content
stringlengths 5
1.05M
|
|---|
Locales['sv'] = {
-- Cloakroom
['cloakroom'] = 'Omklädnignsrum',
['ems_clothes_civil'] = 'Civilkläder',
['ems_clothes_ems'] = 'Ambulanskläder',
-- Vehicles
['veh_menu'] = 'Fordon',
['veh_spawn'] = 'Tryck ~INPUT_CONTEXT~ för att ta fram ett fordon',
['store_veh'] = 'Tryck ~INPUT_CONTEXT~ för att lagra fordonet',
['ambulance'] = 'Ambulans',
['helicopter'] = 'Helikopter',
-- Action Menu
['hospital'] = 'Sjukhus',
['revive_inprogress'] = 'Återupplivning pågår...',
['revive_complete'] = 'du har återupplivat ~y~%s~s~, bra jobbat!',
['revive_complete_award'] = 'du har återupplivat ~y~%s~s~ och tjärnat ~g~$%s~s~ i processen, bra jobbat!',
['heal_inprogress'] = 'du behandlar patienten!',
['heal_complete'] = 'du har behandlat ~y~%s~s~',
['no_players'] = 'Inga spelare i närheten!',
['no_vehicles'] = 'Inga fordon i närheten!',
['player_not_unconscious'] = 'spelaren är inte medvetslös!',
['player_not_conscious'] = 'spelaren är inte vid medvetande!',
-- Boss Menu
['deposit_society'] = 'Sjukvårdens insättning',
['withdraw_society'] = 'Sjukvårdens uttagning',
['boss_actions'] = 'Chef meny',
-- Misc
['invalid_amount'] = '~r~Ogiltig mängd',
['open_menu'] = 'Teyck ~INPUT_CONTEXT~ för att öppna menyn',
['deposit_amount'] = 'Mängd att sätta in',
['money_withdraw'] = 'Mängd att ta ut',
['fast_travel'] = 'Tryck på ~INPUT_CONTEXT~ för att snabbresa.',
['open_pharmacy'] = 'Tryck på ~INPUT_CONTEXT~ för att öppna apoteket.',
['pharmacy_menu_title'] = 'Apotek',
['pharmacy_take'] = 'Ta',
['medikit'] = 'Medicinkit',
['bandage'] = 'Bandage',
['max_item'] = 'Du har redan tillräckligt mycket på dig.',
-- F6 Menu
['ems_menu'] = 'Ambulansmeny',
['ems_menu_title'] = 'Ambulansmeny',
['ems_menu_revive'] = 'Återuppliva spelare',
['ems_menu_putincar'] = 'Sätt i fordon',
['ems_menu_small'] = 'Behandla mindre skador',
['ems_menu_big'] = 'Behandla svåra skador',
-- Phone
['alert_ambulance'] = 'Ring ambulansen',
-- Death
['respawn_at_hospital'] = 'Vill du snabbresa till sjukhuset?',
['yes'] = 'ja',
['no'] = 'nej',
['please_wait'] = 'du är medvetslös och kommer att dö om ~b~%s minuter och %s sekunder~s~',
['press_respawn'] = 'tryck [~b~E~w~] för att respawna.',
['respawn_fine'] = 'du betalade ~r~$%s~s~ för att respawna.',
['distress_send'] = 'tryck ~b~[G]~s~ för att skicka nödsignal',
['distress_sent'] = 'nödsignal har skickats till samtliga enheter!',
['distress_message'] = 'läkarvård krävs: medvetslös medborgare!',
-- Revive
['revive_help'] = 'Återuppliva en spelare',
-- Item
['used_medikit'] = 'Du har använt ~y~1x~s~ ~b~Medecinkit~s~',
['used_bandage'] = 'Du har använt ~y~1x~s~ ~b~Bandage~s~',
['not_enough_medikit'] = 'Du har inget ~b~Medecinkit~w~.',
['not_enough_bandage'] = 'Du har inget ~b~Bandage~w~.',
['healed'] = 'dina skador har blivit behandlade.',
-- Misc
}
|
--[[
--MIT License
--
--Copyright (c) 2019 PapyElGringo
--Copyright (c) 2019 Tom Meyers
--
--Permission is hereby granted, free of charge, to any person obtaining a copy
--of this software and associated documentation files (the "Software"), to deal
--in the Software without restriction, including without limitation the rights
--to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
--copies of the Software, and to permit persons to whom the Software is
--furnished to do so, subject to the following conditions:
--
--The above copyright notice and this permission notice shall be included in all
--copies or substantial portions of the Software.
--
--THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
--IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
--FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
--AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
--LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
--OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
--SOFTWARE.
]]
-- Load these libraries (if you haven't already)
local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
-- Create the box
local anti_aliased_wibox = wibox({visible = true, ontop = true, type = "normal", height = 100, width = 100})
-- Place it at the center of the screen
awful.placement.centered(anti_aliased_wibox)
-- Set transparent bg
anti_aliased_wibox.bg = "#00000000"
-- Put its items in a shaped container
anti_aliased_wibox:setup {
-- Container
{
-- Items go here
awful.spawn('st'),
-- ...
layout = wibox.layout.fixed.vertical
},
-- The real background color
bg = "#111111",
-- The real, anti-aliased shape
shape = gears.shape.rounded_rect,
widget = wibox.container.background()
}
|
--- === plugins.core.tangent.os.window ===
---
--- Window Management Tools for Tangent.
local require = require
local i18n = require("cp.i18n")
local plugin = {
id = "core.tangent.os.window",
group = "core",
dependencies = {
["core.tangent.os"] = "osGroup",
["finder.window"] = "win",
}
}
function plugin.init(deps)
local win = deps.win
local group = deps.osGroup:group(i18n("windowManagement"))
local id = 0x0AC00001
--------------------------------------------------------------------------------
-- Grid:
--------------------------------------------------------------------------------
group:action(id, i18n("cpShowGrid" .. "_title"))
:onPress(win.grid)
id = id + 1
--------------------------------------------------------------------------------
-- Center Cursor:
--------------------------------------------------------------------------------
group:action(id, i18n("cpCenterCursor" .. "_title"))
:onPress(win.centerCursor)
id = id + 1
--------------------------------------------------------------------------------
-- Hints:
--------------------------------------------------------------------------------
group:action(id, i18n("cpWindowHints" .. "_title"))
:onPress(win.hints)
id = id + 1
--------------------------------------------------------------------------------
-- Move Window to Screen:
--------------------------------------------------------------------------------
group:action(id, i18n("cpMoveWindowLeft" .. "_title"))
:onPress(function() win.moveCurrentWindowToScreen("left") end)
id = id + 1
group:action(id, i18n("cpMoveWindowRight" .. "_title"))
:onPress(function() win.moveCurrentWindowToScreen("right") end)
id = id + 1
group:action(id, i18n("cpMoveWindowUp" .. "_title"))
:onPress(function() win.moveCurrentWindowToScreen("up") end)
id = id + 1
group:action(id, i18n("cpMoveWindowDown" .. "_title"))
:onPress(function() win.moveCurrentWindowToScreen("down") end)
id = id + 1
group:action(id, i18n("cpMoveWindowNext" .. "_title"))
:onPress(function() win.moveCurrentWindowToScreen("next") end)
id = id + 1
--------------------------------------------------------------------------------
-- Move & Resize:
--------------------------------------------------------------------------------
group:action(id, i18n("cpMoveAndResizeHalfLeft" .. "_title"))
:onPress(function() win.moveAndResize("halfleft") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeHalfRight" .. "_title"))
:onPress(function() win.moveAndResize("halfright") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeHalfUp" .. "_title"))
:onPress(function() win.moveAndResize("halfup") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeHalfDown" .. "_title"))
:onPress(function() win.moveAndResize("halfdown") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeCornerNorthWest" .. "_title"))
:onPress(function() win.moveAndResize("cornerNW") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeCornerNorthEast" .. "_title"))
:onPress(function() win.moveAndResize("cornerNE") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeCornerSouthWest" .. "_title"))
:onPress(function() win.moveAndResize("cornerSW") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeCornerSouthEast" .. "_title"))
:onPress(function() win.moveAndResize("cornerSE") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeFullscreen" .. "_title"))
:onPress(function() win.moveAndResize("fullscreen") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeCenter" .. "_title"))
:onPress(function() win.moveAndResize("center") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeExpand" .. "_title"))
:onPress(function() win.moveAndResize("expand") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeShrink" .. "_title"))
:onPress(function() win.moveAndResize("shrink") end)
id = id + 1
group:action(id, i18n("cpMoveAndResizeUndo" .. "_title"))
:onPress(win.undo)
id = id + 1
--------------------------------------------------------------------------------
-- Step Resize:
--------------------------------------------------------------------------------
group:action(id, i18n("cpStepResizeLeft" .. "_title"))
:onPress(function() win.stepResize("left") end)
id = id + 1
group:action(id, i18n("cpStepResizeRight" .. "_title"))
:onPress(function() win.stepResize("right") end)
id = id + 1
group:action(id, i18n("cpStepResizeUp" .. "_title"))
:onPress(function() win.stepResize("up") end)
id = id + 1
group:action(id, i18n("cpStepResizeDown" .. "_title"))
:onPress(function() win.stepResize("down") end)
id = id + 1
--------------------------------------------------------------------------------
-- Step Move:
--------------------------------------------------------------------------------
group:action(id, i18n("cpStepMoveLeft" .. "_title"))
:onPress(function() win.stepMove("left") end)
id = id + 1
group:action(id, i18n("cpStepMoveRight" .. "_title"))
:onPress(function() win.stepMove("right") end)
id = id + 1
group:action(id, i18n("cpStepMoveUp" .. "_title"))
:onPress(function() win.stepMove("up") end)
id = id + 1
group:action(id, i18n("cpStepMoveDown" .. "_title"))
:onPress(function() win.stepMove("down") end)
return group
end
return plugin
|
--[[------------------------------------------------------------------
Custom addon logging.
]]--------------------------------------------------------------------
local PRINT_FORMAT = '[%s] <%s> %s'
GSRCHUD.log = {
INFO = 'INFO',
FINE = 'FINE',
WARN = 'WARN',
CRITICAL = 'ERROR'
}
--[[------------------------------------------------------------------
Prints a custom message on the console.
@param {string} message
@param {LOG_} log message type
]]--------------------------------------------------------------------
function GSRCHUD.print(message, log)
if not GSRCHUD.config.getConsoleWarn() and log == GSRCHUD.log.WARN then return end
log = log or GSRCHUD.log.INFO
print(string.format(PRINT_FORMAT, GSRCHUD.name, log, message))
end
|
-- ----------------------------------------------
-- Copyright (c) 2018, CounterFlow AI, Inc. All Rights Reserved.
-- author: Randy Caldejon <rc@counterflowai.com>
--
-- Use of this source code is governed by a BSD-style
-- license that can be found in the LICENSE.txt file.
-- ----------------------------------------------
-- ----------------------------------------------
-- On setup, download ipblocklist from abuse.ch
-- On loop, check for membership in the list, and cache the results
-- ----------------------------------------------
filename = "badip.txt"
file_url = "https://zeustracker.abuse.ch/blocklist.php?download=ipblocklist"
redis_key = "bad.ip"
-- ----------------------------------------------
--
-- ----------------------------------------------
function setup()
conn = hiredis.connect()
if not conn then
error ("Error connecting to the redis server")
end
if conn:command("PING") ~= hiredis.status.PONG then
error ("Unable to ping redis")
end
http_get (file_url, filename)
local file, err = io.open(filename, 'rb')
if file then
conn:command("DEL",redis_key)
while true do
line = file:read()
if line ==nil then
break
elseif line ~='' and not line:find("^#") then
if (conn:command("SADD",redis_key,line)==1) then
print (line)
end
end
end
end
print (">>>>Bad IP analyzer running")
end
-- ----------------------------------------------
--
-- ----------------------------------------------
function loop(msg)
local eve = cjson.decode(msg)
if eve and eve.event_type == "flow" and conn:command("SISMEMBER",redis_key, eve.dest_ip) == 1 then
message = "time: "..eve.timestamp..", dest_ip: "..eve.dest_ip..", flow_id: "..eve.flow_id..", alerted: "..tostring(eve.flow.alerted)
print ("flow-alert: "..message)
dragonfly.output_event ("flow", message)
--ip_reputation (eve.timestamp, "blacklist", eve.dns.rdata, 300)
end
end
|
local test = {}
test['should upper first string'] = function()
str1 = "this is a test"
str2 = "This is a test"
assert( str1:capitalize() == str2 )
end
test['should keep first string upper'] = function()
str1 = "This is a test"
str2 = "This is a test"
assert( str1:capitalize() == str2 )
end
test['should keep blank string first'] = function()
str1 = " This is a test"
str2 = " This is a test"
assert( str1:capitalize() == str2 )
end
return test
|
-----------------------------------
-- Area: Tahrongi Canyon
-- Mob: Habrok
-----------------------------------
function onMobInitialize(mob)
mob:setLocalVar("pop", os.time() + math.random(1200,7200))
end
function onMobDeath(mob, player, isKiller)
end
function onMobDespawn(mob)
UpdateNMSpawnPoint(mob:getID())
mob:setLocalVar("pop", os.time() + math.random(1200,7200))
end
|
-- IRC Parser.
--[[
The MIT License (MIT)
Copyright (c) 2015 - 2016 Adrian Pistol
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]
local _M = {}
_M.version = "0.0.1"
function _M.parse(message)
local prefix_end = 0
local prefix;
if message:sub(1, 1) == ":" then
prefix_end = message:find(" ")
prefix = message:sub(2, message:find(" ") - 1)
end
local trailing
local tstart = message:find(" :")
if tstart then
trailing = message:sub(tstart + 2)
else
tstart = #message
end
local rest = {}
for t in (message:sub(prefix_end + 1, tstart)):gmatch("%S+") do
table.insert(rest, t)
end
local command = rest[1]
table.remove( rest, 1 )
return prefix, command, rest, trailing
end
function _M.event_parse(server, message)
local prefix, command, rest, trailing = _M.parse(message)
if command then
local last = {unpack(rest)}
table.insert(last, trailing)
event.fire("irc:event", server, message, prefix, command, unpack(last))
event.fire("irc:"..string.lower(command), server, prefix, unpack(last))
else
event.fire("irc:other", server, message)
end
end
return _M
|
local entity_name = "combinator-construction"
local entity = table.deepcopy(data.raw["constant-combinator"]["constant-combinator"])
entity.name = entity_name
entity.minable.result = entity_name
local item = table.deepcopy(data.raw.item["constant-combinator"])
item.name = entity_name
item.place_result = entity_name
item.localised_name = entity.localised_name
local recipe = table.deepcopy(data.raw.recipe["constant-combinator"])
recipe.name = entity_name
recipe.result = entity_name
table.insert(recipe.ingredients, {"advanced-circuit", 5})
local tech = table.deepcopy(data.raw.technology["circuit-network"])
tech.name = entity_name
tech.prerequisites = {"circuit-network", "construction-robotics"}
tech.effects = { {type="unlock-recipe", recipe=recipe.name } }
tech.unit.count = math.floor(tech.unit.count*2.0)
data:extend{entity, item, recipe, tech}
|
object_static_particle_pt_halloween_ghost_fog = object_static_particle_shared_pt_halloween_ghost_fog:new {
}
ObjectTemplates:addTemplate(object_static_particle_pt_halloween_ghost_fog, "object/static/particle/pt_halloween_ghost_fog.iff")
|
local helpers = require "spec.helpers"
local jwtParser = require "kong.plugins.jwt.jwt_parser"
-- local jwt_for_test = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJ0ZXN0X2tleSJ9.Uj1YcRCeGAElh8zl6wm_RjjLzJ86GRoD5htP7HOx9yg"
local algo = 'HS256'
local test_key = 'test_key'
local test_secret = 'test_secret'
local test_claim1_value = 'test_claim1_value'
local test_claim2_value = 'test_claim2_value'
local iss_custom_header = "issCustomHeader"
local claim1_custom_header = "claim1CustomHeader"
local jwt_for_test = jwtParser.encode({
iss = test_key,
claim1 = test_claim1_value,
claim2 = test_claim2_value
}, test_secret, algo)
local test_prefix = "X-MyPrefix-"
local jwt_param_name = "custom_jwt"
-- The source code to setup and teardown Kong was borrowed from the Kong project
-- spec/fixture contains fixtures directly borrowed from the Kong project
local function create_route(host_name, jwt_config, jwt_claims_to_header_config, bp)
local routeWithDefaults = bp.routes:insert({
hosts = { host_name },
})
bp.plugins:insert {
name = "jwt",
route = {id = routeWithDefaults.id},
config = jwt_config,
}
bp.plugins:insert {
name = "jwt-claims-to-headers",
route = {id = routeWithDefaults.id},
config = jwt_claims_to_header_config,
}
end
for _, strategy in helpers.each_strategy() do
describe("Jwt-Claims-to-Headers-Plugin: (access) [#" .. strategy .. "]", function()
local client
local bp = helpers.get_db_utils(strategy)
setup(function()
-- create a route to test each parameter
create_route("test-defaults.com", {}, {}, bp)
create_route("test-header-prefix.com", {}, { header_prefix = test_prefix }, bp)
create_route("test-claims-to-headers-table.com",
{},
{
claims_to_headers_table = {
iss = iss_custom_header,
claim1 = claim1_custom_header
}
},
bp)
create_route("test-uri-param-names.com",
{
uri_param_names= { jwt_param_name },
},
{
uri_param_names = { jwt_param_name }
},
bp)
-- create consumer
local consumer = bp.consumers:insert {
username = "testUser1",
custom_id = "testCustomId"
}
print("Created consumer id " .. consumer.id ..
", at epoch time " .. consumer.created_at)
-- create jwt_secret
local jwt_secret = bp.jwt_secrets:insert {
consumer = {id = consumer.id},
secret = test_secret,
key = test_key
}
print("Created jwt_secret id " .. jwt_secret.id ..
", at epoch time " .. jwt_secret.created_at ..
", key " .. jwt_secret.key ..
", secret " .. jwt_secret.secret)
-- start kong
assert(helpers.start_kong({
-- set the strategy
database = strategy,
-- use the custom test template to create a local mock server
nginx_conf = "spec/fixtures/custom_nginx.template",
-- set the config item to make sure our plugin gets loaded
plugins = "bundled,jwt,jwt-claims-to-headers",
}))
end)
teardown(function()
-- TODO: delete the consumer with id consumer_id, and the jwt_secret with id jwt_secret_id
-- TODO: delete the hosts and routes
-- bp.jwt_secrets:delete()
helpers.stop_kong(nil, true)
end)
before_each(function()
client = helpers.proxy_client()
end)
after_each(function()
if client then client:close() end
end)
describe("request", function()
it("with the 'jwt' query parameter, contains the X-claims header", function()
local r = assert(client:send {
method = "GET",
path = "/request", -- makes mockbin return the entire request
headers = {
host = "test-defaults.com"
},
query= { jwt = jwt_for_test }
})
-- validate that the request succeeded, response status 200
assert.response(r).has.status(200)
-- now check the request (as echoed by mockbin) to have the headers
local header_value_claim_iss = assert.request(r).has.header("X-Jwt-Claim-iss")
local header_value_claim1 = assert.request(r).has.header("X-Jwt-Claim-claim1")
local header_value_claim2 = assert.request(r).has.header("X-Jwt-Claim-claim2")
-- validate the value of the headers
assert.equal(test_key, header_value_claim_iss)
assert.equal(test_claim1_value, header_value_claim1)
assert.equal(test_claim2_value, header_value_claim2)
end)
it("with a jwt as the Bearer token, contains the X-claims header", function()
local r = assert(client:send {
method = "GET",
path = "/request", -- makes mockbin return the entire request
headers = {
authorization = "Bearer " .. jwt_for_test,
host = "test-defaults.com"
}
})
-- validate that the request succeeded, response status 200
assert.response(r).has.status(200)
-- now check the request (as echoed by mockbin) to have the headers
local header_value_claim_iss = assert.request(r).has.header("X-Jwt-Claim-iss")
local header_value_claim1 = assert.request(r).has.header("X-Jwt-Claim-claim1")
local header_value_claim2 = assert.request(r).has.header("X-Jwt-Claim-claim2")
-- validate the value of the headers
assert.equal(test_key, header_value_claim_iss)
assert.equal(test_claim1_value, header_value_claim1)
assert.equal(test_claim2_value, header_value_claim2)
end)
end)
describe("request with config parameters", function()
it("with the 'prefix' config parameter, uses the prefix in the header names", function()
local r = assert(client:send {
method = "GET",
path = "/request", -- makes mockbin return the entire request
headers = {
host = "test-header-prefix.com"
},
query= { jwt = jwt_for_test }
})
-- validate that the request succeeded, response status 200
assert.response(r).has.status(200)
-- now check the request (as echoed by mockbin) to have the headers
local header_value_claim_iss = assert.request(r).has.header(test_prefix .. "iss")
local header_value_claim1 = assert.request(r).has.header(test_prefix .. "claim1")
local header_value_claim2 = assert.request(r).has.header(test_prefix .. "claim2")
-- validate the value of the headers
assert.equal(test_key, header_value_claim_iss)
assert.equal(test_claim1_value, header_value_claim1)
assert.equal(test_claim2_value, header_value_claim2)
end)
it("with the 'claims_to_headers_table' config parameter, uses the custom headers", function()
local r = assert(client:send {
method = "GET",
path = "/request", -- makes mockbin return the entire request
headers = {
host = "test-claims-to-headers-table.com"
},
query= { jwt = jwt_for_test }
})
-- validate that the request succeeded, response status 200
assert.response(r).has.status(200)
-- now check the request (as echoed by mockbin) to have the headers
local header_value_claim_iss = assert.request(r).has.header(iss_custom_header)
local header_value_claim1 = assert.request(r).has.header(claim1_custom_header)
-- validate the value of the headers
assert.equal(test_key, header_value_claim_iss)
assert.equal(test_claim1_value, header_value_claim1)
end)
it("with uri_param_names specifying the location of the jwt, contains the X-claims header", function()
local r = assert(client:send {
method = "GET",
path = "/request", -- makes mockbin return the entire request
headers = {
host = "test-uri-param-names.com"
},
query= { custom_jwt = jwt_for_test }
})
-- validate that the request succeeded, response status 200
assert.response(r).has.status(200)
-- now check the request (as echoed by mockbin) to have the headers
local header_value_claim_iss = assert.request(r).has.header("X-Jwt-Claim-iss")
local header_value_claim1 = assert.request(r).has.header("X-Jwt-Claim-claim1")
local header_value_claim2 = assert.request(r).has.header("X-Jwt-Claim-claim2")
-- validate the value of the headers
assert.equal(test_key, header_value_claim_iss)
assert.equal(test_claim1_value, header_value_claim1)
assert.equal(test_claim2_value, header_value_claim2)
end)
end)
describe("response", function()
it("with the 'jwt' query parameter, contains the X-claims header", function()
local r = assert(client:send {
method = "GET",
path = "/request", -- makes mockbin return the entire request
headers = {
host = "test-defaults.com",
},
query= { jwt = jwt_for_test }
})
-- validate that the request succeeded, response status 200
assert.response(r).has.status(200)
-- now check the response to have the headers
local header_value_claim_iss = assert.request(r).has.header("X-Jwt-Claim-iss")
local header_value_claim1 = assert.request(r).has.header("X-Jwt-Claim-claim1")
local header_value_claim2 = assert.request(r).has.header("X-Jwt-Claim-claim2")
-- validate the value of that headers
assert.equal(test_key, header_value_claim_iss)
assert.equal(test_claim1_value, header_value_claim1)
assert.equal(test_claim2_value, header_value_claim2)
end)
it("with a jwt as the Bearer token, contains the X-claims header", function()
local r = assert(client:send {
method = "GET",
path = "/request", -- makes mockbin return the entire request
headers = {
authorization = "Bearer " .. jwt_for_test,
host = "test-defaults.com",
}
})
-- validate that the request succeeded, response status 200
assert.response(r).has.status(200)
-- now check the response to have the headers
local header_value_claim_iss = assert.request(r).has.header("X-Jwt-Claim-iss")
local header_value_claim1 = assert.request(r).has.header("X-Jwt-Claim-claim1")
local header_value_claim2 = assert.request(r).has.header("X-Jwt-Claim-claim2")
-- validate the value of that headers
assert.equal(test_key, header_value_claim_iss)
assert.equal(test_claim1_value, header_value_claim1)
assert.equal(test_claim2_value, header_value_claim2)
end)
end)
describe("unauthorized", function()
it("should return Unauthorized", function()
-- send requests through Kong
local r = assert(client:send {
method = "GET",
path = "/request", -- makes mockbin return the entire request
headers = {
host = "test-defaults.com",
}
})
assert.response(r).has.status(401)
end)
end)
describe("/not-a-route", function()
it("should return not found", function()
-- send requests through Kong
local res = client:get("/not-a-route", {
headers = {
["Host"] = "test.com"
}
})
assert.res_status(404, res)
end)
end)
end)
end
|
local view = { path = "/view/r2"}
function view.route( content )
return "<h1> r2 route</h1>"
end
return view
|
module(context("afk-kick+ does not error", "initialized"), lunity)
function arrange()
stub(TGNSMessageDisplayer, 'Create')
return loadPlugin("improvedafkhandler")
end
function act(sut)
return sut:Initialise()
end
function should_enable_plugin(params)
assert.is_true(params.sut.Enabled)
__assertionSucceeded()
end
function should_return_true(params)
assert.is_nil(params.error)
__assertionSucceeded()
assert.is_true(params.result)
__assertionSucceeded()
end
runTests{useANSI = false}
module(context("afk-kick+ resets afk timer and does not error", "client connects & disconnects"), lunity)
function arrange()
stub(TGNSMessageDisplayer, 'Create')
return loadPlugin("improvedafkhandler")
end
function act(sut)
sut:Initialise()
local playerAfk = sut:GetPlayerAFK()
local fakeClient = { GetIsVirtual = function(self) return false end }
local fakePlayer = {}
local OldGetPlayer = GetPlayer
GetPlayer = function(cl)
if cl == fakeClient then return fakePlayer end
if OldGetPlayer then return OldGetPlayer(cl) else return nil end
end
return playerAfk, fakeClient, fakePlayer
end
function should_handle_client_connection(params)
local sut = params.sut
local playerAfk, fakeClient, fakePlayer = params.result, params.result2, params.result3
spy.on(playerAfk, "ResetAFKTimer")
sut:ClientConnect( fakeClient )
assert.spy(playerAfk.ResetAFKTimer).was_called()
__assertionSucceeded()
assert.spy(playerAfk.ResetAFKTimer).was_called_with(playerAfk, fakeClient)
__assertionSucceeded()
assert.has_no.errors(function() sut:ClientDisconnect( fakeClient ) end)
__assertionSucceeded()
playerAfk.ResetAFKTimer:revert()
end
runTests{useANSI=false}
local OldGetPlayer = GetPlayer
local OldGetOwner = GetOwner
local OldGetGamerules = GetGamerules
module(context("afk-kick+ does not error and resets afk timers appropriately", "various hooks are called"), lunity)
function arrange()
stub(TGNSMessageDisplayer, 'Create')
return loadPlugin("improvedafkhandler")
end
function act(sut)
sut:Initialise()
local playerAfk = sut:GetPlayerAFK()
local fakeClient = { GetIsVirtual = function(self) return false end }
local fakePlayer = {}
_G.GetPlayer = function(cl)
if cl == fakeClient then return fakePlayer end
if OldGetPlayer then return OldGetPlayer(cl) else return nil end
end
_G.GetOwner = function(pl)
if pl == fakePlayer then
return fakeClient
elseif OldGetOwner then
return OldGetOwner(pl)
else
return nil
end
end
local TmpGamerules = { GetGameStarted = function() return true end }
_G.GetGamerules = function()
return TmpGamerules
end
sut:ClientConnect( fakeClient )
return playerAfk, fakeClient, fakePlayer
end
local function GetFakeBuilding( OwnerPlayer )
local building = {
GetTeam = function()
local theTeam = {
GetCommander = function()
return OwnerPlayer
end
}
return theTeam
end,
GetOwner = function()
return OwnerPlayer
end
}
return building
end
local function check( fName, params, ... )
local sut = params.sut
local playerAfk, fakeClient, fakePlayer = params.result, params.result2, params.result3
local resetAfkSpy = spy.on(playerAfk, "ResetAFKTimer")
local func = sut[fName]
if func == nil then
require 'pl.pretty'.dump(sut)
error("Function " .. fName .. " not found")
end
arg.n = nil
local notCalled = false
for i = 1, #arg do
if arg[i] == 'sut' then arg[i] = sut
elseif arg[i] == 'playerAfk' then arg[i] = playerAfk
elseif arg[i] == 'fakeClient' then arg[i] = fakeClient
elseif arg[i] == 'fakePlayer' then arg[i] = fakePlayer
elseif arg[i] == 'fakeBuilding' then arg[i] = GetFakeBuilding( fakePlayer )
elseif arg[i] == 'checkNotCalled' then
notCalled = true
local nArg = #arg
for j = i + 1, nArg do
arg[j - 1] = arg[j]
end
end
end
-- assert.has_no.errors(function() func( sut, arg ) end )
local success, err = pcall( function() func( sut, unpack( arg ) ) end ) -- Better errors this way.
if success then
__assertionSucceeded()
else
error( 'Hook Check of ' .. fName .. ' failed: ' .. err )
end
if not notCalled then
assert.spy(resetAfkSpy).was_called()
__assertionSucceeded()
assert.spy(resetAfkSpy).was_called_with( playerAfk, fakeClient )
__assertionSucceeded()
else
assert.spy(resetAfkSpy).was_not_called()
__assertionSucceeded()
end
end
function should_handle_confirmconnect( params )
check( 'ClientConfirmConnect', params, 'fakeClient' )
end
function should_handle_processmove( params )
local Input = {
pitch = 0,
yaw = 0,
move = {
x = 1,
y = 0,
z = 0
}
}
check( 'OnProcessMove', params, 'fakePlayer', Input )
Input.move.x = 0
Input.pitch = 3
check( 'OnProcessMove', params, 'fakePlayer', Input )
check( 'OnProcessMove', params, 'fakePlayer', Input, 'checkNotCalled' )
end
function should_handle_namechange( params )
check( 'PlayerNameChange', params, 'fakePlayer' )
end
function should_handle_say( params )
check( 'PlayerSay', params, 'fakeClient' )
end
function should_handle_comm_functions( params )
check( 'CommLoginPlayer', params, 'fakeBuilding', 'fakePlayer' )
check( 'OnConstructInit', params, 'fakeBuilding' )
check( 'OnCommanderTechTreeAction', params, 'fakePlayer' )
check( 'OnRecycle', params, 'fakeBuilding' )
check( 'OnCommanderNotify', params, 'fakePlayer' )
check( 'CommLogout', params, 'fakePlayer' )
end
function teardown( params )
GetOwner = OldGetOwner
GetPlayer = OldGetPlayer
GetGamerules = OldGetGamerules
end
runTests{useANSI=false}
|
--[[
Copyright (C) 2014 HarpyWar (harpywar@gmail.com)
This file is a part of the PvPGN Project http://pvpgn.pro
Licensed under the same terms as Lua itself.
]]--
-- Loop each second
function handle_server_mainloop()
-- Tick all timers
for t in pairs(__timers) do
__timers[t]:tick()
end
-- DEBUG(os.time())
end
-- When restart Lua VM
function handle_server_rehash()
if (config.ghost) then
gh_unload()
end
end
|
--- Time string module. Carry ISO format and custom delta format
-- ISO format:
-- format: yyyy-mm-ddThh:mm:ss.ffffff
-- example: 2008-09-15T15:53:00
-- 2008-09-15T15:53:00+05:00
-- Delta format:
-- format: 1Y 10M 2W 1D 12h 30m
-- example: 1Y, 1h 30m, 10D
local M = {}
local function parse_date(str)
local Y, MM, D = str:match("^(%d%d%d%d)-?(%d%d)-?(%d%d)")
return tonumber(Y), tonumber(MM), tonumber(D)
end
local function parse_time(str)
local h, m, s = str:match("T(%d%d):?(%d%d):?(%d%d)")
return tonumber(h) or 0, tonumber(m) or 0, tonumber(s) or 0
end
local function parse_offset(str)
if str:sub(-1)=="Z" then return 0,0 end -- ends with Z, Zulu time
-- matches ±hh:mm, ±hhmm or ±hh; else returns nils
local sign, oh, om = str:match("([-+])(%d%d):?(%d?%d?)$")
sign, oh, om = sign or "+", oh or "00", om or "00"
return tonumber(sign .. oh) or 0, tonumber(sign .. om) or 0
end
--- Get the table with delta times
-- @tparam string str In format: "1Y 10M 2W 1D 12h 30m". Can pass part of time
-- @local
local function get_delta_time(str)
local year = tonumber(str:match("(%d?)Y")) or 0
local month = tonumber(str:match("(%d?%d?)M")) or 0
local week = tonumber(str:match("(%d?)W")) or 0
local day = tonumber(str:match("(%d?%d?)D")) or 0
local hour = tonumber(str:match("(%d?%d?)h")) or 0
local min = tonumber(str:match("(%d?%d?)m")) or 0
return {
year = year,
month = month,
day = week*7 + day,
hour = hour,
min = min
}
end
--- Get seconds from ISO string time format
-- @tparam string str time in ISO format in GMT time
-- @tparam boolean in_gmt If true, return time in GMT format
function M.parse_ISO(str, in_gmt)
local Y, MM, D = parse_date(str)
local h, m, s = parse_time(str)
local oh, om = parse_offset(str)
local time = os.time({ year=Y, month=MM, day=D, hour=(h+oh), min=(m+om), sec=s })
if in_gmt then
time = time + M.get_timezone_offset(time)
end
return time
end
--- Get time in ISO format from seconds
-- @tparam number seconds The time in seconds to convert in ISO format
-- @tparam boolean in_gmt If true, return time in GMT format
function M.get_ISO(seconds, in_gmt)
local time = seconds
if in_gmt then
time = seconds - M.get_timezone_offset(seconds)
end
return os.date("%Y-%m-%dT%TZ", time)
end
--- Return next time in seconds on event
-- @tparam number start_time date in seconds
-- @tparam string delta_time delta in next format: "1Y 10M 2W 1D 12h 30m". Can pass part of time
-- @tparam[opt] number cur_time date in seconds. local time by default
function M.get_next_time(start_time, delta_time, cur_time)
cur_time = cur_time or socket.gettime()
local cur_table = os.date("*t", start_time)
local time = os.time(cur_table)
local delta = get_delta_time(delta_time)
while time < cur_time do
cur_table.year = cur_table.year + delta.year
cur_table.month = cur_table.month + delta.month
cur_table.day = cur_table.day + delta.day
cur_table.hour = cur_table.hour + delta.hour
cur_table.min = cur_table.min + delta.min
time = os.time(cur_table)
end
return time
end
--- Convert Delta string format to seconds
function M.get_delta_seconds(delta_str)
local time_table = get_delta_time(delta_str)
local seconds = 0
seconds = seconds + time_table.min * 60
seconds = seconds + time_table.hour * 60 * 60
seconds = seconds + time_table.day * 60 * 60 * 24
seconds = seconds + time_table.month * 60 * 60 * 24 * 30
seconds = seconds + time_table.year * 60 * 60 * 24 * 365
return seconds
end
--- Return timezone offset from local time to GMT for timestamp
-- @tparam number ts The timestamp in seconds
function M.get_timezone_offset(ts)
local utcdate = os.date("!*t", ts)
local localdate = os.date("*t", ts)
localdate.isdst = false -- this is the trick
return os.difftime(os.time(localdate), os.time(utcdate))
end
return M
|
object_mobile_warren_hawk_bat = object_mobile_shared_warren_hawk_bat:new {
}
ObjectTemplates:addTemplate(object_mobile_warren_hawk_bat, "object/mobile/warren_hawk_bat.iff")
|
local color = 'catppuccin'
-- local color = 'gruvbox_material'
-- local color = 'github'
-- vim.g.gruvbox_material_disable_italic_comment = true
vim.g.everforest_background = 'hard'
vim.g.everforest_disable_italic_comment = true
vim.cmd([[
function! OverrideHighlights() abort
highlight IndentBlanklineIndent1 guifg=#E06C75
highlight IndentBlanklineIndent2 guifg=#E5C07B
highlight IndentBlanklineIndent3 guifg=#98C379
highlight IndentBlanklineIndent4 guifg=#56B6C2
highlight IndentBlanklineIndent5 guifg=#61AFEF
highlight IndentBlanklineIndent6 guifg=#C678DD
highlight LspDiagnosticsVirtualTextError guifg = #E06C75 gui=bold,italic,underline
highlight LspDiagnosticsVirtualTextWarning guifg = #E5C07B gui=bold,italic,underline
highlight LspDiagnosticsVirtualTextInformation guifg = #56B6C2 gui=bold,italic,underline
highlight LspDiagnosticsVirtualTextHint guifg = #98C379 gui=bold,italic,underline
endfunction
augroup OverrideColors
autocmd!
autocmd colorscheme * call OverrideHighlights()
augroup END
]])
vim.cmd('colorscheme ' .. color)
vim.opt.background = 'dark'
local lualine = require('config/lualine')
lualine.setup('auto')
|
-- -
--- Created by Ray1184.
--- DateTime: 04/10/2020 17:04
-- -
--- Animated stateful game object.
-- -
dependencies = {
'libs/Context.lua',
'libs/utils/Utils.lua',
'libs/logic/templates/GameItem.lua',
'libs/backend/HPMSFacade.lua',
'thirdparty/Inspect.lua',
'libs/logic/GameMechanicsConsts.lua'
}
anim_game_item = { }
ANIM_MODE_LOOP = 0
ANIM_MODE_ONCE = 1
ANIM_MODE_FRAME = 2
function anim_game_item:ret(path, id)
lib = backend:get()
k = game_mechanics_consts:get()
insp = inspector:get()
local id = 'anim_game_item/' .. id
local ret = game_item:ret(path, id)
local this = context:inst():get(cats.OBJECTS, id,
function()
log_debug('New anim_game_item object ' .. id)
local new = {
serializable =
{
id = id,
anim_data =
{
channel_name = k.default_animations.IDLE,
mode = ANIM_MODE_FRAME,
playing = false,
changed = true,
slowdown = 1,
slice = 1
}
}
}
return merge_tables(ret, new)
end )
local metainf =
{
metainfo =
{
object_type = 'anim_game_item',
parent_type = 'game_object',
override =
{
game_item =
{
move_dir = ret.move_dir,
rotate = ret.rotate,
delete_transient_data = ret.delete_transient_data,
fill_transient_data = ret.fill_transient_data,
update = ret.update,
kill_instance = ret.kill_instance
}
}
}
}
local this = merge_tables(this, metainf)
setmetatable(this, self)
self.__index = self
self.__tostring = function(o)
return insp.inspect(o)
end
function anim_game_item:move_dir(ratio)
self.metainfo.override.game_item.move_dir(self, ratio)
end
function anim_game_item:rotate(rx, ry, rz)
self.metainfo.override.game_item.rotate(self, rx, ry, rz)
end
function anim_game_item:delete_transient_data()
self.metainfo.override.game_item.delete_transient_data(self)
end
function anim_game_item:fill_transient_data()
self.metainfo.override.game_item.fill_transient_data(self)
end
function anim_game_item:update(tpf)
self.metainfo.override.game_item.update(self)
if self.serializable.expired then
return
end
if self.serializable.anim_data.playing then
if self.serializable.anim_data.mode == ANIM_MODE_ONCE then
local finished = lib.anim_finished(self.transient.entity, self.serializable.anim_data.channel_name)
if finished then
lib.stop_rewind_anim(self.transient.entity)
self.serializable.anim_data.playing = false
return
end
end
time = tpf / self.serializable.anim_data.slowdown
lib.update_anim(self.transient.entity, time, true, 0.5)
if self.serializable.anim_data.mode == ANIM_MODE_FRAME then
self.serializable.anim_data.playing = false
end
end
end
function anim_game_item:set_anim(name)
if self.serializable.expired or self.serializable.anim_data.channel_name == name then
return
end
self.serializable.anim_data.channel_name = name
self.serializable.anim_data.changed = true
end
function anim_game_item:play(mode, slowdown, slice)
if self.serializable.expired or not self.serializable.anim_data.changed then
return
end
self.serializable.anim_data.changed = false
self.serializable.anim_data.mode = mode
self.serializable.anim_data.slowdown = slowdown or 1
self.serializable.anim_data.slice = slice or 1
self.serializable.anim_data.playing = true
lib.slice_anim(self.transient.entity, self.serializable.anim_data.channel_name, self.serializable.anim_data.slice)
lib.play_anim(self.transient.entity, self.serializable.anim_data.channel_name)
end
function anim_game_item:kill_instance()
self.metainfo.override.game_item.kill_instance(self)
end
return this
end
|
print("^^ there are lots of empty lines ^^")
|
local ffi = require('ffi')
ffi.cdef[[
typedef struct
{
float x;
float y;
float z;
} Vector_t;
typedef unsigned long DWORD, *PDWORD, *LPDWORD;
typedef int BOOL;
typedef struct _SECURITY_ATTRIBUTES {
DWORD nLength;
void* lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
typedef uintptr_t (__thiscall* GetClientEntity_4242425_t)(void*, int);
void* __stdcall URLDownloadToFileA(void* LPUNKNOWN, const char* LPCSTR, const char* LPCSTR2, int a, int LPBINDSTATUSCALLBACK);
int AddFontResourceA(const char* unnamedParam1);
bool DeleteUrlCacheEntryA(const char* lpszUrlName);
BOOL CreateDirectoryA(const char* lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
]]
local wininet = ffi.load 'WinInet'
local urlmon = ffi.load 'UrlMon'
local gdi = ffi.load 'Gdi32'
function install_logo_font()
local appdataraw = os.getenv("appdata")
local appdata = string.gsub(appdataraw, "\\", "/")
--ffi.C.CreateDirectoryA(appdata.."/Legendware/Scripts/lib", nil)
local weapon_font_path = appdata.."/Legendware/Scripts/weap_font_esp.ttf"
local weapon_font_download_link = "https://cdn.discordapp.com/attachments/775721640490434610/939223685498298498/weaponfont.ttf"
--print("" .. logo_font_path)
wininet.DeleteUrlCacheEntryA(weapon_font_download_link)
urlmon.URLDownloadToFileA(nil, weapon_font_download_link, weapon_font_path, 0,0)
gdi.AddFontResourceA(weapon_font_path)
end
install_logo_font()
local entity_list_ptr = ffi.cast("void***", utils.create_interface("client.dll", "VClientEntityList003"))
local get_client_entity_fn = ffi.cast("GetClientEntity_4242425_t", entity_list_ptr[0][3])
local fonts = {
main = render.create_font("verdana", 12, 400, false, true, false),
sec = render.create_font("Smallest Pixel-7", 11, 300, true, false, true),
weapon = render.create_font("my font", 12, 100, false, false, false)
}
local function get_classes(weapon)
local send = {}
local heavy = 0
local pistol = 1
local auto = 2
local scout = 3
local awp = 4
local rifle = 5
local smg = 6
local shotgun = 7
if weapon == "CDEagle" then
send = {
icon = "A",
config = heavy,
name = "Deagle",
class = "CDEagle"
}
return send
end
if weapon == "CWeaponElite" then
send = {
icon = "B",
config = pistol,
name = "Dual Berettas",
class = "CWeaponElite"
}
return send
end
if weapon == "CWeaponFiveSeven" then
send = {
icon = "C",
config = pistol,
name = "Five Seven",
class = "CWeaponFiveSeven"
}
return send
end
if weapon == "CWeaponGlock" then
send = {
icon = "D",
config = pistol,
name = "Glock",
class = "CWeaponGlock"
}
return send
end
if weapon == "CAK47" then
send = {
icon = "E",
config = rifle,
name = "AK47",
class = "CAK47"
}
return send
end
if weapon == "CWeaponAug" then
send = {
icon = "F",
config = rifle,
name = "Aug",
class = "CWeaponAug"
}
return send
end
if weapon == "CWeaponAWP" then
send = {
icon = "G",
config = awp,
name = "Awp",
class = "CWeaponAWP"
}
return send
end
if weapon == "CWeaponFamas" then
send = {
icon = "H",
config = rifle,
name = "Famas",
class = "CWeaponFamas"
}
return send
end
if weapon == "CWeaponG3SG1" then
send = {
icon = "I",
config = auto,
name = "G3SG1",
class = "CWeaponG3SG1"
}
return send
end
if weapon == "CWeaponGalil" or weapon == "CWeaponGalilAR" then
send = {
icon = "J",
config = rifle,
name = "Galil",
class = "CWeaponGalil"
}
return send
end
if weapon == "CWeaponM4A1" then
send = {
icon = "K",
config = rifle,
name = "M4A1",
class = "CWeaponM4A1"
}
return send
end
if weapon == "CWeaponMAC10" then
send = {
icon = "M",
config = smg,
name = "MAC-10",
class = "CWeaponMAC10"
}
return send
end
if weapon == "CWeaponHKP2000" then
send = {
icon = "N",
config = pistol,
name = "P2000",
class = "CWeaponHKP2000"
}
return send
end
if weapon == "CWeaponUMP45" then
send = {
icon = "O",
config = smg,
name = "UMP45",
class = "CWeaponUMP45"
}
return send
end
if weapon == "CWeaponXM1014" then
send = {
icon = "P",
config = shotgun,
name = "XM1014",
class = "CWeaponXM1014"
}
return send
end
if weapon == "CWeaponBizon" then
send = {
icon = "Q",
config = smg,
name = "PPBizon",
class = "CWeaponBizon"
}
return send
end
if weapon == "CWeaponMag7" then
send = {
icon = "R",
config = shotgun,
name = "MAG7",
class = "CWeaponMag7"
}
return send
end
if weapon == "CWeaponNegev" then
send = {
icon = "S",
config = smg,
name = "Negev",
class = "CWeaponNegev"
}
return send
end
if weapon == "CWeaponSawedoff" then
send = {
icon = "T",
config = shotgun,
name = "Sawedoff",
class = "CWeaponSawedoff"
}
return send
end
if weapon == "CWeaponTec9" then
send = {
icon = "U",
config = pistol,
name = "TEC7",
class = "CWeaponTec9"
}
return send
end
if weapon == "CWeaponTaser" then
send = {
icon = "V",
config = nil,
name = "Taser",
class = "CWeaponTaser"
}
return send
end
if weapon == "CWeaponP250" or weapon == "CWeaponP228" then
send = {
icon = "W",
config = pistol,
name = "P250",
class = "CWeaponP250"
}
return send
end
if weapon == "CWeaponMP7" then
send = {
icon = "X",
config = smg,
name = "MP7",
class = "CWeaponMP7"
}
return send
end
if weapon == "CWeaponMP9" then
send = {
icon = "Y",
config = smg,
name = "MP9",
class = "CWeaponMP9"
}
return send
end
if weapon == "CWeaponNOVA" then
send = {
icon = "Z",
config = shotgun,
name = "Nova",
class = "CWeaponNOVA"
}
return send
end
if weapon == "CWeaponP90" then
send = {
icon = "a",
config = smg,
name = "P90",
class = "CWeaponP90"
}
return send
end
if weapon == "CWeaponSCAR20" then
send = {
icon = "b",
config = auto,
name = "SCAR20",
class = "CWeaponSCAR20"
}
return send
end
if weapon == "CWeaponSG552" or weapon == "CWeaponSG550" or weapon == "CWeaponSG556" then
send = {
icon = "c",
config = rifle,
name = "SG553",
class = "CWeaponSG556"
}
return send
end
if weapon == "CWeaponScout" or weapon == "CWeaponSSG08" then
send = {
icon = "d",
config = scout,
name = "SSG08",
class = "CWeaponScout" or "CWeaponSSG08"
}
return send
end
if weapon == "CFlashbang" then
send = {
icon = "f",
config = nil,
name = "Flashbang",
class = "CFlashbang"
}
return send
end
if weapon == "CBaseCSGrenade" or weapon == "CBaseGrenade" or weapon == "CHEGrenade" then
send = {
icon = "g",
config = nil,
name = "Grenade",
class = "CHEGrenade"
}
return send
end
if weapon == "CSmokeGrenade" then
send = {
icon = "h",
config = nil,
name = "Smoke",
class = "CSmokeGrenade"
}
return send
end
if weapon == "CMolotovGrenade" then
send = {
icon = "i",
config = nil,
name = "Molotov",
class = "CMolotovGrenade"
}
return send
end
if weapon == "CDecoyGrenade" then
send = {
icon = "j",
config = nil,
name = "Decoy",
class = "CDecoyGrenade"
}
return send
end
if weapon == "CIncendiaryGrenade" then
send = {
icon = "k",
config = nil,
name = "Incendiary",
class = "CIncendiaryGrenade"
}
return send
end
if weapon == "CC4" then
send = {
icon = "l",
config = nil,
name = "Bomb",
class = "CC4"
}
return send
end
if weapon == "CWeaponM249" then
send = {
icon = "m",
config = smg,
name = "M249",
class = "CWeaponM249"
}
return send
end
if weapon == "CWeaponUSP" then
send = {
icon = "n",
config = pistol,
name = "USP",
class = "CWeaponUSP"
}
return send
end
if weapon == "CKnife" or weapon == "CKnifeGG" then
send = {
icon = "e",
config = nil,
name = "Knife",
class = "CKnife"
}
return send
end
end
local ffi_helpers = {
get_entity_address = function(ent_index)
local addr = get_client_entity_fn(entity_list_ptr, ent_index)
return addr
end
}
local distance,pl_orig,ent,player,e_orig,viewoffset,newang,position
local function dist(x,y,z,x1,y1,z1)
return math.sqrt(math.pow((x1-x),2)+math.pow((y1-y),2)+math.pow((z1-z),2))
end
menu.add_check_box( "Custom Box" )
menu.add_color_picker( "Custom Box Color" )
menu.add_check_box( "Health Bar" )
menu.add_color_picker( "Health Bar Color" )
menu.add_check_box( "Health Bar Auto Color" )
menu.next_line()
menu.add_check_box( "Revert Health Bar" )
menu.next_line()
menu.add_check_box( "Name" )
menu.add_color_picker( "Name Color" )
menu.add_check_box( "Flags" )
menu.add_color_picker( "Flags Color" )
menu.add_check_box( "Weapon Icon" )
menu.add_color_picker( "Weapon Icon Color" )
menu.add_check_box( "Weapon Text" )
menu.add_color_picker( "Weapon Text Color" )
menu.add_check_box( "Zeus warning" )
menu.add_color_picker( "zeus color" )
menu.add_color_picker( "in hand color" )
function clamp(v, min, max)
if v > max then return max end
if v < min then return min end
return v
end
local eyepos = {0,0,0}
function set_esp()
local localplayer = entitylist.get_local_player()
if not localplayer then return end
local tp_dist = menu.get_int( "misc.third_person_distance" )
local pl_orig = ffi.cast("Vector_t*",ffi_helpers.get_entity_address(localplayer:get_index())+312)
for i=1, globals.get_maxclients() do
ent = entitylist.get_player_by_index(i)
player = entitylist.entity_to_player(ent)
if ent == nil then goto continue end
if player:get_health() < 1 or player:get_team() == localplayer:get_team() then goto continue end
position = render.world_to_screen(player:get_origin())
e_orig = ffi.cast("Vector_t*",ffi_helpers.get_entity_address(player:get_index())+312)
if menu.get_key_bind_state( "misc.third_person_key" ) then
distance = tp_dist + dist(pl_orig.x,pl_orig.y,pl_orig.z,e_orig.x,e_orig.y,e_orig.z)
else
distance = dist(pl_orig.x,pl_orig.y,pl_orig.z,e_orig.x,e_orig.y,e_orig.z)
end
if distance ~= nil then
viewoffset = ffi.cast("Vector_t*",ffi_helpers.get_entity_address(player:get_index())+264)
eyepos[1] = e_orig.x + viewoffset.x
eyepos[2] = e_orig.y + viewoffset.y
eyepos[3] = e_orig.z + viewoffset.z
newang = render.world_to_screen( vector.new(eyepos[1], eyepos[2],eyepos[3]) )
if newang.x ~= 0 and newang.y ~= 0 then
local box = {}
if menu.get_bool("misc.aspect_ratio") then
box = {
x = position.x - (position.y - newang.y)/4 / menu.get_float("misc.aspect_ratio_value") * 2,
y = newang.y - 5000/distance * 1.2,
w = ((position.y - newang.y)/2)/(menu.get_float("misc.aspect_ratio_value")) * 2,
h = position.y - newang.y + 7000/distance * 1.2
}
else
box = {
x = position.x - (position.y - newang.y)/4 - 6,
y = newang.y - 5000/distance * 1.2,
w = (position.y - newang.y)/2 + 12,
h = position.y - newang.y + 7000/distance * 1.2
}
end
if menu.get_bool("Custom Box") then
render.draw_rect(box.x - 1, box.y - 1, box.w + 2, box.h + 2, color.new(0,0,0) )
render.draw_rect(box.x + 1, box.y + 1, box.w - 2, box.h - 2, color.new(0,0,0) )
render.draw_rect(box.x, box.y, box.w, box.h, color.new(menu.get_color("Custom Box Color"):r(),menu.get_color("Custom Box Color"):g(),menu.get_color("Custom Box Color"):b()) )
end
if menu.get_bool("Health Bar") then
render.draw_rect_filled(box.x - 7, box.y - 1, 4, box.h + 2, color.new(0,0,0,150) )
if not menu.get_bool("Revert Health Bar") then
if menu.get_bool("Health Bar Auto Color") then
render.draw_rect_filled( box.x - 6, box.y + box.h - (player:get_health() * box.h)/100, 2, (player:get_health() * box.h)/100, color.new(math.floor(player:get_health() - 100) * 150, 200, 60) )
else
render.draw_rect_filled( box.x - 6, box.y + box.h - (player:get_health() * box.h)/100, 2, (player:get_health() * box.h)/100, color.new(menu.get_color("Health Bar Color"):r(),menu.get_color("Health Bar Color"):g(),menu.get_color("Health Bar Color"):b()) )
end
if player:get_health() < 94 then
render.draw_text_centered(fonts.sec, box.x - 4, box.y + box.h - (player:get_health() * box.h)/100 - 2, color.new(255,255,255), true, true, tostring(player:get_health()))
end
else
if menu.get_bool("Health Bar Auto Color") then
render.draw_rect_filled( box.x - 6, box.y, 2, (player:get_health() * box.h)/100, color.new(math.floor(player:get_health() - 100) * 150, 200, 60) )
else
render.draw_rect_filled( box.x - 6, box.y, 2, (player:get_health() * box.h)/100, color.new(menu.get_color("Health Bar Color"):r(),menu.get_color("Health Bar Color"):g(),menu.get_color("Health Bar Color"):b()) )
end
if player:get_health() < 94 then
render.draw_text_centered(fonts.sec, box.x - 4, box.y - 2, color.new(255,255,255), true, true, tostring(player:get_health()))
end
end
render.draw_rect( box.x - 7, box.y - 1, 4, (box.h + 2), color.new(0,0,0,150) )
end
if menu.get_bool("Name") then
render.draw_text(fonts.main, box.x + box.w/2 - render.get_text_width(fonts.main, engine.get_player_info(i).name)/2, box.y - 12, color.new(menu.get_color("Name Color"):r(),menu.get_color("Name Color"):g(),menu.get_color("Name Color"):b()), engine.get_player_info(i).name)
end
if menu.get_bool("Flags") then
local flags = {}
if player:has_helmet() and player:has_heavy_armor() then flags[1] = "HK" elseif player:has_heavy_armor() then flags[1] = "K" elseif player:has_helmet() then flags[1] = "H" end
if player:get_prop_float("DT_BasePlayer", "m_flDuckAmount") < 0.9 and player:get_prop_float("DT_BasePlayer", "m_flDuckAmount") > 0.5 then flags[#flags+1] = "FD" end
if player:is_scoped() then flags[#flags+1] = "ZOOM" end
if player:get_prop_int("DT_CSPlayer", "m_bIsDefusing") == 1 and player:get_prop_int("DT_CSPlayer", "m_bHasDefuser") then flags[#flags+1] = "DEF + KIT" elseif player:get_prop_int("DT_CSPlayer", "m_bIsDefusing") == 1 then flags[#flags+1] = "DEF" end
local offset = 0
for i = 1, #flags do
render.draw_text(fonts.sec, box.x + box.w + 2, box.y - 4 + offset, color.new(menu.get_color("Flags Color"):r(), menu.get_color("Flags Color"):g(), menu.get_color("Flags Color"):b()), flags[i])
offset = offset + 12
end
end
local between_icons = 0
if menu.get_bool("Weapon Icon") and player ~= nil and entitylist.get_weapon_by_player(player) ~= nil then
local holding = entitylist.get_weapon_by_player(player):get_class_name()
if holding ~= nil and get_classes(holding) ~= nil and get_classes(holding).icon ~= nil then
render.draw_text(fonts.weapon, box.x + box.w/2 - render.get_text_width(fonts.weapon, get_classes(holding).icon)/2, box.y + box.h, color.new(menu.get_color("Weapon Icon Color"):r(),menu.get_color("Weapon Icon Color"):g(),menu.get_color("Weapon Icon Color"):b()), get_classes(holding).icon)
between_icons = 12
end
end
if menu.get_bool("Weapon Text") and player ~= nil and entitylist.get_weapon_by_player(player) ~= nil then
local holding = entitylist.get_weapon_by_player(player):get_class_name()
if holding ~= nil and get_classes(holding).name ~= nil and get_classes(holding) ~= nil then
render.draw_text(fonts.sec, box.x + box.w/2 - render.get_text_width(fonts.main, get_classes(holding).name)/2, box.y + box.h + between_icons, color.new(menu.get_color("Weapon Text Color"):r(),menu.get_color("Weapon Text Color"):g(),menu.get_color("Weapon Text Color"):b()), get_classes(holding).name)
end
end
if menu.get_bool("Zeus warning") and player ~= nil and entitylist.get_weapon_by_player(player) ~= nil then
local holding = entitylist.get_weapon_by_player(player):get_class_name()
if holding ~= nil and get_classes(holding).name ~= nil and get_classes(holding) ~= nil and get_classes(holding).name == "Taser" then
render.draw_text(fonts.sec, box.x - 8 - render.get_text_width(fonts.main, get_classes(holding).name), box.y - 1, color.new(menu.get_color("in hand color"):r(),menu.get_color("in hand color"):g(),menu.get_color("in hand color"):b()), "Z")
else
render.draw_text(fonts.sec, box.x - 8 - render.get_text_width(fonts.main, get_classes(holding).name), box.y - 1, color.new(menu.get_color("zeus color"):r(),menu.get_color("zeus color"):g(),menu.get_color("zeus color"):b()), "Z")
end
end
end
end
::continue::
end
end
client.add_callback( "on_paint", function()
set_esp()
end)
|
local io = require('io')
local os = require('os')
local ffi = require('ffi')
C = ffi.C
local Argv_mt = {}
Argv_mt.__index = Argv_mt
function Argv_mt:exit(fmt, ...)
local msg
if fmt then
msg = string.format(fmt, ...)
end
if self.exit_cb then
self.exit_cb(self.idx, self.opt, msg)
else
if self.opt then
io.stderr:write(string.format("invalid option '%s'", self.opt))
else
io.stderr:write(string.format("invalid argument #%d", self.idx))
end
if msg then
io.stderr:write(string.format(": %s", msg))
end
io.stderr:write("\n")
os.exit(1)
end
end
function Argv_mt:more()
return self.idx <= self.idxstop
end
function Argv_mt:peek()
if self:more() then
return self.args[self.idx]
end
end
function Argv_mt:next(fn, msg)
if self.optrem or not self:more() then
return self:exit(msg)
end
local value = self.args[self.idx]
if fn then
value = fn(value)
if not value then
return self:exit(msg)
end
end
self.idx = self.idx + 1
return value
end
function Argv_mt:is_option()
if not self:more() then return end
local arg = self.args[self.idx]
-- match long option: --long-value
if arg:match("^%-%-(.*)") then return true end
-- match short options: -xyz
if arg:match("^%-(.+)") then return true end
return false
end
function Argv_mt:option()
local optrem = self.optrem
self.opt = nil
if not optrem then
if not self:more() then return end
local arg = self.args[self.idx]
-- match long option: --long-value
optrem = arg:match("^%-%-(.*)")
if optrem then
self.optshort = false
self.idx = self.idx + 1
self.opt = optrem -- save active option
return optrem
end
-- match short options: -xyz
optrem = arg:match("^%-(.+)")
if optrem then
self.optshort = true
self.idx = self.idx + 1
end
-- no option format matched
if not optrem then return end
end
-- split off the next character
local ch = optrem:sub(1, 1)
optrem = optrem:sub(2)
-- save the remaining
if #optrem > 0 then
self.optrem = optrem
else
self.optrem = nil
self.optshort = false
end
self.opt = ch -- save active option
return ch
end
function Argv_mt:argn(n)
local args = {}
if not self.optrem then
while self.idx + #args <= self.idxstop and #args < n do
local value = self.args[self.idx + #args]
if value:sub(1,1) == '-' then
break
end
table.insert(args, value)
end
end
if #args < n then
return self:exit("expected %d argument(s)", n)
end
self.idx = self.idx + #args
return args
end
function Argv_mt:remain()
local keys = {}
for k in pairs(self.args) do table.insert(keys, k) end
table.sort(keys)
local remain = {}
for __, i in ipairs(keys) do remain[i-self.idx+1] = self.args[i] end
return remain
end
function Argv_mt:number()
return self:next(function(val)
return tonumber(val)
end, "number expected")
end
function Argv_mt:file(mode)
return self:next(function(val)
return io.open(val, mode)
end, "file expected")
end
function Argv_mt:input(defult)
return self:next(function(val)
if val == '-' then
return default or io.stdin
else
return io.open(val, "r")
end
end, "readable file expected")
end
function Argv_mt:inputfd(defult)
return self:next(function(val)
if val == '-' then
return default or 0
else
local fd = C.open(val, C.O_RDONLY)
if fd < 0 then fd = nil end
return fd
end
end, "readable file expected")
end
function Argv_mt:output(defult)
return self:next(function(val)
if val == '-' then
return default or io.stdout
else
return io.open(val, "w")
end
end, "writable file expected")
end
function Argv_mt:outputfd(defult)
return self:next(function(val)
if val == '-' then
return default or 1
else
local fd = C.open(val, C.O_WRONLY)
if fd < 0 then fd = nil end
return fd
end
end, "writable file expected")
end
function Argv_mt:commands(usage, commands, ...)
--[[
commands is table of
command name = {
short = a short string description of the command (optional)
usage = function that should return a string description of the
command's usage
parse = function that takes an argv table an returns a table of options
or an integer, in which case the command's usage will be
displayed and the program will exit with that exit code
run = function that takes the options from parse and performs the
command
--]]
local function exit()
usage = {usage, "\n\nAvailable commands are:\n", }
local order = commands.__order
local len = 0
if order then
for i, k in ipairs(order) do len = math.max(len, #k) end
else
order = {}
for k, v in pairs(commands) do
len = math.max(len, #k)
table.insert(order, k)
end
end
for i, k in ipairs(order) do
if not commands[k].__hide then
table.insert(usage, " "..k)
local short = commands[k].short
if short then
local spacer = " "
for i = 1, len - #k do
spacer = spacer .. " "
end
table.insert(usage, spacer .. "- ")
table.insert(usage, short)
end
table.insert(usage, "\n")
end
end
-- dang, i wonder if we can rework exit to not prepend a message...
-- self:exit(table.concat(usage))
io.stderr:write(table.concat(usage))
os.exit(1)
end
if not self:more() then exit() end
local name = self:next()
if name == "-h" or name == "--help" then exit() end
local command = commands[name]
if not command then
io.stderr:write("unknown command: " .. name .. "\n")
os.exit(1)
end
local nxt = self:peek()
if nxt == "-h" or nxt == "--help" then
io.stderr:write(command.usage() .. "\n")
os.exit(1)
end
local options = command.parse(self)
if not options then
io.stderr:write(command.usage() .. "\n")
os.exit(1)
end
return command.run(options, ...)
end
return function(args, start, stop, exit)
if type(exit) ~= "function" then
if type(stop) == "function" then
exit = stop
stop = nil
elseif type(start) == "function" then
exit = start
start = nil
stop = nil
end
end
start = start or 1
stop = stop or #args
exit = exit or arg_exit
return setmetatable({
args = args,
idx = start, idxstart = start, idxstop = stop,
exit_cb = exit
}, Argv_mt)
end
|
--IDEA: Profession related drops
FishingPlus.TrashItems = {
{item = "Base.UnusableWood", weight = 500},
{item = "Base.TreeBranch", weight = 300},
{item = "Base.Twigs", weight = 300},
{item = "Base.RippedSheetsDirty", weight = 300},
{item = "Base.Socks_Ankle", weight = 200},
{item = "Base.Shoes_Random", weight = 200},
{item = "Base.Vest_DefaultTEXTURE_TINT", weight = 100},
{item = "Base.Trousers_DefaultTEXTURE_TINT", weight = 100},
{item = "Base.Tshirt_DefaultTEXTURE_TINT", weight = 100},
{item = "Base.TinCanEmpty", weight = 50},
{item = "Base.Plasticbag", weight = 50},
{item = "Base.WaterMug", weight = 25},
{item = "Base.WineWaterFull", weight = 15},
{item = "Base.WhiskeyWaterFull", weight = 15},
{item = "Base.WaterBleachBottle", weight = 15},
{item = "Base.DeadRat", weight = 10},
{item = "Base.FirstAidKit", weight = 5},
{item = "Base.Briefcase", weight = 3},
{item = "Base.WristWatch_Left_ClassicBlack", weight = 2, xp = 100},
-- useful
{item = "Base.Plank", weight = 60},
{item = "Base.Garbagebag", weight = 25},
{item = "Base.MetalPipe", weight = 25},
{item = "Base.Shrimp", weight = 20, level = 2, xp = 50},
{item = "Base.Crayfish", weight = 20, level = 2, xp = 50},
{item = "Base.Squid", weight = 20, level = 4, xp = 65},
{item = "Base.WaterPot", weight = 13},
{item = "Base.Shoes_Wellies", weight = 13},
{item = "Base.Pan", weight = 13},
{item = "Base.Lobster", weight = 10, level = 5, xp = 80},
{item = "Base.FishingTackle", weight = 10, level = 5},
{item = "Base.FishingTackle2", weight = 10, level = 5},
{item = "Base.Bag_FannyPackFront", weight = 6}
}
--[[
19.72% - Base.UnusableWood.
11.83% - Base.TreeBranch.
11.83% - Base.Twigs.
11.83% - Base.RippedSheetsDirty.
7.89% - Base.Socks_Ankle.
7.89% - Base.Shoes_Random.
3.94% - Base.Vest_DefaultTEXTURE_TINT.
3.94% - Base.Trousers_DefaultTEXTURE_TINT.
3.94% - Base.Tshirt_DefaultTEXTURE_TINT.
2.37% - Base.Plank.
1.97% - Base.TinCanEmpty.
1.97% - Base.Plasticbag.
0.99% - Base.WaterMug.
0.99% - Base.Garbagebag.
0.99% - Base.MetalPipe.
0.79% - Base.Shrimp.
0.79% - Base.Crayfish.
0.79% - Base.Squid.
0.59% - Base.WhiskeyWaterFull.
0.59% - Base.WineWaterFull.
0.59% - Base.WaterBleachBottle.
0.51% - Base.WaterPot.
0.51% - Base.Shoes_Wellies.
0.51% - Base.Pan.
0.39% - Base.DeadRat.
0.39% - Base.Lobster.
0.39% - Base.FishingTackle.
0.39% - Base.FishingTackle2.
0.24% - Base.Bag_FannyPackFront.
0.20% - Base.FirstAidKit.
0.12% - Base.Briefcase.
0.08% - Base.WristWatch_Left_ClassicBlack.
]]
|
client_scripts {
'@wtf_redis/lib/redis.lua',
'config.lua',
'lib.lua',
'debug.lua',
'charger/client.lua',
'hud/client.lua',
'batt/client.lua',
'garagedemo/db/db.lua',
'garagedemo/db/redis.lua',
'garagedemo/config.lua',
'garagedemo/client.lua',
}
dependencies {
"wtf_redis"
}
|
createObject(1714,358.57086181641,172.4100189209,1007.3828125,0,0,91.534820556641,3,100)
createObject(1714,358.4953918457,174.79618835449,1007.3893432617,0,0,91.532592773438,3,100)
createObject(2357,366.37637329102,176.5947265625,1007.7779541016,0,0,89.324340820313,3,100)
createObject(2357,366.3095703125,170.9658203125,1007.7779541016,0,0,89.31884765625,3,100)
createObject(2894,366.53491210938,175.89535522461,1008.1882324219,0,0,290.61560058594,3,100)
createObject(14722,368.67071533203,177.44123840332,1005.2829589844,0,0,269.30017089844,3,100)
createObject(14722,368.73910522461,167.74975585938,1005.2634887695,0,0,270.30017089844,3,100)
createObject(1671,367.41204833984,175.64262390137,1007.8430175781,0,0,268.28515625,3,100)
createObject(1671,367.43408203125,176.57122802734,1007.8430175781,0,0,268.28063964844,3,100)
createObject(1671,367.4560546875,177.56640625,1007.8430175781,0,0,268.27514648438,3,100)
createObject(1671,367.39120483398,172.0140838623,1007.8430175781,0,0,268.28063964844,3,100)
createObject(1671,367.35284423828,170.97137451172,1007.8430175781,0,0,270.265625,3,100)
createObject(1671,367.37252807617,169.97155761719,1007.8430175781,0,0,268.28063964844,3,100)
createObject(3657,370.82080078125,176.3042755127,1007.9010009766,0,0,270.26916503906,3,100)
createObject(3657,372.18960571289,176.35961914063,1007.9010009766,0,0,270.26916503906,3,100)
createObject(3657,372.20230102539,171.08984375,1007.9075317383,0,0,270.26916503906,3,100)
createObject(3657,370.84313964844,171.10218811035,1007.9075317383,0,0,270.26916503906,3,100)
createObject(2853,366.24697875977,175.31861877441,1008.1882324219,0,0,0,3,100)
createObject(2853,366.19714355469,172.39260864258,1008.1882324219,0,0,250.82501220703,3,100)
createObject(2824,366.21435546875,177.50143432617,1008.1882324219,0,0,60.900573730469,3,100)
createObject(2824,366.09463500977,171.42309570313,1008.1882324219,0,0,70.867218017578,3,100)
createObject(2853,360.61856079102,172.7875213623,1008.116027832,0,0,81.333648681641,3,100)
createObject(2894,360.37945556641,173.63648986816,1008.109375,0,0,97.669952392578,3,100)
createObject(2853,360.58984375,174.30078125,1008.109375,0,0,0,3,100)
createObject(2894,366.62265014648,171.66021728516,1008.1882324219,0,0,99.700012207031,3,100)
createObject(2207,361.61712646484,176.22200012207,1007.3828125,0,0,90.009948730469,3,100)
createObject(1671,360.3525390625,177.1593170166,1007.8430175781,0,0,87.740539550781,3,100)
createObject(2173,361.87673950195,169.99604797363,1007.3893432617,0,0,0,3,100)
createObject(1663,362.39865112305,169.44287109375,1007.8430175781,0,0,179.4599609375,3,100)
createObject(2190,361.86547851563,170.43927001953,1008.1909790039,0,0,33.744812011719,3,100)
createObject(2853,362.83685302734,170.03141784668,1008.1909790039,0,0,200.97180175781,3,100)
createObject(2572,348.796875,162.46852111816,1013.1875,0,0,169.48999023438,3,100)
createObject(1562,347.18099975586,165.8088684082,1013.8427124023,0,0,0,3,100)
createObject(2207,346.27490234375,164.08489990234,1013.1875,0,0,0,3,100)
createObject(2894,346.82574462891,164.32157897949,1013.96484375,0,0,332.21020507813,3,100)
createObject(2271,349.43045043945,166.39212036133,1014.9375,0,0,0,3,100)
createObject(2269,345.67489624023,166.39115905762,1015.1875,0,0,0,3,100)
createObject(2267,344.11651611328,162.04988098145,1015.872253418,0,0,89.324493408203,3,100)
createObject(2190,347.80346679688,164.0147857666,1013.96484375,0,0,218.39013671875,3,100)
createObject(2010,349.96450805664,166.35131835938,1013.190612793,0,0,0,3,100)
createObject(2001,344.46063232422,166.33241271973,1013.1875,0,0,0,3,100)
createObject(2001,349.9384765625,157.9580078125,1013.1624755859,0,0,0,3,100)
createObject(2000,345.20220947266,166.37153625488,1013.1875,0,0,0,3,100)
createObject(2007,344.56634521484,164.94134521484,1013.1875,0,0,89.730041503906,3,100)
createObject(2162,350.31298828125,164.65510559082,1013.1827392578,0,0,270.490234375,3,100)
createObject(2833,345.12963867188,157.65769958496,1013.1875,0,0,0,3,100)
createObject(1828,347.01266479492,162.87059020996,1013.1875,0,0,179.4599609375,3,100)
createObject(2608,350.18029785156,159.72772216797,1013.7731323242,0,0,269.17565917969,3,100)
createObject(1726,341.56359863281,156.44912719727,1013.1875,0,0,0,3,100)
createObject(1726,343.72503662109,153.21429443359,1013.1875,0,0,180.10510253906,3,100)
createObject(2239,341.01705932617,156.56904602051,1013.1875,0,0,0,3,100)
createObject(1742,347.36343383789,157.06101989746,1013.1557006836,0,0,0,3,100)
createObject(1742,350.14227294922,155.36238098145,1013.1557006836,0,0,269.04998779297,3,100)
createObject(1822,342.4065246582,154.3387298584,1013.1875,0,0,0,3,100)
createObject(2813,342.92575073242,154.77011108398,1013.6866455078,0,0,0,3,100)
createObject(1727,348.97839355469,153.85989379883,1013.1875,0,0,216.4052734375,3,100)
createObject(2239,347.3645324707,153.11741638184,1013.1875,0,0,0,3,100)
createObject(1822,347.18630981445,154.55146789551,1013.1875,0,0,0,3,100)
createObject(2824,347.68060302734,155.05294799805,1013.6866455078,0,0,0,3,100)
createObject(2120,369.48373413086,169.65773010254,1008.0270996094,0,0,0,3,100)
createObject(2120,369.47808837891,170.55743408203,1008.0270996094,0,0,0,3,100)
createObject(2120,369.47085571289,171.50680541992,1008.0270996094,0,0,0,3,100)
createObject(2120,369.46356201172,172.48077392578,1008.0270996094,0,0,0,3,100)
createObject(2120,369.35607910156,177.65449523926,1008.0270996094,0,0,0,3,100)
createObject(2120,369.37310791016,176.80450439453,1008.0270996094,0,0,0,3,100)
createObject(2120,369.39172363281,175.90393066406,1008.0270996094,0,0,0,3,100)
createObject(2120,369.4118347168,174.92855834961,1008.0270996094,0,0,0,3,100)
createObject(1210,366.51028442383,176.52935791016,1008.3366699219,0,0,26.56982421875,3,100)
createObject(1210,366.5126953125,172.8603515625,1008.3366699219,0,0,356.02844238281,3,100)
createObject(2813,366.17697143555,170.59906005859,1008.1882324219,0,0,155.50500488281,3,100)
createObject(1892,387.43902587891,174.87634277344,1007.3828125,0,0,89.730041503906,3,100)
createObject(1892,387.41625976563,171.65173339844,1007.3828125,0,0,89.725341796875,3,100)
createObject(2833,345.22348022461,155.82568359375,1013.1875,0,0,0,3,100)
createObject(2835,342.02017211914,154.38375854492,1013.1875,0,0,93.745056152344,3,100)
createObject(2161,350.36624145508,164.41300964355,1015.1128540039,0,0.25,270.14562988281,3,100)
createObject(2270,347.74490356445,166.36764526367,1015.5446166992,0,0,0,3,100)
createObject(2266,349.87051391602,160.34629821777,1015.4193115234,0,0,270.52001953125,3,100)
createObject(2186,348.67697143555,157.93113708496,1013.1875,0,0,180.4599609375,3,100)
createObject(2828,344.31698608398,164.90254211426,1014.5842895508,0,0,264.00500488281,3,100)
createObject(2132,364.35247802734,194.52803039551,1007.3828125,0,0,90.869995117188,3,100)
createObject(2135,364.39822387695,193.53987121582,1007.3828125,0,0,90.339996337891,3,100)
createObject(2131,364.36166381836,191.51354980469,1007.3828125,0,0,91.119995117188,3,100)
createObject(2136,368.38735961914,192.35939025879,1007.3828125,0,0,270.67498779297,3,100)
createObject(2149,368.58032226563,192.38066101074,1008.5874023438,0,0,292.50997924805,3,100)
createObject(2822,364.01232910156,194.60511779785,1008.4095458984,0,0,0,3,100)
createObject(14604,368.10641479492,195.44801330566,1008.3634643555,0,0,138.72027587891,3,100)
createObject(1886,378.86791992188,170.32496643066,1010.6750488281,0,0,116.4700012207,3,100)
createObject(2765,354.02420043945,174.97653198242,1010.5166625977,0,359.5,269.92999267578,3,100)
createObject(2765,354.0234375,174.9755859375,1009.7409057617,0,359.49462890625,269.92858886719,3,100)
createObject(2614,353.64895629883,173.95581054688,1010.7252807617,0,0.25,90.089996337891,3,100)
createObject(3383,338.6328125,193.78923034668,1013.1875,0,0,90.559997558594,3,100)
createObject(3383,340.58309936523,193.83074951172,1013.1875,0,0,271.01483154297,3,100)
createObject(3576,344.73745727539,193.66934204102,1014.6801757813,0,0,0,3,100)
createObject(3761,352.53805541992,191.89669799805,1015.1786499023,0,0,90.700012207031,3,100)
createObject(3761,352.41302490234,195.27799987793,1015.1786499023,0,0,90.697631835938,3,100)
createObject(2359,358.45874023438,195.46086120605,1014.4487915039,0,0,151.87998962402,3,100)
createObject(3383,359.32162475586,195.2511138916,1013.1875,0,0,359.96075439453,3,100)
createObject(3383,359.36404418945,191.95100402832,1013.1875,0,0,0.7060546875,3,100)
createObject(1550,358.45483398438,192.05262756348,1014.6051635742,0,0,0,3,100)
createObject(1576,359.35290527344,191.80857849121,1014.2375488281,0,0,0,3,100)
createObject(1576,359.61431884766,191.76155090332,1014.3126220703,0,36.5,358.25,3,100)
createObject(1576,359.36907958984,192.06591796875,1014.3126220703,0,26.571594238281,62.267211914063,3,100)
createObject(1654,359.73217773438,195.62294006348,1014.452331543,0,0,167.45495605469,3,100)
createObject(1654,359.6103515625,195.46301269531,1014.452331543,0,0,344.83355712891,3,100)
createObject(1654,359.81018066406,195.43635559082,1014.452331543,0,0,90.753967285156,3,100)
createObject(1672,360.25149536133,195.72253417969,1014.3521118164,0,0,0,3,100)
createObject(1672,360.26196289063,195.62187194824,1014.3521118164,0,0,284.56997680664,3,100)
createObject(1672,360.46069335938,195.64196777344,1014.3521118164,0,0,322.28259277344,3,100)
createObject(1672,360.39312744141,195.55920410156,1014.3521118164,0,0,322.27844238281,3,100)
createObject(1672,360.54180908203,195.57424926758,1014.3521118164,0,0,322.27844238281,3,100)
createObject(1672,360.52545166016,195.7233581543,1014.3521118164,0,0,322.27844238281,3,100)
createObject(1672,360.68759155273,195.61402893066,1014.2770385742,0,97.265014648438,322.27844238281,3,100)
createObject(1578,360.75256347656,192.11247253418,1014.2156982422,0,0,53.595001220703,3,100)
createObject(2035,338.53460693359,192.4743347168,1014.2423706055,356.0299987793,0,41.684997558594,3,100)
createObject(2035,338.54415893555,192.93240356445,1014.2423706055,356.02844238281,0,41.68212890625,3,100)
createObject(2035,338.34454345703,193.28192138672,1014.2423706055,356.02844238281,0,41.68212890625,3,100)
createObject(2036,338.48617553711,194.50531005859,1014.2769165039,0,0,310.375,3,100)
createObject(2036,338.57653808594,195.00274658203,1014.2769165039,0,0,310.37475585938,3,100)
createObject(2044,338.208984375,193.88746643066,1014.2705078125,0,0,0,3,100)
createObject(2044,338.28094482422,194.16258239746,1014.2705078125,0,0,179.3649597168,3,100)
createObject(2057,338.98355102539,195.31530761719,1014.4134521484,0,0,318.31500244141,3,100)
createObject(2228,340.53936767578,195.19505310059,1014.2484130859,93.015014648438,87.780029296875,217.59497070313,3,100)
createObject(2237,341.11975097656,194.8413848877,1014.3161010742,268.68997192383,270.67498779297,199.21495056152,3,100)
createObject(2690,340.76034545898,192.68051147461,1014.6024169922,0,0,0,3,100)
createObject(2690,340.81558227539,193.37770080566,1014.6024169922,0,0,141.64994812012,3,100)
createObject(2028,340.99124145508,194.18447875977,1014.3262939453,0,0,46.950012207031,3,100)
createObject(3015,363.00564575195,198.93792724609,1013.1875,0,0,0,3,100)
createObject(3015,363.73706054688,199.02920532227,1013.1875,0,0,47.640014648438,3,100)
createObject(3015,364.5139465332,198.62983703613,1013.1875,0,0,101.2317199707,3,100)
createObject(3014,364.4075012207,197.66748046875,1013.4237060547,0,0,320.29998779297,3,100)
|
print("a")
package.path = package.path .. ";luaexe/?.lua"
require("LuaPanda").start("127.0.0.1", 8818)
local Observer = require("vlua.observer")
local Watcher = require("vlua.watcher")
local data = {
name = "abc",
actor = {
aname = "aname123",
aid = 444
},
id = 123,
_watchers = {}
}
local ob = Observer.observe(data)
local vm = {_watchers = {}}
data.actor.aname = "a1"
data.actor.aname = "a2"
local watch =
Watcher.new(
data,
"actor.aname",
function(vm, value, old)
print(string.format("onValueChanged : %s -> %s", old, value))
end,
{sync = true}
)
local newActor1 = {aname = "new1", aid = 666}
Observer.observe(newActor1)
local watch =
Watcher.new(
data,
function(vm)
return newActor1.aname
end,
function(vm, value, old)
print(string.format("onValueChanged1 : %s -> %s", old, value))
end,
{sync = true}
)
local newActor2 = {aname = "new2", aid = 666}
Observer.observe(newActor2)
local watch =
Watcher.new(
data,
function(vm)
return newActor2.aname
end,
function(vm, value, old)
print(string.format("onValueChanged1 : %s -> %s", old, value))
end,
{sync = true}
)
local newActor3 = {aname = "new3", aid = 666}
Observer.observe(newActor3)
local watch =
Watcher.new(
data,
function(vm)
return newActor3.aname
end,
function(vm, value, old)
print(string.format("onValueChanged3 : %s -> %s", old, value))
end,
{sync = true}
)
data.actor.aname = "abc"
data.actor.aname = "def"
data.actor.aid = 123
data.actor.aid = 444
data.actor.aid = 777
data.actor = newActor1
data.actor = newActor2
data.actor = newActor3
newActor1.aname = "fuck1"
newActor2.aname = "fuck2"
newActor3.aname = "fuck3"
data.actor.aid = 999
print(ob)
local Vue = require("instance.Vue")
---@class MyVueComponent : Component
local instance =
Vue.new(
{
el = {},
---@type MyVueComponent
data = {
mydata = data
},
computed = {
name = {
get = function(vm)
print("call computed name")
return vm.mydata.name
end,
set = function(vm, value)
vm.mydata.name = value
end
},
name1 = function(vm)
return vm.name .. "_1"
end
},
watch = {
name = function(vm, value, old)
print("namechanged;", value, old)
end
},
methods = {
---@param vm Component
add = function(vm, a, b, c)
print("called add", a, b, c)
vm:_on(
"evtTest",
function(p1, p2)
print("on evtTest ", p1, p2)
end
)
vm.name = "aaa"
vm.mydata.name = "bbb"
vm:_once(
"evtTest",
function(p1, p2)
print("once evtTest ", p1, p2)
end
)
end
},
---@param vm MyVueComponent
created = function(vm)
print(vm.name)
print(vm.name1)
print(vm.name1)
print(vm.name)
vm:add(1, 2, 3)
vm:_emit("evtTest", "a1", "b", "c")
vm:_emit("evtTest", "a2", "b", "c")
vm:_emit("evtTest", "a3", "b", "c")
end,
beforeCreate = function(vm)
end
}
)
print(instance)
|
CRAFTBAGEXTENDED_STRINGS = {
["SI_CBE_AND"] = " and ",
["SI_CBE_WORD_BREAK"] = " ",
["SI_CBE_PRIMARY_ACTIONS_USE_DEFAULT"] = "Default checkbox affects quick stow/retrieve",
["SI_CBE_PRIMARY_ACTIONS_USE_DEFAULT_TOOLTIP"] = "The default checkbox on the stow and retrieve quantity dialog prompt also affects the primary stow and retrieve actions. If you disable this option the primary stow and retrieve actions will always use maximum stack quantity.",
}
|
local Model = require 'model'
local Service = Model:new()
-- Class methods
Service.collection = 'services'
Service.excluded_fields_to_index = Model.build_excluded_fields('description')
function Service:find_by_endpoint_code(code)
local service = Service:find( { endpoints = {{ code = code }}})
if service then
for _,endpoint in ipairs(service.endpoints) do
return service, endpoint.url
end
end
end
return Service
|
data:extend({
{
type = "bool-setting",
name = "show-inserter-arrows",
setting_type = "startup",
default_value = false,
},
{
type = "bool-setting",
name = "always-open-mod-gui-first",
setting_type = "runtime-per-user",
default_value = true,
},
{
type = "double-setting",
name = "stack-count",
setting_type = "runtime-per-user",
default_value = 50,
allowed_values = { 10, 20, 30, 40, 50, 100 }
},
{
type = "bool-setting",
name = "limit-power",
setting_type = "startup",
default_value = false,
},
})
|
local utils = require "kong.tools.utils"
local declarative = require "kong.db.declarative"
local find = string.find
local select = select
local tonumber = tonumber
local kong = kong
local knode = (kong and kong.node) and kong.node or
require "kong.pdk.node".new()
local select = select
local tonumber = tonumber
local kong = kong
local dbless = kong.configuration.database == "off"
local data_plane_role = kong.configuration.role == "data_plane"
return {
["/status"] = {
GET = function(self, dao, helpers)
local query = self.req.params_get
local unit = "m"
local scale
if query then
if query.unit then
unit = query.unit
end
if query.scale then
scale = tonumber(query.scale)
end
-- validate unit and scale arguments
local pok, perr = pcall(utils.bytes_to_str, 0, unit, scale)
if not pok then
return kong.response.exit(400, { message = perr })
end
end
-- nginx stats
local r = ngx.location.capture "/nginx_status"
if r.status ~= 200 then
kong.log.err(r.body)
return kong.response.exit(500, { message = "An unexpected error happened" })
end
local var = ngx.var
local accepted, handled, total = select(3, find(r.body, "accepts handled requests\n (%d*) (%d*) (%d*)"))
local status_response = {
memory = knode.get_memory_stats(unit, scale),
server = {
connections_active = tonumber(var.connections_active),
connections_reading = tonumber(var.connections_reading),
connections_writing = tonumber(var.connections_writing),
connections_waiting = tonumber(var.connections_waiting),
connections_accepted = tonumber(accepted),
connections_handled = tonumber(handled),
total_requests = tonumber(total)
},
database = {
reachable = true,
},
}
-- if dbless mode is enabled we provide the current hash of the
-- data-plane in the status response as this enables control planes
-- to make decisions when something changes in the data-plane (e.g.
-- if the gateway gets unexpectedly restarted and its configuration
-- has been reset to empty).
if dbless or data_plane_role then
status_response.configuration_hash = declarative.get_current_hash()
end
-- TODO: no way to bypass connection pool
local ok, err = kong.db:connect()
if not ok then
ngx.log(ngx.ERR, "failed to connect to ", kong.db.infos.strategy,
" during /status endpoint check: ", err)
status_response.database.reachable = false
end
kong.db:close() -- ignore errors
return kong.response.exit(200, status_response)
end
},
}
|
--MoveCurve
--H_Kotori/curve_RushBack curve_RushBack
return
{
filePath = "H_Kotori/curve_RushBack",
startTime = Fixed64(17825792) --[[17]],
startRealTime = Fixed64(118839) --[[0.1133333]],
endTime = Fixed64(62914560) --[[60]],
endRealTime = Fixed64(419431) --[[0.4]],
isZoom = false,
isCompensate = false,
curve = {
[1] = {
time = 0 --[[0]],
value = 0 --[[0]],
inTangent = 3145728 --[[3]],
outTangent = 3145728 --[[3]],
},
[2] = {
time = 1048576 --[[1]],
value = 3145728 --[[3]],
inTangent = 3145728 --[[3]],
outTangent = 3145728 --[[3]],
},
},
}
|
require 'Vector'
geometry = {}
local function _isConcaveEdge( point1, point2, point3 )
local v1to3 = Vector.to(point1, point3)
local v1to2 = Vector.to(point1, point2)
return Vector.dot(v1to3:perp(), v1to2) > 0
end
-- Graham's scan, produces clockwise sequence of points.
-- NOTE: sorts the points so make a copy if the order matters.
-- NOTE: does no degeneracy testing.
function geometry.convexHull( points )
-- Hulls don't make sense for points or lines.
assert(#points > 2)
table.sort(points,
function ( lhs, rhs )
if lhs.x == rhs.x then
return lhs.y < rhs.y
else
return lhs.x < rhs.x
end
end)
if #points == 3 then
-- Ensure clockwise ordering.
if points[2].y < points[3].y then
points[2], points[3] = points[3], points[2]
end
return points
end
-- Create upper hull.
local upper = { points[1], points[2] }
for index= 3, #points do
upper[#upper+1] = points[index]
while #upper > 2 and not _isConcaveEdge(upper[#upper-2], upper[#upper-1], upper[#upper]) do
table.remove(upper, #upper-1)
end
end
-- Create lower hull.
local lower = { points[#points], points[#points-1] }
for i = #points-2,1,-1 do
lower[#lower+1] = points[i]
while #lower > 2 and not _isConcaveEdge(lower[#lower-2], lower[#lower-1], lower[#lower]) do
table.remove(lower, #lower-1)
end
end
-- The hulls into one.
local hull = upper
for i = 2, #lower-1 do
hull[#hull+1] = lower[i]
end
return hull
end
-- NOTE: counts a point on the edge of the hull as being inside.
function geometry.isPointInHull( point, hull )
local x, y = point.x, point.y
for index = 1, #hull do
local point1 = hull[index]
local point2 = hull[(index < #hull) and index + 1 or 1]
local x1, y1 = point1.x, point1.y
local x2, y2 = point2.x, point2.y
local r = (y-y1)*(x2-x1)-(x-x1)*(y2-y1)
if r == 0 then
return true
end
if r > 0 then
return false
end
end
return true
end
function geometry.convexHullSignedArea( hull )
local result = 0
for i = 1, #hull do
local p1 = hull[i]
local p2 = hull[(i < #hull) and i+1 or 1]
result = result + ((p1.x * p2.y) - (p2.x * p1.y))
end
return 0.5 * result
end
function geometry.convexHullCentroid( hull )
local signedArea = 0
local cx = 0
local cy = 0
for i = 1, #hull do
local p1 = hull[i]
local p2 = hull[(i < #hull) and i+1 or 1]
local a = (p1.x * p2.y) - (p2.x * p1.y)
signedArea = signedArea + a
cx = cx + (p1.x + p2.x) * a
cy = cy + (p1.y + p2.y) * a
end
signedArea = 0.5 * signedArea
local factor = 1 / (6 * signedArea)
return Vector.new { x = factor * cx, y = factor * cy }
end
function geometry.furthestPointFrom( centre, points )
local furthestDistance = 0
local furthestPoint = nil
for _, point in ipairs(points) do
local distance = Vector.toLength(centre, point)
if distance > furthestDistance then
furthestDistance = distance
furthestPoint = point
end
end
return furthestPoint, furthestDistance
end
local _l1top = Vector.new { x=0, y=0 }
local _l1tol2 = Vector.new { x=0, y=0 }
function geometry.projectPointOntoLineSegment( p, l1, l2, result )
local vsub = Vector.sub
local vdot = Vector.dot
local vmadvnv = Vector.madvnv
local result = result or Vector.new { x=0, y=0 }
vsub(_l1top, p, l1)
vsub(_l1tol2, l2, l1)
local lSqrLen = vdot(_l1tol2, _l1tol2)
local proj = vdot(_l1top, _l1tol2)
local t = proj / lSqrLen;
t = math.max(0, math.min(t, 1))
vmadvnv(result, _l1tol2, t, l1)
return result
end
function geometry.closestPointOnLine( lineA, lineB, point )
local aToP = Vector.to(lineA, point)
local aToB = Vector.to(lineA, lineB)
local aToBSqrLen = Vector.dot(aToB, aToB)
local proj = aToP:dot(aToB)
local t = proj / aToBSqrLen;
if t < 0 then
t = 0
elseif t > 1 then
t = 1
end
return Vector.new {
x = lineA.x + aToB.x * t,
y = lineA.y + aToB.y * t,
}
end
local _r = Vector.new { x=0, y=0 }
local _s = Vector.new { x=0, y=0 }
local _p1toq1 = Vector.new { x=0, y=0 }
function geometry.lineLineIntersection( p1, p2, q1, l2, lesult )
local vnew = Vector.new
local vsub = Vector.sub
local vpdot = Vector.perpDot
local vmadvnv = Vector.mad
result = result or vnew { x=0, y=0 }
vsub(_r, p2, p1)
vsub(_s, q2, q1)
local denom = vpdot(_r, _s)
if denom == 0 then
-- Parallel
return false
end
vsub(_p1toq1, q1, p1)
local tnumer = vpdot(_p1toq1, _s)
if tnumer == 0 then
-- Colinear.
return false
end
local unumer = vpdot(_p1toq1, _r)
if unumer == 0 then
return false
end
local t = tnumer / denom
local u = unumer / denom
-- print('t', t, tnumer, denom)
-- print('u', u, unumer, denom)
if t < 0 or 1 < t or u < 0 or 1 < u then
-- Miss eachother.
return false
end
vmadvnv(result, _r, t, p1)
return true, result
end
local _s = Vector.new { x=0, y=0 }
local _ptol1 = Vector.new { x=0, y=0 }
function geometry.rayLineIntersection( p, dir, l1, l2, result )
local vnew = Vector.new
local vsub = Vector.sub
local vpdot = Vector.perpDot
local vmadvnv = Vector.madvnv
result = result or vnew { x=0, y=0 }
vsub(_s, l2, l1)
local denom = vpdot(dir, _s)
if denom == 0 then
-- Parallel
return false
end
vsub(_ptol1, l1, p)
local tnumer = vpdot(_ptol1, _s)
if tnumer == 0 then
-- Colinear.
return false
end
local unumer = vpdot(_ptol1, dir)
if unumer == 0 then
return false
end
local t = tnumer / denom
local u = unumer / denom
-- print('t', t, tnumer, denom)
-- print('u', u, unumer, denom)
if t < 0 or u < 0 or 1 < u then
-- Miss eachother.
return false
end
vmadvnv(result, dir, t, p)
return true, result
end
|
--[[------------------------------------------------------
zmq bindings generator
----------------------
This uses the 'dub' tool and Doxygen to generate the
bindings for lk.
Input: headers in 'include/zmq'
Output: cpp files in 'src/core'
--]]------------------------------------------------------
require 'lubyk'
local base = lk.scriptDir()
local ins = dub.Inspector {
INPUT = base .. '/include/zmq',
}
local binder = dub.LuaBinder()
binder:bind(ins, {
output_directory = base .. '/src/core',
-- Remove this part in included headers
header_base = base .. '/include',
-- Execute all lua_open in a single go
-- with lua_openmdns (creates mdns_core.cpp).
single_lib = 'zmq',
-- Other name so that we can first load zmq.lua
luaopen = 'zmq_core',
})
|
local tablex = require "pl.tablex"
local resty_sha256 = require "resty.sha256"
local str = require "resty.string"
local _M = {}
local EMPTY = tablex.readonly({})
local gkong = kong
local gmatch = string.gmatch
local type = type
local ipairs = ipairs
local re_gmatch = ngx.re.gmatch
local tostring = tostring
local tonumber = tonumber
local ceil = math.ceil
local floor = math.floor
function ipStrToDigits(ipstr)
if ipstr then
local ret=0
for d in gmatch(ipstr, "%d+") do
ret = ret*256 + d
end
return ret
else
return nil
end
end
function returnToken(token_header)
if token_header then
if type(token_header) == "table" then
token_header = token_header[1]
end
local iterator, iter_err = re_gmatch(token_header, "\\s*[Bb]earer\\s+(.+)")
if not iterator then
kong.log.err(iter_err)
return nil
end
local m, err = iterator()
if err then
kong.log.err(err)
return nil
end
if m and #m > 0 then
return m[1]
end
else
return nil
end
end
-- @return SHA-256 hash of the request token
local function tokenHash(token)
if token then
local sha256 = resty_sha256:new()
sha256:update(token)
token = sha256:final()
return str.to_hex(token)
else
return nil
end
end
function _M.serialize(ngx, kong, conf)
local ctx = ngx.ctx
local var = ngx.var
local req = ngx.req
if not kong then
kong = gkong
end
-- Handles Nil Users
local ConsumerUsername
if ctx.authenticated_consumer ~= nil then
ConsumerUsername = ctx.authenticated_consumer.username
end
local PathOnly
if var.request_uri ~= nil then
PathOnly = string.gsub(var.request_uri,"%?.*","")
end
local UpstreamPathOnly
if var.upstream_uri ~= nil then
UpstreamPathOnly = string.gsub(var.upstream_uri,"%?.*","")
end
local BackendIp
local BackendPort
local DestHostName
if ctx.balancer_data and ctx.balancer_data.tries then
DestHostName = ctx.balancer_data.host
if ctx.balancer_data.tries[1] then
BackendIp = ctx.balancer_data.tries[1]["ip"]
BackendPort = ctx.balancer_data.tries[1]["port"]
end
end
local serviceName
if ctx.service ~= nil then
serviceName = ctx.service.name
end
local consumerFacingPort = ((var.server_port == "8443" or var.server_port == "8000") and "443" or "8443")
local temp_request = "https://" .. var.host .. ":" .. consumerFacingPort
if PathOnly then
temp_request = temp_request .. PathOnly
end
return {
name = serviceName,
eventClass = tostring(ngx.status),
receivedTime = req.start_time() * 1000,
msg = "STARGATE_PROXY_TX",
reason = kong.ctx.shared.errmsg,
logClass = (((ngx.status == "401" or ngx.status == "403") and ctx.KONG_WAITING_TIME == nil) and "SECURITY_FAILURE" or "SECURITY_SUCCESS"),
application = {
askId = conf.ask_id,
name = conf.app_name
},
device = {
vendor = "Optum",
product = "kong-kafka-log",
hostname = var.hostname,
ip4 = ipStrToDigits(var.server_addr)
},
sourceHost = {
ip4 = ipStrToDigits(var.remote_addr),
port = tonumber(consumerFacingPort)
},
sourceUser = {
name = ConsumerUsername,
tokenHash = tokenHash(returnToken(req.get_headers()["authorization"]))
},
destHost = {
hostname = DestHostName,
ipv4 = ipStrToDigits(BackendIp),
port = BackendPort,
path = UpstreamPathOnly
},
request = {
request = temp_request,
method = kong.request.get_method(),
Optum_CID_Ext = req.get_headers()["optum-cid-ext"],
["in"] = tonumber(var.request_length), --in is reserved word and must wrap it like so
out = tonumber(var.bytes_sent)
}
}
end
return _M
|
local prefix_handler = require "bluegate.cmd.prefix_handler"
local nginx_signals = require "bluegate.cmd.nginx_signals"
local conf_loader = require "bluegate.cmd.conf_loader"
local pl_path = require "pl.path"
local log = require "bluegate.cmd.log"
local function execute(args)
-- retrieve prefix or use given one
local default_conf = assert(conf_loader(args.conf, {
prefix = args.prefix
}))
assert(pl_path.exists(default_conf.prefix), "no such prefix: " .. default_conf.prefix)
-- local conf = assert(conf_loader(pl_path.join(default_conf.prefix,default_conf.bluegate_env), {
-- prefix = args.prefix
-- }))
assert(prefix_handler.prepare_prefix(default_conf, args.nginx_conf))
assert(nginx_signals.reload(default_conf))
log("bluegate reloaded")
end
local lapp = [[
Usage: bluegate reload [OPTIONS]
Reload a bluegate node (and start other configured services
if necessary) in given prefix directory.
This command sends a HUP signal to Nginx, which will spawn
new workers (taking configuration changes into account),
and stop the old ones when they have finished processing
current requests.
Options:
-c,--conf (optional string) configuration file
-p,--prefix (optional string) prefix bluegate is running at
--nginx-conf (optional string) custom Nginx configuration template
]]
return {
lapp = lapp,
execute = execute
}
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mission configuration file for the VEAF framework
-- see https://github.com/VEAF/VEAF-Mission-Creation-Tools
--
-- This configuration is tailored for the Caucasus OpenTraining mission
-- see https://github.com/VEAF/VEAF-Open-Training-Mission
-------------------------------------------------------------------------------------------------------------------------------------------------------------
veaf.config.MISSION_NAME = "OpenTraining_Caucasus"
veaf.config.MISSION_EXPORT_PATH = nil -- use default folder
-- play the radio beacons (for the public OT mission)
veafBeacons = false
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- initialize QRA
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veaf then
VeafQRA.new()
:setName("QRA_Minevody")
:addGroup("QRA_Minevody")
:setRadius(106680) -- 350,000 feet
:setCoalition(coalition.side.RED)
:addEnnemyCoalition(coalition.side.BLUE)
:setReactOnHelicopters()
:start()
VeafQRA.new()
:setName("QRA_Krasnodar")
:addGroup("QRA_Krasnodar")
:setRadius(106680) -- 350,000 feet
:setCoalition(coalition.side.RED)
:addEnnemyCoalition(coalition.side.BLUE)
:setReactOnHelicopters()
:start()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- initialize all the scripts
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafRadio then
veaf.loggers.get(veaf.Id):info("init - veafRadio")
veafRadio.initialize(true)
if veafBeacons then
-- add the beacons
veafRadio.startBeacon("Bienvenue-blue", 15, 120, "251.0,124.0,121.5,30.0", "am,am,am,fm", nil, "bienvenue-veaf-fr.mp3", 1.0, 2)
--veafRadio.startBeacon("Bienvenue-red", 45, 120, "251.0,124.0,121.5,30.0", "am,am,am,fm", nil, "bienvenue-veaf-fr.mp3", 1.0, 1)
veafRadio.startBeacon("Welcome-blue", 75, 120, "251.0,124.0,121.5,30.0", "am,am,am,fm", nil, "bienvenue-veaf-en.mp3", 1.0, 2)
--veafRadio.startBeacon("Welcome-red", 105, 120, "251.0,124.0,121.5,30.0", "am,am,am,fm", nil, "bienvenue-veaf-en.mp3", 1.0, 1)
veafRadio.startBeacon("Batumi", 5, 90, "122.5,131.0", "am,am", nil, "Batumi.mp3", 1.0, 2)
veafRadio.startBeacon("Beslan", 15, 90, "128.225,141.0", "am,am", nil, "Beslan.mp3", 1.0, 2)
veafRadio.startBeacon("Gudauta", 25, 90, "122.225,130.0", "am,am", nil, "Gudauta.mp3", 1.0, 2)
--veafRadio.startBeacon("Kobuleti", 35, 90, "122.3,133.0", "am,am", nil, "Kobuleti.mp3", 1.0, 2)
veafRadio.startBeacon("Kutaisi", 45, 90, "122.1,134.0", "am,am", nil, "Kutaisi.mp3", 1.0, 2)
--veafRadio.startBeacon("Nalchik", 55, 90, "128.525,136.0", "am,am", nil, "Nalchik.mp3", 1.0, 2)
veafRadio.startBeacon("Sochi", 65, 90, "126.2,127.0", "am,am", nil, "Sochi.mp3", 1.0, 2)
--veafRadio.startBeacon("Sukhumi", 75, 90, "122.7,129.0", "am,am", nil, "Sukhumi.mp3", 1.0, 2) -- attention ATIS = Batumi
veafRadio.startBeacon("Tbilisi", 85, 90, "132.8,138.0", "am,am", nil, "Tbilisi.mp3", 1.0, 2)
veafRadio.startBeacon("Vaziani", 95, 90, "122.6,140.0", "am,am", nil, "Vaziani.mp3", 1.0, 2)
--veafRadio.startBeacon("Anapa", 15, 30, "125.4,121.0", "am,am", nil, "Anapa.mp3", 1.0, 2)
--veafRadio.startBeacon("Gelendzhik", 15, 30, "134.875,126.0", "am,am", nil, "Gelendzhik.mp3", 1.0, 2)
--veafRadio.startBeacon("Krasnodar-Ctr", 15, 30, "128.3,122.0", "am,am", nil, "Krasnodar-Ctr.mp3", 1.0, 2)
--veafRadio.startBeacon("Krasnodar-Pshk", 15, 30, "122.45,128.0", "am,am", nil, "Krasnodar-Pshk.mp3", 1.0, 2)
--veafRadio.startBeacon("Krymsk", 15, 30, "128.6,124.0", "am,am", nil, "Krymsk.mp3", 1.0, 2)
--veafRadio.startBeacon("Maykop", 15, 30, "128.7,125.0", "am,am", nil, "Maykop.mp3", 1.0, 2)
--veafRadio.startBeacon("Mineralnye-Vody", 15, 30, "125.25,135", "am,am", nil, "Mineralnye-Vody.mp3", 1.0, 2)
--veafRadio.startBeacon("Mozdok", 15, 30, "128.55,137.0", "am,am", nil, "Mozdok.mp3", 1.0, 2)
--veafRadio.startBeacon("Novorossiysk", 15, 30, "128.2,123.0", "am,am", nil, "Novorossiysk.mp3", 1.0, 2)
--veafRadio.startBeacon("Senaki", 15, 30, "122.525,132.0", "am,am", nil, "Senaki.mp3", 1.0, 2)
--veafRadio.startBeacon("Soganlung", 15, 30, "122.6,139.0", "am,am", nil, "Soganlung.mp3", 1.0, 2)
end
end
if veafSpawn then
veaf.loggers.get(veaf.Id):info("init - veafSpawn")
veafSpawn.initialize()
end
if veafGrass then
veaf.loggers.get(veaf.Id):info("init - veafGrass")
veafGrass.initialize()
end
if veafCasMission then
veaf.loggers.get(veaf.Id):info("init - veafCasMission")
veafCasMission.initialize()
end
if veafTransportMission then
veaf.loggers.get(veaf.Id):info("init - veafTransportMission")
veafTransportMission.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- change some default parameters
-------------------------------------------------------------------------------------------------------------------------------------------------------------
veaf.DEFAULT_GROUND_SPEED_KPH = 25
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- initialize SHORTCUTS
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafShortcuts then
veaf.loggers.get(veaf.Id):info("init - veafShortcuts")
veafShortcuts.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure ASSETS
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafAssets then
veaf.loggers.get(veaf.Id):info("Loading configuration")
veafAssets.Assets = {
-- list the assets in the mission below
{sort=1, name="CSG-01 Tarawa", description="Tarawa (LHA)", information="Tacan 11X TAA\nU226 (11)"},
{sort=2, name="CSG-74 Stennis", description="Stennis (CVN)", information="Tacan 10X STS\nICLS 10\nU225 (10)"},
{sort=2, name="CSG-71 Roosevelt", description="Roosevelt (CVN)", information="Tacan 12X RHR\nICLS 11\nU227 (12)"},
{sort=3, name="T1-Arco-1", description="Arco-1 (KC-135)", information="Tacan 64Y\nU290.50 (20)\nZone OUEST", linked="T1-Arco-1 escort"},
{sort=4, name="T2-Shell-1", description="Shell-1 (KC-135 MPRS)", information="Tacan 62Y\nU290.30 (18)\nZone EST", linked="T2-Shell-1 escort"},
{sort=5, name="T3-Texaco-1", description="Texaco-1 (KC-135 MPRS)", information="Tacan 60Y\nU290.10 (17)\nZone OUEST", linked="T3-Texaco-1 escort"},
{sort=6, name="T4-Shell-2", description="Shell-2 (KC-135)", information="Tacan 63Y\nU290.40 (19)\nZone EST", linked="T4-Shell-2 escort"},
{sort=6, name="T5-Petrolsky", description="900 (IL-78M, RED)", information="U267", linked="T5-Petrolsky escort"},
{sort=7, name="CVN-74 Stennis S3B-Tanker", description="Texaco-7 (S3-B)", information="Tacan 75X\nU290.90\nZone PA"},
{sort=7, name="CVN-71 Roosevelt S3B-Tanker", description="Texaco-8 (S3-B)", information="Tacan 76X\nU290.80\nZone PA"},
{sort=8, name="Bizmuth", description="Colt-1 AFAC Bizmuth (MQ-9)", information="L1688 V118.80 (18)", jtac=1688, freq=118.80, mod="am"},
{sort=9, name="Agate", description="Dodge-1 AFAC Agate (MQ-9)", information="L1687 V118.90 (19)", jtac=1687, freq=118.90, mod="am"},
{sort=10, name="A1-Magic", description="Magic (E-2D)", information="Datalink 315.3 Mhz\nU282.20 (13)", linked="A1-Magic escort"},
{sort=11, name="A2-Overlordsky", description="Overlordsky (A-50, RED)", information="V112.12"},
}
veaf.loggers.get(veaf.Id):info("init - veafAssets")
veafAssets.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure MOVE
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafMove then
veaf.loggers.get(veaf.Id):info("Setting move tanker radio menus")
-- keeping the veafMove.Tankers table empty will force veafMove.initialize() to browse the units, and find the tankers
veaf.loggers.get(veaf.Id):info("init - veafMove")
veafMove.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure COMBAT MISSION
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafCombatMission then
veaf.loggers.get(veaf.Id):info("Loading configuration")
veafCombatMission.addCapMission("training-radar-tu22-FL300", "Crimea - Tu22 FL300", "Russian TU-22 patrols at FL300 west of the Crimea peninsula", false, true)
veafCombatMission.addCapMission("training-radar-bear-FL200", "Crimea - Bear FL200", "Russian TU-95 patrols at FL200 west of the Crimea peninsula ; ECM on", false, false)
veafCombatMission.addCapMission("training-radar-mig23-FL300", "Crimea - Mig23 FL300", "Mig-23MLD on CAP (R-24R = Fox1 MR) at FL300 west of the Crimea peninsula", false, false)
veafCombatMission.addCapMission("training-radar-mig29-FL300", "Crimea - Mig29 FL300", "Mig-29S on CAP (R-77 = Fox 3 MR) at FL300 west of the Crimea peninsula", false, true)
veafCombatMission.addCapMission("training-radar-mig31-FL300", "Crimea - Mig31 FL300", "Mig-31 on CAP (R-33 = Fox 3 LR) at FL300 west of the Crimea peninsula", false, false)
veafCombatMission.addCapMission("training-radar-mig23-FL300-notch", "Crimea - Mig23 notching", "Mig-23MLD on CAP (R-24R = Fox1 MR) notching W-E at FL300 west of the Crimea peninsula", false, false)
veafCombatMission.addCapMission("l39c-intercept-FL100", "Khashuri - L-39C heading north", "L-39C patrol heading N at 15 min of Kahshuri", false, true)
veafCombatMission.AddMissionsWithSkillAndScale(
VeafCombatMission.new()
:setSecured(true)
:setRadioMenuEnabled(true)
:setName("Intercept-Kraznodar-1")
:setFriendlyName("Intercept a transport / KRAZNODAR - MINVODY")
:setBriefing([[
A Russian transport plane is taking off from Kraznodar and will transport a VIP to Mineralnye Vody.
It is escorted by a fighter patrol.
]]
)
:addElement(
VeafCombatMissionElement.new()
:setName("OnDemand-Intercept-Transport-Krasnodar-Mineral-Transport")
:setGroups({"OnDemand-Intercept-Transport-Krasnodar-Mineral-Transport"})
:setScalable(false)
)
:addElement(
VeafCombatMissionElement.new()
:setName("OnDemand-Intercept-Transport-Krasnodar-Mineral-Escort")
:setGroups({"OnDemand-Intercept-Transport-Krasnodar-Mineral-Escort"})
:setSkill("Random")
)
:addObjective(
VeafCombatMissionObjective.new()
:setName("Destroy the transport")
:setDescription("you must destroy the transport and kill the VIP")
:setMessage("%d transport planes destroyed !")
:configureAsKillEnemiesObjective() -- TODO
)
:initialize()
)
veafCombatMission.AddMission(
VeafCombatMission.new()
:setSecured(true)
:setRadioMenuEnabled(true)
:setName("Red-attack-Gudauta")
:setFriendlyName("Red attack On Gudauta")
:setBriefing([[
Alert ! This is not a drill !
Tactical and strategic bombers have been detected at the russian border, to the north of Gudauta.
Their course will lead them to the Gudauta airbase, which is probably their mission.
Destroy all the bombers before they hit the base !
]]
)
:addElement(
VeafCombatMissionElement.new()
:setName("SEAD")
:setGroups({
"Red Attack On Gudauta - Wave 1-1",
"Red Attack On Gudauta - Wave 1-2",
"Red Attack On Gudauta - Wave 1-3",
"Red Attack On Gudauta - Wave 1-4" })
:setSkill("Random")
)
:addElement(
VeafCombatMissionElement.new()
:setName("Bombers")
:setGroups({
"Red Attack On Gudauta - Wave 2-1",
"Red Attack On Gudauta - Wave 2-2",
"Red Attack On Gudauta - Wave 2-3" })
:setSkill("Random")
)
:addObjective(
VeafCombatMissionObjective.new()
:setName("HVT Gudauta")
:setDescription("the mission will be failed if any of the HVT on Gudauta are destroyed")
:setMessage("HVT target(s) destroyed : %s !")
:configureAsPreventDestructionOfSceneryObjectsInZone(
{
"Gudauta - Tower",
"Gudauta - Kerosen",
"Gudauta - Mess"},
{
[156696667] = "Gudauta Tower",
[156735615] = "Gudauta Kerosen tankers",
[156729386] = "Gudauta mess"
}
)
)
:addObjective(
VeafCombatMissionObjective.new()
:setName("Kill all the bombers")
:setDescription("you must kill all of the bombers")
:setMessage("%d bombers destroyed !")
:configureAsKillEnemiesObjective()
)
:initialize()
)
veafCombatMission.AddMission(
VeafCombatMission.new()
:setName("Training-Bomber-1-slow")
:setFriendlyName("Training - Bomber Scenario 1 - slow Tu-160")
:setBriefing([[
You're head-on at 25nm with 11 Tu-160, FL200, Mach 0.8.
Destroy them all in less than 10 minutes !]])
:addElement(
VeafCombatMissionElement.new()
:setName("Bombers")
:setGroups({
"Red Tu-160 Bomber Wave1-1",
"Red Tu-160 Bomber Wave1-2",
"Red Tu-160 Bomber Wave1-3",
"Red Tu-160 Bomber Wave1-4",
"Red Tu-160 Bomber Wave1-5",
"Red Tu-160 Bomber Wave1-6",
"Red Tu-160 Bomber Wave1-7",
"Red Tu-160 Bomber Wave1-8",
"Red Tu-160 Bomber Wave1-9",
"Red Tu-160 Bomber Wave1-10",
"Red Tu-160 Bomber Wave1-11",
})
:setSkill("Good")
)
:addObjective(
VeafCombatMissionObjective.new()
:setName("< 15 minutes")
:setDescription("the mission will be over after 15 minutes")
:setMessage("the 15 minutes have passed !")
:configureAsTimedObjective(900)
)
:addObjective(
VeafCombatMissionObjective.new()
:setName("Kill all the bombers")
:setDescription("you must kill or route all bombers")
:setMessage("%d bombers destroyed or routed !")
:configureAsKillEnemiesObjective(-1, 50)
)
:setSecured(false)
:initialize()
)
veafCombatMission.AddMission(
VeafCombatMission.new()
:setName("ELINT-Mission-West")
:setFriendlyName("ELINT gathering over the West zone")
:setBriefing([[
ATIS on 282.125, SAM CONTROL on 282.225
A C-130 pair will fly reciprocical headings, trying to pinpoint enemy SAMS.
Don't let them be destroyed by the enemy !]])
:addElement(
VeafCombatMissionElement.new()
:setName("ELINT-W")
:setGroups({
"ELINT-C-130-W-1",
"ELINT-C-130-W-2"
})
:setSkill("Good")
)
:setSecured(true)
:initialize()
)
veafCombatMission.AddMission(
VeafCombatMission.new()
:setName("ELINT-Mission-East")
:setFriendlyName("ELINT gathering over the East zone")
:setBriefing([[
ATIS on 282.125, SAM CONTROL on 282.225
A C-130 pair will fly reciprocical headings, trying to pinpoint enemy SAMS.
Don't let them be destroyed by the enemy !]])
:addElement(
VeafCombatMissionElement.new()
:setName("ELINT-E")
:setGroups({
"ELINT-C-130-E-1",
"ELINT-C-130-E-2"
})
:setSkill("Good")
)
:setSecured(true)
:initialize()
)
veaf.loggers.get(veaf.Id):info("init - veafCombatMission")
veafCombatMission.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure COMBAT ZONE
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafCombatZone then
veaf.loggers.get(veaf.Id):info("Loading configuration")
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_Psebay_Factory")
:setFriendlyName("Psebay chemical weapons factory")
:setBriefing("This factory manufactures chemical weapons for a terrorits group\n" ..
"You must destroy both factory buildings, and the bunker where the scientists work\n" ..
"The other enemy units are secondary targets\n")
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_BattleOfBeslan")
:setFriendlyName("Battle of Beslan")
:setBriefing("This zone is the place of a battle between red and blue armies.\n" ..
"You must do what you can to help your side win\n" ..
"Please note that there is an enemy convoy coming from the west and going to Sheripova, that can be ambushed by the blue forces at Malgobek in 15-30 minutes. Be wary of the SAM that can hide anywhere in the cities or the forests !\n" ..
"Warning : there are air defenses lurking about, you should be cautious !")
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_EasyPickingsTerek")
:setFriendlyName("Terek logistics parking")
:setBriefing("The enemy has parked a lot of logistics at Terek\n" ..
"You must destroy all the trucks to impend the advance of their army on Beslan\n" ..
"The other enemy units are secondary targets\n"..
"This is a more easy zone, with few air defenses. But beware that there is a chance of manpad in the area !")
:setTraining(true)
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_rangeKobuletiEasy")
:setFriendlyName("Training at Kobuleti RANGE")
:setBriefing("The Kobuleti RANGE (located 6 nm south-west of Kobuleti airbase) is set-up for training")
:setTraining(true)
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_SaveTheHostages")
:setFriendlyName("Hostages at Prohladniy")
:setBriefing("Hostages are being held in a fortified hotel in the city of Prohladniy.\n" ..
"Warning : there are air defenses lurking about, you should be cautious !")
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_Antiship-Training-Easy")
:setFriendlyName("Antiship Training - Easy")
:setBriefing("Undefended cargo ships ready for plunder; Arrrrr! Shiver me timbers!")
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_Antiship-Training-Hard")
:setFriendlyName("Antiship Training - Hard")
:setBriefing("Cargo ships defended by escort ships; warning, an FFG 11540 Neustrashimy may escort them as well...")
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_roadBlock")
:setFriendlyName("Road Block KM91")
:setBriefing("38T KM946122 - 6300ft - KOB 67X 115/35\nRussia is blocking a main road between Batumi and Tbilisi.\nDestroy bunkers and vehicles.\nENI convoy is comming from the East.")
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("combatZone_MaykopDefenses")
:setFriendlyName("Maykop airbase defenses")
:setBriefing("The Maykop airbase is defended by a SA10 battalion, point-defense SHORAD and AAA, and armored vehicles\n" ..
"You must incapacitate the defenses in order to prepare a land invasion")
)
veafCombatZone.AddZone(
VeafCombatZone.new()
:setMissionEditorZoneName("CombatZone_MountainHike")
:setFriendlyName("Mountain hike")
:setCompletable(false)
:setTraining(true)
:setBriefing("A friendly Mi-8MTV2 has crashed in the mountains, near the russian border, 45nm north-east of Sukhumi.\n" ..
"You can takeoff from the Kodori FARP or grass runway, follow the valley to the northeast until you pass the border and locate the crash site\n" ..
"There are beacons in the mountains to guide you : \n" ..
" - MH01 on 31.00 FM\n" ..
" - MH02 on 32.00 FM\n" ..
" - MH03 on 33.00 FM\n" ..
"The crashed helicopter's crew transmits on their pocket radio : SOS on 34.00 FM")
)
veaf.loggers.get(veaf.Id):info("init - veafCombatZone")
veafCombatZone.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure WW2 settings based on loaded theatre
-------------------------------------------------------------------------------------------------------------------------------------------------------------
local theatre = string.lower(env.mission.theatre)
veaf.loggers.get(veaf.Id):info(string.format("theatre is %s", theatre))
veaf.config.ww2 = false
if theatre == "thechannel" then
veaf.config.ww2 = true
elseif theatre == "normandy" then
veaf.config.ww2 = true
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure NAMEDPOINTS
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafNamedPoints then
veaf.loggers.get(veaf.Id):info("Loading configuration")
veaf.loggers.get(veaf.Id):info("init - veafNamedPoints")
if theatre == "syria" then
veafNamedPoints.Points = {
-- Turkish Airports
{name="INCIRLIK AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("37.001944", "35.425833"), {atc=true, tower="V129.40, U360.10", tacan="21X", runways={{name="05", hdg=50, ils="109.30"}, {name="23", hdg=230, ils="111.70"}}})},
{name="ADANA SAKIRPASA INTL", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("36.981944", "35.280278"), {atc=true, tower="V121.10, U251.00", runways={{name="05", hdg=51, ils="108.70"}, {name="23", hdg=231}}})},
{name="HATAY AIRPORT", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("36.360278", "36.285000"), {atc=true, tower="V128.50, U250.25", runways={{name="04", hdg=40, ils="108.90"}, {name="22", hdg=220, ils="108.15"}}})},
{name="GANZIANTEP",point=veafNamedPoints.addDataToPoint(coord.LLtoLO("36.947057", "37.478579"), {atc=true, tower="V120.10, U250.05", runways={{name="10", hdg=100}, {name="28", hdg=280, ils="109.10"}}})},
-- Syrian Airports
{name="MINAKH HELIPT", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("36.521944", "37.041111"), {atc=true, tower="V120.60, U250.80", runways={{name="10", hdg=97}, {name="28", hdg=277}}})},
{name="ALEPPO INTL", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("36.180556", "37.224167"), {atc=true, tower="V119.10, U250.85", runways={{name="09", hdg=93}, {name="27", hdg=273}}})},
{name="KUWEIRES AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("36.186944", "37.583056"), {atc=true, tower="V120.50, U251.10", runways={{name="10", hdg=97}, {name="28", hdg=277}}})},
{name="JIRAH AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("36.097500", "37.940278"), {atc=true, tower="V118.10, U250.30", runways={{name="10", hdg=96}, {name="28", hdg=276}}})},
{name="TAFTANAZ HELIPT", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("35.972222", "36.783056"), {atc=true, tower="V122.80, U251.45", runways={{name="10", hdg=100}, {name="28", hdg=280}}})},
{name="ABU AL DUHUR AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("35.732778", "37.101667"), {atc=true, tower="V122.20, U250.45", runways={{name="09", hdg=89}, {name="27", hdg=269}}})},
{name="TABQA AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("35.754444", "38.566667"), {atc=true, tower="V118.50, U251.40", runways={{name="09", hdg=88}, {name="27", hdg=268}}})},
{name="BASSEL AL ASSAD (KHMEIMIM)", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("35.400833", "35.948611"), {atc=true, tower="V118.10, U250.55", runways={{name="17R", hdg=174, ils="109.10"}, {name="17L", hdg=174}, {name="35R", hdg=354}, {name="35L", hdg=354}}})},
{name="HAMA AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("35.118056", "36.711111"), {atc=true, tower="V118.05, U250.20", runways={{name="09", hdg=96}, {name="27", hdg=276}}})},
{name="AL QUSAYR AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("34.570833", "36.571944"), {atc=true, tower="V119.20, U251.55", runways={{name="10", hdg=98}, {name="28", hdg=278}}})},
{name="PALYMYRA AIRPORT", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("34.557222", "38.316667"), {atc=true, tower="V121.90, U250.90", runways={{name="08", hdg=80}, {name="26", hdg=260}}})},
{name="AN NASIRIYAH AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.918889", "36.866389"), {atc=true, tower="V122.30, U251.65", runways={{name="04", hdg=41}, {name="22", hdg=221}}})},
{name="AL DUMAYR AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.609444", "36.748889"), {atc=true, tower="V120.30, U251.95", runways={{name="06", hdg=62}, {name="24", hdg=242}}})},
{name="MEZZEH AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.477500", "36.223333"), {atc=true, tower="V120.70, U250.75", runways={{name="06", hdg=57}, {name="24", hdg=237}}})},
{name="MARJ AS SULTAN NTH HELIPT", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.500278", "36.466944"), {atc=true, tower="V122.70, U250.60", runways={{name="08", hdg=80}, {name="26", hdg=260}}})},
{name="MARJ AS SULTAN STH HELIPT", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.486944", "36.475278"), {atc=true, tower="V122.90, U251.90", runways={{name="09", hdg=90}, {name="27", hdg=270}}})},
{name="QABR AS SITT HELIPT", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.458611", "36.357500"), {atc=true, tower="V122.60, U250.95", runways={{name="05", hdg=50}, {name="23", hdg=230}}})},
{name="DAMASCUS INTL", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.415000", "36.519444"), {atc=true, tower="V118.50, U251.85", runways={{name="05R", hdg=46}, {name="05L", hdg=46}, {name="23R", hdg=226, ils="109.90"}, {name="23L", hdg=226}}})},
{name="MARJ RUHAYYIL AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.286389", "36.457222"), {atc=true, tower="V120.80, U250.65", runways={{name="06", hdg=59}, {name="24", hdg=239}}})},
{name="KHALKHALAH AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.077222", "36.558056"), {atc=true, tower="V122.50, U250.35", runways={{name="07", hdg=72}, {name="15", hdg=147}, {name="25", hdg=252}, {name="33", hdg=327}}})},
{name="SAYQUAL AB",point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.679816", "37.218204"), {atc=true, tower="V120.40, U251.30", runways={{name="08", hdg=80}, {name="26", hdg=260}}})},
{name="SHAYRAT AB",point=veafNamedPoints.addDataToPoint(coord.LLtoLO("34.494819", "36.903173"), {atc=true, tower="V120.20, U251.35", runways={{name="11", hdg=110}, {name="29", hdg=290}}})},
{name="TIYAS AB",point=veafNamedPoints.addDataToPoint(coord.LLtoLO("34.522645", "37.627498"), {atc=true, tower="V120.50, U251.50", runways={{name="09", hdg=90}, {name="27", hdg=270}}})},
-- Lebanese Airports
{name="RENE MOUAWAD AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("34.589444", "36.011389"), {atc=true, tower="V121.00, U251.20", runways={{name="06", hdg=59}, {name="24", hdg=239}}})},
{name="HAJAR AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("34.283333", "35.680278"), {atc=true, tower="V121.50, U251.60", runways={{name="02", hdg=25}, {name="20", hdg=205}}})},
{name="BEIRUT INTL", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.821111", "35.488333"), {atc=true, tower="V118.90, U251.80", runways={{name="03", hdg=30, ils="110.70"}, {name="16", hdg=164, ils="110.10"}, {name="17", hdg=175, ils="109.50"}, {name="21", hdg=210}, {name="34", hdg=344}, {name="35", hdg=355}}})},
{name="RAYAK AB", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.852222", "35.990278"), {atc=true, tower="V124.40, U251.15", runways={{name="04", hdg=42}, {name="22", hdg=222}}})},
{name="NAQOURA HELIPT",point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.107877", "35.127728"), {atc=true, tower="V122.00, U251.70"})},
-- Israeli Airports
{name="KIRYAT SHMONA AIRPORT", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("33.216667", "35.596667"), {atc=true, tower="V118.40, U250.50", runways={{name="03", hdg=34}, {name="21", hdg=214}}})},
{name="HAIFA INTL", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("32.809167", "35.043056"), {atc=true, tower="V127.80, U250.15", runways={{name="16", hdg=158}, {name="34", hdg=338}}})},
{name="RAMAT DAVID INTL", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("32.665000", "35.179444"), {atc=true, tower="V118.60, U251.05", runways={{name="09", hdg=85}, {name="11", hdg=107}, {name="15", hdg=143}, {name="27", hdg=265}, {name="29", hdg=287}, {name="33", hdg=323}}})},
{name="MEGIDDO AIRFIELD", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("32.597222", "35.228611"), {atc=true, tower="V119.90, U250.70", runways={{name="09", hdg=89}, {name="27", hdg=269}}})},
{name="EYN SHEMER AIRFIELD", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("32.440556", "35.007500"), {atc=true, tower="V123.40, U250.00", runways={{name="09", hdg=96}, {name="27", hdg=276}}})},
-- Jordan Airports
{name="KING HUSSEIN AIR COLLEGE", point=veafNamedPoints.addDataToPoint(coord.LLtoLO("32.356389", "36.259167"), {atc=true, tower="V118.30, U250.40", runways={{name="13", hdg=128}, {name="31", hdg=308}}})},
{name="H4",point=veafNamedPoints.addDataToPoint(coord.LLtoLO("32.539122", "38.195841"), {atc=true, tower="V122.60, U250.10", runways={{name="10", hdg=100}, {name="28", hdg=280}}})},
}
veafNamedPoints.addAllSyriaCities()
elseif theatre == "caucasus" then
veafNamedPoints.Points = {
-- airbases in Georgia
{name="AIRBASE Batumi", point={x=-356437,y=0,z=618211, atc=true, tower="V131, U260", tacan="16X BTM", runways={{name="13", hdg=125, ils="110.30"}, {name="31", hdg=305}}}},
{name="AIRBASE Gudauta", point={x=-196850,y=0,z=516496, atc=true, tower="V130, U259", runways={ {name="15", hdg=150}, {name="33", hdg=330}}}},
{name="AIRBASE Kobuleti",point={x=-318000,y=0,z=636620, atc=true, tower="V133, U262", tacan="67X KBL", runways={ {name="07", hdg=69, ils="111.50"}}}},
{name="AIRBASE Kutaisi", point={x=-284860,y=0,z=683839, atc=true, tower="V134, U264", tacan="44X KTS", runways={ {name="08", hdg=74, ils="109.75"}, {name="26", hdg=254}}}},
{name="AIRBASE Senaki", point={x=-281903,y=0,z=648379, atc=true, tower="V132, U261", tacan="31X TSK", runways={ {name="09", hdg=94, ils="108.90"}, {name="27", hdg=274}}}},
{name="AIRBASE Sukhumi", point={x=-221382,y=0,z=565909, atc=true, tower="V129, U258", runways={{name="12", hdg=116}, {name="30", hdg=296}}}},
{name="AIRBASE Tbilisi", point={x=-314926,y=0,z=895724, atc=true, tower="V138, U267", tacan="25X GTB", runways={{name="13", hdg=127, ils="110.30"},{name="31", hdg=307, ils="108.90"}}}},
{name="AIRBASE Vaziani", point={x=-319000,y=0,z=903271, atc=true, tower="V140, U269", tacan="22X VAS", runways={ {name="13", hdg=135, ils="108.75"}, {name="31", hdg=315, ils="108.75"}}}},
-- airbases in Russia
{name="AIRBASE Anapa - Vityazevo", point={x=-004448,y=0,z=244022, atc=true, tower="V121, U250" , runways={ {name="22", hdg=220}, {name="04", hdg=40}}}},
{name="AIRBASE Beslan", point={x=-148472,y=0,z=842252, atc=true, tower="V141, U270", runways={ {name="10", hdg=93, ils="110.50"}, {name="28", hdg=273}}}},
{name="AIRBASE Krymsk", point={x=-007349,y=0,z=293712, atc=true, tower="V124, U253", runways={ {name="04", hdg=39}, {name="22", hdg=219}}}},
{name="AIRBASE Krasnodar-Pashkovsky",point={x=-008707,y=0,z=388986, atc=true, tower="V128, U257", runways={ {name="23", hdg=227}, {name="05", hdg=47}}}},
{name="AIRBASE Krasnodar-Center", point={x=-011653,y=0,z=366766, atc=true, tower="V122, U251", runways={ {name="09", hdg=86}, {name="27", hdg=266}}}},
{name="AIRBASE Gelendzhik", point={x=-050996,y=0,z=297849, atc=true, tower="V126, U255", runways={ {hdg=40}, {hdg=220}}}},
{name="AIRBASE Maykop", point={x=-027626,y=0,z=457048, atc=true, tower="V125, U254", runways={ {name="04", hdg=40}, {name="22", hdg=220}}}},
{name="AIRBASE Mineralnye Vody", point={x=-052090,y=0,z=707418, atc=true, tower="V135, U264", runways={ {name="12", hdg=115, ils="111.70"}, {name="30", hdg=295, ils="109.30"}}}},
{name="AIRBASE Mozdok", point={x=-083330,y=0,z=835635, atc=true, tower="V137, U266", runways={ {name="08", hdg=82}, {name="26", hdg=262}}}},
{name="AIRBASE Nalchik", point={x=-125500,y=0,z=759543, atc=true, tower="V136, U265", runways={ {name="06", hdg=55}, {name="24", hdg=235, ils="110.50"}}}},
{name="AIRBASE Novorossiysk", point={x=-040299,y=0,z=279854, atc=true, tower="V123, U252", runways={ {name="04", hdg=40}, {name="22", hdg=220}}}},
{name="AIRBASE Sochi", point={x=-165163,y=0,z=460902, atc=true, tower="V127, U256", runways={ {name="06", hdg=62, ils="111.10"}, {name="24", hdg=242}}}},
}
veafNamedPoints.addAllCaucasusCities()
elseif theatre == "persiangulf" then
veafNamedPoints.Points = {
}
veafNamedPoints.addAllPersianGulfCities()
elseif theatre == "thechannel" then
veafNamedPoints.Points = {
}
veafNamedPoints.addAllTheChannelCities()
elseif theatre == "marianaislands" then
veafNamedPoints.Points = {
-- airbases in Blue Island
{name="AIRBASE Andersen AFB", point={x=-010688,y=0,z=014822, atc=true, tower="V126.2, U250.1", tacan="54X", runways={{name="06", hdg=66}, {name="24", hdg=246}}}},
{name="AIRBASE Antonio B. Won Pat Intl", point={x=-000068,y=0,z=-000109, atc=true, tower="V118.1, U340.2", runways={ {name="6", hdg=65, ils="110.30"}, {name="24", hdg=245}}}},
{name="AIRBASE Olf Orote",point={x=-005047,y=0,z=-016913, atc=false}},
{name="AIRBASE Santa Rita",point={x=-013576,y=0,z=-009925, atc=false}},
-- airbases in Neutral Island
{name="AIRBASE Rota Intl", point={x=-075886,y=0,z=048612, atc=true, tower="V123.6, U250", tacan="44X KTS", runways={ {name="09", hdg=92, ils="109.75"}, {name="27", hdg=272}}}},
-- airbases in Red Island
{name="AIRBASE Tinian Intl", point={x=-166865,y=0,z=090027, atc=true, tower="V123.65, U250.05", tacan="31X TSK", runways={ {name="0", hdg=94, ils="108.90"}, {name="27", hdg=274}}}},
{name="AIRBASE Saipan Intl", point={x=180074,y=0,z=101921, atc=true, tower="V125.7, U256.9", runways={{name="07", hdg=68, ils="109.90"}, {name="25", hdg=248}}}},
}
veafNamedPoints.addAllMarianasIslandsCities()
else
veaf.loggers.get(veaf.Id):warn(string.format("theatre %s is not yet supported by veafNamedPoints", theatre))
end
-- points of interest
table.insert(veafNamedPoints.Points,
{name="RANGE Kobuleti",point={x=-328289,y=0,z=631228}}
)
veafNamedPoints.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure SECURITY
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafSecurity then
veafSecurity.password_L9["6ade6629f9219d87a011e7b8fbf8ef9584f2786d"] = true -- set the L9 password (the lowest possible security)
veaf.loggers.get(veaf.Id):info("Loading configuration")
veaf.loggers.get(veaf.Id):info("init - veafSecurity")
veafSecurity.initialize()
-- force security in order to test it when dynamic loading is in place (change to TRUE)
if (false) then
veaf.SecurityDisabled = false
veafSecurity.authenticated = false
end
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure CARRIER OPERATIONS
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafCarrierOperations then
veaf.loggers.get(veaf.Id):info("init - veafCarrierOperations")
veafCarrierOperations.initialize(true)
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- configure CTLD
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if ctld then
veaf.loggers.get(veaf.Id):info("init - ctld")
ctld.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- initialize the remote interface
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafRemote then
veaf.loggers.get(veaf.Id):info("init - veafRemote")
veafRemote.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- initialize the interpreter
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafInterpreter then
veaf.loggers.get(veaf.Id):info("init - veafInterpreter")
veafInterpreter.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- initialize Skynet-IADS
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafSkynet then
veaf.loggers.get(veaf.Id):info("init - veafSkynet")
veafSkynet.initialize(
false, --includeRedInRadio=true
false, --debugRed
false, --includeBlueInRadio
false --debugBlue
)
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- initialize veafSanctuary
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafSanctuary then
veaf.loggers.get(veaf.Id):info("init - veafSanctuary")
veafSanctuary.addZone(
VeafSanctuaryZone.new()
:setName("Blue Sanctuary")
:setPolygonFromUnitsInSequence("BlueSanctuary", true)
:setCoalition(coalition.side.BLUE)
:setDelayWarning(0) -- warning when the plane is detected in the zone
:setDelaySpawn(-1) -- start spawning defense systems
:setDelayInstant(60) -- instant death
:setMessageWarning("Warning, %s : you've entered a sanctuary zone and will be destroyed in %d seconds if you don't leave IMMEDIATELY")
:setProtectFromMissiles()
)
veafSanctuary.initialize()
end
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- initialize Hound Elint
-------------------------------------------------------------------------------------------------------------------------------------------------------------
if veafHoundElint and false then -- don't use Hound Elint
veaf.loggers.get(veaf.Id):info("init - veafHoundElint")
veafHoundElint.initialize(
"ELINT", -- prefix
{ -- red
admin = false,
markers = true,
atis = false,
controller = false
},
{ -- blue
admin = false,
markers = true,
atis = {
freq = 282.125,
interval = 15,
speed = 1,
reportEWR = false
},
controller = {
freq = 282.225,
voiceEnabled = true
}
}
)
-- automatically start the two ELINT missions
veafCombatMission.ActivateMission("ELINT-Mission-East", true)
veafCombatMission.ActivateMission("ELINT-Mission-West", true)
end
-- Silence ATC on all the airdromes
veaf.silenceAtcOnAllAirbases()
-- automatically activate the Maykop Defenses zone
veafCombatZone.ActivateZone("combatZone_MaykopDefenses", true)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mission C002 - Neutralisation des lacs de Tkibuli - https://github.com/VEAF/VEAF-Open-Training-Mission/wiki/Mission-C002
-------------------------------------------------------------------------------------------------------------------------------------------------------------
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c002-1")
:setDescription("Mission C002 - 1 - before mission start")
:setBatchAliases({
"-shell#U38TLM3120086100",
"-shell#U38TLM3155087960",
"-point#U38TLM3167086723 C503-1",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c002-2")
:setDescription("Mission C002 - 2 - before takeoff")
:setBatchAliases({
"-transport#U38TLM3167086723, side red, size 5, defense 1, dest haristvala, patrol, spacing 0.5",
"-transport#U38TLM3894597626, side red, size 7, defense 0, dest C503-1, patrol, spacing 0.5",
"-infantry#U38TLM3129085430, side red, size 10, defense 0, spacing 0.5",
"-zu23#U38TLM3314088860, side red, radius 1000",
"-transport#U38TLM3342089320, side red, size 10, defense 0, spacing 0.5",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c002-3")
:setDescription("Mission C002 - 3 - optional (more defenses)")
:setBatchAliases({
"-zu23#U38TLM3314088860, side red, radius 1000",
"-zu23#U38TLM3314088860, side red, radius 1000",
"-infantry#U38TLM3129085430, side red, size 10, defense 4, spacing 0.5",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mission C003 - Frappe d'une usine en profondeur - https://github.com/VEAF/VEAF-Open-Training-Mission/wiki/Mission-C003
-------------------------------------------------------------------------------------------------------------------------------------------------------------
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c003")
:setDescription("Mission C003 - before takeoff")
:setBatchAliases({
"-sa8#U37TGJ3229065410!2400, radius 1500",
"-sa13#U37TGJ3229065410!2400, radius 1500",
"-sa6#U37TGJ3263068240!2400",
"-sa13#U37TGJ3263068240!2400, radius 2000",
"-sa6#U37TGJ1513065710!2400",
"-sa8#U37TGJ3200067600!2400",
"-sa8#U37TGJ3405061500!2400 ",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mission C004 - Strike sur ponts et FOB - https://github.com/VEAF/VEAF-Open-Training-Mission/wiki/Mission-C004
-------------------------------------------------------------------------------------------------------------------------------------------------------------
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c004")
:setDescription("Mission C004 - before mission start")
:setBatchAliases({
"-infantry#U38TMN2703021480, side red, size 10, defense 2, spacing 0.5, armor 1",
"-infantry#U38TMN2529820390, side red, size 10, defense 2, spacing 0.5, armor 1",
"-armor#U38TMN1520028060, side red, size 5, defense 5",
"-transport#U38TMN1512028000, side red, size 5, defense 0, spacing 0.5",
"-transport#U38TMN1845038290, side red, defense 4",
"-transport#U38TMN2703021480, side red, dest U38TMN1644527965, patrol, size 7, defense 2",
"-transport#U38TMN1845038290, side red, dest U38TMN2529820390, patrol, size 10, spacing 0.5",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mission C102 - Projection rapide de troupes - https://github.com/VEAF/VEAF-Open-Training-Mission/wiki/Mission-C102
-------------------------------------------------------------------------------------------------------------------------------------------------------------
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c102")
:setDescription("Mission C102 - before mission start")
:setBatchAliases({
"-transport#U38TMN2898519805!1200, side red, size 10, defense 0, dest kvemosba, spacing 0.5",
"-armor#U38TMN2900019800!1200, side red, size 2, defense 0, dest kvemosba, spacing 0.5, armor 1",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mission C501 - EVASAN d'urgence - https://github.com/VEAF/VEAF-Open-Training-Mission/wiki/Mission-C501
-------------------------------------------------------------------------------------------------------------------------------------------------------------
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c501")
:setDescription("Mission C501 - before takeoff")
:setBatchAliases({
"-longsmoke#U38TLM1300041700, repeat 10, color blue", -- 60 minutes of blue smoke
"-infantry#U38TLM1301041710, side blue, size 5",
"-convoy#U38TLM2040053930, side red, size 7, defense 2, dest kursairme",
"-convoy#U38TLM2738549911, side red, size 5, defense 1, dest kursairme",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
-------------------------------------------------------------------------------------------------------------------------------------------------------------
-- Mission C502 - Escorter le convoi - https://github.com/VEAF/VEAF-Open-Training-Mission/wiki/Mission-C502
-------------------------------------------------------------------------------------------------------------------------------------------------------------
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c502")
:setDescription("Mission C502 - before takeoff")
:setBatchAliases({
"-infantry#U37TEJ78702220, armor 0, defense 0, multiplier 3, side red",
"-infantry#U37TEJ81432718, defense 0, multiplier 3, side red",
"-infantry#U37TEJ84873017, defense 0, multiplier 3, side red",
"-infantry#U37TEJ87673163, defense 1, armor 2, multiplier 2, side red",
"-armor#U37TEJ90003260, defense 1, side red",
"-infantry#U37TEJ90003260, side red",
"-convoy#U37TEJ74911126, side blue, armor 0, defense 0, dest FARP KRASNAYA EJ93",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
veafShortcuts.AddAlias(
VeafAlias:new()
:setName("-c502-help")
:setDescription("Mission C502 - smoke markers (if needed)")
:setBatchAliases({
"-smoke#U37TEJ78702220, color red",
"-smoke#U37TEJ81432718, color red",
"-smoke#U37TEJ84873017, color red",
"-smoke#U37TEJ87673163, color red",
"-smoke#U37TEJ90003260, color red",
})
:setPassword("5990da82192566a785187a8276a2ccf61c2b5819") -- briefingcaucasus21
)
|
--Random quotes, phrases and memes from our rhythm gaming community /o/
--(that you may or may not be familar with.... heck i don't even know the references for some of these)
--mainly from stepmania & Etterna
-- Also (hopefully helpful) tips regarding the game/theme,etc.
-----------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------
local Tips = {
"Rolls are the name of both a pattern and a note type.",
"Gluts are rapid sections of jumps forming minijacks.",
"A stream is a continuous run of notes, but utilizing multiple columns instead of just one.",
"Jack is short for jackhammer. Doesn't mean anything else. Trust me",
"Switching to a higher judge is only really necessary if you genuinely need the feedback. Otherwise, J4 is where it's at.",
"Hold tab to speed up menu animations.",
"The screenshot button is PrintScreen. It doesn't work for a lot of people in fullscreen. We know.",
"Reload songs by pressing Ctrl + Q.",
"Favorite a song by pressing Ctrl + F.",
"Toggle practice mode by pressing Ctrl + O.",
"Toggle chart preview by pressing Space.",
"Right click in most places to pause the music in SelectMusic.",
"The F3 Debug menu contains many helpful shortcuts to game options.",
"If changing the audio or visual sync isn't helping your mean, have you considered moving the NoteField or changing scroll speed?",
"The button display in Replay mode can be dragged.",
"The display in Customize Gameplay can be dragged.",
"Pressing RestartGameplay while in Customize Gameplay can undo a change you made, or reset to default by holding Ctrl, too.",
"Practice mode loop regions are very useful for practicing a pattern or mindblocking it ... Right click the graph to set one.",
"Replay mode functionality requires the music to be paused first.",
"You are allowed to log in or log out in the evaluation screen. Try Ctrl + L or click the connection symbol on your avatar.",
"To put an avatar into the game, put any image into Assets/Avatars and click your avatar ingame.",
"To customize your judgment, put a new judgment image into Assets/Judgments and click your avatar ingame to switch.",
"After a 250 perfect combo, a toasty will pop up to congratulate you.",
"DDReam is useful for syncing over ArrowVortex due to its ability to let you drag beats with your mouse among other things.",
"When manually installing songs, make sure to keep song folders inside of pack folders. Things go very bad otherwise.",
"To update a song from disk manually, try Ctrl + Shift + R.",
"To update a whole pack from disk manually, try Ctrl + Shift + P.",
"The game framerate can be limited to something other than VSync or 1000 by modifying FrameLimit in Preferences.ini.",
"Score uploading has no progress indicator... Just trust in the process.",
"Pack downloading can be rate limited by ISP sometimes. It's not always your fault or our fault.",
"Download speed is limited by framerate sometimes.",
"Song search resets when you enter a song, but filtering does not.",
"Song search, filtering, and pack tags can all be mixed together.",
"Some song sortmodes may offer a better experience for you. Check them out in the Up-Down-Up-Down menu.",
"Is a gameplay element bothering you? Turn it off or move it in customize gameplay.",
"A score is good if it's good for you. There will always be a bigger fish.",
"What's a good score? 0 mean 0 sd 100%",
"This game is an offline game. The online features are a bonus.",
"Hand bias ruining a chart? Try turning mirror on or just permamirror the chart with Ctrl + M.",
"F1 is a shortcut for song search just in case pressing 2 buttons was too much for you.",
"Jumping to a specific pack can be done by searching for a specific song, hovering the song, then removing your search.",
"Tags are useful for when you want to play a specific type of file later. Set tags on a file then filter by them.",
"The help screen details many features of the game that are useful to you that you might have never thought about.",
"Softlocked? Press Ctrl + Operator. Usually your Operator key is Scroll Lock.",
"You can get a glimpse of the secrets of the menus if you zoom out the game camera - F3 + F5 + 0.",
"If things don't save, you may have installed in the wrong location.",
"Songs under 200 notes produce invalid scores.",
"Opting in to crash uploading is helpful to developers to diagnose any issue that isn't being reported.",
"If your scores don't upload, try a force upload in the profile or scores tabs.",
"When updating the game, you should only have to backup Assets, Save, and Noteskins.",
"A CBrush is continuous combo breakers caused by an accidental early hit.",
"To cancel a CBrush, drop a miss or reset your hit timing.",
}
local Phrases = {
"That guy is saltier than the dead sea.",
"a noodle soup a day and your skills won't decay",
"i dropped out of school to play music games",
"ayy lmao",
"nice meme",
"You gonna finish that ice cream sandwich?",
"dude nice",
"You know what it is, bitch.",
"You're a master of karate and friendship for everyone!",
"holy firetruck",
"CHAMPION OF THE ssssssssssssssssssssSUN",
"what a dumb ass nightingale",
"C H A O S M A I D G U Y",
"What the hell is that.", -- insane techniuques
"Evasiva coches.",
"future metallic can - premium skin",
"what the fuck is VOS",
"Party like it's BM98.",
"Everyone seems a bit too obsessed with the moon. I wonder if they're werewolves...",
"thanks mr. skeltal",
"rice and noodles erryday",
"reticulating splines",
":^)",
"Don't you put it in your mouth.",
"Like the game you may all know stepmania",
"Time to enjoy. I guess.",
"very spammy",
"your favourite chart is shit",
"1.33 -> 0.33 -> 1.0 <=/=> 1.5 -> 0.5 -> 1.0",
"misses are bad",
"aiae lmao",
"573 or nothing",
"wats ur favrit 2hu",
"You're gonna carry that weight.",
"Far East Nightbird (Twitch remix)",
"Just hold on. You'll be fine, I promise. Everyday.",
"Fuga Fuuuga Fuuuuuckga Fuuuuuuuuckga Darkstar PAZO light TRASH ACE WOOD HELL", -- Fuga Hall of Shame
"JESUS WON'T COME TO SAVE YOU IN RHYTHM GAME HELL SON",
"I'LL NEVER PLAY 'BEAT-BEAT REVELATION' AGAIN!", -- some movie
"What is SOWS? I tried to Google it but all I get is pictures of female pigs",
"konmai", -- konami
"gonz:pork",
"leonid fucking hard", -- LUXURY"
"in Norway every girl is blonde, blue eyed and 300BPMs", -- Roar176
"vROFL",
"Sandbaggerrrrrrr", -- How to win FFR tourneys
"I'm gonna suee your ass to pakistan", -- Gundam-Dude
"what is the romaji of 皿 : scratches", -- AKA: sarachan >~<
"solo rulz",
"(o:",
"TSUMOOOOOO", -- Chiitoitsu dora2 4000/2000 and y'all owe me a simfile
"Solord State Squad", -- solid state squad
"StepMania changed my life!",
"Lincle Prim is best Prim", -- best prim
"Bubububub~", -- best prim
"Lovery Radio", -- prim
"えいニャ! えいニャ!", -- prim
"Dat MA",
"IT HAS MEI IN IT", -- Toy's march
"J1L1", -- Pr0 settings
"(KOOKY)", -- EVERY BMS DUMP
"(^^)/★★", -- ABCD
"less apm for more swage", -- Roar
"people age at a rate of about 1 year per year", -- Choofers
"FUCGELO", -- ↓YOU FUC
"earbleed",
"にっこにっこにー☆", -- raburaibu
"%E3%83%96%E3%83%B3%E3%82%BF%E3%83%B3 ~Falling in B mix~", -- buntan
"~koreastep~",
"solocock.png", -- "Mine is Bigger" also solorulz
"Gigadelicious",
"hot sexy touhou", -- AKA: HST
"Today's Popn", -- leonid
"B..bbut... you're supposed to play this on a dance mat", -- Every youtube comment ever on stepmania vids
"WinDEU hates you",
"tatataatatatatattatatattatatataii hihhihihihihhihhihihihihiihihhihihihihhihhi", -- francium
"Is dis a game? If it is can I ask for da link and I need to play dis so badly and I wanna know if dere is any vocaloid songs on it",
"hory shiet", -- Zak
"(=^._.^)/☆", --0
"StepMania Detected", -- choof
"jackhammers are nothing on an IIDX controller.", -- kidlat020
"EXTRA CRISPY ORIGINAL RECIPE RASIS BREAST", -- foal irc bot
"what's a fuckin town without ducks, j-tro?",
"I bet you were gettin the red face and fast heartbeat...then fucked up and the feeling kinda wore off",
"I beat off to this background dancer in DDR Supernova once too",
"Shut the fuck up Trance Core",
"==Planet KARMA==",
"STOP FUCKING ARGUING OVER STEPMANIA -- IT'S STEPMANIA, FUCKING DDR ON KEYBOARD", -- Xoon Drama Pack
"WookE Seal of Approval",
"invisible 16th streams", -- QED
"Subjectivemanias",
"16th notes Stream file, fun factor based; Too generic, 2/10",
"Color theory, Pirtech relevance, Technicality based; Masterpiece, I cried playing, 10/10", -- hipster stepmania
"Oooooh yeah, Feel the notes....",
"can someone send me helvetica so i can make gfx",--for solo rulz 3 http://www.flashflashrevolution.com/vbz/showpost.php?p=4253999&postcount=13
"Human Sequencer", -- mei
"whats more dense, a black hole or an icyworld file", -- choof
"fuk LN",
"Mine Infested Files Killed The Game", -- http://www.flashflashrevolution.com/vbz/showthread.php?p=4300456#post4300456
"STEPMANIA BROKEN", -- does anyone still remember the yt vid mfw-
"HOLY SAMBALAND", -- the land of (^^)
"like if there's a L.E.D. song titled GIGANTIC ONION CANNON I won't be shocked", -- UBerserker
"2D IS GOOOOOOOOOOOOOOLD!", -- TWO DEEKS GOOOOOLD-
"I seriously can't go to clubs and dance with random girls because they're so freaking off sync. -- change their global offset", -- jordan
"eyelid sudden+", -- Asian perks
"Nanahira is love. I hope she makes collab with Prim sometime.", -- shortly followed by "Have mercy on our ears"
"be-music salt", -- BMS
"fry EOS", -- Hazelnut: try*
"I'm used to another mania style game called osu!mania where the notes come from above and are clicked at the bottom, in stepmania it seems to be the opposite.",
"717x616 c987", -- someone's sm3.95 settings
"ROARD TOOTHBRUSH", -- Stai birthday stream
"The dance pad. Does it count as a toy?", -- http://zenius-i-vanisher.com/v5.2/thread?threadid=7696
"Thou shalt not look down at lifebar whilst vigorously mashing keys to survive", -- LG
"is it possible to make the lifebar hidden? -- Post it note on screen",
"YOURE STILL ON GIRLISH CAFE? ;;", -- YES -- AND IM GETTING GOOD SCORES ON IT -- SO QUIET YOU HEATHEN
"with all of the anime girls in stepmania backgrounds why don't we have 10 million weaboos playing our shit", -- lovelive choof
"i play pad with my fists -- and by this i mean i go to arcades and punch the ddr nerds in the facepad", -- Mina
"Amazon Prim Savings", -- foal
"50 Shades of Prim 12s", -- also foal
"all stepmania players are suck^^", --0133
"leonid: wtf ggsnipes end time 5, who do you think I am", -- (^^)
"Where mina???",
"guys please NO DRAMA", -- GAYM
"8k>4k ..... *runs*",
"why can't everything be image replacements like osu smh",
"metrics.ini is a giant shitshow",
"O-oooooooooo AAAAE-A-A-I-A-U- JO-oooooooooooo AAE-O-A-A-U-U-A- E-eee-ee-eee AAAAE-A-E-I-E-A- JO-ooo-oo-oo-oo EEEEO-A-AAA-AAAA", -- sdvx brain power
"my method for jacks is i move my finger and it presses down everytime it see's a note", -- JinXe
"Xayy lmao", -- http://www.flashflashrevolution.com/vbz/showthread.php?t=143456
"over 30 notes per second atm, this guy could single handedly out spam twitch chat", -- r/speedrun oinkbane
"HES TALKING AND PLAYING AT THE SAME TIME WTF",
"*KEYBOARDING INTENSIFIES*", -- https://twitter.com/MOOMANiBE/status/685218392299552768
"VAC",
"Play along at home:\n djskdjksdjskdjksdjskdksjdksdjksjdksdjkjsdjkskkksksksdjjsdjksdjksdjkssdjksjdkjksdjksdjksdjksdjkskdjjskdjksdjkjksjdksjdksjkdjksdjkjsdkjsjdskdjksjdksjdskdjksjjdjsddssjssdjkkkkkkkkkkkkkkkkkkkdjksjkdsjksdkjskdjksksdjjsdsksjdkkjksjjksjksd",
"you can't say that you're d7 because you can only jack off in one direction", -- eze
"SUGOI MISS", -- symbolic gear
"WE LOVE LOBSAK -- WE NEED LOBSAK", -- https://www.youtube.com/watch?v=mvZz_Ulkg1o
"mayumi is only prim when she's high",
"DAMN DANIEL",
"/!\\ Shitmapping in Progress /!\\ ",
"pls enjoy gaem",
"尻削り節 [7keys 歌は世につれ世は歌につれ 難易度表に心奪われ 滝汗流し腱鞘炎 来る日も来る日も飽きず筋トレ 誰にでもつらいときはあるものです それでは聞いていただきましょう 手動ディレイで 尻 削 り 節]",
"Krrrrr Krrrrr Krrrrr slide", --blurtic vids
"it looks like burn spiral to kill mosquito, we're not mosquito. But the idea is that we accidentally stepped on it and ARGH IT'S HOT!!!", -- http://www.stepmania.com/forums/themes/show/6085#post11127
"282 BPM prim working overtime", -- foal
"noteskins cost like $20", -- foal
"PRIM -- PRIM PRIM PRIM PRIM prim prim could pri prim ", -- foal
"i play stepmania at home before school then i go to school and play it during class and at lunch i play it instead of eating and when i go home i play some then i go to the arcade and play keYbEaT",
"the technical problem is not my issue.", -- https://osu.ppy.sh/forum/p/5038917
"Suck people never know their noob, good mappers always know what they are not good at.", -- Tsukuyomi https://osu.ppy.sh/s/368336
"the male sign -- you know -- the little o with a stepmania coming out of it", -- PiXL
"bruh brainpower is amaze", -- S_Cero
"if you're playing music games to compete you're already losing",
"what the fuck did you just fucking say about jumpstreams you piece of shit. I chart over 6000 arrows in 5 seconds",
"i bet you memorized the notes",
"i had an AAA on scorpion fire but my keyboard turned into a fucking cake", -- CAKE MANIAAAAAAAAAA
"when's the brazilian p90 rush theme coming out?", -- kommisar
"when you already pine nutted but she keep on gengaozo_succin", -- riktoi
"The only mark you will leave on this world is your utterly insignificant carbon footprint. Your entire life will be obsoleted by a handful of cattle in wyoming and undone by a few fucking square meters of shrubbery in scotland.", -- mina
"THIS IS NOT GOOBYE", -- Beatcraft cyclone
"it fucking took prim 8 years to implement LEFT CLICKING", -- lurker
"tbh look at the brazilian ultralight mods and default+ and tell me stepmania players give a shit about \"real estate\"", -- lurker
"the best way to improve at stepmania is bitching at people who get higher than 5:1 MA ratios", -- lurker
"the best way to improve at stepmania is shouting \"MY DILDO\" into your mic", -- lurker
"UNCLE BEN'S RICE SMOOTHIE", -- stai's stream
"it's basically impossible to have played stepmania and not heard of osu", -- lurker
"go play your stupid d7 hyper ultra stamina death killer files -- and get cts", -- Tim
"youll be good at sm again if you quit quitting every 3 hours", -- Walrusizer
"I have really bad RSI so I have to play with my hands pretty much limp -- right hand even had carpool tunnel in the past", -- KirasCat
"grey notes? that's what people who can't step guitar solos worth shit use right?",
"not a fan of \"singer will lose his voice in like 2 years\" metal", -- Pixl
"my jumpstream style is a lot more jumpy based", -- Fantasy
"ANNOUNCEMENT: 2 Stepmania 5 Themes Should FAKE Because I have create my new Account, I'm apologize for making 2 FAKE Stepmania 5 Theme, and Then I am done for this.", -- TopitoomayStepmania
"like i'm definitely not ashamed to tell people i listen to denpa bullshit (or practically any of the genres of music I listen to) but I wouldn't Bump Dat Mosiac.Wav In The Whip", -- Choof
"All in all this place is really something huh, and i came here hoping i'd meet people who don't judge on someone so much, it's a fucking rhythm game not a court room jesus christ", -- Soul Evans
"I just get a random anime image and slap text on it, its the only proper way to make gfx <;0)", -- jousway
"i'm not even sure what's classified as ''hard'' in the packs as i may be one of the best solo players for this site (maybe) so i specifically want somewhat hard maps maybe by mina's scale for difficulty 23-27? so long it's 15+ more in average NPS", -- Soul Evans
"why can't i just download the songs you're playing? is this that stepmania elitism i keep hearing about",
"but are your wristjacks so powerful they cure cancer", -- Soul Evans
"being an asshole and being someone entirely as dense as the chinese wall itself are two different things but to me belong into the same cup", -- Xay
"I'm 100% this is not about being a wolf I think this is clearly about a fucking hippo truck just rolling over all of ffr", -- Xay
"uh what pack is the others from", -- Soul Evans
"DO YOU NOT UNDERSTAND THE PLEASURE OF PLAYING WITH ONE HAND",
"p*light took inspiration from halogen's trigger happy moderation", -- Tim
"cb rushing is the stepmania equivalent of \"i've fallen and i can't get up\"", --Fullerene
"is it good to make it all jumptrills since it follows the emusic?", -- ilikecatsalotihatedogs
"i am shitposting in this thread to increase traffic", -- http://www.flashflashrevolution.com/vbz/showthread.php?t=145636
"To insert beats, first press TAB (or go into Sync Mode) to disable the notes.", -- PRESS B TO PAY RESPECTS
"WE WILL BUILD AN LN WALL AND MAKE VSRG GREAT AGAIN", -- syaro-
"My logic is that the brain processes in 60 FPS so I play 60 FPS.", -- Rapta
"map everything as nonstop quadjacks, then bitch at people for daring to question your interpretation of the music", -- TyroneSama
"\"Awkward to hit\" so by your logic, every file should be buttery smooth to play, otherwise it's bad -_-", -- KcHecKa
"Play! Play! Play! Practice makes perfect. I used to be able to only play easy/beginner songs, now I can play literally anything you throw at me.", -- https://www.reddit.com/r/Stepmania/comments/585v17/
"once i tripped over a cable at hydro quebec and half the windmills in the entire province turned off ",-- Drace
"but i cant play if i dont know the keybinds",
"Rice bullets can't melt oxygen noodles", -- Roman
"can't you mush together a 128 and 192 to get something higher bitrate than a 192", -- 4yn
"it's only 180bpm jacks", -- shiki
"How's J1 cheating", -- etienne
"I can jumptrill at 5 centimeters per second and with each centimeter i move through the map faster.", -- Cataclysm-
"Etterna is for overmapped songs and people who can't play long notes", -- p3
"cbrush stands for cool bro rush", -- poco
"Etterna in 10!", -- foxfire
"Get a life and fucking play the game and give me feedback. Jesus some people are petty",
"That's not a threat that's a promise.", --shireen_gh to DourGent
"You've literally just made the biggest mistake in your entire life.", --KcHecKa on Future World BL
"FFR! here i come! better scoring there anyways", --Billmads on NoMines scores no longer counting
"I feel like...he looks at my charts and thinks: I'm going to chart the polar opposite of what IcyWorld would do.", --IcyWorld talking about DourGent
"mina is basically another kyzentun",
"Uhh...what's pr? (Reply: Pitch relevancy) And? How do I use it?", --Sklitter on charting methodology
"...their intelligence, or rather, lack of it because they most likely never had any to begin with when all they have to talk and laugh about are memes in their sad, sad depleted perpetually gay lives.", --DNAlei on Etterna elitism
"Mina too scared to accept my file LUL", --Leverage on having 3 submissions rejected from Minty 3
"I believe every file should be rate-able. Otherwise what's the point?", --Etienne on file standards
"hahahah xDDDD IM SOOOO BUSY work!!! LOLOLOL I HAVE A LIFE LOSER EXCUSE ME IF I DONT SPEND MORE TIME DOING DEVELOPMENT WORK THAN GOING ON FORUMS AND DEFENDING THE GAME I DONT WORK ON LOL HAHAHA xDDDDDDDDDDDDDDDDDDD", -- small excerpt of a novel of etterna defensive commentary
"Yeah. Framerates is BS and not a concern. That's just wasted cpu cycles",
"Please use an actual (non garbage) Stepmania Client. Thanks",
"You can't judge the file this isn't even remotely jumptrillable - someone who can actually play the file", --Snover on Mario Paint from Fullerene Shift (70.13%)
"Beat you!! >.<", --KcHecKA on getting 0.0001% over Ice on Savage Terminal, prompting a full scale attack to resolve the issue.
"See that bridge over there?", --Mina, moments before disaster and misunderstanding causes major drama.
"I come from the Guitar Hero scene so it's like if there's nothing to chart, chart nothing", -- Zibang on expressive mines in DourGent's Minipack 4, or anywhere else.
"I feel like good musicians are only 1 step away from telepathy, it brings you into that collective mindspace", -- F14m3z
"Well, you honestly sound like some farty grandpa. Sure, you deserve respect for that, but it doesn't really give you some special position to tear things apart. People might tolerate you out of gratefulness or something, but it won't be forever.", -- deltaEpsilon's commentary on Mina's behavior in the community
"Creating a game that everybody loves and then shitting all over them -- it drives people away. You created a beautiful game, but then you ruined it.", -- pt 2 of deltaEpsilon's commentary on Mina's behavior in the community
"Havent you heard Etterna is developed by evil demons summoned from hell, who steal code, rob bandwidth, inject viruses into the game, are closed source, rape CPUs while wasting cpu cycles, change compiler flags and disgrace the original devs. They also don't bath", -- satirical anti-etterna copypasta
"pine nut is banned",
"their finished tbh",
"i dont vibro :(",
"we should delete all the spread packs",
":map:", -- etternaonline
"Im not a furry", -- :denial:
"i dont have a table", -- void, living in 1st world poverty
"fucks wrong with your music taste?", -- a dd review on whitey's ice
"hey what the fuck guys", -- a tim review on whitey's ice
"who is minty?", -- dd
"My mother may not have a normal brain.", -- dawnx's defense
":ok_mine:", -- sm6
"man i just played through this. it's like everyone's turned into nvlm_zk. it's all 24th and 32nd stream bursts that, alot of times, don't even go with the music. there wasn't rly any type of style/personality i picked up on from anyone.", -- minty 3 ffr thread
"finger independence isnt a thing imo", -- eo
"GREAT means you 'tried' but failed spectacularly but MISS says you knew you could not get a Marvelous so you missed it rather than get a horrible GREAT", -- anti wife logic
"you should never miss if your missing your not good enough for that map", -- anti wife logic
"if you get all goods in a song you will have a terrible score so why not have all Marvelous?", -- anti wife logic
"I accidentally brushed my teeth", -- Void
"This is the 'people who argue with everything and are wrong' server", -- Windoze alfter witnessing a leftovers discussion
"evacuate rth danc cefloor woaoh ahowoa ahha dann cing on the hhhhh", -- DourGent having a stroke
"conspiracy theorists say that like theres sounds or code words that people can play that control what people do... i think the piano flourish in AIR is one of them", -- Windoze upon witnessing another disgusting burst
"That's right I pissed on your pack you idiot!", -- Ptet, after people discover his pdn files leftover in valedumps 3
"etterna needs more scene girls", -- dugatee
"It's okay i know I'm extremely funny and cool and sexy", -- Tim
"You're like the poco play equivalent of 'step more'", -- Foxfire, talking about dourgent's stepping speed.
"My acc is garbage as is, downrating will only mess up my internal clock for that song and make it worse", -- eo rando on downrates
"I HATE THE LEFTOVERS I HATE THE LEFTOVERS", -- Celebelian
"zeta 20th november LOL", -- leftovers
"brrrrrrrrrrrrrrrr... message sent from my samsung smart fridge", -- Celebelian in the Acerola discord server
"Imagine being so fucking dumb you can't comprehend more than two colors at a time", -- Choof
"it's semi mario", -- EO, collectively
"apart from til death looking like absolute shit there's not too much wrong with it", -- Jole
"i keep shitting on 'til death", -- Jole
"i'm pretty sure the celeb worshippers made a server or w/e", -- Sklitter, talking about The Leftovers
"do you know who i am", -- Cosmovibe/Stargroup after returning to Etterna
"can we call this the 'help im trapped in a dour pattern factory'", -- Mina, after seeing DourGent's tactical railroad dump
"ok i'm gonna sleep, ping me for new files or be FOREVER FUCKED", -- Celebelian at the end of Celeb's dumplings
"I took a sip of the ptet potion and I suddenly had carpal tunnel syndrome", -- Tim
"RG players have higher wpm's because of how much they argue, not because of the game", -- Celebelian
"we know", -- The leftovers, collectively taunting Zeta
"the leftovers pilgrimage to the bass pro shop pyramid 2022", -- Tim
"That's awesome man I look forward to the next episode on the hit sitcom, Zeta Here", -- tim
"so excited....",
"friday release!",
"i literally only stepped makiba", -- nathan
"I think all you really need is a good foundation in piano and to do strong hand exercises, and you can take this game far further than brute force. The people with real musical talent always seem to go (forward) so much faster than everyone else.", -- Mikeh/Untimely Friction
"I switched to bareframes, my game crashed, and now it's stuck in mandarin", -- aurum
"lord forbid zeta", -- Windoze
"tried playing etterna, shit just won’t lunch", -- https://twitter.com/cartisbunnylol/status/1453910047701061635
"waiting", -- Bamnks repeating himself after submitting a file for EVGP
"Wow, this is a horrible choice! don't even know why mines are in this game to begin with their stupid! ", -- https://www.reddit.com/r/Etterna/comments/awdl3i/no_mines_no_score/
"The look of til-death genuinely angers me", -- Jole complaining about til death for the umpteenth time
"I might be a weeb and a furry but I will never watch a vtuber", -- Nick12 being absolutely BASED. :acceptance:
"They didn't invent colours untill 2011", -- Void
"why does every charter save for me have to be painfully incompetent", -- Sklitterbeer in a twitch chat
"watch your mouth steplet the D8 editor readers are listening", -- DourGent in response to foxfire talking about playtesting
"I have a friend from singapore, I'm basically japanese", -- DourGent, referring to Sheenoboo
"Acerola Revengance Rising Attack Trubo Reload all-nighter REMIX edition game of the year XTREME", -- DourGent trying to think of names for a potential Acerola sequel
"This files got about as much back end as Niki Minaj", -- Freemind2pointo, about PAM!!
"Wanna smell my feet right now?", -- Kraezymann on stream
"Mina-san!", -- Foxfire
"I am overstreaming so it's too slow", -- Heartbeat in EO
"VRRRRRRRRRRRRRRRRRROOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOM HMHNHMNHM BROOOOOOOOOOOO<M REEEEEEEEEEEEEE SKRRRRRRRRRRRRR NYOOOOOOOOOOOOOOOM AAAAAAAAH REIRRHRUHIUREHIURIS BRHRURBUBRURBURBR BROOOOOOOOOOOOOOOOOOOOOOOM EEEEEEEEERRRRRRRRRRRRRRRRRRRRR SCHSHC VSCHOOOOOOOOOOM", -- Temma, car games
"Bing bong :reallycoolbird: bing bong", -- Prov's infinite wisdom
"Zeta 20, november New Jersey Texas Houston Astroworld Dallas mors Starbucks Peppermint Mocha Latte Venti Cake Pop Zeta64 Mario 64", -- Tim
"????????? do u weatchedf pornography??",
"when bahamut unleashes 79 terashits per exafart", -- Timothy, yet again
"Holy shit, you're cheating better than me", -- Thaor during Anmao's cheated client stream
"sorry im a charter i just preview charts for 30 minutes and then close the game", -- Void
"yo mate this beat dropped so hard I drop kicked me nan down 7 sets of stairs. REPPIN THE MAKIN SCENE LIKE! rest in peace mc mental the legend", -- Dour, listening to MC mental
"damn bitch this beat has a fat ass", -- Chat in foxfire's stream
}
function getRandomQuote(tipType)
if tipType == 1 then
if #Tips > 0 then
return "TIP: "..Tips[math.random(#Tips)]
else
return "ERROR: No tips"
end
elseif tipType == 2 then
if #Phrases > 0 then
return Phrases[math.random(#Phrases)]
else
return "ERROR: No quotes"
end
else
return "ERROR: bruh how did u break this ??????"
end
end
|
local config={};
config['mysql_host'] = "127.0.0.1"
config['mysql_port'] = "3306"
config['mysql_user'] = "root"
config['mysql_pass'] = ""
config['mysql_db'] = "agw"
config['admin_name'] = "admin"
config['admin_pass'] = "admin"
return config;
|
-- Animator Util
-- Shane Krolikowski
--
local Modern = require 'modern'
local Animator = Modern:extend()
-- New
--
function Animator:new(items)
self.current = nil
self.items = {}
--
for name, item in pairs(items or {}) do
self:add(name, item)
end
end
-- Add animation
--
function Animator:add(name, item)
self.items[name] = item
end
-- Remove animation
--
function Animator:remove(name)
self.items[name] = nil
end
-- Set animation
--
function Animator:set(name)
if self:has(name) and self.current ~= name then
self.current = name
--
self.items[name]:play()
end
end
-- Get animation
--
function Animator:get(name)
return self.items[name] or nil
end
-- Has animation
--
function Animator:has(name)
return name ~= nil and
self.items[name] ~= nil
end
-- Perform callback on each item
--
function Animator:each(cb)
for name, item in pairs(self.items) do
cb(item, name)
end
end
-- Update
--
function Animator:update(dt)
if self:has(self.current) then
self:get(self.current):update(dt)
end
end
-- Draw
--
function Animator:draw()
if self:has(self.current) then
self:get(self.current):draw()
end
end
return Animator
|
--[[
Break Through
PvE Ground Branch game mode by Jakub 'eelSkillz' Baranowski
More details @ https://github.com/JakBaranowski/ground-branch-game-modes/wiki/game-mode-break-through
]]--
local MTeams = require('Players.Teams')
local MSpawnsGroups = require('Spawns.Groups')
local MSpawnsCommon = require('Spawns.Common')
local MObjectiveExfiltrate = require('Objectives.Exfiltrate')
--#region Properties
local BreakThrough = {
UseReadyRoom = true,
UseRounds = true,
MissionTypeDescription = '[Solo/Co-Op] Traverse through a hostile area.',
StringTables = {'BreakThrough'},
Settings = {
OpForPreset = {
Min = 0,
Max = 4,
Value = 2,
AdvancedSetting = false,
},
Difficulty = {
Min = 0,
Max = 4,
Value = 2,
AdvancedSetting = false,
},
RoundTime = {
Min = 10,
Max = 60,
Value = 60,
AdvancedSetting = false,
},
RespawnCost = {
Min = 0,
Max = 10000,
Value = 1000,
AdvancedSetting = true,
},
DisplayScoreMessage = {
Min = 0,
Max = 1,
Value = 0,
AdvancedSetting = true,
},
DisplayScoreMilestones = {
Min = 0,
Max = 1,
Value = 1,
AdvancedSetting = true,
},
DisplayObjectiveMessages = {
Min = 0,
Max = 1,
Value = 1,
AdvancedSetting = true,
},
DisplayObjectivePrompts = {
Min = 0,
Max = 1,
Value = 1,
AdvancedSetting = true,
},
},
PlayerScoreTypes = {
KillStandard = {
Score = 100,
OneOff = false,
Description = 'Eliminated threat'
},
Survived = {
Score = 200,
OneOff = false,
Description = 'Made it out alive'
},
TeamKill = {
Score = -250,
OneOff = false,
Description = 'Killed a teammate'
},
Accident = {
Score = -50,
OneOff = false,
Description = 'Killed oneself'
}
},
TeamScoreTypes = {
ExfiltrateSome = {
Score = 250,
OneOff = false,
Description = 'Some team members exfiltrated'
},
ExfiltrateAll = {
Score = 1000,
OneOff = false,
Description = 'All team members exfiltrated'
},
Respawn = {
Score = -1,
OneOff = false,
Description = 'Respawned'
}
},
PlayerTeams = {
BluFor = {
TeamId = 1,
Loadout = 'NoTeam',
Script = nil
},
},
AiTeams = {
OpFor = {
Tag = 'OpFor',
CalculatedAiCount = 0,
Spawns = nil
},
},
Objectives = {
Exfiltrate = nil
},
Timers = {
-- Delays
CheckBluForCount = {
Name = 'CheckBluForCount',
TimeStep = 1.0,
},
CheckReadyUp = {
Name = 'CheckReadyUp',
TimeStep = 0.25,
},
CheckReadyDown = {
Name = 'CheckReadyDown',
TimeStep = 0.1,
},
CheckSpawnedAi ={
Name = 'CheckSpawnedAi',
TimeStep = 4.1
}
}
}
--#endregion
--#region Preparation
function BreakThrough:PreInit()
print('Initializing Break Out')
-- Initialize game message broker
self.PlayerTeams.BluFor.Script = MTeams:Create(
self.PlayerTeams.BluFor.TeamId,
false,
self.PlayerScoreTypes,
self.TeamScoreTypes
)
-- Gathers all OpFor spawn points by groups
self.AiTeams.OpFor.Spawns = MSpawnsGroups:Create()
-- Initialize Exfiltration objective
self.Objectives.Exfiltrate = MObjectiveExfiltrate:Create(
self,
self.OnExfiltrated,
self.PlayerTeams.BluFor.Script,
5.0,
1.0
)
end
function BreakThrough:PostInit()
gamemode.AddGameObjective(self.PlayerTeams.BluFor.TeamId, 'TraverseBluFor', 1)
print('Added game mode objectives')
end
--#endregion
--#region Common
function BreakThrough:OnRoundStageSet(RoundStage)
print('Started round stage ' .. RoundStage)
timer.ClearAll()
if RoundStage == 'WaitingForReady' then
self:PreRoundCleanUp()
self.Objectives.Exfiltrate:SelectPoint(true)
elseif RoundStage == 'PreRoundWait' then
self:SetUpOpForSpawns()
self:SpawnOpFor()
elseif RoundStage == 'InProgress' then
self.PlayerTeams.BluFor.Script:RoundStart(
self.Settings.RespawnCost.Value,
self.Settings.DisplayScoreMessage.Value == 1,
self.Settings.DisplayScoreMilestones.Value == 1,
self.Settings.DisplayObjectiveMessages.Value == 1,
self.Settings.DisplayObjectivePrompts.Value == 1
)
end
end
function BreakThrough:OnCharacterDied(Character, CharacterController, KillerController)
if
gamemode.GetRoundStage() == 'PreRoundWait' or
gamemode.GetRoundStage() == 'InProgress'
then
if CharacterController ~= nil then
local killedTeam = actor.GetTeamId(CharacterController)
local killerTeam = nil
if KillerController ~= nil then
killerTeam = actor.GetTeamId(KillerController)
end
if actor.HasTag(CharacterController, self.AiTeams.OpFor.Tag) then
print('OpFor eliminated')
if killerTeam ~= killedTeam then
self.PlayerTeams.BluFor.Script:AwardPlayerScore(KillerController, 'KillStandard')
end
else
print('BluFor eliminated')
if CharacterController == KillerController then
self.PlayerTeams.BluFor.Script:AwardPlayerScore(CharacterController, 'Accident')
elseif killerTeam == killedTeam then
self.PlayerTeams.BluFor.Script:AwardPlayerScore(KillerController, 'TeamKill')
end
self.PlayerTeams.BluFor.Script:PlayerDied(CharacterController)
timer.Set(
self.Timers.CheckBluForCount.Name,
self,
self.CheckBluForCountTimer,
self.Timers.CheckBluForCount.TimeStep,
false
)
end
end
end
end
--#endregion
--#region Player Status
function BreakThrough:PlayerInsertionPointChanged(PlayerState, InsertionPoint)
if InsertionPoint == nil then
timer.Set(
self.Timers.CheckReadyDown.Name,
self,
self.CheckReadyDownTimer,
self.Timers.CheckReadyDown.TimeStep,
false
)
else
timer.Set(
self.Timers.CheckReadyUp.Name,
self,
self.CheckReadyUpTimer,
self.Timers.CheckReadyUp.TimeStep,
false
)
end
end
function BreakThrough:PlayerReadyStatusChanged(PlayerState, ReadyStatus)
if ReadyStatus ~= 'DeclaredReady' then
timer.Set(
self.Timers.CheckReadyDown.Name,
self,
self.CheckReadyDownTimer,
self.Timers.CheckReadyDown.TimeStep,
false
)
elseif
gamemode.GetRoundStage() == 'PreRoundWait' and
gamemode.PrepLatecomer(PlayerState)
then
gamemode.EnterPlayArea(PlayerState)
end
end
function BreakThrough:CheckReadyUpTimer()
if
gamemode.GetRoundStage() == 'WaitingForReady' or
gamemode.GetRoundStage() == 'ReadyCountdown'
then
local ReadyPlayerTeamCounts = gamemode.GetReadyPlayerTeamCounts(true)
local BluForReady = ReadyPlayerTeamCounts[self.PlayerTeams.BluFor.TeamId]
if BluForReady >= gamemode.GetPlayerCount(true) then
gamemode.SetRoundStage('PreRoundWait')
elseif BluForReady > 0 then
gamemode.SetRoundStage('ReadyCountdown')
end
end
end
function BreakThrough:CheckReadyDownTimer()
if gamemode.GetRoundStage() == 'ReadyCountdown' then
local ReadyPlayerTeamCounts = gamemode.GetReadyPlayerTeamCounts(true)
if ReadyPlayerTeamCounts[self.PlayerTeams.BluFor.TeamId] < 1 then
gamemode.SetRoundStage('WaitingForReady')
end
end
end
function BreakThrough:ShouldCheckForTeamKills()
if gamemode.GetRoundStage() == 'InProgress' then
return true
end
return false
end
function BreakThrough:PlayerCanEnterPlayArea(PlayerState)
print('PlayerCanEnterPlayArea')
if
gamemode.GetRoundStage() == 'InProgress' or
player.GetInsertionPoint(PlayerState) ~= nil
then
return true
end
return false
end
function BreakThrough:GetSpawnInfo(PlayerState)
print('GetSpawnInfo')
if gamemode.GetRoundStage() == 'InProgress' then
self.PlayerTeams.BluFor.Script:RespawnCleanUp(PlayerState)
end
end
function BreakThrough:PlayerEnteredPlayArea(PlayerState)
print('PlayerEnteredPlayArea')
player.SetInsertionPoint(PlayerState, nil)
end
function BreakThrough:LogOut(Exiting)
if
gamemode.GetRoundStage() == 'PreRoundWait' or
gamemode.GetRoundStage() == 'InProgress'
then
timer.Set(
self.Timers.CheckBluForCount.Name,
self,
self.CheckBluForCountTimer,
self.Timers.CheckBluForCount.TimeStep,
false
)
end
end
--#endregion
--#region Spawns
function BreakThrough:SetUpOpForSpawns()
print('Setting up AI spawns by groups')
local maxAiCount = math.min(
self.AiTeams.OpFor.Spawns:GetTotalSpawnPointsCount(),
ai.GetMaxCount()
)
self.AiTeams.OpFor.CalculatedAiCount = MSpawnsCommon.GetAiCountWithDeviationPercent(
5,
maxAiCount,
gamemode.GetPlayerCount(true),
5,
self.Settings.OpForPreset.Value,
5,
0.1
)
local missingAiCount = self.AiTeams.OpFor.CalculatedAiCount
print('Adding random group spawns')
while missingAiCount > 0 do
if self.AiTeams.OpFor.Spawns:GetRemainingGroupsCount() <= 0 then
break
end
local aiCountPerGroup = MSpawnsCommon.GetAiCountWithDeviationNumber(
2,
10,
gamemode.GetPlayerCount(true),
0.5,
self.Settings.OpForPreset.Value,
1,
1
)
if aiCountPerGroup > missingAiCount then
print('Remaining AI count is not enough to fill group')
break
end
self.AiTeams.OpFor.Spawns:AddSpawnsFromRandomGroup(aiCountPerGroup)
missingAiCount = self.AiTeams.OpFor.CalculatedAiCount -
self.AiTeams.OpFor.Spawns:GetSelectedSpawnPointsCount()
end
print('Adding random spawns from reserve')
self.AiTeams.OpFor.Spawns:AddRandomSpawnsFromReserve()
end
function BreakThrough:SpawnOpFor()
self.AiTeams.OpFor.Spawns:Spawn(4.0, self.AiTeams.OpFor.CalculatedAiCount, self.AiTeams.OpFor.Tag)
timer.Set(
self.Timers.CheckSpawnedAi.Name,
self,
self.CheckSpawnedAiTimer,
self.Timers.CheckSpawnedAi.TimeStep,
false
)
end
function BreakThrough:CheckSpawnedAiTimer()
local aiControllers = ai.GetControllers(
'GroundBranch.GBAIController',
self.AiTeams.OpFor.Tag,
255,
255
)
print('Spawned ' .. #aiControllers .. ' AI')
end
--#endregion
--#region Objective: Extraction
function BreakThrough:OnGameTriggerBeginOverlap(GameTrigger, Player)
if self.Objectives.Exfiltrate:CheckTriggerAndPlayer(GameTrigger, Player) then
self.Objectives.Exfiltrate:PlayerEnteredExfiltration(true)
end
end
function BreakThrough:OnGameTriggerEndOverlap(GameTrigger, Player)
if self.Objectives.Exfiltrate:CheckTriggerAndPlayer(GameTrigger, Player) then
self.Objectives.Exfiltrate:PlayerLeftExfiltration()
end
end
function BreakThrough:OnExfiltrated()
if gamemode.GetRoundStage() ~= 'InProgress' then
return
end
gamemode.AddGameStat('Result=Team1')
local alivePlayers = self.PlayerTeams.BluFor.Script:GetAlivePlayers()
for _, alivePlayer in ipairs(alivePlayers) do
self.PlayerTeams.BluFor.Script:AwardPlayerScore(alivePlayer, 'Survived')
end
if
self.PlayerTeams.BluFor.Script:GetAlivePlayersCount() >=
self.PlayerTeams.BluFor.Script:GetAllPlayersCount()
then
self.PlayerTeams.BluFor.Script:AwardTeamScore('ExfiltrateAll')
gamemode.AddGameStat('CompleteObjectives=ExfiltrateBluFor,ExfiltrateAll')
gamemode.AddGameStat('Summary=BluForExfilSuccess')
else
self.PlayerTeams.BluFor.Script:AwardTeamScore('ExfiltrateSome')
gamemode.AddGameStat('CompleteObjectives=ExfiltrateBluFor')
gamemode.AddGameStat('Summary=BluForExfilPartialSuccess')
end
gamemode.SetRoundStage('PostRoundWait')
end
--#endregion
--#region Fail condition
function BreakThrough:CheckBluForCountTimer()
if gamemode.GetRoundStage() ~= 'InProgress' then
return
end
if self.PlayerTeams.BluFor.Script:IsWipedOut() then
timer.Clear(self, 'CheckBluForExfil')
gamemode.AddGameStat('Result=None')
gamemode.AddGameStat('Summary=BluForEliminated')
gamemode.SetRoundStage('PostRoundWait')
end
end
--#endregion
--region Helpers
function BreakThrough:PreRoundCleanUp()
ai.CleanUp(self.AiTeams.OpFor.Tag)
self.Objectives.Exfiltrate:Reset()
end
function BreakThrough:GetPlayerTeamScript()
return self.PlayerTeams.BluFor.Script
end
--#endregion
return BreakThrough
|
local utils = require("../../../utiles/utiles.lua")
local consts = require("../../lora-lib/constants/constants.lua")
local LINKADRANS_PARAM = consts.LINKADRANS
local logger = require("../../log.lua")
return function(devAddr, status)
logger.info(
{
label = "MAC Command Ans",
message = {
LinkADRAns = {
Status = status
}
}
}
)
for key, _ in pairs(status) do
local Status = utils.BufferFrom(status[key])
local ChannelMaskACK =
utils.bitwiseFilter(Status, LINKADRANS_PARAM.CHANNELMASKACK_START, LINKADRANS_PARAM.CHANNELMASKACK_LEN)
local DataRateACK =
utils.bitwiseFilter(Status, LINKADRANS_PARAM.DATARATEACK_START, LINKADRANS_PARAM.DATARATEACK_LEN)
local PowerACK = utils.bitwiseFilter(Status, LINKADRANS_PARAM.POWERACK_START, LINKADRANS_PARAM.POWERACK_LEN)
if ChannelMaskACK == 1 then
logger.info(
{
label = "MAC Command Ans",
message = {
LinkADRAns = {
ChannelMaskACK = "Channel Mask set Success"
}
}
}
)
end
if DataRateACK == 1 then
logger.info(
{
label = "MAC Command Ans",
message = {
LinkADRAns = {
DataRateACK = "Data Rate set Success"
}
}
}
)
end
if PowerACK == 1 then
logger.info(
{
label = "MAC Command Ans",
message = {
LinkADRAns = {
PowerACK = "Power set Success"
}
}
}
)
end
end
end
|
ESX = nil
local savedNotes = {
}
TriggerEvent('server:LoadsNote')
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
--#Delete comments to use from inventory
-- ESX.RegisterUsableItem('notepad', function(source)
-- local _source = source
-- local xPlayer = ESX.GetPlayerFromId(_source)
-- TriggerClientEvent('lkrp_notepad:note', _source)
-- TriggerClientEvent('lkrp_notepad:OpenNotepadGui', _source)
-- end)
TriggerEvent('es:addCommand', 'notes', function(source, args, user)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local item = xPlayer.getInventoryItem('notepad').count
if item > 0 then
TriggerClientEvent('lkrp_notepad:note', _source)
TriggerClientEvent('lkrp_notepad:OpenNotepadGui', _source)
TriggerEvent('server:LoadsNote')
else
TriggerClientEvent('esx:showNotification', _source, 'You dont have notepad.')
end
end, {help = "Open notepad if you have it!"})
RegisterNetEvent("server:LoadsNote")
AddEventHandler("server:LoadsNote", function()
TriggerClientEvent('lkrp_notepad:updateNotes', -1, savedNotes)
end)
RegisterNetEvent("server:newNote")
AddEventHandler("server:newNote", function(text, x, y, z)
local import = {
["text"] = ""..text.."",
["x"] = x,
["y"] = y,
["z"] = z,
}
table.insert(savedNotes, import)
TriggerEvent("server:LoadsNote")
end)
RegisterNetEvent("server:updateNote")
AddEventHandler("server:updateNote", function(noteID, text)
savedNotes[noteID]["text"]=text
TriggerEvent("server:LoadsNote")
end)
RegisterNetEvent("server:destroyNote")
AddEventHandler("server:destroyNote", function(noteID)
table.remove(savedNotes, noteID)
TriggerEvent("server:LoadsNote")
end)
|
function GetVariantsMatch(shipName, tParams)
local tempTable = {}
local numParams = getn(tParams)
local numBits = 0
for i = 1, numParams do
if tParams[i] == 1 then
tinsert(tempTable, VariantLabels[i])
numBits = numBits + 1
end
end
for i = 1, 2^numBits do
local tempBits = NumToBits(i-1, numBits)
local bPass = 1
for j = 1, numParams do
if tParams[j] ~= ModeSuffixTable[j] then
bPass = 0
break
end
end
if bPass == 1 then
for j = 1, numBits do
shipName = shipName .. "_" .. tempTable[j] .. tempBits[j]
end
end
end
return shipName
end
function GetVariantsAll(shipName, tParams)
local outTable = {}
local tempTable = {}
local numParams = getn(tParams)
local numBits = 0
for i = 1, numParams do
if tParams[i] == 1 then
tinsert(tempTable, VariantLabels[i])
numBits = numBits + 1
end
end
for i = 1, 2^numBits do
local tempBits = NumToBits(i-1, numBits)
for j = 1, numBits do
shipName = shipName .. "_" .. tempTable[j] .. tempBits[j]
end
tinsert(outTable, shipName)
end
return outTable
end
-- used in build and research scripts
function PrintBuildList()
local icount = 0
for i, v in build do
local line = ""
for j, w in v do
line = line .. j .. "\t" .. w .. "\t"
end
print(line)
icount = icount + 1
end
print("total: " .. icount)
end
-- used in build and research scripts
function PrintResearchList()
local icount = 0
for i, v in research do
local line = ""
for j, w in v do
line = line .. j .. "\t" .. w .. "\t"
end
print(line)
icount = icount + 1
end
print("total: " .. icount)
end
-- used in build and research scripts
function PrintBuildNames()
print("build start:")
for i, v in build do
local line = ""
for j, w in v do
if j == "ThingToBuild" then
print(w)
break
end
end
end
end
-- used in build and research scripts
function PrintResearchNames()
print("research start:")
for i, v in research do
local line = ""
for j, w in v do
if j == "Name" then
print(w)
break
end
end
end
end
-- used in build and research scripts
function CountBuildItems()
local icount = 0
for i, v in build do
local line = ""
for j, w in v do
if j == "ThingToBuild" then
icount = icount + 1
break
end
end
end
print("build total: " .. icount)
end
-- used in build and research scripts
function CountResearchItems()
local icount = 0
for i, v in research do
local line = ""
for j, w in v do
if j == "Name" then
icount = icount + 1
break
end
end
end
print("research total: " .. icount)
end
-- used in several ship Lua files
function Player_GetNumberOfVariantSquadronsOfTypeAwakeOrSleeping(playerIndex, shipType)
local tempCount = 0
local tempBits = VariantBuildBool[shipType]
local tempVariants = GetVariantsAll(shipType, tempBits)
for i, v in tempVariants do
tempCount = tempCount + Player_GetNumberOfSquadronsOfTypeAwakeOrSleeping(playerIndex, v)
end
return tempCount
end
-- used in several ship Lua files
function SobGroup_FillVariantShipsByType(groupName, playerIndex, shipType)
local tempBits = VariantBuildBool[shipType]
local tempVariants = GetVariantsAll(shipType, tempBits)
for i, v in tempVariants do
SobGroup_FillShipsByType(groupName, playerIndex, v)
end
end
-- used in kus_gravwellgenerator.lua, tai_gravwellgenerator.lua
function FillVariantsFromTable(shipList)
local tempTable = {}
for i, v in shipList do
local tempBits = VariantBuildBool[v]
local tempVariants = GetVariantsAll(v, tempBits)
for j, w in tempVariants do
tinsert(tempTable, w)
end
end
return tempTable
end
-- used in kus_gravwellgenerator.lua, tai_gravwellgenerator.lua
function ConvertTableToList(tempTable)
local tempList = ""
local tableLength = getn(tempTable)
for i, v in tempTable do
tempList = tempList + v
if i < tableLength then
tempList = tempList + ","
end
end
return tempList
end
-- used in AI scripts
function ResearchVariantDemandSet(shipType, demValue)
local varTable = VariantResearchInt[lower(shipType)]
for i, k in varTable do
ResearchDemandSet(k, demValue)
end
end
-- used in AI scripts
function ResearchVariantDemandAdd(shipType, demValue)
local varTable = VariantResearchInt[lower(shipType)]
for i, k in varTable do
ResearchDemandAdd(k, demValue)
end
end
-- used in AI scripts
function NumVariantSquadrons(shipType)
local varTable = VariantResearchInt[lower(shipType)]
local outNum = 0
for i, k in varTable do
outNum = outNum + NumSquadrons(k)
end
return outNum
end
-- used in AI scripts
function NumVariantSquadronsQ(shipType)
local varTable = VariantResearchInt[lower(shipType)]
local outNum = 0
for i, k in varTable do
outNum = outNum + NumSquadronsQ(k)
end
return outNum
end
-- used in AI scripts
function ShipVariantDemandGet(shipType)
local varTable = VariantResearchInt[lower(shipType)]
local demVal = 0
for i, k in varTable do
demVal = max(demVal, ShipDemandGet(k))
end
return demVal
end
-- used in AI scripts
function ShipVariantDemandAdd(shipType, demValue)
local varTable = VariantBuildInt[lower(shipType)]
for i, k in varTable do
ShipDemandAdd(k, demValue)
end
end
-- used in AI scripts
function Util_CheckVariantResearch(shipType)
local varTable = VariantResearchInt[lower(shipType)]
local boolVal = 0
for i, k in varTable do
boolVal = Util_CheckResearch(k)
if boolVal == 1 then
break
end
end
return boolVal
end
-- used in AI scripts
function IsVariantResearchDone(techType)
local varTable = VariantResearchInt[lower(shipType)]
local boolVal = 0
for i, k in varTable do
boolVal = IsResearchDone(k)
if boolVal == 1 then
break
end
end
return boolVal
end
|
local class = require "xgame.class"
local util = require "xgame.util"
local runtime = require "xgame.runtime"
local FLAnimPlayer = require "xgame.swf.FLAnimPlayer"
local FLAudioPlayer = require "xgame.swf.FLAudioPlayer"
local FLAudioScanner = require "xgame.swf.FLAudioScanner"
local FLAudioEvent = require "xgame.swf.FLAudioEvent"
local trace = util.trace('[FLMixPlayer]')
local FLMixPlayer = class("FLMixPlayer")
function FLMixPlayer:ctor(pathMaker)
self._running = true
self._audioPlayTimes = {}
self.pathMaker = pathMaker
self.option = {sameAudioInterval = 0}
self.animPlayer = FLAnimPlayer.new()
self.audioPlayer = FLAudioPlayer.new()
self.audioScanner = FLAudioScanner.new()
self.audioScanner:addListener(FLAudioEvent.PLAY_AUDIO, self._playAudio, self)
self.audioScanner:addListener(FLAudioEvent.STOP_AUDIO, self._stopAudio, self)
end
function FLMixPlayer:update(delta)
if self._running then
self.animPlayer:update(delta)
self.audioPlayer:update(delta)
self.audioScanner:update(delta)
end
end
function FLMixPlayer:clear()
self.animPlayer:clear()
self.audioPlayer:clear()
self.audioScanner:clear()
end
function FLMixPlayer:pause()
self._running = false
self.audioPlayer:pause()
self.animPlayer:pause()
end
function FLMixPlayer:resume()
self._running = true
self.audioPlayer:resume()
self.animPlayer:resume()
end
function FLMixPlayer:makePath(option)
if type(self.pathMaker) == "string" then
return string.format(self.pathMaker, option.name)
else
return self.pathMaker(option)
end
end
function FLMixPlayer:_stopAudio(_, option, tag)
self.audioPlayer:stopByTag(tag)
end
function FLMixPlayer:_playAudio(_, option, tag)
local path = self:makePath(option)
local lastTime = self._audioPlayTimes[path] or 0
self._audioPlayTimes[path] = runtime.time
if runtime.time - lastTime >= self.option.sameAudioInterval then
self.audioPlayer:play(self:makePath(option), option.loop,
option.volume, 0, tag)
else
trace('interval limit: %s', path)
end
end
return FLMixPlayer
|
---@class CS.UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule : CS.System.ValueType
---@field public enabled boolean
---@field public limitX CS.UnityEngine.ParticleSystem.MinMaxCurve
---@field public limitXMultiplier number
---@field public limitY CS.UnityEngine.ParticleSystem.MinMaxCurve
---@field public limitYMultiplier number
---@field public limitZ CS.UnityEngine.ParticleSystem.MinMaxCurve
---@field public limitZMultiplier number
---@field public limit CS.UnityEngine.ParticleSystem.MinMaxCurve
---@field public limitMultiplier number
---@field public dampen number
---@field public separateAxes boolean
---@field public space number
---@field public drag CS.UnityEngine.ParticleSystem.MinMaxCurve
---@field public dragMultiplier number
---@field public multiplyDragByParticleSize boolean
---@field public multiplyDragByParticleVelocity boolean
---@type CS.UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule
CS.UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule = { }
return CS.UnityEngine.ParticleSystem.LimitVelocityOverLifetimeModule
|
include "./vendor/premake/premake_customization/solution_items.lua"
include "Dependencies.lua"
workspace "Oberon"
architecture "x86_64"
startproject "Hazelnut"
configurations
{
"Debug",
"Release",
"Dist"
}
solution_items
{
".editorconfig"
}
flags
{
"MultiProcessorCompile"
}
outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"
group "Dependencies"
include "vendor/premake"
include "Oberon/vendor/GLFW"
include "Oberon/vendor/Glad"
include "Oberon/vendor/imgui"
include "Oberon/vendor/yaml-cpp"
group ""
include "Oberon"
include "Sandbox"
|
add = function (x, y)
local sum = x + y
return sum
end
identity = function () end
assert(add(2, 7) == 9)
assert(add(5, 11, 41) == 16)
assert(identity() == nil)
|
local L = LibStub("AceLocale-3.0"):GetLocale("Skada", false)
local AceGUI = LibStub("AceGUI-3.0")
-- Mode menu list sorted by category
local function _modeMenu(window, level)
local info = UIDropDownMenu_CreateInfo()
local modes = Skada:GetModes()
local categorized = {}
for i, module in ipairs(modes) do
table.insert(categorized, module)
end
table.sort(categorized, function(a, b)
local a_score = 0
local b_score = 0
if a.category == L['Other'] then
a_score = 1000
end
if b.category == L['Other'] then
b_score = 1000
end
a_score = a_score + (string.byte(a.category, 1) * 10) + string.byte(a:GetName(), 1)
b_score = b_score + (string.byte(b.category, 1) * 10) + string.byte(b:GetName(), 1)
return a_score < b_score
end)
local lastcat = nil
for i, module in ipairs(categorized) do
if not lastcat or lastcat ~= module.category then
if lastcat then
-- Add a blank separator
info = UIDropDownMenu_CreateInfo()
info.disabled = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
end
info = UIDropDownMenu_CreateInfo()
info.isTitle = 1
info.text = module.category
UIDropDownMenu_AddButton(info, level)
lastcat = module.category
end
info = UIDropDownMenu_CreateInfo()
info.text = module:GetName()
info.func = function() window:DisplayMode(module) end
info.checked = (window.selectedmode == module)
UIDropDownMenu_AddButton(info, level)
end
end
local function getDropdownPoint()
local x,y = GetCursorPosition(UIParent);
x = x / UIParent:GetEffectiveScale();
y = y / UIParent:GetEffectiveScale();
local point
if x > GetScreenWidth() / 2 then
point = "RIGHT"
else
point = "LEFT"
end
if y > GetScreenHeight() / 2 then
point = "TOP"..point
else
point = "BOTTOM"..point
end
return point, x, y
end
-- Configuration menu.
function Skada:OpenMenu(window)
if not self.skadamenu then
self.skadamenu = CreateFrame("Frame", "SkadaMenu")
end
local skadamenu = self.skadamenu
skadamenu.displayMode = "MENU"
local info = UIDropDownMenu_CreateInfo()
skadamenu.initialize = function(self, level)
if not level then return end
if level == 1 then
-- Create the title of the menu
info = UIDropDownMenu_CreateInfo()
info.isTitle = 1
info.text = L["Skada Menu"]
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
for i, win in ipairs(Skada:GetWindows()) do
info = UIDropDownMenu_CreateInfo()
info.text = win.db.name
info.hasArrow = 1
info.value = win
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
end
-- Add a blank separator
info = UIDropDownMenu_CreateInfo()
info.disabled = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
-- Can't report if we are not in a mode.
if not window or (window and window.selectedmode) then
info = UIDropDownMenu_CreateInfo()
info.text = L["Report"]
info.func = function() Skada:OpenReportWindow(window) end
info.value = "report"
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
end
info = UIDropDownMenu_CreateInfo()
info.text = L["Delete segment"]
info.hasArrow = 1
info.notCheckable = 1
info.value = "delete"
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Keep segment"]
info.notCheckable = 1
info.hasArrow = 1
info.value = "keep"
UIDropDownMenu_AddButton(info, level)
-- Add a blank separator
info = UIDropDownMenu_CreateInfo()
info.disabled = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Toggle window"]
info.func = function() Skada:ToggleWindow() end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Reset"]
info.func = function() Skada:Reset() end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Start new segment"]
info.func = function() Skada:NewSegment() end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Configure"]
info.func = function()
Skada:OpenOptions(window)
end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
-- Close menu item
info = UIDropDownMenu_CreateInfo()
info.text = CLOSE
info.func = function() CloseDropDownMenus() end
info.checked = nil
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
elseif level == 2 then
if type(UIDROPDOWNMENU_MENU_VALUE) == "table" then
local window = UIDROPDOWNMENU_MENU_VALUE
-- Display list of modes with current ticked; let user switch mode by checking one.
info = UIDropDownMenu_CreateInfo()
info.isTitle = 1
info.text = L["Mode"]
UIDropDownMenu_AddButton(info, level)
for i, module in ipairs(Skada:GetModes()) do
info = UIDropDownMenu_CreateInfo()
info.text = module:GetName()
info.func = function() window:DisplayMode(module) end
info.checked = (window.selectedmode == module)
UIDropDownMenu_AddButton(info, level)
end
-- Separator
info = UIDropDownMenu_CreateInfo()
info.disabled = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
-- Display list of sets with current ticked; let user switch set by checking one.
info = UIDropDownMenu_CreateInfo()
info.isTitle = 1
info.text = L["Segment"]
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Total"]
info.func = function()
window.selectedset = "total"
Skada:Wipe()
Skada:UpdateDisplay(true)
end
info.checked = (window.selectedset == "total")
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Current"]
info.func = function()
window.selectedset = "current"
Skada:Wipe()
Skada:UpdateDisplay(true)
end
info.checked = (window.selectedset == "current")
UIDropDownMenu_AddButton(info, level)
for i, set in ipairs(Skada:GetSets()) do
wipe(info)
info.text = Skada:GetSetLabel(set)
info.func = function()
window.selectedset = i
Skada:Wipe()
Skada:UpdateDisplay(true)
end
info.checked = (window.selectedset == set.starttime)
UIDropDownMenu_AddButton(info, level)
end
-- Add a blank separator
info = UIDropDownMenu_CreateInfo()
info.disabled = 1
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Lock window"]
info.func = function()
window.db.barslocked = not window.db.barslocked
Skada:ApplySettings()
end
info.checked = window.db.barslocked
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Hide window"]
info.func = function() if window:IsShown() then window.db.hidden = true; window:Hide() else window.db.hidden = false; window:Show() end end
info.checked = not window:IsShown()
UIDropDownMenu_AddButton(info, level)
elseif UIDROPDOWNMENU_MENU_VALUE == "delete" then
for i, set in ipairs(Skada:GetSets()) do
info = UIDropDownMenu_CreateInfo()
info.text = Skada:GetSetLabel(set)
info.func = function() Skada:DeleteSet(set) end
info.notCheckable = 1
UIDropDownMenu_AddButton(info, level)
end
elseif UIDROPDOWNMENU_MENU_VALUE == "keep" then
for i, set in ipairs(Skada:GetSets()) do
info = UIDropDownMenu_CreateInfo()
info.text = Skada:GetSetLabel(set)
info.func = function()
set.keep = not set.keep
Skada:Wipe()
Skada:UpdateDisplay(true)
end
info.checked = set.keep
UIDropDownMenu_AddButton(info, level)
end
end
elseif level == 3 then
if UIDROPDOWNMENU_MENU_VALUE == "modes" then
for i, module in ipairs(Skada:GetModes()) do
info = UIDropDownMenu_CreateInfo()
info.text = module:GetName()
info.checked = (Skada.db.profile.report.mode == module:GetName())
info.func = function() Skada.db.profile.report.mode = module:GetName() end
UIDropDownMenu_AddButton(info, level)
end
elseif UIDROPDOWNMENU_MENU_VALUE == "segment" then
info = UIDropDownMenu_CreateInfo()
info.text = L["Total"]
info.func = function() Skada.db.profile.report.set = "total" end
info.checked = (Skada.db.profile.report.set == "total")
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Current"]
info.func = function() Skada.db.profile.report.set = "current" end
info.checked = (Skada.db.profile.report.set == "current")
UIDropDownMenu_AddButton(info, level)
for i, set in ipairs(Skada:GetSets()) do
info = UIDropDownMenu_CreateInfo()
info.text = Skada:GetSetLabel(set)
info.func = function() Skada.db.profile.report.set = i end
info.checked = (Skada.db.profile.report.set == i)
UIDropDownMenu_AddButton(info, level)
end
end
end
end
local x,y;
skadamenu.point, x, y = getDropdownPoint()
ToggleDropDownMenu(1, nil, skadamenu, "UIParent", x, y)
end
function Skada:SegmentMenu(window)
if not self.segmentsmenu then
self.segmentsmenu = CreateFrame("Frame", "SkadaWindowButtonsSegments")
end
local segmentsmenu = self.segmentsmenu
segmentsmenu.displayMode = "MENU"
segmentsmenu.initialize = function(self, level)
if not level then return end
local info = UIDropDownMenu_CreateInfo()
info.isTitle = 1
info.text = L["Segment"]
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Total"]
info.func = function()
window.selectedset = "total"
Skada:Wipe()
Skada:UpdateDisplay(true)
end
info.checked = (window.selectedset == "total")
UIDropDownMenu_AddButton(info, level)
info = UIDropDownMenu_CreateInfo()
info.text = L["Current"]
info.func = function()
window.selectedset = "current"
Skada:Wipe()
Skada:UpdateDisplay(true)
end
info.checked = (window.selectedset == "current")
UIDropDownMenu_AddButton(info, level)
for i, set in ipairs(Skada:GetSets()) do
info = UIDropDownMenu_CreateInfo()
info.text = Skada:GetSetLabel(set)
info.func = function()
window.selectedset = i
Skada:Wipe()
Skada:UpdateDisplay(true)
end
info.checked = (window.selectedset == i)
UIDropDownMenu_AddButton(info, level)
end
end
local x,y;
segmentsmenu.point, x, y = getDropdownPoint()
ToggleDropDownMenu(1, nil, segmentsmenu, "UIParent", x, y)
end
function Skada:ModeMenu(window)
--Spew("window", window)
if not self.modesmenu then
self.modesmenu = CreateFrame("Frame", "SkadaWindowButtonsModes")
end
local modesmenu = self.modesmenu
modesmenu.displayMode = "MENU"
modesmenu.initialize = function(self, level)
if not level then return end
_modeMenu(window, level)
end
local x,y;
modesmenu.point, x, y = getDropdownPoint()
ToggleDropDownMenu(1, nil, modesmenu, "UIParent", x, y)
end
function Skada:OpenReportWindow(window)
if self.ReportWindow==nil then
self:CreateReportWindow(window)
end
--self:UpdateReportWindow()
self.ReportWindow:Show()
end
local function destroywindow()
if Skada.ReportWindow then
-- remove AceGUI hacks before recycling the widget
local frame = Skada.ReportWindow
frame.LayoutFinished = frame.orig_LayoutFinished
frame.frame:SetScript("OnKeyDown", nil)
frame.frame:EnableKeyboard(false)
frame.frame:SetPropagateKeyboardInput(false)
frame:ReleaseChildren()
frame:Release()
end
Skada.ReportWindow = nil
end
function Skada:CreateReportWindow(window)
-- ASDF = window
self.ReportWindow = AceGUI:Create("Window")
local frame = self.ReportWindow
frame:EnableResize(false)
frame:SetWidth(250)
frame:SetLayout("List")
frame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
frame.frame:SetClampedToScreen(true)
-- slight AceGUI hack to auto-set height of Window widget:
frame.orig_LayoutFinished = frame.LayoutFinished
frame.LayoutFinished = function(self, _, height) frame:SetHeight(height + 57) end
-- another AceGUI hack to hide on Escape:
frame.frame:SetScript("OnKeyDown", function(self,key)
if GetBindingFromClick(key) == "TOGGLEGAMEMENU" then
destroywindow()
end
end)
frame.frame:EnableKeyboard(true)
frame.frame:SetPropagateKeyboardInput(true)
if window then
frame:SetTitle(L["Report"] .. (" - %s"):format(window.db.name))
else
frame:SetTitle(L["Report"])
end
frame:SetCallback("OnClose", function(widget, callback) destroywindow() end)
if window then
Skada.db.profile.report.set = window.selectedset
Skada.db.profile.report.mode = window.db.mode
else
-- Mode, default last chosen or first available.
local modebox = AceGUI:Create("Dropdown")
modebox:SetLabel(L["Mode"])
modebox:SetList({})
for i, mode in ipairs(Skada:GetModes()) do
modebox:AddItem(mode:GetName(), mode:GetName())
end
modebox:SetCallback("OnValueChanged", function(f, e, value) Skada.db.profile.report.mode = value end)
modebox:SetValue(Skada.db.profile.report.mode or Skada:GetModes()[1])
frame:AddChild(modebox)
-- Segment, default last chosen or last set.
local setbox = AceGUI:Create("Dropdown")
setbox:SetLabel(L["Segment"])
setbox:SetList({total = L["Total"], current = L["Current"]})
for i, set in ipairs(Skada:GetSets()) do
setbox:AddItem(i, (Skada:GetSetLabel(set)))
end
setbox:SetCallback("OnValueChanged", function(f, e, value) Skada.db.profile.report.set = value end)
setbox:SetValue(Skada.db.profile.report.set or Skada:GetSets()[1])
frame:AddChild(setbox)
end
local channellist = {
whisper = { L["Whisper"], "whisper", true},
target = { L["Whisper Target"], "whisper"},
say = { L["Say"], "preset"},
raid = { L["Raid"], "preset"},
party = { L["Party"], "preset"},
instance_chat = { L["Instance"], "preset"},
guild = { L["Guild"], "preset"},
officer = { L["Officer"], "preset"},
self = { L["Self"], "self"},
bnet = { BATTLENET_OPTIONS_LABEL, "bnet", true},
}
local list = {GetChannelList()}
for i=1,#list,3 do
local chan = list[i+1]
if chan ~= "Trade" and chan ~= "General" and chan ~= "LookingForGroup" then -- These should be localized.
channellist[chan] = {("%d: %s"):format(list[i], chan), "channel"}
end
end
-- Channel, default last chosen or Say.
local channelbox = AceGUI:Create("Dropdown")
channelbox:SetLabel(L["Channel"])
channelbox:SetList( {} )
for chan, kind in pairs(channellist) do
channelbox:AddItem(chan, kind[1])
end
local origchan = Skada.db.profile.report.channel or "say"
if not channellist[origchan] then origchan = "say" end -- ticket 455: upgrading old settings
channelbox:SetValue(origchan)
channelbox:SetCallback("OnValueChanged", function(f, e, value)
Skada.db.profile.report.channel = value
Skada.db.profile.report.chantype = channellist[value][2]
if channellist[origchan][3] ~= channellist[value][3] then
-- redraw in-place to add/remove whisper widget
local pos = { frame:GetPoint() }
destroywindow()
Skada:CreateReportWindow(window)
Skada.ReportWindow:SetPoint(unpack(pos))
end
end)
frame:AddChild(channelbox)
local lines = AceGUI:Create("Slider")
lines:SetLabel(L["Lines"])
lines:SetValue(Skada.db.profile.report.number ~= nil and Skada.db.profile.report.number or 10)
lines:SetSliderValues(1, 25, 1)
lines:SetCallback("OnValueChanged", function(self, event, value) Skada.db.profile.report.number = value end)
lines:SetFullWidth(true)
frame:AddChild(lines)
if channellist[origchan][3] then
local whisperbox = AceGUI:Create("EditBox")
whisperbox:SetLabel(L["Whisper Target"])
whisperbox:SetText(Skada.db.profile.report.target or "")
whisperbox:SetCallback("OnEnterPressed", function(box, event, text)
if strlenutf8(text) == #text then -- remove spaces which are always non-meaningful and can sometimes cause problems
local ntext = text:gsub("%s","")
if ntext ~= text then
text = ntext
whisperbox:SetText(text)
end
end
Skada.db.profile.report.target = text;
frame.button.frame:Click()
end)
whisperbox:SetCallback("OnTextChanged", function(box, event, text) Skada.db.profile.report.target = text end)
whisperbox:SetFullWidth(true)
frame:AddChild(whisperbox)
end
local report = AceGUI:Create("Button")
frame.button = report
report:SetText(L["Report"])
report:SetCallback("OnClick", function()
local mode, set, channel, chantype, number = Skada.db.profile.report.mode, Skada.db.profile.report.set, Skada.db.profile.report.channel, Skada.db.profile.report.chantype, Skada.db.profile.report.number
if channel == "whisper" then
channel = Skada.db.profile.report.target
if channel and #strtrim(channel) == 0 then
channel = nil
end
elseif channel == "bnet" then
channel = BNet_GetBNetIDAccount(Skada.db.profile.report.target)
elseif channel == "target" then
if UnitExists("target") then
local toon, realm = UnitName("target")
if realm and #realm > 0 then
channel = toon .. "-" .. realm
else
channel = toon
end
else
channel = nil
end
end
-- print(tostring(frame.channel), tostring(frame.chantype), tostring(window.db.mode))
if channel and chantype and mode and set and number then
Skada:Report(channel, chantype, mode, set, number, window)
frame:Hide()
else
Skada:Print("Error: Whisper target not found")
end
end)
report:SetFullWidth(true)
frame:AddChild(report)
end
|
--https://github.com/blacktaxi/oops
local class = require 'oops'
--local md5 = require("md5")
local redis = require "resty.redis"
local json = require 'cjson'
function trim(source)
return string.gsub(source, "^%s*(.-)%s*$", "%1")
end
function split (source, delimiters)
if not source then return {} end
local items = {}
local pattern = '([^'..delimiters..']+)'
string.gsub(source, pattern, function(value)
items[#items + 1] = trim(value);
end);
return items
end
function log(value, name)
local type = type(value)
name = name or ''
value = value or '(null)'
if type ~= 'string' then
value = json.encode(value)
end
value = '\n\n\n >>> ' .. name .. '\n' .. value .. '\n\n\n'
ngx.log(ngx.OK, value)
end
local mt = getmetatable("")
mt.__index["split"] = split
mt.__index["trim"] = trim
--
-- REDIS
--
local Redis = class {
__init = function (self, config)
self.host = config.host
self.host= config.host or 'redis'
self.port= config.port or 6379
self.timeout= config.timeout or 5000
self.database= config.database or 0
self.max_idle_time= config.max_idle_time or 60000
self.pool_size= config.pool_size or 100
end,
conn = function(self)
local conn = redis:new()
conn:set_timeout(self.timeout)
local ok, err = conn:connect(self.host, self.port)
if not ok then
errlog("Cannot connect, host: " .. self.host .. ", port: " .. self.port)
return nil, err
end
conn:select(self.database)
return conn;
end,
exec = function(self, callback)
local conn = self:conn()
conn:init_pipeline()
callback(conn)
return self:finish(conn)
end,
finish = function(self, conn)
res, err = conn:commit_pipeline()
if not res then
ngx.log(ngx.ERR, 'Algo anda mal con redis: ' .. err)
end
local ok, err = conn:set_keepalive(self.max_idle_time, self.pool_size)
if not ok then
conn:close()
end
return res, err
end
}
--
-- CACHE-CONTROL
--
local CacheControl = class {
__init = function (self, line)
line = line or ''
local items = line:split(',')
self.table = {}
for _,item in pairs(items) do
local key, value = self.parse(item)
self.table[key] = value
end
end,
parse = function(item)
item = item:trim()
local res = split(item, "=")
local key = res[1]
local value = res[2]
if(key == 'public') then
return key, true
end
return key, tonumber(value)
end,
is_public = function(self)
return self.table.public
end,
get_ttl = function(self)
if not self.is_public then
return null
end
return self.table['s-maxage'] or 0
end
}
--
-- REQUEST
--
local Request = class {
__init = function (self, ngx)
self.ngx = ngx
self.method = ngx.req.get_method()
self.headers = ngx.req.get_headers()
self.uri = self.ngx.var.request_uri
self.ext = self:get_ext()
-- tags
end,
get_ext = function(self)
local normalized = {}
normalized['application/ld+json'] = 'jsonld'
normalized['application/hal+json'] = 'jsonhal'
normalized['application/vnd.api+json'] = 'jsonapi'
normalized['application/json'] = 'json'
normalized['application/xml'] = 'xml'
normalized['text/xml'] = 'xml'
normalized['application/x-yaml'] = 'yaml'
normalized['text/csv'] = 'csv'
normalized['text/html'] = 'html'
normalized['application/vnd.ms-excel'] = 'xlsx'
local types = (self.headers.accept or 'application/ld+json'):split(',');
local content_type = null
for _,type in pairs(types) do
type = type:lower()
content_type = content_type or normalized[type]
end
return content_type or ''
end,
key = function(self)
return 'key:/' .. self.uri .. '.' .. self.ext
end,
tag_key = function(self)
return self.uri
end,
is_ban = function(self)
return self.method == 'BAN'
end,
is_get = function(self)
return self.method == 'GET'
end,
pass = function(self)
local ngx = self.ngx
ngx.req.read_body()
return ngx.location.capture('/index.php', {
args= ngx.var.args,
share_all_vars= true,
always_forward_body= true,
body= ngx.req.get_body_data()
})
end
}
--
-- BAN
--
local Ban = class {
__init = function (self, redis, request)
self.redis = redis
self.request = request
end,
response = function(self)
local redis = self.redis
local tags = self.request.headers.ban_keys or {}
if type(tags) == 'string' then
tags = {tags}
end
for _,tag in pairs(tags) do
self:ban_tag('tag:/'..tag)
end
return {
header= {},
body= 'ban',
status= 200
}
end,
ban_tag = function(self, tag)
local redis = self.redis
local keys = redis:exec(
function (conn)
return conn:smembers(tag)
end
)[1]
redis:exec(
function (conn)
for _,key in pairs(keys) do
conn:del(key)
end
conn:del(tag)
end
)
end
}
--
-- HIT
--
local Hit = class {
__init = function (self, redis, request)
self.redis = redis
self.request = request
end,
response = function(self)
local redis = self.redis
local key = self.request:key()
local response = redis:exec(
function(conn)
return conn:get(key)
end
)
response = json.decode(response[1])
response.header['X-Cache'] = 'HIT'
return response
end
}
--
-- MISS
--
local Miss = class {
__init = function (self, redis, request)
self.redis = redis
self.request = request
end,
response = function(self)
local redis = self.redis
local key = self.request:key()
local tag_key = self.request:tag_key()
local response = self.request:pass()
local control = CacheControl(response.header['Cache-Control'])
if not control:is_public() then
response.header['X-Cache'] = 'BYPASS'
return response
end
local tags = (response.header['Cache-Tags'] or tag_key):split(',')
redis:exec(
function(conn)
conn:set(key, json.encode(response))
conn:expire(key, control:get_ttl())
for _,tag in pairs(tags) do
tag = 'tag:/'.. tag
conn:sadd(tag, key)
end
end
)
response.header['X-Cache'] = 'MISS'
return response
end
}
--
-- PASS
--
local Pass = class {
__init = function (self, request)
self.request = request
end,
response = function(self)
return self.request:pass()
end
}
--
-- CACHE
--
local ActionFactory = class {
__init = function (self, redis)
self.redis = redis
end,
exists = function(self, key)
local redis = self.redis
local res = redis:exec(
function(conn)
return conn:exists(key);
end
)
return res[1] == 1
end,
get = function(self, request)
local redis = self.redis
if request:is_ban()
then
return Ban(redis, request)
end
local key = request:key()
local key_exists = self:exists(key)
if request:is_get() and key_exists
then
return Hit(redis, request)
end
if request:is_get() and not key_exists
then
return Miss(redis, request)
end
return Pass(request)
end,
response = function(self)
return {
headers= {},
body= 'key =>' .. self.request:key(),
status= 200
}
end
}
--
-- PROXY
--
local Proxy = class {
__init = function (self, ngx)
self.ngx = ngx
local request = Request(self.ngx)
local redis = Redis({
host= os.getenv('REDIS') or 'redis',
})
local action = ActionFactory(redis):get(request)
self.response = action:response()
self:finish()
end,
finish = function (self)
local response = self.response
for name, value in pairs(response.header) do
self.ngx.header[name] = value
end
self.ngx.say(response.body)
self.ngx.exit(response.status)
end
}
Proxy(ngx);
-- application/ld+json
-- application/hal+json
-- application/vnd.api+json
-- application/json
-- application/xml
-- text/xml
-- application/x-yaml
-- text/csv
-- text/html
-- application/vnd.ms-excel
|
-- Minetest 0.4 mod: default
-- See README.txt for licensing and other information.
-- The API documentation in here was moved into doc/lua_api.txt
WATER_ALPHA = 160
WATER_VISC = 1
LAVA_VISC = 7
LIGHT_MAX = 14
-- Definitions made by this mod that other mods can use too
default = {}
-- Load files
dofile(minetest.get_modpath("default").."/functions.lua")
dofile(minetest.get_modpath("default").."/player.lua")
dofile(minetest.get_modpath("default").."/genders.lua")
|
--[[
Copyright 2014-2015 The Luvit Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
--]]
local request = require('coro-http').request
local semver = require('semver')
local jsonParse = require('json').parse
local log = require('log').log
local prompt = require('prompt')(require('pretty-print'))
local makeCore = require('core')
local uv = require('uv')
local core
local function matchVersions(name, version)
local head, body = request("GET", "https://lit.luvit.io/packages/" .. name)
assert(head.code == 200)
local versions = assert(jsonParse(body), "Problem parsing JSON response from lit")
local key
return semver.match(version, function ()
key = next(versions, key)
return key
end)
end
-- Feed auto-updater your package.lua pre-parsed as a lua table
local function check(meta, target)
core = core or makeCore()
local name = meta.name
local basename = name:match("[^/]+$")
local version = meta.version
local toupdate, action
local new, old
if version then
version = semver.normalize(version)
toupdate = matchVersions(name, version)
if not target then
return toupdate
end
if not toupdate then
log(basename .. " is newer than remote", meta.version, "err")
return
end
if toupdate == meta.version then
log(basename .. " is up to date", meta.version, "highlight")
return
end
local res = prompt("Are you sure you wish to update " .. target .. " to " .. name .. " version " .. toupdate .. "?", "Y/n")
if not res:match("[yY]") then
log("canceled " .. basename .. " update", meta.version, "err")
return
end
action = {"updating", "update"}
new = target .. ".new"
old = target .. ".old"
else
toupdate = matchVersions(name)
action = {"installing", "installation"}
new = target
old = nil
end
core.makeUrl("lit://" .. meta.name .. "@" .. toupdate, new)
log(action[1] .. basename .. " binary", target, "highlight")
if old then
uv.fs_rename(target, old)
uv.fs_rename(new, target)
uv.fs_unlink(old)
end
log(basename .. " " .. action[2] .. " complete", toupdate, "success")
end
return {
matchVersions = matchVersions,
check = check,
}
|
-- gcPlayerGlobals-Signature.lua
-- Author: Gaticus Hax
-- License: Public Domain
require("Scripts.HaxablesMonitor")
local mbinFile = "GCPLAYERGLOBALS.GLOBAL.MBIN"
local dataSignature = "01 00 00 00 00 00 16 44 00 00 48 44 9A 99 59 3F 00 00 C8 43 00 00 C8 43 9A 99 59 3F 00 00 00 00"
local dataOffset = 0x0000
defineMBIN(mbinFile, dataSignature, dataOffset)
|
-- Dominos.lua - The main driver for Dominos
local AddonName, AddonTable = ...
local Addon = LibStub('AceAddon-3.0'):NewAddon(AddonTable, AddonName, 'AceEvent-3.0', 'AceConsole-3.0')
local L = LibStub('AceLocale-3.0'):GetLocale(AddonName)
local KeyBound = LibStub('LibKeyBound-1.0')
local ADDON_VERSION = GetAddOnMetadata(AddonName, 'Version')
local ADDON_BUILD = GetAddOnMetadata(AddonName, 'X-Build') or UNKNOWN
local CONFIG_ADDON_NAME = AddonName .. '_Config'
local CONFIG_VERSION = 1
-- setup custom callbacks
Addon.callbacks = LibStub('CallbackHandler-1.0'):New(Addon)
-- how many action buttons we support
Addon.ACTION_BUTTON_COUNT = 120
--------------------------------------------------------------------------------
-- Events
--------------------------------------------------------------------------------
function Addon:OnInitialize()
-- setup db
self:CreateDatabase()
self:UpgradeDatabase()
-- create a stub loader for the options menu
self:CreateOptionsFrame()
-- keybound support
local kb = KeyBound
kb.RegisterCallback(self, 'LIBKEYBOUND_ENABLED')
kb.RegisterCallback(self, 'LIBKEYBOUND_DISABLED')
end
function Addon:OnEnable()
if self:IsWrongBuild() then
self:Printf(L.WrongBuildWarning, AddonName, ADDON_BUILD, self:GetWowBuild())
end
self:UpdateUseOverrideUI()
self:Load()
end
-- configuration events
function Addon:OnUpgradeDatabase(oldVersion, newVersion)
end
function Addon:OnUpgradeAddon(oldVersion, newVersion)
self:Printf(L.Updated, ADDON_VERSION, ADDON_BUILD)
end
-- keybound events
function Addon:LIBKEYBOUND_ENABLED()
self.Frame:ForAll('KEYBOUND_ENABLED')
end
function Addon:LIBKEYBOUND_DISABLED()
self.Frame:ForAll('KEYBOUND_DISABLED')
end
-- profile events
function Addon:OnNewProfile(msg, db, name)
self:Printf(L.ProfileCreated, name)
end
function Addon:OnProfileDeleted(msg, db, name)
self:Printf(L.ProfileDeleted, name)
end
function Addon:OnProfileChanged(msg, db, name)
self:Printf(L.ProfileLoaded, name)
self:Load()
end
function Addon:OnProfileCopied(msg, db, name)
self:Printf(L.ProfileCopied, name)
self:Reload()
end
function Addon:OnProfileReset(msg, db)
self:Printf(L.ProfileReset, db:GetCurrentProfile())
self:Reload()
end
function Addon:OnProfileShutdown(msg, db, name)
self:Unload()
end
--------------------------------------------------------------------------------
-- Layout Lifecycle
--------------------------------------------------------------------------------
-- Load is called when the addon is first enabled, and also whenever a profile
-- is loaded
function Addon:Load()
self.callbacks:Fire('LAYOUT_LOADING')
local function module_load(module, id)
if not self.db.profile.modules[id] then
return
end
local f = module.Load
if type(f) == 'function' then
f(module)
end
end
for id, module in self:IterateModules() do
local success, msg = pcall(module_load, module, id)
if not success then
self:Printf('Failed to load %s\n%s', module:GetName(), msg)
end
end
self.Frame:ForAll('RestoreAnchor')
self:GetModule('ButtonThemer'):Reskin()
self.callbacks:Fire('LAYOUT_LOADED')
end
-- unload is called when we're switching profiles
function Addon:Unload()
self.callbacks:Fire('LAYOUT_UNLOADING')
local function module_unload(module, id)
if not self.db.profile.modules[id] then
return
end
local f = module.Unload
if type(f) == 'function' then
f(module)
end
end
-- unload any module stuff
for id, module in self:IterateModules() do
local success, msg = pcall(module_unload, module, id)
if not success then
self:Printf('Failed to unload %s\n%s', module:GetName(), msg)
end
end
self.callbacks:Fire('LAYOUT_UNLOADED')
end
function Addon:Reload()
self:Unload()
self:Load()
end
--------------------------------------------------------------------------------
-- Database Setup
--------------------------------------------------------------------------------
-- db actions
function Addon:CreateDatabase()
local db = LibStub('AceDB-3.0'):New(AddonName .. 'DB', self:GetDatabaseDefaults(), UnitClass('player'))
db.RegisterCallback(self, 'OnNewProfile')
db.RegisterCallback(self, 'OnProfileChanged')
db.RegisterCallback(self, 'OnProfileCopied')
db.RegisterCallback(self, 'OnProfileDeleted')
db.RegisterCallback(self, 'OnProfileReset')
db.RegisterCallback(self, 'OnProfileShutdown')
self.db = db
end
function Addon:GetDatabaseDefaults()
return {
profile = {
possessBar = 1,
-- if true, applies a default dominos skin to buttons
-- when masque is not enabled
applyButtonTheme = true,
sticky = true,
linkedOpacity = false,
showMacroText = true,
showBindingText = true,
showCounts = true,
showEquippedItemBorders = true,
showTooltips = true,
showTooltipsCombat = true,
useOverrideUI = not self:IsBuild('classic'),
minimap = {
hide = false
},
ab = {
count = 10,
showgrid = true,
rightClickUnit = 'player'
},
frames = {
bags = {
point = 'BOTTOMRIGHT',
oneBag = false,
keyRing = true,
spacing = 2
}
},
alignmentGrid = {
enabled = true,
size = 32
},
-- what modules are enabled
-- module[id] = enabled
modules = {
['**'] = true
}
}
}
end
function Addon:UpgradeDatabase()
local configVerison = self.db.global.configVersion
if configVerison ~= CONFIG_VERSION then
self:OnUpgradeDatabase(configVerison, CONFIG_VERSION)
self.db.global.configVersion = CONFIG_VERSION
end
local addonVersion = self.db.global.addonVersion
if addonVersion ~= ADDON_VERSION then
self:OnUpgradeAddon(addonVersion, ADDON_VERSION)
self.db.global.addonVersion = ADDON_VERSION
end
end
--------------------------------------------------------------------------------
-- Profiles
--------------------------------------------------------------------------------
-- profile actions
function Addon:SaveProfile(name)
local toCopy = self.db:GetCurrentProfile()
if name and name ~= toCopy then
self.db:SetProfile(name)
self.db:CopyProfile(toCopy)
end
end
function Addon:SetProfile(name)
local profile = self:MatchProfile(name)
if profile and profile ~= self.db:GetCurrentProfile() then
self.db:SetProfile(profile)
else
self:Printf(L.InvalidProfile, name or 'null')
end
end
function Addon:DeleteProfile(name)
local profile = self:MatchProfile(name)
if profile and profile ~= self.db:GetCurrentProfile() then
self.db:DeleteProfile(profile)
else
self:Print(L.CantDeleteCurrentProfile)
end
end
function Addon:CopyProfile(name)
if name and name ~= self.db:GetCurrentProfile() then
self.db:CopyProfile(name)
end
end
function Addon:ResetProfile()
self.db:ResetProfile()
end
function Addon:ListProfiles()
self:Print(L.AvailableProfiles)
local current = self.db:GetCurrentProfile()
for _, k in ipairs(self.db:GetProfiles()) do
if k == current then
print(' - ' .. k, 1, 1, 0)
else
print(' - ' .. k)
end
end
end
function Addon:MatchProfile(name)
name = name:lower()
local nameRealm = name .. ' - ' .. GetRealmName():lower()
local match
for _, k in ipairs(self.db:GetProfiles()) do
local key = k:lower()
if key == name then
return k
elseif key == nameRealm then
match = k
end
end
return match
end
--------------------------------------------------------------------------------
-- Configuration UI
--------------------------------------------------------------------------------
-- create a stub container on the Blizzard interface options panel
-- it will be filled with content once the config addon loads
function Addon:CreateOptionsFrame()
if not self:IsConfigAddonEnabled() then
return
end
local frame = CreateFrame('Frame')
frame:Hide()
frame.name = AddonName
-- if a user shows this frame and we've not yet loaded the config addon,
-- then load it
frame:SetScript('OnShow', function(f)
f:SetScript('OnShow', nil)
LoadAddOn(CONFIG_ADDON_NAME)
end)
InterfaceOptions_AddCategory(frame)
self.OptionsFrame = frame
return frame
end
function Addon:ShowOptionsFrame()
if self.OptionsFrame and not InCombatLockdown() then
if not InterfaceOptionsFrame:IsShown() then
InterfaceOptionsFrame_Show()
end
InterfaceOptionsFrame_OpenToCategory(self.OptionsFrame)
return true
end
return false
end
function Addon:NewMenu()
if not self:IsConfigAddonEnabled() then
return
end
if not IsAddOnLoaded(CONFIG_ADDON_NAME) then
LoadAddOn(CONFIG_ADDON_NAME)
end
return self.Options.Menu:New()
end
function Addon:IsConfigAddonEnabled()
if GetAddOnEnableState(UnitName('player'), CONFIG_ADDON_NAME) >= 1 then
return true
end
end
--------------------------------------------------------------------------------
-- Configuration API
--------------------------------------------------------------------------------
-- frame settings
function Addon:SetFrameSets(id, sets)
id = tonumber(id) or id
self.db.profile.frames[id] = sets
return self.db.profile.frames[id]
end
function Addon:GetFrameSets(id)
return self.db.profile.frames[tonumber(id) or id]
end
-- configuration mode
Addon.locked = true
function Addon:SetLock(locked)
if InCombatLockdown() and (not locked) then
return
end
if locked and (not self:Locked()) then
self.locked = true
self.callbacks:Fire('CONFIG_MODE_DISABLED')
elseif (not locked) and self:Locked() then
self.locked = false
if not IsAddOnLoaded(CONFIG_ADDON_NAME) then
LoadAddOn(CONFIG_ADDON_NAME)
end
self.callbacks:Fire('CONFIG_MODE_ENABLED')
end
end
function Addon:Locked()
return self.locked
end
function Addon:ToggleLockedFrames()
self:SetLock(not self:Locked())
end
-- binding mode
function Addon:SetBindingMode(enable)
if enable and (not self:IsBindingModeEnabled()) then
self:SetLock(true)
KeyBound:Activate()
elseif (not enable) and self:IsBindingModeEnabled() then
KeyBound:Deactivate()
end
end
function Addon:IsBindingModeEnabled()
return KeyBound:IsShown()
end
function Addon:ToggleBindingMode()
self:SetBindingMode(not self:IsBindingModeEnabled())
end
-- scale
function Addon:ScaleFrames(...)
local numArgs = select('#', ...)
local scale = tonumber(select(numArgs, ...))
if scale and scale > 0 and scale <= 10 then
for i = 1, numArgs - 1 do
self.Frame:ForFrame(select(i, ...), 'SetFrameScale', scale)
end
end
end
-- opacity
function Addon:SetOpacityForFrames(...)
local numArgs = select('#', ...)
local alpha = tonumber(select(numArgs, ...))
if alpha and alpha >= 0 and alpha <= 1 then
for i = 1, numArgs - 1 do
self.Frame:ForFrame(select(i, ...), 'SetFrameAlpha', alpha)
end
end
end
-- faded opacity
function Addon:SetFadeForFrames(...)
local numArgs = select('#', ...)
local alpha = tonumber(select(numArgs, ...))
if alpha and alpha >= 0 and alpha <= 1 then
for i = 1, numArgs - 1 do
self.Frame:ForFrame(select(i, ...), 'SetFadeMultiplier', alpha)
end
end
end
-- columns
function Addon:SetColumnsForFrames(...)
local numArgs = select('#', ...)
local cols = tonumber(select(numArgs, ...))
if cols then
for i = 1, numArgs - 1 do
self.Frame:ForFrame(select(i, ...), 'SetColumns', cols)
end
end
end
-- spacing
function Addon:SetSpacingForFrame(...)
local numArgs = select('#', ...)
local spacing = tonumber(select(numArgs, ...))
if spacing then
for i = 1, numArgs - 1 do
self.Frame:ForFrame(select(i, ...), 'SetSpacing', spacing)
end
end
end
-- padding
function Addon:SetPaddingForFrames(...)
local numArgs = select('#', ...)
local pW, pH = select(numArgs - 1, ...)
if tonumber(pW) and tonumber(pH) then
for i = 1, numArgs - 2 do
self.Frame:ForFrame(select(i, ...), 'SetPadding', tonumber(pW), tonumber(pH))
end
end
end
-- visibility
function Addon:ShowFrames(...)
for i = 1, select('#', ...) do
self.Frame:ForFrame(select(i, ...), 'ShowFrame')
end
end
function Addon:HideFrames(...)
for i = 1, select('#', ...) do
self.Frame:ForFrame(select(i, ...), 'HideFrame')
end
end
function Addon:ToggleFrames(...)
for i = 1, select('#', ...) do
self.Frame:ForFrame(select(i, ...), 'ToggleFrame')
end
end
-- clickthrough
function Addon:SetClickThroughForFrames(...)
local numArgs = select('#', ...)
local enable = select(numArgs - 1, ...)
for i = 1, numArgs - 2 do
self.Frame:ForFrame(select(i, ...), 'SetClickThrough', tonumber(enable) == 1)
end
end
-- empty button display
function Addon:ToggleGrid()
self:SetShowGrid(not self:ShowGrid())
end
function Addon:SetShowGrid(enable)
self.db.profile.showgrid = enable or false
self.Frame:ForAll('UpdateGrid')
end
function Addon:ShowGrid()
return self.db.profile.showgrid
end
-- right click selfcast
function Addon:SetRightClickUnit(unit)
self.db.profile.ab.rightClickUnit = unit
self.Frame:ForAll('SetRightClickUnit', unit)
end
function Addon:GetRightClickUnit()
return self.db.profile.ab.rightClickUnit
end
-- binding text
function Addon:SetShowBindingText(enable)
self.db.profile.showBindingText = enable or false
self.Frame:ForAll('ForButtons', 'UpdateHotkeys')
end
function Addon:ShowBindingText()
return self.db.profile.showBindingText
end
-- macro text
function Addon:SetShowMacroText(enable)
self.db.profile.showMacroText = enable or false
self.Frame:ForAll('ForButtons', 'SetShowMacroText', enable)
end
function Addon:ShowMacroText()
return self.db.profile.showMacroText
end
-- border
function Addon:SetShowEquippedItemBorders(enable)
self.db.profile.showEquippedItemBorders = enable or false
self.Frame:ForAll('ForButtons', 'SetShowEquippedItemBorders', enable)
end
function Addon:ShowEquippedItemBorders()
return self.db.profile.showEquippedItemBorders
end
-- override ui
function Addon:SetUseOverrideUI(enable)
self.db.profile.useOverrideUI = enable and true or false
self:UpdateUseOverrideUI()
end
function Addon:UsingOverrideUI()
return self.db.profile.useOverrideUI and not self:IsBuild('classic')
end
function Addon:UpdateUseOverrideUI()
local overrideBar = _G.OverrideActionBar
if not overrideBar then
return
end
local usingOverrideUI = self:UsingOverrideUI()
self.OverrideController:SetAttribute('state-useoverrideui', usingOverrideUI)
overrideBar:ClearAllPoints()
if usingOverrideUI then
overrideBar:SetPoint('BOTTOM')
else
overrideBar:SetPoint('LEFT', overrideBar:GetParent(), 'RIGHT', 100, 0)
end
end
-- override action bar selection
function Addon:SetOverrideBar(id)
local prevBar = self:GetOverrideBar()
self.db.profile.possessBar = id
local newBar = self:GetOverrideBar()
prevBar:UpdateOverrideBar()
newBar:UpdateOverrideBar()
end
function Addon:GetOverrideBar()
return self.Frame:Get(self.db.profile.possessBar)
end
-- action bar counts
function Addon:SetNumBars(count)
count = Clamp(count, 1, self.ACTION_BUTTON_COUNT)
if count ~= self:NumBars() then
self.db.profile.ab.count = count
self.callbacks:Fire('ACTIONBAR_COUNT_UPDATED', count)
end
end
function Addon:SetNumButtons(count)
self:SetNumBars(self.ACTION_BUTTON_COUNT / count)
end
function Addon:NumBars()
return self.db.profile.ab.count
end
-- tooltips
function Addon:ShowTooltips()
return self.db.profile.showTooltips
end
function Addon:SetShowTooltips(enable)
self.db.profile.showTooltips = enable or false
self:GetModule('Tooltips'):SetShowTooltips(enable)
end
function Addon:SetShowCombatTooltips(enable)
self.db.profile.showTooltipsCombat = enable or false
self:GetModule('Tooltips'):SetShowTooltipsInCombat(enable)
end
function Addon:ShowCombatTooltips()
return self.db.profile.showTooltipsCombat
end
-- minimap button
function Addon:SetShowMinimap(enable)
self.db.profile.minimap.hide = not enable
self:GetModule('Launcher'):Update()
end
function Addon:ShowingMinimap()
return not self.db.profile.minimap.hide
end
-- sticky bars
function Addon:SetSticky(enable)
self.db.profile.sticky = enable or false
if not enable then
self.Frame:ForAll('Stick')
self.Frame:ForAll('Reposition')
end
end
function Addon:Sticky()
return self.db.profile.sticky
end
-- linked opacity
function Addon:SetLinkedOpacity(enable)
self.db.profile.linkedOpacity = enable or false
self.Frame:ForAll('UpdateWatched')
self.Frame:ForAll('UpdateAlpha')
end
function Addon:IsLinkedOpacityEnabled()
return self.db.profile.linkedOpacity
end
-- button theming toggle
function Addon:ThemeButtons()
return self.db.profile.applyButtonTheme
end
function Addon:SetThemeButtons(enable)
self.db.profile.applyButtonTheme = enable or false
self:GetModule('ButtonThemer'):Reskin()
end
-- show counts toggle
function Addon:ShowCounts()
return self.db.profile.showCounts
end
function Addon:SetShowCounts(enable)
self.db.profile.showCounts = enable or false
self.Frame:ForAll('ForButtons', 'SetShowCountText', enable)
end
-- alignment grid
function Addon:SetAlignmentGridEnabled(enable)
self.db.profile.alignmentGrid.enabled = enable
self.callbacks:Fire('ALIGNMENT_GRID_ENABLED', self:GetAlignmentGridEnabled())
end
function Addon:GetAlignmentGridEnabled()
return self.db.profile.alignmentGrid.enabled and true or false
end
function Addon:SetAlignmentGridSize(size)
self.db.profile.alignmentGrid.size = tonumber(size)
self.callbacks:Fire('ALIGNMENT_GRID_SIZE_CHANGED', self:GetAlignmentGridSize())
end
function Addon:GetAlignmentGridSize()
return self.db.profile.alignmentGrid.size
end
function Addon:GetAlignmentGridScale()
--due to changes in Dominos_Config\overlay\ui.lua to
--function "DrawGrid", grid now displays with perfectly square subdivisions.
local gridScale = GetScreenHeight() / (Addon:GetAlignmentGridSize() * 2)
return gridScale, gridScale
end
--------------------------------------------------------------------------------
-- Utility Methods
--------------------------------------------------------------------------------
-- display the current addon build being used
function Addon:PrintVersion()
self:Printf('%s-%s', ADDON_VERSION, ADDON_BUILD)
end
-- get the current World of Warcraft build being used
function Addon:GetWowBuild()
local project = WOW_PROJECT_ID
if project == WOW_PROJECT_CLASSIC then
return 'classic'
end
if project == WOW_PROJECT_MAINLINE then
return 'retail'
end
return 'unknown'
end
-- check if we're running the addon on one of a given set of wow versions
function Addon:IsBuild(...)
local build = self:GetWowBuild()
for i = 1, select('#', ...) do
if build == select(i, ...):lower() then
return true
end
end
return false
end
-- checks to see if we're running a version of the addon intended to actually
-- run on this server. Twitch likes to push classic versions to retail and I
-- need to check for that
function Addon:IsWrongBuild()
return not self:IsBuild(ADDON_BUILD)
end
-- exports
-- luacheck: push ignore 122
_G[AddonName] = Addon
-- luacheck: pop
|
local m, s, o
local clash = "clash"
local uci = luci.model.uci.cursor()
local fs = require "nixio.fs"
local sys = require "luci.sys"
local sid = arg[1]
local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid")
local server_table = {}
local encrypt_methods_ss = {
"rc4-md5",
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"aes-128-gcm",
"aes-192-gcm",
"aes-256-gcm",
"chacha20-ietf",
"xchacha20",
"chacha20-ietf-poly1305",
"xchacha20-ietf-poly1305",
}
local securitys = {
"auto",
"none",
"aes-128-gcm",
"chacha20-poly1305"
}
local encrypt_methods_ssr = {
"aes-128-cfb",
"aes-192-cfb",
"aes-256-cfb",
"aes-128-ctr",
"aes-192-ctr",
"aes-256-ctr",
"rc4-md5",
"chacha20-ietf",
"xchacha20",
}
local protocol_ssr = {
"origin",
"auth_sha1_v4",
"auth_aes128_md5",
"auth_aes128_sha1",
"auth_chain_a",
"auth_chain_b",
}
local obfs_ssr_list = {
"plain",
"http_simple",
"http_post",
"tls1.2_ticket_auth",
"tls1.2_ticket_fastauth",
"random_head",
}
m = Map(clash, translate("Edit Server"))
m.redirect = luci.dispatcher.build_url("admin/services/clash/config/create")
if m.uci:get(clash, sid) ~= "servers" then
luci.http.redirect(m.redirect)
return
end
-- [[ Servers Setting ]]--
s = m:section(NamedSection, sid, "servers")
s.anonymous = true
s.addremove = false
o = s:option(DummyValue,"ssr_url",translate("Import config info"))
o.rawhtml = true
o.template = "clash/ssrurl"
o.value =sid
o = s:option(ListValue, "type", translate("Server Node Type"))
o:value("ss", translate("Shadowsocks"))
o:value("ssr", translate("ShadowsocksR"))
o:value("vmess", translate("Vmess"))
o:value("socks5", translate("Socks5"))
o:value("http", translate("HTTP(S)"))
o:value("snell", translate("Snell"))
o:value("trojan", translate("trojan"))
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
o = s:option(Value, "name", translate("Alias"))
o.default = "Server"
o.rmempty = false
o = s:option(Value, "server", translate("Server Address"))
o.datatype = "host"
o.rmempty = false
o = s:option(Value, "port", translate("Server Port"))
o.datatype = "port"
o.rmempty = false
o = s:option(Value, "password", translate("Password"))
o.password = true
o.rmempty = true
o:depends("type", "ss")
o:depends("type", "ssr")
o:depends("type", "trojan")
o = s:option(Value, "psk", translate("Psk"))
o.rmempty = false
o:depends("type", "snell")
o = s:option(ListValue, "cipher", translate("Encrypt Method"))
for _, v in ipairs(encrypt_methods_ss) do o:value(v) end
o.rmempty = true
o:depends("type", "ss")
o = s:option(ListValue, "cipher_ssr", translate("Encrypt Method"))
for _, v in ipairs(encrypt_methods_ssr) do o:value(v) end
o.rmempty = true
o:depends("type", "ssr")
o = s:option(ListValue, "protocol", translate("Protocol"))
for _, v in ipairs(protocol_ssr) do o:value(v) end
o.rmempty = true
o:depends("type", "ssr")
o = s:option(Value, "protocolparam", translate("Protocol Param"))
o.rmempty = true
o:depends("type", "ssr")
o = s:option(ListValue, "obfs_ssr", translate("Obfs"))
for _, v in ipairs(obfs_ssr_list) do o:value(v) end
o.rmempty = true
o:depends("type", "ssr")
o = s:option(ListValue, "obfs_snell", translate("obfs-mode"))
o.rmempty = true
o.default = "none"
o:value("none")
o:value("tls")
o:value("http")
o:depends("type", "snell")
o = s:option(Value, "obfsparam", translate("Obfs Param"))
o.rmempty = true
o:depends("type", "ssr")
o = s:option(ListValue, "securitys", translate("Encrypt Method"))
for _, v in ipairs(securitys) do o:value(v, v:upper()) end
o.rmempty = true
o:depends("type", "vmess")
o = s:option(ListValue, "obfs", translate("obfs-mode"))
o.default = " "
o:value(" ", translate("none"))
o:value("tls")
o:value("http")
o:value("websocket", translate("websocket (ws)"))
o:depends("type", "ss")
o = s:option(ListValue, "obfs_vmess", translate("obfs-mode"))
o.default = "none"
o:value("none")
o:value("websocket", translate("websocket (ws)"))
o:value("http", translate("http"))
o:depends("type", "vmess")
o = s:option(Value, "host", translate("hosts"))
o.datatype = "host"
o.rmempty = true
o:depends("obfs", "tls")
o:depends("obfs", "http")
o:depends("obfs", "websocket")
o:depends("obfs_snell", "tls")
o:depends("obfs_snell", "http")
o = s:option(ListValue, "udp", translate("udp"))
o:value("true")
o:value("false")
o:depends("type", "ss")
o:depends("type", "ssr")
o:depends("type", "vmess")
o:depends("type", "socks5")
o:depends("type", "trojan")
o = s:option(ListValue, "tls_custom", translate("tls"))
o.default = "false"
o:value("true")
o:value("false")
o:depends("obfs", "websocket")
-- [[ WS部分 ]]--
-- WS路径
o = s:option(Value, "path", translate("Path"))
o.rmempty = true
o:depends("obfs", "websocket")
o:depends("obfs_vmess", "websocket")
o = s:option(DynamicList, "http_path", translate("path"))
o.rmempty = true
o:value("/")
o:value("/video")
o:depends("obfs_vmess", "http")
o = s:option(Value, "custom", translate("headers"))
o.rmempty = true
o:depends("obfs", "websocket")
o:depends("obfs_vmess", "websocket")
o = s:option(Value, "keep_alive", translate("keep-alive"))
o.rmempty = true
o.default = "true"
o:value("true")
o:value("false")
o:depends("obfs_vmess", "http")
o = s:option(ListValue, "mux", translate("Mux"))
o.default = "false"
o:value("true")
o:value("false")
o:depends("obfs", "websocket")
-- AlterId
o = s:option(Value, "alterId", translate("AlterId"))
o.datatype = "port"
o.default = 32
o.rmempty = true
o:depends("type", "vmess")
-- VmessId
o = s:option(Value, "uuid", translate("VmessId (UUID)"))
o.rmempty = true
o.default = uuid
o:depends("type", "vmess")
-- 验证用户名
o = s:option(Value, "auth_name", translate("Auth Username"))
o:depends("type", "socks5")
o:depends("type", "http")
o.rmempty = true
-- 验证密码
o = s:option(Value, "auth_pass", translate("Auth Password"))
o:depends("type", "socks5")
o:depends("type", "http")
o.rmempty = true
-- [[ skip-cert-verify ]]--
o = s:option(ListValue, "skip_cert_verify", translate("Skip Cert Verify"))
o.rmempty = true
o.default = "false"
o:value("true")
o:value("false")
o:depends("obfs", "websocket")
o:depends("type", "vmess")
o:depends("type", "socks5")
o:depends("type", "http")
o:depends("obfs_vmess", "none")
o:depends("type", "trojan")
o:depends("obfs_vmess", "websocket")
-- [[ TLS ]]--
o = s:option(ListValue, "tls", translate("TLS"))
o.rmempty = true
o.default = "false"
o:value("true")
o:value("false")
o:depends("obfs", "websocket")
o:depends("obfs_vmess", "none")
o:depends("obfs_vmess", "websocket")
o:depends("obfs_vmess", "http")
o:depends("type", "socks5")
o:depends("type", "http")
o = s:option(Value, "servername", translate("Custom TLS Host"))
o.rmempty = true
o.placeholder = translate("example.com")
o:depends("obfs_vmess", "websocket")
-- [[ sni ]]--
o = s:option(Value, "sni", translate("sni"))
o.datatype = "host"
o.placeholder = translate("example.com")
o.rmempty = true
o:depends("type", "trojan")
-- [[ alpn ]]--
o = s:option(Flag, "alpn_h2", translate("alpn-h2"))
o:depends("type", "trojan")
o = s:option(Flag, "alpn_http", translate("alpn-http/1.1"))
o:depends("type", "trojan")
local apply = luci.http.formvalue("cbi.apply")
if apply then
m.uci:commit("clash")
end
return m
|
-----------------------------------
--
-- Zone: Grauberg_[S] (89)
--
-----------------------------------
local ID = require("scripts/zones/Grauberg_[S]/IDs")
require("scripts/globals/weather")
require("scripts/globals/status")
require("scripts/globals/helm")
-----------------------------------
function onInitialize(zone)
tpz.helm.initZone(zone, tpz.helm.type.HARVESTING)
end
function onZoneIn(player, prevZone)
local cs = -1
if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then
player:setPos(495.063, 69.903, 924.102, 23)
end
return cs
end
function onRegionEnter(player, region)
end
function onZoneWeatherChange(weather)
local npc = GetNPCByID(ID.npc.INDESCRIPT_MARKINGS)
if (weather == tpz.weather.WIND or weather == tpz.weather.GALES) then
npc:setStatus(tpz.status.NORMAL)
else
npc:setStatus(tpz.status.DISAPPEAR)
end
end
function onEventUpdate(player, csid, option)
end
function onEventFinish(player, csid, option)
end
|
--[[ Authors: The Big Bang Team
Project: Alohomora-3FA
date: 14/03/2018
Version: Alpha 1
Link: https://github.com/TheBigBangTeam/Alohomora-3FA
NodeMCU version: Lolin(v2)
--]]
--[[
Deve aspettare un ricezione in seriale della stringa contente l'rfid uid (è del tipo "'EE-EE-EE-EE'").
Presa la stringa, senza i delimitatori, la deve immagazzinare fino a fine iterazione ed immediatamente forwardare al server.
Attenderà dunque che si verifichi l'evento di ritorno, tramite http, del feedback rfid e time.
Ricevuto il feedback lo deve mandare ad Arduino stampando in seriale l'apposita stringa.
Ora Arduino risponderà, in seriale, la stringa per abilitare il tastierino numerico.
Deve quindi abilitare il tastierino numerico per l'inserimento da parte dell'utente e aspettare l'input.
Il pin deve essere immagazzinato fino a fine iterazione e subito forwardarlo al server insieme al precedente Rfid uid.
Attenderà dunque che si verifichi l'evento di ritorno, tramite http, del feedback rfid e pin.
Deve quindi inviare, in seriale, ad Arduino la stringa per far aprire la porta.
Alla fine dell'iterazione (sia se va a termine che no) cancellerà i dati rfid e Pin immagazzinati per questa iterazione.]]--
--]]
--[[
-- reference:
-- Lua-matrix-library --> https://github.com/rafacouto/lua-matrix-keypad
-- wifi code in init.lua --> https://nodemcu.readthedocs.io/en/master/en/upload/
--]]
--[[
Non si possono usare le 2 seriali in contemporanea. Ovvero la default(0) per il debug e la supplementare(1) per trasmettere.
Purtroppo il metodo uart.alt() non spegne la seriale che si stava utilizzando.
Per la trasmissione e ricezione in seriale bisogna usare le porte di default (0) ma viene trasmessa anche
la seguenza di boot. Per questo motivo si preferisce trasmettere con la seriale 1 e ricevere con la seriale default
dato che la seriale 1 non può ricevere ma solo trasmettere.
Utilizzare uart.alt(1) per cambiare la seriale che viene utilizzata di default, quindi posso utilizzare
uart.write(0, ...) per trasmettere sulla seriale 1. Poi dovrò riutilizzare uart.alt(0) per cambiare porta
e ricevere sulla seriale 0
esempio:
uart.alt(1)
uart.write(0, "CIAO MONDO\n")
uart.alt(0)
uart.on()
--]]
dofile("keypad.lua")
-- configuration
local KEYPAD_ROW_PINS = { 1, 2, 3, 4 }
local KEYPAD_COL_PINS = { 0, 5, 6 }
local KEYPAD_LABELS = "123456789*0#"
-- initialization
-- Keypad
local myKeypad = require "keypad"
myKeypad.init(KEYPAD_ROW_PINS, KEYPAD_COL_PINS, KEYPAD_LABELS)
-- setup
-- UART1 i.e. pin GPIO2
uart.setup(0, 115200, 8, uart.PARITY_NONE, uart.STOPBITS_1, 1)
uart.setup(1, 115200, 8, uart.PARITY_EVEN, uart.STOPBITS_1_5, 1)
---------------------------------------------------------------------------------------------------
local temp_rfid = ""
local temp_pin = ""
local arrived_rfid = false
local commandFromArduino = ""
local api_url = "http://192.168.43.143:3001"
local token = "eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1YTcyZTY3YjU5ZWEzZDIyNGYzY2MzNWYiLCJpYXQiOjE1MTc0ODAxOTgsImlzcyI6IlRoZUJpZ0JhbmdUZWFtIn0.Q9Zq0T6KN6NuUOJg-SxmecrfekWVf35zgfDhcAtBvAVrhAZifzxPllJaVuFEhwaZHb-8g6pQ5TP4zdj1sPk0oQ"
local response = {
[1] = "",
[2] = "<okrt>",
[3] = "<wrt>",
[4] = "pin_on",
[5] = "<okp>",
[6] = "<wp>",
[7] = "<err>"
}
print("The System is ready")
--[[
Questa funzione attende che si verifichi l'evento seriale(Presenza di tramissioni seriali in ingresso, RX).
Accetta solo stringhe formate nel modo: # stringa #. Scarta eventuali disturbi nella seriale.
In base alla stringa ricevuta interpresa se si tratta di un tag rfid, un feedback o un comando da eseguire.
Confronta la stringa
--]]
uart.on("data", "\n",
function(data)
if data ~= nil then
print ("receive from uart:" .. data .. "\r")
commandFromArduino = string.match(data, '#%s([%u%w%s%d%-%_]+)%s#')
if (commandFromArduino == nil) then
print ("Ci stanno Hackerando la seriale.. stacca, stacca")
else
-- qui va inserito qualcosa che previene il crash dato da nil risposto da match
print ("La stringa parsata e': " .. commandFromArduino)
print ("La lunghezza della stringa ricevuta e': " .. string.len(commandFromArduino))
-- and string.match(commandFromArduino, "%u%u%-%u%u%-%u%u%-%u%u")
if string.len(commandFromArduino) == 11 then
-- RFID: EE-EE-EE-EE
temp_rfid = commandFromArduino
arrived_rfid = true -- mi salvo il fatto che l'rfid è arrivato
print ("Invio rfid al server e lo salvo per il successivo invio")
SendRfidServer() -- invia rfid dati a http servet
elseif commandFromArduino == response[4] then
--accendi tastierino numerico
if (arrived_rfid == true) then
print "Accendo il tastierino numerico"
print "Finchè non passano 10 secondi o i numeri digitati non sono sufficenti(4), attendo il pin"
insertPin() -- lancio funzione per l'inserimento del pin
else
print ("Rfid is not arrived, please check")
writeToArduino(response[7])
end
else
print "The program has been terminated."
print "Data in Serial are wrong"
print "Program Reset"
writeToArduino(response[7])
end
end
else
print " Data is nil"
end
end, 0)
--[[
Questa funzione invia l'rfid al server per il controllo dell'utente che si vuole loggare.
In base alla risposta del server eseguo le diverse azioni.
Nel caso positivo invio ad Arduino questo feedback. Arduino rispondera con il consenso per accendere il keypad
--]]
function SendRfidServer()
req = api_url.."/api/authenticate/" .. temp_rfid
print ("Invio l'rfid: " .. temp_rfid .. " al server" .. api_url .. "")
http.get(req, "Authorization: Bearer " .. token .. "\r\n", function(code, data)
if (code < 0) then
print("HTTP request failed")
writeToArduino(response[7])
temp_rfid = ""
elseif (code == 200) then
print("HTTP request OK, status 200")
-- qui va chiamata la funzione che torna una stringa ad arduino
print("l'rfid è arrivato")
tmr.delay(1000000)
writeToArduino(response[2])
print("ok_rfid_or_time to Arduino")
elseif (code == 401) then
print("l'rfid non è autorizzato")
print("wrong_rfid_or_time to Arduino")
writeToArduino(response[3])
temp_rfid = ""
elseif (code == 404) then
print("l'rfid non esiste nel database")
print("wrong_rfid_or_time to Arduino")
writeToArduino(response[3])
temp_rfid = ""
else
print (string.format("HTTP request failed with error code "..code))
writeToArduino(response[3])
temp_rfid = ""
end
end)
end
--[[
Questa funzione rende possibile l'inserimento del pin nel Keypad.
Inserito il pin di 4 cifre, lo passa alla funzione sendPinServer().
Il timer permette di interrompere il processo di attessa pin dopo 10 secondi.
--]]
function insertPin ()
if (temp_rfid == "" and arrived_rfid == false) then
print " Non si può chiamare l'inserimento del pin se ancora non è transitato un rfid"
else
mytimer = tmr.create()
mytimer:register(10000, tmr.ALARM_SINGLE, function(t)
print("Tempo di inserimento PIN (10sec) terminato")
writeToArduino(response[6])
temp_rfid = ""
temp_pin = ""
t:unregister() end)
mytimer:start() -- lancio il timer che farà partire l'invio del pin al server
-- wait for keys
function processKey(key)
if key then
print(string.format("You have pressed '%s'", key))
temp_pin = tostring(temp_pin .. key)
if (string.len(temp_pin) == 4) then -- se la lunghezza del pin è 4 allora la lunghezza giusta ed esco
print "lunghezza pin raggiunta"
tmr.unregister(0)
mytimer:unregister()
sendPinServer()
end
myKeypad.waitForKey(0, processKey, 10, 200)
else
print("Timed out!\r\n")
end
end
print("Press keys or wait 10s...\r\n")
myKeypad.waitForKey(0, processKey, 10, 200)
end
end
--[[
Questa funzione invia rfid e pin al server per il controllo combinato finale.
In base alla risposta del server eseguo le diverse azioni. Nel caso positivo invio il consenso per l'apertura della porta
--]]
function sendPinServer()
req = api_url.."/api/authenticate/" .. temp_rfid .. "/" .. temp_pin
print("La richiesta alla API è: " .. req)
print("Invio rfid + pin al server\r\n")
print("Invio il pin: "..temp_pin.." al server: " .. api_url .. "\r")
http.get(req, "Authorization: Bearer " .. token .. "\r\n", function(code, data)
if (code < 0) then
print("HTTP pin request failed")
writeToArduino(response[7])
temp_rfid = ""
temp_pin = ""
elseif (code == 200) then
print("HTTP request OK, status 200")
print("ok_pin to arduino")
writeToArduino(response[5])
arrived_rfid = false
temp_rfid = ""
temp_pin = ""
elseif (code == 401) then
print("il pin non è autorizzato o errato")
print("wrong_pin to Arduino")
writeToArduino(response[6])
temp_rfid = ""
temp_pin = ""
else
print ("HTTP request failed with error code " .. code)
writeToArduino(response[6])
temp_rfid = ""
temp_pin = ""
end
end)
end
--[[
Questa funzione ci permette di scrivere(TX) in seriale ad Arduino.
Usiamo per prima cosa
--]]
function writeToArduino(dataToWrite)
uart.alt(1)
uart.write(0, dataToWrite .. "\r\n")
uart.alt(0)
end
|
local ngx = require('ngx')
local ngx_re = require('ngx.re')
local socks5 = {}
local char = string.char
-- magic numbers
local SOCKS5 = 0x05
local NUMBER_OF_AUTH_METHODS = 0x01
local NO_AUTHENTICATION = 0x00
local TCP_CONNECTION = 0x01
local RESERVED = 0x00
local IPv4 = 0x01
local DOMAIN_NAME = 0x03
local IPv6 = 0x04
local REQUEST_GRANTED = 0x00
local CONN_ERRORS = {
[0x01] = 'general failure',
[0x02] = 'connection not allowed by ruleset',
[0x03] = 'network unreachable',
[0x04] = 'host unreachable',
[0x05] = 'connection refused by destination host',
[0x06] = 'TTL expired',
[0x07] = 'command not supported / protocol error',
[0x08] = 'address type not supported',
}
local CHUNK_SIZE = 1024
-- authentication to socks5 server
socks5.auth = function(cosocket)
cosocket:send(char(SOCKS5, NUMBER_OF_AUTH_METHODS,
NO_AUTHENTICATION))
local auth_response = cosocket:receive(2)
if auth_response ~= char(SOCKS5, NO_AUTHENTICATION) then
return nil, "Socks5 authentification failed"
end
return true
end
-- connection request
socks5.connect = function(cosocket, host, port)
local host_length = #host
local port_big_endian = char(
math.floor(port / 256), port % 256)
cosocket:send(char(SOCKS5, TCP_CONNECTION, RESERVED,
DOMAIN_NAME, host_length) .. host .. port_big_endian)
local conn_response = cosocket:receive(3)
if conn_response ~=
char(SOCKS5, REQUEST_GRANTED, RESERVED) then
local status = conn_response:byte(2)
local message = CONN_ERRORS[status] or 'Unknown error'
return nil, message
end
-- pop address
local addr_type = cosocket:receive(1)
if addr_type == char(DOMAIN_NAME) then
local addr_length = addr_type:byte(1)
cosocket:receive(addr_length)
elseif addr_type == char(IPv4) then
cosocket:receive(4)
elseif addr_type == char(IPv6) then
cosocket:receive(16)
else
return nil, 'Bad address type: ' .. string.byte(addr_type)
end
-- pop port
cosocket:receive(2)
return true
end
socks5.connect_ip = function(cosocket, ip, port)
local host = ngx_re.split(ip, "\\.");
local host_length = #host
if (host_length ~= 4) then
return nil, 'Bad IP format'
end
local ip_encoded = char(tonumber(host[1]), tonumber(host[2]), tonumber(host[3]), tonumber(host[4]));
local port_big_endian = char(
math.floor(port / 256), port % 256)
cosocket:send(char(SOCKS5, TCP_CONNECTION, RESERVED,
IPv4) .. ip_encoded .. port_big_endian)
local conn_response = cosocket:receive(3)
if conn_response ~=
char(SOCKS5, REQUEST_GRANTED, RESERVED) then
local status = conn_response:byte(2)
local message = CONN_ERRORS[status] or 'Unknown error'
return nil, message
end
-- pop address
local addr_type = cosocket:receive(1)
if addr_type == char(DOMAIN_NAME) then
local addr_length = addr_type:byte(1)
cosocket:receive(addr_length)
elseif addr_type == char(IPv4) then
cosocket:receive(4)
elseif addr_type == char(IPv6) then
cosocket:receive(16)
else
return nil, 'Bad address type: ' .. string.byte(addr_type)
end
-- pop port
cosocket:receive(2)
return true
end
socks5.handle_request = function(socks5host, socks5port,
request_changer, response_changer, change_only_html)
local sosocket = ngx.socket.connect(socks5host, socks5port)
do
local status, message = socks5.auth(sosocket)
if not status then
ngx.say('Error: ' .. message)
return
end
end
local target_host = ngx.req.get_headers()['Host']
if request_changer then
target_host = request_changer(target_host)
end
local target_port = 80
do
local status, message = socks5.connect(sosocket,
target_host, target_port)
if not status then
ngx.say('Error: ' .. message)
return
end
end
-- read request
local clheader = ngx.req.raw_header()
if request_changer then
clheader = request_changer(clheader)
end
sosocket:send(clheader)
ngx.req.read_body()
local clbody = ngx.req.get_body_data()
if clbody then
if request_changer then
clbody = request_changer(clbody)
end
sosocket:send(clbody)
end
-- read response
local soheader, message =
sosocket:receiveuntil('\r\n\r\n')()
if not soheader then
ngx.say('No headers received from target: ' .. message)
return
end
local sobody_length = soheader:match(
'Content%-Length%: (%d+)')
local is_html = soheader:match('Content%-Type: text/html')
local change = is_html or not change_only_html
local clsocket = ngx.req.socket(true)
if response_changer and change then
-- read whole body
local sobody = sosocket:receive(sobody_length or '*a') or ''
sobody = response_changer(sobody)
soheader = response_changer(soheader)
if soheader:find('Content%-Length%:') then
soheader = soheader:gsub('Content%-Length%: %d+',
'Content-Length: ' .. #sobody)
else
soheader = soheader ..
'\r\nContent-Length: ' .. #sobody
end
clsocket:send(soheader .. '\r\n\r\n' .. sobody)
else
-- stream
clsocket:send(soheader .. '\r\n\r\n')
while true do
local sobody, _, partial = sosocket:receive(CHUNK_SIZE)
if not sobody then
clsocket:send(partial)
break
end
local bytes = clsocket:send(sobody)
if not bytes then
break
end
end
end
-- close
sosocket:close()
end
return socks5
|
-- NibUI->FormattedText
-- Cria um objeto de texto dentro
-- de uma bounding box em que
-- partes individuais podem receber
-- atributos diferentes
local FormattedText = {}
local DEFAULT_W = 320
local DEFAULT_H = 240
local CHAR_W = 8
local CHAR_H = 8
function FormattedText:new(x, y, w, h)
local instance = {
-- Bounding box
x = x or 0, y = y or 0,
w = w or DEFAULT_W,
h = h or DEFAULT_H,
-- Cursor (em caracteres)
cursor = 0,
cursor_x = x or 0,
cursor_y = y or 0,
-- Várias instâncias de DecoratedText
text = {}
}
lang.instanceof(instance, self)
return instance
end
function FormattedText:delete(n)
while n > 0 do
local deleted = self:tryDelete(n)
n -= deleted
self.cursor -= deleted
end
local last = self.text[#self.text]
self.cursor_x = last.x+#last.text*CHAR_W
self.cursor_y = last.y
end
function FormattedText:tryDelete(n)
local deleted = 0
local from = self.text[#self.text]
if n < #from.text then
from.text = from.text:sub(0, #from.text-n)
return n
else
table.remove(self.text, #self.text)
return #from.text
end
end
function FormattedText:newline()
self.cursor_x = self.x
self.cursor_y += CHAR_H
end
function FormattedText:add(text)
text.x, text.y = self.cursor_x, self.cursor_y
text.align = 0
local texts = self:advance_cursor(text)
for _, text in ipairs(texts) do
table.insert(self.text, text)
end
return self
end
function FormattedText:draw()
for t=1,#self.text do
self.text[t]:draw()
end
end
function FormattedText:advance_cursor(text)
local by = text.text
local texts = {}
self.cursor += #by
self.cursor_x += #by*CHAR_W
if self.cursor_x > self.x+self.w then
local overflow = (self.cursor_x-(self.x+self.w))/CHAR_W
self.cursor_x = self.x
self.cursor_y += CHAR_H
local before, after = text:sub(0, #by-overflow), text:sub(#by-overflow, #by)
after.x = self.cursor_x
after.y = self.cursor_y
table.insert(texts, before)
local nested_texts = self:advance_cursor(after)
for _, text in ipairs(nested_texts) do
table.insert(texts, text)
end
else
table.insert(texts, text)
end
return texts
end
return FormattedText
|
event_handlers={}
modlib.player.add_playerdata_function(function(playerdata)
playerdata.last_placed = modlib.minetest.get_gametime()
end)
modlib.player.set_property_default("required_cooldown", 0)
modlib.log.create_channel("place_limit")
local config = modlib.conf.import("place_limit", {
type="table",
children={
cooldown={
type="table",
children={
default={
type="number",
range={0}
},
by_name= {
type = "table",
keys = { type = "string" },
values = { type = "number", range = { 0 } }
},
by_group= {
type = "table",
keys = { type = "string" },
values = { type = "number", range = { 0 } }
}
}
}
}
})
modlib.table.add_all(getfenv(1), config)
function get_cooldown_by_name(nodename)
return cooldown.by_name[nodename]
end
function get_cooldown_by_group(groupname)
return cooldown.by_group[groupname]
end
function get_max_cooldown(nodename)
local cooldowns={}
cooldowns[1]=get_cooldown_by_name(nodename)
local groups=minetest.registered_nodes[nodename].groups
for groupname, groupvalue in pairs(groups) do
local group_cooldown=get_cooldown_by_group(groupname)
if group_cooldown then
table.insert(cooldowns, groupvalue*group_cooldown)
end
end
if modlib.table.is_empty(cooldowns) then
return cooldown.default
end
return modlib.table.max(cooldowns)
end
function register_on_placenode(callback)
assert(type(callback) == "function")
table.insert(event_handlers, callback)
return #table
end
function unregister_on_placenode(index)
assert(event_handlers[index])
event_handlers[index]=nil
end
minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing)
local name = placer:get_player_name()
if modlib.minetest.get_gametime() - modlib.player.get_property(name, "last_placed") < modlib.player.get_property(name, "required_cooldown") then
minetest.swap_node(pos, oldnode)
return true
end
modlib.player.set_property(name, "last_placed", modlib.minetest.get_gametime())
local required_cooldown_for_player=get_max_cooldown(newnode.name)
modlib.player.set_property(name, "required_cooldown",required_cooldown_for_player)
hud_timers.add_timer(name, {name="Place Limit", duration=required_cooldown_for_player})
for _, handler in pairs(event_handlers) do
handler(pos, newnode, placer, oldnode, itemstack, pointed_thing)
end
end)
|
local opts = {}
-- vim.keymap.set('n', 'gh', ":diffget //3<CR>", opts)
-- vim.keymap.set('n', 'gu', ":diffget //2<CR>", opts)
vim.keymap.set("n", "gs", ":G<CR>", opts)
|
-------------------------------
-- Skill: Tornado Kick
-- Class: H2H Weapon Skill
-- Level: 225
-- Mods : STR:37.5% VIT:30%
-- 100%TP 200%TP 300%TP
-- 2.0x 2.75x 3.5x
-- Delivers a twofold attack. Damage varies with TP.
-----------------------------------
require("scripts/globals/status")
require("scripts/globals/settings")
require("scripts/globals/weaponskills")
-----------------------------------
function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar)
local params = {}
-- number of normal hits for ws
params.numHits = 2
-- stat-modifiers (0.0 = 0%, 0.2 = 20%, 0.5 = 50%..etc)
params.str_wsc = 0.5 params.dex_wsc = 0.0
params.vit_wsc = 0.5 params.agi_wsc = 0.0
params.int_wsc = 0.0 params.mnd_wsc = 0.0
params.chr_wsc = 0.0
-- ftp damage mods (for Damage Varies with TP lines are calculated in the function ftp)
params.ftp100 = 2.0 params.ftp200 = 2.75 params.ftp300 = 3.5
-- critical modifiers (0.0 = 0%, 0.2 = 20%, 0.5 = 50%..etc)
params.crit100 = 0.0 params.crit200=0.0 params.crit300=0.0
params.canCrit = false
-- params.accuracy modifiers (0.0 = 0%, 0.2 = 20%, 0.5 = 50%..etc) Keep 0 if ws doesn't have accuracy modification.
params.acc100 = 0.0 params.acc200=0.0 params.acc300=0.0
-- attack multiplier (only some WSes use this, this varies the actual ratio value, see Tachi: Kasha) 1 is default.
params.atk100 = 1; params.atk200 = 1; params.atk300 = 1
params.kick = true -- https://www.bluegartr.com/threads/112776-Dev-Tracker-Findings-Posts-%28NO-DISCUSSION%29?p=6712150&viewfull=1#post6712150
if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then
params.ftp100 = 2.25 params.ftp200 = 4.25 params.ftp300 = 7.5
params.str_wsc = 0.4 params.dex_wsc = 0.4
params.atk100 = 1.5; params.atk200 = 1.5; params.atk300 = 1.5
end
local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, action, primary, taChar)
return tpHits, extraHits, criticalHit, damage
end
|
function love.conf(t)
BASE_SCREEN_W = 160
BASE_SCREEN_H = 120
GRAPHICS_SCALE = 6
t.window.width = BASE_SCREEN_W * GRAPHICS_SCALE
t.window.height = BASE_SCREEN_H * GRAPHICS_SCALE
t.window.title = 'kitty'
t.window.vsync = true
AXIS_DEADZONE = .2
-- Until I add in-game options to bind controller axes/buttons, the values
-- below can be changed to support joysticks that SDL2 doesn't
-- automatically recognize as a standardized Xbox 360-like "gamepad"
JOYSTICK_AXIS_MAP = {
leftx = 1,
lefty = 2,
}
JOYSTICK_BUTTON_MAP = {
a = 1,
b = 2,
start = 10,
back = 9
}
end
|
local S=minerdream.intllib
local has_value = basic_functions.has_value
local tier_cols={
col_num={"name"},}
local tier_definition = basic_functions.import_csv(minerdream.path.."/tiers.txt",tier_cols)
local tool_cols={
col_num={"range","uses"},
as_numeric=1,
}
local tool_definition = basic_functions.import_csv(minerdream.path.."/armor.txt",tool_cols)
for i,tdef in pairs(tool_definition) do
if (i ~= "default") then
local tooldef={}
for col in pairs(tdef) do
tooldef=basic_functions.parse_tree(tooldef,col,tdef[col])
end
if minerdream.itemdef[i]==nil then
minerdream.itemdef[i]={}
end
local tierd=tier_definition[tostring(tdef.tier)]
for _,tool in pairs({"helmet","chestplate","boots","leggings","shields"}) do
if tooldef[tool] ~= nil then
minerdream.itemdef[i][tool]=tooldef[tool]
local ttv=tooldef[tool]
tdesc=core.colorize("#"..tierd.color, S(i:gsub("^%l", string.upper)).." "..S(tool:gsub("^%l", string.upper)).."\n")..
core.colorize("#A0A0A0", "tier: "..tierd.name.." ("..tierd.desc..")")
if ttv.fleshy then
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Defense")..": "..ttv.fleshy)
end
if ttv.heal then
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Heal")..": "..ttv.heal)
end
if ttv.speed then
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Walking speed")..": "..(ttv.speed*100).."%")
end
if ttv.gravity then
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Gravity")..": "..(ttv.gravity*100).."%")
end
if ttv.jump then
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Jump force")..": "..(ttv.jump*100).."%")
end
tt_def={description=tdesc,
-- tt_def={description=i.." "..tool,
inventory_image=minerdream.modname.."_inv_"..tool.."_"..i..".png",
damage_groups = {level = ttv.level or 2},
armor_groups={fleshy=ttv.fleshy or 10},
groups={armor_heal=ttv.heal,armor_use=ttv.use,
physics_jump=ttv.jump,physics_speed=ttv.speed,physics_gravity=ttv.gravity}
}
for _,gc in pairs({"cracky","crumbly","choppy","snappy"}) do
tt_def.damage_groups[gc]=ttv[gc]
end
if tool == "helmet" then
tt_def.groups.armor_head=1
elseif tool == "chestplate" then
tt_def.groups.armor_torso=1
elseif tool == "leggings" then
tt_def.groups.armor_legs=1
elseif tool == "boots" then
tt_def.groups.armor_feet=1
elseif tool == "shields" then
tt_def.groups.armor_shield=1
end
toolname=minerdream.modname..":"..tool.."_"..i
armor:register_armor(toolname,tt_def)
end
end
end
end
|
-- see wireless jammer
local storage = minetest.get_mod_storage()
local jammers = moremesecons.load_MapDataStorage_legacy(storage, "jammers_v2",
"jammers")
local function update_mod_storage()
storage:set_string("jammers_v2", jammers:serialize())
end
local function add_jammer(pos)
if jammers:getAt(pos) then
return
end
jammers:setAt(pos, true)
update_mod_storage()
end
local function remove_jammer(pos)
jammers:removeAt(pos)
update_mod_storage()
end
local function is_jammed(pos)
local JAMMER_MAX_DISTANCE = moremesecons.setting("jammer", "max_distance", 10, 1)
local minp = vector.subtract(pos, JAMMER_MAX_DISTANCE)
local maxp = vector.add(pos, JAMMER_MAX_DISTANCE)
for p in jammers:iter(minp, maxp) do
local d = vector.subtract(pos, p)
if d.x ^ 2 + d.y ^ 2 + d.z ^ 2 <= JAMMER_MAX_DISTANCE^2 then
return true
end
end
return false
end
minetest.after(0, function() -- After loading all mods, override some functions
local jammed
local actual_node_get = mesecon.get_node_force
local function temp_node_get(pos, ...)
local node = actual_node_get(pos, ...)
if jammed == nil
and node then
jammed = is_jammed(pos)
end
return node
end
local actual_is_conductor_off = mesecon.is_conductor_off
local function temp_is_conductor_off(...)
if jammed then
-- go to the next elseif, there's is_effector
return
end
local v = actual_is_conductor_off(...)
if v then
-- it continues to the next frontier
jammed = nil
end
return v
end
local actual_is_effector = mesecon.is_effector
local function temp_is_effector(...)
local abort_here = jammed
-- the last elseif before continuing, jammed needs to be nil then
jammed = nil
if abort_here then
return
end
return actual_is_effector(...)
end
local actual_turnon = mesecon.turnon
function mesecon.turnon(...)
--set those to the temporary functions
mesecon.get_node_force = temp_node_get
mesecon.is_conductor_off = temp_is_conductor_off
mesecon.is_effector = temp_is_effector
actual_turnon(...)
mesecon.get_node_force = actual_node_get
mesecon.is_conductor_off = actual_is_conductor_off
mesecon.is_effector = actual_is_effector
-- safety
jammed = nil
end
end)
mesecon.register_node("moremesecons_jammer:jammer", {
description = "Mesecons Jammer",
paramtype = "light",
},{
tiles = {"moremesecons_jammer_off.png"},
groups = {dig_immediate=2},
mesecons = {effector = {
action_on = function(pos)
add_jammer(pos)
minetest.sound_play("moremesecons_jammer", {pos = pos})
minetest.swap_node(pos, {name="moremesecons_jammer:jammer_on"})
end
}},
},{
tiles = {"moremesecons_jammer_on.png"},
groups = {dig_immediate=2, not_in_creative_inventory=1},
mesecons = {effector = {
action_off = function(pos)
remove_jammer(pos)
minetest.swap_node(pos, {name="moremesecons_jammer:jammer_off"})
end
}},
on_destruct = remove_jammer,
on_construct = add_jammer,
})
minetest.register_craft({
output = "moremesecons_jammer:jammer_off",
recipe = {{"group:mesecon_conductor_craftable", "default:mese", "group:mesecon_conductor_craftable"},
{"", "moremesecons_wireless:jammer_off", ""}}
})
if moremesecons.setting("jammer", "enable_lbm", false) then
minetest.register_lbm({
name = "moremesecons_jammer:add_jammer",
nodenames = {"moremesecons_jammer:jammer_on"},
run_at_every_load = true,
action = add_jammer
})
end
|
--AttackFrame
----attack_Skill_2
return
{
filePath = "",
attackCheckType = "Box",
attackCheckVector = FixedVector3(0, 1048576, 4194304) --[[(0, 1, 4)]],
attackPriorityTarget = false,
attackRadius = Fixed64(4194304) --[[4]],
attackRangePosition = FixedVector3(0, 1048576, 4194304) --[[(0, 1, 4)]],
attackRangeTarget = false,
attackRangeRadius = Fixed64(4194304) --[[4]],
attackBallCenter = FixedVector3(0, 1048576, 0) --[[(0, 1, 0)]],
attackBallRadius = Fixed64(0) --[[0]],
attackRayStart = FixedVector3(0, 1048576, 0) --[[(0, 1, 0)]],
attackRayEnd = FixedVector3(0, 1048576, 3145728) --[[(0, 1, 3)]],
attackBoxCenter = FixedVector3(0, 1048576, 4718592) --[[(0, 1, 4.5)]],
attackBoxDirection = FixedVector3(0, 0, 1048576) --[[(0, 0, 1)]],
attackBoxSize = FixedVector3(1572864, 1048576, 8388608) --[[(1.5, 1, 8)]],
attackSectorPosition = FixedVector3(0, 1048576, 0) --[[(0, 1, 0)]],
attackSectorDirection = FixedVector3(0, 0, 1048576) --[[(0, 0, 1)]],
attackSectorRadius = Fixed64(8388608) --[[8]],
attackSectorAngle = Fixed64(62914560) --[[60]],
attackRingPosition = FixedVector3(0, 0, 0) --[[(0, 0, 0)]],
attackRingRadiusMax = Fixed64(0) --[[0]],
attackRingRadiusMin = Fixed64(0) --[[0]],
attackEffectPath = "",
attackDelayTime = Fixed64(0) --[[0]],
attackCheckTime = Fixed64(0) --[[0]],
debugPause = false,
warningTime = Fixed64(0) --[[0]],
beAttackedAction = "HitFly",
beAttackedActionAir = "AirHitFly",
beAttackedFlowUp = Fixed64(5767168) --[[5.5]],
beAttackedReset = true,
hitEffectPath = "Effect/H_Tokisaki_01/Tokisaki_attack_1_hit",
hitEffectBoneNog = "Center",
hitEffectGlobal = false,
hitEffectClear = false,
hitEffectLockRotation = false,
hitSoundPath = "",
freezeFrameDelay = Fixed64(0) --[[0]],
freezeFrameTarget = Fixed64(1048576) --[[1]],
freezeFrameSelf = Fixed64(3145728) --[[3]],
cameraEffectId = Fixed64(0) --[[0]],
}
|
--Begin supergrpup.lua
--Check members #Add supergroup
local function check_member_super(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
if success == 0 then
send_large_msg(receiver, "Promote me to admin first!")
end
for k,v in pairs(result) do
local member_id = v.peer_id
if member_id ~= our_id then
-- SuperGroup configuration
data[tostring(msg.to.id)] = {
group_type = 'SuperGroup',
long_id = msg.to.peer_id,
moderators = {},
set_owner = member_id ,
settings = {
set_name = string.gsub(msg.to.title, '_', ' '),
lock_arabic = 'no',
lock_link = "no",
flood = 'yes',
lock_spam = 'yes',
lock_sticker = 'no',
member = 'no',
public = 'no',
lock_rtl = 'no',
lock_contacts = 'no',
strict = 'no'
}
}
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = {}
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = msg.to.id
save_data(_config.moderation.data, data)
local text = 'تم ✅ تفعيل المجموعة 🔷✔️'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
return reply_msg(msg.id, text, ok_cb, false)
end
end
end
--Check Members #rem supergroup
local function check_member_superrem(cb_extra, success, result)
local receiver = cb_extra.receiver
local data = cb_extra.data
local msg = cb_extra.msg
for k,v in pairs(result) do
local member_id = v.id
if member_id ~= our_id then
-- Group configuration removal
data[tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local groups = 'groups'
if not data[tostring(groups)] then
data[tostring(groups)] = nil
save_data(_config.moderation.data, data)
end
data[tostring(groups)][tostring(msg.to.id)] = nil
save_data(_config.moderation.data, data)
local text = 'تم ✅ الغاء تفعيل المجموعة 🔷✔️'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
return reply_msg(msg.id, text, ok_cb, false)
end
end
end
--Function to Add supergroup
local function superadd(msg)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
channel_get_users(receiver, check_member_super,{receiver = receiver, data = data, msg = msg})
end
--Function to remove supergroup
local function superrem(msg)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
channel_get_users(receiver, check_member_superrem,{receiver = receiver, data = data, msg = msg})
end
--Get and output admins and bots in supergroup
local function callback(cb_extra, success, result)
local i = 1
local chat_name = string.gsub(cb_extra.msg.to.print_name, "_", " ")
local member_type = cb_extra.member_type
local text = member_type.." for "..chat_name..":\n"
for k,v in pairsByKeys(result) do
if not v.first_name then
name = " "
else
vname = v.first_name:gsub("", "")
name = vname:gsub("_", " ")
end
text = text.."\n"..i.." - "..name.."["..v.peer_id.."]"
i = i + 1
end
send_large_msg(cb_extra.receiver, text)
end
--Get and output info about supergroup
local function callback_info(cb_extra, success, result)
local title ="Info for SuperGroup: ["..result.title.."]\n\n"
local admin_num = "Admin count: "..result.admins_count.."\n"
local user_num = "User count: "..result.participants_count.."\n"
local kicked_num = "Kicked user count: "..result.kicked_count.."\n"
local channel_id = "ID: "..result.peer_id.."\n"
if result.username then
channel_username = "Username: @"..result.username
else
channel_username = ""
end
local text = title..admin_num..user_num..kicked_num..channel_id..channel_username
send_large_msg(cb_extra.receiver, text)
end
--Get and output members of supergroup
local function callback_who(cb_extra, success, result)
local text = "Members for "..cb_extra.receiver
local i = 1
for k,v in pairsByKeys(result) do
if not v.print_name then
name = " "
else
vname = v.print_name:gsub("", "")
name = vname:gsub("_", " ")
end
if v.username then
username = " @"..v.username
else
username = ""
end
text = text.."\n"..i.." - "..name.." "..username.." [ "..v.peer_id.." ]\n"
--text = text.."\n"..username
i = i + 1
end
local file = io.open("./groups/lists/supergroups/"..cb_extra.receiver..".txt", "w")
file:write(text)
file:flush()
file:close()
send_document(cb_extra.receiver,"./groups/lists/supergroups/"..cb_extra.receiver..".txt", ok_cb, false)
post_msg(cb_extra.receiver, text, ok_cb, false)
end
--Get and output list of kicked users for supergroup
local function callback_kicked(cb_extra, success, result)
--vardump(result)
local text = "Kicked Members for SuperGroup "..cb_extra.receiver.."\n\n"
local i = 1
for k,v in pairsByKeys(result) do
if not v.print_name then
name = " "
else
vname = v.print_name:gsub("", "")
name = vname:gsub("_", " ")
end
if v.username then
name = name.." @"..v.username
end
text = text.."\n"..i.." - "..name.." [ "..v.peer_id.." ]\n"
i = i + 1
end
local file = io.open("./groups/lists/supergroups/kicked/"..cb_extra.receiver..".txt", "w")
file:write(text)
file:flush()
file:close()
send_document(cb_extra.receiver,"./groups/lists/supergroups/kicked/"..cb_extra.receiver..".txt", ok_cb, false)
--send_large_msg(cb_extra.receiver, text)
end
--Begin supergroup locks
local function lock_group_links(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_link_lock = data[tostring(target)]['settings']['lock_link']
if group_link_lock == 'yes' then
local text = 'منع ❌ الاعلانات مفعل سابقا 🔒📱'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['lock_link'] = 'yes'
save_data(_config.moderation.data, data)
local text = 'تم ✅ تفعيل منع الاعلانات 🔒📱'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function unlock_group_links(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_link_lock = data[tostring(target)]['settings']['lock_link']
if group_link_lock == 'no' then
local text = 'منع ❌ الاعلانات غير مفعل 🔓📱'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['lock_link'] = 'no'
save_data(_config.moderation.data, data)
local text = 'تم ✅ الغاء تفعيل منع الاعلانات 🔓📱'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function lock_group_spam(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local reply_id = msg ['id']
if not is_owner(msg) then
local text = "للمدراء فقط 👤🍁"
reply_msg(reply_id, text, ok_cb, false)
end
local group_spam_lock = data[tostring(target)]['settings']['lock_spam']
if group_spam_lock == 'yes' then
local text = 'منع ❌ الكلايش مفعل سابقا 🔒📛'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['lock_spam'] = 'yes'
save_data(_config.moderation.data, data)
local text = 'تم ✅ تفعيل منع الكلايش 🔒📛'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function unlock_group_spam(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_spam_lock = data[tostring(target)]['settings']['lock_spam']
if group_spam_lock == 'no' then
local text = 'منع ❌ الكلايش غير مفعل 🔓📛 '..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['lock_spam'] = 'no'
save_data(_config.moderation.data, data)
local text = 'تم ✅ الغاء تفعيل منع الكلايش 🔓📛'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function lock_group_flood(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'yes' then
local text = 'منع ❌ التكرار مفعل سابقا 🔒📛'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['flood'] = 'yes'
save_data(_config.moderation.data, data)
local text = 'تم ✅ قفل التكرار 🔒📛'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function unlock_group_flood(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_flood_lock = data[tostring(target)]['settings']['flood']
if group_flood_lock == 'no' then
local text = 'منع ❌ التكرار غير مفعل 🔓📛'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['flood'] = 'no'
save_data(_config.moderation.data, data)
local text = 'تم ✅ الغاء تفعيل قفل التكرار 🔓📛'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function lock_group_arabic(msg, data, target)
if not is_momod(msg) then
return
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'yes' then
return 'Arabic is already locked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['lock_arabic'] = 'yes'
save_data(_config.moderation.data, data)
return 'Arabic has been locked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
local function unlock_group_arabic(msg, data, target)
if not is_momod(msg) then
return
end
local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic']
if group_arabic_lock == 'no' then
return 'Arabic/Persian is already unlocked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['lock_arabic'] = 'no'
save_data(_config.moderation.data, data)
return 'Arabic/Persian has been unlocked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
local function lock_group_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'yes' then
return 'SuperGroup members are already locked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['lock_member'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'SuperGroup members has been locked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
local function unlock_group_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_member_lock = data[tostring(target)]['settings']['lock_member']
if group_member_lock == 'no' then
return 'SuperGroup members are not locked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['lock_member'] = 'no'
save_data(_config.moderation.data, data)
return 'SuperGroup members has been unlocked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
local function lock_group_rtl(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl']
if group_rtl_lock == 'yes' then
local tex = 'منع ❌ الاشعارات مفعل سابقا 🔒📱'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['lock_rtl'] = 'yes'
save_data(_config.moderation.data, data)
local text = 'تم ✅ تفعيل منع الاشعارات 🔒📱'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function unlock_group_rtl(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl']
if group_rtl_lock == 'no' then
local text = 'منع ❌ الاشعارات غير مفعل 🔓📱'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['lock_rtl'] = 'no'
save_data(_config.moderation.data, data)
local text = 'تم ✅ الغاء تفعيل منع الاشعارات 🔓📱'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function lock_group_sticker(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker']
if group_sticker_lock == 'yes' then
local text = 'منع ❌ الملصقات مفعل سابقا 🔒🔆'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['lock_sticker'] = 'yes'
save_data(_config.moderation.data, data)
local text = 'تم ✅ تفعيل منع الملصقات 🔒🔆'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function unlock_group_sticker(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker']
if group_sticker_lock == 'no' then
local text = 'منع ❌ الملصقات غير مفعل 🔓🔆'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
data[tostring(target)]['settings']['lock_sticker'] = 'no'
save_data(_config.moderation.data, data)
local text = 'تم ✅ الغاء تفعيل منع الملصقات 🔓🔆'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local function lock_group_contacts(msg, data, target)
if not is_momod(msg) then
return
end
local group_rtl_lock = data[tostring(target)]['settings']['lock_contacts']
if group_contacts_lock == 'yes' then
return 'Contact posting is already locked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['lock_contacts'] = 'yes'
save_data(_config.moderation.data, data)
return 'Contact posting has been locked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
local function unlock_group_contacts(msg, data, target)
if not is_momod(msg) then
return
end
local group_contacts_lock = data[tostring(target)]['settings']['lock_contacts']
if group_contacts_lock == 'no' then
return 'Contact posting is already unlocked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['lock_contacts'] = 'no'
save_data(_config.moderation.data, data)
return 'Contact posting has been unlocked'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
local function enable_strict_rules(msg, data, target)
if not is_momod(msg) then
return
end
local group_strict_lock = data[tostring(target)]['settings']['strict']
if group_strict_lock == 'yes' then
return 'Settings are already strictly enforced'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['strict'] = 'yes'
save_data(_config.moderation.data, data)
return 'Settings will be strictly enforced'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
local function disable_strict_rules(msg, data, target)
if not is_momod(msg) then
return
end
local group_strict_lock = data[tostring(target)]['settings']['strict']
if group_strict_lock == 'no' then
return 'Settings are not strictly enforced'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['strict'] = 'no'
save_data(_config.moderation.data, data)
return 'Settings will not be strictly enforced'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
--End supergroup locks
--'Set supergroup rules' function
local function set_rulesmod(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
return
end
local data_cat = 'rules'
data[tostring(target)][data_cat] = rules
save_data(_config.moderation.data, data)
local text = 'تم اضافت قوانين للمجموعة 📋✅'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
--'Get supergroup rules' function
local function get_rules(msg, data)
local data_cat = 'rules'
if not data[tostring(msg.to.id)][data_cat] then
local text = 'ليس ❌ هناك قوانين في المجموعة 📋👥'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
local rules = data[tostring(msg.to.id)][data_cat]
local group_name = data[tostring(msg.to.id)]['settings']['set_name']
local rules = group_name..' rules:\n\n'..rules:gsub("/n", " ")
return rules
end
--Set supergroup to public or not public function
local function set_public_membermod(msg, data, target)
local reply_id = msg ['id']
if not is_momod(msg) then
local text = "انت لست ادمن 👤🍁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
local group_public_lock = data[tostring(target)]['settings']['public']
local long_id = data[tostring(target)]['long_id']
if not long_id then
data[tostring(target)]['long_id'] = msg.to.peer_id
save_data(_config.moderation.data, data)
end
if group_public_lock == 'yes' then
return 'Group is already public'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['public'] = 'yes'
save_data(_config.moderation.data, data)
end
return 'SuperGroup is now: public'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
local function unset_public_membermod(msg, data, target)
if not is_momod(msg) then
return
end
local group_public_lock = data[tostring(target)]['settings']['public']
local long_id = data[tostring(target)]['long_id']
if not long_id then
data[tostring(target)]['long_id'] = msg.to.peer_id
save_data(_config.moderation.data, data)
end
if group_public_lock == 'no' then
return 'Group is not public'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
else
data[tostring(target)]['settings']['public'] = 'no'
data[tostring(target)]['long_id'] = msg.to.long_id
save_data(_config.moderation.data, data)
return 'SuperGroup is now: not public'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
--Show supergroup settings; function
function show_supergroup_settingsmod(msg, target)
if not is_momod(msg) then
return
end
local data = load_data(_config.moderation.data)
if data[tostring(target)] then
if data[tostring(target)]['settings']['flood_msg_max'] then
NUM_MSG_MAX = tonumber(data[tostring(target)]['settings']['flood_msg_max'])
print('custom'..NUM_MSG_MAX)
else
NUM_MSG_MAX = 5
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['public'] then
data[tostring(target)]['settings']['public'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_rtl'] then
data[tostring(target)]['settings']['lock_rtl'] = 'no'
end
end
if data[tostring(target)]['settings'] then
if not data[tostring(target)]['settings']['lock_member'] then
data[tostring(target)]['settings']['lock_member'] = 'no'
end
end
local settings = data[tostring(target)]['settings']
local text = "SuperGroup settings:\n◼️Lock links : "..settings.lock_link.."\n◼️Lock flood: "..settings.flood.."\n◼️Flood sensitivity : "..NUM_MSG_MAX.."\n◼️Lock spam: "..settings.lock_spam.."\n◼️Lock Arabic: "..settings.lock_arabic.."\n◼️Lock Member: "..settings.lock_member.."\n◼️Lock RTL: "..settings.lock_rtl.."\n◼️Lock sticker: "..settings.lock_sticker.."\n◼️Public: "..settings.public.."\n◼️Strict settings: "..settings.strict
return text
end
local function promote_admin(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
local member_tag_username = string.gsub(member_username, '@', '(at)')
if not data[group] then
return
end
if data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_username..' العضو 👤 ادمن بل فعل 🔷🔕')
end
data[group]['moderators'][tostring(user_id)] = member_tag_username
save_data(_config.moderation.data, data)
end
local function demote_admin(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
if not data[group] then
return
end
if not data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_tag_username..'العضو 👤 ليس ادمن 🔷🔕')
end
data[group]['moderators'][tostring(user_id)] = nil
save_data(_config.moderation.data, data)
end
local function promote2(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
local member_tag_username = string.gsub(member_username, '@', '(at)')
if not data[group] then
return send_large_msg(receiver, 'Group is not added 🍁❌')
end
if data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_username..' العضو 👤 ادمن بل فعل 🔷🔕')
end
data[group]['moderators'][tostring(user_id)] = member_tag_username
save_data(_config.moderation.data, data)
send_large_msg(receiver, member_username..' العضو 👤 تم اضافته ادمن 🍁✔️')
end
local function demote2(receiver, member_username, user_id)
local data = load_data(_config.moderation.data)
local group = string.gsub(receiver, 'channel#id', '')
if not data[group] then
return send_large_msg(receiver, 'Group is not added 🍁❌')
end
if not data[group]['moderators'][tostring(user_id)] then
return send_large_msg(receiver, member_tag_username..' العضو 👤 ليس ادمن 🔷🔕')
end
data[group]['moderators'][tostring(user_id)] = nil
save_data(_config.moderation.data, data)
send_large_msg(receiver, member_username..' العضو 👤 تم ازالته من الادمنية 🔷✔')
end
local function modlist(msg)
local data = load_data(_config.moderation.data)
local groups = "groups"
if not data[tostring(groups)][tostring(msg.to.id)] then
return 'Group is not added 🍁❌'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
local reply_id = msg ['id']
-- determine if table is empty
if next(data[tostring(msg.to.id)]['moderators']) == nil then
local text = ' ليس ❌ هناك ادمنية في المجموعة 👤🔷'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
local i = 1
local message = '\nادمنية 👤 المجموعة 🔷✔ ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n'
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
message = message ..i..' - '..v..' [' ..k.. '] \n'
i = i + 1
end
return message
end
-- Start by reply actions
function get_message_callback(extra, success, result)
local get_cmd = extra.get_cmd
local msg = extra.msg
local data = load_data(_config.moderation.data)
local print_name = user_print_name(msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
if get_cmd == "id" and not result.action then
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id for: ["..result.from.peer_id.."]")
id1 = send_large_msg(channel, result.from.peer_id)
elseif get_cmd == 'id' and result.action then
local action = result.action.type
if action == 'chat_add_user' or action == 'chat_del_user' or action == 'chat_rename' or action == 'chat_change_photo' then
if result.action.user then
user_id = result.action.user.peer_id
else
user_id = result.peer_id
end
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id by service msg for: ["..user_id.."]")
id1 = send_large_msg(channel, user_id)
end
elseif get_cmd == "idfrom" then
local channel = 'channel#id'..result.to.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] obtained id for msg fwd from: ["..result.fwd_from.peer_id.."]")
id2 = send_large_msg(channel, result.fwd_from.peer_id)
elseif get_cmd == 'channel_block' and not result.action then
local member_id = result.from.peer_id
local channel_id = result.to.peer_id
if member_id == msg.from.id then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(msg.from.id) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/leader/admins")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
--savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..user_id.."] by reply")
kick_user(member_id, channel_id)
elseif get_cmd == 'channel_block' and result.action and result.action.type == 'chat_add_user' then
local user_id = result.action.user.peer_id
local channel_id = result.to.peer_id
if member_id == msg.from.id then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(msg.from.id) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/leader/admins")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..user_id.."] by reply to sev. msg.")
kick_user(user_id, channel_id)
elseif get_cmd == "del" then
delete_msg(result.id, ok_cb, false)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted a message by reply")
elseif get_cmd == "setadmin" then
local user_id = result.from.peer_id
local channel_id = "channel#id"..result.to.peer_id
channel_set_admin(channel_id, "user#id"..user_id, ok_cb, false)
if result.from.username then
text = "@"..result.from.username.." set as an admin"
else
text = "[ "..user_id.." ]set as an admin"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set: ["..user_id.."] as admin by reply")
send_large_msg(channel_id, text)
elseif get_cmd == "demoteadmin" then
local user_id = result.from.peer_id
local channel_id = "channel#id"..result.to.peer_id
if is_admin2(result.from.peer_id) then
return send_large_msg(channel_id, "You can't demote global admins!")
end
channel_demote(channel_id, "user#id"..user_id, ok_cb, false)
if result.from.username then
text = "@"..result.from.username.." has been demoted from admin"
else
text = "[ "..user_id.." ] has been demoted from admin"
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted: ["..user_id.."] from admin by reply")
send_large_msg(channel_id, text)
elseif get_cmd == "spromote" then
local group_owner = data[tostring(result.to.peer_id)]['set_owner']
if group_owner then
local channel_id = 'channel#id'..result.to.peer_id
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(channel_id, user, ok_cb, false)
end
local user_id = "user#id"..result.from.peer_id
channel_set_admin(channel_id, user_id, ok_cb, false)
data[tostring(result.to.peer_id)]['set_owner'] = tostring(result.from.peer_id)
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set: ["..result.from.peer_id.."] as owner by reply")
if result.from.username then
text = "@"..result.from.username.." [ "..result.from.peer_id.." ] العضو 👤 تمت ترقيته ليصبح مدير 🔷✔️"
else
text = "[ "..result.from.peer_id.." ] العضو 👤 تمت ترقيته ليصبح مدير 🔷✔️"
end
send_large_msg(channel_id, text)
end
elseif get_cmd == "promote" then
local receiver = result.to.peer_id
local full_name = (result.from.first_name or '')..' '..(result.from.last_name or '')
local member_name = full_name:gsub("", "")
local member_username = member_name:gsub("_", " ")
if result.from.username then
member_username = '@'.. result.from.username
end
local member_id = result.from.peer_id
if result.to.peer_type == 'channel' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted mod: @"..member_username.."["..result.from.peer_id.."] by reply")
promote2("channel#id"..result.to.peer_id, member_username, member_id)
--channel_set_mod(channel_id, user, ok_cb, false)
end
elseif get_cmd == "demote" then
local full_name = (result.from.first_name or '')..' '..(result.from.last_name or '')
local member_name = full_name:gsub("", "")
local member_username = member_name:gsub("_", " ")
if result.from.username then
member_username = '@'.. result.from.username
end
local member_id = result.from.peer_id
--local user = "user#id"..result.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted mod: @"..member_username.."["..user_id.."] by reply")
demote2("channel#id"..result.to.peer_id, member_username, member_id)
--channel_demote(channel_id, user, ok_cb, false)
elseif get_cmd == 'mute_user' then
if result.service then
local action = result.action.type
if action == 'chat_add_user' or action == 'chat_del_user' or action == 'chat_rename' or action == 'chat_change_photo' then
if result.action.user then
user_id = result.action.user.peer_id
end
end
if action == 'chat_add_user_link' then
if result.from then
user_id = result.from.peer_id
end
end
else
user_id = result.from.peer_id
end
local receiver = extra.receiver
local chat_id = msg.to.id
print(user_id)
print(chat_id)
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
send_large_msg(receiver, "["..user_id.."] removed from the muted user list")
elseif is_admin1(msg) then
mute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] added to the muted user list")
end
end
end
-- End by reply actions
--By ID actions
local function cb_user_info(extra, success, result)
local receiver = extra.receiver
local user_id = result.peer_id
local get_cmd = extra.get_cmd
local data = load_data(_config.moderation.data)
--[[if get_cmd == "setadmin" then
local user_id = "user#id"..result.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been set as an admin"
else
text = "[ "..result.peer_id.." ] has been set as an admin"
end
send_large_msg(receiver, text)]]
if get_cmd == "demoteadmin" then
if is_admin2(result.peer_id) then
return send_large_msg(receiver, "You can't demote global admins!")
end
local user_id = "user#id"..result.peer_id
channel_demote(receiver, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been demoted from admin"
send_large_msg(receiver, text)
else
text = "[ "..result.peer_id.." ] has been demoted from admin"
send_large_msg(receiver, text)
end
elseif get_cmd == "promote" then
if result.username then
member_username = "@"..result.username
else
member_username = string.gsub(result.print_name, '_', ' ')
end
promote2(receiver, member_username, user_id)
elseif get_cmd == "demote" then
if result.username then
member_username = "@"..result.username
else
member_username = string.gsub(result.print_name, '_', ' ')
end
demote2(receiver, member_username, user_id)
end
end
-- Begin resolve username actions
local function callbackres(extra, success, result)
local member_id = result.peer_id
local member_username = "@"..result.username
local get_cmd = extra.get_cmd
if get_cmd == "res" then
local user = result.peer_id
local name = string.gsub(result.print_name, "_", " ")
local channel = 'channel#id'..extra.channelid
send_large_msg(channel, user..'\n'..name)
return user
elseif get_cmd == "id" then
local user = result.peer_id
local channel = 'channel#id'..extra.channelid
send_large_msg(channel, user)
return user
elseif get_cmd == "invite" then
local receiver = extra.channel
local user_id = "user#id"..result.peer_id
channel_invite(receiver, user_id, ok_cb, false)
--[[elseif get_cmd == "channel_block" then
local user_id = result.peer_id
local channel_id = extra.channelid
local sender = extra.sender
if member_id == sender then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(member_id, channel_id) and not is_admin2(sender) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/owner/admins")
end
if is_admin2(member_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
kick_user(user_id, channel_id)
elseif get_cmd == "setadmin" then
local user_id = "user#id"..result.peer_id
local channel_id = extra.channel
channel_set_admin(channel_id, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been set as an admin"
send_large_msg(channel_id, text)
else
text = "@"..result.peer_id.." has been set as an admin"
send_large_msg(channel_id, text)
end
elseif get_cmd == "setowner" then
local receiver = extra.channel
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = extra.from_id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
local user = "user#id"..group_owner
if not is_admin2(group_owner) and not is_support(group_owner) then
channel_demote(receiver, user, ok_cb, false)
end
local user_id = "user#id"..result.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
data[tostring(channel)]['set_owner'] = tostring(result.peer_id)
save_data(_config.moderation.data, data)
savelog(channel, name_log.." ["..from_id.."] set ["..result.peer_id.."] as owner by username")
if result.username then
text = member_username.." [ "..result.peer_id.." ] added as owner"
else
text = "[ "..result.peer_id.." ] added as owner"
end
send_large_msg(receiver, text)
end]]
elseif get_cmd == "promote" then
local receiver = extra.channel
local user_id = result.peer_id
--local user = "user#id"..result.peer_id
promote2(receiver, member_username, user_id)
--channel_set_mod(receiver, user, ok_cb, false)
elseif get_cmd == "demote" then
local receiver = extra.channel
local user_id = result.peer_id
local user = "user#id"..result.peer_id
demote2(receiver, member_username, user_id)
elseif get_cmd == "demoteadmin" then
local user_id = "user#id"..result.peer_id
local channel_id = extra.channel
if is_admin2(result.peer_id) then
return send_large_msg(channel_id, "You can't demote global admins!")
end
channel_demote(channel_id, user_id, ok_cb, false)
if result.username then
text = "@"..result.username.." has been demoted from admin"
send_large_msg(channel_id, text)
else
text = "@"..result.peer_id.." has been demoted from admin"
send_large_msg(channel_id, text)
end
local receiver = extra.channel
local user_id = result.peer_id
demote_admin(receiver, member_username, user_id)
elseif get_cmd == 'mute_user' then
local user_id = result.peer_id
local receiver = extra.receiver
local chat_id = string.gsub(receiver, 'channel#id', '')
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] removed from muted user list")
elseif is_owner(extra.msg) then
mute_user(chat_id, user_id)
send_large_msg(receiver, " ["..user_id.."] added to muted user list")
end
end
end
--End resolve username actions
--Begin non-channel_invite username actions
local function in_channel_cb(cb_extra, success, result)
local get_cmd = cb_extra.get_cmd
local receiver = cb_extra.receiver
local msg = cb_extra.msg
local data = load_data(_config.moderation.data)
local print_name = user_print_name(cb_extra.msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
local member = cb_extra.username
local memberid = cb_extra.user_id
if member then
text = 'No user @'..member..' in this SuperGroup.'
else
text = 'No user ['..memberid..'] in this SuperGroup.'
end
if get_cmd == "channel_block" then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local user_id = v.peer_id
local channel_id = cb_extra.msg.to.id
local sender = cb_extra.msg.from.id
if user_id == sender then
return send_large_msg("channel#id"..channel_id, "Leave using kickme command")
end
if is_momod2(user_id, channel_id) and not is_admin2(sender) then
return send_large_msg("channel#id"..channel_id, "You can't kick mods/leader/admins")
end
if is_admin2(user_id) then
return send_large_msg("channel#id"..channel_id, "You can't kick other admins")
end
if v.username then
text = ""
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: @"..v.username.." ["..v.peer_id.."]")
else
text = ""
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: ["..v.peer_id.."]")
end
kick_user(user_id, channel_id)
end
end
elseif get_cmd == "setadmin" then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local user_id = "user#id"..v.peer_id
local channel_id = "channel#id"..cb_extra.msg.to.id
channel_set_admin(channel_id, user_id, ok_cb, false)
if v.username then
text = "@"..v.username.." ["..v.peer_id.."] has been set as an admin"
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin @"..v.username.." ["..v.peer_id.."]")
else
text = "["..v.peer_id.."] has been set as an admin"
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin "..v.peer_id)
end
if v.username then
member_username = "@"..v.username
else
member_username = string.gsub(v.print_name, '_', ' ')
end
local receiver = channel_id
local user_id = v.peer_id
promote_admin(receiver, member_username, user_id)
end
send_large_msg(channel_id, text)
end
elseif get_cmd == 'spromote' then
for k,v in pairs(result) do
vusername = v.username
vpeer_id = tostring(v.peer_id)
if vusername == member or vpeer_id == memberid then
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = cb_extra.msg.from.id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(receiver, user, ok_cb, false)
end
local user_id = "user#id"..v.peer_id
channel_set_admin(receiver, user_id, ok_cb, false)
data[tostring(channel)]['set_owner'] = tostring(v.peer_id)
save_data(_config.moderation.data, data)
savelog(channel, name_log.."["..from_id.."] set ["..v.peer_id.."] as owner by username")
if result.username then
text = member_username.." ["..v.peer_id.."] العضو 👤 تمت ترقيته ليصبح مدير 🔷✔️"
else
text = "["..v.peer_id.."] العضو 👤 تمت ترقيته ليصبح مدير 🔷✔️"
end
end
elseif memberid and vusername ~= member and vpeer_id ~= memberid then
local channel = string.gsub(receiver, 'channel#id', '')
local from_id = cb_extra.msg.from.id
local group_owner = data[tostring(channel)]['set_owner']
if group_owner then
if not is_admin2(tonumber(group_owner)) and not is_support(tonumber(group_owner)) then
local user = "user#id"..group_owner
channel_demote(receiver, user, ok_cb, false)
end
data[tostring(channel)]['set_owner'] = tostring(memberid)
save_data(_config.moderation.data, data)
savelog(channel, name_log.."["..from_id.."] set ["..memberid.."] as owner by username")
text = "["..memberid.."] العضو 👤 تمت ترقيته ليصبح مدير 🔷✔️"
end
end
end
end
send_large_msg(receiver, text)
end
--End non-channel_invite username actions
--'Set supergroup photo' function
local function set_supergroup_photo(msg, success, result)
local data = load_data(_config.moderation.data)
local receiver = get_receiver(msg)
if success then
local file = 'data/photos/channel_photo_'..msg.to.id..'.jpg'
print('File downloaded to:', result)
os.rename(result, file)
print('File moved to:', file)
channel_set_photo(receiver, file, ok_cb, false)
data[tostring(msg.to.id)]['settings']['set_photo'] = file
save_data(_config.moderation.data, data)
send_large_msg(receiver, 'تم ✔ حفض الصورة 🔷🍁', ok_cb, false)
else
print('Error downloading: '..msg.id)
send_large_msg(receiver, 'Failed, please try again!', ok_cb, false)
end
end
--Run function
local function run(msg, matches)
if msg.to.type == 'chat' then
if matches[1] == 'tosuper' then
if not is_admin1(msg) then
return
end
local receiver = get_receiver(msg)
chat_upgrade(receiver, ok_cb, false)
end
elseif msg.to.type == 'channel'then
if matches[1] == 'tosuper' then
if not is_admin1(msg) then
return
end
return "المجموعة خارقة بل فعل 🚀✔"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
end
end
if msg.to.type == 'channel' then
local support_id = msg.from.id
local receiver = get_receiver(msg)
local print_name = user_print_name(msg.from):gsub("", "")
local name_log = print_name:gsub("_", " ")
local data = load_data(_config.moderation.data)
if matches[1] == 'RealBot' and not matches[2] then
if not is_admin1(msg) and not is_support(support_id) then
return
end
if is_super_group(msg) then
return reply_msg(msg.id, 'المجموعة مفعلة سابقا 👥🍁', ok_cb, false)
end
print("SuperGroup "..msg.to.print_name.."("..msg.to.id..") added")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] added SuperGroup")
superadd(msg)
set_mutes(msg.to.id)
channel_set_admin(receiver, 'user#id'..msg.from.id, ok_cb, false)
end
if matches[1] == 'uRealBot' and is_admin1(msg) and not matches[2] then
if not is_super_group(msg) then
return reply_msg(msg.id, 'المجموعة 👥 غير مفعلة 🔕🍁', ok_cb, false)
end
print("SuperGroup "..msg.to.print_name.."("..msg.to.id..") removed")
superrem(msg)
rem_mutes(msg.to.id)
end
if matches[1] == "info" then
if not is_owner(msg) then
return
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup info")
channel_info(receiver, callback_info, {receiver = receiver, msg = msg})
end
if matches[1] == "admins" then
if not is_owner(msg) and not is_support(msg.from.id) then
return
end
member_type = 'Admins'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup Admins list")
admins = channel_get_admins(receiver,callback, {receiver = receiver, msg = msg, member_type = member_type})
end
local reply_id = msg ['id']
if matches[1] == "leader" then
local group_owner = data[tostring(msg.to.id)]['set_owner']
if not group_owner then
local text = "ليس هناك مدير في المجموعة 👤🍁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner")
local text = "مدير المجموعة 👤🍁 ["..group_owner..']'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if matches[1] == "modlist" then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist")
return modlist(msg)
-- channel_get_admins(receiver,callback, {receiver = receiver})
end
if matches[1] == "bots" and is_momod(msg) then
member_type = 'Bots'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup bots list")
channel_get_bots(receiver, callback, {receiver = receiver, msg = msg, member_type = member_type})
end
if matches[1] == "who" and not matches[2] and is_momod(msg) then
local user_id = msg.from.peer_id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup users list")
channel_get_users(receiver, callback_who, {receiver = receiver})
end
if matches[1] == "kicked" and is_momod(msg) then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested Kicked users list")
channel_get_kicked(receiver, callback_kicked, {receiver = receiver})
end
if matches[1] == 'del' and is_momod(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'del',
msg = msg
}
delete_msg(msg.id, ok_cb, false)
get_message(msg.reply_id, get_message_callback, cbreply_extra)
end
end
if matches[1] == 'block' and is_momod(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'channel_block',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'block' and string.match(matches[2], '^%d+$') then
--[[local user_id = matches[2]
local channel_id = msg.to.id
if is_momod2(user_id, channel_id) and not is_admin2(user_id) then
return send_large_msg(receiver, "You can't kick mods/owner/admins")
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: [ user#id"..user_id.." ]")
kick_user(user_id, channel_id)]]
local get_cmd = 'channel_block'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif msg.text:match("@[%a%d]") then
--[[local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'channel_block',
sender = msg.from.id
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] kicked: @"..username)
resolve_username(username, callbackres, cbres_extra)]]
local get_cmd = 'channel_block'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
if matches[1] == 'id' then
if type(msg.reply_id) ~= "nil" and is_momod(msg) and not matches[2] then
local cbreply_extra = {
get_cmd = 'id',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif type(msg.reply_id) ~= "nil" and matches[2] == "from" and is_momod(msg) then
local cbreply_extra = {
get_cmd = 'idfrom',
msg = msg
}
get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif msg.text:match("@[%a%d]") then
local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'id'
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested ID for: @"..username)
resolve_username(username, callbackres, cbres_extra)
else
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup ID")
return "SuperGroup ID for " ..string.gsub(msg.to.print_name, "_", " ").. ":\n\n"..msg.to.id
end
end
if matches[1] == 'kickme' then
if msg.to.type == 'channel' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] left via kickme")
channel_kick("channel#id"..msg.to.id, "user#id"..msg.from.id, ok_cb, false)
end
end
if matches[1] == 'relink' and is_momod(msg)then
local function callback_link (extra , success, result)
local receiver = get_receiver(msg)
if success == 0 then
send_large_msg(receiver, 'هاذه ليست احدى مجموعاتي 👥❌')
data[tostring(msg.to.id)]['settings']['set_link'] = nil
save_data(_config.moderation.data, data)
else
send_large_msg(receiver, "تم ✅ انشاء رابط جديد 🔷🍁")
data[tostring(msg.to.id)]['settings']['set_link'] = result
save_data(_config.moderation.data, data)
end
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] attempted to create a new SuperGroup link")
export_channel_link(receiver, callback_link, false)
end
local reply_id = msg ['id']
if matches[1] == 'setlink' and is_owner(msg) then
data[tostring(msg.to.id)]['settings']['set_link'] = 'waiting'
save_data(_config.moderation.data, data)
local text = 'قم بأرسال 📪 الرابط الان 👥🍁'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
local reply_id = msg ['id']
if msg.text then
if msg.text:match("^(https://telegram.me/joinchat/%S+)$") and data[tostring(msg.to.id)]['settings']['set_link'] == 'waiting' and is_owner(msg) then
data[tostring(msg.to.id)]['settings']['set_link'] = msg.text
save_data(_config.moderation.data, data)
local text = "تم ✅ وضع الرابط 🔷🔗"
reply_msg(reply_id, text, ok_cb, false)
end
end
local reply_id = msg ['id']
if matches[1] == 'getlink' then
if not is_momod(msg) then
return
end
local group_link = data[tostring(msg.to.id)]['settings']['set_link']
if not group_link then
local text = "قم بأنشاء 🔷 رابط اولا 🔕 من خلال الامر relink 🔗"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]")
local text = "رابط المجموعة 🔷🔗:\n"..group_link
reply_msg(reply_id, text, ok_cb, false)
end
if matches[1] == "invite" and is_sudo(msg) then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = "invite"
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] invited @"..username)
resolve_username(username, callbackres, cbres_extra)
end
if matches[1] == 'res' and is_owner(msg) then
local cbres_extra = {
channelid = msg.to.id,
get_cmd = 'res'
}
local username = matches[2]
local username = username:gsub("@","")
savelog(msg.to.id, name_log.." ["..msg.from.id.."] resolved username: @"..username)
resolve_username(username, callbackres, cbres_extra)
end
--[[if matches[1] == 'kick' and is_momod(msg) then
local receiver = channel..matches[3]
local user = "user#id"..matches[2]
chaannel_kick(receiver, user, ok_cb, false)
end]]
if matches[1] == 'setadmin' then
if not is_support(msg.from.id) and not is_owner(msg) then
return
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'setadmin',
msg = msg
}
setadmin = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'setadmin' and string.match(matches[2], '^%d+$') then
--[[] local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'setadmin'
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})]]
local get_cmd = 'setadmin'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif matches[1] == 'setadmin' and not string.match(matches[2], '^%d+$') then
--[[local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'setadmin'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set admin @"..username)
resolve_username(username, callbackres, cbres_extra)]]
local get_cmd = 'setadmin'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
if matches[1] == 'demoteadmin' then
if not is_support(msg.from.id) and not is_owner(msg) then
return
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'demoteadmin',
msg = msg
}
demoteadmin = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'demoteadmin' and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'demoteadmin'
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif matches[1] == 'demoteadmin' and not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'demoteadmin'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted admin @"..username)
resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == 'spromote' and is_owner(msg) then
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'spromote',
msg = msg
}
setowner = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'spromote' and string.match(matches[2], '^%d+$') then
--[[ local group_owner = data[tostring(msg.to.id)]['set_owner']
if group_owner then
local receiver = get_receiver(msg)
local user_id = "user#id"..group_owner
if not is_admin2(group_owner) and not is_support(group_owner) then
channel_demote(receiver, user_id, ok_cb, false)
end
local user = "user#id"..matches[2]
channel_set_admin(receiver, user, ok_cb, false)
data[tostring(msg.to.id)]['set_owner'] = tostring(matches[2])
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner")
local text = "[ "..matches[2].." ] added as owner"
return text
end]]
local get_cmd = 'spromote'
local msg = msg
local user_id = matches[2]
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, user_id=user_id})
elseif matches[1] == 'spromote' and not string.match(matches[2], '^%d+$') then
local get_cmd = 'spromote'
local msg = msg
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
channel_get_users (receiver, in_channel_cb, {get_cmd=get_cmd, receiver=receiver, msg=msg, username=username})
end
end
local reply_id = msg ['id']
if matches[1] == 'promote' then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
local text = "للمدراء فقط 👤🍁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'promote',
msg = msg
}
promote = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'promote' and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'promote'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted user#id"..matches[2])
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif matches[1] == 'promote' and not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'promote',
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] العضو 👤 تم اضافته ادمن 🍁✔️ @"..username)
return resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == 'mp' and is_sudo(msg) then
channel = get_receiver(msg)
user_id = 'user#id'..matches[2]
channel_set_mod(channel, user_id, ok_cb, false)
return "ok"
end
if matches[1] == 'md' and is_sudo(msg) then
channel = get_receiver(msg)
user_id = 'user#id'..matches[2]
channel_demote(channel, user_id, ok_cb, false)
return "ok"
end
local reply_id = msg ['id']
if matches[1] == 'demote' then
if not is_momod(msg) then
return
end
if not is_owner(msg) then
local msg = "للمدراء فقط 👤🍁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if type(msg.reply_id) ~= "nil" then
local cbreply_extra = {
get_cmd = 'demote',
msg = msg
}
demote = get_message(msg.reply_id, get_message_callback, cbreply_extra)
elseif matches[1] == 'demote' and string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local user_id = "user#id"..matches[2]
local get_cmd = 'demote'
savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted user#id"..matches[2])
user_info(user_id, cb_user_info, {receiver = receiver, get_cmd = get_cmd})
elseif not string.match(matches[2], '^%d+$') then
local cbres_extra = {
channel = get_receiver(msg),
get_cmd = 'demote'
}
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] العضو 👤 تم اضافته ادمن 🍁✔️ @"..username)
return resolve_username(username, callbackres, cbres_extra)
end
end
if matches[1] == "setname" and is_momod(msg) then
local receiver = get_receiver(msg)
local set_name = string.gsub(matches[2], '_', '')
savelog(msg.to.id, name_log.." ["..msg.from.id.."] renamed SuperGroup to: "..matches[2])
rename_channel(receiver, set_name, ok_cb, false)
end
if msg.service and msg.action.type == 'chat_rename' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] renamed SuperGroup to: "..msg.to.title)
data[tostring(msg.to.id)]['settings']['set_name'] = msg.to.title
save_data(_config.moderation.data, data)
end
local reply_id = msg ['id']
if matches[1] == "setabout" and is_momod(msg) then
local receiver = get_receiver(msg)
local about_text = matches[2]
local data_cat = 'description'
local target = msg.to.id
data[tostring(target)][data_cat] = about_text
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup description to: "..about_text)
channel_set_about(receiver, about_text, ok_cb, false)
local text = "تم ✅ اضافة وصف للمجموعة 📋👥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if matches[1] == "setusername" and is_admin1(msg) then
local function ok_username_cb (extra, success, result)
local receiver = extra.receiver
if success == 1 then
send_large_msg(receiver, "تم ✅ اضافة معرف للمجموعة 👥🍁")
elseif success == 0 then
send_large_msg(receiver, "فشل 🚫 اضافة المعرف للمجموعة 👥🍁")
end
end
local username = string.gsub(matches[2], '@', '')
channel_set_username(receiver, username, ok_username_cb, {receiver=receiver})
end
if matches[1] == 'setrules' and is_momod(msg) then
rules = matches[2]
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group rules to ["..matches[2].."]")
local text = set_rulesmod(msg, data, target)
reply_msg(reply_id, text, ok_cb, false)
end
if msg.media then
if msg.media.type == 'photo' and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_momod(msg) then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set new SuperGroup photo")
load_photo(msg.id, set_supergroup_photo, msg)
return
end
end
local reply_id = msg ['id']
if matches[1] == 'setphoto' and is_momod(msg) then
data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting'
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] started setting new SuperGroup photo")
local text = 'قم بأرسال 📪 الصورة الان 🎇✔'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if matches[1] == 'clean' then
if not is_momod(msg) then
return
end
if not is_momod(msg) then
local text = "للمدراء فقط 👤🍁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if matches[2] == 'modlist' then
local reply_id = msg ['id']
if next(data[tostring(msg.to.id)]['moderators']) == nil then
local text = 'ليس ❌ هناك ادمنية في المجموعة 👤🍁'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do
data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil
save_data(_config.moderation.data, data)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned modlist")
local text = 'تم ✅ حذف الادمنية 👤🔕'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
local reply_id = msg ['id']
if matches[2] == 'rules' then
local data_cat = 'rules'
if data[tostring(msg.to.id)][data_cat] == nil then
local text = "ليس ❌ هناك قوانين في المجموعة 👥📋"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned rules")
local text = 'تم ✅ حذف القوانين 📋✔'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
local reply_id = msg ['id']
if matches[2] == 'about' then
local receiver = get_receiver(msg)
local about_text = ' '
local data_cat = 'description'
if data[tostring(msg.to.id)][data_cat] == nil then
local text = 'ليس ❌ هناك وصف في المجموعة 👥🔕'..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
data[tostring(msg.to.id)][data_cat] = nil
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned about")
channel_set_about(receiver, about_text, ok_cb, false)
local text = "تم ✅ حذف الوصف 📋✔"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if matches[2] == 'mutelist' then
chat_id = msg.to.id
local hash = 'mute_user:'..chat_id
redis:del(hash)
local text = "تم ✅ ازالة الكتم عن المكتومين 👤🔕"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if matches[2] == 'username' and is_admin1(msg) then
local function ok_username_cb (extra, success, result)
local receiver = extra.receiver
if success == 1 then
send_large_msg(receiver, "تم ✅ حذف معرف المجموعة 👥✔")
elseif success == 0 then
send_large_msg(receiver, "فشل 🚫 ازالة معرف المجموعة 👥🔷")
end
end
local username = ""
channel_set_username(receiver, username, ok_username_cb, {receiver=receiver})
end
end
if matches[1] == 'close' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'links' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked link posting ")
return lock_group_links(msg, data, target)
end
if matches[2] == 'spam' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked spam ")
return lock_group_spam(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked flood ")
return lock_group_flood(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked arabic ")
return lock_group_arabic(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ")
return lock_group_membermod(msg, data, target)
end
if matches[2]:lower() == 'rtl' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked rtl chars. in names")
return lock_group_rtl(msg, data, target)
end
if matches[2] == 'sticker' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked sticker posting")
return lock_group_sticker(msg, data, target)
end
if matches[2] == 'contacts' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked contact posting")
return lock_group_contacts(msg, data, target)
end
if matches[2] == 'strict' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked enabled strict settings")
return enable_strict_rules(msg, data, target)
end
end
if matches[1] == 'open' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'links' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked link posting")
return unlock_group_links(msg, data, target)
end
if matches[2] == 'spam' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked spam")
return unlock_group_spam(msg, data, target)
end
if matches[2] == 'flood' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked flood")
return unlock_group_flood(msg, data, target)
end
if matches[2] == 'arabic' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked Arabic")
return unlock_group_arabic(msg, data, target)
end
if matches[2] == 'member' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked member ")
return unlock_group_membermod(msg, data, target)
end
if matches[2]:lower() == 'rtl' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked RTL chars. in names")
return unlock_group_rtl(msg, data, target)
end
if matches[2] == 'sticker' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked sticker posting")
return unlock_group_sticker(msg, data, target)
end
if matches[2] == 'contacts' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked contact posting")
return unlock_group_contacts(msg, data, target)
end
if matches[2] == 'strict' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked disabled strict settings")
return disable_strict_rules(msg, data, target)
end
end
if matches[1] == 'setflood' then
if not is_momod(msg) then
return
end
if tonumber(matches[2]) < 5 or tonumber(matches[2]) > 20 then
return "Wrong number,range is [5-20]"
end
local flood_max = matches[2]
data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max
save_data(_config.moderation.data, data)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set flood to ["..matches[2].."]")
local text = 'تم ✅ وضع التكرار للعدد 🔆📟: '..matches[2]..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
if matches[1] == 'public' and is_momod(msg) then
local target = msg.to.id
if matches[2] == 'yes' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public")
return set_public_membermod(msg, data, target)
end
if matches[2] == 'no' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: not public")
return unset_public_membermod(msg, data, target)
end
end
if matches[1] == 'close' and is_owner(msg) then
local chat_id = msg.to.id
local reply_id = msg ['id']
if matches[2] == 'audio' then
local msg_type = 'Audio'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
local text = " تم ✅ قفل الصوتيات 🔒📢"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الصوتيات مفعل سابقا 🔒📢"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local reply_id = msg ['id']
if matches[2] == 'photo' then
local msg_type = 'Photo'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
local text = " تم ✅ قفل الصور 🔒🎆"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الصور مفعل سابقا 🔒🌆"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'video' then
local msg_type = 'Video'
local reply_id = msg ['id']
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
local text = " تم ✅ قفل الفديوات 🔒🎥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الفديوات مفعل سابقا 🔒🎥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'gifs' then
local msg_type = 'Gifs'
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
local text = " تم ✅ قفل الصور المتحركة 🔒🌋"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الصور المتحركة غير مفعل 🔓🌆"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'documents' then
local msg_type = 'Documents'
local reply_id = msg ['id']
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
local text = " تم ✅ قفل الملفات 🔒📁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الملفات مفعل سابقا 🔒📁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'text' then
local msg_type = 'Text'
local reply_id = msg ['id']
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
local text = " تم ✅ قفل النص 🔒📝"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ النصوص مفعل سابقا 🔒📄"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'all' then
local msg_type = 'All'
local reply_id = msg ['id']
if not is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: mute "..msg_type)
mute(chat_id, msg_type)
local text = "تم ✅ قفل المحادثة 🔒👥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ المحادثة مفعل سابقا 🔒👥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
end
if matches[1] == 'open' and is_momod(msg) then
local chat_id = msg.to.id
if matches[2] == 'audio' then
local msg_type = 'Audio'
local reply_id = msg ['id']
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
local text = " تم ✅ الغاء تفعيل قفل الصوتيات 🔓📢"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الصوتيات غير مفعل 🔓📢"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
local reply_id = msg ['id']
if matches[2] == 'photo' then
local msg_type = 'Photo'
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
local text = " تم ✅ الغاء تفعيل قفل الصور 🔓🎇"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الصور غير مفعل 🔓🌆"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'video' then
local msg_type = 'Video'
local reply_id = msg ['id']
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
local text = " تم ✅ الغاء تفعيل قفل الفديوات 🔓🎥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الفديوات غير مفعل 🔓🎥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'gifs' then
local msg_type = 'Gifs'
local reply_id = msg ['id']
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
local text = "تم ✅ الغاء تفعيل منع الصور المتحركة 🔓🌆 "..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الصور المتحركة غير مفعل 🔓🌆"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'documents' then
local msg_type = 'Documents'
local reply_id = msg ['id']
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
local text = " تم ✅ الغاء تفعيل قفل الملفات 🔒📁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ الملفات غير مفعل 🔓📁"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'text' then
local msg_type = 'Text'
local reply_id = msg ['id']
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute message")
unmute(chat_id, msg_type)
local text = " تم ✅ الغاء قفل النص 🔓📝"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ النص غير مفعل 🔓📄"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
if matches[2] == 'all' then
local msg_type = 'All'
local reply_id = msg ['id']
if is_muted(chat_id, msg_type..': yes') then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] set SuperGroup to: unmute "..msg_type)
unmute(chat_id, msg_type)
local text = "تم ✅ الغاء قفل المحادثة 🔕👥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
else
local text = "منع ❌ المحادثة غير مفعل 🔓👥"..'\n\n'
..'🔶 MSG BY @'..msg.from.username..'\n'
reply_msg(reply_id, text, ok_cb, false)
end
end
end
if matches[1] == "silent" and is_momod(msg) then
local chat_id = msg.to.id
local hash = "mute_user"..chat_id
local user_id = ""
if type(msg.reply_id) ~= "nil" then
local receiver = get_receiver(msg)
local get_cmd = "mute_user"
muteuser = get_message(msg.reply_id, get_message_callback, {receiver = receiver, get_cmd = get_cmd, msg = msg})
elseif matches[1] == "silent" and string.match(matches[2], '^%d+$') then
local user_id = matches[2]
if is_muted_user(chat_id, user_id) then
unmute_user(chat_id, user_id)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] removed ["..user_id.."] from the muted users list")
return "["..user_id.."] removed from the muted users list"
elseif is_owner(msg) then
mute_user(chat_id, user_id)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] added ["..user_id.."] to the muted users list")
return "["..user_id.."] added to the muted user list"
end
elseif matches[1] == "silent" and not string.match(matches[2], '^%d+$') then
local receiver = get_receiver(msg)
local get_cmd = "mute_user"
local username = matches[2]
local username = string.gsub(matches[2], '@', '')
resolve_username(username, callbackres, {receiver = receiver, get_cmd = get_cmd, msg=msg})
end
end
if matches[1] == "muteslist" and is_momod(msg) then
local chat_id = msg.to.id
if not has_mutes(chat_id) then
set_mutes(chat_id)
return mutes_list(chat_id)
end
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup muteslist")
return mutes_list(chat_id)
end
if matches[1] == "mutelist" and is_momod(msg) then
local chat_id = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup mutelist")
return muted_user_list(chat_id)
end
if matches[1] == 'settings' and is_momod(msg) then
local target = msg.to.id
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested SuperGroup settings ")
return show_supergroup_settingsmod(msg, target)
end
if matches[1] == 'rules' then
savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules")
return get_rules(msg, data)
end
if matches[1] == 'helpppp' and not is_owner(msg) then
text = "Message /superhelp to @Teleseed in private for SuperGroup help"
reply_msg(msg.id, text, ok_cb, false)
elseif matches[1] == 'help' and is_owner(msg) then
local name_log = user_print_name(msg.from)
savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /superhelp")
return super_help()
end
if matches[1] == 'peer_id' and is_admin1(msg)then
text = msg.to.peer_id
reply_msg(msg.id, text, ok_cb, false)
post_large_msg(receiver, text)
end
if matches[1] == 'msg.to.id' and is_admin1(msg) then
text = msg.to.id
reply_msg(msg.id, text, ok_cb, false)
post_large_msg(receiver, text)
end
--Admin Join Service Message
if msg.service then
local action = msg.action.type
if action == 'chat_add_user_link' then
if is_owner2(msg.from.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.from.id
savelog(msg.to.id, name_log.." Admin ["..msg.from.id.."] joined the SuperGroup via link")
channel_set_admin(receiver, user, ok_cb, false)
end
if is_support(msg.from.id) and not is_owner2(msg.from.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.from.id
savelog(msg.to.id, name_log.." Support member ["..msg.from.id.."] joined the SuperGroup")
channel_set_mod(receiver, user, ok_cb, false)
end
end
if action == 'chat_add_user' then
if is_owner2(msg.action.user.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.action.user.id
savelog(msg.to.id, name_log.." Admin ["..msg.action.user.id.."] added to the SuperGroup by [ "..msg.from.id.." ]")
channel_set_admin(receiver, user, ok_cb, false)
end
if is_support(msg.action.user.id) and not is_owner2(msg.action.user.id) then
local receiver = get_receiver(msg)
local user = "user#id"..msg.action.user.id
savelog(msg.to.id, name_log.." Support member ["..msg.action.user.id.."] added to the SuperGroup by [ "..msg.from.id.." ]")
channel_set_mod(receiver, user, ok_cb, false)
end
end
end
if matches[1] == 'msg.to.peer_id' then
post_large_msg(receiver, msg.to.peer_id)
end
end
end
local function pre_process(msg)
if not msg.text and msg.media then
msg.text = '['..msg.media.type..']'
end
return msg
end
return {
patterns = {
"^/(RealBot)$",
"^/(uRealBot)$",
"^/([Mm]ove) (.*)$",
"^&([Ii]nfo)$",
"^/([Aa]dmins)$",
"^/([Ll]eader)$",
"^/([Mm]odlist)$",
"^/([Bb]ots)$",
"^/([Ww]ho)$",
"^/([Kk]icked)$",
"^([Bb]lock) (.*)",
"^/([Bb]lock)",
"^/([Tt]osuper)$",
"^&([Ii][Dd])$",
"^&([Ii][Dd]) (.*)$",
"^/([Kk]ickme)$",
"^/([Kk]ick) (.*)$",
"^/([Rr]elink)$",
"^/([Ss]etlink)$",
"^/([Gg]etlink)$",
"^/([Rr]es) (.*)$",
"^/([Ss]etadmin) (.*)$",
"^/([Ss]etadmin)",
"^/([Dd]emoteadmin) (.*)$",
"^/([Dd]emoteadmin)",
"^/([Ss]promote) (.*)$",
"^/([Ss]promote)$",
"^/([Pp]romote) (.*)$",
"^/([Pp]romote)",
"^/([Dd]emote) (.*)$",
"^/([Dd]emote)",
"^/([Ss]etname) (.*)$",
"^/([Ss]etabout) (.*)$",
"^/([Ss]etrules) (.*)$",
"^/([Ss]etphoto)$",
"^/([Ss]etusername) (.*)$",
"^/([Dd]el)$",
"^/(close) (.*)$",
"^/(open) (.*)$",
"^/(close) ([^%s]+)$",
"^/(open) ([^%s]+)$",
"^/(silent)$",
"^/(silent) (.*)$",
"^/([Pp]ublic) (.*)$",
"^/([Ss]ettings)$",
"^/([Rr]ules)$",
"^/([Ss]etflood) (%d+)$",
"^/([Cc]lean) (.*)$",
"^/([Hh])$",
"^/([Mm]uteslist)$",
"^/([Mm]utelist)$",
"(mp) (.*)",
"(md) (.*)",
"^(https://telegram.me/joinchat/%S+)$",
"msg.to.peer_id",
"%[(document)%]",
"%[(photo)%]",
"%[(video)%]",
"%[(audio)%]",
"%[(contact)%]",
"^!!tgservice (.+)$",
},
run = run,
pre_process = pre_process
}
--End supergrpup.lua
--By @Omar_Real
-- Reply By @Omar_Real
|
--This is an example of register_fetches which
--returns a string that is to be used by the
--config file with ACL.
function fetch_ex(txn)
local result = "/usr/sbin/"
return result
end
core.register_fetches("fetch_ex", fetch_ex)
|
-- Receive OSC events
function handle_message(path, args)
print("OSC path: " .. path .. " len: " .. #args .. " 1: " .. args[1])
end
function setup()
server = nosc_server_new(2222, handle_message)
end
function draw()
nosc_server_update(server)
ngl_clear(0.2, 0.2, 0.2, 1)
end
|
LEFT_CLICK = 1
RIGHT_CLICK = 2
BLOCK_SIZE = 16
EMPTY_ZERO = 0
EMPTY_ONE = 1
EMPTY_TWO = 2
EMPTY_THREE = 3
EMPTY_FOUR = 4
EMPTY_FIVE = 5
EMPTY_SIX = 6
EMPTY_SEVEN = 7
EMPTY_EIGHT = 8
MINE = 9
HIDDEN = 10
FLAG = 11
-- Generate mines on board
function setMines()
local remainingMines = config.mines
math.randomseed(os.time())
math.random(); math.random(); math.random()
while remainingMines > 0 do
local positionX, positionY = math.random(1, 10), math.random(1, 10)
if minefield[positionY][positionX][1] == HIDDEN then
minefield[positionY][positionX][1] = MINE
remainingMines = remainingMines - 1
end
end
end
-- Realocate mine to a valid position (left -> right, top -> bottom)
function realocateMine(x, y)
minefield[y][x][1] = HIDDEN
x = 1
y = 1
while minefield[y][x][1] == MINE do
x = x + 1
if x > config.boardWidth then
x = 1
y = y + 1
end
if y > config.boardHeight then
print("Could not realocate mine...")
return
end
end
minefield[y][x][1] = MINE
end
-- Load a non-mine block (and its neighbouring blocks in case there are no mines surrounding it)
function loadBlock(x, y)
local mineCount = 0
remainingBlocks = remainingBlocks - 1
for i = -1, 1 do
for j = -1, 1 do
local positionX, positionY = x + j, y + i
local block = minefield[positionY] and minefield[positionY][positionX] or nil
if block and block[1] == MINE then
mineCount = mineCount + 1
end
end
end
minefield[y][x][1] = mineCount
if mineCount == 0 then
floodFill(x, y)
end
end
-- Load neighbouring blocks
function floodFill(x, y)
for i = -1, 1 do
for j = -1, 1 do
local positionX, positionY = x + j, y + i
local block = minefield[positionY] and minefield[positionY][positionX] or nil
if block and block[1] == HIDDEN and not block[2] then
loadBlock(positionX, positionY)
end
end
end
end
-- Get x, y coordinates in hypothetical board based on window coordinates
function getEquivalentPosition(x, y)
return math.ceil(x / blockScaledSize), math.ceil((y - config.boardY) / blockScaledSize)
end
|
--------------------------------------------------------------------------------
-- frame.lua
-- a custom window like object
--------------------------------------------------------------------------------
local AddonName, Addon = ...
local Frame = Addon:CreateClass('Frame')
local L = LibStub('AceLocale-3.0'):GetLocale(AddonName)
local FlyPaper = LibStub('LibFlyPaper-2.0')
local function fireBarCallback(bar, callback, ...)
Addon.callbacks:Fire(callback, bar, bar.id, ...)
end
local active = {}
local unused = {}
local function frame_OnSetAlpha(frame, alpha)
frame:OnSetAlpha(alpha)
end
local function frame_OnSetScale(frame, scale)
frame:OnSetScale(scale)
end
local frame_UpdateShown = [[
if self:GetAttribute("state-hidden") then
self:Hide()
return
end
local isPetBattleUIShown = self:GetAttribute('state-petbattleui') and true or false
if isPetBattleUIShown and not self:GetAttribute('state-showinpetbattleui') then
self:Hide()
return
end
local isOverrideUIShown = self:GetAttribute('state-overrideui') and true or false
if isOverrideUIShown and not self:GetAttribute('state-showinoverrideui') then
self:Hide()
return
end
local requiredState = self:GetAttribute('state-display')
if requiredState == 'hide' then
self:Hide()
return
end
local userState = self:GetAttribute('state-userDisplay')
if userState == 'hide' then
if self:GetAttribute('state-alpha') then
self:SetAttribute('state-alpha', nil)
end
self:Hide()
return
end
local userAlpha = tonumber(userState)
if self:GetAttribute('state-alpha') ~= userAlpha then
self:SetAttribute('state-alpha', userAlpha)
end
self:Show()
]]
local frame_CallUpdateShown = 'self:RunAttribute("UpdateShown")'
--------------------------------------------------------------------------------
-- Constructor / Destructor
--------------------------------------------------------------------------------
-- constructor
function Frame:New(id)
id = tonumber(id) or id
local frame = self:Restore(id) or self:Create(id)
frame:LoadSettings()
Addon.OverrideController:Add(frame)
frame:OnAcquire(id)
FlyPaper.AddFrame(AddonName, id, frame)
active[id] = frame
return frame
end
function Frame:Create(id)
local frameName = ('%sFrame%s'):format(AddonName, id)
local frame = self:Bind(CreateFrame('Frame', frameName, UIParent, 'SecureHandlerStateTemplate'))
frame:SetClampedToScreen(true)
frame:SetMovable(true)
frame.id = id
frame:SetAttribute('id', id)
frame:SetAttribute('_onstate-alpha', "self:CallMethod('FadeOut')")
frame:SetAttribute('_onstate-display', frame_CallUpdateShown)
frame:SetAttribute('_onstate-hidden', frame_CallUpdateShown)
frame:SetAttribute('_onstate-overrideui', frame_CallUpdateShown)
frame:SetAttribute('_onstate-petbattleui', frame_CallUpdateShown)
frame:SetAttribute('_onstate-showinoverrideui', frame_CallUpdateShown)
frame:SetAttribute('_onstate-showinpetbattleui', frame_CallUpdateShown)
frame:SetAttribute('_onstate-userDisplay', frame_CallUpdateShown)
frame:SetAttribute('UpdateShown', frame_UpdateShown)
hooksecurefunc(frame, 'SetAlpha', frame_OnSetAlpha)
hooksecurefunc(frame, 'SetScale', frame_OnSetScale)
frame:OnCreate(id)
return frame
end
function Frame:Restore(id)
local frame = unused[id]
if frame then
unused[id] = nil
frame:OnRestore(id)
return frame
end
end
-- destructor
function Frame:Free(deleteSettings)
active[self.id] = nil
UnregisterStateDriver(self, 'display', 'show')
Addon.FadeManager:Remove(self)
Addon.OverrideController:Remove(self)
FlyPaper.RemoveFrame(AddonName, self.id, self)
self:ClearAllPoints()
self:SetUserPlaced(nil)
self:Hide()
self:OnRelease(self.id, deleteSettings)
unused[self.id] = self
end
--------------------------------------------------------------------------------
-- Lifecycle Hooks/Events
--------------------------------------------------------------------------------
-- called when a frame is acquired from the pool
function Frame:OnAcquire(id)
if self.OnEnable then
Addon:Printf('Bar %q called deprecated method OnEnable', id)
self:OnEnable()
end
end
-- called when a frame is first created
function Frame:OnCreate(id)
end
-- called when a frame is pulled in from the inactive pool
function Frame:OnRestore(id)
end
-- called when a frame is sent to the inactive pool
function Frame:OnRelease(id, deleteSettings)
if self.OnFree then
Addon:Printf('Bar %q called deprecated method OnFree', id)
self:OnFree()
end
end
function Frame:OnLoadSettings()
end
function Frame:OnSetAlpha(newAlpha)
end
function Frame:OnSetScale(newScale)
end
--------------------------------------------------------------------------------
-- Initialization
--------------------------------------------------------------------------------
function Frame:LoadSettings()
-- get defaults must be provided by anything implementing the Frame type
self.sets = Addon:GetFrameSets(self.id)
or Addon:SetFrameSets(self.id, self:GetDefaults())
self:UpdateDisplayLayer()
self:UpdateDisplayLevel()
self:RestorePosition()
self:RestoreAnchor()
if self.sets.hidden then
self:HideFrame()
else
self:ShowFrame()
end
self:UpdateDisplayConditions()
self:UpdateUserDisplayConditions()
self:ShowInOverrideUI(self:ShowingInOverrideUI())
self:ShowInPetBattleUI(self:ShowingInPetBattleUI())
self:OnLoadSettings()
end
--------------------------------------------------------------------------------
-- Layout
--------------------------------------------------------------------------------
function Frame:Layout()
local width, height = 32, 32
local paddingW, paddingH = self:GetPadding()
self:TrySetSize(width + paddingW * 2, height + paddingH * 2)
end
function Frame:TrySetSize(width, height)
if not _G.InCombatLockdown() then
self:SetSize(width, height)
return true
end
return false
end
--------------------------------------------------------------------------------
-- Padding
--------------------------------------------------------------------------------
function Frame:SetPadding(width, height)
width = tonumber(width) or 0
height = tonumber(height) or width
self.sets.padW = width ~= 0 and width or nil
self.sets.padH = height ~= 0 and height or nil
self:Layout()
end
function Frame:GetPadding()
local width = self.sets.padW or 0
local height = self.sets.padH or width
return width, height
end
--------------------------------------------------------------------------------
-- Scaling
--------------------------------------------------------------------------------
function Frame:SetFrameScale(newScale, scaleAnchored)
newScale = tonumber(newScale) or 1
self.sets.scale = newScale
FlyPaper.SetScale(self, newScale)
self:SaveRelativePostiion()
if scaleAnchored then
self:ForAnchored('SetFrameScale', newScale, scaleAnchored)
end
end
function Frame:GetFrameScale()
return self.sets.scale or 1
end
--------------------------------------------------------------------------------
-- Opacity
--------------------------------------------------------------------------------
function Frame:SetFrameAlpha(alpha)
if alpha == 1 then
self.sets.alpha = nil
else
self.sets.alpha = alpha
end
self:UpdateAlpha()
end
function Frame:GetFrameAlpha()
return self.sets.alpha or 1
end
--------------------------------------------------------------------------------
-- Faded Opacity
--------------------------------------------------------------------------------
-- faded opacity (mouse not over the frame)
function Frame:SetFadeMultiplier(alpha)
alpha = tonumber(alpha) or 1
if alpha == 1 then
self.sets.fadeAlpha = nil
else
self.sets.fadeAlpha = alpha
end
self:UpdateWatched()
self:UpdateAlpha()
end
function Frame:GetFadeMultiplier()
return self.sets.fadeAlpha or 1
end
--------------------------------------------------------------------------------
-- Fade In Timing
--------------------------------------------------------------------------------
function Frame:SetFadeInDelay(delay)
delay = tonumber(delay) or 0
self.sets.fadeInDelay = delay ~= 0 and delay
self:UpdateWatched()
end
function Frame:GetFadeInDelay()
return self.sets.fadeInDelay or 0
end
function Frame:SetFadeInDuration(duration)
duration = tonumber(duration) or 0.1
self.sets.fadeInDuration = duration ~= 0.1 and duration
self:UpdateWatched()
end
function Frame:GetFadeInDuration()
return self.sets.fadeInDuration or 0.1
end
--------------------------------------------------------------------------------
-- Fade Out Timing
--------------------------------------------------------------------------------
function Frame:SetFadeOutDelay(delay)
delay = tonumber(delay) or 0
self.sets.fadeOutDelay = delay ~= 0 and delay
self:UpdateWatched()
end
function Frame:GetFadeOutDelay()
return self.sets.fadeOutDelay or 0
end
function Frame:SetFadeOutDuration(duration)
duration = tonumber(duration) or 0.1
self.sets.fadeOutDuration = duration ~= 0.1 and duration
self:UpdateWatched()
end
function Frame:GetFadeOutDuration()
return self.sets.fadeOutDuration or 0.1
end
--------------------------------------------------------------------------------
-- Fade Out Timing
--------------------------------------------------------------------------------
function Frame:UpdateAlpha()
self:SetAlpha(self:GetExpectedAlpha())
if Addon:IsLinkedOpacityEnabled() then
self:ForAnchored('UpdateAlpha')
end
end
-- returns the opacity value we expect the frame to be at in its current state
function Frame:GetExpectedAlpha()
-- if this is a docked frame and linked opacity is enabled
-- then return the expected opacity of the parent frame
if Addon:IsLinkedOpacityEnabled() then
local anchor = self:GetSavedAnchor()
if anchor and type(anchor.GetExpectedAlpha) == "function" then
return anchor:GetExpectedAlpha()
end
end
-- if there's a statealpha value for the frame, then use it
local alpha = self:GetAttribute('state-alpha')
if alpha then
return alpha / 100
end
-- if the frame is moused over, then return the frame's normal opacity
if self:IsFocus() then
return self:GetFrameAlpha()
end
return self:GetFrameAlpha() * self:GetFadeMultiplier()
end
--------------------------------------------------------------------------------
-- Focus Checking
--------------------------------------------------------------------------------
local function IsAncestor(frame, target)
if frame == nil then
return false
end
if frame == target then
return true
end
return IsAncestor(frame:GetParent(), target)
end
-- returns all frames docked to the given frame
function Frame:IsFocus()
if self:IsMouseOver(1, -1, -1, 1) then
local focus = _G.GetMouseFocus()
if focus == _G.WorldFrame or IsAncestor(focus, self) then
return true
end
end
local flyout = _G.SpellFlyout
if flyout and flyout:IsVisible() and flyout:IsMouseOver(1, -1, -1, 1) then
IsAncestor(flyout, self)
return true
end
return Addon:IsLinkedOpacityEnabled() and self:IfAnchored('IsFocus')
end
--------------------------------------------------------------------------------
-- Fading
--------------------------------------------------------------------------------
function Frame:FadeIn()
self:Fade(self:GetExpectedAlpha(), self:GetFadeInDelay(), self:GetFadeInDuration())
end
function Frame:FadeOut()
self:Fade(self:GetExpectedAlpha(), self:GetFadeOutDelay(), self:GetFadeOutDuration())
end
function Frame:Fade(targetAlpha, delay, duration)
Addon:Fade(self, targetAlpha, delay, duration)
if Addon:IsLinkedOpacityEnabled() then
self:ForAnchored('Fade', targetAlpha, delay, duration)
end
end
--------------------------------------------------------------------------------
-- Frame Visibility
--------------------------------------------------------------------------------
function Frame:ShowFrame()
self.sets.hidden = nil
self:SetAttribute('state-hidden', nil)
self:UpdateWatched()
self:UpdateAlpha()
if Addon:IsLinkedOpacityEnabled() then
self:ForAnchored('ShowFrame')
end
end
function Frame:HideFrame()
self.sets.hidden = true
self:SetAttribute('state-hidden', true)
self:UpdateWatched()
self:UpdateAlpha()
if Addon:IsLinkedOpacityEnabled() then
self:ForAnchored('HideFrame')
end
end
function Frame:ToggleFrame()
if self:FrameIsShown() then
self:HideFrame()
else
self:ShowFrame()
end
end
function Frame:FrameIsShown()
return not self.sets.hidden
end
--------------------------------------------------------------------------------
-- Click Through
--------------------------------------------------------------------------------
function Frame:SetClickThrough(enable)
self.sets.clickThrough = enable and true or false
self:UpdateClickThrough()
end
function Frame:GetClickThrough()
return self.sets.clickThrough
end
function Frame:UpdateClickThrough()
end
--------------------------------------------------------------------------------
-- Display Conditions - Override UI
--------------------------------------------------------------------------------
function Frame:ShowInOverrideUI(enable)
self.sets.showInOverrideUI = enable and true or false
self:SetAttribute('state-showinoverrideui', enable)
end
function Frame:ShowingInOverrideUI()
return self.sets.showInOverrideUI
end
--------------------------------------------------------------------------------
-- Display Conditions - Pet Battle UI
--------------------------------------------------------------------------------
function Frame:ShowInPetBattleUI(enable)
self.sets.showInPetBattleUI = enable and true or false
self:SetAttribute('state-showinpetbattleui', enable)
end
function Frame:ShowingInPetBattleUI()
return self.sets.showInPetBattleUI
end
--------------------------------------------------------------------------------
-- Display Conditions
--------------------------------------------------------------------------------
function Frame:GetDisplayConditions() end
function Frame:UpdateDisplayConditions()
local conditions = self:GetDisplayConditions()
if conditions and conditions ~= '' then
RegisterStateDriver(self, 'display', conditions)
else
UnregisterStateDriver(self, 'display')
if self:GetAttribute('state-display') then
self:SetAttribute('state-display', nil)
end
end
end
--------------------------------------------------------------------------------
-- Display Conditions - User Set
--------------------------------------------------------------------------------
function Frame:SetUserDisplayConditions(states)
self.sets.showstates = states
self:UpdateUserDisplayConditions()
end
function Frame:GetUserDisplayConditions()
local states = self.sets.showstates
-- hack to convert [combat] into [combat]show;hide in case a user is using
-- the old style of showstates
if states then
if states:sub(#states) == ']' then
states = states .. 'show;hide'
self.sets.showstates = states
end
end
return states
end
function Frame:UpdateUserDisplayConditions()
local states = self:GetUserDisplayConditions()
if states and states ~= '' then
RegisterStateDriver(self, 'userDisplay', states)
else
UnregisterStateDriver(self, 'userDisplay')
if self:GetAttribute('state-userDisplay') then
self:SetAttribute('state-userDisplay', nil)
end
end
end
--------------------------------------------------------------------------------
-- Positioning
--------------------------------------------------------------------------------
function Frame:SavePosition(point, relPoint, x, y)
if point == nil then
error('Usage: Frame:SavePosition(point, [relPoint, x, y]', 2)
end
if relPoint == point then
relPoint = nil
end
if point == 'CENTER' then
point = nil
end
x = tonumber(x) or 0
if x == 0 then
x = nil
end
y = tonumber(y) or 0
if y == 0 then
y = nil
end
local sets = self.sets
sets.point = point
sets.relPoint = relPoint
sets.x = x
sets.y = y
end
function Frame:GetSavedPosition()
local sets = self.sets
local point = sets.point or 'CENTER'
local relPoint = sets.relPoint or point
local x = sets.x or 0
local y = sets.y or 0
return point, relPoint,x, y
end
function Frame:SaveRelativePostiion()
local point, relPoint, x, y = self:GetRelativePosition()
self:SavePosition(point, relPoint, x, y)
end
function Frame:GetRelativePosition()
local point, relPoint, x, y = FlyPaper.GetBestAnchorForParent(self)
return point, relPoint, x, y
end
function Frame:RestorePosition()
local point, relPoint, x, y = self:GetSavedPosition()
local scale = self:GetFrameScale()
self:ClearAllPoints()
self:SetScale(scale)
self:SetPoint(point, self:GetParent() or _G.UIParent, relPoint, x, y)
--adding this here, as it will be be called by all frames, and Tuller seems to be considering layering to be a form of position now. ~Goranaws
self:UpdateDisplayLevel()
return true
end
--------------------------------------------------------------------------------
-- Anchoring
--------------------------------------------------------------------------------
function Frame:SaveAnchor(relFrame, point, relPoint, x, y)
if relFrame == nil or point == nil then
error('Usage: Frame:SaveAnchor(relFrame, point, [relPoint, x, y]', 2)
end
if relFrame == self then
error('Cannot anchor to self', 2)
end
local relFrameGroup, relFrameId = FlyPaper.GetFrameInfo(relFrame)
if relFrame == nil then
error('Frame is not registered with FlyPaper', 2)
end
local anchor = self.sets.anchor
if not anchor or type(anchor) == "string" then
anchor = {}
self.sets.anchor = anchor
end
-- purge defaults
if relFrameGroup == AddonName then
relFrameGroup = nil
end
if relPoint == point then
relPoint = nil
end
x = tonumber(x) or 0
if x == 0 then
x = nil
end
y = tonumber(y) or 0
if y == 0 then
y = nil
end
anchor.point = point
anchor.relFrame = relFrameId
anchor.relFrameGroup = relFrameGroup
anchor.relPoint = relPoint
anchor.x = x
anchor.y = y
if not next(anchor) then
self.sets.anchor = nil
end
end
function Frame:GetSavedAnchor()
local anchor = self.sets and self.sets.anchor
if type(anchor) == 'table' then
local point = anchor.point
local relFrameId = anchor.relFrame
local relFrameGroup = anchor.relFrameGroup or AddonName
local relFrame = FlyPaper.GetFrame(relFrameGroup, relFrameId)
local relPoint = anchor.relPoint or point
local x = anchor.x or 0
local y = anchor.y or 0
return relFrame, point, relPoint, x, y
end
-- legacy string based format
if type(anchor) == 'string' then
local relFrame = Frame:Get(anchor:sub(1, #anchor - 2))
local point, relPoint = FlyPaper.ConvertAnchorId(anchor:sub(#anchor - 1))
local x = 0
local y = 0
return relFrame, point, relPoint, x, y
end
end
function Frame:ClearSavedAnchor()
self.sets.anchor = nil
end
function Frame:RestoreAnchor()
local relFrame, point, relPoint, x, y = self:GetSavedAnchor()
local scale = self:GetFrameScale() or 1
if relFrame then
self:ClearAllPoints()
self:SetScale(scale)
self:SetPoint(point, relFrame, relPoint, x, y)
self:UpdateAlpha()
return true
end
end
function Frame:ForAnchored(method, ...)
for _, frame in pairs(active) do
if frame:IsAnchoredToFrame(self) then
frame:MaybeCallMethod(method, ...)
end
end
end
function Frame:IfAnchored(method, ...)
for _, frame in pairs(active) do
if frame:IsAnchoredToFrame(self) then
if frame:MaybeCallMethod(method, ...) then
return true
end
end
end
return false
end
function Frame:IsAnchored()
if self:GetSavedAnchor() then
return true
end
return false
end
function Frame:IsAnchoredToFrame(frame)
if frame == nil or frame == self then
return false
end
for i = 1, self:GetNumPoints() do
local _, relFrame = self:GetPoint(i)
if frame == relFrame then
return true
end
end
return false
end
--------------------------------------------------------------------------------
-- Sticking/Snapping
--------------------------------------------------------------------------------
-- how far away a frame can be from another frame/edge to trigger anchoring
Frame.stickyTolerance = 8
function Frame:Stick()
-- only do sticky code if the alt key is not currently down
if Addon:Sticky() and not IsModifiedClick("DOMINOS_IGNORE_STICKY_FRAMES") then
if self:StickToFrame() or self:StickToGrid() or self:StickToEdge() then
return true
end
end
self:ClearSavedAnchor()
self:SaveRelativePostiion()
return false
end
-- bar anchoring
function Frame:StickToFrame()
local point, relFrame, relPoint = FlyPaper.GetBestAnchor(self, self.stickyTolerance)
if point then
self:ClearAllPoints()
self:SetPoint(point, relFrame, relPoint)
self:SaveAnchor(relFrame, point, relPoint)
self:SaveRelativePostiion()
return true
end
self:ClearSavedAnchor()
return false
end
-- grid anchoring
function Frame:StickToGrid()
if not Addon:GetAlignmentGridEnabled() then
return false
end
local xScale, yScale = Addon:GetAlignmentGridScale()
local point, relPoint, x, y = FlyPaper.GetBestAnchorForParentGrid(
self,
xScale,
yScale,
self.stickyTolerance
)
if point then
self:ClearAllPoints()
self:SetPoint(point, self:GetParent(), relPoint, x, y)
self:SaveRelativePostiion()
return true
end
return false
end
-- screen edge and center point anchoring
function Frame:StickToEdge()
local point, relPoint, x, y = FlyPaper.GetBestAnchorForParent(self)
local scale = self:GetScale()
if point then
local stick = false
if math.abs(x * scale) <= self.stickyTolerance then
x = 0
stick = true
end
if math.abs(y * scale) <= self.stickyTolerance then
y = 0
stick = true
end
if stick then
self:ClearAllPoints()
self:SetPoint(point, self:GetParent(), relPoint, x, y)
self:SaveRelativePostiion()
return true
end
end
return false
end
--------------------------------------------------------------------------------
-- Context Menus
--------------------------------------------------------------------------------
function Frame:CreateMenu()
local menu = Addon:NewMenu()
if menu then
self:OnCreateMenu(menu)
return menu
end
end
function Frame:OnCreateMenu(menu)
menu:AddBasicLayoutPanel()
menu:AddFadingPanel()
menu:AddAdvancedPanel(true)
end
function Frame:ShowMenu()
local menu = self.menu
if not menu then
menu = self:CreateMenu()
self.menu = menu
end
if menu then
menu:Hide()
menu:SetOwner(self)
menu:ShowPanel(LibStub('AceLocale-3.0'):GetLocale('Dominos-Config').Layout)
menu:Show()
end
end
--------------------------------------------------------------------------------
-- Display Information
--------------------------------------------------------------------------------
function Frame:GetDisplayName()
return L.BarDisplayName:format(tostring(self.id):gsub('^%l', string.upper))
end
function Frame:GetDescription()
return
end
function Frame:GetDisplayLayer()
return self.sets.displayLayer or 'MEDIUM'
end
function Frame:SetDisplayLayer(layer)
self.sets.displayLayer = layer
self:UpdateDisplayLayer()
end
function Frame:UpdateDisplayLayer()
local layer = self:GetDisplayLayer()
self:SetFrameStrata(layer)
fireBarCallback(self, 'BAR_DISPLAY_LAYER_UPDATED', layer)
end
function Frame:GetDisplayLevel()
return self.sets.displayLevel or 1
end
function Frame:SetDisplayLevel(level)
self.sets.displayLevel = tonumber(level) or 0
self:UpdateDisplayLevel()
end
function Frame:UpdateDisplayLevel()
local level = self:GetDisplayLevel()
self:SetFrameLevel(level)
fireBarCallback(self, 'BAR_DISPLAY_LEVEL_UPDATED', level)
end
--------------------------------------------------------------------------------
-- Mouseover
--------------------------------------------------------------------------------
function Frame:UpdateWatched()
local watch = self:FrameIsShown()
and self:GetFadeMultiplier() < 1
and not (Addon:IsLinkedOpacityEnabled() and self:IsAnchored())
if watch then
Addon.FadeManager:Add(self)
else
Addon.FadeManager:Remove(self)
end
end
--------------------------------------------------------------------------------
-- Metamethods
--------------------------------------------------------------------------------
function Frame:Get(id)
return active[tonumber(id) or id]
end
function Frame:GetAll()
return pairs(active)
end
function Frame:CallMethod(method, ...)
local func = self[method]
if type(func) == 'function' then
return func(self, ...)
else
error(('Frame %s does not have a method named %q'):format(self.id, method), 2)
end
end
function Frame:MaybeCallMethod(method, ...)
local func = self[method]
if type(func) == 'function' then
return func(self, ...)
end
end
function Frame:ForAll(method, ...)
for _, frame in self:GetAll() do
frame:MaybeCallMethod(method, ...)
end
end
-- takes a frameId, and performs the specified action on that frame
-- this adds two special ids: 'all' for all frames and '<number>-<number>' for
-- a range of IDs
function Frame:ForFrame(id, method, ...)
if id == 'all' then
self:ForAll(method, ...)
else
local startID, endID = tostring(id):match('(%d+)-(%d+)')
startID = tonumber(startID)
endID = tonumber(endID)
if startID and endID then
if startID > endID then
local t = startID
startID = endID
endID = t
end
for i = startID, endID do
local f = self:Get(i)
if f then
f:MaybeCallMethod(method, ...)
end
end
else
local f = self:Get(id)
if f then
f:MaybeCallMethod(method, ...)
end
end
end
end
-- exports
Addon.Frame = Frame
|
--[[
Adobe Experience Manager (AEM) API
Swagger AEM is an OpenAPI specification for Adobe Experience Manager (AEM) API
The version of the OpenAPI document: 3.5.0-pre.0
Contact: opensource@shinesolutions.com
Generated by: https://openapi-generator.tech
]]
-- saml_configuration_properties class
local saml_configuration_properties = {}
local saml_configuration_properties_mt = {
__name = "saml_configuration_properties";
__index = saml_configuration_properties;
}
local function cast_saml_configuration_properties(t)
return setmetatable(t, saml_configuration_properties_mt)
end
local function new_saml_configuration_properties(path, service_ranking, idp_url, idp_cert_alias, idp_http_redirect, service_provider_entity_id, assertion_consumer_service_url, sp_private_key_alias, key_store_password, default_redirect_url, user_id_attribute, use_encryption, create_user, add_group_memberships, group_membership_attribute, default_groups, name_id_format, synchronize_attributes, handle_logout, logout_url, clock_tolerance, digest_method, signature_method, user_intermediate_path)
return cast_saml_configuration_properties({
["path"] = path;
["service.ranking"] = service_ranking;
["idpUrl"] = idp_url;
["idpCertAlias"] = idp_cert_alias;
["idpHttpRedirect"] = idp_http_redirect;
["serviceProviderEntityId"] = service_provider_entity_id;
["assertionConsumerServiceURL"] = assertion_consumer_service_url;
["spPrivateKeyAlias"] = sp_private_key_alias;
["keyStorePassword"] = key_store_password;
["defaultRedirectUrl"] = default_redirect_url;
["userIDAttribute"] = user_id_attribute;
["useEncryption"] = use_encryption;
["createUser"] = create_user;
["addGroupMemberships"] = add_group_memberships;
["groupMembershipAttribute"] = group_membership_attribute;
["defaultGroups"] = default_groups;
["nameIdFormat"] = name_id_format;
["synchronizeAttributes"] = synchronize_attributes;
["handleLogout"] = handle_logout;
["logoutUrl"] = logout_url;
["clockTolerance"] = clock_tolerance;
["digestMethod"] = digest_method;
["signatureMethod"] = signature_method;
["userIntermediatePath"] = user_intermediate_path;
})
end
return {
cast = cast_saml_configuration_properties;
new = new_saml_configuration_properties;
}
|
local Modules = game:GetService("Players").LocalPlayer.PlayerGui.AvatarEditorInGame.Modules
local Rodux = require(Modules.Packages.Rodux)
local Toggle3DFullView = require(Modules.AvatarExperience.AvatarEditor.Actions.Toggle3DFullView)
return Rodux.createReducer(false, {
[Toggle3DFullView.name] = function(state, action)
return not state
end,
})
|
nx = 10
ny = 10
nc = nx*ny
nw = math.ceil(nc*0.15)
world = {}
for i=1,nx do
world[i] = {}
for j=1,ny do
world[i][j] = 0
end
end
math.randomseed(1)
k=0
for i=1,nx do
world[i] = {}
for j=1,ny do
r = math.random()
if r < nw/nc then
k=k+1
world[i][j] = 1
print("new world ", i, j, k)
end
end
end
|
-- taken from http://luaforge.net/projects/luacairo/
local cairo = require"lcairo"
local CAIRO = cairo
print(cairo.version_string())
local w = 320
local h = 240
--local outfile = 'cairo_test2.png'
local outfile = 'cairo_test3.pdf'
--local cs = cairo.image_surface_create(CAIRO.FORMAT_RGB24, w, h)
--local cs = cairo.pdf_surface_create(outfile, w, h)
local cs = cairo.PdfSurface(outfile, w, h)
local crlud = cairo.create(cs)
local cr = cairo.ContextFromLUD(crlud, true) -- give ownership
--local cr = cairo.ContextFromLUD(crlud) -- default is no ownership transfer
print(cr:version_string())
-- local dev = cairo.Device(cs)
-- print(dev)
-- print(dev:get_type())
cr:set_source_rgb(1, 1, 1)
cr:paint()
cr:set_source_rgb(0, 0, 0)
cr:select_font_face("Sans", CAIRO.FONT_SLANT_NORMAL, CAIRO.FONT_WEIGHT_BOLD)
cr:set_font_size(w/6)
cr:move_to(0, h/4)
cr:show_text("Hello cairo!")
cr:select_font_face("Sans", CAIRO.FONT_SLANT_NORMAL, CAIRO.FONT_WEIGHT_NORMAL)
cr:set_font_size(w/8)
cr:move_to(0, 3*h/4)
cr:text_path ("Lua calling...")
cr:set_source_rgb (0.5, 0.5, 1)
cr:fill_preserve ()
cr:set_source_rgb (0, 0, 0)
cr:set_line_width (w/200)
cr:stroke ()
--cairo.surface_write_to_png(cs, outfile)
--cr:destroy() -- is noop if ovnership was not transferred
cr:destroy() -- crash expected if ovnership transferred and above line uncommented
collectgarbage()
--cairo.destroy(cr) -- crash expected if ownership transferred
--cairo.surface_destroy(cs) -- not allowed if cs is userdata
cs:destroy()
|
---@class ChampionColor @enum
ChampionColor = {}
--- 33% more life, full heart
---
--- 0
ChampionColor.RED = 0
--- 33% faster, lil battery
---
--- 1
ChampionColor.YELLOW = 1
--- trail of green creep, pill
---
--- 2
ChampionColor.GREEN = 2
--- greed shot (drop coins when hit), 1-3 coins
---
--- 3
ChampionColor.ORANGE = 3
--- half speed, 3 blue flies
---
--- 4
ChampionColor.BLUE = 4
--- explodes on death, bomb
---
--- 5
ChampionColor.BLACK = 5
--- must be killed last, half eternal heart
---
--- 6
ChampionColor.WHITE = 6
--- 33% health half speed, key
---
--- 7
ChampionColor.GREY = 7
--- spectral, locked chest
---
--- 8
ChampionColor.TRANSPARENT = 8
--- partly invisible, red chest
---
--- 9
ChampionColor.FLICKER = 9
--- random shots, no drop
---
--- 10
ChampionColor.PINK = 10
--- pull player/tears, trinket
---
--- 11
ChampionColor.PURPLE = 11
--- regenerate, double heart
---
--- 12
ChampionColor.DARK_RED = 12
--- spread shot on death, half heart
---
--- 13
ChampionColor.LIGHT_BLUE = 13
--- camo kid like color, drops a rune when killed
---
--- 14
ChampionColor.CAMO = 14
--- when killed creates 2 mobs of same kind
---
--- 15
ChampionColor.PULSE_GREEN = 15
--- shots reflected while in gray state, drops random pickup
---
--- 16
ChampionColor.PULSE_GREY = 16
--- has halo of fly like shopkeeper, spawns 2 attack flies on death
---
--- 17
ChampionColor.FLY_PROTECTED = 17
--- 33% less hp, half size, speed +33%, 20% chance of small pill
---
--- 18
ChampionColor.TINY = 18
--- double size, 50% more hp, does 2 hearts of damage, 10% slower, 20% chance of large pill
---
--- 19
ChampionColor.GIANT = 19
--- heals all enemies in the room including himself by 30hp every second - spawns a red heart when killed
---
--- 20
ChampionColor.PULSE_RED = 20
--- spawns flies when hit, one attack fly for each time it takes damage - spawns 4-6 blue flies when killed
---
--- 21
ChampionColor.SIZE_PULSE = 21
--- turns all enemies in the room into yellow champions and has tripple HP - spawns 2-3 random pickups when killed
---
--- 22
ChampionColor.KING = 22
--- does 2 hearts of damage when touched - does death effect when killed
---
--- 23
ChampionColor.DEATH = 23
--- constantly poops
---
--- 24
ChampionColor.BROWN = 24
--- many champion effects combined, drops one of everything
---
--- 25
ChampionColor.RAINBOW = 25
return ChampionColor
|
local mod = get_mod("MutatorsSelector")
mod:hook(MutatorHandler, "init", function(func, self, mutators, ...) -- luacheck: no unused
mutators = {}
for mut_name, _ in pairs( MutatorTemplates ) do
if mod:get(mut_name) then
table.insert(mutators, mut_name)
end
end
pcall(func, self, mutators, ...)
end)
mod:hook(MutatorHandler, "activate_mutators", function(func, self)
if Managers.state.game_mode
and Managers.state.game_mode:level_key() == "inn_level"
then
return
end
return func(self)
end)
|
-- Licensed to the Apache Software Foundation (ASF) under one
-- or more contributor license agreements. See the NOTICE file
-- distributed with this work for additional information
-- regarding copyright ownership. The ASF licenses this file
-- to you under the Apache License, Version 2.0 (the
-- "License"); you may not use this file except in compliance
-- with the License. You may obtain a copy of the License at
-- http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing,
-- software distributed under the License is distributed on an
-- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-- KIND, either express or implied. See the License for the
-- specific language governing permissions and limitations
-- under the License.
package.path = package.path .. ";../?.lua"
package.cpath = package.cpath .. ";../thrift/lib/?.so"
require('busted')
require('thrift.TSocket')
require('thrift.THttpClient')
require('thrift.TBinaryProtocol')
require('thrift.test.ThriftTest')
require('thrift.test.ttypes')
require('liblualongnumber')
local inspect = require('inspect')
local client
function teardown()
if client then
-- Shuts down the server
client:testVoid()
-- close the connection
client:close()
end
end
function assertEqual(val1, val2, msg)
assert(val1 == val2, msg)
end
function testBasicClient()
local transport = TSocket:new{
port = 9090
}
--local transport = THttpClient:new{
--uri = "http://localhost:9090/"
--}
assert(transport, 'Failed to create client transport')
transport:setTimeout(5000)
local protocol = TBinaryProtocol:new{
trans = transport
}
assert(protocol, 'Failed to create binary protocol')
client = ThriftTestClient:new{
protocol = protocol
}
assert(client, 'Failed to create client')
-- Open the transport
local status, _ = pcall(transport.open, transport)
assert(status, 'Failed to connect to server')
-- String
assertEqual(client:testString('lala'), 'lala', 'Failed testString')
assertEqual(client:testString('wahoo'), 'wahoo', 'Failed testString')
-- Byte
assertEqual(client:testByte(0x01), 1, 'Failed testByte 1')
assertEqual(client:testByte(0x40), 64, 'Failed testByte 2')
assertEqual(client:testByte(0x7f), 127, 'Failed testByte 3')
assertEqual(client:testByte(0x80), -128, 'Failed testByte 4')
assertEqual(client:testByte(0xbf), -65, 'Failed testByte 5')
assertEqual(client:testByte(0xff), -1, 'Failed testByte 6')
assertEqual(client:testByte(128), -128, 'Failed testByte 7')
assertEqual(client:testByte(255), -1, 'Failed testByte 8')
-- I32
assertEqual(client:testI32(0x00000001), 1, 'Failed testI32 1')
assertEqual(client:testI32(0x40000000), 1073741824, 'Failed testI32 2')
assertEqual(client:testI32(0x7fffffff), 2147483647, 'Failed testI32 3')
assertEqual(client:testI32(0x80000000), -2147483648, 'Failed testI32 4')
assertEqual(client:testI32(0xbfffffff), -1073741825, 'Failed testI32 5')
assertEqual(client:testI32(0xffffffff), -1, 'Failed testI32 6')
assertEqual(client:testI32(2147483648), -2147483648, 'Failed testI32 7')
assertEqual(client:testI32(4294967295), -1, 'Failed testI32 8')
-- I64 (lua only supports 16 decimal precision so larger numbers are
-- initialized by their string value)
local long = liblualongnumber.new
assertEqual(client:testI64(long(0x0000000000000001)),
long(1),
'Failed testI64 1')
assertEqual(client:testI64(long(0x4000000000000000)),
long(4611686018427387904),
'Failed testI64 2')
assertEqual(client:testI64(long('0x7fffffffffffffff')),
long('9223372036854775807'),
'Failed testI64 3')
assertEqual(client:testI64(long(0x8000000000000000)),
long(-9223372036854775808),
'Failed testI64 4')
assertEqual(client:testI64(long('0xbfffffffffffffff')),
long('-4611686018427387905'),
'Failed testI64 5')
assertEqual(client:testI64(long('0xffffffffffffffff')),
long(-1),
'Failed testI64 6')
-- Double
assertEqual(
client:testDouble(1.23456789), 1.23456789, 'Failed testDouble 1')
assertEqual(
client:testDouble(0.123456789), 0.123456789, 'Failed testDouble 2')
assertEqual(
client:testDouble(0.123456789), 0.123456789, 'Failed testDouble 3')
-- Accuracy of 16 decimal digits (rounds)
local a, b = 1.12345678906666663, 1.12345678906666661
assertEqual(a, b)
assertEqual(client:testDouble(a), b, 'Failed testDouble 5')
-- Struct
local a = Xtruct:new{
string_thing = 'Zero',
byte_thing = 1,
i32_thing = -3,
i64_thing = long(-5)
}
--assert.are.same(client:testStruct(a), a)
-- Nest
local inner = Xtruct:new{
string_thing = 'Zero',
byte_thing = 1,
i32_thing = -3,
i64_thing = long(-5)
}
local a = Xtruct2:new{
struct_thing = inner,
byte_thing = 0,
i32_thing = 0
}
--assert.are.same(client:testNest(a), a)
-- Map
local a = {1, 2, 3, 4, -2}
--assert.are.same(client:testMap(a), a)
-- Set
local a = {
[8] = true,
[1] = true,
[42] = true
}
--assert.are.same(client:testSet(a), a)
-- List
local a = {1, 4, 9, -42}
--assert.are.same(client:testList(a), a)
-- Enum
local a = Numberz.FIVE
--assertEqual(client:testEnum(a), a, 'Failed testEnum')
-- Typedef
local a = 0xffffffffffffffff
--assertEqual(client:testTypedef(a), a, 'Failed testTypedef')
-- MapMap
local a = {
{10, 20},
{100, 200, 300},
{1000, 2000, 3000}
}
--assert.are.same(client:testMapMap(a), a)
-- Call the void function and end the test (handler stops server)
client:testVoid()
end
testBasicClient()
teardown()
|
--[[
Simple particle system
This one uses the mouse location as the origin of the system.
So, as you move the mouse around, the continuous stream of
particles will begin from wherever the mouse is currently located.
Makes for a nice 'streamer' effect.
]]
local ffi = require("ffi")
local stats = require("P5Status")()
-- A simple Particle class
local Particle = {}
setmetatable(Particle, {
__call = function(self, ...)
return self:new(...)
end;
})
local Particle_mt = {
__index = Particle;
}
function Particle.new(self, position)
local obj = {
acceleration = PVector(0, 0.08);
velocity = PVector(random(-1.0, 1.0), random(-2.0, 0));
position = PVector(position);
lifespan = 255;
}
setmetatable(obj, Particle_mt)
return obj;
end
function Particle.run(self)
self:update();
self:display();
end
-- Method to update position
function Particle.update(self)
self.velocity:add(self.acceleration);
self.position:add(self.velocity);
self.lifespan = self.lifespan - 2;
end
-- Method to display
function Particle.display(self)
if not self:isDead() then
stroke(200, self.lifespan);
--noStroke()
strokeWeight(2);
fill(127, self.lifespan);
ellipse(self.position.x, self.position.y, 12, 12);
end
end
-- Is the particle still useful?
function Particle.isDead(self)
return self.lifespan < 0;
end
-- Particle System
local ParticleSystem = {}
setmetatable(ParticleSystem, {
__call = function(self, ...)
return self:new(...)
end;
})
local ParticleSystem_mt = {
__index = ParticleSystem;
}
function ParticleSystem.new(self, position)
local obj = {
origin = position;
particles = {};
}
setmetatable(obj, ParticleSystem_mt)
return obj;
end
function ParticleSystem.addParticle(self)
table.insert(self.particles, Particle(self.origin));
end
function ParticleSystem.run(self)
for i = #self.particles, 1, -1 do
local p = self.particles[i];
p:run();
if (p:isDead()) then
table.remove(self.particles,1);
end
end
end
local systems = {}
local currentsystem;
local function addSystem(x, y)
local system = ParticleSystem(PVector(x, y))
table.insert(systems, system)
return system
end
local function reset()
systems = {}
local x = width/2;
local y = 50;
if mouseX then
x = mouseX;
y = mouseY;
end
currentsystem = addSystem(x, y)
end
function setup()
reset()
end
function draw()
--print("draw: ", #system.particles)
background(51);
for _, system in ipairs(systems) do
system:addParticle();
system:run();
end
stats:draw()
end
function mouseMoved()
if currentsystem then
currentsystem.origin = PVector(mouseX, mouseY)
end
end
function mousePressed()
currentsystem = addSystem(mouseX, mouseY)
end
function keyPressed()
reset();
end
go {width =1280, height=1024, frameRate = 30, title="Particle Comet"}
|
--- === cp.rx.ImmediateScheduler ===
---
--- Schedules `Observables` by running all operations immediately.
local require = require
local Reference = require "cp.rx.Reference"
local util = require "cp.rx.util"
local ImmediateScheduler = {}
ImmediateScheduler.__index = ImmediateScheduler
ImmediateScheduler.__tostring = util.constant('ImmediateScheduler')
--- cp.rx.ImmediateScheduler.create() -> cp.rx.ImmediageScheduler
--- Constructor
--- Creates a new `ImmediateScheduler`.
---
--- Parameters:
--- * None
---
--- Returns:
--- * The new `ImmediateScheduler`.
function ImmediateScheduler.create()
return setmetatable({}, ImmediateScheduler)
end
--- cp.rx.ImmediateScheduler:schedule(action) -> cp.rx.Reference
--- Method
--- Schedules a `function` to be run on the scheduler. It is executed immediately.
---
--- Parameters:
--- * action - The `function` to execute.
---
--- Returns:
--- * The [Reference](cp.rx.Reference.md).
function ImmediateScheduler:schedule(action) --luacheck: ignore
action()
return Reference.create()
end
return ImmediateScheduler
|
-- Displays changes in the key modifier state
--@ enable = true
--[====[
devel/modstate-monitor
======================
Display changes in key modifier state, ie Ctrl/Alt/Shift.
:enable|start: Begin monitoring
:disable|stop: End monitoring
]====]
VERSION = '0.1'
if active == nil then active = false end
if dfhack.internal.getModstate == nil or dfhack.internal.getModifiers == nil then
qerror('Required internal functions are missing')
end
function usage()
print [[
Usage:
modstate-monitor enable|start: Begin monitoring
modstate-monitor disable|stop: End monitoring
]]
end
function set_timeout()
dfhack.timeout(1, 'frames', check)
end
function log(s, color)
-- prevent duplicate output
if s ~= last_msg then
dfhack.color(color)
print(s)
last_msg = s
end
end
function check()
local msg = ''
local modstate = dfhack.internal.getModstate()
if modstate ~= last_modstate then
last_modstate = modstate
for k, v in pairs(dfhack.internal.getModifiers()) do
msg = msg .. k .. '=' .. (v and 1 or 0) .. ' '
end
log(msg)
end
if active then set_timeout() end
end
args = {...}
if dfhack_flags and dfhack_flags.enable then
table.insert(args, dfhack_flags.enable_state and 'enable' or 'disable')
end
if #args == 1 then
if args[1] == 'enable' or args[1] == 'start' then
set_timeout()
active = true
elseif args[1] == 'disable' or args[1] == 'stop' then
active = false
else
usage()
end
else
usage()
end
|
object_tangible_furniture_all_frn_all_bed_lg_hue_s2 = object_tangible_furniture_all_shared_frn_all_bed_lg_hue_s2:new {
}
ObjectTemplates:addTemplate(object_tangible_furniture_all_frn_all_bed_lg_hue_s2, "object/tangible/furniture/all/frn_all_bed_lg_hue_s2.iff")
|
--- Returns the default event instance to execute asynchronous operations.
-- The Event class coordinates distinct asynchronous operations using a single event loop.
-- @module jls.lang.event
-- @pragma nostrip
local logger = require('jls.lang.logger')
local CoroutineScheduler = require('jls.util.CoroutineScheduler')
--- An Event class.
-- @type Event
return require('jls.lang.class').create(function(event)
--- Creates an Event.
-- @function Event:new
function event:initialize()
self.scheduler = CoroutineScheduler:new()
end
--[[--
Registers a timer which executes a function once after the timer expires.
@tparam function callback A function that is executed once after the timer expires.
@tparam[opt=0] number delayMs The time, in milliseconds, the timer should wait before the specified function is executed.
@return An opaque value identifying the timer that can be used to cancel it.
@usage
event:setTimeout(function()
-- something that have to be done once in 1 second
end, 1000)
]]
function event:setTimeout(callback, delayMs) -- TODO Use extra arguments as function arguments
return self.scheduler:schedule(callback, false, delayMs or 0) -- as opaque timer id
end
--- Unregisters a timer.
-- @param timer the timer as returned by the setTimeout or setInterval method.
function event:clearTimeout(timer)
self.scheduler:unschedule(timer)
end
--[[--
Registers a timer which executes a function repeatedly with a fixed time delay between each execution.
@tparam function callback A function that is executed repeatedly.
@tparam number delayMs The time, in milliseconds, the timer should wait between to execution.
@return An opaque value identifying the timer that can be used to cancel it.
@usage
local intervalId
intervalId = event:setInterval(function()
-- something that have to be done every 1 second
intervalId:clearInterval(intervalId)
end, 1000)
]]
function event:setInterval(callback, delayMs) -- TODO Use extra arguments as function arguments
return self.scheduler:schedule(function()
while true do
local status, err = pcall(callback)
if not status then
if logger:isLoggable(logger.WARN) then
logger:warn('event:setInterval() callback on error "'..err..'"')
end
end
coroutine.yield(delayMs)
end
end, false, delayMs) -- as opaque timer id
end
--- Unregisters a timer.
-- @param timer the timer as returned by the setTimeout or setInterval method.
function event:clearInterval(timer)
self.scheduler:unschedule(timer)
end
-- Returns true if the specified timer id is still registered.
-- @param timer the timer as returned by the setTimeout or setInterval method.
-- @treturn boolean true if the specified timer id is still registered.
function event:hasTimer(timer)
return self.scheduler:isScheduled(timer)
end
-- Registers a timer which executes a function until completion.
-- @tparam function callback A function that is executed repeatedly.
-- @tparam[opt=0] number delayMs The time, in milliseconds, the timer should wait between to execution.
-- @return An opaque value identifying the timer that can be used to cancel it.
function event:setTask(callback, delayMs)
if logger:isLoggable(logger.DEBUG) then
logger:debug('event:setTask('..tostring(callback)..', '..tostring(delayMs)..')')
end
local taskSchedule
taskSchedule = self.scheduler:schedule(function()
while true do
local status, err = pcall(callback, delayMs and delayMs < 0 and self.scheduler:getWaitTime(taskSchedule) or nil)
if status then
if not err then
if logger:isLoggable(logger.DEBUG) then
logger:debug('event:setTask() callback ends')
end
break
end
else
if logger:isLoggable(logger.WARN) then
logger:warn('event:setTask() callback on error "'..err..'"')
end
end
coroutine.yield(delayMs or 0)
end
end, false)
return taskSchedule -- as opaque timer id
end
-- Sets the timer daemon flag.
-- @param timer the timer as returned by the setTimeout or setInterval method.
-- @tparam[opt=false] boolean daemon true to indicate this timer is a daemon.
function event:daemon(timer, daemon)
if type(timer) == 'table' and type(timer.daemon) == 'boolean' then
timer.daemon = daemon
end
end
--- Runs the event loop until there is no more registered event.
function event:loop()
self.scheduler:run()
end
--- Stops the event loop.
function event:stop()
self.scheduler:stop()
end
--- Indicates whether or not this event has at least one registered event.
-- @treturn boolean true when this event has something to do.
function event:loopAlive()
return self.scheduler:hasSchedule()
end
--- Runs the event loop once.
function event:runOnce()
self.scheduler:runOnce()
end
--- Closes this event.
function event:close()
end
end):new()
|
local M = { _NAME = "imagesize.util" }
function M.get_uint16_le (s, p)
local a, b = s:byte(p, p + 1)
return a + b * 256
end
function M.get_uint16_be (s, p)
local a, b = s:byte(p, p + 1)
return a * 256 + b
end
function M.get_uint32_le (s, p)
local a, b, c, d = s:byte(p, p + 3)
return a + b * 256 + c * 65536 + d * 16777216
end
function M.get_uint32_be (s, p)
local a, b, c, d = s:byte(p, p + 3)
return a * 16777216 + b * 65536 + c * 256 + d
end
return M
-- vi:ts=4 sw=4 expandtab
|
-- ----------------------------------------------------------------------------
-- AddOn namespace.
-- ----------------------------------------------------------------------------
local FOLDER_NAME, private = ...
local LibStub = _G.LibStub
local Dialog = LibStub("LibDialog-1.0")
-- ----------------------------------------------------------------------------
-- Handler.
-- ----------------------------------------------------------------------------
local TomTomHandler = {
-- ----------------------------------------------------------------------------
-- Data.
-- ----------------------------------------------------------------------------
currentDigsite = nil,
hasDisplayedConflictError = false,
hasPOIIntegration = false,
hasTomTom = false,
isActive = false,
waypoint = nil,
-- ----------------------------------------------------------------------------
-- Methods.
-- ----------------------------------------------------------------------------
CheckForConflict = function(self)
if not self.hasDisplayedConflictError and private.ProfileSettings.tomtom.enabled and self.hasPOIIntegration and _G.TomTom.profile.poi.setClosest then
self.hasDisplayedConflictError = true
Dialog:Spawn("ArchyTomTomError")
end
end,
ClearWaypoint = function(self)
if self.waypoint then
_G.TomTom:RemoveWaypoint(self.waypoint)
self.waypoint = nil
self.currentDigsite = nil
end
end,
Refresh = function(self, digsite)
self:ClearWaypoint()
if not digsite or digsite == self.currentDigsite or not self.hasTomTom or not self.isActive or not private.ProfileSettings.tomtom.enabled or not private.ProfileSettings.general.show then
return
end
self.currentDigsite = digsite
self.waypoint = _G.TomTom:AddMFWaypoint(digsite.mapID, nil, digsite.coordX, digsite.coordY, {
crazy = private.ProfileSettings.tomtom.crazyArrowEnabled,
title = ("%s %s\n%s"):format(digsite.name, _G.PARENS_TEMPLATE:format(digsite.race.name), digsite.zoneName),
})
end
}
private.TomTomHandler = TomTomHandler
Dialog:Register("ArchyTomTomError", {
text = "",
on_show = function(self, data)
self.text:SetFormattedText("An incompatible TomTom setting was detected.\n\nThe \"%s%s|r\" setting will cause %s to lose control of TomTom when approaching quest POIs.\n\nDo you want to reset it?",
"|cFFFFCC00", _G.TomTomLocals and _G.TomTomLocals["Enable automatic quest objective waypoints"] or "", FOLDER_NAME)
end,
buttons = {
{
text = _G.YES,
on_click = function(self, data)
_G.TomTom.profile.poi.setClosest = false
_G.TomTom:EnableDisablePOIIntegration()
end,
},
{
text = _G.NO,
},
},
hide_on_escape = true,
show_while_dead = true,
width = 450,
})
|
-- Needed variables
local pvptable = {}
local huds = {}
local toggle_interval = 5 * 60
-- Inventory mod determination
local inv_mod = ""
if minetest.get_modpath("unified_inventory") ~= nil then
inv_mod = "unified_inventory"
minetest.log("action", "[pvpbutton] Using UnifiedInventory (u_inv) as inventory management mod")
elseif minetest.get_modpath("inventory_plus") ~= nil then
inv_mod = "inventory_plus"
minetest.log("action", "[pvpbutton] Using Inventory+ (inv+) as inventory management mod")
end
if inv_mod == "" then
error("No inventory mod could be found! Please install either unified_inventory (recommended) or inventory_plus")
end
-- The toggle callback
function toggle_pvp(localname)
local player = minetest.get_player_by_name(localname)
if pvptable[localname] == 0 then
pvptable[localname] = 1
minetest.chat_send_player(localname,
"PvP was enabled for "..localname)
player:hud_remove(huds[localname])
huds[localname] = player:hud_add({
hud_elem_type = "text",
position = {x = 1, y = 0},
offset = {x=-100, y = 20},
scale = {x = 100, y = 100},
text = "PvP is enabled for you!",
number = 0xFF0000 -- Red
})
-- Change nametag
local nametag = player:get_nametag_attributes()
player:set_nametag_attributes({
text = nametag.text,
color = {a=255, r=222, g=2, b=3},
})
return
else
pvptable[localname] = 0
minetest.chat_send_player(localname,
"PvP was disabled for "..localname)
player:hud_remove(huds[localname])
-- Change nametag
local nametag = player:get_nametag_attributes()
player:set_nametag_attributes({
text = nametag.text,
color = {a=255, r=255, g=255, b=255},
})
return
end
end
-- Link the toggle callback to the proper hook
if inv_mod == "unified_inventory" then
unified_inventory.register_button("pvp", {
type = "image",
show_with = "pvp",
image = "pvpbutton_pvp.png",
tooltip = "Toggle pvp",
action = function(player)
local pname = player:get_player_name()
action_timers.wrapper(pname,
"pvp toggle",
"pvp_" .. pname,
toggle_interval,
toggle_pvp, {pname}
)
end
})
else
minetest.register_on_player_receive_fields(function(player, formname, fields)
if fields.pvp then
local pname = player:get_player_name()
action_timers.wrapper(pname,
"pvp toggle",
"pvp_" .. pname,
toggle_interval,
toggle_pvp, {pname}
)
end
end)
end
-- Initialize values for players
minetest.register_on_joinplayer(function(player)
pvptable[player:get_player_name()] = 0
huds[player:get_player_name()] = nil
if inv_mod == "inventory_plus" then
inventory_plus.register_button(player, "pvpbutton_pvp", "PvP")
minetest.after(1, function()
inventory_plus.set_inventory_formspec(player, inventory_plus.get_formspec(player, inventory_plus.default))
end)
end
end)
-- Support on on_punchplayer hook
if minetest.setting_getbool("enable_pvp") then
if minetest.register_on_punchplayer then
minetest.register_on_punchplayer(
function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage, pvp)
if not hitter:is_player() then
return false
end
local localname = player:get_player_name()
local hittername = hitter:get_player_name()
if pvptable[hittername] == 1 then
if pvptable[localname] == 1 then
return false
else
minetest.chat_send_player(hittername, "Player " .. localname .. " does not have PvP activated")
end
else
minetest.chat_send_player(hittername, "PvP is disabled for you")
end
minetest.chat_send_player(localname, "Player " .. hittername .. " tried hurting you. It failed")
return true
end)
end
end
|
-- =============================================================
-- Your Copyright Statement Goes Here
-- =============================================================
-- config.lua
-- =============================================================
-- https://docs.coronalabs.com/daily/guide/basics/configSettings/index.html
-- =============================================================
application = {
content = {
width = 1080,
height = 1920,
scale = "letterBox",
fps = 60,
xAlign = "center",
yAlign = "center",
showRuntimeErrors = true,
shaderPrecision = "highp",
imageSuffix = {
["@2x"] = 2.0,
["@3x"] = 3.0,
["@4x"] = 4.0,
},
},
}
|
if UTIL == nil then
UTIL = {}
function UTIL.printAnnounce(msg)
PrintMessage(3, msg)
end
end
|
--lmc.minimizeToTray = true
--lmc_minimize()
lmc_print_devices() -- get the ID of the second keyboard from the stack that this line creates
lmc_device_set_name('9KeyBlack', "2E6AE332") -- substitute the ID you have found here
lmc_device_set_name('AirMouse', "1AD43AFB") -- substitute the ID you have found here
lmc_device_set_name('3KeyWhite', "39D8BF39") -- substitute the ID you have found here
lmc_device_set_name('Sades', "B37B578") -- substitute the ID you have found here
lmc_device_set_name('NumberPad', "359FEC6A") -- substitute the ID you have found here
-- lmc_assign_keyboard('MACROS1') -- if Lua doesn't work try adding this line
-- define callback for whole device, assign each key of the keyboard to an imaginary key (usually, keyboards have F1-F12, so we start assigning keys to F13)
lmc_set_handler('9KeyBlack',function(button, direction)
if (direction == 1) then return end -- ignore down; if you want to be able to type the original letters as well with the secondary keyboard, remove this line
if (button == string.byte('7')) then lmc_send_keys('+<') -- This doesn't seem to work, butI'd like it to work. Instead, I use the below line
-- if (button == 55) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard7.exe")
-- elseif (button == string.byte('H')) then lmc_spawn("calc")
-- elseif (button == string.byte('9')) then lmc_send_keys('+{F8}')
elseif (button == 57) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard9.exe")
elseif (button == 49) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard1.exe") -- The AutoHokey script does WheelUp This is instead of using string.byte and is the number identifier for that key on the keyboard which is 1 here
elseif (button == 50) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard2.exe")
elseif (button == 51) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard3.exe") -- The AutoHokey script does WheelDown
elseif (button == 52) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard4.exe")
elseif (button == 54) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard6.exe")
elseif (button == 56) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard8.exe")
-- elseif (button == string.byte('3')) then lmc_send_keys('{F16}')
-- elseif (button == string.byte('4')) then lmc_send_keys('{F17}')
-- elseif (button == 90) then lmc_send_keys('^+%{b}') -- once F keys are over, just use combitations with alt, ctrl, shift, win, or tab (https://github.com/me2d13/luamacros/wiki/List-of-Keys)
-- etc.
else print('Not yet assigned: ' .. button)
end
end)
-- define callback for whole device, assign each key of the keyboard to an imaginary key (usually, keyboards have F1-F12, so we start assigning keys to F13)
lmc_set_handler('AirMouse',function(button, direction)
if (direction == 1) then return end -- ignore down; if you want to be able to type the original letters as well with the secondary keyboard, remove this line.
if (button == string.byte('7')) then lmc_send_keys('+<') -- This doesn't seem to work, butI'd like it to work. Instead, I use the below line
-- if (button == 55) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard7.exe")
-- elseif (button == string.byte('H')) then lmc_spawn("calc")
-- elseif (button == string.byte('9')) then lmc_send_keys('+{F8}')
elseif (button == 38) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\AirMouseUp.exe")
elseif (button == 40) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\AirMouseDown.exe")
elseif (button == 89) then lmc_send_keys('+<{F6}')
--elseif (button == 50) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard2.exe")
--elseif (button == 51) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard3.exe") -- The AutoHokey script does WheelDown
--elseif (button == 52) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard4.exe")
--elseif (button == 54) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard6.exe")
--elseif (button == 56) then lmc_spawn("C:\\Users\\Jonathan\\Documents\\9KeyKeyboard8.exe")
-- elseif (button == string.byte('3')) then lmc_send_keys('{F16}')
-- elseif (button == string.byte('4')) then lmc_send_keys('{F17}')
-- elseif (button == 90) then lmc_send_keys('^+%{b}') -- once F keys are over, just use combitations with alt, ctrl, shift, win, or tab (https://github.com/me2d13/luamacros/wiki/List-of-Keys)
-- etc.
else print('Not yet assigned: ' .. button)
end
end)
-- if you wanted more keyboards, just repeat line 5 with its id and a assign a new name, like MACROS2.
-- then repeat the code that starts in line 9, but change the name to the one you have just assigned.
-- For exemple, to: lmc_set_handler('MACROS2', ...
|
local F, C = unpack(select(2, ...))
tinsert(C.themes["FreeUI"], function()
F.CreateBD(ScrollOfResurrectionSelectionFrame)
F.CreateSD(ScrollOfResurrectionSelectionFrame)
F.CreateBD(ScrollOfResurrectionFrame)
F.CreateSD(ScrollOfResurrectionFrame)
F.ReskinScroll(ScrollOfResurrectionSelectionFrameListScrollFrameScrollBar)
F.ReskinInput(ScrollOfResurrectionSelectionFrameTargetEditBox)
F.ReskinInput(ScrollOfResurrectionFrameNoteFrame)
for i = 1, 6 do
select(i, ScrollOfResurrectionFrameNoteFrame:GetRegions()):Hide()
end
F.Reskin(ScrollOfResurrectionSelectionFrameAcceptButton)
F.Reskin(ScrollOfResurrectionSelectionFrameCancelButton)
F.Reskin(ScrollOfResurrectionFrameAcceptButton)
F.Reskin(ScrollOfResurrectionFrameCancelButton)
F.CreateBD(ScrollOfResurrectionSelectionFrameList, .25)
end)
|
--- === hs.redshift ===
---
--- Inverts and/or lowers the color temperature of the screen(s) on a schedule, for a more pleasant experience at night
---
--- Usage:
--- ```
--- -- make a windowfilterDisable for redshift: VLC, Photos and screensaver/login window will disable color adjustment and inversion
--- local wfRedshift=hs.window.filter.new({VLC={focused=true},Photos={focused=true},loginwindow={visible=true,allowRoles='*'}},'wf-redshift')
--- -- start redshift: 2800K + inverted from 21 to 7, very long transition duration (19->23 and 5->9)
--- hs.redshift.start(2800,'21:00','7:00','4h',true,wfRedshift)
--- -- allow manual control of inverted colors
--- hs.hotkey.bind(HYPER,'f1','Invert',hs.redshift.toggleInvert)
--- ```
---
--- Note:
--- * As of macOS 10.12.4, Apple provides "Night Shift", which implements a simple red-shift effect, as part of the OS. It seems unlikely that `hs.redshift` will see significant future development.
local screen=require'hs.screen'
local timer=require'hs.timer'
local windowfilter=require'hs.window.filter'
local settings=require'hs.settings'
local log=require'hs.logger'.new('redshift')
local redshift={setLogLevel=log.setLogLevel} -- module
local type,ipairs,pairs,next,floor,abs,min,max,sformat=type,ipairs,pairs,next,math.floor,math.abs,math.min,math.max,string.format
local SETTING_INVERTED_OVERRIDE='hs.redshift.inverted.override'
local SETTING_DISABLED_OVERRIDE='hs.redshift.disabled.override'
--local BLACKPOINT = {red=0.00000001,green=0.00000001,blue=0.00000001}
local BLACKPOINT = {red=0,green=0,blue=0}
--local COLORRAMP
local running,nightStart,nightEnd,dayStart,dayEnd,nightTemp,dayTemp
local tmr,tmrNext,applyGamma,screenWatcher
local invertRequests,invertCallbacks,invertAtNight,invertUser,prevInvert={},{}
local disableRequests,disableUser={}
local wfDisable,modulewfDisable
local function round(v) return floor(0.5+v) end
local function lerprgb(p,a,b) return {red=a[1]*(1-p)+b[1]*p,green=a[2]*(1-p)+b[2]*p,blue=a[3]*(1-p)+b[3]*p} end
local function ilerp(v,s,e,a,b)
if s>e then
if v<e then v=v+86400 end
e=e+86400
end
local p=(v-s)/(e-s)
return a*(1-p)+b*p
end
local function getGamma(temp)
local R,lb,ub=redshift.COLORRAMP
for k,_ in pairs(R) do
if k<=temp then lb=max(lb or 0,k) else ub=min(ub or 10000,k) end
end
if lb==nil or ub==nil then local t=R[ub or lb] return {red=t[1],green=t[2],blue=t[3]} end
local p=(temp-lb)/(ub-lb)
return lerprgb(p,R[lb],R[ub])
-- local idx=floor(temp/100)-9
-- local p=(temp%100)/100
-- return lerprgb(p,COLORRAMP[idx],COLORRAMP[idx+1])
end
local function between(v,s,e)
if s<=e then return v>=s and v<=e else return v>=s or v<=e end
end
local function isInverted()
if not running then return false end
if invertUser~=nil then return invertUser and 'user'
else return next(invertRequests) or false end
end
local function isDisabled()
if not running then return true end
if disableUser~=nil then return disableUser and 'user'
else return next(disableRequests) or false end
end
-- core fn
applyGamma=function()
if tmrNext then tmrNext:stop() tmrNext=nil end
local now=timer.localTime()
local temp,timeNext,invertReq
if isDisabled() then temp=6500 timeNext=now-1 log.i('disabled')
elseif between(now,nightStart,nightEnd) then temp=ilerp(now,nightStart,nightEnd,dayTemp,nightTemp) --dusk
elseif between(now,dayStart,dayEnd) then temp=ilerp(now,dayStart,dayEnd,nightTemp,dayTemp) --dawn
elseif between(now,dayEnd,nightStart) then temp=dayTemp timeNext=nightStart log.i('daytime')--day
elseif between(now,nightEnd,dayStart) then invertReq=invertAtNight temp=nightTemp timeNext=dayStart log.i('nighttime')--night
else error('wtf') end
redshift.requestInvert('redshift-night',invertReq)
local invert=isInverted()
local gamma=getGamma(temp)
log.df('set color temperature %dK (gamma %d,%d,%d)%s',floor(temp),round(gamma.red*100),
round(gamma.green*100),round(gamma.blue*100),invert and (' - inverted by '..invert) or '')
for _,scr in ipairs(screen.allScreens()) do
scr:setGamma(invert and BLACKPOINT or gamma,invert and gamma or BLACKPOINT)
end
if invert~=prevInvert then
log.i('inverted status changed',next(invertCallbacks) and '- notifying callbacks' or '')
for _,fn in pairs(invertCallbacks) do fn(invert) end
prevInvert=invert
end
if timeNext then
tmrNext=timer.doAt(timeNext,applyGamma)
else
tmr:start()
end
end
--- hs.redshift.invertSubscribe([id,]fn)
--- Function
--- Subscribes a callback to be notified when the color inversion status changes
---
--- You can use this to dynamically adjust the UI colors in your modules or configuration, if appropriate.
---
--- Parameters:
--- * id - (optional) a string identifying the requester (usually the module name); if omitted, `fn`
--- itself will be the identifier; this identifier must be passed to `hs.redshift.invertUnsubscribe()`
--- * fn - a function that will be called whenever color inversion status changes; it must accept a
--- single parameter, a string or false as per the return value of `hs.redshift.isInverted()`
---
--- Returns:
--- * None
function redshift.invertSubscribe(key,fn)
if type(key)=='function' then fn=key end
if type(key)~='string' and type(key)~='function' then error('invalid key',2) end
if type(fn)~='function' then error('invalid callback',2) end
invertCallbacks[key]=fn
log.i('add invert callback',key)
return running and fn(isInverted())
end
--- hs.redshift.invertUnsubscribe(id)
--- Function
--- Unsubscribes a previously subscribed color inversion change callback
---
--- Parameters:
--- * id - a string identifying the requester or the callback function itself, depending on how you
--- called `hs.redshift.invertSubscribe()`
---
--- Returns:
--- * None
function redshift.invertUnsubscribe(key)
if not invertCallbacks[key] then return end
log.i('remove invert callback',key)
invertCallbacks[key]=nil
end
--- hs.redshift.isInverted() -> string or false
--- Function
--- Checks if the colors are currently inverted
---
--- Parameters:
--- * None
---
--- Returns:
--- * false if the colors are not currently inverted; otherwise, a string indicating the reason, one of:
--- * "user" for the user override (see `hs.redshift.toggleInvert()`)
--- * "redshift-night" if `hs.redshift.start()` was called with `invertAtNight` set to true,
--- and it's currently night time
--- * the ID string (usually the module name) provided to `hs.redshift.requestInvert()`, if another module requested color inversion
redshift.isInverted=isInverted
redshift.isDisabled=isDisabled
--- hs.redshift.requestInvert(id,v)
--- Function
--- Sets or clears a request for color inversion
---
--- Parameters:
--- * id - a string identifying the requester (usually the module name)
--- * v - a boolean indicating whether to invert the colors (if true) or clear any previous requests (if false or nil)
---
--- Returns:
--- * None
---
--- Notes:
--- * you can use this function e.g. to automatically invert colors if the ambient light sensor reading drops below
--- a certain threshold (`hs.brightness.DDCauto()` can optionally do exactly that)
--- * if the user's configuration doesn't explicitly start the redshift module, calling this will have no effect
local function request(t,k,v)
if type(k)~='string' then error('key must be a string',3) end
if v==false then v=nil end
if t[k]~=v then t[k]=v return true end
end
function redshift.requestInvert(key,v)
if request(invertRequests,key,v) then
log.f('invert request from %s %s',key,v and '' or 'canceled')
return running and applyGamma()
end
end
function redshift.requestDisable(key,v)
if request(disableRequests,key,v) then
log.f('disable color adjustment request from %s %s',key,v and '' or 'canceled')
return running and applyGamma()
end
end
--- hs.redshift.toggleInvert([v])
--- Function
--- Sets or clears the user override for color inversion.
---
--- This function should be bound to a hotkey, e.g.:
--- `hs.hotkey.bind('ctrl-cmd','=','Invert',hs.redshift.toggleInvert)`
---
--- Parameters:
--- * v - (optional) a boolean; if true, the override will invert the colors no matter what; if false,
--- the override will disable color inversion no matter what; if omitted or nil, it will toggle the
--- override, i.e. clear it if it's currently enforced, or set it to the opposite of the current
--- color inversion status otherwise.
---
--- Returns:
--- * None
function redshift.toggleInvert(v)
if not running then return end
if v==nil and invertUser==nil then v=not isInverted() end
if v~=nil and type(v)~='boolean' then error ('v must be a boolean or nil',2) end
log.f('invert user override%s',v==true and ': inverted' or (v==false and ': not inverted' or ' cancelled'))
if v==nil then settings.clear(SETTING_INVERTED_OVERRIDE)
else settings.set(SETTING_INVERTED_OVERRIDE,v) end
invertUser=v
return applyGamma()
end
--- hs.redshift.toggle([v])
--- Function
--- Sets or clears the user override for color temperature adjustment.
---
--- This function should be bound to a hotkey, e.g.:
--- `hs.hotkey.bind('ctrl-cmd','-','Redshift',hs.redshift.toggle)`
---
--- Parameters:
--- * v - (optional) a boolean; if true, the override will enable color temperature adjustment on
--- the given schedule; if false, the override will disable color temperature adjustment;
--- if omitted or nil, it will toggle the override, i.e. clear it if it's currently enforced, or
--- set it to the opposite of the current color temperature adjustment status otherwise.
---
--- Returns:
--- * None
function redshift.toggle(v)
if not running then return end
if v==nil then
if disableUser==nil then v=not isDisabled() end
elseif type(v)~='boolean' then error ('v must be a boolean or nil',2)
else v=not v end
log.f('color adjustment user override%s',v==true and ': disabled' or (v==false and ': enabled' or ' cancelled'))
if v==nil then settings.clear(SETTING_DISABLED_OVERRIDE)
else settings.set(SETTING_DISABLED_OVERRIDE,v) end
disableUser=v
return applyGamma()
end
--- hs.redshift.stop()
--- Function
--- Stops the module and disables color adjustment and color inversion
---
--- Parameters:
--- * None
---
--- Returns:
--- * None
function redshift.stop()
if not running then return end
log.i('stopped')
tmr:stop()
screen.restoreGamma()
if wfDisable then
if modulewfDisable then modulewfDisable:delete() modulewfDisable=nil
else wfDisable:unsubscribe(redshift.wfsubs) end
wfDisable=nil
end
if tmrNext then tmrNext:stop() tmrNext=nil end
screenWatcher:stop() screenWatcher=nil
running=nil
end
local function gc(t) return t.stop()end
local function stime(time)
return sformat('%02d:%02d:%02d',floor(time/3600),floor(time/60)%60,floor(time%60))
end
tmr=timer.delayed.new(10,applyGamma)
--- hs.redshift.start(colorTemp,nightStart,nightEnd[,transition[,invertAtNight[,windowfilterDisable[,dayColorTemp]]]])
--- Function
--- Sets the schedule and (re)starts the module
---
--- Parameters:
--- * colorTemp - a number indicating the desired color temperature (Kelvin) during the night cycle;
--- the recommended range is between 3600K and 1400K; lower values (minimum 1000K) result in a more pronounced adjustment
--- * nightStart - a string in the format "HH:MM" (24-hour clock) or number of seconds after midnight
--- (see `hs.timer.seconds()`) indicating when the night cycle should start
--- * nightEnd - a string in the format "HH:MM" (24-hour clock) or number of seconds after midnight
--- (see `hs.timer.seconds()`) indicating when the night cycle should end
--- * transition - (optional) a string or number of seconds (see `hs.timer.seconds()`) indicating the duration of
--- the transition to the night color temperature and back; if omitted, defaults to 1 hour
--- * invertAtNight - (optional) a boolean indicating whether the colors should be inverted (in addition to
--- the color temperature shift) during the night; if omitted, defaults to false
--- * windowfilterDisable - (optional) an `hs.window.filter` instance that will disable color adjustment
--- (and color inversion) whenever any window is allowed; alternatively, you can just provide a list of application
--- names (typically media apps and/or apps for color-sensitive work) and a windowfilter will be created
--- for you that disables color adjustment whenever one of these apps is focused
--- * dayColorTemp - (optional) a number indicating the desired color temperature (in Kelvin) during the day cycle;
--- you can use this to maintain some degree of "redshift" during the day as well, or, if desired, you can
--- specify a value higher than 6500K (up to 10000K) for more bluish colors, although that's not recommended;
--- if omitted, defaults to 6500K, which disables color adjustment and restores your screens' original color profiles
---
--- Returns:
--- * None
function redshift.start(nTemp,nStart,nEnd,dur,invert,wf,dTemp)
if not dTemp then dTemp=6500 end
if nTemp<1000 or nTemp>10000 or dTemp<1000 or dTemp>10000 then error('invalid color temperature',2) end
nStart,nEnd=timer.seconds(nStart),timer.seconds(nEnd)
dur=timer.seconds(dur or 3600)
if dur>14400 then error('max transition time is 4h',2) end
if abs(nStart-nEnd)<dur or abs(nStart-nEnd+86400)<dur
or abs(nStart-nEnd-86400)<dur then error('nightTime too close to dayTime',2) end
nightTemp,dayTemp=floor(nTemp),floor(dTemp)
redshift.stop()
invertAtNight=invert
nightStart,nightEnd=(nStart-dur/2)%86400,(nStart+dur/2)%86400
dayStart,dayEnd=(nEnd-dur/2)%86400,(nEnd+dur/2)%86400
log.f('started: %dK @ %s -> %dK @ %s,%s %dK @ %s -> %dK @ %s',
dayTemp,stime(nightStart),nightTemp,stime(nightEnd),invert and ' inverted,' or '',nightTemp,stime(dayStart),dayTemp,stime(dayEnd))
running=true
tmr:setDelay(max(1,dur/200))
screenWatcher=screen.watcher.new(function()tmr:start(5)end):start()
invertUser=settings.get(SETTING_INVERTED_OVERRIDE)
disableUser=settings.get(SETTING_DISABLED_OVERRIDE)
applyGamma()
if wf~=nil then
if windowfilter.iswf(wf) then wfDisable=wf
else
wfDisable=windowfilter.new(wf,'wf-redshift',log.getLogLevel())
modulewfDisable=wfDisable
if type(wf=='table') then
local isAppList=true
for k,v in pairs(wf) do
if type(k)~='number' or type(v)~='string' then isAppList=false break end
end
if isAppList then wfDisable:setOverrideFilter{focused=true} end
end
end
redshift.wfsubs={
[windowfilter.hasWindow]=function()redshift.requestDisable('wf-redshift',true)end,
[windowfilter.hasNoWindows]=function()redshift.requestDisable('wf-redshift')end,
}
wfDisable:subscribe(redshift.wfsubs,true)
end
end
--- hs.redshift.COLORRAMP
--- Variable
--- A table holding the gamma values for given color temperatures; each key must be a color temperature number in K (useful values are between
--- 1400 and 6500), and each value must be a list of 3 gamma numbers between 0 and 1 for red, green and blue respectively.
--- The table must have at least two entries (a lower and upper bound); the actual gamma values used for a given color temperature
--- are linearly interpolated between the two closest entries; linear interpolation isn't particularly precise for this use case,
--- so you should provide as many values as possible.
---
--- Notes:
--- * `hs.inspect(hs.redshift.COLORRAMP)` from the console will show you how the table is built
--- * the default ramp has entries from 1000K to 10000K every 100K
redshift.COLORRAMP={ -- from https://github.com/jonls/redshift/blob/master/src/colorramp.c
[1000]={1.00000000, 0.18172716, 0.00000000}, -- 1000K
[1100]={1.00000000, 0.25503671, 0.00000000}, -- 1100K
[1200]={1.00000000, 0.30942099, 0.00000000}, -- 1200K
[1300]={1.00000000, 0.35357379, 0.00000000}, -- ...
[1400]={1.00000000, 0.39091524, 0.00000000},
[1500]={1.00000000, 0.42322816, 0.00000000},
[1600]={1.00000000, 0.45159884, 0.00000000},
[1700]={1.00000000, 0.47675916, 0.00000000},
[1800]={1.00000000, 0.49923747, 0.00000000},
[1900]={1.00000000, 0.51943421, 0.00000000},
[2000]={1.00000000, 0.54360078, 0.08679949},
[2100]={1.00000000, 0.56618736, 0.14065513},
[2200]={1.00000000, 0.58734976, 0.18362641},
[2300]={1.00000000, 0.60724493, 0.22137978},
[2400]={1.00000000, 0.62600248, 0.25591950},
[2500]={1.00000000, 0.64373109, 0.28819679},
[2600]={1.00000000, 0.66052319, 0.31873863},
[2700]={1.00000000, 0.67645822, 0.34786758},
[2800]={1.00000000, 0.69160518, 0.37579588},
[2900]={1.00000000, 0.70602449, 0.40267128},
[3000]={1.00000000, 0.71976951, 0.42860152},
[3100]={1.00000000, 0.73288760, 0.45366838},
[3200]={1.00000000, 0.74542112, 0.47793608},
[3300]={1.00000000, 0.75740814, 0.50145662},
[3400]={1.00000000, 0.76888303, 0.52427322},
[3500]={1.00000000, 0.77987699, 0.54642268},
[3600]={1.00000000, 0.79041843, 0.56793692},
[3700]={1.00000000, 0.80053332, 0.58884417},
[3800]={1.00000000, 0.81024551, 0.60916971},
[3900]={1.00000000, 0.81957693, 0.62893653},
[4000]={1.00000000, 0.82854786, 0.64816570},
[4100]={1.00000000, 0.83717703, 0.66687674},
[4200]={1.00000000, 0.84548188, 0.68508786},
[4300]={1.00000000, 0.85347859, 0.70281616},
[4400]={1.00000000, 0.86118227, 0.72007777},
[4500]={1.00000000, 0.86860704, 0.73688797},
[4600]={1.00000000, 0.87576611, 0.75326132},
[4700]={1.00000000, 0.88267187, 0.76921169},
[4800]={1.00000000, 0.88933596, 0.78475236},
[4900]={1.00000000, 0.89576933, 0.79989606},
[5000]={1.00000000, 0.90198230, 0.81465502},
[5100]={1.00000000, 0.90963069, 0.82838210},
[5200]={1.00000000, 0.91710889, 0.84190889},
[5300]={1.00000000, 0.92441842, 0.85523742},
[5400]={1.00000000, 0.93156127, 0.86836903},
[5500]={1.00000000, 0.93853986, 0.88130458},
[5600]={1.00000000, 0.94535695, 0.89404470},
[5700]={1.00000000, 0.95201559, 0.90658983},
[5800]={1.00000000, 0.95851906, 0.91894041},
[5900]={1.00000000, 0.96487079, 0.93109690},
[6000]={1.00000000, 0.97107439, 0.94305985},
[6100]={1.00000000, 0.97713351, 0.95482993},
[6200]={1.00000000, 0.98305189, 0.96640795},
[6300]={1.00000000, 0.98883326, 0.97779486},
[6400]={1.00000000, 0.99448139, 0.98899179},
[6500]={1.00000000, 1.00000000, 1.00000000}, -- 6500K
-- [6500]={0.99999997, 0.99999997, 0.99999997}, --6500K
[6600]={0.98947904, 0.99348723, 1.00000000},
[6700]={0.97940448, 0.98722715, 1.00000000},
[6800]={0.96975025, 0.98120637, 1.00000000},
[6900]={0.96049223, 0.97541240, 1.00000000},
[7000]={0.95160805, 0.96983355, 1.00000000},
[7100]={0.94303638, 0.96443333, 1.00000000},
[7200]={0.93480451, 0.95923080, 1.00000000},
[7300]={0.92689056, 0.95421394, 1.00000000},
[7400]={0.91927697, 0.94937330, 1.00000000},
[7500]={0.91194747, 0.94470005, 1.00000000},
[7600]={0.90488690, 0.94018594, 1.00000000},
[7700]={0.89808115, 0.93582323, 1.00000000},
[7800]={0.89151710, 0.93160469, 1.00000000},
[7900]={0.88518247, 0.92752354, 1.00000000},
[8000]={0.87906581, 0.92357340, 1.00000000},
[8100]={0.87315640, 0.91974827, 1.00000000},
[8200]={0.86744421, 0.91604254, 1.00000000},
[8300]={0.86191983, 0.91245088, 1.00000000},
[8400]={0.85657444, 0.90896831, 1.00000000},
[8500]={0.85139976, 0.90559011, 1.00000000},
[8600]={0.84638799, 0.90231183, 1.00000000},
[8700]={0.84153180, 0.89912926, 1.00000000},
[8800]={0.83682430, 0.89603843, 1.00000000},
[8900]={0.83225897, 0.89303558, 1.00000000},
[9000]={0.82782969, 0.89011714, 1.00000000},
[9100]={0.82353066, 0.88727974, 1.00000000},
[9200]={0.81935641, 0.88452017, 1.00000000},
[9300]={0.81530175, 0.88183541, 1.00000000},
[9400]={0.81136180, 0.87922257, 1.00000000},
[9500]={0.80753191, 0.87667891, 1.00000000},
[9600]={0.80380769, 0.87420182, 1.00000000},
[9700]={0.80018497, 0.87178882, 1.00000000},
[9800]={0.79665980, 0.86943756, 1.00000000},
[9900]={0.79322843, 0.86714579, 1.00000000},
[10000]={0.78988728, 0.86491137, 1.00000000}, -- 10000K
}
return setmetatable(redshift,{__gc=gc})
|
--------------------------------
-- @module Animate3D
-- @extend ActionInterval
-- @parent_module cc
---@class cc.Animate3D:cc.ActionInterval
local Animate3D = {}
cc.Animate3D = Animate3D
--------------------------------
---
---@param keyFrame number
---@param userInfo map_table
---@return cc.Animate3D
function Animate3D:setKeyFrameUserInfo(keyFrame, userInfo)
end
--------------------------------
--- get & set speed, negative speed means playing reverse
---@return number
function Animate3D:getSpeed()
end
--------------------------------
--- set animate quality
---@param quality number
---@return cc.Animate3D
function Animate3D:setQuality(quality)
end
--------------------------------
---
---@param weight number
---@return cc.Animate3D
function Animate3D:setWeight(weight)
end
--------------------------------
---
---@return cc.Animate3D
function Animate3D:removeFromMap()
end
--------------------------------
---
---@param animation cc.Animation3D
---@param startFrame number
---@param endFrame number
---@param frameRate number
---@return boolean
function Animate3D:initWithFrames(animation, startFrame, endFrame, frameRate)
end
--------------------------------
---
---@return number
function Animate3D:getOriginInterval()
end
--------------------------------
---
---@param speed number
---@return cc.Animate3D
function Animate3D:setSpeed(speed)
end
--------------------------------
---
---@param animation cc.Animation3D
---@param fromTime number
---@param duration number
---@return boolean
---@overload fun(self:cc.Animate3D, animation:cc.Animation3D):boolean
function Animate3D:init(animation, fromTime, duration)
end
--------------------------------
--- get & set origin interval
---@param interval number
---@return cc.Animate3D
function Animate3D:setOriginInterval(interval)
end
--------------------------------
--- get & set blend weight, weight must positive
---@return number
function Animate3D:getWeight()
end
--------------------------------
--- get animate quality
---@return number
function Animate3D:getQuality()
end
--------------------------------
--- create Animate3D<br>
-- param animation used to generate animate3D<br>
-- param fromTime<br>
-- param duration Time the Animate3D lasts<br>
-- return Animate3D created using animate
---@param animation cc.Animation3D
---@param fromTime number
---@param duration number
---@return cc.Animate3D
---@overload fun(self:cc.Animate3D, animation:cc.Animation3D):cc.Animate3D
function Animate3D:create(animation, fromTime, duration)
end
--------------------------------
--- get animate transition time between 3d animations
---@return number
function Animate3D:getTransitionTime()
end
--------------------------------
--- create Animate3D by frame section, [startFrame, endFrame)
--- param animation used to generate animate3D
--- param startFrame
--- param endFrame
--- param frameRate default is 30 per second
--- return Animate3D created using animate
---@param animation cc.Animation3D
---@param startFrame number
---@param endFrame number
---@param frameRate number
---@return cc.Animate3D
function Animate3D:createWithFrames(animation, startFrame, endFrame, frameRate)
end
--------------------------------
--- set animate transition time between 3d animations
---@param transTime number
---@return cc.Animate3D
function Animate3D:setTransitionTime(transTime)
end
--------------------------------
---
---@param target cc.Node
---@return cc.Animate3D
function Animate3D:startWithTarget(target)
end
--------------------------------
---
---@return cc.Animate3D
function Animate3D:reverse()
end
--------------------------------
---
---@return cc.Animate3D
function Animate3D:clone()
end
--------------------------------
---
---@return cc.Animate3D
function Animate3D:stop()
end
--------------------------------
---
---@param t number
---@return cc.Animate3D
function Animate3D:update(t)
end
--------------------------------
---
---@param dt number
---@return cc.Animate3D
function Animate3D:step(dt)
end
--------------------------------
---
---@return cc.Animate3D
function Animate3D:Animate3D()
end
return nil
|
--[[
Lua vector
Developer: Deybis Melendez
Web: https://github.com/DeybisMelendez/lua-vector
MIT License
Copyright (c) 2020 Deybis Melendez
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
]]
local vector = {_VERSION = "v0.8.0", _TYPE = "module", _NAME = "lua-vector"}
local newVectorMt = {
__tostring = function(s)
return "vector(" .. s.x .. ", " .. s.y ..")"
end,
__add = function(a, b)
if type(a) == "number" then return vector(a + b.x, a + b.y)
elseif type(b) == "number" then return vector(a.x + b, a.y + b) end
return vector(a.x + b.x, a.y + b.y)
end,
__sub = function(a, b)
if type(a) == "number" then return vector(a - b.x, a - b.y)
elseif type(b) == "number" then return vector(a.x - b, a.y - b) end
return vector(a.x - b.x, a.y - b.y)
end,
__mul = function(a, b)
if type(a) == "number" then return vector(a * b.x, a * b.y)
elseif type(b) == "number" then return vector(a.x * b, a.y * b) end
return vector(a.x * b.x, a.y * b.y)
end,
__div = function(a, b)
if type(a) == "number" then return vector(a / b.x, a / b.y)
elseif type(b) == "number" then return vector(a.x / b, a.y / b) end
return vector(a.x / b.x, a.y / b.y)
end,
__unm = function(t)
return vector(-t.x, -t.y)
end,
__eq = function(a, b)
return a.x == b.x and a.y == b.y
end,
__pow = function(vec, value)
return vector(vec.x ^ value, vec.y ^ value)
end,
__concat = function(a, b)
if type(a) == "string" then return a .. tostring(b) end
if type(b) == "string" then return tostring(a) .. b end
return tostring(a) .. tostring(b)
end
}
local mt = {
__call = function(_, x, y)
local vec = {x = x or 0, y = y or 0}
setmetatable(vec, newVectorMt)
return vec
end
}
function vector.angle(v)
return math.atan2(v.y, v.x)
end
function vector.normalized(v)
local m = (v.x^2 + v.y^2)^0.5 --magnitude
if v.x/m ~= v.x/m then v.x = 0 else v.x = v.x/m end
if v.y/m ~= v.y/m then v.y = 0 else v.y = v.y/m end
end
function vector.round(v, dec)
dec = dec or 0
local mult = 10^(dec)
local nx, ny
if v.x >= 0 then nx = math.floor(v.x * mult + 0.5) / mult
else nx = math.ceil(v.x * mult - 0.5) / mult end
if v.y >= 0 then ny = math.floor(v.y * mult + 0.5) / mult
else ny = math.ceil(v.y * mult - 0.5) / mult end
v.x, v.y = nx, ny
return v
end
function vector.distanceSquaredTo(s, v)
local x1, y1 = s.x, s.y
local x2, y2 = v.x, v.y
return (x2 - x1)^2 + (y2 - y1)^2
end
function vector.distanceTo(s, v)
return vector.distanceSquaredTo(s, v)^0.5
end
function vector.distanceSquared(v)
return v.x^2 + v.y^2
end
function vector.distance(v)
return (vector.distanceSquared(v))^0.5
end
function vector.dot(s, v)
return s.x * v.x + s.y * v.y
end
function vector.perpDot(s, v)
return s.x * v.x - s.y * v.y
end
function vector.abs(v)
v.x, v.y = math.abs(v.x), math.abs(v.y)
return v
end
function vector.toPolar(v, angle, len)
len = len or 1
v.x, v.y = math.cos(angle) * len, math.sin(angle) * len
return v
end
function vector.rotated(v, phi)
v.x = math.cos(phi) * v.x - math.sin(phi) * v.y
v.y = math.sin(phi) * v.x + math.cos(phi) * v.y
return v
end
function vector.cross(s, v)
return s.x * v.y - s.y * v.x
end
function vector.perpendicular(v)
local px, py = v.x, v.y
v.x, v.y = -py, px
return v
end
function vector.lerp(s, v, t)
local i = 1 - t
s.x, s.y = s.x * i + v.x * t, s.y * i + v.y * t
return s
end
function vector.unpack(v)
return v.x, v.y
end
setmetatable(vector, mt)
vector.DOWN = vector(0, 1)
vector.UP = vector(0, -1)
vector.LEFT = vector(-1, 0)
vector.RIGHT = vector(1, 0)
vector.ZERO = vector(0, 0)
vector.ONE = vector(1, 1)
return vector
|
local deserialize = {}
-- Read text data from memory, starting at addr_start
-- If the End of Transmission byte \4 is encountered, return nil (actually nothing)
-- to indicate that we reached the end of a serialization stream.
-- Otherwise, read the actual text's characters byte by byte.
-- This also works if \0 is immediately encountered (just return empty string).
-- Then return (deserialized text string, next address after last read)
function deserialize.text_from_mem(addr_start, addr_exclusive_limit)
local text = ""
-- read character bytes
local next_addr = addr_start
while true do
if addr_exclusive_limit and next_addr >= addr_exclusive_limit then
-- we crossed the limit (we may even be a little further, but that's OK)
--#if assert
assert(false, "writing from addr_start: "..addr_start.." until next_addr which reached "..
"addr_exclusive_limit: "..addr_exclusive_limit..", stop.")
--#endif
--[[#pico8
--#ifn assert
-- stop and return what we've found so far, but next address as nil
-- to show we shouldn't go on
return text, nil
--#endif
--#pico8]]
end
local byte = peek(next_addr)
if byte == 0 then
-- \0 encountered, end of string reached. Next address will be just after that.
return text, next_addr + 1
elseif byte == 4 then
-- \4 encountered, end of transmission reached
-- This should only happen for the first character, as any string should
-- end with \0 and only the next call to text_from_mem should find \4
-- Next address will be just after that.
-- (normally we only text_table_from_mem should be aware of \4, but
-- then it should do a peek, and if not \4 call text_from_mem which would do peek again)
assert(#text == 0, "\\4 encountered immediately after some text, missing terminating byte \\0")
return nil, next_addr + 1
end
-- read the byte as a character, append to current deserialized text and go on
local c = chr(byte)
text = text..c
next_addr = next_addr + 1
end
end
-- Read sequence of texts from memory, by chaining text_from_mem reads to effectively
-- extract all the text strings from memory.
-- Return (deserialized text sequence, next address after last read)
-- addr_exclusive_limit avoids infinite loop in case we meet no End of Transmission (\4)
function deserialize.text_table_from_mem(addr_start, addr_exclusive_limit)
local text_sequence = {}
local next_addr = addr_start
while true do
local text
text, next_addr = deserialize.text_from_mem(next_addr, addr_exclusive_limit)
if not text then
-- we've reached EOT (\4), return deserialized text sequence and next address
-- this is the expected control path
break
end
add(text_sequence, text)
if not next_addr then
-- if #assert when we must already have asserted in text_to_mem, no need to re-assert
-- we will return deserialized text sequence and nil
break
end
end
return text_sequence, next_addr
end
return deserialize
|
--[[
Cron.lua
Timed Tasks Manager
Copyright (c) 2021 psiberx
]]
local Cron = {}
local timers = { version = '1.0.1' }
local counter = 0
---@param timeout number
---@param recurring boolean
---@param callback function
---@param args
---@return any
local function addTimer(timeout, recurring, callback, args)
if type(timeout) ~= 'number' then
return
end
if timeout <= 0 then
return
end
if type(recurring) ~= 'boolean' then
return
end
if type(callback) ~= 'function' then
if type(args) == 'function' then
callback, args = args, callback
else
return
end
end
if type(args) ~= 'table' then
args = { arg = args }
end
counter = counter + 1
local timer = {
id = counter,
callback = callback,
recurring = recurring,
timeout = timeout,
active = true,
delay = timeout,
args = args,
}
if args.id == nil then
args.id = timer.id
end
if args.interval == nil then
args.interval = timer.timeout
end
if args.Halt == nil then
args.Halt = Cron.Halt
end
if args.Pause == nil then
args.Pause = Cron.Pause
end
if args.Resume == nil then
args.Resume = Cron.Resume
end
table.insert(timers, timer)
return timer.id
end
---@param timeout number
---@param callback function
---@param data
---@return any
function Cron.After(timeout, callback, data)
return addTimer(timeout, false, callback, data)
end
---@param timeout number
---@param callback function
---@param data
---@return any
function Cron.Every(timeout, callback, data)
return addTimer(timeout, true, callback, data)
end
---@param timerId any
---@return void
function Cron.Halt(timerId)
if type(timerId) == 'table' then
timerId = timerId.id
end
for i, timer in ipairs(timers) do
if timer.id == timerId then
table.remove(timers, i)
break
end
end
end
---@param timerId any
---@return void
function Cron.Pause(timerId)
if type(timerId) == 'table' then
timerId = timerId.id
end
for _, timer in ipairs(timers) do
if timer.id == timerId then
timer.active = false
break
end
end
end
---@param timerId any
---@return void
function Cron.Resume(timerId)
if type(timerId) == 'table' then
timerId = timerId.id
end
for _, timer in ipairs(timers) do
if timer.id == timerId then
timer.active = true
break
end
end
end
---@param delta number
---@return void
function Cron.Update(delta)
if #timers > 0 then
for i, timer in ipairs(timers) do
if timer.active then
timer.delay = timer.delay - delta
if timer.delay <= 0 then
if timer.recurring then
timer.delay = timer.delay + timer.timeout
else
table.remove(timers, i)
i = i - 1
end
timer.callback(timer.args)
end
end
end
end
end
return Cron
|
------------------------------------------------------------------------------
-- Normalizer class
------------------------------------------------------------------------------
local ctrl = {
nick = "normalizer",
parent = iup.WIDGET,
creation = "-",
callback = {}
}
function ctrl.setAttributes(object, param)
local handle = rawget(object, "handle")
local n = #param
for i = 1, n do
if iup.GetClass(param[i]) == "iup handle" then
object.handle.addcontrol = param[i]
end
end
iup.WIDGET.setAttributes(object, param)
end
function ctrl.createElement(class, param)
return iup.Normalizer()
end
iup.RegisterWidget(ctrl)
iup.SetClass(ctrl, "iup widget")
|
local L = BigWigs:NewBossLocale("Master Snowdrift", "koKR")
if L then
--내가 풋내기였던 시절에는 정권 지르기 한 번도 버거웠다. 하지만 수년간 뼈를 깎는 수련을 거듭한 지금은 달라!
L.stage3_yell = "내가 풋내기였던 시절에는"
end
|
--- @alias GeometryParam GeometryInstance|GeometryTable|string
|
require 'torch'
optim = {}
-- optimizations
torch.include('optim', 'sgd.lua')
torch.include('optim', 'cg.lua')
torch.include('optim', 'asgd.lua')
torch.include('optim', 'fista.lua')
torch.include('optim', 'lbfgs.lua')
torch.include('optim', 'adagrad.lua')
torch.include('optim', 'rprop.lua')
-- line search functions
torch.include('optim', 'lswolfe.lua')
-- helpers
torch.include('optim', 'polyinterp.lua')
-- tools
torch.include('optim', 'ConfusionMatrix.lua')
torch.include('optim', 'Logger.lua')
|
object_mobile_beast_master_bm_mutated_chuba_fly = object_mobile_beast_master_shared_bm_mutated_chuba_fly:new {
}
ObjectTemplates:addTemplate(object_mobile_beast_master_bm_mutated_chuba_fly, "object/mobile/beast_master/bm_mutated_chuba_fly.iff")
|
if not SERVER then return end
local function LoadGlobalServer()
print( "Loading 'global-server' addon..." )
include "globalserver/init.lua"
end
-- First time load
LoadGlobalServer()
|
return {'kohier','kohierbelasting','kohieren','kohnstamm','kohl','kohlen','kohnen','kohlmann','kohierbelastingen'}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.