content
stringlengths
5
1.05M
data:extend { { type = 'bool-setting', name = 'picker-tool-admin-only', setting_type = 'runtime-global', default_value = true, order = 'picker[admin]' } }
TTS.Admin.LocalPerms = {} TTS.Admin.LocalRoles = {} netstream.Hook('WS:Permissions/List', function(perms) TTS.Admin.LocalPerms = perms end) netstream.Hook('WS:Roles/List', function(roles) TTS.Admin.LocalRoles = roles end)
game:DefineFastFlag("LuaCatalogFixRemoveSellToastIcon", false) return function() return game:GetFastFlag("LuaCatalogFixRemoveSellToastIcon") end
local detours = {} local function Detour(tbl,key,newfunc) if (tbl[key] == nil) then return end local oldfunc = tbl[key] if (!isfunction(oldfunc)) then return end detours[key] = {tbl = tbl,oldfunc = oldfunc} tbl[key] = function(...) newfunc(...) return oldfunc(...) end end local msg = "" Detour(net,"SendToServer",function() print("NetLogger:End Message:",tostring(msg)) msg = nil end) Detour(net,"Start",function(m) msg = m if (msg != nil) then print("NetLogger:Start New Message:",tostring(msg)) end end) Detour(net,"WriteAngle",function(ang) if (msg != nil) then print("NetLogger:Writing Angle ",tostring(ang)) end end) Detour(net,"WriteBit",function(b) if (msg != nil) then print("NetLogger:Writing bit ",tostring(b)) end end) Detour(net,"WriteBool",function(bo) if (msg != nil) then print("NetLogger:Writing bool ",tostring(bo)) end end) Detour(net,"WriteColor",function(c) if (msg != nil) then print("NetLogger:Writing Color ",tostring(c)) end end) Detour(net,"WriteData",function(data) if (msg != nil) then print("NetLogger:Writing Data, see wow_data.txt in /data/") file.Write("wow_data.txt",data) end end) Detour(net,"WriteDouble",function(d) if (msg != nil) then print("NetLogger:Writing Double ",tostring(d)) end end) Detour(net,"WriteEntity",function(e) if (msg != nil) then print("NetLogger:Writing Entity ",tostring(e)) end end) Detour(net,"WriteFloat",function(f) if (msg != nil) then print("NetLogger:Writing Float ",tostring(f)) end end) Detour(net,"WriteInt",function(i,b) if (msg != nil) then print("NetLogger:Writing Int ",tostring(i),tostring(b)) end end) Detour(net,"WriteMatrix",function(m) if (msg != nil) then print("NetLogger:Writing Matrix ",tostring(m)) end end) Detour(net,"WriteNormal",function(n) if (msg != nil) then print("NetLogger:Writing Normal ",tostring(n)) end end) Detour(net,"WriteString",function(s) if (msg != nil) then print("NetLogger:Writing String ",tostring(s)) end end) Detour(net,"WriteTable",function() if (msg != nil) then print("NetLogger:Writing Table") end end) Detour(net,"WriteUInt",function(un,b) if (msg != nil) then print("NetLogger:Writing UInt ",tostring(un),tostring(b)) end end) Detour(net,"WriteVector",function(v) if (msg != nil) then print("NetLogger:Writing Vector ",tostring(v)) end end)
vr_mem_stats_table = {} vr_mem_stats_table[1] = {} vr_mem_stats_table[1].field_name = "vr_mem_stats_h_op" vr_mem_stats_table[1].ProtoField = ProtoField.int8 vr_mem_stats_table[1].base = base.DEC vr_mem_stats_table[1].append_value = { branch = { prepend = ": ", value = function (val) return sandesh_op[val] end }, subtree = { prepend = ", Operation: ", value = function (val) return sandesh_op[val] end }} vr_mem_stats_table[1].info_col = {prepend = "Operation: "} vr_mem_stats_table[1].show_when_zero = true vr_mem_stats_table[2] = {} vr_mem_stats_table[2].field_name = "vms_rid" vr_mem_stats_table[2].ProtoField = ProtoField.int16 vr_mem_stats_table[2].base = base.DEC vr_mem_stats_table[3] = {} vr_mem_stats_table[3].field_name = "vms_alloced" vr_mem_stats_table[3].ProtoField = ProtoField.int64 vr_mem_stats_table[3].base = base.DEC vr_mem_stats_table[4] = {} vr_mem_stats_table[4].field_name = "vms_freed" vr_mem_stats_table[4].ProtoField = ProtoField.int64 vr_mem_stats_table[4].base = base.DEC vr_mem_stats_table[5] = {} vr_mem_stats_table[5].field_name = "vms_assembler_table_object" vr_mem_stats_table[5].ProtoField = ProtoField.int64 vr_mem_stats_table[5].base = base.DEC vr_mem_stats_table[6] = {} vr_mem_stats_table[6].field_name = "vms_bridge_mac_object" vr_mem_stats_table[6].ProtoField = ProtoField.int64 vr_mem_stats_table[6].base = base.DEC vr_mem_stats_table[7] = {} vr_mem_stats_table[7].field_name = "vms_btable_object" vr_mem_stats_table[7].ProtoField = ProtoField.int64 vr_mem_stats_table[7].base = base.DEC vr_mem_stats_table[8] = {} vr_mem_stats_table[8].field_name = "vms_build_info_object" vr_mem_stats_table[8].ProtoField = ProtoField.int64 vr_mem_stats_table[8].base = base.DEC vr_mem_stats_table[9] = {} vr_mem_stats_table[9].field_name = "vms_defer_object" vr_mem_stats_table[9].ProtoField = ProtoField.int64 vr_mem_stats_table[9].base = base.DEC vr_mem_stats_table[10] = {} vr_mem_stats_table[10].field_name = "vms_drop_stats_object" vr_mem_stats_table[10].ProtoField = ProtoField.int64 vr_mem_stats_table[10].base = base.DEC vr_mem_stats_table[11] = {} vr_mem_stats_table[11].field_name = "vms_drop_stats_req_object" vr_mem_stats_table[11].ProtoField = ProtoField.int64 vr_mem_stats_table[11].base = base.DEC vr_mem_stats_table[12] = {} vr_mem_stats_table[12].field_name = "vms_flow_queue_object" vr_mem_stats_table[12].ProtoField = ProtoField.int64 vr_mem_stats_table[12].base = base.DEC vr_mem_stats_table[13] = {} vr_mem_stats_table[13].field_name = "vms_flow_req_object" vr_mem_stats_table[13].ProtoField = ProtoField.int64 vr_mem_stats_table[13].base = base.DEC vr_mem_stats_table[14] = {} vr_mem_stats_table[14].field_name = "vms_flow_req_path_object" vr_mem_stats_table[14].ProtoField = ProtoField.int64 vr_mem_stats_table[14].base = base.DEC vr_mem_stats_table[15] = {} vr_mem_stats_table[15].field_name = "vms_flow_hold_stat_object" vr_mem_stats_table[15].ProtoField = ProtoField.int64 vr_mem_stats_table[15].base = base.DEC vr_mem_stats_table[16] = {} vr_mem_stats_table[16].field_name = "vms_flow_link_local_object" vr_mem_stats_table[16].ProtoField = ProtoField.int64 vr_mem_stats_table[16].base = base.DEC vr_mem_stats_table[17] = {} vr_mem_stats_table[17].field_name = "vms_flow_metadata_object" vr_mem_stats_table[17].ProtoField = ProtoField.int64 vr_mem_stats_table[17].base = base.DEC vr_mem_stats_table[18] = {} vr_mem_stats_table[18].field_name = "vms_flow_table_data_object" vr_mem_stats_table[18].ProtoField = ProtoField.int64 vr_mem_stats_table[18].base = base.DEC vr_mem_stats_table[19] = {} vr_mem_stats_table[19].field_name = "vms_flow_table_info_object" vr_mem_stats_table[19].ProtoField = ProtoField.int64 vr_mem_stats_table[19].base = base.DEC vr_mem_stats_table[20] = {} vr_mem_stats_table[20].field_name = "vms_fragment_object" vr_mem_stats_table[20].ProtoField = ProtoField.int64 vr_mem_stats_table[20].base = base.DEC vr_mem_stats_table[21] = {} vr_mem_stats_table[21].field_name = "vms_fragment_queue_object" vr_mem_stats_table[21].ProtoField = ProtoField.int64 vr_mem_stats_table[21].base = base.DEC vr_mem_stats_table[22] = {} vr_mem_stats_table[22].field_name = "vms_fragment_queue_element_object" vr_mem_stats_table[22].ProtoField = ProtoField.int64 vr_mem_stats_table[22].base = base.DEC vr_mem_stats_table[23] = {} vr_mem_stats_table[23].field_name = "vms_fragment_scanner_object" vr_mem_stats_table[23].ProtoField = ProtoField.int64 vr_mem_stats_table[23].base = base.DEC vr_mem_stats_table[24] = {} vr_mem_stats_table[24].field_name = "vms_hpacket_pool_object" vr_mem_stats_table[24].ProtoField = ProtoField.int64 vr_mem_stats_table[24].base = base.DEC vr_mem_stats_table[25] = {} vr_mem_stats_table[25].field_name = "vms_htable_object" vr_mem_stats_table[25].ProtoField = ProtoField.int64 vr_mem_stats_table[25].base = base.DEC vr_mem_stats_table[26] = {} vr_mem_stats_table[26].field_name = "vms_interface_object" vr_mem_stats_table[26].ProtoField = ProtoField.int64 vr_mem_stats_table[26].base = base.DEC vr_mem_stats_table[27] = {} vr_mem_stats_table[27].field_name = "vms_interface_mac_object" vr_mem_stats_table[27].ProtoField = ProtoField.int64 vr_mem_stats_table[27].base = base.DEC vr_mem_stats_table[28] = {} vr_mem_stats_table[28].field_name = "vms_interface_req_object" vr_mem_stats_table[28].ProtoField = ProtoField.int64 vr_mem_stats_table[28].base = base.DEC vr_mem_stats_table[29] = {} vr_mem_stats_table[29].field_name = "vms_interface_req_mac_object" vr_mem_stats_table[29].ProtoField = ProtoField.int64 vr_mem_stats_table[29].base = base.DEC vr_mem_stats_table[30] = {} vr_mem_stats_table[30].field_name = "vms_interface_req_name_object" vr_mem_stats_table[30].ProtoField = ProtoField.int64 vr_mem_stats_table[30].base = base.DEC vr_mem_stats_table[31] = {} vr_mem_stats_table[31].field_name = "vms_interface_stats_object" vr_mem_stats_table[31].ProtoField = ProtoField.int64 vr_mem_stats_table[31].base = base.DEC vr_mem_stats_table[32] = {} vr_mem_stats_table[32].field_name = "vms_interface_table_object" vr_mem_stats_table[32].ProtoField = ProtoField.int64 vr_mem_stats_table[32].base = base.DEC vr_mem_stats_table[33] = {} vr_mem_stats_table[33].field_name = "vms_interface_vrf_table_object" vr_mem_stats_table[33].ProtoField = ProtoField.int64 vr_mem_stats_table[33].base = base.DEC vr_mem_stats_table[34] = {} vr_mem_stats_table[34].field_name = "vms_itable_object" vr_mem_stats_table[34].ProtoField = ProtoField.int64 vr_mem_stats_table[34].base = base.DEC vr_mem_stats_table[35] = {} vr_mem_stats_table[35].field_name = "vms_malloc_object" vr_mem_stats_table[35].ProtoField = ProtoField.int64 vr_mem_stats_table[35].base = base.DEC vr_mem_stats_table[36] = {} vr_mem_stats_table[36].field_name = "vms_message_object" vr_mem_stats_table[36].ProtoField = ProtoField.int64 vr_mem_stats_table[36].base = base.DEC vr_mem_stats_table[37] = {} vr_mem_stats_table[37].field_name = "vms_message_response_object" vr_mem_stats_table[37].ProtoField = ProtoField.int64 vr_mem_stats_table[37].base = base.DEC vr_mem_stats_table[38] = {} vr_mem_stats_table[38].field_name = "vms_message_dump_object" vr_mem_stats_table[38].ProtoField = ProtoField.int64 vr_mem_stats_table[38].base = base.DEC vr_mem_stats_table[39] = {} vr_mem_stats_table[39].field_name = "vms_mem_stats_req_object" vr_mem_stats_table[39].ProtoField = ProtoField.int64 vr_mem_stats_table[39].base = base.DEC vr_mem_stats_table[40] = {} vr_mem_stats_table[40].field_name = "vms_mirror_object" vr_mem_stats_table[40].ProtoField = ProtoField.int64 vr_mem_stats_table[40].base = base.DEC vr_mem_stats_table[41] = {} vr_mem_stats_table[41].field_name = "vms_mirror_table_object" vr_mem_stats_table[41].ProtoField = ProtoField.int64 vr_mem_stats_table[41].base = base.DEC vr_mem_stats_table[42] = {} vr_mem_stats_table[42].field_name = "vms_mirror_meta_object" vr_mem_stats_table[42].ProtoField = ProtoField.int64 vr_mem_stats_table[42].base = base.DEC vr_mem_stats_table[43] = {} vr_mem_stats_table[43].field_name = "vms_mtrie_object" vr_mem_stats_table[43].ProtoField = ProtoField.int64 vr_mem_stats_table[43].base = base.DEC vr_mem_stats_table[44] = {} vr_mem_stats_table[44].field_name = "vms_mtrie_bucket_object" vr_mem_stats_table[44].ProtoField = ProtoField.int64 vr_mem_stats_table[44].base = base.DEC vr_mem_stats_table[45] = {} vr_mem_stats_table[45].field_name = "vms_mtrie_stats_object" vr_mem_stats_table[45].ProtoField = ProtoField.int64 vr_mem_stats_table[45].base = base.DEC vr_mem_stats_table[46] = {} vr_mem_stats_table[46].field_name = "vms_mtrie_table_object" vr_mem_stats_table[46].ProtoField = ProtoField.int64 vr_mem_stats_table[46].base = base.DEC vr_mem_stats_table[47] = {} vr_mem_stats_table[47].field_name = "vms_network_address_object" vr_mem_stats_table[47].ProtoField = ProtoField.int64 vr_mem_stats_table[47].base = base.DEC vr_mem_stats_table[48] = {} vr_mem_stats_table[48].field_name = "vms_nexthop_object" vr_mem_stats_table[48].ProtoField = ProtoField.int64 vr_mem_stats_table[48].base = base.DEC vr_mem_stats_table[49] = {} vr_mem_stats_table[49].field_name = "vms_nexthop_component_object" vr_mem_stats_table[49].ProtoField = ProtoField.int64 vr_mem_stats_table[49].base = base.DEC vr_mem_stats_table[50] = {} vr_mem_stats_table[50].field_name = "vms_nexthop_req_list_object" vr_mem_stats_table[50].ProtoField = ProtoField.int64 vr_mem_stats_table[50].base = base.DEC vr_mem_stats_table[51] = {} vr_mem_stats_table[51].field_name = "vms_nexthop_req_encap_object" vr_mem_stats_table[51].ProtoField = ProtoField.int64 vr_mem_stats_table[51].base = base.DEC vr_mem_stats_table[52] = {} vr_mem_stats_table[52].field_name = "vms_nexthop_req_object" vr_mem_stats_table[52].ProtoField = ProtoField.int64 vr_mem_stats_table[52].base = base.DEC vr_mem_stats_table[53] = {} vr_mem_stats_table[53].field_name = "vms_route_table_object" vr_mem_stats_table[53].ProtoField = ProtoField.int64 vr_mem_stats_table[53].base = base.DEC vr_mem_stats_table[54] = {} vr_mem_stats_table[54].field_name = "vms_route_req_mac_object" vr_mem_stats_table[54].ProtoField = ProtoField.int64 vr_mem_stats_table[54].base = base.DEC vr_mem_stats_table[55] = {} vr_mem_stats_table[55].field_name = "vms_timer_object" vr_mem_stats_table[55].ProtoField = ProtoField.int64 vr_mem_stats_table[55].base = base.DEC vr_mem_stats_table[56] = {} vr_mem_stats_table[56].field_name = "vms_usock_object" vr_mem_stats_table[56].ProtoField = ProtoField.int64 vr_mem_stats_table[56].base = base.DEC vr_mem_stats_table[57] = {} vr_mem_stats_table[57].field_name = "vms_usock_poll_object" vr_mem_stats_table[57].ProtoField = ProtoField.int64 vr_mem_stats_table[57].base = base.DEC vr_mem_stats_table[58] = {} vr_mem_stats_table[58].field_name = "vms_usock_buf_object" vr_mem_stats_table[58].ProtoField = ProtoField.int64 vr_mem_stats_table[58].base = base.DEC vr_mem_stats_table[59] = {} vr_mem_stats_table[59].field_name = "vms_usock_iovec_object" vr_mem_stats_table[59].ProtoField = ProtoField.int64 vr_mem_stats_table[59].base = base.DEC vr_mem_stats_table[60] = {} vr_mem_stats_table[60].field_name = "vms_vrouter_req_object" vr_mem_stats_table[60].ProtoField = ProtoField.int64 vr_mem_stats_table[60].base = base.DEC vr_mem_stats_table[61] = {} vr_mem_stats_table[61].field_name = "vms_interface_fat_flow_config_object" vr_mem_stats_table[61].ProtoField = ProtoField.int64 vr_mem_stats_table[61].base = base.DEC vr_mem_stats_table[62] = {} vr_mem_stats_table[62].field_name = "vms_qos_map_object" vr_mem_stats_table[62].ProtoField = ProtoField.int64 vr_mem_stats_table[62].base = base.DEC vr_mem_stats_table[63] = {} vr_mem_stats_table[63].field_name = "vms_fc_object" vr_mem_stats_table[63].ProtoField = ProtoField.int64 vr_mem_stats_table[63].base = base.DEC vr_mem_stats_table[64] = {} vr_mem_stats_table[64].field_name = "vms_interface_mirror_meta_object" vr_mem_stats_table[64].ProtoField = ProtoField.int64 vr_mem_stats_table[64].base = base.DEC vr_mem_stats_table[65] = {} vr_mem_stats_table[65].field_name = "vms_interface_req_mirror_meta_object" vr_mem_stats_table[65].ProtoField = ProtoField.int64 vr_mem_stats_table[65].base = base.DEC vr_mem_stats_table[66] = {} vr_mem_stats_table[66].field_name = "vms_interface_bridge_lock_object" vr_mem_stats_table[66].ProtoField = ProtoField.int64 vr_mem_stats_table[66].base = base.DEC vr_mem_stats_table[67] = {} vr_mem_stats_table[67].field_name = "vms_interface_queue_object" vr_mem_stats_table[67].ProtoField = ProtoField.int64 vr_mem_stats_table[67].base = base.DEC vr_mem_stats_table[68] = {} vr_mem_stats_table[68].field_name = "vms_interface_req_pbb_mac_object" vr_mem_stats_table[68].ProtoField = ProtoField.int64 vr_mem_stats_table[68].base = base.DEC vr_mem_stats_table[69] = {} vr_mem_stats_table[69].field_name = "vms_nexthop_req_bmac_object" vr_mem_stats_table[69].ProtoField = ProtoField.int64 vr_mem_stats_table[69].base = base.DEC vr_mem_stats_table[70] = {} vr_mem_stats_table[70].field_name = "vms_interface_req_bridge_id_object" vr_mem_stats_table[70].ProtoField = ProtoField.int64 vr_mem_stats_table[70].base = base.DEC vr_mem_stats_table[71] = {} vr_mem_stats_table[71].field_name = "vms_interface_fat_flow_ipv4_exclude_list_object" vr_mem_stats_table[71].ProtoField = ProtoField.int64 vr_mem_stats_table[71].base = base.DEC vr_mem_stats_table[72] = {} vr_mem_stats_table[72].field_name = "vms_interface_fat_flow_ipv6_exclude_list_object" vr_mem_stats_table[72].ProtoField = ProtoField.int64 vr_mem_stats_table[72].base = base.DEC
-- Read and step through dialogue trees created from Dialogger tool. -- http://stewart.bracken.bz/storage/Dialogger/ local DialogueOp = require "dialogue_op_def" local VarState = require "variablestate" local M = {} M.TNODE_TEXT = "Text" M.TNODE_NODE = "Node" M.TNODE_CHOICE = "Choice" M.TNODE_SET = "Set" M.TNODE_BRANCH = "Branch" ---------------------------------------------------- -- underscore copy local function iter(list_or_iter) if type(list_or_iter) == "function" then return list_or_iter end return coroutine.wrap(function() for i = 1, #list_or_iter do coroutine.yield(list_or_iter[i]) end end) end local function map(list, func) local mapped = {} for i in iter(list) do mapped[#mapped + 1] = func(i) end return mapped end local function extend(dest, src) for k, v in pairs(src) do dest[k] = v end return dest end ---------------------------------------------------- local function validate_node(node) if not node.id then error("A node is missing it's id. Object #" .. i .. " in " .. file) end end local function increment_reference(referenced_id, ref_table) ref_table[referenced_id] = (ref_table[referenced_id] or 0) + 1 end local function add_reference(node, ref_table) if node.next then increment_reference(node.next, ref_table) elseif node.choices then for i, choice_id in ipairs(node.choices) do increment_reference(choice_id, ref_table) end elseif node.branches then for branch_name, branch_id in pairs(node.branches) do increment_reference(branch_id, ref_table) end end end local function start_nodes(id_table, references_table) local start_nodes = {} for id, _ in pairs(id_table) do if not references_table[id] then table.insert(start_nodes, id_table[id]) end end return start_nodes end -- dl_save_json is a string with dialogger game save string contents function M.load(dl_json_table) --json should be array of object for game version save if type(dl_json_table) ~= "table" then error("expected a table representation of dialogger JSON game export format.") end --if it's not a list of objects, then it's wrong local nodes = dl_json_table local id_table = {} local references_table = {} for _, node in ipairs(nodes) do --per node logic validate_node(node) id_table[node.id] = node add_reference(node, references_table) end local start_nodes = start_nodes(id_table, references_table) if #start_nodes ~= 1 then error("The dialogue tree has too many beginning nodes.") end return { start_node = start_nodes[1], id_table = id_table, file = file } end -- Returns a list of tables with id and name properties local function collect_choice_nodes(choices, tree) return map(choices, function(i) local node = tree.id_table[i] return { id = node.id, name = node.name } end) end local function nodeToString(node) return node.type .. "[" .. node.id .. "]" end local function missingChoiceError(node, tree) error("Choice selection is required when executing node '" .. nodeToString(node) .. "' in file: " .. tree.file) end local function copy_node(node) return extend({}, node) end local function get_branch_next(node, game_context) local next_node_id if DialogueOp.branch_has_op(node.variable) then next_node_id = DialogueOp.get_op_branch_next_id(node, game_context) else next_node_id = node.branches[game_context.get(node.variable)] end if not next_node_id then next_node_id = node.branches["_default"] end return next_node_id end local function execute_node(head, tree, game_context) if not head then return end game_context.visit(copy_node(head)) --for hosuekeeping or anything clearing the current text / choices local next_node_id = nil local node_type = head.type if node_type == M.TNODE_NODE then if head.choices then game_context.choices(collect_choice_nodes(head.choices, tree)) end local choice = coroutine.yield() if head.choices then if not choice then return missingChoiceError(head, tree) end local choice_id = type(choice) == "string" and choice or choice.id next_node_id = tree.id_table[choice_id].next else next_node_id = head.next end elseif node_type == M.TNODE_TEXT then game_context.text(head.name) if head.choices then game_context.choices(collect_choice_nodes(head.choices, tree)) end local choice = coroutine.yield() if head.choices then if not choice then return missingChoiceError(head, tree) end local choice_id = type(choice) == "string" and choice or choice.id next_node_id = tree.id_table[choice_id].next else next_node_id = head.next end elseif node_type == M.TNODE_SET then game_context.set(head.variable, head.value) next_node_id = head.next elseif node_type == M.TNODE_BRANCH then next_node_id = get_branch_next(head, game_context) end if next_node_id then execute_node(tree.id_table[next_node_id], tree, game_context) end end --create a tree_execution that steps through the dialogue tree. -- parameters is the tree table from load -- game_context is the client interface for callbacks to show text, choices, and set/get variables -- game_context should have four methods, -- get(var_name) -- set(var_name, string_value) -- choice(choice_list) -- visit(node_table) -- called just before any node is executed -- text(text_node_name) function M.begin(tree, game_context) return coroutine.create(function() -- execute start nodes (only one for first iteration; error if more than one for now) local head = tree.start_node execute_node(head, tree, game_context) end) end -- usage: do .. while not M.finished(tree_execution) function M.finished(tree_execution) return coroutine.status(tree_execution) == "dead" end --choice_selection is an optional string if the tree is expecting a choice to be made. It is the string id or the table function M.next(tree_execution, choice_selection_idstr_or_table) if M.finished(tree_execution) then error("Error calling next(), this dialogue tree is already finished.") end local status, err = coroutine.resume(tree_execution, choice_selection_idstr_or_table) if not status then error(err) end end -- Returns an empty game context with a variablestate setup and returned as second return value function M.new_game_context() local vars = VarState() return { visit = function(n) end, choices = function(choice_list) end, text = function(text_node) end, set = function(var_name, value) vars:set(var_name, value) end, get = function(var_name) return vars:get(var_name) end, get_numeric = function(var_name) return vars:get_numeric(var_name) end, is_numeric = function(var_name) return vars:is_numeric(var_name) end }, vars end return M
local cURL = require("lcurl") local post = cURL.form() -- post file from filesystem :add_file ("name", "post.lua", "text/plain") -- post file from data variable :add_buffer("name2", "dummy.html", "<html><bold>bold</bold></html>", "text/html") cURL.easy() :setopt_url("http://localhost") :setopt_httppost(post) :perform() :close() -- Lua-cURL compatiable function local function post(e, data) local form = cURL.form() local ok, err = true for k, v in pairs(data) do if type(v) == "string" then ok, err = form:add_content(k, v) else assert(type(v) == "table") if v.stream_length then form:free() error("Stream does not support") end if v.data then ok, err = form:add_buffer(k, v.file, v.data, v.type, v.headers) else ok, err = form:add_file(k, v.file, v.data, v.type, v.filename, v.headers) end end if not ok then break end end if not ok then form:free() return nil, err end ok, err = e:setopt_httppost(form) if not ok then form:free() return nil, err end return e end local e = cURL.easy() :setopt_url("http://localhost") postdata = { -- post file from filesystem name = {file="post.lua", type="text/plain" }, -- post file from data variable name2 = {file="dummy.html", data="<html><bold>bold</bold></html>", type="text/html" }, } post(e, postdata):perform() print("Done")
-- View whether tiles on the map can be pathed to --[====[ gui/pathable ============ Highlights each visible map tile to indicate whether it is possible to path to from the tile at the cursor - green if possible, red if not, similar to `gui/siege-engine`. A few options are available: * :kbd:`l`: Lock cursor: when enabled, the movement keys move around the map instead of moving the cursor. This is useful to check whether parts of the map far away from the cursor can be pathed to from the cursor. * :kbd:`d`: Draw: allows temporarily disabling the highlighting entirely. * :kbd:`u`: Skip unrevealed: when enabled, unrevealed tiles will not be highlighed at all. (These would otherwise be highlighted in red.) .. note:: This tool uses a cache used by DF, which currently does *not* account for climbing. If an area of the map is only accessible by climbing, this tool may report it as inaccessible. Care should be taken when digging into the upper levels of caverns, for example. ]====] local guidm = require 'gui.dwarfmode' local plugin = require 'plugins.pathable' opts = opts or { lock_cursor = false, draw = true, skip_unrevealed = false, } function render_toggle(p, key, text, state) p:key_string(key, text .. ': ') p:string(state and 'Yes' or 'No', state and COLOR_GREEN or COLOR_RED) end Pathable = defclass(Pathable, guidm.MenuOverlay) function Pathable:onAboutToShow(parent) if df.global.cursor.x == -30000 then if df.global.ui.main.mode == df.ui_sidebar_mode.Default then parent:feed_key(df.interface_key.D_LOOK) else qerror("Unsupported UI mode - needs a cursor") end end Pathable.super.onAboutToShow(self, parent) end function Pathable:onRenderBody(p) local cursor = df.global.cursor local block = dfhack.maps.getTileBlock(pos2xyz(cursor)) p:seek(1, 1) p:string("DFHack pathable tile viewer"):newline():newline(1) render_toggle(p, 'CUSTOM_L', 'Lock cursor', opts.lock_cursor) p:newline(1) render_toggle(p, 'CUSTOM_D', 'Draw', opts.draw) p:newline(1) render_toggle(p, 'CUSTOM_U', 'Skip unrevealed', opts.skip_unrevealed) p:newline():newline(1) p:key_string('LEAVESCREEN', "Exit to cursor"):newline(1) p:key_string('LEAVESCREEN_ALL', "Exit to here"):newline(1) p:newline(1) p:string('Group: ' .. block.walkable[cursor.x % 16][cursor.y % 16]) p:newline(1) p:string(df.tiletype[block.tiletype[cursor.x % 16][cursor.y % 16]], COLOR_CYAN) if opts.draw then plugin.paintScreen(xyz2pos(pos2xyz(cursor)), opts.skip_unrevealed) end end function Pathable:onInput(keys) if keys.LEAVESCREEN then self:dismiss() dfhack.gui.refreshSidebar() elseif keys.LEAVESCREEN_ALL then self:dismiss() df.global.ui.main.mode = df.ui_sidebar_mode.Default elseif keys.CUSTOM_L then opts.lock_cursor = not opts.lock_cursor elseif keys.CUSTOM_D then opts.draw = not opts.draw elseif keys.CUSTOM_U then opts.skip_unrevealed = not opts.skip_unrevealed else if opts.lock_cursor then -- no_clip_cursor=true: allow scrolling so the cursor isn't in view self:simulateViewScroll(keys, nil, true) else self:propagateMoveKeys(keys) end end end Pathable():show()
local Component = require "component" local Progression = Component:extend() Progression.name = "Progression" Progression.requirements = {components.Stats} function Progression:initialize(actor) actor.level = 1 actor.feats = {} actor:addAction(actions.LevelUp) end return Progression
-- NetHack 3.7 Sovereign.des -- Copyright (c) 1989 by Jean-Christophe Collet -- Copyright (c) 1991-2 by M. Stephenson -- NetHack may be freely redistributed. See license for details. -- des.level_init({ style = "solidfill", fg = "," }); des.level_flags("mazelevel", "noflip") des.region(selection.area(00,00,79,20), "lit") -- Biased drunk man's walk to reach the stairs local arr = {} local startx = 75 local starty = 3 + math.random(0,14) local x = 75 local y = starty local dx = -1 local dy = 0 while x > 3 do des.replace_terrain({ region={x-2,y-2,x+2,y+2}, fromterrain=",", toterrain=".", chance=100 }) x = x + dx y = y + dy y = math.max(3, math.min(y, 17)) if y < 3 then y = 3 dy = 1 end if y > 17 then y = 17 dy = -1 end if percent(50) then dx = dx + math.random(0, 2) - 1 end if percent(50) then dy = dy + math.random(0, 2) - 1 end if dx < -2 then dx = -2 end if dx > 0 then dx = 0 end if dy > 2 then dy = 2 end if dy < -2 then dy = -2 end end des.replace_terrain({ region={x-2,y-2,x+2,y+2}, fromterrain=",", toterrain=".", chance=100 }) des.replace_terrain({ region={0,0,80,20}, fromterrain=",", toterrain="T", chance=60 }) des.replace_terrain({ region={0,0,80,20}, fromterrain=",", toterrain="#", chance=100 }) des.stair("up", startx, starty) des.stair("down", x, y) -- Animals; these can be anywhere on the map. des.monster({ id = "raven", peaceful = 0}) des.monster({ id = "boar", peaceful = 0}) des.monster({ id = "boar", peaceful = 0}) des.monster({ id = "snake", peaceful = 0}) des.monster({ id = "wolf", peaceful = 0}) des.monster({ id = "wolf", peaceful = 0}) des.monster({ id = "wolf", peaceful = 0}) des.monster({ id = "wolf", peaceful = 0}) des.monster({ id = "wolf", peaceful = 0}) -- Now turn the grass tiles back from corridors so everything else lands on the road des.replace_terrain({ region={0,0,80,20}, fromterrain="#", toterrain=",", chance=100 }) des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.object() des.trap("pit") des.trap("pit") if percent(50) then des.monster({ id = "rogue", peaceful = 0}) else des.monster({ id = "convict", peaceful = 0}) end --
local game_scene = class("game_scene", cc.Layer) local public_module = require("app.public.util.public_module") local event_manager = require("app.public.util.event_manager") local layer_main = require("app.views.layer.layer_main") function game_scene:ctor() self:setPosition(display.cx, display.cy) self.layer_main = layer_main.new() self:addChild(self.layer_main) end return game_scene
local cfg = require("config").entity.stardust local util = require("util") local hexagon = require("hexagon") local core = require("core") local buff = require("buff") local function buff_charge(charge) return { name = "buff.stardust.charge", initial = function(self) local entity = self.owner local p = buff.remove(entity, "buff.stardust.charge") if p then local val = cfg.charge.damage(p.charge, charge) core.damage(entity, { damage = val, element = "light", }) return false end self.charge = charge return charge > 0 end, tick = {{ core.priority.stat, function(self) if self.charge <= cfg.charge.dissipate then return false end self.charge = self.charge - cfg.charge.dissipate return true end }} } end local quiver = { name = "quiver.light", element = "light", cost = cfg.quiver.single.cost, range = cfg.quiver.single.range, shots = cfg.quiver.single.shots, single = function(entity, target) entity.map:damage(entity, target, cfg.quiver.single.damage, buff.insert, buff_charge, cfg.quiver.single.charge) end, area = function(entity, area) entity.map:damage(entity, area, cfg.quiver.area.damage, buff.insert, buff_charge, cfg.quiver.area.charge) end, } local buff_generator = { name = "buff.stardust.generator", tick = {{ core.priority.first, function(self) local entity = self.owner if not entity.status.down then local src = entity.map:layer_get("light", entity.pos, "source") local val = 0 for k, v in pairs(src) do local dis = hexagon.distance(v.pos, entity.pos, cfg.generator.range) if dis then val = val + v.energy / (dis + 1) ^ cfg.generator.exp end end entity.generator = math.floor(val) end return true end }}, defer = { core.priority.stat, function(self) local entity = self.owner if not entity.status.down then local energy = entity.energy for i = 1, #entity.inventory, 1 do local item = entity.inventory[i] if not item.active then local need = item.energy_cap - item.energy if energy > need then energy = energy - need item.energy = item.energy_cap else item.energy = item.energy + energy energy = 0 break end end end end entity.energy = 0 end, } } local buff_hover = { name = "buff.stardust.hover", cost = cfg.skill.hover.cost, power = cfg.skill.hover.power_req, tick = {{ core.priority.fly, function(self) local entity = self.owner if entity.status.down or entity.generator < self.cost then entity.hover = false end if entity.power < self.power then entity.hover = false end if entity.hover then entity.generator = entity.generator - self.cost entity.status.fly = true end return true end, }} } local skill_move = { name = "skill.stardust.move", type = "waypoint", remain = 0, update = function(self) local entity = self.owner if entity.hover then util.merge_table(self, cfg.skill.move.hover) else util.merge_table(self, cfg.skill.move.ground) end self.enable = core.skill_update(self) and not entity.moved end, use = function(self, waypoint) local entity = self.owner if #waypoint == 0 or #waypoint > self.step then return false end local res = core.move(entity, waypoint) if res then entity.moved = true end return res end, } local skill_attack = util.merge_table({ name = "skill.stardust.attack", type = "target", remain = 0, update = function(self) local entity = self.owner local has_lance = false for i = 1, 2, 1 do local item = entity.inventory[i] if item.energy == item.energy_cap then has_lance = true end end self.enable = core.skill_update(self) and has_lance end, use = function(self, target) local entity = self.owner if not hexagon.distance(entity.pos, target, self.range) then return false end entity.map:damage(entity, { target }, self.damage, buff.insert, buff_charge, entity.power * self.damage.ratio * self.charge_rate) for i = 1, 2, 1 do local item = entity.inventory[i] if item.energy == item.energy_cap then item.energy = 0 break end end return true end, }, cfg.skill.attack) local skill_hover = { name = "skill.stardust.hover", type = "toggle", cooldown = cfg.skill.hover.cooldown, remain = 0, enable = true, power_req = cfg.skill.hover.power_req, update = function(self) local entity = self.owner if entity.hover then self.cost = 0 else self.cost = cfg.skill.hover.cost end self.enable = core.skill_update(self) and not entity.moved end, use = function(self) local entity = self.owner if entity.hover then entity.hover = false entity.status.fly = nil else entity.hover = true entity.status.fly = true end return true end, } local skill_teleport = util.merge_table({ name = "skill.stardust.teleport", remain = 0, update = function(self) local entity = self.owner local mirror = entity.inventory[3] local active = false if mirror.portal then self.type = "effect" active = not entity.moved else self.type = "target" active = (mirror.energy == mirror.energy_cap) end self.enable = core.skill_update(self) and active end, use = function(self, target) local entity = self.owner local mirror = entity.inventory[3] if mirror.portal then local e = entity.map:get(mirror.portal) if e and e.team == entity.team then e.pos, entity.pos = entity.pos, e.pos elseif not core.teleport(entity, mirror.portal) then return false end mirror.active = nil mirror.portal = nil return true end if hexagon.distance(entity.pos, target, 1) then return false end local orig_pos = entity.pos if not core.teleport(entity, target) then return false end if entity.hover then mirror.energy = mirror.energy_cap * (1 - self.energy_cost.solo) mirror.portal = orig_pos mirror.active = self.portal_duration else for d = 1, 6, 1 do local p = hexagon.direction(orig_pos, d) local e = entity.map:get(p) if e and e.team == entity.team and (e.free_ultimate or not e.status.ultimate) then local t = hexagon.direction(entity.pos, d) core.teleport(e, t) end end mirror.energy = mirror.energy_cap * (1 - self.energy_cost.group) end return true end, }, cfg.skill.teleport) local skill_blackhole = util.merge_table({ name = "skill.stardust.blackhole", type = "target", remain = 0, update = function(self) local entity = self.owner local mirror = entity.inventory[3] self.enable = core.skill_update(self) and (mirror.energy == mirror.energy_cap) end, use = function(self, target) local entity = self.owner local mirror = entity.inventory[3] if not hexagon.distance(entity.pos, target, self.range) then return false end local info = { team = entity.team, pos = target, radius = self.radius, duration = self.duraion, power = entity.power * self.power_ratio, crush_threshold = self.crush_threshold, } entity.map:layer_set("light", "blackhole", info) mirror.energy = mirror.energy_cap * (1 - self.energy_cost) mirror.active = self.duration return true end, }, cfg.skill.blackhole) local skill_lazer = util.merge_table({ name = "skill.stardust.lazer", type = "direction", remain = 0, update = function(self) local entity = self.owner local prism = entity.inventory[4] self.enable = core.skill_update(self) and (prism.energy >= prism.energy_cap * self.threshold) end, use = function(self, direction) local entity = self.owner local prism = entity.inventory[4] local area = hexagon.line(entity.pos, direction, 2 * (entity.map.scale + 1)) local d = prism.energy * self.efficiency entity.map:damage(entity, area, { damage = d, element = "light", }, buff.insert, buff_charge, d * self.charge_rate) prism.energy = 0 return true end, }, cfg.skill.lazer) local skill_starfall = util.merge_table({ name = "skill.stardust.starfall", type = "target", remain = 0, update = function(self) local entity = self.owner local has_lance = false for i = 1, 2, 1 do local item = entity.inventory[i] if item.energy == item.energy_cap then has_lance = true end end self.enable = core.skill_update(self) and has_lance end, use = function(self, target) local entity = self.owner buff.insert(entity, { name = "buff.stardust.starfall", target = target, power = entity.power, duration = 0, detonate_cfg = { damage = self.damage, trigger_radius = trigger_radius, }, defer = { core.priority.last, function(self) local entity = self.owner entity.map:layer_set("light", "detonate", self.target, self.detonate_cfg, self.power) end, } }) for i = 1, 2, 1 do local item = entity.inventory[i] if item.energy == item.energy_cap then item.energy = 0 break end end self.energy = 0 entity.hover = false entity.status.fly = nil entity.status.down = true buff.insert(entity, "down", self.down_duration) return true end, }, cfg.skill.starfall) return function() local stardust = core.new_character("entity.stardust", cfg.template, { skill_move, skill_attack, skill_hover, skill_teleport, skill_blackhole, skill_lazer, skill_starfall, }) stardust.quiver = quiver stardust.hover = false for i = 1, 2, 1 do table.insert(stardust.inventory, { name = "item.stardust.lance", energy_cap = cfg.item.lance.energy_cap, energy = cfg.item.lance.initial, tick = function(self) end, }) end table.insert(stardust.inventory, { name = "item.stardust.mirror", energy_cap = cfg.item.mirror.energy_cap, energy = cfg.item.mirror.initial, tick = function(self) if self.active and self.active > 0 then self.active = self.active - 1 else self.active = nil self.portal = nil end end, }) table.insert(stardust.inventory, { name = "item.stardust.prism", energy_cap = cfg.item.prism.energy_cap, energy = cfg.item.prism.initial, tick = function(self) end, }) buff.insert_notick(stardust, buff_generator) buff.insert_notick(stardust, buff_hover) return stardust end
local V = { Name = "Lotus Exige S Roadster", Class = "prop_vehicle_jeep", Category = "LW Cars", Author = "LoneWolfie", Information = "Driveable lotus by LoneWolfie", Model = "models/LoneWolfie/lotus_exiges_roadster.mdl", //Vehicle Controller KeyValues = { vehiclescript = "scripts/vehicles/LWCars/lotus_exiges_roadster.txt" } } list.Set("Vehicles", "lotus_exiges_roadster_lw", V)
-- convert permaprop to this system --[[ local tbl = sql.Query("SELECT * FROM permaprops") for k, v in pairs(tbl) do json = util.JSONToTable(v.content) print(string.format("{ent = '%s', pos = %s, ang = %s},", json.Class, "Vector("..json.Pos.x..", "..json.Pos.y..", "..json.Pos.z..")", "Angle("..json.Angle.p..", "..json.Angle.y..", "..json.Angle.r..")")) end ]]-- -- TODO -- Patrols -- UPS -- Trucker -- Racing -- Trash/Dumpsters -- Fire local propsToSpawn = { ["rp_rockford_v2b_xyz_v1a"] = { -- Spawn text screens {ent = 'lite_text', pos = Vector(-5219.1875, -6003.78125, 57.812496185303), ang = Angle(0, 0, 90), custom = function(ent) ent.data.text = {"SPAWN ENDS HERE", "‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾"} ent.data.color = {Color(255, 255, 255), Color(255, 0, 0)} ent.data.size = {100, 100} end}, {ent = 'lite_text', pos = Vector(-4643, -6001.8125, 56.65625), ang = Angle(0, -0.10986328125, 90), custom = function(ent) ent.data.text = {"SPAWN ENDS HERE", "‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾"} ent.data.color = {Color(255, 255, 255), Color(255, 0, 0)} ent.data.size = {100, 100} end}, {ent = 'lite_text', pos = Vector(-4066.6560058594, -6004.09375, 58.09375), ang = Angle(0, 0.0054931640625, 90), custom = function(ent) ent.data.text = {"SPAWN ENDS HERE", "‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾"} ent.data.color = {Color(255, 255, 255), Color(255, 0, 0)} ent.data.size = {100, 100} end}, -- City Hall / Spawn {ent = 'xyz_auction_house', pos = Vector(-4542.40625, -4597.3125, 64.125), ang = Angle(0, -88.319091796875, 0)}, {ent = 'xyz_dmv', pos = Vector(-4607.375, -4595.5, 64.375), ang = Angle(0, -90.28564453125, 0)}, {ent = 'xyz_wep_skins', pos = Vector(-4671.8125, -4598.96875, 64.59375), ang = Angle(0, -99.860229492188, 0)}, {ent = 'xyz_election', pos = Vector(-4737.8125, -4598.96875, 64.78125), ang = Angle(0, -90.313110351563, 0)}, -- Bank {ent = 'xyz_banker_npc', pos = Vector(-3959, -3094.625, 67.9375), ang = Angle(0, 0, 0)}, -- President Office {ent = 'xyz_president_tax', pos = Vector(-3995.5, -4725.84375, 768.65625), ang = Angle(-0.2691650390625, 122.50854492188, 0.1153564453125)}, {ent = 'prop_physics', pos = Vector(-4024.1875, -4721.15625, 720.4375), ang = Angle(0, 0, 0), model = "models/props/cs_militia/wood_table.mdl"}, {ent = 'xyz_president_comp', pos = Vector(-3869.5, -5063.46875, 720.46875), ang = Angle(0.0274658203125, 134.18151855469, 0)}, -- Cardealership {ent = 'xyz_misc_car_dealer', pos = Vector(-2795.53125, -1481.03125, 0.625), ang = Angle(0, 180, 0)}, {ent = 'xyz_dmv', pos = Vector(-4201.28125, -668, 0.1875), ang = Angle(0, -90, 0)}, {ent = 'xyz_car_dealer', pos = Vector(-4636.90625, -668.84375, 0.1875), ang = Angle(0, -90, 0)}, -- Police Department {ent = 'police_exam_npc', pos = Vector(-8766.78125, -5586.78125, 8.0625), ang = Angle(0, -89.18701171875, 0)}, {ent = 'handcuff_front_desk', pos = Vector(-8833.78125, -5587.96875, 8.125), ang = Angle(0, -90.115356445313, 0)}, {ent = 'xyz_undercover_npc', pos = Vector(-8266.03125, -4953, 9.34375), ang = Angle(0, -89.247436523438, 0)}, {ent = 'xyz_podium', pos = Vector(-7229.59375, -5117.34375, 57.65625), ang = Angle(-0.076904296875, 90.038452148438, 0.0054931640625)}, {ent = 'xyz_badge_id', pos = Vector(-8347.09375, -4956.625, 8.125), ang = Angle(0, -90.230712890625, 0)}, {ent = 'cw_ammo_crate_unlimited', pos = Vector(-7847.6875, -4779.34375, 24.34375), ang = Angle(0.0439453125, -0.0274658203125, 0.0054931640625)}, {ent = 'xyz_armory', pos = Vector(-7700.96875, -4616.59375, 69.3125), ang = Angle(-0.0274658203125, -90.692138671875, 0.010986328125)}, {ent = 'xyz_weapon_armory', pos = Vector(-7566.78125, -4629.1875, 8.34375), ang = Angle(0, -135, 0)}, {ent = 'xyz_seized_box', pos = Vector(-7568.375, -4894.09375, 24.34375), ang = Angle(-0.0054931640625, -179.99450683594, 0.0823974609375)}, {ent = 'xyz_gov_car_dealer', pos = Vector(-8484.78125, -5801.34375, 1.4375), ang = Angle(0, -0.17578125, 0)}, {ent = 'xyz_gov_car_dealer', pos = Vector(-7589.84375, -5618.5625, 1.03125), ang = Angle(0, -178.50036621094, 0)}, {ent = 'xyz_gundealer_npc', pos = Vector(-8690.78125, -5584.875, 8.15625), ang = Angle(0, -64.62158203125, 0)}, -- Sub Department {ent = 'handcuff_warden', pos = Vector(-5803.875, -3345.28125, 8.25), ang = Angle(0, -179.82971191406, 0)}, {ent = 'xyz_undercover_npc', pos = Vector(-5724.625, -3704.6875, 272.03125), ang = Angle(0, 57.85400390625, 0)}, {ent = 'xyz_badge_id', pos = Vector(-5800.1875, -3159.125, 8.90625), ang = Angle(0, 177.47863769531, 0)}, -- Robbable Stores {ent = 'xyz_raid_shell', pos = Vector(-14646.9375, 2629.0625, 400.03125), ang = Angle(0, 0.0054931640625, 0)}, {ent = 'xyz_raid_taco', pos = Vector(752.9375, 2036.8125, 544.03125), ang = Angle(0, -178.7255859375, 0)}, {ent = 'xyz_raid_supermarket', pos = Vector(1606.4375, 6067.0625, 574.03125), ang = Angle(0, -90.142822265625, 0)}, -- Prison {ent = 'handcuff_warden', pos = Vector(-8413.34375, -4954.0625, 9.375), ang = Angle(0, -92.422485351563, 0)}, {ent = 'xyz_prison_escape_box', pos = Vector(-7123.875, -5864.09375, -1372.65625), ang = Angle(0, 89.994506835938, -0.0384521484375)}, {ent = 'xyz_prison_escape_box', pos = Vector(-7212.25, -5864.125, -1372.625), ang = Angle(0.06591796875, 89.989013671875, -0.0384521484375)}, {ent = 'xyz_prison_escape_box', pos = Vector(-7564.03125, -5864.15625, -1372.78125), ang = Angle(-0.0164794921875, 89.5166015625, -0.06591796875)}, {ent = 'xyz_prison_escape_box', pos = Vector(-7660.15625, -5864.1875, -1372.78125), ang = Angle(0.0164794921875, 89.972534179688, 0.1043701171875)}, {ent = 'xyz_prison_escape_box', pos = Vector(-7660.15625, -5608.09375, -1372.65625), ang = Angle(0.0604248046875, 90.19775390625, -0.032958984375)}, {ent = 'xyz_prison_escape_box', pos = Vector(-7563.84375, -5607.4375, -1372.84375), ang = Angle(0.032958984375, 90.170288085938, -0.0274658203125)}, {ent = 'xyz_prison_escape_box', pos = Vector(-7212.21875, -5608.15625, -1372.65625), ang = Angle(-0.120849609375, 89.945068359375, -0.0823974609375)}, {ent = 'xyz_prison_escape_box', pos = Vector(-7123.9375, -5608.28125, -1372.8125), ang = Angle(0.0274658203125, 89.972534179688, 0)}, -- Hospital {ent = 'xyz_doctor_npc', pos = Vector(-78.96875, -5856.9375, 64.65625), ang = Angle(0, 179.70886230469, 0)}, {ent = 'fr_exam_npc', pos = Vector(-157.375, -6021.9375, 64.46875), ang = Angle(0, 135.95031738281, 0)}, {ent = 'xyz_gov_car_dealer', pos = Vector(338.6875, -4589.09375, 65.5625), ang = Angle(0, -93.543090820313, 0)}, -- Hitman Phones {ent = 'xyz_hitman_phone', pos = Vector(-3602.59375, -2735.65625, 45.09375), ang = Angle(0.0494384765625, 90.005493164063, -0.0054931640625)}, {ent = 'xyz_hitman_phone', pos = Vector(-7085.6875, -157.1875, 35.781246185303), ang = Angle(0, 0.0054931640625, 0)}, {ent = 'xyz_hitman_phone', pos = Vector(1778.1875, 5932.1875, 609.4375), ang = Angle(0, 0, 0)}, -- Mine {ent = 'xyz_mining_npc', pos = Vector(10524.0625, -4228.15625, -447.125), ang = Angle(0, -90.104370117188, 0)}, {ent = 'xyz_mining_ore_node', pos = Vector(11822.28125, -2288.0625, -425.28125), ang = Angle(0, -43.368530273438, 0)}, {ent = 'xyz_mining_ore_node', pos = Vector(11849.21875, -2637.84375, -425.1875), ang = Angle(0, -58.95263671875, -0.032958984375)}, {ent = 'xyz_mining_ore_node', pos = Vector(11994.71875, -2868.3125, -425.25), ang = Angle(-0.0274658203125, 172.02941894531, 0.010986328125)}, {ent = 'xyz_mining_ore_node', pos = Vector(11822.625, -3324.375, -425.125), ang = Angle(0.0164794921875, -57.980346679688, 0.142822265625)}, {ent = 'xyz_mining_ore_node', pos = Vector(11988.71875, -3920.53125, -425.21875), ang = Angle(-0.0823974609375, -114.521484375, -0.02197265625)}, {ent = 'xyz_mining_ore_node', pos = Vector(11829.59375, -4013.40625, -425.25), ang = Angle(0, -43.203735351563, 0)}, {ent = 'xyz_mining_ore_node', pos = Vector(11900.4375, -4439.90625, -425.28125), ang = Angle(0, 168.38195800781, 0)}, {ent = 'xyz_mining_ore_node', pos = Vector(11298.15625, -4424.0625, -425.28125), ang = Angle(0, 9.1571044921875, 0)}, {ent = 'xyz_mining_ore_node', pos = Vector(10372.96875, -4404.09375, -425.03125), ang = Angle(-0.0604248046875, 81.353759765625, -0.2911376953125)}, -- UPS {ent = 'ups_npc', pos = Vector(-1378.59375, 3918.84375, 552.34375), ang = Angle(0, 90, 0)}, {ent = 'ups_platform', pos = Vector(1666.71875, 9695.28125, 530.375), ang = Angle(0, -89.989013671875, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Appartments" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(-5891.28125, -1892.78125, -5.6875), ang = Angle(-0.0164794921875, 89.994506835938, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Car Dealer" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(-1651.40625, -5632.28125, -5.65625), ang = Angle(0, 89.945068359375, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Hospital" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(-5444.5625, -7407.6875, -5.625), ang = Angle(0, 90.225219726563, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Town Hall" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(-8930.8125, -3865.78125, -5.71875), ang = Angle(0, 0.3515625, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Police Department" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(-7806.0625, 7640.5, -5.71875), ang = Angle(0, -0.076904296875, 0), ang = Angle(0, 0.3515625, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Industrial" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(-1974.71875, 6296.21875, 530.3125), ang = Angle(0, -179.53308105469, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Tavern" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(14056.84375, 14187.9375, 1530.25), ang = Angle(0, -178.68713378906, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Bridge" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(9953.96875, 3560.875, 1530.21875), ang = Angle(0, 179.36828613281, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Park" ent.reward = 2000 end}, {ent = 'ups_platform', pos = Vector(-14047.78125, 2716.96875, 378.28125), ang = Angle(0, -0.6646728515625, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Shell Gas Station" ent.reward = 2000 end}, -- Trucker {ent = 'trucker_npc', pos = Vector(-1446.125, 3918.125, 552.34375), ang = Angle(0, 90, 0)}, {ent = 'trucker_platform', pos = Vector(1725.5, 9024.78125, 530.25), ang = Angle(0.0054931640625, 0, -0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, -- Apartments {ent = 'trucker_platform', pos = Vector(-4129, -1892.34375, -5.71875), ang = Angle(-0.0054931640625, 89.6923828125, -0.010986328125), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, -- Car Dealer {ent = 'trucker_platform', pos = Vector(13380.5, -3155.8125, 314.3125), ang = Angle(0.0274658203125, 0.0164794921875, -0.010986328125), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, -- Mine {ent = 'trucker_platform', pos = Vector(7392.4375, 3401.625, 1530.21875), ang = Angle(0, -0.0274658203125, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, -- Park {ent = 'trucker_platform', pos = Vector(-2576.4375, 14014.15625, 506.21875), ang = Angle(0, 0.5767822265625, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, -- Bridge {ent = 'trucker_platform', pos = Vector(-1555.875, -4987.6875, -5.71875), ang = Angle(0.0164794921875, -89.571533203125, -0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, -- Hospital -- Racing {ent = 'racing_platform', pos = Vector(-3348.21875, -5828.4375, -5.78125), ang = Angle(0, 0.4998779296875, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, {ent = 'racing_platform', pos = Vector(13098.0625, -8624.1875, 314.34375), ang = Angle(-0.032958984375, -121.79992675781, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, {ent = 'racing_platform', pos = Vector(11295.9375, 6410.1875, 1530.34375), ang = Angle(0.0274658203125, 89.994506835938, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, {ent = 'racing_platform', pos = Vector(-2520.84375, 15035.3125, 506.3125), ang = Angle(0.0054931640625, -0.208740234375, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, {ent = 'racing_platform', pos = Vector(697.5625, 2729.65625, 530.25), ang = Angle(0, 89.939575195313, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, {ent = 'racing_platform', pos = Vector(-4792.9375, -1635.53125, -5.71875), ang = Angle(0.0274658203125, 0.054931640625, 0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, {ent = 'racing_platform', pos = Vector(-9358.8125, -5349.15625, -5.71875), ang = Angle(0, 0.2197265625, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, {ent = 'racing_platform', pos = Vector(-7896.09375, 9460.53125, -5.71875), ang = Angle(0, -89.923095703125, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, {ent = 'racing_platform', pos = Vector(-13168.5, -11863.28125, -5.71875), ang = Angle(0, 89.3408203125, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) end}, -- Foot Patrol {ent = 'xyz_patrol_waypoint_foot', pos = Vector(-358.03125, -5353.875, 58.25), ang = Angle(-0.0054931640625, -89.346313476563, -0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Hospital" end}, {ent = 'xyz_patrol_waypoint_foot', pos = Vector(-4909.28125, -6112.28125, 2.25), ang = Angle(-0.0054931640625, 0.1373291015625, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Town Hall" end}, {ent = 'xyz_patrol_waypoint_foot', pos = Vector(-3899.84375, -877.71875, -5.78125), ang = Angle(0.0054931640625, -179.08264160156, -0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Car Dealer" end}, {ent = 'xyz_patrol_waypoint_foot', pos = Vector(-6423.28125, 3615.28125, 2.25), ang = Angle(-0.0054931640625, 90.19775390625, 0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Industrial" end}, {ent = 'xyz_patrol_waypoint_foot', pos = Vector(-8753.84375, -5079.375, 2.21875), ang = Angle(-0.0054931640625, -4.9273681640625, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Police Station" end}, {ent = 'xyz_patrol_waypoint_foot', pos = Vector(-5974.59375, -2987.96875, 2.25), ang = Angle(0, 90.362548828125, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Sub Department HQ" end}, {ent = 'xyz_patrol_waypoint_foot', pos = Vector(423.15625, 1850.15625, 538.25), ang = Angle(-0.0054931640625, 90.510864257813, 0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Taco Bell" end}, {ent = 'xyz_patrol_waypoint_foot', pos = Vector(-3635.9375, -3067.6875, 26.1875), ang = Angle(0, 89.994506835938, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Bank" end}, -- Patrol {ent = 'xyz_patrol_waypoint', pos = Vector(-5437.28125, -7562.46875, -5.59375), ang = Angle(0.0274658203125, -89.97802734375, -0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Town Hall" end}, {ent = 'xyz_patrol_waypoint', pos = Vector(-8092.5, 6980.28125, -5.71875), ang = Angle(0, 0.032958984375, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Industrial" end}, {ent = 'xyz_patrol_waypoint', pos = Vector(-13186.0625, 14193.8125, 506.25), ang = Angle(0, -0.1483154296875, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Bridge" end}, {ent = 'xyz_patrol_waypoint', pos = Vector(-13697.75, 2583.34375, 378.34375), ang = Angle(0.0164794921875, -0.087890625, 0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Shell Gas Station" end}, {ent = 'xyz_patrol_waypoint', pos = Vector(2515.9375, 5694.96875, 530.25), ang = Angle(0, 0.7525634765625, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Rockford Foods" end}, {ent = 'xyz_patrol_waypoint', pos = Vector(8195.0625, 2261.8125, 1530.21875), ang = Angle(0, 90.115356445313, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Park" end}, {ent = 'xyz_patrol_waypoint', pos = Vector(13354.15625, -3702.40625, 314.375), ang = Angle(0, 179.73083496094, -0.0054931640625), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Mine" end}, {ent = 'xyz_patrol_waypoint', pos = Vector(-5440.4375, -1720.75, -5.65625), ang = Angle(0.0164794921875, 0.3790283203125, 0), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Car Dealer" end}, {ent = 'xyz_patrol_waypoint', pos = Vector(-1580.90625, -5877.71875, -5.71875), ang = Angle(0.0054931640625, -90.368041992188, 0.0164794921875), custom = function(ent) ent:SetColor(Color(0, 0, 0, 0)) ent:SetRenderMode(RENDERMODE_TRANSALPHA) ent.name = "Hospital" end}, -- Misc {ent = 'xyz_dumpster', pos = Vector(-4879.875, -7951.09375, 25.5625), ang = Angle(0.0494384765625, 90.587768554688, 0)}, {ent = 'xyz_dumpster', pos = Vector(-7077.5625, 2334.25, 34.65625), ang = Angle(0, 0.7086181640625, 0)}, {ent = 'xyz_dumpster', pos = Vector(-720.46875, 5452.15625, 561.71875), ang = Angle(-0.0933837890625, 0.28564453125, -0.0439453125)}, {ent = 'xyz_dumpster', pos = Vector(10273.46875, 4966.15625, 1569.46875), ang = Angle(0, -135.56030273438, -0.0054931640625)}, {ent = 'xyz_car_scrapper', pos = Vector(14216.5, 15196.25, 1536.03125), ang = Angle(0, -135, 0)}, {ent = 'xyz_drug_hustler', pos = Vector(-2521.59375, 13776.46875, 252.5), ang = Angle(0, 90, 0)}, {ent = 'xyz_drug_hustler', pos = Vector(10333.96875, 2176.5625, 1544.03125), ang = Angle(0, 141.21276855469, 0)}, {ent = 'xyz_smuggler_npc', pos = Vector(-3653, 322.90625, 52.3125), ang = Angle(0, -45, 0)}, {ent = 'xyz_tow_truck_agency', pos = Vector(-7027.4375, 1435.71875, 0.03125), ang = Angle(0, 0, 0)}, {ent = 'xyz_recycleseller', pos = Vector(-5710.71875, -8127.625, 8.28125), ang = Angle(0.010986328125, 0, 0)}, {ent = 'xyz_manhole', pos = Vector(-2706.5, -6120.96875, 9.46875), ang = Angle(-0.0604248046875, -135.54382324219, -0.0054931640625)}, {ent = 'xyz_manhole', pos = Vector(-6395.9375, -1253.3125, 9.34375), ang = Angle(0, -46.554565429688, 0)}, {ent = 'xyz_manhole', pos = Vector(-7534.875, 8508.1875, 1.53125), ang = Angle(0.340576171875, -10.92041015625, 0.1483154296875)}, {ent = 'xyz_manhole', pos = Vector(778.84375, 4674.375, 545.59375), ang = Angle(-0.2581787109375, 55.134887695313, -0.1153564453125)}, {ent = 'xyz_manhole', pos = Vector(8448.8125, 2753.3125, 1545.5), ang = Angle(0.252685546875, 120.60791015625, 0.120849609375)}, {ent = 'g4s_npc', pos = Vector(-2790.03125, -1583.40625, 0), ang = Angle(0, 180, 0)}, {ent = 'g4s_deposit', pos = Vector(7069.71875, 3146.78125, -1488.625), ang = Angle(-1.0272216796875, 0.0714111328125, 0.4779052734375)}, }, ["map_name"] = { } } -- These should be used for plates that detect vehicles / player colliding on them -- They should not be networked, any info the client needs will be networked via net. local toNoDraw = { ["ups_platform"] = true, ["trucker_platform"] = true, ["racing_platform"] = true, ["xyz_patrol_waypoint_foot"] = true, ["xyz_patrol_waypoint"] = true } hook.Add("InitPostEntity", "xyz_perma_start", function() local entsToSpawn = propsToSpawn[game.GetMap()] if !entsToSpawn then for i=1, 10 do print("[Perma Entities]", "There are no perma ents found for this map:", game.GetMap()) end return end for k, v in pairs(entsToSpawn) do print("[Perma Entities]", "Spawning", v.ent, "at", v.pos) local ent = ents.Create(v.ent) print(ent) if not IsValid(ent) then continue end ent:SetPos(v.pos) ent:SetAngles(v.ang) if v.model then ent:SetModel(v.model) end if toNoDraw[v.ent] then ent:SetNoDraw(true) end ent:Spawn() local phys = ent:GetPhysicsObject() if IsValid(phys) then phys:EnableMotion(false) end if v.custom then v.custom(ent) end end end) concommand.Add("xyz_perma_world", function(ply, cmd, args) if not ply:IsSuperAdmin() then return end local target = ply:GetEyeTrace().Entity local worldEnt = ents.Create(target:GetClass()) if not IsValid(worldEnt) then return end worldEnt:SetModel(target:GetModel()) worldEnt:SetPos(target:GetPos()) worldEnt:SetAngles(target:GetAngles()) worldEnt:Spawn() worldEnt:GetPhysicsObject():EnableMotion(false) target:Remove() end)
----------------------------------- -- Area: Western Altepa Desert -- Mob: Desert Dhalmel -- Note: Place holder for Celphie ----------------------------------- local ID = require("scripts/zones/Western_Altepa_Desert/IDs") require("scripts/globals/regimes") require("scripts/globals/mobs") ----------------------------------- function onMobDeath(mob, player, isKiller) tpz.regime.checkRegime(player, mob, 135, 1, tpz.regime.type.FIELDS) end function onMobDespawn(mob) tpz.mob.phOnDespawn(mob, ID.mob.CELPHIE_PH, 5, math.random(7200, 28800)) -- 2 to 8 hours end
-------------------------------------------------------------------------------- -- -- (C) %%YEAR%% Michael J. Beer -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or with‐ -- out modification, are permitted provided that the following con‐ -- ditions are met: -- -- 1. Redistributions of source code must retain the above copyright -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copy‐ -- right notice, this list of conditions and the following dis‐ -- claimer in the documentation and/or other materials provided with -- the distribution. -- -- 3. Neither the name of the copyright holder nor the names of its -- contributors may be used to endorse or promote products derived -- from this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBU‐ -- TORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, -- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND -- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT -- SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DI‐ -- RECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS IN‐ -- TERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLI‐ -- GENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -------------------------------------------------------------------------------- -- -- author Michael J. Beer <michael.josef.beer@gmail.com> -- copyright (c) %%YEAR%% Michael J. Beer <michael.josef.beer@gmail.com> -- date %%DATE%% -- -- license MIT -- -------------------------------------------------------------------------------- %%START_POINT%%
local assets = { Asset("ANIM", "anim/book_maxwell.zip"), } local prefabs = { "shadowwaxwell", "waxwell_book_fx" } local function doeffects(inst, pos) SpawnPrefab("statue_transition").Transform:SetPosition(pos:Get()) SpawnPrefab("statue_transition_2").Transform:SetPosition(pos:Get()) end local function canread(inst) return (inst.components.sanity:GetMaxSanity() >= TUNING.SHADOWWAXWELL_SANITY_PENALTY) end local function onread(inst, reader) --Check sanity if not canread(reader) then if reader.components.talker then reader.components.talker:Say(GetString(reader.prefab, "ANNOUNCE_NOSANITY")) return true end end --Check reagent if not reader.components.inventory:Has("nightmarefuel", TUNING.SHADOWWAXWELL_FUEL_COST) then if reader.components.talker then reader.components.talker:Say(GetString(reader.prefab, "ANNOUNCE_NOFUEL")) return true end end reader.components.inventory:ConsumeByName("nightmarefuel", TUNING.SHADOWWAXWELL_FUEL_COST) --Ok you had everything. Make the image. local theta = math.random() * 2 * PI local pt = inst:GetPosition() local radius = math.random(3, 6) local offset = FindWalkableOffset(pt, theta, radius, 12, true) if offset then local image = SpawnPrefab("shadowwaxwell") local pos = pt + offset image.Transform:SetPosition(pos:Get()) doeffects(inst, pos) image.components.follower:SetLeader(reader) reader.components.health:DoDelta(-TUNING.SHADOWWAXWELL_HEALTH_COST) reader.components.sanity:RecalculatePenalty() inst.SoundEmitter:PlaySound("dontstarve/maxwell/shadowmax_appear") return true end end local function fn() local inst = CreateEntity() local trans = inst.entity:AddTransform() local anim = inst.entity:AddAnimState() local sound = inst.entity:AddSoundEmitter() anim:SetBank("book_maxwell") anim:SetBuild("book_maxwell") anim:PlayAnimation("idle") MakeInventoryPhysics(inst) inst:AddComponent("inventoryitem") inst:AddComponent("characterspecific") inst.components.characterspecific:SetOwner("waxwell") ----------------------------------- inst:AddComponent("inspectable") inst:AddComponent("book") inst.components.book.onread = onread MakeSmallBurnable(inst) MakeSmallPropagator(inst) return inst end return Prefab("common/waxwelljournal", fn, assets)
-- 1 ensemble + dropout os.execute('CUDA_VISIBLE_DEVICES=0 th train.lua -dataset flic -expID hg-generic8-ensemblev3 -netType hg-generic-ensemblev3 -nGPU 1 -optMethod adam -nThreads 4 -snapshot 0 -schedule "{{30,1e-3,0},{5,1e-4,0},{5,5e-5,0}}" -nStack 8 -genGraph 0') -- 2 ensemble + spatial dropout os.execute('CUDA_VISIBLE_DEVICES=0 th train.lua -dataset flic -expID hg-generic8-ensemblev4 -netType hg-generic-ensemblev4 -nGPU 1 -optMethod adam -nThreads 4 -snapshot 0 -schedule "{{30,1e-3,0},{5,1e-4,0},{5,5e-5,0}}" -nStack 8 -genGraph 0') -- 3 ensemble + rrelu os.execute('CUDA_VISIBLE_DEVICES=0 th train.lua -dataset flic -expID hg-generic8-ensemblev5 -netType hg-generic-ensemblev5 -nGPU 1 -optMethod adam -nThreads 4 -snapshot 0 -schedule "{{30,1e-3,0},{5,1e-4,0},{5,5e-5,0}}" -nStack 8 -genGraph 0') -- 4 ensemble hg-generic 16 os.execute('CUDA_VISIBLE_DEVICES=0 th train.lua -dataset flic -expID hg-generic16-ensemblev6 -netType hg-generic-ensemblev6 -nGPU 1 -optMethod adam -nThreads 4 -snapshot 0 -schedule "{{30,1e-3,0},{5,1e-4,0},{5,5e-5,0}}" -nStack 16 -genGraph 0') -- benchmarks os.execute('th benchmark.lua -expID hg-generic8-ensemblev3 -threshold 0.2') os.execute('th benchmark.lua -expID hg-generic8-ensemblev4 -threshold 0.2') os.execute('th benchmark.lua -expID hg-generic8-ensemblev5 -threshold 0.2') os.execute('th benchmark.lua -expID hg-generic8-ensemblev6 -threshold 0.2') CUDA_VISIBLE_DEVICES=0 th train.lua -dataset flic -expID hg-generic16-ensemblev6 -netType hg-generic-ensemblev6 -nGPU 1 -optMethod adam -nThreads 4 -snapshot 0 -schedule "{{10,1e-3,0},{1,1e-4,0},{1,5e-5,0}}" -nStack 16 -genGraph 0
-- Created by LuaView. -- Copyright (c) 2017, Alibaba Group. All rights reserved. -- -- This source code is licensed under the MIT. -- For the full copyright and license information,please view the LICENSE file in the root directory of this source tree. -- -- Created by IntelliJ IDEA. -- User: song -- Date: 16/10/13 -- Time: 下午2:32 -- To change this template use File | Settings | File Templates. -- --2. 普通构造传url v1 = Image() v1.frame(0, 0, 100, 100) v1.scaleType(ScaleType.FIT_XY) v1.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") v2 = Image() v2.frame(101, 0, 100, 100) v2.scaleType(ScaleType.FIT_START) v2.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") v3 = Image() v3.frame(202, 0, 100, 100) v3.scaleType(ScaleType.FIT_END) v3.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") v4 = Image() v4.scaleType(ScaleType.FIT_CENTER) v4.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") v4.frame(0, 101, 100, 100) v5 = Image() v5.scaleType(ScaleType.CENTER) v5.frame(101, 101, 100, 100) v5.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") --TODO v6 = Image() v6.scaleType(ScaleType.CENTER_CROP) v6.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") v6.frame(202, 101, 100, 100) v7 = Image() v7.scaleType(ScaleType.CENTER_INSIDE) v7.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") v7.frame(0, 202, 100, 100) --TODO v8 = Image() v8.scaleType(ScaleType.MATRIX) v8.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") v8.frame(101, 202, 100, 100) v9 = Image() v9.scaleType(ScaleType.CENTER_CROP) v9.image("https://gju1.alicdn.com/bao/uploaded/i4/100000120700895002/TB2Qu0_fXXXXXb9XpXXXXXXXXXX_!!0-0-juitemmedia.jpg_560x560Q90.jpg") v9.scale(1.2, 1.2) v9.frame(0, 303, 100, 100)
local curl = require 'cURL' local URL = require 'socket.url' local JSON = require 'dkjson' local clr = require 'term.colors' local function getRandomBootts(attempt, bootts) attempt = attempt or 0 attempt = attempt + 1 local count = bootts == 'butts' and 3 or 10 local url = string.format('http://api.o%s.ru/noise/1', bootts) local res, status = performRequest(url) if status ~= 200 then return nil end local data = JSON.decode(res)[1] if not data and attempt < count then print('Cannot get that %s, trying another one...'):format(bootts) return getRandomBootts(attempt, bootts) end local output = string.format('http://media.o%s.ru/%s', bootts, data.preview) return output end -------------------------------------------------------------------------------- local function run(msg, matches) local url = getRandomBootts(nil, matches[1]) if url ~= nil then td.sendText(msg.to.id, msg.id, 1, 0, nil,url, 0, 'html', ok_cb, bk) else local text = 'Error getting boobs/butts for you, please try again later.' reply_msg(msg.id, text, ok_cb, true) end end local function inline(msg , matches) if matches[1] == 'blist' then local tab = load_data('xxx.lua') local box = {} local a = 1 for x=1 ,20 do getRandomBootts(attempt, 'boobs') local v = tab.boobs[math.random(#tab.boobs)] table.insert(box,{type = "photo",photo_url = v,id = tostring(a),thumb_url = v,}) a = a + 1 end print(#tab.boobs) return send_req(send_api.."/answerInlineQuery?inline_query_id="..msg.id.."&is_personal=false&cache_time=1&results="..json.encode(box)) end local url = getRandomBootts(nil, matches[1]) print(matches[1]) if url ~= nil then tab = {{type = "photo",photo_url = url,id = "1", title = "دریافت عکس", description = "دریافت عکس", thumb_url = url,},} else local text = 'Error getting boobs/butts for you, please try again later.' tab = {{type = "article",disable_web_page_preview = true,id = "1", title = "eror", description = text, message_text = text,},} end return send_req(send_api.."/answerInlineQuery?inline_query_id="..msg.id.."&is_personal=false&cache_time=1&results="..json.encode(tab)) end -------------------------------------------------------------------------------- return { description = 'Gets a random boobs or butts pic', usage = { '<code>!boobs</code>', 'Get a boobs tgGuard image. ', '', '<code>!butts</code>', 'Get a butts tgGuard image.', '', }, patterns = { '(boobs)$', '(butts)$' }, inline_pt = { '(boobs)', '(butts)', '(blist)' }, run = run, inline = inline }
add_repositories("antlr https://github.com/antlr/antlr4.git") add_repositories("args https://github.com/Taywee/args.git") add_repositories("yaml https://github.com/jbeder/yaml-cpp.git") add_repositories("catch https://github.com/catchorg/Catch2.git") local repo = "$(configdir)/repositories/" target("lua-format") set_kind("binary") add_cxxflags("-std=c++17", "-fuse-ld=lld", {force = true}) add_files("src/**.cpp", repo .. "antlr/runtime/Cpp/runtime/src/**.cpp", repo .. "yaml/src/**.cpp") add_includedirs("src", "src/lua", repo .. "args", repo .. "yaml/include", repo .. "antlr/runtime/Cpp/runtime/src") target("test-lua-format") set_kind("binary") add_cxxflags("-std=c++17", "-fuse-ld=lld", {force = true}) add_files("tests/**.cpp", "src/**.cpp", repo .. "yaml/src/**.cpp", repo .. "antlr/runtime/Cpp/runtime/src/**.cpp") del_files("src/main.cpp") add_includedirs("src", "src/lua", repo .. "yaml/include", repo .. "antlr/runtime/Cpp/runtime/src", repo .. "args", repo .. "catch/include")
ENT.Type = "anim" ENT.Base = "wick_base" ENT.Category = "STRP" ENT.PrintName = "Дверь в бар" ENT.Author = "WickedRabbit" ENT.Contact = "" ENT.Spawnable = true --Spawnable? ENT.AdminSpawnable = false --If spawnable, is it admin only? function ENT:Draw() self:DrawModel() end
local bigfont = require("bigfont") exports = {} local currentLiseners = { } local customChars = { upArrow = "f\152f\137f\144", downArrow = "t\155t\159f\132" .."f\128f\129f\128", bottomBar = "t\143", leftBar = "f\149", rightBar = "t\149", } function getDrawingCharacter(topLeft, topRight, left, right, bottomLeft, bottomRight) local data = 128 if not bottomRight then data = data + (topLeft and 1 or 0) data = data + (topRight and 2 or 0) data = data + (left and 4 or 0) data = data + (right and 8 or 0) data = data + (bottomLeft and 16 or 0) else data = data + (topLeft and 0 or 1) data = data + (topRight and 0 or 2) data = data + (left and 0 or 4) data = data + (right and 0 or 8) data = data + (bottomLeft and 0 or 16) end return {char = string.char(data), inverted = bottomRight} end exports.drawCustomChar = function(monitor, char, x, y, fColor, bColor) if fColor then monitor.setTextColor(fColor) else monitor.setTextColor(colors.white) end if bColor then monitor.setBackgroundColor(bColor) else monitor.setBackgroundColor(colors.black) end for i = 0, (#char / 6) - 1 do local text = char:sub((i*6) +1, (i+1) * 6) monitor.setCursorPos(x, y + i) for j = 0, 6, 2 do local charVal = text:sub(j + 1, 2 * (j+1)) local inverted = charVal:sub(1,1) == "t" local value = charVal:sub(2,2) if inverted then monitor.setTextColor(bColor) monitor.setBackgroundColor(fColor) else monitor.setTextColor(fColor) monitor.setBackgroundColor(bColor) end monitor.write(value) end end end exports.drawSpecialCharVertically = function(monitor, char, x, y, height, fColor, bColor) local inverted = char:sub(1,1) == "t" local value = char:sub(2,2) if inverted then monitor.setTextColor(bColor) monitor.setBackgroundColor(fColor) else monitor.setTextColor(fColor) monitor.setBackgroundColor(bColor) end for i = 0, height - 1 do monitor.setCursorPos(x, y + i) monitor.write(value) end end exports.drawSpecialCharHorizontally = function(monitor, char, x, y, width, fColor, bColor) monitor.setCursorPos(x, y) local inverted = char:sub(1,1) == "t" local value = char:sub(2,2) if inverted then monitor.setTextColor(bColor) monitor.setBackgroundColor(fColor) else monitor.setTextColor(fColor) monitor.setBackgroundColor(bColor) end local text = value for i = 1, width do text = text .. value end monitor.write(text) end local function addListener(func, x1, y1, x2, y2) table.insert(currentLiseners, { x1 = x1, x2 = x2, y1 = y1, y2 = y2, func = func, }) end local function getListener(x, y) for _, v in ipairs(currentLiseners) do if v.x1 <= x and v.x2 >= x and v.y1 <= y and v.y2 >= y then return v end end end exports.writeText = function(monitor, size, text, x, y, fColor, bColor) if fColor then monitor.setTextColor(fColor) else monitor.setTextColor(colors.white) end if bColor then monitor.setBackgroundColor(bColor) else monitor.setBackgroundColor(colors.black) end bigfont.writeOn(monitor, size, text, x, y) end exports.writeCenterText = function(monitor, size, text, x, y, width, fColor, bColor) if fColor then monitor.setTextColor(fColor) else monitor.setTextColor(colors.white) end if bColor then monitor.setBackgroundColor(bColor) else monitor.setBackgroundColor(colors.black) end local charWidth = size * 3 -- determine the center width of the `text` value local textWidth = #text * charWidth -- next, get the center point of our area and minus the text width from it local textX = ( width / 2) - (textWidth / 2) -- finally, draw our text exports.writeText(monitor, size, text, x + textX, y, fColor, bColor) end exports.drawHorizontalProgressBar = function(monitor, x, y, width, height, progress, fColor, bColor) -- first lets draw the background, paintutils.drawFilledBox(x, y, x + width, y + height - 1, bColor) -- next we determine the relative width of the percentage local rWidth = width * progress if progress >= 1 then rWidth = width end if progress ~= 0 then -- we can fill that section in with the floor value of rWidth paintutils.drawFilledBox(x, y, x + math.floor(rWidth), y + height - 1, fColor) -- finnaly lets see if were above k.5 if math.floor(rWidth) ~= math.floor(rWidth + 0.5) then -- Add a "half pixel" exports.drawSpecialCharVertically(monitor, customChars.leftBar, x + math.floor(rWidth) + 1, y, height, fColor, bColor) end end end exports.makeButton = function(monitor, x, y, width, height, text, fColor, bColor, onClick) if height < 2 then height = 2 end if width < #text + 2 then width = #text + 2 end -- draw the rect box paintutils.drawFilledBox(x, y, x + width, y + height, bColor) exports.drawSpecialCharHorizontally(monitor, customChars.bottomBar, x, y - 1, width, bColor, colors.black) -- draw the text exports.writeCenterText(monitor, 1, text, x, y, width + 1, fColor, bColor) -- add the listener addListener( function(lX, lY, instance) print(onClick) if onClick then onClick() end end, x, y, x + width, y + height ) end exports.writeRightText = function(monitor, x, y, text, fColor, bColor) exports.writeNormalText(monitor, text, x - #text, y, fColor, bColor) end exports.writeNormalText = function(monitor,text, x, y, fColor, bColor) if fColor then monitor.setTextColor(fColor) else monitor.setTextColor(colors.white) end if bColor then monitor.setBackgroundColor(bColor) else monitor.setBackgroundColor(colors.black) end monitor.setCursorPos(x, y) monitor.write(text) end exports.makeCircle = function(monitor, centerX, centerY, radius, thickness, fColor, bColor) if fColor then monitor.setTextColor(fColor) else monitor.setTextColor(colors.white) end if bColor then monitor.setBackgroundColor(bColor) else monitor.setBackgroundColor(colors.black) end local r = radius or 10 r = r * 2 local t = thickness or 1 for i = 1, 360 do local dChar = "" local x, y = centerX + r/2 * math.cos(i), centerY - r/3 * math.sin(i) local xD, yD = x%1*10, y%1*10 --if xD < 5 paintutils.drawPixel(x, y, fColor) --print(x, y) end end exports.makeNumberSelector = function(monitor, size, x, y, fColor, bColor, value, onUp, onDown, rightAligned) if not fColor then fColor = colors.white end if not bColor then bColor = colors.green end local isRightAligned = rightAligned or false -- Check if were going to be writing text outside our rect bounds, if so lets sneakily extend it :D local calWidth = #value * (size * 3) + 3 local calHeight = size * 3 -- if calWidth > eX - sX then eX = sX + calWidth end if isRightAligned then x = x - calWidth end -- draw the rect paintutils.drawFilledBox(x, y, x + calWidth, y + calHeight - 1, bColor) -- add a top border with the \143 char inverted, its basically 1/3 of a bottom of a pixel, looks good with bigfont exports.drawSpecialCharHorizontally(monitor, customChars.bottomBar, x, y - 1, calWidth, bColor, colors.black) -- Write the text exports.writeText(monitor, size, value, x + 4, y, fColor, bColor) -- draw the controls, exports.drawCustomChar(monitor, customChars.upArrow, x + 1, y, fColor, bColor) exports.drawCustomChar(monitor, customChars.downArrow, x + 1, y + calHeight - 2, fColor, bColor) -- Add the listeners addListener( function(lX, lY, instance) if lY == y then if onUp then onUp() end elseif onDown then onDown() end end, x + 1, y, x + 4, y + calHeight - 1 ) end exports.handleClick = function(monitor, x, y) local l = getListener(x, y) print(l) if l then l.func(x, y, l) end end return exports
-- Load plugins require "plugins" -- Load basics require "config.treesitter" -- Load LSPs require "config.lsp" require "config.lsp.snippets" require "config.lsp.completions" -- Load theme based require "config.tokyonight" require "config.lualine" require "config.indentline" -- Load extra features require "config.alpha" require "config.gitsigns" require "config.editorconfig" require "config.vista" -- Load preferences require "settings" require "keybinds" require "extras"
ys = ys or {} ys.Battle.BattleBuffScapegoat = class("BattleBuffScapegoat", ys.Battle.BattleBuffEffect) ys.Battle.BattleBuffScapegoat.__name = "BattleBuffScapegoat" ys.Battle.BattleBuffScapegoat.Ctor = function (slot0, slot1) slot0.super.Ctor(slot0, slot1) end ys.Battle.BattleBuffScapegoat.SetArgs = function (slot0, slot1, slot2) slot0._target = slot0._tempData.arg_list.target slot0._rant = slot0._tempData.arg_list.rant or 10000 end ys.Battle.BattleBuffScapegoat.onAttach = function (slot0, slot1) slot0:updateGoatsList(slot1) end ys.Battle.BattleBuffScapegoat.onStartGame = function (slot0, slot1) slot0:updateGoatsList(slot1) end ys.Battle.BattleBuffScapegoat.onFriendlyShipDying = function (slot0, slot1) slot0:updateGoatsList(slot1) end ys.Battle.BattleBuffScapegoat.updateGoatsList = function (slot0, slot1) slot0._goatList = slot0:getTargetList(slot1, slot0._target, slot0._tempData.arg_list) slot0._goatCount = #slot0._goatList end ys.Battle.BattleBuffScapegoat.onTakeDamage = function (slot0, slot1, slot2, slot3) if not slot0.Battle.BattleFormulas.IsHappen(slot0._rant) then return "chance" end if slot3.miss then return end slot5 = math.floor(slot3.damage / slot0._goatCount) * -1 slot6 = {} for slot10, slot11 in ipairs(slot0._goatList) do slot6[#slot6 + 1] = slot11 end for slot10, slot11 in ipairs(slot6) do slot11:UpdateHP(slot5, { isMiss = false, isCri = false, isHeal = false, isShare = true }) end slot3.damage = 0 end return
local LoseGameSystem = tiny.processingSystem() LoseGameSystem.keyboard = true LoseGameSystem.filter = tiny.requireAll('score') function LoseGameSystem:process(entity, ev) if ev.isDown then love.event.quit() end end return LoseGameSystem
group("third_party") project("spirv-tools") uuid("621512da-bb50-40f2-85ba-ae615ff13e68") kind("StaticLib") language("C++") links({ }) defines({ "_LIB", }) includedirs({ "spirv-headers/include", "spirv-tools/include", "spirv-tools/source", }) files({ "spirv-tools/include/spirv-tools/libspirv.h", -- "spirv-tools/source/opt/basic_block.h", -- "spirv-tools/source/opt/function.cpp", -- "spirv-tools/source/opt/function.h", -- "spirv-tools/source/opt/instruction.cpp", -- "spirv-tools/source/opt/instruction.h", -- "spirv-tools/source/opt/ir_loader.cpp", -- "spirv-tools/source/opt/ir_loader.h", -- "spirv-tools/source/opt/module.cpp", -- "spirv-tools/source/opt/module.h", -- "spirv-tools/source/opt/reflect.h", "spirv-tools/source/val/BasicBlock.cpp", "spirv-tools/source/val/BasicBlock.h", "spirv-tools/source/val/Construct.cpp", "spirv-tools/source/val/Construct.h", "spirv-tools/source/val/Function.cpp", "spirv-tools/source/val/Function.h", "spirv-tools/source/val/ValidationState.cpp", "spirv-tools/source/val/ValidationState.h", "spirv-tools/source/assembly_grammar.cpp", "spirv-tools/source/assembly_grammar.h", "spirv-tools/source/binary.cpp", "spirv-tools/source/binary.h", "spirv-tools/source/diagnostic.cpp", "spirv-tools/source/diagnostic.h", "spirv-tools/source/disassemble.cpp", "spirv-tools/source/ext_inst.cpp", "spirv-tools/source/ext_inst.h", "spirv-tools/source/instruction.cpp", "spirv-tools/source/instruction.h", "spirv-tools/source/macro.h", "spirv-tools/source/opcode.cpp", "spirv-tools/source/opcode.h", "spirv-tools/source/operand.cpp", "spirv-tools/source/operand.h", "spirv-tools/source/print.cpp", "spirv-tools/source/print.h", -- "spirv-tools/source/software_version.cpp", "spirv-tools/source/spirv_constant.h", "spirv-tools/source/spirv_definition.h", "spirv-tools/source/spirv_endian.cpp", "spirv-tools/source/spirv_endian.h", "spirv-tools/source/spirv_target_env.cpp", "spirv-tools/source/spirv_target_env.h", "spirv-tools/source/table.cpp", "spirv-tools/source/table.h", "spirv-tools/source/text.cpp", "spirv-tools/source/text.h", "spirv-tools/source/text_handler.cpp", "spirv-tools/source/text_handler.h", "spirv-tools/source/validate.cpp", "spirv-tools/source/validate.h", "spirv-tools/source/validate_cfg.cpp", "spirv-tools/source/validate_id.cpp", "spirv-tools/source/validate_instruction.cpp", "spirv-tools/source/validate_layout.cpp", "spirv-tools/source/validate_ssa.cpp", "spirv-tools/source/util/bitutils.h", "spirv-tools/source/util/hex_float.h", })
--[[ Warp Splinter yells: Children, come to me! Warp Splinter yells: Maybe this is not-- No, we fight! Come to my aid! Warp Splinter yells: So... confused. Do not... belong here. Warp Splinter yells: What am I doing? Why do I... Warp Splinter yells: Who disturbs this sanctuary? Warp Splinter yells: You must die! But wait: this does not-- No, no... you must die!]] function Splinter(Unit, event, miscUnit, misc) Unit:RegisterEvent("Splinter_Heal", 1000, 1) Unit:RegisterEvent("Splinter_War_Stomp", 21000, 0) Unit:RegisterEvent("Splinter_Arcane_Volley", 31000, 0) end function Splinter_Heal(Unit) if((Unit:GetHealthPct() < 25) and (Didthat == 0)) then Unit:FullCastSpell(39321) Didthat = 1 else end end function Splinter_War_Stomp(Unit, event, miscUnit, misc) Unit:FullCastSpellOnTarget(36835, Unit:GetClosestPlayer()) end function Splinter_Arcane_Volley(Unit, event, miscUnit, misc) Unit:FullCastSpellOnTarget(29885, Unit:GetClosestPlayer()) end RegisterUnitEvent(17977, 1, "Splinter")
require "lunit" module("tests.e2.undead", package.seeall, lunit.testcase) function setup() eressea.free_game() end function test_undead_give_item() local r1 = region.create(0, 0, "plain") local f1 = faction.create("hodor@eressea.de", "human", "de") local u1 = unit.create(f1, r1, 1) u1.race = "undead" u1:clear_orders() u1:add_item("log", 1) u1:add_order("GIB 0 1 Holz") process_orders() assert_equal(0, u1:get_item("log")) end function test_undead_dont_give_person() local r1 = region.create(0, 0, "plain") local f1 = faction.create("hodor@eressea.de", "human", "de") local u1 = unit.create(f1, r1, 2) u1.race = "undead" u1:clear_orders() u1:add_item("log", 1) u1:add_order("GIB 0 1 Person") process_orders() assert_equal(2, u1.number) end
local GUI = { } local function inRect(pos, dim, point) return pos.x < point.x and pos.x + dim.x > point.x and pos.y < point.y and pos.y + dim.y > point.y end local function pressed(pos, dim) for k,v in pairs(Input.released) do if inRect(pos, dim, v.down) and inRect(pos, dim, v.pos) then return true end end return false end local function renderButton(item, renderer, pos, dim, content) local cond = false for _, v in pairs(Input.pointers) do if inRect(pos, dim, v.down) and inRect(pos, dim, v.pos) then cond = true break end end local color if cond then color = item.highlight else color = item.color end renderer:addFrame(item.bgFrame, pos, dim, color) if type(content) == "string" then local size = vec2(item.size, item.size) * item.font:measure(content); local fpos = pos + ((dim - size) / 2) renderer:addText(item.font, content, fpos, item.textColor, vec2(item.size, item.size), vec2(0.2, 0.6)) else --Frames used are actually Frame[1] normally... local frame = content[0] local size = vec2(frame.width * frame.texture.width, frame.height * frame.texture.height) local fpos = pos + ((dim - size) / 2); renderer:addFrame(frame, fpos, size, 0xFFFFFFFF) end end local function renderTextBox(item, renderer, pos, dim, text, hint) local color local tex if text and #text > 0 then color = item.fgColor tex = text else color = item.htColor tex = hint end renderer:addFrame(item.bgFrame, pos, dim, item.bgColor) local size = item.size * item.font:measure(tex); local fpos = pos + vec2(0, (dim.y - size.y) / 2) renderer:addText(item.font, tex, fpos, color, item.size, vec2(0.2, 0.6)) end local function renderToggle(item, renderer, pos, dim, value) local color local img if value then color = item.toggleColor img = item.toggleFrame else color = item.untoggleColor img = item.untoggleFrame end renderer:addFrame(img, pos, dim, color) end local function renderSlider(item, renderer, pos, dim, value) local long = math.max(dim.x, dim.y) local short = math.min(dim.x, dim.y) local off = long * 0.01 * value - short / 2 off = math.min(math.max(off, 0), long - short) renderer:addFrame(item.bgFrame, pos, dim, item.bgColor) local sPos if dim.y < dim.x then sPos = pos + vec2(off, 0) else sPos = pos + vec2(0, off) end renderer:addFrame(item.fgFrame, sPos, vec2(short, short), item.fgColor) end function GUI:button(pos, dim, text) self.buttonRenderer:render(self.renderer, pos, dim, text) return pressed(pos, dim) end function GUI:textBox(pos, dim, text, hint) --Focus is hard so i skip it for now! if Input.string then if not text then text = "" end text = text .. Input.string end if pressed(pos, dim) then Input.showKeyboard() end --Do text input logic self.textBoxRenderer:render(self.renderer, pos, dim, text, hint) end function GUI:toggle(pos, dim, value) self.toggleRenderer:render(self.renderer, pos, dim, value) local res = pressed(pos, dim) if res then return not value else return value end end function GUI:slider(pos, dim, value) for _, v in pairs(Input.pointers) do if inRect(pos, dim, v.down) then if dim.y < dim.x then local calc = ((v.pos - pos).x / dim.x) * 100 value = math.max(0, math.min(100, calc)) else local calc = ((v.pos - pos).y / dim.y) * 100 value = math.max(0, math.min(100, calc)) end end end --Calculate Value based on stuff self.sliderRenderer:render(self.renderer, pos, dim, value, min, max) return value end function GUI:init(renderer, fonts, frame) self.buttonRenderer = { font = fonts:find("consola"), size = 20, bgFrame = frame, color = 0xFFFFFFFF, highlight = 0xFF00FFFF, textColor = 0xFF00FF00, render = renderButton } self.textBoxRenderer = { font = fonts:find("consola"), size = vec2(20,20), bgFrame = frame, bgColor = 0xFFFFFFFF, htColor = 0xFFaaaaaa, fgColor = 0xFFaa3300, render = renderTextBox } self.toggleRenderer = { toggleFrame = frame, untoggleFrame = frame, toggleColor = 0xFFFFFFFF, untoggleColor = 0xFF000000, render = renderToggle } self.sliderRenderer = { bgFrame = frame, fgFrame = frame, bgColor = 0xFF00FFFF, fgColor = 0xFFFF0000, render = renderSlider } self.renderer = renderer end Type.define(GUI, "GUI")
require('nvim-treesitter.configs').setup { highlight = { enable = true, }, indent = { enable = true, }, autotag = { enable = true, }, ensure_installed = { 'bash', 'css', 'html', 'javascript', 'json', 'lua', 'yaml', }, keymaps = { ['af'] = '@function.outer', ['if'] = '@function.inner', }, textobjects = { lsp_interop = { enable = true, border = 'single', peek_definition_code = { ['<leader>df'] = '@function.outer', }, }, move = { enable = true, set_jumps = true, -- whether to set jumps in the jumplist goto_next_start = { [']m'] = '@function.outer', }, goto_next_end = { [']M'] = '@function.outer', }, goto_previous_start = { ['[m'] = '@function.outer', }, goto_previous_end = { ['[M'] = '@function.outer', }, }, swap = { enable = true, swap_next = { ['<leader>a'] = '@parameter.inner', }, swap_previous = { ['<leader>A'] = '@parameter.inner', }, }, }, playground = { enable = true, disable = {}, updatetime = 25, -- Debounced time for highlighting nodes in the playground from source code persist_queries = false, -- Whether the query persists across vim sessions keybindings = { toggle_query_editor = 'o', toggle_hl_groups = 'i', toggle_injected_languages = 't', toggle_anonymous_nodes = 'a', toggle_language_display = 'I', focus_language = 'f', unfocus_language = 'F', update = 'R', goto_node = '<cr>', show_help = '?', }, }, }
-- Questo script disabilita lo Shift Lock. game.StarterPlayer.EnableMouseLockOption = false
local M = {} M.disable_buffer = function() if pcall(require, 'virt-column') then require('virt-column').setup_buffer({ virtcolumn = '' }) end end return M
local util = require"lacord.util" local SEPARATOR = require"lacord.x.command".SEPARATOR local components = require"lacord.x.components" local insert = table.insert local iiter = ipairs local get = rawget local setm = setmetatable local _ENV = {} --luacheck: ignore 111 local command_ctx = {__name = "lacord.x.command_context"} local guild_command_ctx = {__name = "lacord.x.guild_command_context"} local spec = { 'source', 'id', 'application_id', 'token', 'channel_id', 'user', 'args', 'me', 'config', 'type', 'resolved', 'target_id', } for i, v in iiter(spec) do spec[v] = i end local guild_spec = { 'source', 'id', 'application_id', 'token', 'guild_id', 'channel_id', 'member', 'args', 'me', 'config', 'type', 'resolved', 'target_id', } for i, v in iiter(guild_spec) do guild_spec[v] = i end function command_ctx:__index(k) if spec[k] then return get(self, spec[k]) else return command_ctx[k] end end function guild_command_ctx:__index(k) if guild_spec[k] then return get(self, guild_spec[k]) elseif guild_command_ctx[k] then return guild_command_ctx[k] end end setm(guild_command_ctx, {__index = command_ctx}) function contextualize(source, payload, args, _me, config) local ctx = { source, payload.id, payload.application_id, payload.token, } local ctxcommand = payload.data.type and payload.data.type > 1 if ctxcommand then ctx[1] = 'click' .. SEPARATOR .. ctx[1] end if payload.guild_id then ctx[1] = 'guild' .. SEPARATOR .. ctx[1] insert(ctx, payload.guild_id) insert(ctx, payload.channel_id) insert(ctx, payload.member) else insert(ctx, payload.channel_id) insert(ctx, payload.user) end insert(ctx, args) insert(ctx, _me) insert(ctx, config) insert(ctx, payload.data.type|0) if payload.data.resolved then insert(ctx, payload.data.resolved) if payload.data.target_id then insert(ctx, payload.data.target_id) end end return setm(ctx, payload.guild_id and guild_command_ctx or command_ctx) end function command_ctx:reply(msg, files) return components.acknowledge_and_reply(self.me.api, self, msg, files) end function command_ctx:reply_ephemerally(msg, files) return components.acknowledge_and_reply_ephemerally(self.me.api, self, msg, files) end function command_ctx:defer() return components.loading(self.me.api, self) end function command_ctx:ephemeral_defer() return components.loading_ephemeral(self.me.api, self) end function command_ctx:get_command_id() if util.startswith(self.source, 'guild') then local st = self.source:find(SEPARATOR, 1, true) local root = st and self.source:sub(st + 1) or self.source local cache = self.me.guild_discovery[self.guild_id] return cache and cache[root] else local st = self.source:find(SEPARATOR, 1, true) local root = st and self.source:sub(1, st - 1) or self.source return self.me.commands[root].id end end return _ENV
local M = {} function M.error(msg) print("[Error] " .. msg) end function M.warning(msg) print("[Warning] " .. msg) end function M.info(msg) print("[Info] " .. msg) end return M
local noise = require("noise") local tne = noise.to_noise_expression -- Remove decorative placements. These bloat map sizes. local decoratives = data.raw["optimized-decorative"] for key, decorative in pairs(decoratives) do if decorative.autoplace ~= nil then decorative.autoplace.probability_expression = tne(0); end end
local Color = Config.common.color.Color local utils = Config.common.utils local hl = Config.common.hl local api = vim.api local hi, hi_link, hi_clear = hl.hi, hl.hi_link, hl.hi_clear local colorscheme = "catppuccin" vim.opt.bg = "dark" vim.g.ayucolor = "dark" vim.g.gruvbox_italic = 1 vim.g.gruvbox_contrast_dark = "medium" vim.g.gruvbox_invert_selection = 0 vim.g.gruvbox_material_background = "medium" vim.g.gruvbox_material_enable_italic = 1 vim.g.gruvbox_material_diagnostic_line_highlight = 1 vim.g.base16colorspace = 256 vim.g.seoul256_background = 234 vim.g.palenight_terminal_italics = 1 vim.g.neodark = "#202020" vim.g.neodark = 0 vim.g.neodark = 1 vim.g.spacegray_use_italics = 1 vim.g.spacegray_low_contrast = 1 vim.g.rose_pine_variant = "moon" vim.g.rose_pine_enable_italics = true vim.g.tokyonight_style = "storm" vim.g.tokyonight_dark_sidebar = 1 vim.g.tokyonight_sidebars = { "qf", "packer", "DiffviewFiles" } if vim.g.tokyonight_style == "night" then vim.g.tokyonight_colors = { ["bg_dark"] = "#16161F", ["bg_popup"] = "#16161F", ["bg_statusline"] = "#16161F", ["bg_sidebar"] = "#16161F", ["bg_float"] = "#16161F", } else vim.g.tokyonight_colors = nil end require "nvim-config.plugins.material"() local M = {} function M.apply_terminal_defaults() -- black vim.g.terminal_color_0 = "#222222" vim.g.terminal_color_8 = "#666666" -- red vim.g.terminal_color_1 = "#e84f4f" vim.g.terminal_color_9 = "#d23d3d" -- green vim.g.terminal_color_2 = "#b7ce42" vim.g.terminal_color_10 = "#bde077" -- yellow vim.g.terminal_color_3 = "#fea63c" vim.g.terminal_color_11 = "#ffe863" -- blue vim.g.terminal_color_4 = "#66a9b9" vim.g.terminal_color_12 = "#aaccbb" -- magenta vim.g.terminal_color_5 = "#b7416e" vim.g.terminal_color_13 = "#e16a98" -- cyan vim.g.terminal_color_6 = "#6dc1b6" vim.g.terminal_color_14 = "#42717b" -- white vim.g.terminal_color_7 = "#cccccc" vim.g.terminal_color_15 = "#ffffff" end function M.generate_diff_colors() local bg = vim.o.bg local hl_bg_normal = hl.get_bg "Normal" or (bg == "dark" and "#111111" or "#eeeeee") local bg_normal = Color.from_hex(hl_bg_normal) local base_add = Color.from_hex(hl.get_fg "diffAdded" or "#b7ce42") local base_del = Color.from_hex(hl.get_fg "diffRemoved" or "#e84f4f") local base_mod = Color.from_hex(hl.get_fg "diffChanged" or "#51afef") local bg_add = base_add:blend(bg_normal, 0.85):mod_saturation(0.05) local bg_del = base_del:blend(bg_normal, 0.85):mod_saturation(0.05) local bg_mod = base_mod:blend(bg_normal, 0.85):mod_saturation(0.05) local bg_mod_text = base_mod:blend(bg_normal, 0.7):mod_saturation(0.05) hi("DiffAdd", { bg = bg_add:to_css(), fg = "NONE", gui = "NONE" }) hi("DiffDelete", { bg = bg_del:to_css(), fg = "NONE", gui = "NONE" }) hi("DiffChange", { bg = bg_mod:to_css(), fg = "NONE", gui = "NONE" }) hi("DiffText", { bg = bg_mod_text:to_css(), fg = "NONE", gui = "NONE" }) end function M.apply_log_defaults() hi_link("logLevelTrace", "DiagnosticHint") hi_link({ "logLevelInfo", "logLevelNotice" }, "DiagnosticInfo") hi_link({ "logLevelWarning", "logLevelDebug", "logLevelAlert" }, "DiagnosticWarn") hi_link({ "logLevelError", "logLevelCritical", "logLevelEmergency" }, "DiagnosticError") end function M.apply_tweaks() if not vim.g.colors_name then utils.warn "'g:colors_name' is not defined!" vim.g.colors_name = "UNKNOWN" end colorscheme = vim.g.colors_name local bg = vim.o.bg hi_clear "Cursor" if colorscheme == "codedark" then hi("NonText", { bg = "NONE" }) M.generate_diff_colors() elseif colorscheme == "tender" then hi("Visual", { gui = "NONE", bg = "#293b44" }) hi("VertSplit", { fg = "#202020", bg = "NONE" }) hi("Search", { gui = "bold", fg = "#dddddd", bg = "#7a6a24" }) M.generate_diff_colors() elseif colorscheme == "horizon" then hi("NonText", { fg = "#414559", bg = "NONE" }) hi("VertSplit", { gui = "bold", fg = "#0f1117", bg = "NONE" }) hi("Pmenu", { bg = "#272c42", fg = "#eff0f4" }) hi("PmenuSel", { bg = "#5b6389" }) hi("PmenuSbar", { bg = "#3d425b" }) hi("PmenuThumb", { bg = "#0f1117" }) hi("CursorLineNr", { gui = "bold", fg = "#09f7a0", bg = "NONE" }) hi("QuickFixLine", { bg = "#335172", fg = "NONE" }) hi_link "vimVar" hi_link "vimFuncVar" hi_link "vimUserFunc" hi_link "jsonQuote" M.generate_diff_colors() elseif colorscheme == "monokai_pro" then hi("NonText", { fg = "#5b595c", bg = "None" }) hi("VertSplit", { fg = "#696769", bg = "None" }) hi("Pmenu", { fg = "#a9dc76", bg = "#252226" }) hi("PmenuSel", { bg = "#403e41" }) hi("PmenuSbar", { bg = "Grey" }) hi("PmenuThumb", { bg = "White" }) hi("CursorLineNr", { gui = "bold", fg = "Yellow", bg = "#423f42" }) hi("SignColumn", { bg = "#423f42" }) hi("FoldColumn", { fg = "Cyan", bg = "#423f42" }) hi("QuickFixLine", { bg = "#714754", fg = "NONE" }) hi("Search", { fg = "#ffd866", gui = "bold,underline" }) hi_link "vimVar" hi_link "vimFuncVar" hi_link "vimUserFunc" hi_link "jsonQuote" M.generate_diff_colors() elseif colorscheme == "gruvbox-material" then hi("CursorLineNr", { gui = "bold", fg = "#a9b665" }) M.generate_diff_colors() elseif colorscheme == "predawn" then hi("NonText", { fg = "#3c3c3c", bg = "None" }) hi("CursorLine", { bg = "#303030" }) hi("SignColumn", { fg = "#8c8c8c", bg = "#3c3c3c" }) hi_link "vimVar" hi_link "vimFuncVar" hi_link "vimUserFunc" hi_link "jsonQuote" hi("GitGutterAdd", { fg = "#46830d", bg = "None" }) hi("GitGutterChange", { fg = "#243958", bg = "None" }) hi("GitGutterDelete", { fg = "#8b0808", bg = "None" }) elseif colorscheme == "nvcode" then hi("CocExplorerGitIgnored", { fg = "#5C6370" }) hi_link("GitGutterAdd", "diffAdded") hi_link("GitGutterRemoved", "diffRemoved") hi_link("GitGutterChange", "diffChanged") hi_link "vimVar" hi_link "vimFuncVar" hi_link "vimUserFunc" elseif colorscheme == "zephyr" then hi("Visual", { fg = "NONE", bg = "#393e49" }) elseif colorscheme == "tokyonight" then hi_link("ColorColumn", "CursorLine") if bg == "dark" then hi("DiffAdd", { bg = "#283B4D", fg = "NONE" }) hi("DiffChange", { bg = "#28304d", fg = "NONE" }) hi("DiffText", { bg = "#36426b", fg = "NONE" }) end hi_link("GitsignsAdd", "String") -- hi_link("DiffviewNormal", "NormalSB") elseif colorscheme == "everforest" then hi("SignColumn", { bg = "NONE" }) hi("FoldColumn", { bg = "NONE" }) hi("OrangeSign", { bg = "NONE" }) hi("GreenSign", { bg = "NONE" }) hi("PurpleSign", { bg = "NONE" }) hi("RedSign", { bg = "NONE" }) hi("YellowSign", { bg = "NONE" }) hi("AquaSign", { bg = "NONE" }) hi("BlueSign", { bg = "NONE" }) if bg == "light" then hi("Search", { bg = "#35a77c" }) hi("CursorLineNr", { gui = "bold", bg = "NONE", fg = "#8da101" }) hi("DiffAdd", { bg = "#EBF4BF", fg = "NONE" }) hi("DiffDelete", { bg = "#FCDDCC", fg = "NONE" }) hi("DiffChange", { bg = "#E3ECE4", fg = "NONE" }) hi("DiffText", { bg = "#BEDFE6", fg = "NONE" }) else hi("CursorLineNr", { gui = "bold", bg = "NONE", fg = "#a7c080" }) -- hi("DiffText", { bg = "#4a6778", fg = "NONE", }) M.generate_diff_colors() end elseif colorscheme == "palenight" then local bg_normal = Color.from_hl("Normal", "bg") hi("Visual", { bg = bg_normal:clone():mod_value(0.18):mod_saturation(0.2):to_css() }) hi("CursorLine", { bg = "#212433" }) hi("StatusLine", { bg = "#212433" }) hi("StatusLineNC", { bg = "#212433" }) hi("Folded", { bg = "#1e212e" }) hi("ColorColumn", { bg = "#33384d" }) hi("NonText", { fg = "#3c445f" }) hi("TabLineSel", { fg = "#82b1ff" }) hi("IndentBlanklineContextChar", { fg = "#82b1ff" }) hi("EndOfBuffer", { fg = "#292D3E" }) hi("PmenuThumb", { bg = "#6A3EB5" }) hi_link("QuickFixLine", "DiffText") hi_link("NvimTreeIndentMarker", "LineNr") hi_link("TelescopeBorder", "Directory") hi("DiffAdd", { bg = "#344a4d", fg = "NONE" }) hi("DiffDelete", { bg = "#4b3346", fg = "NONE" }) hi("DiffChange", { bg = "#32395c", fg = "NONE" }) hi("DiffText", { bg = "#3f4a87", fg = "NONE" }) hi("diffChanged", { fg = "#82b1ff" }) hi("GitSignsChange", { fg = "#82b1ff" }) hi("LspReferenceText", { bg = bg_normal:clone():mod_value(0.12):to_css() }) hi("LspReferenceRead", { bg = bg_normal:clone():mod_value(0.12):to_css() }) hi("LspReferenceWrite", { bg = bg_normal:clone():mod_value(0.12):to_css() }) hi("NvimTreeRootFolder", { fg = "#C3E88D", gui = "bold" }) hi("NvimTreeFolderIcon", { fg = "#F78C6C" }) hi("NvimTreeNormal", { bg = "#222533" }) hi("NvimTreeCursorLine", { bg = "#33374c" }) hi("NvimTreeGitDirty", { fg = "#ffcb6b" }) elseif colorscheme == "onedarkpro" then if bg == "dark" then hi("Cursor", { bg = "#61afef" }) hi("Identifier", { fg = "#c678dd" }) hi("TabLineSel", { fg = "#61afef", bg = "NONE" }) hi("Whitespace", { fg = "#303030" }) hi("NonText", { fg = "#303030" }) hi("IndentBlanklineContextChar", { fg = "#61afef" }) hi("CursorLine", { bg = "#252525" }) hi("FoldColumn", { bg = "#1e1e1e", fg = "#61afef" }) hi("StatusLine", { bg = "#2e2e2e" }) hi("LspReferenceText", { bg = "#2e2e2e" }) hi("NvimTreeOpenedFolderName", { fg = "#61afef", gui = "italic,bold" }) hi("NvimTreeRootFolder", { fg = "#98c379" }) hi("NvimTreeGitDirty", { fg = "#e5c07b" }) hi("NvimTreeGitStaged", { fg = "#98c379" }) hi("TelescopeSelection", { fg = "#c678dd", bg = "#2e2e2e" }) hi_link("TelescopeBorder", "Directory") M.generate_diff_colors() end elseif colorscheme == "doom-one" then if bg == "dark" then hi("diffAdded", { bg = "#3E493D", fg = "#97BE65" }) hi("diffRemoved", { bg = "#4F343A", fg = "#FF6C69" }) hi("diffChanged", { fg = "#51afef" }) hi("GitSignsChange", { fg = "#51afef" }) hi("TermCursor", { fg = "NONE" }) hi_link "TermCursor" hi("NvimTreeRootFolder", { gui = "bold" }) hi("SpellCap", { sp = "#51afef" }) hi("SpellBad", { sp = "#FF6C69" }) hi("SpellRare", { sp = "#a9a1e1" }) hi("SpellLocal", { sp = "#da8548" }) M.generate_diff_colors() vim.opt.pumblend = 0 end elseif colorscheme == "catppuccin" then local bg_normal = Color.from_hl("Normal", "bg") hi_link("ColorColumn", "CursorLine", { force = true }) hi("diffAdded", { fg = "#B3E1A3" }) hi("diffChanged", { fg = "#A4B9EF" }) hi("Visual", { gui = "NONE", bg = bg_normal:clone():mod_value(0.1):to_css() }) hi({ "NormalFloat", "StatusLine" }, { bg = bg_normal:clone():mod_value(-0.025):to_css() }) hi("ModeMsg", { fg = "#98BBF5" }) hi({ "TsNumber", "TsFloat" }, { gui = "NONE" }) hi("IndentBlanklineContextChar", { fg = "#B5E8E0" }) hi("TablineSel", { bg = "NONE" }) hi("TelescopeBorder", { fg = hl.get_fg "FloatBorder" }) hi("TelescopePromptPrefix", { fg = "#F08FA9" }) M.apply_log_defaults() M.generate_diff_colors() end -- FloatBorder hi("FloatBorder", { bg = hl.get_bg "NormalFloat" or "NONE", fg = hl.get_fg { "FloatBorder", "Normal" }, }) -- Custom diff hl hi("DiffAddAsDelete", { bg = hl.get_bg("DiffDelete", false) or "#FF6C69", fg = hl.get_fg("DiffDelete", false) or "NONE", gui = hl.get_gui("DiffDelete", false) or "NONE", }) hi_link("DiffDelete", "Comment") end do hi("NonText", { gui = "nocombine" }) hi_link("LspReferenceText", "Visual", { default = true }) hi_link("LspReferenceRead", "Visual", { default = true }) hi_link("LspReferenceWrite", "Visual", { default = true }) hi_link({ "illuminateWord", "illuminatedWord", "illuminateCurWord" }, "LspReferenceText", { default = true }) M.apply_log_defaults() api.nvim_exec( [[ augroup colorscheme_config au! au ColorScheme * call v:lua.Config.colorscheme.apply_tweaks() augroup END ]], false ) end Config.colorscheme = M vim.cmd("colorscheme " .. colorscheme) return M
return {'oxidase','oxidatie','oxidatief','oxide','oxideren','oxidelaag','oxidehuid','oxidant','oxideerde','oxideert','oxiden','oxidatieve','oxiderend','oxiderende','oxides','oxidaties'}
local v = vim.api local Editor = {} Editor.get_curr_char = function () local byte_index = v.nvim_win_get_cursor(0)[2] return v.nvim_get_current_line():sub(byte_index, byte_index) end Editor.is_curr_char_space = function() return string.find(Editor.get_curr_char(), '%s') ~= nil end return Editor
--[[ Copyright (c) 2018 Optera * Part of Re-Stack * * See LICENSE.md in the project directory for license information. --]] -- Get ammo by category and set stack size local function SetByAmmoCategory(type, stack_size) if stack_size > 0 then for _, ammo in pairs(data.raw.ammo) do if ammo.ammo_type.category == type then log("[RS] Setting "..tostring(type).."."..tostring(ammo.name)..".stack_size "..ammo.stack_size.." -> "..stack_size) ammo.stack_size = stack_size end end end end SetByAmmoCategory("bullet", settings.startup["ReStack-ammo-bullet"].value) SetByAmmoCategory("shotgun-shell", settings.startup["ReStack-ammo-shotgun"].value) SetByAmmoCategory("flamethrower", settings.startup["ReStack-ammo-flamethrower"].value) SetByAmmoCategory("rocket", settings.startup["ReStack-ammo-rocket"].value) SetByAmmoCategory("cannon-shell", settings.startup["ReStack-ammo-cannon"].value) SetByAmmoCategory("artillery-shell", settings.startup["ReStack-ammo-artillery"].value)
function digit (value) value = value / 8 if value >= 10 then return 0 end return value end oldvalue = 0 function reward () value = digit(data.score0) value = value + digit(data.score1) * 10 value = value + digit(data.score2) * 100 value = value + digit(data.score3) * 1000 value = value + digit(data.score4) * 10000 value = value + digit(data.score5) * 100000 newvalue = value - oldvalue oldvalue = value return newvalue end
--include("shared.lua") --AddCSLuaFile("shared.lua") --AddCSLuaFile("cl_init.lua") SWEP.Author = "TP Hunter NL" SWEP.Contact = "http:--facepunch.com/showthread.php?t=1328089" SWEP.Purpose = "Sit inside train and put it into reverser slot, turn reverser to forward, drive the train" SWEP.Instructions = "Used as a key and reverser handle for the subway trains" SWEP.Spawnable = false SWEP.AdminSpawnable = false SWEP.Category = "Metrostroi" SWEP.UseHands = false SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = false SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none"
local window = require('cmp.utils.window') local config = require('cmp.config') ---@class cmp.DocsView ---@field public window cmp.Window local docs_view = {} ---Create new floating window module docs_view.new = function() local self = setmetatable({}, { __index = docs_view }) self.entry = nil self.window = window.new() self.window:option('conceallevel', 2) self.window:option('concealcursor', 'n') self.window:option('foldenable', false) self.window:option('scrolloff', 0) self.window:option('wrap', true) return self end ---Open documentation window ---@param e cmp.Entry ---@param view cmp.WindowStyle docs_view.open = function(self, e, view) local documentation = config.get().documentation if not documentation then return end if not e or not view then return self:close() end local right_space = vim.o.columns - (view.col + view.width) - 2 local left_space = view.col - 2 local maxwidth = math.min(documentation.maxwidth, math.max(left_space, right_space) - 1) -- update buffer content if needed. if not self.entry or e.id ~= self.entry.id then local documents = e:get_documentation() if #documents == 0 then return self:close() end self.entry = e vim.api.nvim_buf_call(self.window:get_buffer(), function() vim.cmd([[syntax clear]]) end) vim.lsp.util.stylize_markdown(self.window:get_buffer(), documents, { max_width = maxwidth, max_height = documentation.maxheight, }) end local width, height = vim.lsp.util._make_floating_popup_size(vim.api.nvim_buf_get_lines(self.window:get_buffer(), 0, -1, false), { max_width = maxwidth, max_height = documentation.maxheight, }) if width <= 0 or height <= 0 then return self:close() end local right_col = view.col + view.width local left_col = view.col - width - 2 local col, left if right_space >= width and left_space >= width then if right_space < left_space then col = left_col left = true else col = right_col end elseif right_space >= width then col = right_col elseif left_space >= width then col = left_col left = true else return self:close() end self.window:option('winhighlight', documentation.winhighlight) self.window:set_style({ relative = 'editor', style = 'minimal', width = width, height = height, row = view.row, col = col, border = documentation.border, }) if left and self.window:has_scrollbar() then self.window.style.col = self.window.style.col - 1 end self.window:open() end ---Close floating window docs_view.close = function(self) self.window:close() self.entry = nil end docs_view.scroll = function(self, delta) if self:visible() then local info = vim.fn.getwininfo(self.window.win)[1] or {} local top = info.topline or 1 top = top + delta top = math.max(top, 1) top = math.min(top, self.window:get_content_height() - info.height + 1) vim.defer_fn(function() vim.api.nvim_buf_call(self.window:get_buffer(), function() vim.api.nvim_command('normal! ' .. top .. 'zt') self.window:update() end) end, 0) end end docs_view.visible = function(self) return self.window:visible() end return docs_view
object_tangible_quest_talus_genetic_potential_datapad_07 = object_tangible_quest_shared_talus_genetic_potential_datapad_07:new { } ObjectTemplates:addTemplate(object_tangible_quest_talus_genetic_potential_datapad_07, "object/tangible/quest/talus_genetic_potential_datapad_07.iff")
--Automatically generated by SWGEmu Spawn Tool v0.12 loot editor. high_valocity_feed_mechanism = { minimumLevel = 0, maximumLevel = -1, customObjectName = "", directObjectTemplate = "object/tangible/component/weapon/projectile_feed_mechanism_enhancement_max_damage.iff", craftingValues = { {"maxdamage",20,20.01,1}, -- setting at 20,20.01, allows damage to be effected by legendary, exceptional, and yellow modifiers {"useCount",1,5,0}, }, customizationStringNames = {}, customizationValues = {} } addLootItemTemplate("high_valocity_feed_mechanism", high_valocity_feed_mechanism)
-- SPDX-License-Identifier: BSD-3-Clause -- -- Copyright 2016 Raritan Inc. All rights reserved. -- Iterates through all uploaded Lua scripts and prints it actually state out. -- The output will be written back to usb stick require "LuaService" -- get the LuaService Manager local lsManager = luaservice.Manager:getDefault() -- get all script names local scriptNames = lsManager:getScriptNames() -- helper functions to convert script state to a string function strFromState(_s) local ExecState = luaservice.ScriptState.ExecState if _s == ExecState.STAT_NEW then return "new" elseif _s == ExecState.STAT_RUNNING then return "running" elseif _s == ExecState.STAT_TERMINATED then return "terminated" elseif _s == ExecState.STAT_RESTARTING then return "restarting" else return "unkown" end end -- iterate through all scripts, get the state and print the state out for k,v in ipairs(scriptNames) do local err, state = lsManager:getScriptState(v) print(k .. ": " .. v .. " - state: " .. strFromState(state.execState)) end
---@class ISDebugBlood : ISDebugSubPanelBase ISDebugBlood = ISDebugSubPanelBase:derive("ISDebugBlood") function ISDebugBlood:initialise() ISDebugSubPanelBase.initialise(self) end function ISDebugBlood:createChildren() ISDebugSubPanelBase.createChildren(self) local x,y,w, obj = 10,10,self.width-30 self:initHorzBars(x, w) y, obj = ISDebugUtils.addLabel(self, "float_title", x+(w/2), y, "Blood on Body, not Clothes", UIFont.Medium) obj.center = true y = ISDebugUtils.addHorzBar(self, y+5)+5 local barMod = 3 local y2, label, value, slider self.partToSlider = {} for i=0,BloodBodyPartType.MAX:index()-1 do local part = BloodBodyPartType.FromIndex(i) y2,label = ISDebugUtils.addLabel(self, part, x, y, part:name(), UIFont.Small) y2,value = ISDebugUtils.addLabel(self, part, x+(w/2)-20, y, "0", UIFont.Small, false) y,slider = ISDebugUtils.addSlider(self, part, x+(w/2), y, w/2,18, self.onSliderChange) slider:setValues(0.0, 1.0, 0.01, 0.01, true) -- slider:setCurrentValue(getPlayer():getHumanVisual():getBlood(part)) self.partToSlider[part] = slider y = ISDebugUtils.addHorzBar(self, y+barMod)+barMod end y = y+5 y,obj = ISDebugUtils.addButton(self, "zeroAll", x, y, 200, 16, "ZERO ALL", self.onZeroAll) y = y+5 y,obj = ISDebugUtils.addButton(self, "addRandom", x, y, 200, 16, "ADD RANDOM", self.onRandomBlood) end function ISDebugBlood:prerender() ISDebugSubPanelBase.prerender(self) if self.updateTime + 500 < getTimestampMs() then self:setSliderValues() end end function ISDebugBlood:setSliderValues() local playerObj = getSpecificPlayer(0) self.updateTime = getTimestampMs() for i=0,BloodBodyPartType.MAX:index()-1 do local part = BloodBodyPartType.FromIndex(i) local slider = self.partToSlider[part] local newValue = playerObj:getHumanVisual():getBlood(part) self.ignoreSlider = true slider:setCurrentValue(newValue) self.ignoreSlider = false end end function ISDebugBlood:onSliderChange(_newval, _slider) local playerObj = getSpecificPlayer(0) if self.ignoreSlider then return end local part = _slider.customData playerObj:getHumanVisual():setBlood(part, _newval) playerObj:resetModelNextFrame() triggerEvent("OnClothingUpdated", playerObj) end function ISDebugBlood:onZeroAll() local playerObj = getSpecificPlayer(0) playerObj:getHumanVisual():removeBlood() playerObj:resetModelNextFrame() triggerEvent("OnClothingUpdated", playerObj) self:setSliderValues() end function ISDebugBlood:onRandomBlood() local playerObj = getSpecificPlayer(0) playerObj:addBlood(null, false, true, false) triggerEvent("OnClothingUpdated", playerObj) self:setSliderValues() end function ISDebugBlood:new(x, y, width, height, doStencil) local o = ISDebugSubPanelBase:new(x, y, width, height, doStencil) setmetatable(o, self) self.__index = self o.updateTime = 0 return o end
---- vim: ts=2 tabstop=2 shiftwidth=2 expandtab theme = {} theme.confdir = _Awesome.path.themes .. '/solarized-dark' --os.getenv("HOME") .. "/.config/awesome/themes/solarized-dark" theme.icons = _Awesome.path.themes .. '/icons' --os.getenv("HOME") .. "/.config/awesome/themes/solarized-dark/icons" theme.wallpaper = theme.confdir .. "/wall.png" -- | AWESOME WM | -- theme.awesome_icon = theme.icons .. '/awesome_icon.png' theme.lockscreen = theme.icons .. '/lockscreen.png' theme.browser = theme.icons .. '/browser.png' theme.console = theme.icons .. '/console.png' theme.filemanager = theme.icons .. '/filemanager.png' theme.email = theme.icons .. '/email.png' theme.awesomeManual = theme.icons .. '/awesomeManual.png' theme.sourceEdit = theme.icons .. '/sourceEdit.png' theme.file = theme.icons .. '/file.png' theme.updateAwesome = theme.icons .. '/updateAwesome.png' theme.themesAwesome = theme.icons .. '/themesAwesome.png' theme.poweroff = theme.icons .. '/poweroff.png' theme.restart = theme.icons .. '/restart.png' theme.applications = theme.icons .. '/applications.png' theme.lualogo = theme.icons .. '/luaLogo.png' theme.cloud9 = theme.icons .. '/cloud9.png' theme.develop = theme.icons .. '/develop.png' -- | GOOGLE APPS | -- theme.google_apps = theme.icons .. '/google/google_apps.png' -- theme.play_books = theme.icons .. '/google/play_book.png' theme.play_docs = theme.icons .. '/google/play_doc.png' theme.play_sheets = theme.icons .. '/google/play_sheet.png' theme.play_forms = theme.icons .. '/google/play_form.png' theme.play_slides = theme.icons .. '/google/play_slide.png' theme.play_drawings = theme.icons .. '/google/play_drawing.png' theme.play_drive = theme.icons .. '/google/play_drive.png' theme.play_hangouts = theme.icons .. '/google/play_hangouts.png' theme.play_calendar = theme.icons .. '/google/play_calendar.png' theme.play_news = theme.icons .. '/google/play_news.png' theme.play_contacts = theme.icons .. '/google/play_contacts.png' theme.play_inbox = theme.icons .. '/google/play_inbox.png' theme.radio_yandex = theme.icons .. '/radio.yandex.png' theme.music_yandex = theme.icons .. '/music.yandex.png' theme.music = theme.icons .. '/music.png' theme.ru101 = theme.icons .. '/101.png' theme.di = theme.icons .. '/di.png' theme.photoeditor = theme.icons .. '/photoeditor.png' theme.im = theme.icons .. '/im.png' theme.font = "Ohsnap 9" theme.english = theme.confdir .. "/icons/english.png" theme.russian = theme.confdir .. "/icons/russian.png" theme.colors = {} theme.colors.base3 = "#002b36ff" theme.colors.base2 = "#073642ff" theme.colors.base1 = "#586e75ff" theme.colors.base0 = "#657b83ff" theme.colors.base00 = "#839496ff" theme.colors.base01 = "#93a1a1ff" theme.colors.base02 = "#eee8d5ff" theme.colors.base03 = "#fdf6e3ff" theme.colors.yellow = "#b58900ff" theme.colors.orange = "#cb4b16ff" theme.colors.red = "#dc322fff" theme.colors.magenta = "#d33682ff" theme.colors.violet = "#6c71c4ff" theme.colors.blue = "#268bd2ff" theme.colors.cyan = "#2aa198ff" theme.colors.green = "#859900ff" --theme.taglist_font = -- {{{ Colors theme.fg_normal = theme.colors.base02 theme.fg_focus = theme.colors.base03 theme.fg_urgent = theme.colors.base3 theme.bg_normal = theme.colors.base3 theme.bg_focus = theme.colors.base1 theme.bg_urgent = theme.colors.red theme.bg_systray = theme.bg_normal -- }}} -- {{{ Borders theme.border_width = "1" theme.border_normal = theme.bg_normal theme.border_focus = theme.bg_focus theme.border_marked = theme.bg_urgent -- }}} -- {{{ Titlebars theme.titlebar_bg_focus = theme.bg_focus theme.titlebar_bg_normal = theme.bg_normal -- }}} -- {{{ Mouse finder theme.mouse_finder_color = theme.colors.green -- mouse_finder_[timeout|animate_timeout|radius|factor] -- }}} theme.submenu_icon = theme.confdir .. "/icons/submenu.png" theme.widget_temp = theme.confdir .. "/icons/temp.png" theme.widget_uptime = theme.confdir .. "/icons/ac.png" theme.widget_cpu = theme.confdir .. "/icons/cpu.png" theme.widget_weather = theme.confdir .. "/icons/dish.png" theme.widget_fs = theme.confdir .. "/icons/fs.png" theme.widget_mem = theme.confdir .. "/icons/mem.png" theme.widget_fs = theme.confdir .. "/icons/fs.png" theme.widget_note = theme.confdir .. "/icons/note.png" theme.widget_note_on = theme.confdir .. "/icons/note_on.png" theme.widget_netdown = theme.confdir .. "/icons/net_down.png" theme.widget_netup = theme.confdir .. "/icons/net_up.png" theme.widget_mail = theme.confdir .. "/icons/mail.png" theme.widget_batt = theme.confdir .. "/icons/bat.png" theme.widget_clock = theme.confdir .. "/icons/clock.png" theme.widget_vol = theme.confdir .. "/icons/spkr.png" theme.mpd = theme.confdir .. "/icons/mpd.png" theme.mpd_on = theme.confdir .. "/icons/mpd_on.png" theme.prev = theme.confdir .. "/icons/prev.png" theme.nex = theme.confdir .. "/icons/next.png" theme.stop = theme.confdir .. "/icons/stop.png" theme.pause = theme.confdir .. "/icons/pause.png" theme.play = theme.confdir .. "/icons/play.png" theme.taglist_squares_sel = theme.confdir .. "/icons/square_a.png" theme.taglist_squares_unsel = theme.confdir .. "/icons/square_b.png" theme.tasklist_disable_icon = true tasklist_only_icon = true theme.tasklist_floating = "" theme.tasklist_maximized_horizontal = "" theme.tasklist_maximized_vertical = "" theme.layout_tile = theme.confdir .. "/icons/tile.png" theme.layout_tilegaps = theme.confdir .. "/icons/tilegaps.png" theme.layout_tileleft = theme.confdir .. "/icons/tileleft.png" theme.layout_tilebottom = theme.confdir .. "/icons/tilebottom.png" theme.layout_tiletop = theme.confdir .. "/icons/tiletop.png" theme.layout_fairv = theme.confdir .. "/icons/fairv.png" theme.layout_fairh = theme.confdir .. "/icons/fairh.png" theme.layout_spiral = theme.confdir .. "/icons/spiral.png" theme.layout_dwindle = theme.confdir .. "/icons/dwindle.png" theme.layout_max = theme.confdir .. "/icons/max.png" theme.layout_fullscreen = theme.confdir .. "/icons/fullscreen.png" theme.layout_magnifier = theme.confdir .. "/icons/magnifier.png" theme.layout_floating = theme.confdir .. "/icons/floating.png" return theme
-- Fixing and modifying the testrepos to be used -- for testing luagit2's functions local fix_repo = {} -- Temporarily changes .gitted/ to .git/ -- Requires a string argument of testrepo's name function fix_repo.set_repo(repo_name) os.execute("cd ../ && mv .git/ .gitted/") os.execute(string.format( [[cp -r "%s" "%s"]], "Fixtures/" .. repo_name , "Fixtures/WORKON_REPO" )) os.execute("mv Fixtures/WORKON_REPO/.gitted/ Fixtures/WORKON_REPO/.git/ ") os.execute("cd Fixtures/WORKON_REPO/ && git config user.name \"TEST_USER\"") os.execute("cd Fixtures/WORKON_REPO/ && git config user.email \"testusernoreply@github.com\"") end function fix_repo.set_back() os.execute("rm -rf Fixtures/WORKON_REPO/") os.execute("cd ../ && mv .gitted/ .git/") end return fix_repo
local ADDON = ... local L = Wheel("LibLocale"):NewLocale(ADDON, "zhTW")
local xxh32 = require("luaxxhash") local f = io.open("sherlock.txt") local text = f:read("*all") local str = "Cats are interesting." local str1 = "a" local strt = { str1:rep(4), str1:rep(16), str1:rep(32), str1:rep(32) .. str1 .. str1:rep(4), str:rep(256), "", "dupa", str, str1, text } local answer = { 0xDA576727, 0x5DACDD8C, 0xA3234FBE, 0x3F87545B, 0xF1DB4C68, 0x02CC5D05, 0x1A47C09D, 0x65ED1AFC, 0x550D7456, 0xFAB5AEF6, } assert(xxh32('abc', 3, 0x5BD1E995) == 0xBDDEB201, "Hash produces incorrect value with seed") for i=1, #strt do local x = xxh32(strt[i]) assert(x == answer[i], "Hash produces incorrect values: " .. i .. " Hash: " .. x) end local testIndex = 10 local testRepeat = 10 local hashRepeat = 1000 function test(f) local times = {} local throughputs = {} local len = #strt[testIndex] for i=1,testRepeat do local start = os.clock() for i=1,hashRepeat do f(strt[testIndex], len) end local time = os.clock() - start local throughput = len*hashRepeat/time/(1024*1024*1024) table.insert(times, time) table.insert(throughputs, throughput) end print( ("min: %.3fs %.2f GB/s"):format( math.min(table.unpack(times)), math.min(table.unpack(throughputs))) ) print( ("max: %.3fs %.2f GB/s"):format( math.max(table.unpack(times)), math.max(table.unpack(throughputs))) ) end if not arg[1] then test(xxh32) local ok, murmur = pcall(require, 'murmurhash3') if ok then test(murmur) end end
local gbc = cc.import("#gbc") local JobsAction = cc.class("JobsAction", gbc.ActionBase) JobsAction.ACCEPTED_REQUEST_TYPE = "worker" function JobsAction:triggingAction(job) local key = job.data.key local number = job.data.number local redis = self:getInstance():getRedis() redis:set(key, number * 2) end return JobsAction
BuildEnv(...) local BrowseItem = Addon:NewClass('BrowseItem', GUI:GetClass('ItemButton')) function BrowseItem:Constructor() self:SetCheckedTexture([[Interface\HelpFrame\HelpFrameButton-Highlight]]) self:GetCheckedTexture():SetTexCoord(0, 1, 0, 0.57) self:SetHighlightTexture([[Interface\HelpFrame\HelpFrameButton-Highlight]], 'ADD') self:GetHighlightTexture():SetTexCoord(0, 1, 0, 0.57) local tLeft = self:CreateTexture(nil, 'BACKGROUND') do tLeft:SetTexture([[Interface\AuctionFrame\UI-AuctionItemNameFrame]]) tLeft:SetTexCoord(0, 0.078125, 0, 1) tLeft:SetWidth(10) tLeft:SetPoint('TOPLEFT') tLeft:SetPoint('BOTTOMLEFT') end local tRight = self:CreateTexture(nil, 'BACKGROUND') do tRight:SetTexture([[Interface\AuctionFrame\UI-AuctionItemNameFrame]]) tRight:SetTexCoord(0.75, 0.828125, 0, 1) tRight:SetWidth(10) tRight:SetPoint('TOPRIGHT') tRight:SetPoint('BOTTOMRIGHT') end local tMid = self:CreateTexture(nil, 'BACKGROUND') do tMid:SetTexture([[Interface\AuctionFrame\UI-AuctionItemNameFrame]]) tMid:SetTexCoord(0.078125, 0.75, 0, 1) tMid:SetPoint('TOPLEFT', tLeft, 'TOPRIGHT') tMid:SetPoint('BOTTOMRIGHT', tRight, 'BOTTOMLEFT') end end
local isMinimuze = false; local cursorEnable = false; local sw,sh = guiGetScreenSize() local marker; -- CFG local keyToggle = "mouse3" -- actived script local keyApply = "mouse1" -- teleport local keyOnCar = "mouse2" -- сonfirmation for teleporting to the car local sizePickup = 1.5 function isPauseMenuActive() return isMTAWindowActive() or isMinimuze or isConsoleActive() or false end function click() if cursorEnable and not isCursorShowing() then showCursor(true) end if isPauseMenuActive() then if cursorEnable and isCursorShowing() then showCursor(false) end end if cursorEnable and not isPauseMenuActive() then local sx, sy, posX, posY, posZ = getCursorPosition() if sx >= 0 and sy >= 0 and sx < sw and sy < sh then local camera = {getCameraMatrix()} local result, x,y,z,object,normalX, normalY, normalZ,material,lighting,piece = processLineOfSight(camera[1], camera[2], camera[3], posX, posY, posZ, true, true, false, true, false, false, false) if result then local curX, curY, curZ = getElementPosition(getLocalPlayer()) local normal = {normalX, normalY, normalZ}; local hitCord = {x,y,z} local car_info; local pos = Vector3(hitCord[1], hitCord[2], hitCord[3]) - (Vector3(normal[1], normal[2], normal[3]) * 0.1) local zOffset = 300 if normal[3] >= 0.5 then zOffset = 1 end local result, x,y,z = processLineOfSight(pos:getX(), pos:getY() , pos:getZ() + zOffset, pos:getX(), pos:getY() , pos:getZ() - 0.3, true, true, false, true, false, false, false) -- corrector Z if result then pos = Vector3(x,y,z + 1) end -- delete last marker and create new marker if isElement(marker) then destroyElement(marker) end marker = createMarker(pos:getX(), pos:getY() , pos:getZ() + 0.5,"arrow", sizePickup, 255,255,255) -- Car info if object and getElementType(object) == "vehicle" and not getPedOccupiedVehicle(localPlayer) then local idCar = getElementModel(object); local name = getVehicleName(object); car_info = object; dxDrawText(string.format("Hold right mouse to teleport to the Vehicle: %s[%d]", name,idCar), sw * sx + 40 , sh * sy - 20 ) end -- dist to point local dist = getDistanceBetweenPoints3D(curX, curY, curZ, pos) dxDrawText(string.format("Distance: %0.2fm ", dist), sw * sx + 40 , sh * sy ) if getKeyState(keyApply) then local car = isInAnyCar(car_info) if car then -- If the player is already in the car if getPedOccupiedVehicle(localPlayer) then teleport(car,pos) elseif getKeyState(keyOnCar) then -- if press mouse2 and mouse 1 > Teleport to the car if CarSeat(object) then -- We get the number of the free passenger seat triggerServerEvent("ClickWarp[Teleport]", resourceRoot, object, CarSeat(object)) else -- If there are no seats available teleport(false,pos) end end else -- teleport from your feet teleport(false,pos) end removeMark() end end end end end function teleport(vehicle,pos) if getPedOccupiedVehicle(localPlayer) then setElementVelocity(vehicle,0,0,0) -- Stop the car end setElementPosition (vehicle and vehicle or localPlayer, pos) end function isInAnyCar(veh) return veh or getPedOccupiedVehicle(localPlayer) end function CarSeat(veh) for i = 0, getVehicleMaxPassengers(veh) do if not getVehicleOccupants(veh)[i] then return i end end return false end function removeMark() start() if isElement(marker) then destroyElement(marker) end end -- function start() cursorEnable = not cursorEnable showCursor(cursorEnable) if not cursorEnable then removeEventHandler("onClientRender", root, click) if isElement(marker) then destroyElement(marker) end else addEventHandler("onClientRender", root, click) end end function resourceInit() outputChatBox("[clickwarp] press "..keyToggle.." to activate") bindKey(keyToggle, "down", start) end addEventHandler("onClientResourceStart", resourceRoot, resourceInit) function onClientMinimize() isMinimuze = true end addEventHandler( "onClientMinimize", root , onClientMinimize ) function onClientRestore() isMinimuze = false end addEventHandler("onClientRestore", root ,onClientRestore)
object_building_kashyyyk_decd_wroshyr_fallen_tree_dead = object_building_kashyyyk_shared_decd_wroshyr_fallen_tree_dead:new { } ObjectTemplates:addTemplate(object_building_kashyyyk_decd_wroshyr_fallen_tree_dead, "object/building/kashyyyk/decd_wroshyr_fallen_tree_dead.iff")
_G.Class = require '30log' print('Assuming the returned value when requiring "30log" \nis held in variable named Class') context('Class()', function() context('When Class is called with no args passed', function() test('it returns a new class (regular Lua table)',function() assert_equal(type(Class()),'table') end) end) context('Attributes', function() local myClass, myClass2 before(function() myClass = Class() myClass.name = 'myClass' myClass2 = Class {name = 'myClass'} end) test('can be added to classes',function() assert_equal(myClass.name,'myClass') end) test('can be passed in a table to Class()',function() assert_equal(myClass2.name,'myClass') end) end) context('Methods', function() local myClass before(function() myClass = Class() myClass.name = 'myClass' function myClass:introduce() return self.name end end) test('can be added to classes',function() assert_equal(myClass:introduce(),'myClass') end) end) end)
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937' description 'Afk Bot, Developer Erfan Ebrahimi, http://erfanebrahimi.ir | https://github.com/yeganehha ' version '1.0.0' server_scripts { '@es_extended/locale.lua', 'config.lua', 'server/main.lua' } client_scripts { '@es_extended/locale.lua', 'config.lua', 'client/main.lua' } dependencies { 'es_extended' }
local Parser = {} Parser.Types = { [0] = "open", [1] = "close", [2] = "ping", [3] = "pong", [4] = "message", -- unused [5] = "upgrade", [6] = "noop" } setmetatable(Parser.Types, { __index = function(_, index) for id, type in pairs(Parser.Types) do if type == index then return id end end end }) function Parser:Encode(packets) local payload = "" for _, packet in pairs(packets) do payload = payload .. ("%d:%d%s"):format( packet.Data and #packet.Data + 1 or 1, Parser.Types[packet.Type], packet.Data or "" ) end return payload end function Parser:Decode(str) local packets = {} repeat local length, id, data = str:match("^(%d+):b?(%d)") str = str:sub(#length + 1 + #id + 1) length = tonumber(length) id = tonumber(id) if length > 1 then data = str:sub(1, length - 1) str = str:sub(length) end table.insert(packets, { Type = Parser.Types[id], Data = data }) until #str == 0 return packets end return Parser
-- !!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!! -- This file is automaticly generated. Don't edit manualy! -- !!!!!!!!!!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!!!!!!!!!!! ---@class C_CovenantSanctumUI C_CovenantSanctumUI = {} ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.DepositAnima) function C_CovenantSanctumUI.DepositAnima() end ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.EndInteraction) function C_CovenantSanctumUI.EndInteraction() end ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.GetAnimaInfo) ---@return number, number @currencyID, maxDisplayableValue function C_CovenantSanctumUI.GetAnimaInfo() end ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.GetFeatures) ---@return table @features function C_CovenantSanctumUI.GetFeatures() end ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.GetRenownLevel) ---@return number @level function C_CovenantSanctumUI.GetRenownLevel() end ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.GetRenownMilestones) ---@param covenantID number ---@param renownLevel number ---@return table @milestones function C_CovenantSanctumUI.GetRenownMilestones(covenantID, renownLevel) end ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.GetRenownRewardsForLevel) ---@param covenantID number ---@param renownLevel number ---@return table @rewards function C_CovenantSanctumUI.GetRenownRewardsForLevel(covenantID, renownLevel) end ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.GetSanctumType) ---@return GarrTalentFeatureSubtype @sanctumType function C_CovenantSanctumUI.GetSanctumType() end ---[Wowpedia documentation](https://wow.gamepedia.com/API_C_CovenantSanctumUI.GetSoulCurrencies) ---@return table @currencyIDs function C_CovenantSanctumUI.GetSoulCurrencies() end ---@class CovenantSanctumFeatureInfo ---@field public garrTalentTreeID number ---@field public featureType number ---@field public uiOrder number CovenantSanctumFeatureInfo = {} ---@class CovenantSanctumRenownMilestoneInfo ---@field public level number ---@field public locked boolean ---@field public isCapstone boolean CovenantSanctumRenownMilestoneInfo = {} ---@class CovenantSanctumRenownRewardInfo ---@field public uiOrder number ---@field public itemID number ---@field public spellID number ---@field public mountID number ---@field public transmogID number ---@field public transmogSetID number ---@field public titleID number ---@field public garrFollowerID number ---@field public transmogIllusionSourceID number ---@field public icon number ---@field public name string ---@field public description string ---@field public toastDescription string CovenantSanctumRenownRewardInfo = {}
PED_NETWORKED = true PED_NON_NETWORKED = false function createPed(pedType, model, position, heading,cb) requestModel(model,function() local ped = CreatePed(pedType,model,position.x,position.y,position.z,heading,PED_NETWORKED,false) SetModelAsNoLongerNeeded(model) cb(ped) end) end exports('createPed',createPed) function createLocalPed(pedType, model, position, heading,cb) requestModel(model,function() local ped = CreatePed(pedType,model,position.x,position.y,position.z,heading,PED_NON_NETWORKED,false) SetModelAsNoLongerNeeded(model) cb(ped) end) end exports('createLocalPed',createLocalPed)
--时穿剑阵·四象阵 local m=14000009 local cm=_G["c"..m] function cm.initial_effect(c) --link summon aux.AddLinkProcedure(c,nil,4,4,cm.lcheck) c:EnableReviveLimit() --direct attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) c:RegisterEffect(e1) --battle damage to effect damage local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_BATTLE_DAMAGE_TO_EFFECT) c:RegisterEffect(e2) --actlimit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(EFFECT_CANNOT_ACTIVATE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(0,1) e3:SetValue(cm.aclimit) e3:SetCondition(cm.actcon) c:RegisterEffect(e3) --active local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(m,0)) e4:SetCategory(CATEGORY_TOGRAVE) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetCode(EVENT_DAMAGE) e4:SetRange(LOCATION_MZONE) e4:SetTarget(cm.atktg) e4:SetCondition(cm.atkcon) e4:SetOperation(cm.atkop) c:RegisterEffect(e4) end function cm.lcheck(g,lc) return g:GetClassCount(Card.GetCode)==g:GetCount() end function cm.aclimit(e,re,tp) return true end function cm.actcon(e) return Duel.GetAttacker()==e:GetHandler() or Duel.GetAttackTarget()==e:GetHandler() end function cm.atkcon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp and bit.band(r,REASON_EFFECT)~=0 and re:GetHandler():IsSetCard(0x1404) end function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_ONFIELD) end function cm.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE) local s=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,0) local nseq=math.log(s,2) if Duel.MoveSequence(c,nseq) then return true end local cg=c:GetColumnGroup():Filter(Card.IsControler,nil,1-tp) if cg:GetCount()>0 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE) local sg=cg:Select(1-tp,1,1,nil) Duel.HintSelection(sg) Duel.SendtoGrave(sg,REASON_RULE) end end
--- === cp.ui.Button === --- --- The `Button` type extends [Element](cp.ui.Element.md) and includes all its --- methods, fields and other properties. local require = require local axutils = require "cp.ui.axutils" local Element = require "cp.ui.Element" local Menu = require "cp.ui.Menu" local go = require "cp.rx.go" local If = go.If local WaitUntil = go.WaitUntil local Button = Element:subclass("cp.ui.Button") --- cp.ui.Button.matches(element) -> boolean --- Function --- Checks if the `element` is a `Button`, returning `true` if so. --- --- Parameters: --- * element - The `hs._asm.axuielement` to check. --- --- Returns: --- * `true` if the `element` is a `Button`, or `false` if not. function Button.static.matches(element) return Element.matches(element) and element:attributeValue("AXRole") == "AXButton" end --- cp.ui.Button(parent, uiFinder) -> cp.ui.Button --- Constructor --- Creates a new `Button` instance. --- --- Parameters: --- * parent - The parent object. Should have a `UI` and `isShowing` field. --- * uiFinder - A function which will return the `hs._asm.axuielement` the button belongs to, or `nil` if not available. --- --- Returns: --- The new `Button` instance. function Button:initialize(parent, uiFinder) Element.initialize(self, parent, uiFinder) end --- cp.ui.Button.title <cp.prop: string; read-only> --- Field --- The button title, if available. function Button.lazy.prop:title() return axutils.prop(self.UI, "AXTitle") end --- cp.ui.Button:press() -> self, boolean --- Method --- Performs a button press action, if the button is available. --- --- Parameters: --- * None --- --- Returns: --- * The `Button` instance. --- * `true` if the button was actually pressed successfully. function Button:press() local success = false local ui = self:UI() if ui then success = ui:doPress() == true end return self, success end --- cp.ui.Button:doPress() -> cp.rx.go.Statement --- Method --- Returns a `Statement` that will press the button when executed, if available at the time. --- If not an `error` is sent. --- --- Parameters: --- * None --- --- Returns: --- * The `Statement` which will press the button when executed. function Button.lazy.method:doPress() return If(self.UI):Then(function(ui) ui:doPress() return true end) :Otherwise(false) :ThenYield() :Label("Button:doPress") end function Button:showMenu() local ui = self:UI() if ui then ui:performAction("AXShowMenu") end end function Button.lazy.method:doShowMenu() return If(self.UI) :Then(function(ui) ui:performAction("AXShowMenu") end) :Then(WaitUntil(self.menu.isShowing)) :Otherwise(false) :Label("Button:doShowMenu") end function Button:cancelMenu() self.menu:cancel() end function Button.lazy.method:doCancelMenu() return self.menu:doCancel() end function Button.lazy.value:menu() return Menu(self, self.UI:mutate(function(original) return axutils.childWithRole(original(), "AXMenu") end)) end -- cp.ui.Button:__call() -> self, boolean -- Method -- Allows the button to be called like a function which will trigger a `press`. -- -- Parameters: -- * None -- -- Returns: -- * The `Button` instance. -- * `true` if the button was actually pressed successfully. function Button:__call() return self:press() end function Button:__tostring() return string.format("cp.ui.Button: %q (parent: %s)", self:title(), self:parent()) end return Button
object_tangible_furniture_modern_bar_piece_curve_s1_treasure_map = object_tangible_furniture_modern_shared_bar_piece_curve_s1_treasure_map:new { } ObjectTemplates:addTemplate(object_tangible_furniture_modern_bar_piece_curve_s1_treasure_map, "object/tangible/furniture/modern/bar_piece_curve_s1_treasure_map.iff")
-- -- created with TexturePacker (http://www.codeandweb.com/texturepacker) -- -- $TexturePacker:SmartUpdate:80bc6ce36d3999c1c60ff2ce47185aab:7a5167064ab93c186141cc0e0a95d05c:cf8ab4992190eb44f97f06311ef326d7$ -- -- local sheetInfo = require("mysheet") -- local myImageSheet = graphics.newImageSheet( "mysheet.png", sheetInfo:getSheet() ) -- local sprite = display.newSprite( myImageSheet , {frames={sheetInfo:getFrameIndex("sprite")}} ) -- local SheetInfo = {} SheetInfo.sheet = { frames = { { -- 1 x=521, y=447, width=64, height=42, sourceX = 494, sourceY = 424, sourceWidth = 960, sourceHeight = 672 }, { -- 2 x=595, y=355, width=66, height=42, sourceX = 456, sourceY = 570, sourceWidth = 960, sourceHeight = 672 }, { -- 3 x=337, y=367, width=90, height=122, sourceX = 591, sourceY = 497, sourceWidth = 960, sourceHeight = 672 }, { -- 4 x=699, y=345, width=128, height=152, sourceX = 526, sourceY = 355, sourceWidth = 960, sourceHeight = 672 }, { -- 5 x=197, y=367, width=138, height=130, sourceX = 573, sourceY = 242, sourceWidth = 960, sourceHeight = 672 }, { -- 6 x=699, y=159, width=98, height=184, sourceX = 627, sourceY = 356, sourceWidth = 960, sourceHeight = 672 }, { -- 7 x=197, y=1, width=266, height=364, sourceX = 421, sourceY = 29, sourceWidth = 960, sourceHeight = 672 }, { -- 8 x=595, y=1, width=190, height=156, sourceX = 418, sourceY = 432, sourceWidth = 960, sourceHeight = 672 }, { -- 9 x=787, y=1, width=106, height=106, sourceX = 364, sourceY = 53, sourceWidth = 960, sourceHeight = 672 }, { -- 10 x=521, y=397, width=70, height=48, sourceX = 271, sourceY = 271, sourceWidth = 960, sourceHeight = 672 }, { -- 11 x=593, y=399, width=36, height=34, sourceX = 351, sourceY = 207, sourceWidth = 960, sourceHeight = 672 }, { -- 12 x=663, y=355, width=34, height=36, sourceX = 385, sourceY = 259, sourceWidth = 960, sourceHeight = 672 }, { -- 13 x=799, y=109, width=62, height=218, sourceX = 457, sourceY = 249, sourceWidth = 960, sourceHeight = 672 }, { -- 14 x=595, y=159, width=102, height=194, sourceX = 468, sourceY = 273, sourceWidth = 960, sourceHeight = 672 }, { -- 15 x=1, y=1, width=194, height=484, sourceX = 317, sourceY = 35, sourceWidth = 960, sourceHeight = 672 }, { -- 16 x=429, y=397, width=90, height=90, sourceX = 290, sourceY = 122, sourceWidth = 960, sourceHeight = 672 }, { -- 17 x=465, y=1, width=128, height=394, sourceX = 253, sourceY = 115, sourceWidth = 960, sourceHeight = 672 }, }, sheetContentWidth = 894, sheetContentHeight = 498 } SheetInfo.frameIndex = { ["1"] = 1, ["2"] = 2, ["3"] = 3, ["4"] = 4, ["5"] = 5, ["6"] = 6, ["7"] = 7, ["8"] = 8, ["9"] = 9, ["10"] = 10, ["11"] = 11, ["12"] = 12, ["13"] = 13, ["14"] = 14, ["15"] = 15, ["16"] = 16, ["17"] = 17, } function SheetInfo:getSheet() return self.sheet; end function SheetInfo:getFrameIndex(name) return self.frameIndex[name]; end return SheetInfo
--- @module OutputStream -- @author sci4me -- @license MIT -- @copyright Scitoshi Nakayobro 2021 local class = require "middleclass" local OutputStream = class("OutputStream") -- luacheck: push no unused args function OutputStream:writeU8(x) end function OutputStream:flush() end function OutputStream:close() end -- luacheck: pop return OutputStream
-- Copyright 2013 by Till Tantau -- -- This file may be distributed an/or modified -- -- 1. under the LaTeX Project Public License and/or -- 2. under the GNU Public License -- -- See the file doc/generic/pgf/licenses/LICENSE for more information -- @release $Header$ local key = require 'pgf.gd.doc'.key local documentation = require 'pgf.gd.doc'.documentation local summary = require 'pgf.gd.doc'.summary local example = require 'pgf.gd.doc'.example -------------------------------------------------------------------------------- key "SpringEmbedderKK" summary "The spring embedder of Kamada and Kawai" documentation [[ The implementation used in |SpringEmbedderKK| is based on the following publication: Tomihisa Kamada, Satoru Kawai: \emph{An Algorithm for Drawing General Undirected Graphs.} Information Processing Letters 31, pp. 7--15, 1989. There are some parameters that can be tuned to optimize the algorithm's behavior regarding runtime and layout quality. First of all note that the algorithm uses all pairs shortest path to compute the graph theoretic distance. This can be done either with BFS (ignoring node sizes) in quadratic time or by using e.g. Floyd's algorithm in cubic time with given edge lengths that may reflect the node sizes. Also |m_computeMaxIt| decides if the computation is stopped after a fixed maximum number of iterations. The desirable edge length can either be set or computed from the graph and the given layout. ]] -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- key "SpringEmbedderKK.stopTolerance" summary "Sets the value for the stop tolerance." documentation [[ Below this value, the system is regarded stable (balanced) and the optimization stopped. ]] -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- key "SpringEmbedderKK.desLength" summary "Sets desirable edge length directly" -------------------------------------------------------------------------------- -- Local Variables: -- mode:latex -- End:
-- This example shows how to present a menu with two choices. Each -- choice jumps the story to one of two possible scenes. This example -- also demonstrates jumping to other scenes in general. Eric = Character {dialogName = "Eric", textColor = "#c8ffc8"} Jeff = Character {dialogName = "Jeff", textColor = "#c8c8ff"} Judge = Character {dialogName = "The Great Judgini", textColor = "#ffc8c8"} START = Scene { Jeff "Isn't this copyright infringement again?", Eric "Would you just shut up...", Judge "I have reviewed the evidence. How do you plead?", -- Each choice has two parts: a line of text to present to the -- player, and the name of the scene to jump to if that is the -- selection he makes. Menu { {"Not Guilty", "NOT_GUILTY"}, {"Obviously Guilty", "THE_TRUTH"} }, } NOT_GUILTY = Scene { Eric "Not guilty, your Honor.", Judge "Denied! It's opposite day!", Jeff "Wait, what the...", ChangeToScene "THE_TRUTH", } THE_TRUTH = Scene { Eric "Ok, so we infringed on copyrighted material...", Jeff "You did.", Judge "Then I hearby sentence you to hard labor in that prison from Rambo 2.", Jeff "What?!?", Eric "Oh cool, do we get a visit from Richard Crenna?", Judge "No. He died in 2003, remember?", Eric "Oh yeah...", ChangeToScene "END", } END = Scene { Jeff "I hate you. I hate you so much.", Eric "I love you too buddy.", Jeff "So much hate..." } -- That is how you make arbitrary jumps to other scenes and poor -- references to other media.
function class(classname, super) local superType = type(super) local cls if superType ~= "table" then superType = nil super = nil end -- inherited from Lua Object if super then cls = {} setmetatable(cls, {__index = super}) cls.super = super else cls = {ctor = function() end} end cls.__cname = classname cls.__ctype = 2 -- lua cls.__index = cls function cls.new(...) local instance = setmetatable({}, cls) instance.class = cls instance:ctor(...) return instance end return cls end return class
cc = cc or {} ---Touch object ---@class Touch : Ref local Touch = {} cc.Touch = Touch -------------------------------- --- Returns the previous touch location in screen coordinates. <br> ---return The previous touch location in screen coordinates. ---@return vec2_table function Touch:getPreviousLocationInView() end -------------------------------- --- Returns the current touch location in OpenGL coordinates.<br> ---return The current touch location in OpenGL coordinates. ---@return vec2_table function Touch:getLocation() end -------------------------------- --- Returns the delta of 2 current touches locations in screen coordinates.<br> ---return The delta of 2 current touches locations in screen coordinates. ---@return vec2_table function Touch:getDelta() end -------------------------------- --- Returns the start touch location in screen coordinates.<br> ---return The start touch location in screen coordinates. ---@return vec2_table function Touch:getStartLocationInView() end -------------------------------- --- Returns the current touch force for 3d touch.<br> ---return The current touch force for 3d touch. ---@return float function Touch:getCurrentForce() end -------------------------------- --- Returns the start touch location in OpenGL coordinates.<br> ---return The start touch location in OpenGL coordinates. ---@return vec2_table function Touch:getStartLocation() end -------------------------------- --- Get touch id.<br> ---js getId<br> ---lua getId<br> ---return The id of touch. ---@return int function Touch:getID() end -------------------------------- ---@overload fun(int, float, float, float, float):Touch ---@overload fun(int, float, float):Touch ---@param id int ---@param x float ---@param y float ---@param force float ---@param maxForce float ---@return Touch function Touch:setTouchInfo(id, x, y, force, maxForce) end -------------------------------- --- Returns the maximum touch force for 3d touch.<br> ---return The maximum touch force for 3d touch. ---@return float function Touch:getMaxForce() end -------------------------------- --- Returns the current touch location in screen coordinates.<br> ---return The current touch location in screen coordinates. ---@return vec2_table function Touch:getLocationInView() end -------------------------------- --- Returns the previous touch location in OpenGL coordinates.<br> ---return The previous touch location in OpenGL coordinates. ---@return vec2_table function Touch:getPreviousLocation() end -------------------------------- --- Constructor.<br> ---js ctor ---@return Touch function Touch:Touch() end return Touch
local AS = unpack(AddOnSkins) if not AS:CheckAddOn('CoolLine') then return end function AS:CoolLine() CoolLineDB.bgcolor = { r = 0, g = 0, b = 0, a = 0, } CoolLineDB.border = 'None' CoolLine.updatelook() AS:SkinBackdropFrame(CoolLine) CoolLine.Backdrop:SetAllPoints(CoolLine) CoolLine.Backdrop:CreateShadow() AS:RegisterForPetBattleHide(CoolLine) end AS:RegisterSkin('CoolLine', AS.CoolLine, '[ElvUI_CoolLine]')
--[[------------------------------------------------------ # Lubyk core module This file is loaded just after the load paths have been changed and loads Lubyk essentials. --]]------------------------------------------------------ --=============================================== LOAD PATHS -- These paths already come loaded with lubyk lib path -- through the lubyk loader "require 'lubyk'" local lua_paths = package.path local lua_cpaths = package.cpath -- 1. local lib (foo.lua or lib/foo.lua) package.path = './?.lua;./?/init.lua;' package.cpath = './?.so;' -- 2. user libs for _, path in ipairs(Lubyk.paths or {}) do package.path = package.path .. path .. '/?.lua;' .. path .. '/?/init.so;' end for _, cpath in ipairs(Lubyk.cpaths or {}) do package.cpath = package.cpath .. cpath .. '/?.so;' end -- 3. Installed lubyk libs and lua paths package.path = package.path .. lua_paths package.cpath = package.cpath .. lua_cpaths --=============================================== BASE REQUIRE -- From core module require 'lk.core' -- From lk module require 'lk.more'
--[[ (c) 2008-2011 David Manura. Licensed under the same terms as Lua (MIT). 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. (end license) --]] local assert, error, ipairs, pairs, tostring, type, setmetatable, io, math = assert, error, ipairs, pairs, tostring, type, setmetatable, io, math local table_sort, math_max, string_char = table.sort, math.max, string.char local band, lshift, rshift = bit32.band, bit32.lshift, bit32.rshift local function make_outstate(outbs) local outstate = {} outstate.outbs = outbs outstate.len = 0 outstate.window = {} outstate.window_pos = 1 return outstate end local function output(outstate, byte) local window_pos = outstate.window_pos outstate.outbs(byte) outstate.len = outstate.len + 1 outstate.window[window_pos] = byte outstate.window_pos = window_pos % 32768 + 1 -- 32K end local function noeof(val) return assert(val, 'unexpected end of file') end local function memoize(f) return setmetatable({}, { __index = function(self, k) local v = f(k) self[k] = v return v end }) end -- small optimization (lookup table for powers of 2) local pow2 = memoize(function(n) return 2^n end) local function bitstream_from_bytestream(bys) local buf_byte = 0 local buf_nbit = 0 local o = { type = "bitstream" } function o:nbits_left_in_byte() return buf_nbit end function o:read(nbits) nbits = nbits or 1 while buf_nbit < nbits do local byte = bys() if not byte then return end -- note: more calls also return nil buf_byte = buf_byte + lshift(byte, buf_nbit) buf_nbit = buf_nbit + 8 end local bits if nbits == 0 then bits = 0 elseif nbits == 32 then bits = buf_byte buf_byte = 0 else bits = band(buf_byte, rshift(0xffffffff, 32 - nbits)) buf_byte = rshift(buf_byte, nbits) end buf_nbit = buf_nbit - nbits return bits end return o end local function get_bitstream(o) if type(o) == "table" and o.type == "bitstream" then return o elseif io.type(o) == 'file' then return bitstream_from_bytestream(function() local sb = o:read(1) if sb then return sb:byte() end end) elseif type(o) == "function" then return bitstream_from_bytestream(o) else error 'unrecognized type' end end local function get_obytestream(o) local bs if io.type(o) == 'file' then bs = function(sbyte) o:write(string_char(sbyte)) end elseif type(o) == 'function' then bs = o else error('unrecognized type: ' .. tostring(o)) end return bs end local function HuffmanTable(init, is_full) local t = {} if is_full then for val,nbits in pairs(init) do if nbits ~= 0 then t[#t+1] = {val=val, nbits=nbits} end end else for i=1,#init-2,2 do local firstval, nbits, nextval = init[i], init[i+1], init[i+2] if nbits ~= 0 then for val=firstval,nextval-1 do t[#t+1] = {val=val, nbits=nbits} end end end end table_sort(t, function(a,b) return a.nbits == b.nbits and a.val < b.val or a.nbits < b.nbits end) -- assign codes local code = 1 -- leading 1 marker local nbits = 0 for _, s in ipairs(t) do if s.nbits ~= nbits then code = code * pow2[s.nbits - nbits] nbits = s.nbits end s.code = code code = code + 1 end local minbits = math.huge local look = {} for _, s in ipairs(t) do minbits = math.min(minbits, s.nbits) look[s.code] = s.val end local msb = function(bits, nbits) local res = 0 for _ = 1, nbits do res = lshift(res, 1) + band(bits, 1) bits = rshift(bits, 1) end return res end local tfirstcode = memoize( function(bits) return pow2[minbits] + msb(bits, minbits) end) function t:read(bs) local code = 1 -- leading 1 marker local nbits = 0 while 1 do if nbits == 0 then -- small optimization (optional) code = tfirstcode[noeof(bs:read(minbits))] nbits = nbits + minbits else local b = noeof(bs:read()) nbits = nbits + 1 code = code * 2 + b -- MSB first end local val = look[code] if val then return val end end end return t end local function parse_zlib_header(bs) local cm = bs:read(4) -- Compression Method local cinfo = bs:read(4) -- Compression info local fcheck = bs:read(5) -- FLaGs: FCHECK (check bits for CMF and FLG) local fdict = bs:read(1) -- FLaGs: FDICT (present dictionary) local flevel = bs:read(2) -- FLaGs: FLEVEL (compression level) local cmf = cinfo * 16 + cm -- CMF (Compresion Method and flags) local flg = fcheck + fdict * 32 + flevel * 64 -- FLaGs if cm ~= 8 then -- not "deflate" error("unrecognized zlib compression method: " .. cm) end if cinfo > 7 then error("invalid zlib window size: cinfo=" .. cinfo) end local window_size = 2^(cinfo + 8) if (cmf*256 + flg) % 31 ~= 0 then error("invalid zlib header (bad fcheck sum)") end if fdict == 1 then error("FIX:TODO - FDICT not currently implemented") local dictid_ = bs:read(32) end return window_size end local function parse_huffmantables(bs) local hlit = bs:read(5) -- # of literal/length codes - 257 local hdist = bs:read(5) -- # of distance codes - 1 local hclen = noeof(bs:read(4)) -- # of code length codes - 4 local ncodelen_codes = hclen + 4 local codelen_init = {} local codelen_vals = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15} for i=1,ncodelen_codes do local nbits = bs:read(3) local val = codelen_vals[i] codelen_init[val] = nbits end local codelentable = HuffmanTable(codelen_init, true) local function decode(ncodes) local init = {} local nbits local val = 0 while val < ncodes do local codelen = codelentable:read(bs) --FIX:check nil? local nrepeat if codelen <= 15 then nrepeat = 1 nbits = codelen elseif codelen == 16 then nrepeat = 3 + noeof(bs:read(2)) -- nbits unchanged elseif codelen == 17 then nrepeat = 3 + noeof(bs:read(3)) nbits = 0 elseif codelen == 18 then nrepeat = 11 + noeof(bs:read(7)) nbits = 0 else error 'ASSERT' end for _ = 1, nrepeat do init[val] = nbits val = val + 1 end end local huffmantable = HuffmanTable(init, true) return huffmantable end local nlit_codes = hlit + 257 local ndist_codes = hdist + 1 local littable = decode(nlit_codes) local disttable = decode(ndist_codes) return littable, disttable end local tdecode_len_base local tdecode_len_nextrabits local tdecode_dist_base local tdecode_dist_nextrabits local function parse_compressed_item(bs, outstate, littable, disttable) local val = littable:read(bs) if val < 256 then -- literal output(outstate, val) elseif val == 256 then -- end of block return true else if not tdecode_len_base then local t = {[257]=3} local skip = 1 for i=258,285,4 do for j=i,i+3 do t[j] = t[j-1] + skip end if i ~= 258 then skip = skip * 2 end end t[285] = 258 tdecode_len_base = t end if not tdecode_len_nextrabits then local t = {} for i=257,285 do local j = math_max(i - 261, 0) t[i] = rshift(j, 2) end t[285] = 0 tdecode_len_nextrabits = t end local len_base = tdecode_len_base[val] local nextrabits = tdecode_len_nextrabits[val] local extrabits = bs:read(nextrabits) local len = len_base + extrabits if not tdecode_dist_base then local t = {[0]=1} local skip = 1 for i=1,29,2 do for j=i,i+1 do t[j] = t[j-1] + skip end if i ~= 1 then skip = skip * 2 end end tdecode_dist_base = t end if not tdecode_dist_nextrabits then local t = {} for i=0,29 do local j = math_max(i - 2, 0) t[i] = rshift(j, 1) end tdecode_dist_nextrabits = t end local dist_val = disttable:read(bs) local dist_base = tdecode_dist_base[dist_val] local dist_nextrabits = tdecode_dist_nextrabits[dist_val] local dist_extrabits = bs:read(dist_nextrabits) local dist = dist_base + dist_extrabits for _ = 1,len do local pos = (outstate.window_pos - 1 - dist) % 32768 + 1 -- 32K output(outstate, assert(outstate.window[pos], 'invalid distance')) end end return false end local function parse_block(bs, outstate) local bfinal = bs:read(1) local btype = bs:read(2) local BTYPE_NO_COMPRESSION = 0 local BTYPE_FIXED_HUFFMAN = 1 local BTYPE_DYNAMIC_HUFFMAN = 2 local _BTYPE_RESERVED = 3 if btype == BTYPE_NO_COMPRESSION then bs:read(bs:nbits_left_in_byte()) local len = bs:read(16) local _nlen = noeof(bs:read(16)) for i=1,len do local by = noeof(bs:read(8)) output(outstate, by) end elseif btype == BTYPE_FIXED_HUFFMAN or btype == BTYPE_DYNAMIC_HUFFMAN then local littable, disttable if btype == BTYPE_DYNAMIC_HUFFMAN then littable, disttable = parse_huffmantables(bs) else littable = HuffmanTable {0,8, 144,9, 256,7, 280,8, 288,nil} disttable = HuffmanTable {0,5, 32,nil} end repeat local is_done = parse_compressed_item( bs, outstate, littable, disttable) until is_done else error('unrecognized compression type '..btype) end return bfinal ~= 0 end local function inflate(t) local bs = get_bitstream(t.input) local outbs = get_obytestream(t.output) local outstate = make_outstate(outbs) repeat local is_final = parse_block(bs, outstate) until is_final end local function adler32(byte, crc) local s1 = crc % 65536 local s2 = (crc - s1) / 65536 s1 = (s1 + byte) % 65521 s2 = (s2 + s1) % 65521 return s2*65536 + s1 end -- 65521 is the largest prime smaller than 2^16 local function inflate_zlib(t) local bs = get_bitstream(t.input) local outbs = get_obytestream(t.output) local disable_crc = t.disable_crc if disable_crc == nil then disable_crc = false end local _window_size = parse_zlib_header(bs) local data_adler32 = 1 inflate { input=bs, output = disable_crc and outbs or function(byte) data_adler32 = adler32(byte, data_adler32) outbs(byte) end, len = t.len, } bs:read(bs:nbits_left_in_byte()) local b3 = bs:read(8) local b2 = bs:read(8) local b1 = bs:read(8) local b0 = bs:read(8) local expected_adler32 = ((b3*256 + b2)*256 + b1)*256 + b0 if not disable_crc then if data_adler32 ~= expected_adler32 then error('invalid compressed data--crc error') end end end return { inflate = inflate, inflate_zlib = inflate_zlib, }
require 'engine' require 'shared' require 'arena' require 'buy_screen' require 'objects' require 'player' require 'enemies' require 'media' function init() shared_init() input:bind('move_left', {'a', 'left', 'dpleft', 'm1'}) input:bind('move_right', {'d', 'right', 'dpright', 'm2'}) input:bind('move_up', {'w', 'up', 'dpup'}) input:bind('move_down', {'s', 'down', 'dpdown'}) input:bind('enter', {'space', 'return', 'fleft', 'fdown', 'fright'}) local s = {tags = {sfx}} gambler1 = Sound('Collect 5.ogg', s) usurer1 = Sound('Shadow Punch 2.ogg', s) gold1 = Sound('Collect 5.ogg', s) gold2 = Sound('Coins - Gears - Slot.ogg', s) psychic1 = Sound('Magical Impact 13.ogg', s) fire1 = Sound('Fire bolt 3.ogg', s) fire2 = Sound('Fire bolt 5.ogg', s) fire3 = Sound('Fire bolt 10.ogg', s) earth1 = Sound('Earth Bolt 1.ogg', s) earth2 = Sound('Earth Bolt 14.ogg', s) earth3 = Sound('Earth Bolt 20.ogg', s) illusion1 = Sound('Buff 5.ogg', s) thunder1 = Sound('399656__bajko__sfx-thunder-blast.ogg', s) flagellant1 = Sound('Whipping Horse 3.ogg', s) bard2 = Sound('376532__womb-affliction__flute-trill.ogg', s) arcane2 = Sound('Magical Impact 12.ogg', s) frost1 = Sound('Frost Bolt 20.ogg', s) arcane1 = Sound('Magical Impact 26.ogg', s) pyro1 = Sound('Fire bolt 5.ogg', s) pyro2 = Sound('Explosion Fireworks_01.ogg', s) dot1 = Sound('Magical Swoosh 18.ogg', s) gun_kata1 = Sound('Pistol Shot_07.ogg', s) gun_kata2 = Sound('Pistol Shot_08.ogg', s) dual_gunner1 = Sound('Revolver Shot_07.ogg', s) dual_gunner2 = Sound('Revolver Shot_08.ogg', s) ui_hover1 = Sound('bamboo_hit_by_lord.ogg', s) ui_switch1 = Sound('Switch.ogg', s) ui_switch2 = Sound('Switch 3.ogg', s) ui_transition1 = Sound('Wind Bolt 8.ogg', s) ui_transition2 = Sound('Wind Bolt 12.ogg', s) headbutt1 = Sound('Wind Bolt 14.ogg', s) critter1 = Sound('Critters eating 2.ogg', s) critter2 = Sound('Crickets Chirping 4.ogg', s) critter3 = Sound('Popping bloody Sac 1.ogg', s) force1 = Sound('Magical Impact 18.ogg', s) error1 = Sound('Error 2.ogg', s) coins1 = Sound('Coins 7.ogg', s) coins2 = Sound('Coins 8.ogg', s) coins3 = Sound('Coins 9.ogg', s) shoot1 = Sound('Shooting Projectile (Classic) 11.ogg', s) archer1 = Sound('Releasing Bow String 1.ogg', s) wizard1 = Sound('Wind Bolt 20.ogg', s) swordsman1 = Sound('Heavy sword woosh 1.ogg', s) swordsman2 = Sound('Heavy sword woosh 19.ogg', s) scout1 = Sound('Throwing Knife (Thrown) 3.ogg', s) scout2 = Sound('Throwing Knife (Thrown) 4.ogg', s) arrow_hit_wall1 = Sound('Arrow Impact wood 3.ogg', s) arrow_hit_wall2 = Sound('Arrow Impact wood 1.ogg', s) hit1 = Sound('Player Takes Damage 17.ogg', s) hit2 = Sound('Body Head (Headshot) 1.ogg', s) hit3 = Sound('Kick 16_1.ogg', s) hit4 = Sound('Kick 16_2.ogg', s) proj_hit_wall1 = Sound('Player Takes Damage 2.ogg', s) enemy_die1 = Sound('Bloody punches 7.ogg', s) enemy_die2 = Sound('Bloody punches 10.ogg', s) magic_area1 = Sound('Fire bolt 10.ogg', s) magic_hit1 = Sound('Shadow Punch 1.ogg', s) magic_die1 = Sound('Magical Impact 27.ogg', s) knife_hit_wall1 = Sound('Shield Impacts Sword 1.ogg', s) blade_hit1 = Sound('Sword impact (Flesh) 2.ogg', s) player_hit1 = Sound('Body Fall 2.ogg', s) player_hit2 = Sound('Body Fall 18.ogg', s) player_hit_wall1 = Sound('Wood Heavy 5.ogg', s) pop1 = Sound('Pop sounds 10.ogg', s) pop2 = Sound('467951__benzix2__ui-button-click.ogg', s) pop3 = Sound('258269__jcallison__mouth-pop.ogg', s) confirm1 = Sound('80921__justinbw__buttonchime02up.ogg', s) heal1 = Sound('Buff 3.ogg', s) spawn1 = Sound('Buff 13.ogg', s) buff1 = Sound('Buff 14.ogg', s) spawn_mark1 = Sound('Bonus 2.ogg', s) spawn_mark2 = Sound('Bonus.ogg', s) alert1 = Sound('Click.ogg', s) elementor1 = Sound('Wind Bolt 18.ogg', s) saboteur_hit1 = Sound('Explosion Flesh_01.ogg', s) saboteur_hit2 = Sound('Explosion Flesh_02.ogg', s) saboteur1 = Sound('Male Jump 1.ogg', s) saboteur2 = Sound('Male Jump 2.ogg', s) saboteur3 = Sound('Male Jump 3.ogg', s) spark1 = Sound('Spark 1.ogg', s) spark2 = Sound('Spark 2.ogg', s) spark3 = Sound('Spark 3.ogg', s) stormweaver1 = Sound('Buff 8.ogg', s) cannoneer1 = Sound('Cannon shots 1.ogg', s) cannoneer2 = Sound('Cannon shots 7.ogg', s) cannon_hit_wall1 = Sound('Cannon impact sounds (Hitting ship) 4.ogg', s) pet1 = Sound('Wolf barks 5.ogg', s) turret1 = Sound('Sci Fi Machine Gun 7.ogg', s) turret2 = Sound('Sniper Shot_09.ogg', s) turret_hit_wall1 = Sound('Concrete 6.ogg', s) turret_hit_wall2 = Sound('Concrete 7.ogg', s) turret_deploy = Sound('321215__hybrid-v__sci-fi-weapons-deploy.ogg', s) rogue_crit1 = Sound('Dagger Stab (Flesh) 4.ogg', s) rogue_crit2 = Sound('Sword hits another sword 6.ogg', s) song1 = Sound('Kubbi - Ember - 01 Pathfinder.ogg', {tags = {music}}) song2 = Sound('Kubbi - Ember - 02 Ember.ogg', {tags = {music}}) song3 = Sound('Kubbi - Ember - 03 Firelight.ogg', {tags = {music}}) song4 = Sound('Kubbi - Ember - 04 Cascade.ogg', {tags = {music}}) song5 = Sound('Kubbi - Ember - 05 Compass.ogg', {tags = {music}}) death_song = Sound('Kubbi - Ember - 09 Formed by Glaciers.ogg', {tags = {music}}) lock_image = Image('lock') speed_booster_elite = Image('speed_booster_elite') exploder_elite = Image('exploder_elite') swarmer_elite = Image('swarmer_elite') forcer_elite = Image('forcer_elite') cluster_elite = Image('cluster_elite') warrior = Image('warrior') ranger = Image('ranger') healer = Image('healer') mage = Image('mage') rogue = Image('rogue') nuker = Image('nuker') conjurer = Image('conjurer') enchanter = Image('enchanter') psyker = Image('psyker') curser = Image('curser') forcer = Image('forcer') swarmer = Image('swarmer') voider = Image('voider') sorcerer = Image('sorcerer') mercenary = Image('mercenary') ouroboros_technique_r = Image('ouroboros_technique_r') ouroboros_technique_l = Image('ouroboros_technique_l') wall_echo = Image('wall_echo') wall_rider = Image('wall_rider') centipede = Image('centipede') intimidation = Image('intimidation') vulnerability = Image('vulnerability') temporal_chains = Image('temporal_chains') amplify = Image('amplify') amplify_x = Image('amplify_x') resonance = Image('resonance') ballista = Image('ballista') ballista_x = Image('ballista_x') point_blank = Image('point_blank') longshot = Image('longshot') blunt_arrow = Image('blunt_arrow') explosive_arrow = Image('explosive_arrow') divine_machine_arrow = Image('divine_machine_arrow') chronomancy = Image('chronomancy') awakening = Image('awakening') divine_punishment = Image('divine_punishment') berserking = Image('berserking') unwavering_stance = Image('unwavering_stance') ultimatum = Image('ultimatum') flying_daggers = Image('flying_daggers') assassination = Image('assassination') magnify = Image('magnify') echo_barrage = Image('echo_barrage') unleash = Image('unleash') reinforce = Image('reinforce') payback = Image('payback') blessing = Image('blessing') hex_master = Image('hex_master') whispers_of_doom = Image('whispers_of_doom') force_push = Image('force_push') heavy_impact = Image('heavy_impact') crucio = Image('crucio') immolation = Image('immolation') call_of_the_void = Image('call_of_the_void') spawning_pool = Image('spawning_pool') hive = Image('hive') void_rift = Image('void_rift') star = Image('star') arrow = Image('arrow') class_colors = { ['warrior'] = yellow[0], ['ranger'] = green[0], ['healer'] = green[0], ['conjurer'] = orange[0], ['mage'] = blue[0], ['nuker'] = red[0], ['rogue'] = red[0], ['enchanter'] = blue[0], ['psyker'] = fg[0], ['curser'] = purple[0], ['forcer'] = yellow[0], ['swarmer'] = orange[0], ['voider'] = purple[0], ['sorcerer'] = blue2[0], ['mercenary'] = yellow2[0], } class_color_strings = { ['warrior'] = 'yellow', ['ranger'] = 'green', ['healer'] = 'green', ['conjurer'] = 'orange', ['mage'] = 'blue', ['nuker'] = 'red', ['rogue'] = 'red', ['enchanter'] = 'blue', ['psyker'] = 'fg', ['curser'] = 'purple', ['forcer'] = 'yellow', ['swarmer'] = 'orange', ['voider'] = 'purple', ['sorcerer'] = 'blue2', ['mercenary'] = 'yellow2', } character_names = { ['vagrant'] = 'Vagrant', ['swordsman'] = 'Swordsman', ['wizard'] = 'Wizard', ['magician'] = 'Magician', ['archer'] = 'Archer', ['scout'] = 'Scout', ['cleric'] = 'Cleric', ['outlaw'] = 'Outlaw', ['blade'] = 'Blade', ['elementor'] = 'Elementor', ['saboteur'] = 'Saboteur', ['stormweaver'] = 'Stormweaver', ['sage'] = 'Sage', ['squire'] = 'Squire', ['cannoneer'] = 'Cannoneer', ['dual_gunner'] = 'Dual Gunner', ['hunter'] = 'Hunter', ['chronomancer'] = 'Chronomancer', ['spellblade'] = 'Spellblade', ['psykeeper'] = 'Psykeeper', ['engineer'] = 'Engineer', ['plague_doctor'] = 'Plague Doctor', ['barbarian'] = 'Barbarian', ['juggernaut'] = 'Juggernaut', ['lich'] = 'Lich', ['cryomancer'] = 'Cryomancer', ['pyromancer'] = 'Pyromancer', ['corruptor'] = 'Corruptor', ['beastmaster'] = 'Beastmaster', ['launcher'] = 'Launcher', ['jester'] = 'Jester', ['assassin'] = 'Assassin', ['host'] = 'Host', ['carver'] = 'Carver', ['bane'] = 'Bane', ['psykino'] = 'Psykino', ['barrager'] = 'Barrager', ['highlander'] = 'Highlander', ['fairy'] = 'Fairy', ['priest'] = 'Priest', ['infestor'] = 'Infestor', ['flagellant'] = 'Flagellant', ['arcanist'] = 'Arcanist', ['illusionist'] = 'Illusionist', ['witch'] = 'Witch', ['silencer'] = 'Silencer', ['vulcanist'] = 'Vulcanist', ['warden'] = 'Warden', ['psychic'] = 'Psychic', ['miner'] = 'Miner', ['merchant'] = 'Merchant', ['usurer'] = 'Usurer', ['gambler'] = 'Gambler', ['thief'] = 'Thief', } character_colors = { ['vagrant'] = fg[0], ['swordsman'] = yellow[0], ['wizard'] = blue[0], ['magician'] = blue[0], ['archer'] = green[0], ['scout'] = red[0], ['cleric'] = green[0], ['outlaw'] = red[0], ['blade'] = yellow[0], ['elementor'] = blue[0], ['saboteur'] = orange[0], ['stormweaver'] = blue[0], ['sage'] = purple[0], ['squire'] = yellow[0], ['cannoneer'] = orange[0], ['dual_gunner'] = green[0], ['hunter'] = green[0], ['chronomancer'] = blue[0], ['spellblade'] = blue[0], ['psykeeper'] = fg[0], ['engineer'] = orange[0], ['plague_doctor'] = purple[0], ['barbarian'] = yellow[0], ['juggernaut'] = yellow[0], ['lich'] = blue[0], ['cryomancer'] = blue[0], ['pyromancer'] = red[0], ['corruptor'] = orange[0], ['beastmaster'] = red[0], ['launcher'] = yellow[0], ['jester'] = red[0], ['assassin'] = purple[0], ['host'] = orange[0], ['carver'] = green[0], ['bane'] = purple[0], ['psykino'] = fg[0], ['barrager'] = green[0], ['highlander'] = yellow[0], ['fairy'] = green[0], ['priest'] = green[0], ['infestor'] = orange[0], ['flagellant'] = fg[0], ['arcanist'] = blue2[0], ['illusionist'] = blue2[0], ['witch'] = purple[0], ['silencer'] = blue2[0], ['vulcanist'] = red[0], ['warden'] = yellow[0], ['psychic'] = fg[0], ['miner'] = yellow2[0], ['merchant'] = yellow2[0], ['usurer'] = purple[0], ['gambler'] = yellow2[0], ['thief'] = red[0], } character_color_strings = { ['vagrant'] = 'fg', ['swordsman'] = 'yellow', ['wizard'] = 'blue', ['magician'] = 'blue', ['archer'] = 'green', ['scout'] = 'red', ['cleric'] = 'green', ['outlaw'] = 'red', ['blade'] = 'yellow', ['elementor'] = 'blue', ['saboteur'] = 'orange', ['stormweaver'] = 'blue', ['sage'] = 'purple', ['squire'] = 'yellow', ['cannoneer'] = 'orange', ['dual_gunner'] = 'green', ['hunter'] = 'green', ['chronomancer'] = 'blue', ['spellblade'] = 'blue', ['psykeeper'] = 'fg', ['engineer'] = 'orange', ['plague_doctor'] = 'purple', ['barbarian'] = 'yellow', ['juggernaut'] = 'yellow', ['lich'] = 'blue', ['cryomancer'] = 'blue', ['pyromancer'] = 'red', ['corruptor'] = 'orange', ['beastmaster'] = 'red', ['launcher'] = 'yellow', ['jester'] = 'red', ['assassin'] = 'purple', ['host'] = 'orange', ['carver'] = 'green', ['bane'] = 'purple', ['psykino'] = 'fg', ['barrager'] = 'green', ['highlander'] = 'yellow', ['fairy'] = 'green', ['priest'] = 'green', ['infestor'] = 'orange', ['flagellant'] = 'fg', ['arcanist'] = 'blue2', ['illusionist'] = 'blue2', ['witch'] = 'purple', ['silencer'] = 'blue2', ['vulcanist'] = 'red', ['warden'] = 'yellow', ['psychic'] = 'fg', ['miner'] = 'yellow2', ['merchant'] = 'yellow2', ['usurer'] = 'purple', ['gambler'] = 'yellow2', ['thief'] = 'red', } character_classes = { ['vagrant'] = {'psyker', 'ranger', 'warrior'}, ['swordsman'] = {'warrior'}, ['wizard'] = {'mage', 'nuker'}, ['magician'] = {'mage'}, ['archer'] = {'ranger'}, ['scout'] = {'rogue'}, ['cleric'] = {'healer'}, ['outlaw'] = {'warrior', 'rogue'}, ['blade'] = {'warrior', 'nuker'}, ['elementor'] = {'mage', 'nuker'}, ['saboteur'] = {'rogue', 'conjurer', 'nuker'}, ['stormweaver'] = {'enchanter'}, ['sage'] = {'nuker', 'forcer'}, ['squire'] = {'warrior', 'enchanter'}, ['cannoneer'] = {'ranger', 'nuker'}, ['dual_gunner'] = {'ranger', 'rogue'}, ['hunter'] = {'ranger', 'conjurer', 'forcer'}, ['chronomancer'] = {'mage', 'enchanter'}, ['spellblade'] = {'mage', 'rogue'}, ['psykeeper'] = {'healer', 'psyker'}, ['engineer'] = {'conjurer'}, ['plague_doctor'] = {'nuker', 'voider'}, ['barbarian'] = {'curser', 'warrior'}, ['juggernaut'] = {'forcer', 'warrior'}, ['lich'] = {'mage'}, ['cryomancer'] = {'mage', 'voider'}, ['pyromancer'] = {'mage', 'nuker', 'voider'}, ['corruptor'] = {'ranger', 'swarmer'}, ['beastmaster'] = {'rogue', 'swarmer'}, ['launcher'] = {'curser', 'forcer'}, ['jester'] = {'curser', 'rogue'}, ['assassin'] = {'rogue', 'voider'}, ['host'] = {'swarmer'}, ['carver'] = {'conjurer', 'healer'}, ['bane'] = {'curser', 'voider'}, ['psykino'] = {'mage', 'psyker', 'forcer'}, ['barrager'] = {'ranger', 'forcer'}, ['highlander'] = {'warrior'}, ['fairy'] = {'enchanter', 'healer'}, ['priest'] = {'healer'}, ['infestor'] = {'curser', 'swarmer'}, ['flagellant'] = {'psyker', 'enchanter'}, ['arcanist'] = {'sorcerer'}, ['illusionist'] = {'sorcerer', 'conjurer'}, ['witch'] = {'sorcerer', 'voider'}, ['silencer'] = {'sorcerer', 'curser'}, ['vulcanist'] = {'sorcerer', 'nuker'}, ['warden'] = {'sorcerer', 'forcer'}, ['psychic'] = {'sorcerer', 'psyker'}, ['miner'] = {'mercenary'}, ['merchant'] = {'mercenary'}, ['usurer'] = {'curser', 'mercenary', 'voider'}, ['gambler'] = {'mercenary', 'sorcerer'}, ['thief'] = {'rogue', 'mercenary'}, } character_class_strings = { ['vagrant'] = '[fg]Psyker, [green]Ranger, [yellow]Warrior', ['swordsman'] = '[yellow]Warrior', ['wizard'] = '[blue]Mage, [red]Nuker', ['magician'] = '[blue]Mage', ['archer'] = '[green]Ranger', ['scout'] = '[red]Rogue', ['cleric'] = '[green]Healer', ['outlaw'] = '[yellow]Warrior, [red]Rogue', ['blade'] = '[yellow]Warrior, [red]Nuker', ['elementor'] = '[blue]Mage, [red]Nuker', ['saboteur'] = '[red]Rogue, [orange]Conjurer, [red]Nuker', ['stormweaver'] = '[blue]Enchanter', ['sage'] = '[red]Nuker, [yellow]Forcer', ['squire'] = '[yellow]Warrior, [blue]Enchanter', ['cannoneer'] = '[green]Ranger, [red]Nuker', ['dual_gunner'] = '[green]Ranger, [red]Rogue', ['hunter'] = '[green]Ranger, [orange]Conjurer, [yellow]Forcer', ['chronomancer'] = '[blue]Mage, Enchanter', ['spellblade'] = '[blue]Mage, [red]Rogue', ['psykeeper'] = '[green]Healer, [fg]Psyker', ['engineer'] = '[orange]Conjurer', ['plague_doctor'] = '[red]Nuker, [purple]Voider', ['barbarian'] = '[purple]Curser, [yellow]Warrior', ['juggernaut'] = '[yellow]Forcer, Warrior', ['lich'] = '[blue]Mage', ['cryomancer'] = '[blue]Mage, [purple]Voider', ['pyromancer'] = '[blue]Mage, [red]Nuker, [purple]Voider', ['corruptor'] = '[green]Ranger, [orange]Swarmer', ['beastmaster'] = '[red]Rogue, [orange]Swarmer', ['launcher'] = '[yellow]Forcer, [purple]Curser', ['jester'] = '[purple]Curser, [red]Rogue', ['assassin'] = '[red]Rogue, [purple]Voider', ['host'] = '[orange]Swarmer', ['carver'] = '[orange]Conjurer, [green]Healer', ['bane'] = '[purple]Curser, Voider', ['psykino'] = '[blue]Mage, [fg]Psyker, [yellow]Forcer', ['barrager'] = '[green]Ranger, [yellow]Forcer', ['highlander'] = '[yellow]Warrior', ['fairy'] = '[blue]Enchanter, [green]Healer', ['priest'] = '[green]Healer', ['infestor'] = '[purple]Curser, [orange]Swarmer', ['flagellant'] = '[fg]Psyker, [blue]Enchanter', ['arcanist'] = '[blue2]Sorcerer', ['illusionist'] = '[blue2]Sorcerer, [orange]Conjurer', ['witch'] = '[blue2]Sorcerer, [purple]Voider', ['silencer'] = '[blue2]Sorcerer, [purple]Curser', ['vulcanist'] = '[blue2]Sorcerer, [red]Nuker', ['warden'] = '[blue2]Sorcerer, [yellow]Forcer', ['psychic'] = '[blue2]Sorcerer, [fg]Psyker', ['miner'] = '[yellow2]Mercenary', ['merchant'] = '[yellow2]Mercenary', ['usurer'] = '[purple]Curser, [yellow2]Mercenary, [purple]Voider', ['gambler'] = '[yellow2]Mercenary, [blue2]Sorcerer', ['thief'] = '[red]Rogue, [yellow2]Mercenary', } get_character_stat_string = function(character, level) local group = Group():set_as_physics_world(32, 0, 0, {'player', 'enemy', 'projectile', 'enemy_projectile'}) local player = Player{group = group, leader = true, character = character, level = level, follower_index = 1} player:update(0) return '[red]HP: [red]' .. player.max_hp .. '[fg], [red]DMG: [red]' .. player.dmg .. '[fg], [green]ASPD: [green]' .. math.round(player.aspd_m, 2) .. 'x[fg], [blue]AREA: [blue]' .. math.round(player.area_dmg_m*player.area_size_m, 2) .. 'x[fg], [yellow]DEF: [yellow]' .. math.round(player.def, 2) .. '[fg], [green]MVSPD: [green]' .. math.round(player.v, 2) .. '[fg]' end get_character_stat = function(character, level, stat) local group = Group():set_as_physics_world(32, 0, 0, {'player', 'enemy', 'projectile', 'enemy_projectile'}) local player = Player{group = group, leader = true, character = character, level = level, follower_index = 1} player:update(0) return math.round(player[stat], 2) end character_descriptions = { ['vagrant'] = function(lvl) return '[fg]shoots a projectile that deals [yellow]' .. get_character_stat('vagrant', lvl, 'dmg') .. '[fg] damage' end, ['swordsman'] = function(lvl) return '[fg]deals [yellow]' .. get_character_stat('swordsman', lvl, 'dmg') .. '[fg] damage in an area, deals extra [yellow]' .. math.round(get_character_stat('swordsman', lvl, 'dmg')*0.15, 2) .. '[fg] damage per unit hit' end, ['wizard'] = function(lvl) return '[fg]shoots a projectile that deals [yellow]' .. get_character_stat('wizard', lvl, 'dmg') .. ' AoE[fg] damage' end, ['magician'] = function(lvl) return '[fg]creates a small area that deals [yellow]' .. get_character_stat('magician', lvl, 'dmg') .. ' AoE[fg] damage' end, ['archer'] = function(lvl) return '[fg]shoots an arrow that deals [yellow]' .. get_character_stat('archer', lvl, 'dmg') .. '[fg] damage and pierces' end, ['scout'] = function(lvl) return '[fg]throws a knife that deals [yellow]' .. get_character_stat('scout', lvl, 'dmg') .. '[fg] damage and chains [yellow]3[fg] times' end, ['cleric'] = function(lvl) return '[fg]heals a unit for [yellow]20%[fg] of its max hp when it drops below [yellow]50%[fg] max hp' end, ['outlaw'] = function(lvl) return '[fg]throws a fan of [yellow]5[fg] knives, each dealing [yellow]' .. get_character_stat('outlaw', lvl, 'dmg') .. '[fg] damage' end, ['blade'] = function(lvl) return '[fg]throws multiple blades that deal [yellow]' .. get_character_stat('blade', lvl, 'dmg') .. ' AoE[fg] damage' end, ['elementor'] = function(lvl) return '[fg]deals [yellow]' .. get_character_stat('elementor', lvl, 'dmg') .. ' AoE[fg] damage in a large area centered on a random target' end, ['saboteur'] = function(lvl) return '[fg]calls [yellow]2[fg] saboteurs to seek targets and deal [yellow]' .. get_character_stat('saboteur', lvl, 'dmg') .. ' AoE[fg] damage' end, ['stormweaver'] = function(lvl) return '[fg]infuses projectiles with chain lightning that deals [yellow]20%[fg] damage to [yellow]2[fg] enemies' end, ['sage'] = function(lvl) return '[fg]shoots a slow projectile that draws enemies in' end, ['squire'] = function(lvl) return '[yellow]+20%[fg] damage and defense to all allies' end, ['cannoneer'] = function(lvl) return '[fg]shoots a projectile that deals [yellow]' .. 2*get_character_stat('cannoneer', lvl, 'dmg') .. ' AoE[fg] damage' end, ['dual_gunner'] = function(lvl) return '[fg]shoots two parallel projectiles, each dealing [yellow]' .. get_character_stat('dual_gunner', lvl, 'dmg') .. '[fg] damage' end, ['hunter'] = function(lvl) return '[fg]shoots an arrow that deals [yellow]' .. get_character_stat('hunter', lvl, 'dmg') .. '[fg] damage and has a [yellow]20%[fg] chance to summon a pet' end, ['chronomancer'] = function(lvl) return '[yellow]+20%[fg] attack speed to all allies' end, ['spellblade'] = function(lvl) return '[fg]throws knives that deal [yellow]' .. get_character_stat('spellblade', lvl, 'dmg') .. '[fg] damage, pierce and spiral outwards' end, ['psykeeper'] = function(lvl) return '[fg]all damage taken is stored up to [yellow]50%[fg] max HP and distributed as healing to all allies' end, ['engineer'] = function(lvl) return '[fg]drops sentries that shoot bursts of projectiles, each dealing [yellow]' .. get_character_stat('engineer', lvl, 'dmg') .. '[fg] damage' end, ['plague_doctor'] = function(lvl) return '[fg]creates an area that deals [yellow]' .. get_character_stat('plague_doctor', lvl, 'dmg') .. '[fg] damage per second' end, ['barbarian'] = function(lvl) return '[fg]deals [yellow]' .. get_character_stat('barbarian', lvl, 'dmg') .. '[fg] AoE damage and stuns enemies hit for [yellow]4[fg] seconds' end, ['juggernaut'] = function(lvl) return '[fg]deals [yellow]' .. get_character_stat('juggernaut', lvl, 'dmg') .. '[fg] AoE damage and pushes enemies away with a strong force' end, ['lich'] = function(lvl) return '[fg]launches a slow projectile that jumps [yellow]7[fg] times, dealing [yellow]' .. 2*get_character_stat('lich', lvl, 'dmg') .. '[fg] damage per hit' end, ['cryomancer'] = function(lvl) return '[fg]nearby enemies take [yellow]' .. get_character_stat('cryomancer', lvl, 'dmg') .. '[fg] damage per second' end, ['pyromancer'] = function(lvl) return '[fg]nearby enemies take [yellow]' .. get_character_stat('pyromancer', lvl, 'dmg') .. '[fg] damage per second' end, ['corruptor'] = function(lvl) return '[fg]spawn [yellow]3[fg] small critters if the corruptor kills an enemy' end, ['beastmaster'] = function(lvl) return '[fg]spawn [yellow]2[fg] small critters if the beastmaster crits' end, ['launcher'] = function(lvl) return '[fg]all nearby enemies are pushed after [yellow]4[fg] seconds, taking [yellow]' .. 2*get_character_stat('launcher', lvl, 'dmg') .. '[fg] damage on wall hit' end, ['jester'] = function(lvl) return "[fg]curses [yellow]6[fg] nearby enemies for [yellow]6[fg] seconds, they will explode into [yellow]3[fg] knives on death" end, ['assassin'] = function(lvl) return '[fg]throws a piercing knife that deals [yellow]' .. get_character_stat('assassin', lvl, 'dmg') .. '[fg] damage + [yellow]' .. get_character_stat('assassin', lvl, 'dmg')/2 .. '[fg] damage per second' end, ['host'] = function(lvl) return '[fg]periodically spawn [yellow]1[fg] small critter' end, ['carver'] = function(lvl) return '[fg]carves a statue that periodically heals [yellow]1[fg] unit for [yellow]20%[fg] max HP if in range' end, ['bane'] = function(lvl) return '[fg]curses [yellow]6[fg] nearby enemies for [yellow]6[fg] seconds, they will create small void rifts on death' end, ['psykino'] = function(lvl) return '[fg]pulls enemies together for [yellow]2[fg] seconds' end, ['barrager'] = function(lvl) return '[fg]shoots a barrage of [yellow]3[fg] arrows, each dealing [yellow]' .. get_character_stat('barrager', lvl, 'dmg') .. '[fg] damage and pushing enemies' end, ['highlander'] = function(lvl) return '[fg]deals [yellow]' .. 5*get_character_stat('highlander', lvl, 'dmg') .. '[fg] AoE damage' end, ['fairy'] = function(lvl) return '[fg]periodically heals [yellow]1[fg] unit at random and grants it [yellow]+100%[fg] attack speed for [yellow]6[fg] seconds' end, ['priest'] = function(lvl) return '[fg]heals all allies for [yellow]20%[fg] their max HP' end, ['infestor'] = function(lvl) return '[fg]curses [yellow]8[fg] nearby enemies for [yellow]6[fg] seconds, they will release [yellow]2[fg] critters on death' end, ['flagellant'] = function(lvl) return '[fg]deals [yellow]' .. 2*get_character_stat('flagellant', lvl, 'dmg') .. '[fg] damage to self and grants [yellow]+4%[fg] damage to all allies per cast' end, ['arcanist'] = function(lvl) return '[fg]launches a slow moving orb that launches projectiles, each dealing [yellow]' .. get_character_stat('arcanist', lvl, 'dmg') .. '[fg] damage' end, ['illusionist'] = function(lvl) return '[fg]launches a projectile that deals [yellow]' .. get_character_stat('illusionist', lvl, 'dmg') .. '[fg] damage and creates copies that do the same' end, ['witch'] = function(lvl) return '[fg]creates an area that ricochets and deals [yellow]' .. get_character_stat('witch', lvl, 'dmg') .. '[fg] damage per second' end, ['silencer'] = function(lvl) return '[fg]curses [yellow]5[fg] nearby enemies for [yellow]6[fg] seconds, preventing them from using special attacks' end, ['vulcanist'] = function(lvl) return '[fg]creates a volcano that explodes the nearby area [yellow]4[fg] times, dealing [yellow]' .. get_character_stat('vulcanist', lvl, 'dmg') .. ' AoE [fg]damage' end, ['warden'] = function(lvl) return '[fg]creates a force field around a random unit that prevents enemies from entering' end, ['psychic'] = function(lvl) return '[fg]creates a small area that deals [yellow]' .. get_character_stat('psychic', lvl, 'dmg') .. ' AoE[fg] damage' end, ['miner'] = function(lvl) return '[fg]picking up gold releases [yellow]4[fg] homing projectiles that each deal [yellow]' .. get_character_stat('miner', lvl, 'dmg') .. ' [fg]damage' end, ['merchant'] = function(lvl) return '[fg]gain [yellow]+1[fg] interest for every [yellow]10[fg] gold' end, ['usurer'] = function(lvl) return '[fg]curses [yellow]3[fg] nearby enemies indefinitely with [yellow]debt[fg], dealing [yellow]' .. get_character_stat('usurer', lvl, 'dmg') .. '[fg] damage per second' end, ['gambler'] = function(lvl) return '[fg]deal [yellow]2X[fg] damage to a single random enemy where X is how much gold you have' end, ['thief'] = function(lvl) return '[fg]throws a knife that deals [yellow]' .. 2*get_character_stat('thief', lvl, 'dmg') .. '[fg] damage and chains [yellow]5[fg] times' end, } character_effect_names = { ['vagrant'] = '[fg]Champion', ['swordsman'] = '[yellow]Cleave', ['wizard'] = '[blue]Magic Missile', ['magician'] = '[blue]Ethereal Form', ['archer'] = '[green]Bounce Shot', ['scout'] = '[red]Dagger Resonance', ['cleric'] = '[green]Mass Heal ', ['outlaw'] = '[red]Flying Daggers', ['blade'] = '[yellow]Blade Resonance', ['elementor'] = '[blue]Windfield', ['saboteur'] = '[orange]Demoman', ['stormweaver'] = '[blue]Wide Lightning', ['sage'] = '[purple]Dimension Compression', ['squire'] = '[yellow]Shiny Gear', ['cannoneer'] = '[orange]Cannon Barrage', ['dual_gunner'] = '[green]Gun Kata', ['hunter'] = '[green]Feral Pack', ['chronomancer'] = '[blue]Quicken', ['spellblade'] = '[blue]Spiralism', ['psykeeper'] = '[fg]Crucio', ['engineer'] = '[orange]Upgrade!!!', ['plague_doctor'] = '[purple]Black Death Steam', ['barbarian'] = '[yellow]Seism', ['juggernaut'] = '[yellow]Brutal Impact', ['lich'] = '[blue]Chain Frost', ['cryomancer'] = '[blue]Frostbite', ['pyromancer'] = '[red]Ignite', ['corruptor'] = '[orange]Corruption', ['beastmaster'] = '[red]Call of the Wild', ['launcher'] = '[orange]Kineticism', ['jester'] = "[red]Pandemonium", ['assassin'] = '[purple]Toxic Delivery', ['host'] = '[orange]Invasion', ['carver'] = '[green]World Tree', ['bane'] = '[purple]Nightmare', ['psykino'] = '[fg]Magnetic Force', ['barrager'] = '[green]Barrage', ['highlander'] = '[yellow]Moulinet', ['fairy'] = '[green]Whimsy', ['priest'] = '[green]Divine Intervention', ['infestor'] = '[orange]Infestation', ['flagellant'] = '[red]Zealotry', ['arcanist'] = '[blue2]Arcane Orb', ['illusionist'] = '[blue2]Mirror Image', ['witch'] = '[purple]Death Pool', ['silencer'] = '[blue2]Arcane Curse', ['vulcanist'] = '[red]Lava Burst', ['warden'] = '[yellow]Magnetic Field', ['psychic'] = '[fg]Mental Strike', ['miner'] = '[yellow2]Golden Bolts', ['merchant'] = '[yellow2]Item Shop', ['usurer'] = '[purple]Bankruptcy', ['gambler'] = '[yellow2]Multicast', ['thief'] = '[red]Ultrakill', } character_effect_names_gray = { ['vagrant'] = '[light_bg]Champion', ['swordsman'] = '[light_bg]Cleave', ['wizard'] = '[light_bg]Magic Missile', ['magician'] = '[light_bg]Ethereal Form', ['archer'] = '[light_bg]Bounce Shot', ['scout'] = '[light_bg]Dagger Resonance', ['cleric'] = '[light_bg]Mass Heal ', ['outlaw'] = '[light_bg]Flying Daggers', ['blade'] = '[light_bg]Blade Resonance', ['elementor'] = '[light_bg]Windfield', ['saboteur'] = '[light_bg]Demoman', ['stormweaver'] = '[light_bg]Wide Lightning', ['sage'] = '[light_bg]Dimension Compression', ['squire'] = '[light_bg]Shiny Gear', ['cannoneer'] = '[light_bg]Cannon Barrage', ['dual_gunner'] = '[light_bg]Gun Kata', ['hunter'] = '[light_bg]Feral Pack', ['chronomancer'] = '[light_bg]Quicken', ['spellblade'] = '[light_bg]Spiralism', ['psykeeper'] = '[light_bg]Crucio', ['engineer'] = '[light_bg]Upgrade!!!', ['plague_doctor'] = '[light_bg]Black Death Steam', ['barbarian'] = '[light_bg]Seism', ['juggernaut'] = '[light_bg]Brutal Impact', ['lich'] = '[light_bg]Chain Frost', ['cryomancer'] = '[light_bg]Frostbite', ['pyromancer'] = '[light_bg]Ignite', ['corruptor'] = '[light_bg]Corruption', ['beastmaster'] = '[light_bg]Call of the Wild', ['launcher'] = '[light_bg]Kineticism', ['jester'] = "[light_bg]Pandemonium", ['assassin'] = '[light_bg]Toxic Delivery', ['host'] = '[light_bg]Invasion', ['carver'] = '[light_bg]World Tree', ['bane'] = '[light_bg]Nightmare', ['psykino'] = '[light_bg]Magnetic Force', ['barrager'] = '[light_bg]Barrage', ['highlander'] = '[light_bg]Moulinet', ['fairy'] = '[light_bg]Whimsy', ['priest'] = '[light_bg]Divine Intervention', ['infestor'] = '[light_bg]Infestation', ['flagellant'] = '[light_bg]Zealotry', ['arcanist'] = '[light_bg]Arcane Orb', ['illusionist'] = '[light_bg]Mirror Image', ['witch'] = '[light_bg]Death Pool', ['silencer'] = '[light_bg]Arcane Curse', ['vulcanist'] = '[light_bg]Lava Burst', ['warden'] = '[light_bg]Magnetic Field', ['psychic'] = '[light_bg]Mental Strike', ['miner'] = '[light_bg]Golden Bolts', ['merchant'] = '[light_bg]Item Shop', ['usurer'] = '[light_bg]Bankruptcy', ['gambler'] = '[light_bg]Multicast', ['thief'] = '[light_bg]Ultrakill', } character_effect_descriptions = { ['vagrant'] = function() return '[yellow]+10%[fg] damage and [yellow]+10%[fg] attack speed per active set' end, ['swordsman'] = function() return "[fg]the swordsman's damage is [yellow]doubled" end, ['wizard'] = function() return '[fg]the projectile chains [yellow]2[fg] times' end, ['magician'] = function() return '[fg]the magician becomes invulnerable for [yellow]6[fg] seconds but also cannot attack' end, ['archer'] = function() return '[fg]the arrow ricochets off walls [yellow]3[fg] times' end, ['scout'] = function() return '[yellow]+25%[fg] damage per chain and [yellow]+3[fg] chains' end, ['cleric'] = function() return '[fg]heals all units' end, ['outlaw'] = function() return "[yellow]+50%[fg] outlaw attack speed and his knives seek enemies" end, ['blade'] = function() return '[fg]deal additional [yellow]' .. math.round(get_character_stat('blade', 3, 'dmg')/3, 2) .. '[fg] damage per enemy hit' end, ['elementor'] = function() return '[fg]slows enemies by [yellow]60%[fg] for [yellow]6[fg] seconds on hit' end, ['saboteur'] = function() return '[fg]the explosion has [yellow]50%[fg] chance to crit, increasing in size and dealing [yellow]2x[fg] damage' end, ['stormweaver'] = function() return "[fg]chain lightning's trigger area of effect and number of units hit is [yellow]doubled" end, ['sage'] = function() return '[fg]when the projectile expires deal [yellow]' .. 3*get_character_stat('sage', 3, 'dmg') .. '[fg] damage to all enemies under its influence' end, ['squire'] = function() return '[yellow]+30%[fg] damage, attack speed, movement speed and defense to all allies' end, ['cannoneer'] = function() return '[fg]showers the hit area in [yellow]7[fg] additional cannon shots that deal [yellow]' .. get_character_stat('cannoneer', 3, 'dmg')/2 .. '[fg] AoE damage' end, ['dual_gunner'] = function() return '[fg]every 5th attack shoot in rapid succession for [yellow]2[fg] seconds' end, ['hunter'] = function() return '[fg]summons [yellow]3[fg] pets and the pets ricochet off walls once' end, ['chronomancer'] = function() return '[fg]enemies take damave over time [yellow]50%[fg] faster' end, ['spellblade'] = function() return '[fg]faster projectile speed and tighter turns' end, ['psykeeper'] = function() return '[fg]also redistributes damage taken as damage to all enemies at [yellow]double[fg] value' end, ['engineer'] = function() return '[fg]drops [yellow]2[fg] additional turrets and grants all turrets [yellow]+50%[fg] damage and attack speed' end, ['plague_doctor'] = function() return '[fg]nearby enemies take an additional [yellow]' .. get_character_stat('plague_doctor', 3, 'dmg') .. '[fg] damage per second' end, ['barbarian'] = function() return '[fg]stunned enemies also take [yellow]100%[fg] increased damage' end, ['juggernaut'] = function() return '[fg]enemies pushed by the juggernaut take [yellow]' .. 4*get_character_stat('juggernaut', 3, 'dmg') .. '[fg] damage if they hit a wall' end, ['lich'] = function() return '[fg]chain frost slows enemies hit by [yellow]80%[fg] for [yellow]2[fg] seconds and chains [yellow]+7[fg] times' end, ['cryomancer'] = function() return '[fg]enemies are also slowed by [yellow]60%[fg] while in the area' end, ['pyromancer'] = function() return '[fg]enemies killed by the pyromancer explode, dealing [yellow]' .. get_character_stat('pyromancer', 3, 'dmg') .. '[fg] AoE damage' end, ['corruptor'] = function() return '[fg]spawn [yellow]3[fg] small critters if the corruptor hits an enemy' end, ['beastmaster'] = function() return '[fg]spawn [yellow]2[fg] small critters if the beastmaster gets hit' end, ['launcher'] = function() return '[fg]enemies launched take [yellow]300%[fg] more damage when they hit walls' end, ['jester'] = function() return '[fg]all knives seek enemies and pierce [yellow]2[fg] times' end, ['assassin'] = function() return '[fg]poison inflicted from crits deals [yellow]8x[fg] damage' end, ['host'] = function() return '[fg][yellow]+100%[fg] critter spawn rate and spawn [yellow]2[fg] critters instead' end, ['carver'] = function() return '[fg]carves a tree that heals [yellow]twice[fg] as fast, in a bigger area, and heals [yellow]2[fg] units instead' end, ['bane'] = function() return "[yellow]100%[fg] increased area for bane's void rifts" end, ['psykino'] = function() return '[fg]enemies take [yellow]' .. 4*get_character_stat('psykino', 3, 'dmg') .. '[fg] damage and are pushed away when the area expires' end, ['barrager'] = function() return '[fg]every 3rd attack the barrage shoots [yellow]15[fg] projectiles and they push harder' end, ['highlander'] = function() return '[fg]quickly repeats the attack [yellow]3[fg] times' end, ['fairy'] = function() return '[fg]heals [yellow]2[fg] units instead and grants them an additional [yellow]100%[fg] attack speed' end, ['priest'] = function() return '[fg]picks [yellow]3[fg] units at random and grants them a buff that prevents death once' end, ['infestor'] = function() return '[fg][yellow]triples[fg] the number of critters released' end, ['flagellant'] = function() return '[fg]deals [yellow]' .. 2*get_character_stat('flagellant', 3, 'dmg') .. '[fg] damage to all allies and grants [yellow]+12%[fg] damage to all allies per cast' end, ['arcanist'] = function() return '[yellow]+50%[fg] attack speed for the orb and [yellow]2[fg] projectiles are released per cast' end, ['illusionist'] = function() return '[yellow]doubles[fg] the number of copies created and they release [yellow]12[fg] projectiles on death' end, ['witch'] = function() return '[fg]the area releases projectiles, each dealing [yellow]' .. get_character_stat('witch', 3, 'dmg') .. '[fg] damage and chaining once' end, ['silencer'] = function() return '[fg]the curse also deals [yellow]' .. get_character_stat('silencer', 3, 'dmg') .. '[fg] damage per second' end, ['vulcanist'] = function() return '[fg]the number and speed of explosions is [yellow]doubled[fg]' end, ['warden'] = function() return '[fg]creates the force field around [yellow]2[fg] units' end, ['psychic'] = function() return '[fg]the attack can happen from any distance and repeats once' end, ['miner'] = function() return '[fg]release [yellow]8[fg] homing projectiles instead and they pierce twice' end, ['merchant'] = function() return '[fg]your first item reroll is always free' end, ['usurer'] = function() return '[fg]if the same enemy is cursed [yellow]3[fg] times it takes [yellow]' .. 10*get_character_stat('usurer', 3, 'dmg') .. '[fg] damage' end, ['gambler'] = function() return '[yellow]60/40/20%[fg] chance to cast the attack [yellow]2/3/4[fg] times' end, ['thief'] = function() return '[fg]if the knife crits it deals [yellow]' .. 10*get_character_stat('thief', 3, 'dmg') .. '[fg] damage, chains [yellow]10[fg] times and grants [yellow]1[fg] gold' end, } character_effect_descriptions_gray = { ['vagrant'] = function() return '[light_bg]+10% damage and +10% attack speed per active set' end, ['swordsman'] = function() return "[light_bg]the swordsman's damage is doubled" end, ['wizard'] = function() return '[light_bg]the projectile chains 3 times' end, ['magician'] = function() return '[light_bg]the magician becomes invulnerable for 6 seconds but also cannot attack' end, ['archer'] = function() return '[light_bg]the arrow ricochets off walls 3 times' end, ['scout'] = function() return '[light_bg]+25% damage per chain and +3 chains' end, ['cleric'] = function() return '[light_bg]heals all units' end, ['outlaw'] = function() return "[light_bg]+50% outlaw attack speed and his knives seek enemies" end, ['blade'] = function() return '[light_bg]deal additional ' .. math.round(get_character_stat('blade', 3, 'dmg')/2, 2) .. ' damage per enemy hit' end, ['elementor'] = function() return '[light_bg]slows enemies by 60% for 6 seconds on hit' end, ['saboteur'] = function() return '[light_bg]the explosion has 50% chance to crit, increasing in size and dealing 2x damage' end, ['stormweaver'] = function() return "[light_bg]chain lightning's trigger area of effect and number of units hit is doubled" end, ['sage'] = function() return '[light_bg]when the projectile expires deal ' .. 3*get_character_stat('sage', 3, 'dmg') .. ' damage to all enemies under its influence' end, ['squire'] = function() return '[light_bg]+30% damage, attack speed, movement speed and defense to all allies' end, ['cannoneer'] = function() return '[light_bg]showers the hit area in 7 additional cannon shots that deal ' .. get_character_stat('cannoneer', 3, 'dmg')/2 .. ' AoE damage' end, ['dual_gunner'] = function() return '[light_bg]every 5th attack shoot in rapid succession for 2 seconds' end, ['hunter'] = function() return '[light_bg]summons 3 pets and the pets ricochet off walls once' end, ['chronomancer'] = function() return '[light_bg]enemies take damave over time 50% faster' end, ['spellblade'] = function() return '[light_bg]faster projectile speed and tighter turns' end, ['psykeeper'] = function() return '[light_bg]also redistributes damage taken as damage to all enemies at double value' end, ['engineer'] = function() return '[light_bg]drops 2 additional turrets and grants all turrets +50% damage and attack speed' end, ['plague_doctor'] = function() return '[light_bg]nearby enemies take an additional ' .. get_character_stat('plague_doctor', 3, 'dmg') .. ' damage per second' end, ['barbarian'] = function() return '[light_bg]stunned enemies also take 100% increased damage' end, ['juggernaut'] = function() return '[light_bg]enemies pushed by the juggernaut take ' .. 4*get_character_stat('juggernaut', 3, 'dmg') .. ' damage if they hit a wall' end, ['lich'] = function() return '[light_bg]chain frost slows enemies hit by 80% for 2 seconds and chains +7 times' end, ['cryomancer'] = function() return '[light_bg]enemies are also slowed by 60% while in the area' end, ['pyromancer'] = function() return '[light_bg]enemies killed by the pyromancer explode, dealing ' .. get_character_stat('pyromancer', 3, 'dmg') .. ' AoE damage' end, ['corruptor'] = function() return '[light_bg]spawn 3 small critters if the corruptor hits an enemy' end, ['beastmaster'] = function() return '[light_bg]spawn 2 small critters if the beastmaster gets hit' end, ['launcher'] = function() return '[light_bg]enemies launched take 300% more damage when they hit walls' end, ['jester'] = function() return '[light_bg]curses 6 enemies and all knives seek enemies and pierce 2 times' end, ['assassin'] = function() return '[light_bg]poison inflicted from crits deals 8x damage' end, ['host'] = function() return '[light_bg]+100% critter spawn rate and spawn 2 critters instead' end, ['carver'] = function() return '[light_bg]carves a tree that heals twice as fast, in a bigger area, and heals 2 units instead' end, ['bane'] = function() return "[light_bg]100% increased area for bane's void rifts" end, ['psykino'] = function() return '[light_bg]enemies take ' .. 4*get_character_stat('psykino', 3, 'dmg') .. ' damage and are pushed away when the area expires' end, ['barrager'] = function() return '[light_bg]every 3rd attack the barrage shoots 15 projectiles and they push harder' end, ['highlander'] = function() return '[light_bg]quickly repeats the attack 3 times' end, ['fairy'] = function() return '[light_bg]heals 2 units instead and grants them an additional 100% attack speed' end, ['priest'] = function() return '[light_bg]picks 3 units at random and grants them a buff that prevents death once' end, ['infestor'] = function() return '[light_bg]triples the number of critters released' end, ['flagellant'] = function() return '[light_bg]deals ' .. 2*get_character_stat('flagellant', 3, 'dmg') .. ' damage to all allies and grants +12% damage to all allies per cast' end, ['arcanist'] = function() return '[light_bg]+50% attack speed for the orb and 2 projectiles are released per cast' end, ['illusionist'] = function() return '[light_bg]doubles the number of copies created and they release 12 projectiles on death' end, ['witch'] = function() return '[light_bg]the area periodically releases projectiles, each dealing ' .. get_character_stat('witch', 3, 'dmg') .. ' damage and chaining once' end, ['silencer'] = function() return '[light_bg]the curse also deals ' .. get_character_stat('silencer', 3, 'dmg') .. ' damage per second' end, ['vulcanist'] = function() return '[light_bg]the number and speed of explosions is doubled' end, ['warden'] = function() return '[light_bg]creates the force field around 2 units' end, ['psychic'] = function() return '[light_bg]the attack can happen from any distance and repeats once' end, ['miner'] = function() return '[light_bg]release 8 homing projectiles instead and they pierce twice' end, ['merchant'] = function() return '[light_bg]your first item reroll is always free' end, ['usurer'] = function() return '[light_bg]if the same enemy is cursed 3 times it takes ' .. 10*get_character_stat('usurer', 3, 'dmg') .. ' damage' end, ['gambler'] = function() return '[light_bg]60/40/20% chance to cast the attack 2/3/4 times' end, ['thief'] = function() return '[light_bg]if the knife crits it deals ' .. 10*get_character_stat('thief', 3, 'dmg') .. ' damage, chains 10 times and grants 1 gold' end, } character_stats = { ['vagrant'] = function(lvl) return get_character_stat_string('vagrant', lvl) end, ['swordsman'] = function(lvl) return get_character_stat_string('swordsman', lvl) end, ['wizard'] = function(lvl) return get_character_stat_string('wizard', lvl) end, ['magician'] = function(lvl) return get_character_stat_string('magician', lvl) end, ['archer'] = function(lvl) return get_character_stat_string('archer', lvl) end, ['scout'] = function(lvl) return get_character_stat_string('scout', lvl) end, ['cleric'] = function(lvl) return get_character_stat_string('cleric', lvl) end, ['outlaw'] = function(lvl) return get_character_stat_string('outlaw', lvl) end, ['blade'] = function(lvl) return get_character_stat_string('blade', lvl) end, ['elementor'] = function(lvl) return get_character_stat_string('elementor', lvl) end, ['saboteur'] = function(lvl) return get_character_stat_string('saboteur', lvl) end, ['stormweaver'] = function(lvl) return get_character_stat_string('stormweaver', lvl) end, ['sage'] = function(lvl) return get_character_stat_string('sage', lvl) end, ['squire'] = function(lvl) return get_character_stat_string('squire', lvl) end, ['cannoneer'] = function(lvl) return get_character_stat_string('cannoneer', lvl) end, ['dual_gunner'] = function(lvl) return get_character_stat_string('dual_gunner', lvl) end, ['hunter'] = function(lvl) return get_character_stat_string('hunter', lvl) end, ['chronomancer'] = function(lvl) return get_character_stat_string('chronomancer', lvl) end, ['spellblade'] = function(lvl) return get_character_stat_string('spellblade', lvl) end, ['psykeeper'] = function(lvl) return get_character_stat_string('psykeeper', lvl) end, ['engineer'] = function(lvl) return get_character_stat_string('engineer', lvl) end, ['plague_doctor'] = function(lvl) return get_character_stat_string('plague_doctor', lvl) end, ['barbarian'] = function(lvl) return get_character_stat_string('barbarian', lvl) end, ['juggernaut'] = function(lvl) return get_character_stat_string('juggernaut', lvl) end, ['lich'] = function(lvl) return get_character_stat_string('lich', lvl) end, ['cryomancer'] = function(lvl) return get_character_stat_string('cryomancer', lvl) end, ['pyromancer'] = function(lvl) return get_character_stat_string('pyromancer', lvl) end, ['corruptor'] = function(lvl) return get_character_stat_string('corruptor', lvl) end, ['beastmaster'] = function(lvl) return get_character_stat_string('beastmaster', lvl) end, ['launcher'] = function(lvl) return get_character_stat_string('launcher', lvl) end, ['jester'] = function(lvl) return get_character_stat_string('jester', lvl) end, ['assassin'] = function(lvl) return get_character_stat_string('assassin', lvl) end, ['host'] = function(lvl) return get_character_stat_string('host', lvl) end, ['carver'] = function(lvl) return get_character_stat_string('carver', lvl) end, ['bane'] = function(lvl) return get_character_stat_string('bane', lvl) end, ['psykino'] = function(lvl) return get_character_stat_string('psykino', lvl) end, ['barrager'] = function(lvl) return get_character_stat_string('barrager', lvl) end, ['highlander'] = function(lvl) return get_character_stat_string('highlander', lvl) end, ['fairy'] = function(lvl) return get_character_stat_string('fairy', lvl) end, ['priest'] = function(lvl) return get_character_stat_string('priest', lvl) end, ['infestor'] = function(lvl) return get_character_stat_string('infestor', lvl) end, ['flagellant'] = function(lvl) return get_character_stat_string('flagellant', lvl) end, ['arcanist'] = function(lvl) return get_character_stat_string('arcanist', lvl) end, ['illusionist'] = function(lvl) return get_character_stat_string('illusionist', lvl) end, ['witch'] = function(lvl) return get_character_stat_string('witch', lvl) end, ['silencer'] = function(lvl) return get_character_stat_string('silencer', lvl) end, ['vulcanist'] = function(lvl) return get_character_stat_string('vulcanist', lvl) end, ['warden'] = function(lvl) return get_character_stat_string('warden', lvl) end, ['psychic'] = function(lvl) return get_character_stat_string('psychic', lvl) end, ['miner'] = function(lvl) return get_character_stat_string('miner', lvl) end, ['merchant'] = function(lvl) return get_character_stat_string('merchant', lvl) end, ['usurer'] = function(lvl) return get_character_stat_string('usurer', lvl) end, ['gambler'] = function(lvl) return get_character_stat_string('gambler', lvl) end, ['thief'] = function(lvl) return get_character_stat_string('thief', lvl) end, } class_stat_multipliers = { ['ranger'] = {hp = 1, dmg = 1.2, aspd = 1.5, area_dmg = 1, area_size = 1, def = 0.9, mvspd = 1.2}, ['warrior'] = {hp = 1.4, dmg = 1.1, aspd = 0.9, area_dmg = 1, area_size = 1, def = 1.25, mvspd = 0.9}, ['mage'] = {hp = 0.6, dmg = 1.4, aspd = 1, area_dmg = 1.25, area_size = 1.2, def = 0.75, mvspd = 1}, ['rogue'] = {hp = 0.8, dmg = 1.3, aspd = 1.1, area_dmg = 0.6, area_size = 0.6, def = 0.8, mvspd = 1.4}, ['healer'] = {hp = 1.2, dmg = 1, aspd = 0.5, area_dmg = 1, area_size = 1, def = 1.2, mvspd = 1}, ['enchanter'] = {hp = 1.2, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 1.2, mvspd = 1.2}, ['nuker'] = {hp = 0.9, dmg = 1, aspd = 0.75, area_dmg = 1.5, area_size = 1.5, def = 1, mvspd = 1}, ['conjurer'] = {hp = 1, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 1, mvspd = 1}, ['psyker'] = {hp = 1.5, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 0.5, mvspd = 1}, ['curser'] = {hp = 1, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 0.75, mvspd = 1}, ['forcer'] = {hp = 1.25, dmg = 1.1, aspd = 0.9, area_dmg = 0.75, area_size = 0.75, def = 1.2, mvspd = 1}, ['swarmer'] = {hp = 1.2, dmg = 1, aspd = 1.25, area_dmg = 1, area_size = 1, def = 0.75, mvspd = 0.75}, ['voider'] = {hp = 0.75, dmg = 1.3, aspd = 1, area_dmg = 0.8, area_size = 0.75, def = 0.6, mvspd = 0.8}, ['sorcerer'] = {hp = 0.8, dmg = 1.3, aspd = 1, area_dmg = 1.2, area_size = 1, def = 0.8, mvspd = 1}, ['mercenary'] = {hp = 1, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 1, mvspd = 1}, ['seeker'] = {hp = 0.5, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 1, mvspd = 0.3}, ['mini_boss'] = {hp = 1, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 1, mvspd = 0.3}, ['enemy_critter'] = {hp = 1, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 1, mvspd = 0.5}, ['saboteur'] = {hp = 1, dmg = 1, aspd = 1, area_dmg = 1, area_size = 1, def = 1, mvspd = 1.4}, } local ylb1 = function(lvl) if lvl == 3 then return 'fg' elseif lvl == 2 then return 'fg' elseif lvl == 1 then return 'yellow' else return 'light_bg' end end local ylb2 = function(lvl) if lvl == 3 then return 'fg' elseif lvl == 2 then return 'yellow' else return 'light_bg' end end local ylb3 = function(lvl) if lvl == 3 then return 'yellow' else return 'light_bg' end end class_descriptions = { ['ranger'] = function(lvl) return '[' .. ylb1(lvl) .. ']3[' .. ylb2(lvl) .. ']/6 [fg]- [' .. ylb1(lvl) .. ']8%[' .. ylb2(lvl) .. ']/16% [fg]chance to release a barrage on attack to allied rangers' end, ['warrior'] = function(lvl) return '[' .. ylb1(lvl) .. ']3[' .. ylb2(lvl) .. ']/6 [fg]- [' .. ylb1(lvl) .. ']+25[' .. ylb2(lvl) .. ']/+50 [fg]defense to allied warriors' end, ['mage'] = function(lvl) return '[' .. ylb1(lvl) .. ']3[' .. ylb2(lvl) .. ']/6 [fg]- [' .. ylb1(lvl) .. ']-15[' .. ylb2(lvl) .. ']/-30 [fg]enemy defense' end, ['rogue'] = function(lvl) return '[' .. ylb1(lvl) .. ']3[' .. ylb2(lvl) .. ']/6 [fg]- [' .. ylb1(lvl) .. ']15%[' .. ylb2(lvl) .. ']/30% [fg]chance to crit to allied rogues, dealing [yellow]4x[] damage' end, ['healer'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+15%[' .. ylb2(lvl) .. ']/+30% [fg]healing effectiveness' end, ['enchanter'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+15%[' .. ylb2(lvl) .. ']/+25% [fg]damage to all allies' end, ['nuker'] = function(lvl) return '[' .. ylb1(lvl) .. ']3[' .. ylb2(lvl) .. ']/6 [fg]- [' .. ylb1(lvl) .. ']+15%[' .. ylb2(lvl) .. ']/+25% [fg]area damage and size to allied nukers' end, ['conjurer'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+25%[' .. ylb2(lvl) .. ']/+50% [fg]summon damage and duration' end, ['psyker'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+10%[' .. ylb2(lvl) .. ']/+20% [fg]damage and attack speed per active set to allied psykers' end, ['curser'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+25%[' .. ylb2(lvl) .. ']/+50% [fg]curse duration' end, ['forcer'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+25%[' .. ylb2(lvl) .. ']/+50% [fg]knockback force to all allies' end, ['swarmer'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+1[' .. ylb2(lvl) .. ']/+3 [fg]hits to critters' end, ['voider'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+15%[' .. ylb2(lvl) .. ']/+25% [fg]damage over time to allied voiders' end, ['sorcerer'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4[' .. ylb3(lvl) .. ']/6 [fg]- sorcerers repeat their attacks once every [' .. ylb1(lvl) .. ']4/[' .. ylb2(lvl) .. ']3/[' .. ylb3(lvl) .. ']2[fg] attacks' end, ['mercenary'] = function(lvl) return '[' .. ylb1(lvl) .. ']2[' .. ylb2(lvl) .. ']/4 [fg]- [' .. ylb1(lvl) .. ']+10%[' .. ylb2(lvl) .. ']/+20% [fg]chance for enemies to drop gold on death' end, } tier_to_characters = { [1] = {'vagrant', 'swordsman', 'magician', 'archer', 'scout', 'cleric', 'arcanist', 'miner'}, [2] = {'wizard', 'saboteur', 'sage', 'squire', 'dual_gunner', 'hunter', 'chronomancer', 'barbarian', 'cryomancer', 'beastmaster', 'jester', 'carver', 'psychic', 'witch', 'silencer', 'outlaw', 'merchant'}, [3] = {'elementor', 'stormweaver', 'spellblade', 'psykeeper', 'engineer', 'juggernaut', 'pyromancer', 'host', 'assassin', 'bane', 'barrager', 'infestor', 'flagellant', 'illusionist', 'usurer', 'gambler'}, [4] = {'priest', 'highlander', 'psykino', 'fairy', 'blade', 'plague_doctor', 'cannoneer', 'vulcanist', 'warden', 'corruptor', 'thief'}, } non_attacking_characters = {'cleric', 'stormweaver', 'squire', 'chronomancer', 'sage', 'psykeeper', 'bane', 'carver', 'fairy', 'priest', 'flagellant', 'merchant', 'miner'} non_cooldown_characters = {'squire', 'chronomancer', 'psykeeper', 'merchant', 'miner'} character_tiers = { ['vagrant'] = 1, ['swordsman'] = 1, ['magician'] = 1, ['archer'] = 1, ['scout'] = 1, ['cleric'] = 1, ['outlaw'] = 2, ['blade'] = 4, ['elementor'] = 3, ['saboteur'] = 2, ['wizard'] = 2, ['stormweaver'] = 3, ['sage'] = 2, ['squire'] = 2, ['cannoneer'] = 4, ['dual_gunner'] = 2, ['hunter'] = 2, ['chronomancer'] = 2, ['spellblade'] = 3, ['psykeeper'] = 3, ['engineer'] = 3, ['plague_doctor'] = 4, ['barbarian'] = 2, ['juggernaut'] = 3, -- ['lich'] = 4, ['cryomancer'] = 2, ['pyromancer'] = 3, ['corruptor'] = 4, ['beastmaster'] = 2, -- ['launcher'] = 2, ['jester'] = 2, ['assassin'] = 3, ['host'] = 3, ['carver'] = 2, ['bane'] = 3, ['psykino'] = 4, ['barrager'] = 3, ['highlander'] = 4, ['fairy'] = 4, ['priest'] = 4, ['infestor'] = 3, ['flagellant'] = 3, ['arcanist'] = 1, ['illusionist'] = 3, ['witch'] = 2, ['silencer'] = 2, ['vulcanist'] = 4, ['warden'] = 4, ['psychic'] = 2, ['miner'] = 1, ['merchant'] = 2, ['usurer'] = 3, ['gambler'] = 3, ['thief'] = 4, } get_number_of_units_per_class = function(units) local rangers = 0 local warriors = 0 local healers = 0 local mages = 0 local nukers = 0 local conjurers = 0 local rogues = 0 local enchanters = 0 local psykers = 0 local cursers = 0 local forcers = 0 local swarmers = 0 local voiders = 0 local sorcerers = 0 local mercenaries = 0 for _, unit in ipairs(units) do for _, unit_class in ipairs(character_classes[unit.character]) do if unit_class == 'ranger' then rangers = rangers + 1 end if unit_class == 'warrior' then warriors = warriors + 1 end if unit_class == 'healer' then healers = healers + 1 end if unit_class == 'mage' then mages = mages + 1 end if unit_class == 'nuker' then nukers = nukers + 1 end if unit_class == 'conjurer' then conjurers = conjurers + 1 end if unit_class == 'rogue' then rogues = rogues + 1 end if unit_class == 'enchanter' then enchanters = enchanters + 1 end if unit_class == 'psyker' then psykers = psykers + 1 end if unit_class == 'curser' then cursers = cursers + 1 end if unit_class == 'forcer' then forcers = forcers + 1 end if unit_class == 'swarmer' then swarmers = swarmers + 1 end if unit_class == 'voider' then voiders = voiders + 1 end if unit_class == 'sorcerer' then sorcerers = sorcerers + 1 end if unit_class == 'mercenary' then mercenaries = mercenaries + 1 end end end return {ranger = rangers, warrior = warriors, healer = healers, mage = mages, nuker = nukers, conjurer = conjurers, rogue = rogues, enchanter = enchanters, psyker = psykers, curser = cursers, forcer = forcers, swarmer = swarmers, voider = voiders, sorcerer = sorcerers, mercenary = mercenaries} end get_class_levels = function(units) local units_per_class = get_number_of_units_per_class(units) local units_to_class_level = function(number_of_units, class) if class == 'ranger' or class == 'warrior' or class == 'mage' or class == 'nuker' or class == 'rogue' then if number_of_units >= 6 then return 2 elseif number_of_units >= 3 then return 1 else return 0 end elseif class == 'healer' or class == 'conjurer' or class == 'enchanter' or class == 'psyker' or class == 'curser' or class == 'forcer' or class == 'swarmer' or class == 'voider' or class == 'mercenary' then if number_of_units >= 4 then return 2 elseif number_of_units >= 2 then return 1 else return 0 end elseif class == 'sorcerer' then if number_of_units >= 6 then return 3 elseif number_of_units >= 4 then return 2 elseif number_of_units >= 2 then return 1 else return 0 end end end return { ranger = units_to_class_level(units_per_class.ranger, 'ranger'), warrior = units_to_class_level(units_per_class.warrior, 'warrior'), mage = units_to_class_level(units_per_class.mage, 'mage'), nuker = units_to_class_level(units_per_class.nuker, 'nuker'), rogue = units_to_class_level(units_per_class.rogue, 'rogue'), healer = units_to_class_level(units_per_class.healer, 'healer'), conjurer = units_to_class_level(units_per_class.conjurer, 'conjurer'), enchanter = units_to_class_level(units_per_class.enchanter, 'enchanter'), psyker = units_to_class_level(units_per_class.psyker, 'psyker'), curser = units_to_class_level(units_per_class.curser, 'curser'), forcer = units_to_class_level(units_per_class.forcer, 'forcer'), swarmer = units_to_class_level(units_per_class.swarmer, 'swarmer'), voider = units_to_class_level(units_per_class.voider, 'voider'), sorcerer = units_to_class_level(units_per_class.sorcerer, 'sorcerer'), mercenary = units_to_class_level(units_per_class.mercenary, 'mercenary'), } end get_classes = function(units) local classes = {} for _, unit in ipairs(units) do table.insert(classes, table.copy(character_classes[unit.character])) end return table.unify(table.flatten(classes)) end class_set_numbers = { ['ranger'] = function(units) return 3, 6, nil, get_number_of_units_per_class(units).ranger end, ['warrior'] = function(units) return 3, 6, nil, get_number_of_units_per_class(units).warrior end, ['mage'] = function(units) return 3, 6, nil, get_number_of_units_per_class(units).mage end, ['nuker'] = function(units) return 3, 6, nil, get_number_of_units_per_class(units).nuker end, ['rogue'] = function(units) return 3, 6, nil, get_number_of_units_per_class(units).rogue end, ['healer'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).healer end, ['conjurer'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).conjurer end, ['enchanter'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).enchanter end, ['psyker'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).psyker end, ['curser'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).curser end, ['forcer'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).forcer end, ['swarmer'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).swarmer end, ['voider'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).voider end, ['sorcerer'] = function(units) return 2, 4, 6, get_number_of_units_per_class(units).sorcerer end, ['mercenary'] = function(units) return 2, 4, nil, get_number_of_units_per_class(units).mercenary end, } passive_names = { ['ouroboros_technique_r'] = 'Ouroboros Technique R', ['ouroboros_technique_l'] = 'Ouroboros Technique L', ['wall_echo'] = 'Wall Echo', ['wall_rider'] = 'Wall Rider', ['centipede'] = 'Centipede', ['intimidation'] = 'Intimidation', ['vulnerability'] = 'Vulnerability', ['temporal_chains'] = 'Temporal Chains', ['amplify'] = 'Amplify', ['amplify_x'] = 'Amplify X', ['resonance'] = 'Resonance', ['ballista'] = 'Ballista', ['ballista_x'] = 'Ballista X', ['point_blank'] = 'Point Blank', ['longshot'] = 'Longshot', ['blunt_arrow'] = 'Blunt Arrow', ['explosive_arrow'] = 'Explosive Arrow', ['divine_machine_arrow'] = 'Divine Machine Arrow', ['chronomancy'] = 'Chronomancy', ['awakening'] = 'Awakening', ['divine_punishment'] = 'Divine Punishment', ['berserking'] = 'Berserking', ['unwavering_stance'] = 'Unwavering Stance', ['ultimatum'] = 'Ultimatum', ['flying_daggers'] = 'Flying Daggers', ['assassination'] = 'Assassination', ['magnify'] = 'Magnify', ['echo_barrage'] = 'Echo Barrage', ['unleash'] = 'Unleash', ['reinforce'] = 'Reinforce', ['payback'] = 'Payback', ['blessing'] = 'Blessing', ['hex_master'] = 'Hex Master', ['whispers_of_doom'] = 'Whispers of Doom', ['force_push'] = 'Force Push', ['heavy_impact'] = 'Heavy Impact', ['crucio'] = 'Crucio', ['immolation'] = 'Immolation', ['call_of_the_void'] = 'Call of the Void', ['spawning_pool'] = 'Spawning Pool', ['hive'] = 'Hive', ['void_rift'] = 'Void Rift', } passive_descriptions = { ['ouroboros_technique_r'] = '[fg]rotating around yourself to the right makes units release projectiles', ['ouroboros_technique_l'] = '[fg]rotating around yourself to the left grants [yellow]+25%[fg] defense to all units', ['wall_echo'] = '[fg]hitting walls has a [yellow]34%[fg] chance of releasing [yellow]2[fg] projectiles', ['wall_rider'] = '[fg]hitting walls grants a [yellow]25%[fg] movement speed buff to your snake for [yellow]1[fg] second', ['centipede'] = '[yellow]+20%[fg] movement speed', ['intimidation'] = '[fg]enemies spawn with [yellow]-20%[fg] max HP', ['vulnerability'] = '[fg]all enemies take [yellow]+20%[fg] damage', ['temporal_chains'] = '[fg]all enemies move [yellow]20%[fg] slower', ['amplify'] = '[yellow]+25%[fg] AoE damage', ['amplify_x'] = '[yellow]+50%[fg] AoE damage', ['resonance'] = '[fg]all AoE attacks deal [yellow]+5%[fg] damage per unit hit', ['ballista'] = '[yellow]+25%[fg] damage to rangers and rogues ', ['ballista_x'] = '[yellow]+50%[fg] damage to rangers and rogues', ['point_blank'] = '[fg]projectiles deal up to [yellow]+100%[fg] damage up close and down to [yellow]-50%[fg] damage far away', ['longshot'] = '[fg]projectiles deal up to [yellow]+100%[fg] damage far away and down to [yellow]-50%[fg] up close', ['blunt_arrow'] = '[fg]all arrows fired by rangers have a [yellow]20%[fg] chance to knockback', ['explosive_arrow'] = '[fg]arrows fired by rangers have a [yellow]30%[fg] chance to explode, dealing [yellow]20%[fg] AoE damage', ['divine_machine_arrow'] = '[fg]arrows fired by rangers have a [yellow]40%[fg] chance to seek enemies and pierce [yellow]4[fg] times', ['chronomancy'] = '[fg]all mages and sorcerers cast their spells [yellow]25%[fg] faster', ['awakening'] = '[yellow]+100%[fg] aspd and damage to [yellow]1[fg] mage or sorcerer every round for that round', ['divine_punishment'] = '[fg]repeatedly deal damage to all enemies based on how many mages or sorcerers you have', ['berserking'] = '[fg]all warriors have up to [yellow]+50%[fg] attack speed based on missing HP', ['unwavering_stance'] = '[fg]all warriors gain [yellow]+5%[fg] defense every [yellow]5[fg] seconds', ['ultimatum'] = '[fg]projectiles that chain gain [yellow]+25%[fg] damage with each chain', ['flying_daggers'] = '[fg]all knives thrown by rogues chain [yellow]+2[fg] times', ['assassination'] = '[fg]crits from rogues deal [yellow]8x[fg] damage but normal attacks deal [yellow]half[fg] damage', ['magnify'] = '[yellow]+25%[fg] area size', ['echo_barrage'] = '[yellow]20%[fg] chance to create [yellow]3[fg] secondary AoEs on AoE hit', ['unleash'] = '[yellow]+1%[fg] area size and damage per second', ['reinforce'] = '[yellow]+10%[fg] damage, defense and attack speed to all allies with at least one enchanter', ['payback'] = '[yellow]+5%[fg] damage to all allies whenever an enchanter is hit', ['blessing'] = '[yellow]+20%[fg] healing effectiveness', ['hex_master'] = '[yellow]+25%[fg] curse duration', ['whispers_of_doom'] = '[fg]curses apply doom, when [yellow]4[fg] doom instances are reached they deal [yellow]200[fg] damage', ['force_push'] = '[yellow]+25%[fg] knockback force', ['heavy_impact'] = '[fg]when enemies hit walls they take damage according to the knockback force', ['crucio'] = '[fg]taking damage also shares that across all enemies at [yellow]25%[fg] its value', ['immolation'] = '[yellow]3[fg] units will periodically take damage, all your allies gain [yellow]+8%[fg] damage per tick', ['call_of_the_void'] = '[yellow]+25%[fg] damage over time', ['spawning_pool'] = '[yellow]+1[fg] critter health', ['hive'] = '[yellow]+2[fg] critter health', ['void_rift'] = '[fg]attacks by mages, nukers or voiders have a [yellow]20%[fg] chance to create a void rift on hit', } passive_tiers = { ['ouroboros_technique_r'] = 2, ['ouroboros_technique_l'] = 2, ['wall_echo'] = 1, ['wall_rider'] = 1, ['centipede'] = 1, ['intimidation'] = 2, ['vulnerability'] = 2, ['temporal_chains'] = 1, ['amplify'] = 1, ['amplify_x'] = 2, ['resonance'] = 3, ['ballista'] = 1, ['ballista_x'] = 2, ['point_blank'] = 2, ['longshot'] = 2, ['blunt_arrow'] = 1, ['explosive_arrow'] = 2, ['divine_machine_arrow'] = 3, ['chronomancy'] = 2, ['awakening'] = 2, ['divine_punishment'] = 3, ['berserking'] = 1, ['unwavering_stance'] = 1, ['ultimatum'] = 2, ['flying_daggers'] = 3, ['assassination'] = 1, ['magnify'] = 1, ['echo_barrage'] = 2, ['unleash'] = 1, ['reinforce'] = 2, ['payback'] = 2, ['blessing'] = 1, ['hex_master'] = 1, ['whispers_of_doom'] = 2, ['force_push'] = 1, ['heavy_impact'] = 2, ['crucio'] = 3, ['immolation'] = 2, ['call_of_the_void'] = 2, ['spawning_pool'] = 1, ['hive'] = 3, ['void_rift'] = 3, } tier_to_passives = { [1] = {'wall_echo', 'wall_rider', 'centipede', 'temporal_chains', 'amplify', 'amplify_x', 'ballista', 'ballista_x', 'blunt_arrow', 'berserking', 'unwavering_stance', 'assassination', 'unleash', 'blessing', 'hex_master', 'force_push', 'spawning_pool'}, [2] = {'ouroboros_technique_r', 'ouroboros_technique_l', 'intimidation', 'vulnerability', 'resonance', 'point_blank', 'longshot', 'explosive_arrow', 'chronomancy', 'awakening', 'ultimatum', 'echo_barrage', 'reinforce', 'payback', 'whispers_of_doom', 'heavy_impact', 'immolation', 'call_of_the_void'}, [3] = {'divine_machine_arrow', 'divine_punishment', 'flying_daggers', 'crucio', 'hive', 'void_rift'}, } level_to_tier_weights = { [1] = {90, 10, 0, 0}, [2] = {80, 15, 5, 0}, [3] = {75, 20, 5, 0}, [4] = {70, 20, 10, 0}, [5] = {70, 20, 10, 0}, [6] = {65, 25, 10, 0}, [7] = {60, 25, 15, 0}, [8] = {55, 25, 15, 5}, [9] = {50, 30, 15, 5}, [10] = {50, 30, 15, 5}, [11] = {45, 30, 20, 5}, [12] = {40, 30, 20, 10}, [13] = {35, 30, 25, 10}, [14] = {30, 30, 25, 15}, [15] = {25, 30, 30, 15}, [16] = {25, 25, 30, 20}, [17] = {20, 25, 35, 20}, [18] = {15, 25, 35, 25}, [19] = {10, 25, 40, 25}, [20] = {5, 25, 40, 30}, [21] = {0, 25, 40, 35}, [22] = {0, 20, 40, 40}, [23] = {0, 20, 35, 45}, [24] = {0, 10, 30, 60}, [25] = {0, 0, 0, 100}, } level_to_gold_gained = { [1] = {2, 2}, [2] = {2, 2}, [3] = {4, 6}, [4] = {3, 5}, [5] = {4, 7}, [6] = {6, 10}, [7] = {8, 10}, [8] = {10, 12}, [9] = {12, 15}, [10] = {10, 13}, [11] = {12, 15}, [12] = {18, 20}, [13] = {10, 14}, [14] = {12, 16}, [15] = {14, 18}, [16] = {12, 12}, [17] = {12, 12}, [18] = {20, 24}, [19] = {8, 12}, [20] = {10, 14}, [21] = {20, 28}, [22] = {32, 32}, [23] = {36, 36}, [24] = {48, 48}, [25] = {100, 100}, } level_to_passive_tier_weights = { [3] = {70, 20, 10}, [6] = {60, 25, 15}, [9] = {50, 30, 20}, [12] = {40, 40, 20}, [15] = {30, 45, 25}, [18] = {20, 50, 30}, [21] = {20, 40, 40}, [24] = {20, 30, 50}, } level_to_elite_spawn_weights = { [1] = {0}, [2] = {4, 2}, [3] = {10}, [4] = {4, 4}, [5] = {4, 3, 2}, [6] = {12}, [7] = {5, 3, 2}, [8] = {6, 3, 3, 3}, [9] = {14}, [10] = {8, 4}, [11] = {8, 6, 2}, [12] = {16}, [13] = {8, 8}, [14] = {12, 6}, [15] = {18}, [16] = {10, 6, 4}, [17] = {6, 5, 4, 3}, [18] = {18}, [19] = {10, 6}, [20] = {10, 6, 2}, [21] = {28}, [22] = {10, 10, 5}, [23] = {20, 5, 5}, [24] = {35}, [25] = {5, 5, 5, 5, 5, 5}, } level_to_boss = { [6] = 'speed_booster', [12] = 'exploder', [18] = 'swarmer', [24] = 'forcer', [25] = 'randomizer', } level_to_elite_spawn_types = { [1] = {'speed_booster'}, [2] = {'speed_booster', 'shooter'}, [3] = {'speed_booster'}, [4] = {'speed_booster', 'exploder'}, [5] = {'speed_booster', 'exploder', 'shooter'}, [6] = {'speed_booster'}, [7] = {'speed_booster', 'exploder', 'headbutter'}, [8] = {'speed_booster', 'exploder', 'headbutter', 'shooter'}, [9] = {'shooter'}, [10] = {'exploder', 'headbutter'}, [11] = {'exploder', 'headbutter', 'tank'}, [12] = {'exploder'}, [13] = {'speed_booster', 'shooter'}, [14] = {'speed_booster', 'spawner'}, [15] = {'shooter'}, [16] = {'speed_booster', 'exploder', 'spawner'}, [17] = {'speed_booster', 'exploder', 'spawner', 'shooter'}, [18] = {'spawner'}, [19] = {'headbutter', 'tank'}, [20] = {'speed_booster', 'tank', 'spawner'}, [21] = {'headbutter'}, [22] = {'speed_booster', 'headbutter', 'tank'}, [23] = {'headbutter', 'tank', 'shooter'}, [24] = {'tank'}, [25] = {'speed_booster', 'exploder', 'headbutter', 'tank', 'shooter', 'spawner'}, } get_shop_odds_by_level = function(lvl) if lvl == 1 then return {70, 20, 10, 0} elseif lvl == 2 then return {50, 30, 15, 5} elseif lvl == 3 then return {25, 45, 20, 10} elseif lvl == 4 then return {10, 25, 45, 20} elseif lvl == 5 then return {5, 15, 30, 50} end end get_shop_odds = function(lvl, tier) if lvl == 1 then if tier == 1 then return 70 elseif tier == 2 then return 20 elseif tier == 3 then return 10 elseif tier == 4 then return 0 end elseif lvl == 2 then if tier == 1 then return 50 elseif tier == 2 then return 30 elseif tier == 3 then return 15 elseif tier == 4 then return 5 end elseif lvl == 3 then if tier == 1 then return 25 elseif tier == 2 then return 45 elseif tier == 3 then return 20 elseif tier == 4 then return 10 end elseif lvl == 4 then if tier == 1 then return 10 elseif tier == 2 then return 25 elseif tier == 3 then return 45 elseif tier == 4 then return 20 end elseif lvl == 5 then if tier == 1 then return 5 elseif tier == 2 then return 15 elseif tier == 3 then return 30 elseif tier == 4 then return 50 end end end local run = system.load_run() run_passive_pool_by_tiers = run.run_passive_pool_by_tiers or { [1] = { 'wall_echo', 'wall_rider', 'centipede', 'temporal_chains', 'amplify', 'amplify_x', 'ballista', 'ballista_x', 'blunt_arrow', 'berserking', 'unwavering_stance', 'assassination', 'unleash', 'blessing', 'hex_master', 'force_push', 'spawning_pool'}, [2] = {'ouroboros_technique_r', 'ouroboros_technique_l', 'intimidation', 'vulnerability', 'resonance', 'point_blank', 'longshot', 'explosive_arrow', 'chronomancy', 'awakening', 'ultimatum', 'echo_barrage', 'reinforce', 'payback', 'whispers_of_doom', 'heavy_impact', 'immolation', 'call_of_the_void'}, [3] = {'divine_machine_arrow', 'divine_punishment', 'flying_daggers', 'crucio', 'hive', 'void_rift'}, } gold = run.gold or 3 passives = run.passives or {} locked_state = run.locked_state steam.userStats.requestCurrentStats() new_game_plus = state.new_game_plus or 0 if not state.new_game_plus then state.new_game_plus = new_game_plus end current_new_game_plus = state.current_new_game_plus or new_game_plus if not state.current_new_game_plus then state.current_new_game_plus = current_new_game_plus end max_units = 7 + current_new_game_plus main = Main() if run.level and run.level > 0 then main_song_instance = _G[random:table{'song1', 'song2', 'song3', 'song4', 'song5'}]:play{volume = 0.5} end -- main_song_instance = _G[random:table{'song1', 'song2', 'song3', 'song4', 'song5'}]:play{volume = 0.5} main:add(BuyScreen'buy_screen') main:go_to('buy_screen', run.level or 0, run.units or {}, passives, run.shop_level or 1, run.shop_xp or 0) -- main:go_to('buy_screen', 7, run.units or {}, {'unleash'}) --[[ main:add(Arena'arena') main:go_to('arena', 21, { {character = 'plague_doctor', level = 2}, {character = 'swordsman', level = 3}, {character = 'barbarian', level = 2}, {character = 'outlaw', level = 2}, {character = 'warden', level = 2}, {character = 'juggernaut', level = 2}, {character = 'blade', level = 2}, }, passives) ]]-- --[[ main:add(Media'media') main:go_to('media') ]]-- trigger:every(2, function() if debugging_memory then for k, v in pairs(system.type_count()) do print(k, v) end print("-- " .. math.round(tonumber(collectgarbage("count"))/1024, 3) .. "MB --") print() end end) --[[ print(table.tostring(love.graphics.getSupported())) print(love.graphics.getRendererInfo()) local formats = love.graphics.getImageFormats() for f, s in pairs(formats) do print(f, tostring(s)) end local canvasformats = love.graphics.getCanvasFormats() for f, s in pairs(canvasformats) do print(f, tostring(s)) end print(table.tostring(love.graphics.getSystemLimits())) print(table.tostring(love.graphics.getStats())) ]]-- end function update(dt) main:update(dt) --[[ if input.b.pressed then -- debugging_memory = not debugging_memory for k, v in pairs(system.type_count()) do print(k, v) end print("-- " .. math.round(tonumber(collectgarbage("count"))/1024, 3) .. "MB --") print() end ]]-- if input.n.pressed then if main.current.sfx_button then main.current.sfx_button:action() main.current.sfx_button.selected = false else if sfx.volume == 0.5 then sfx.volume = 0 state.volume_muted = true elseif sfx.volume == 0 then sfx.volume = 0.5 state.volume_muted = false end end end if input.m.pressed then if main.current.music_button then main.current.music_button:action() main.current.music_button.selected = false else if music.volume == 0.5 then state.music_muted = true music.volume = 0 elseif music.volume == 0 then music.volume = 0.5 state.music_muted = false end end end if input.k.pressed then if sx > 1 and sy > 1 then sx, sy = sx - 1, sy - 1 love.window.setMode(480*sx, 270*sy) state.sx, state.sy = sx, sy state.fullscreen = false end end if input.l.pressed then sx, sy = sx + 1, sy + 1 love.window.setMode(480*sx, 270*sy) state.sx, state.sy = sx, sy state.fullscreen = false end --[[ if input.f12.pressed then steam.userStats.resetAllStats(true) steam.userStats.storeStats() end ]]-- end function draw() shared_draw(function() main:draw() end) end function love.run() return engine_run({ game_name = 'SNKRX', window_width = 480*4, window_height = 270*4, }) end
-- module Data.Array.Unsafe local Unsafe = {} exports.unsafeIndex = function (xs) return function (n) return xs[n+1] end end return Unsafe
include "src" include "test/src"
settings { } sync { default.rsync, source = "/home/user/workspace/cfnmxl/machine-vision-acquisition/tmp/data-root/", target = "powerplant.pfr.co.nz:/input/projects/dhs/smartsensingandimaging/development", -- # Large delay to allow complete writing and also deletion to not interfere delay = 60, -- # Do not remove remote files delete = false, -- # only monitor going forwards, not existing init = false, rsync = { archive = true, compress = true, chown = "cfnmxl:powerplant", prune_empty_dirs = true, -- This needs to be a valid key, not encrypted for now rsh = "/usr/bin/ssh -i /home/user/.ssh/mflange-edge-fops.nopass.key -oStrictHostKeyChecking=no -l cfnmxl", -- # Remove source files _extra = { "--remove-source-files" } } }
include("shared.lua") function ENT:Draw() render.SetMaterial( Material( "hlof/sprites/exit1" ) ) render.DrawSprite( self:GetPos(), 64, 64, Color( 255, 255, 255 ) ) end function ENT:Think() local light = DynamicLight( self:EntIndex() ) light.Pos = self:GetPos() light.r = 255 light.g = 255 light.b = 100 light.Brightness = 1 light.Size = 256 light.Decay = 250 light.DieTime = CurTime() + 0.2 end function ENT:OnRemove() local light = DynamicLight( self:EntIndex() ) light.Pos = self:GetPos() light.r = 255 light.g = 255 light.b = 100 light.Brightness = 2 light.Size = 256 light.Decay = 250 light.DieTime = CurTime() + 0.5 end
--LL-セレスト・ワグテイル --Scripted by mallu11 function c100425035.initial_effect(c) --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(100425035,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,100425035) e1:SetTarget(c100425035.thtg) e1:SetOperation(c100425035.thop) c:RegisterEffect(e1) --overlay local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(100425035,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,100425135) e2:SetTarget(c100425035.ovtg) e2:SetOperation(c100425035.ovop) c:RegisterEffect(e2) end function c100425035.thfilter(c) return c:IsSetCard(0xf7) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() end function c100425035.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(c100425035.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c100425035.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c100425035.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function c100425035.ovfilter(c) return c:IsFaceup() and c:IsSetCard(0xf7) and c:IsType(TYPE_XYZ) end function c100425035.ovtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c100425035.ovfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c100425035.ovfilter,tp,LOCATION_MZONE,0,1,nil) and e:GetHandler():IsCanOverlay() end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,c100425035.ovfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end function c100425035.ovop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not c:IsImmuneToEffect(e) and not tc:IsImmuneToEffect(e) then Duel.Overlay(tc,Group.FromCards(c)) end end
local uv = require 'couv' local Buffer = uv.Buffer local exports = {} exports['Buffer.new'] = function(test) local buf = Buffer.new(2) test.equal(type(buf), 'userdata') buf = Buffer.new('abc') test.equal(type(buf), 'userdata') test.equal(buf[1], 97) test.equal(buf[2], 98) test.equal(buf[3], 99) test.done() end exports['Buffer.concat'] = function(test) local buf = Buffer.concat{Buffer.new('ab'), Buffer.new('c'), Buffer.new('de')} test.equal(buf:toString(), 'abcde') buf = Buffer.concat({Buffer.new('ab'), Buffer.new('c'), Buffer.new('de')}, 4) test.equal(buf:toString(), 'abcd') test.done() end exports['Buffer.fill'] = function(test) local buf = Buffer.new(3) buf:fill(97, 1, 2) test.equal(buf[1], 97) test.equal(buf[2], 97) test.done() end exports['Buffer.write'] = function(test) local buf = Buffer.new(3) test.equal(buf:write('abc', 1), 3) test.equal(buf[1], 97) test.equal(buf[2], 98) test.equal(buf[3], 99) buf:fill(0) test.equal(buf:write('abc', 1, 2), 2) test.equal(buf[1], 97) test.equal(buf[2], 98) test.equal(buf[3], 0) buf:fill(0) test.equal(buf:write('ab', 1, 3), 2) test.equal(buf[1], 97) test.equal(buf[2], 98) test.equal(buf[3], 0) test.done() end exports['Buffer.copy'] = function(test) local buf1 = Buffer.new(4) local buf2 = Buffer.new(3) buf1[1] = 97 buf1[2] = 98 buf1[3] = 99 buf1[4] = 100 test.equal(buf1:copy(buf2, 2, 3, 4), 2) test.equal(buf2[2], 99) test.equal(buf2[3], 100) test.equal(buf1:copy(buf1, 2, 3, 4), 2) test.equal(buf1[1], 97) test.equal(buf1[2], 99) test.equal(buf1[3], 100) test.equal(buf1[4], 100) buf1[1] = 97 buf1[2] = 98 buf1[3] = 99 buf1[4] = 100 test.equal(buf1:copy(buf2, 2, 2, 4), 2) test.equal(buf2[2], 98) test.equal(buf2[3], 99) test.done() end exports['Buffer.isBuffer'] = function(test) local buf = Buffer.new(2) test.ok(Buffer.isBuffer(buf)) test.ok(not Buffer.isBuffer('string')) test.done() end exports['Buffer.length'] = function(test) local buf = Buffer.new(3) test.equal(buf:length(), 3) test.equal(#buf, 3) test.done() end exports['Buffer.writeUInt8'] = function(test) local buf = Buffer.new(3) test.equal(type(buf), 'userdata') buf:writeUInt8(1, 97) buf:writeUInt8(2, 98) buf:writeUInt8(3, 99) test.equal(buf[1], 97) test.equal(buf[2], 98) test.equal(buf[3], 99) buf:writeUInt8(1, 0) test.equal(buf[1], 0) buf:writeUInt8(1, 255) test.equal(buf[1], 255) test.done() end exports['Buffer.writeInt8'] = function(test) local buf = Buffer.new(3) test.equal(type(buf), 'userdata') buf:writeInt8(1, 97) test.equal(buf[1], 97) buf:writeInt8(1, 0) test.equal(buf[1], 0) buf:writeInt8(1, 127) test.equal(buf[1], 0x7F) buf:writeInt8(1, -128) test.equal(buf[1], 0x80) buf:writeInt8(1, -1) test.equal(buf[1], 0xFF) test.done() end exports['Buffer.__newindex'] = function(test) local buf = Buffer.new(4) buf[1] = 97 buf[2] = 98 buf[3] = 99 test.equal(buf:readUInt8(1), 97) test.equal(buf:readUInt8(2), 98) test.equal(buf:readUInt8(3), 99) buf[1] = 0 test.equal(buf[1], 0) buf[1] = 255 test.equal(buf[1], 255) test.done() end exports['Buffer.__index'] = function(test) local buf = Buffer.new(4) buf[1] = 97 buf[2] = 98 buf[3] = 99 test.equal(buf[1], 97) test.equal(buf[2], 98) test.equal(buf[3], 99) test.done() end exports['Buffer.slice'] = function(test) local buf = Buffer.new(4) buf[1] = 97 buf[2] = 98 buf[3] = 99 local slice = buf:slice(2, 3) test.equal(slice[1], 98) test.equal(slice[2], 99) slice[1] = 100 test.equal(slice[1], 100) test.equal(buf[2], 100) test.done() end exports['Buffer.toString'] = function(test) local buf = Buffer.new(3) buf[1] = 97 buf[2] = 98 buf[3] = 99 test.equal(buf:toString(1, 1), 'a') test.equal(buf:toString(1, 2), 'ab') test.equal(buf:toString(2, 2), 'b') test.equal(buf:toString(2), 'bc') test.equal(buf:toString(3), 'c') test.equal(buf:toString(3, 3), 'c') local ok, err = pcall(function() buf:toString(0) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'toString' (index out of range)", 1, true)) local ok, err = pcall(buf.toString, buf, 0) test.ok(not ok) test.ok(string.find(err, "bad argument #2 to '?' (index out of range)", 1, true)) local ok, err = pcall(function() buf:toString(1, 4) end) test.ok(not ok) test.ok(string.find(err, "bad argument #2 to 'toString' (index out of range)", 1, true)) local ok, err = pcall(function() buf:toString(2, 1) end) test.ok(not ok) test.ok(string.find(err, "bad argument #2 to 'toString' (index out of range)", 1, true)) test.done() end exports['Buffer.readUInt8'] = function(test) local buf = Buffer.new(4) buf[1] = 97 buf[2] = 98 buf[3] = 99 test.equal(buf:readUInt8(1), 97) test.equal(buf:readUInt8(2), 98) test.equal(buf:readUInt8(3), 99) buf[1] = 0 test.equal(buf:readUInt8(1), 0) buf[1] = 255 test.equal(buf:readUInt8(1), 255) test.done() end exports['Buffer.writeUInt8'] = function(test) local buf = Buffer.new(4) buf:writeUInt8(1, 97) buf:writeUInt8(2, 98) buf:writeUInt8(3, 99) test.equal(buf[1], 97) test.equal(buf[2], 98) test.equal(buf[3], 99) buf:writeUInt8(1, 0) test.equal(buf[1], 0) buf:writeUInt8(1, 255) test.equal(buf[1], 255) test.done() end exports['Buffer.readInt8'] = function(test) local buf = Buffer.new(4) buf[1] = 97 buf[2] = 98 buf[3] = 127 test.equal(buf:readInt8(1), 97) test.equal(buf:readInt8(2), 98) test.equal(buf:readInt8(3), 127) buf[1] = 0 test.equal(buf:readInt8(1), 0) buf[1] = 255 test.equal(buf:readInt8(1), -1) buf[1] = 254 test.equal(buf:readInt8(1), -2) buf[1] = 128 test.equal(buf:readInt8(1), -128) test.done() end exports['Buffer.readUInt16LE'] = function(test) local buf = Buffer.new(3) buf[1] = 0x12 buf[2] = 0x34 buf[3] = 0x56 test.equal(buf:readUInt16LE(1), 0x3412) test.equal(buf:readUInt16LE(2), 0x5634) buf[1] = 0xFF buf[2] = 0xFF test.equal(buf:readUInt16LE(1), 0xFFFF) local ok, err = pcall(function() buf:readUInt16LE(3) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readUInt16LE' (index out of range)", 1, true)) test.done() end exports['Buffer.readInt16LE'] = function(test) local buf = Buffer.new(3) buf[1] = 0x12 buf[2] = 0x34 buf[3] = 0x56 test.equal(buf:readInt16LE(1), 0x3412) test.equal(buf:readInt16LE(2), 0x5634) buf[1] = 0xFF buf[2] = 0x7F test.equal(buf:readInt16LE(1), 32767) buf[1] = 0x00 buf[2] = 0x80 test.equal(buf:readInt16LE(1), -32768) buf[1] = 0xFF buf[2] = 0xFF test.equal(buf:readInt16LE(1), -1) buf[1] = 0xFE buf[2] = 0xFF test.equal(buf:readInt16LE(1), -2) local ok, err = pcall(function() buf:readInt16LE(3) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readInt16LE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeInt16LE'] = function(test) local buf = Buffer.new(2) buf:writeInt16LE(1, 0x3412) test.equal(buf[1], 0x12) test.equal(buf[2], 0x34) buf:writeInt16LE(1, -32768) test.equal(buf[1], 0x00) test.equal(buf[2], 0x80) buf:writeInt16LE(1, -1) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) buf:writeInt16LE(1, -2) test.equal(buf[1], 0xFE) test.equal(buf[2], 0xFF) local ok, err = pcall(function() buf:writeInt16LE(2, 0x3412) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeInt16LE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeUInt16LE'] = function(test) local buf = Buffer.new(4) buf:writeUInt16LE(1, 0x1234) test.equal(buf[1], 0x34) test.equal(buf[2], 0x12) buf:writeUInt16LE(1, 0xFFFF) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) local ok, err = pcall(function() buf:writeUInt16LE(4, 0x1234) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeUInt16LE' (index out of range)", 1, true)) test.done() end exports['Buffer.readUInt16BE'] = function(test) local buf = Buffer.new(3) buf[1] = 0x12 buf[2] = 0x34 buf[3] = 0x56 test.equal(buf:readUInt16BE(1), 0x1234) test.equal(buf:readUInt16BE(2), 0x3456) buf[1] = 0xFF buf[2] = 0xFF test.equal(buf:readUInt16LE(1), 0xFFFF) local ok, err = pcall(function() buf:readUInt16BE(3) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readUInt16BE' (index out of range)", 1, true)) test.done() end exports['Buffer.readInt16BE'] = function(test) local buf = Buffer.new(3) buf[1] = 0x12 buf[2] = 0x34 buf[3] = 0x56 test.equal(buf:readInt16BE(1), 0x1234) test.equal(buf:readInt16BE(2), 0x3456) buf[1] = 0x7F buf[2] = 0xFF test.equal(buf:readInt16BE(1), 32767) buf[1] = 0x80 buf[2] = 0x00 test.equal(buf:readInt16BE(1), -32768) buf[1] = 0xFF buf[2] = 0xFF test.equal(buf:readInt16BE(1), -1) buf[1] = 0xFF buf[2] = 0xFE test.equal(buf:readInt16BE(1), -2) local ok, err = pcall(function() buf:readInt16BE(3) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readInt16BE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeInt16BE'] = function(test) local buf = Buffer.new(2) buf:writeInt16BE(1, 0x3412) test.equal(buf[1], 0x34) test.equal(buf[2], 0x12) buf:writeInt16BE(1, -32768) test.equal(buf[1], 0x80) test.equal(buf[2], 0x00) buf:writeInt16BE(1, -1) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) buf:writeInt16BE(1, -2) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFE) local ok, err = pcall(function() buf:writeInt16BE(2, 0x3412) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeInt16BE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeUInt16BE'] = function(test) local buf = Buffer.new(4) buf:writeUInt16BE(1, 0x1234) test.equal(buf[1], 0x12) test.equal(buf[2], 0x34) buf:writeUInt16BE(1, 0xFFFF) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) local ok, err = pcall(function() buf:writeUInt16BE(4, 0x1234) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeUInt16BE' (index out of range)", 1, true)) test.done() end exports['Buffer.readUInt32LE'] = function(test) local buf = Buffer.new(4) buf[1] = 0x12 buf[2] = 0x34 buf[3] = 0x56 buf[4] = 0x78 test.equal(buf:readUInt32LE(1), 0x78563412) buf[1] = 0xFF buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0xFF test.equal(buf:readUInt32LE(1), 0xFFFFFFFF) local ok, err = pcall(function() buf:readUInt32LE(2) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readUInt32LE' (index out of range)", 1, true)) test.done() end exports['Buffer.readInt32LE'] = function(test) local buf = Buffer.new(4) buf[1] = 0x12 buf[2] = 0x34 buf[3] = 0x56 buf[4] = 0x78 test.equal(buf:readInt32LE(1), 0x78563412) buf[1] = 0xFF buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0xFF test.equal(buf:readInt32LE(1), -1) buf[1] = 0xFE buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0xFF test.equal(buf:readInt32LE(1), -2) buf[1] = 0xFF buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0x7F test.equal(buf:readInt32LE(1), 2147483647) buf[1] = 0x00 buf[2] = 0x00 buf[3] = 0x00 buf[4] = 0x80 test.equal(buf:readInt32LE(1), -2147483648) local ok, err = pcall(function() buf:readInt32LE(2) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readInt32LE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeInt32LE'] = function(test) local buf = Buffer.new(4) buf:writeInt32LE(1, 0x78563412) test.equal(buf[1], 0x12) test.equal(buf[2], 0x34) test.equal(buf[3], 0x56) test.equal(buf[4], 0x78) buf:writeInt32LE(1, -1) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) buf:writeInt32LE(1, -2) test.equal(buf[1], 0xFE) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) buf:writeInt32LE(1, 2147483647) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0x7F) buf:writeInt32LE(1, -2147483648) test.equal(buf[1], 0x00) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x80) local ok, err = pcall(function() buf:writeInt32LE(2, 0) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeInt32LE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeUInt32LE'] = function(test) local buf = Buffer.new(4) buf:writeUInt32LE(1, 0x12345678) test.equal(buf[1], 0x78) test.equal(buf[2], 0x56) test.equal(buf[3], 0x34) test.equal(buf[4], 0x12) buf:writeUInt32LE(1, 0xFFFFFFFF) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) local ok, err = pcall(function() buf:writeUInt32LE(2, 0x12345678) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeUInt32LE' (index out of range)", 1, true)) test.done() end exports['Buffer.readUInt32BE'] = function(test) local buf = Buffer.new(4) buf[1] = 0x12 buf[2] = 0x34 buf[3] = 0x56 buf[4] = 0x78 test.equal(buf:readUInt32BE(1), 0x12345678) buf[1] = 0xFF buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0xFF test.equal(buf:readUInt32BE(1), 0xFFFFFFFF) local ok, err = pcall(function() buf:readUInt32BE(2) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readUInt32BE' (index out of range)", 1, true)) test.done() end exports['Buffer.readInt32BE'] = function(test) local buf = Buffer.new(4) buf[1] = 0x78 buf[2] = 0x56 buf[3] = 0x34 buf[4] = 0x12 test.equal(buf:readInt32BE(1), 0x78563412) buf[1] = 0xFF buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0xFF test.equal(buf:readInt32BE(1), -1) buf[1] = 0xFF buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0xFE test.equal(buf:readInt32BE(1), -2) buf[1] = 0x7F buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0xFF test.equal(buf:readInt32BE(1), 2147483647) buf[1] = 0x80 buf[2] = 0x00 buf[3] = 0x00 buf[4] = 0x00 test.equal(buf:readInt32BE(1), -2147483648) local ok, err = pcall(function() buf:readInt32BE(2) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readInt32BE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeInt32BE'] = function(test) local buf = Buffer.new(4) buf:writeInt32BE(1, 0x78563412) test.equal(buf[1], 0x78) test.equal(buf[2], 0x56) test.equal(buf[3], 0x34) test.equal(buf[4], 0x12) buf:writeInt32BE(1, -1) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) buf:writeInt32BE(1, -2) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFE) buf:writeInt32BE(1, 2147483647) test.equal(buf[1], 0x7F) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) buf:writeInt32BE(1, -2147483648) test.equal(buf[1], 0x80) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) local ok, err = pcall(function() buf:writeInt32BE(2, 0) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeInt32BE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeUInt32BE'] = function(test) local buf = Buffer.new(4) buf:writeUInt32BE(1, 0x12345678) test.equal(buf[1], 0x12) test.equal(buf[2], 0x34) test.equal(buf[3], 0x56) test.equal(buf[4], 0x78) buf:writeUInt32BE(1, 0xFFFFFFFF) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) local ok, err = pcall(function() buf:writeUInt32BE(2, 0x12345678) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeUInt32BE' (index out of range)", 1, true)) test.done() end exports['Buffer.readFloatBE'] = function(test) local buf = Buffer.new(4) buf[1] = 0x3F buf[2] = 0x80 buf[3] = 0x00 buf[4] = 0x00 test.equal(buf:readFloatBE(1), 1) buf[1] = 0xC0 buf[2] = 0x00 test.equal(buf:readFloatBE(1), -2) buf[1] = 0x3E buf[2] = 0x20 buf[3] = 0x00 buf[4] = 0x00 test.equal(buf:readFloatBE(1), 0.15625) buf[1] = 0x7F buf[2] = 0x7F buf[3] = 0xFF buf[4] = 0xFF local max = 3.4028234663853e+38 local eps = 1e-14 test.ok(math.abs(buf:readFloatBE(1) - max) / max < eps) local ok, err = pcall(function() buf:readFloatBE(2) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readFloatBE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeFloatBE'] = function(test) local buf = Buffer.new(4) buf:writeFloatBE(1, 1) test.equal(buf[1], 0x3F) test.equal(buf[2], 0x80) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) buf:writeFloatBE(1, -2) test.equal(buf[1], 0xC0) test.equal(buf[2], 0x00) buf:writeFloatBE(1, 0.15625) test.equal(buf[1], 0x3E) test.equal(buf[2], 0x20) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) local max = 3.4028234663853e+38 buf:writeFloatBE(1, max) test.equal(buf[1], 0x7F) test.equal(buf[2], 0x7F) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) local ok, err = pcall(function() buf:writeFloatBE(2, 1) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeFloatBE' (index out of range)", 1, true)) test.done() end exports['Buffer.readFloatLE'] = function(test) local buf = Buffer.new(4) buf[1] = 0x00 buf[2] = 0x00 buf[3] = 0x80 buf[4] = 0x3F test.equal(buf:readFloatLE(1), 1) buf[3] = 0x00 buf[4] = 0xC0 test.equal(buf:readFloatLE(1), -2) buf[1] = 0x00 buf[3] = 0x00 buf[3] = 0x20 buf[4] = 0x3E test.equal(buf:readFloatLE(1), 0.15625) buf[1] = 0xFF buf[2] = 0xFF buf[3] = 0x7F buf[4] = 0x7F local max = 3.4028234663853e+38 local eps = 1e-14 test.ok(math.abs(buf:readFloatLE(1) - max) / max < eps) local ok, err = pcall(function() buf:readFloatLE(2) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readFloatLE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeFloatLE'] = function(test) local buf = Buffer.new(4) buf:writeFloatLE(1, 1) test.equal(buf[1], 0x00) test.equal(buf[2], 0x00) test.equal(buf[3], 0x80) test.equal(buf[4], 0x3F) buf:writeFloatLE(1, -2) test.equal(buf[3], 0x00) test.equal(buf[4], 0xC0) buf:writeFloatLE(1, 0.15625) test.equal(buf[1], 0x00) test.equal(buf[2], 0x00) test.equal(buf[3], 0x20) test.equal(buf[4], 0x3E) local max = 3.4028234663853e+38 buf:writeFloatLE(1, max) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) test.equal(buf[3], 0x7F) test.equal(buf[4], 0x7F) local ok, err = pcall(function() buf:writeFloatLE(2, 1) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeFloatLE' (index out of range)", 1, true)) test.done() end exports['Buffer.readDoubleBE'] = function(test) local buf = Buffer.new(8) buf[1] = 0x3F buf[2] = 0xF0 buf[3] = 0x00 buf[4] = 0x00 buf[5] = 0x00 buf[6] = 0x00 buf[7] = 0x00 buf[8] = 0x00 test.equal(buf:readDoubleBE(1), 1) buf[8] = 0x01 test.equal(buf:readDoubleBE(1), 1.0000000000000002) buf[8] = 0x02 test.equal(buf:readDoubleBE(1), 1.0000000000000004) buf[1] = 0x40 buf[2] = 0x00 buf[3] = 0x00 buf[4] = 0x00 buf[5] = 0x00 buf[6] = 0x00 buf[7] = 0x00 buf[8] = 0x00 test.equal(buf:readDoubleBE(1), 2) buf[1] = 0xC0 test.equal(buf:readDoubleBE(1), -2) buf[1] = 0x7F buf[2] = 0xEF buf[3] = 0xFF buf[4] = 0xFF buf[5] = 0xFF buf[6] = 0xFF buf[7] = 0xFF buf[8] = 0xFF test.equal(buf:readDoubleBE(1), 1.7976931348623157e+308) local ok, err = pcall(function() buf:readDoubleBE(2) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readDoubleBE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeDoubleBE'] = function(test) local buf = Buffer.new(8) buf:writeDoubleBE(1, 1) test.equal(buf[1], 0x3F) test.equal(buf[2], 0xF0) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0x00) test.equal(buf[8], 0x00) buf:writeDoubleBE(1, 1.0000000000000002) test.equal(buf[1], 0x3F) test.equal(buf[2], 0xF0) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0x00) test.equal(buf[8], 0x01) buf:writeDoubleBE(1, 1.0000000000000004) test.equal(buf[1], 0x3F) test.equal(buf[2], 0xF0) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0x00) test.equal(buf[8], 0x02) buf:writeDoubleBE(1, 2) test.equal(buf[1], 0x40) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0x00) test.equal(buf[8], 0x00) buf:writeDoubleBE(1, -2) test.equal(buf[1], 0xC0) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0x00) test.equal(buf[8], 0x00) buf:writeDoubleBE(1, 1.7976931348623157e+308) test.equal(buf[1], 0x7F) test.equal(buf[2], 0xEF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) test.equal(buf[5], 0xFF) test.equal(buf[6], 0xFF) test.equal(buf[7], 0xFF) test.equal(buf[8], 0xFF) local ok, err = pcall(function() buf:writeDoubleBE(2, 1) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeDoubleBE' (index out of range)", 1, true)) test.done() end exports['Buffer.readDoubleLE'] = function(test) local buf = Buffer.new(8) buf[1] = 0x00 buf[2] = 0x00 buf[3] = 0x00 buf[4] = 0x00 buf[5] = 0x00 buf[6] = 0x00 buf[7] = 0xF0 buf[8] = 0x3F test.equal(buf:readDoubleLE(1), 1) buf[1] = 0x01 test.equal(buf:readDoubleLE(1), 1.0000000000000002) buf[1] = 0x02 test.equal(buf:readDoubleLE(1), 1.0000000000000004) buf[1] = 0x00 buf[2] = 0x00 buf[3] = 0x00 buf[4] = 0x00 buf[5] = 0x00 buf[6] = 0x00 buf[7] = 0x00 buf[8] = 0x40 test.equal(buf:readDoubleLE(1), 2) buf[8] = 0xC0 test.equal(buf:readDoubleLE(1), -2) buf[1] = 0xFF buf[2] = 0xFF buf[3] = 0xFF buf[4] = 0xFF buf[5] = 0xFF buf[6] = 0xFF buf[7] = 0xEF buf[8] = 0x7F test.equal(buf:readDoubleLE(1), 1.7976931348623157e+308) local ok, err = pcall(function() buf:readDoubleLE(2) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'readDoubleLE' (index out of range)", 1, true)) test.done() end exports['Buffer.writeDoubleLE'] = function(test) local buf = Buffer.new(8) buf:writeDoubleLE(1, 1) test.equal(buf[1], 0x00) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0xF0) test.equal(buf[8], 0x3F) buf:writeDoubleLE(1, 1.0000000000000002) test.equal(buf[1], 0x01) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0xF0) test.equal(buf[8], 0x3F) buf:writeDoubleLE(1, 1.0000000000000004) test.equal(buf[1], 0x02) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0xF0) test.equal(buf[8], 0x3F) buf:writeDoubleLE(1, 2) test.equal(buf[1], 0x00) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0x00) test.equal(buf[8], 0x40) buf:writeDoubleLE(1, -2) test.equal(buf[1], 0x00) test.equal(buf[2], 0x00) test.equal(buf[3], 0x00) test.equal(buf[4], 0x00) test.equal(buf[5], 0x00) test.equal(buf[6], 0x00) test.equal(buf[7], 0x00) test.equal(buf[8], 0xC0) buf:writeDoubleLE(1, 1.7976931348623157e+308) test.equal(buf[1], 0xFF) test.equal(buf[2], 0xFF) test.equal(buf[3], 0xFF) test.equal(buf[4], 0xFF) test.equal(buf[5], 0xFF) test.equal(buf[6], 0xFF) test.equal(buf[7], 0xEF) test.equal(buf[8], 0x7F) local ok, err = pcall(function() buf:writeDoubleLE(2, 1) end) test.ok(not ok) test.ok(string.find(err, "bad argument #1 to 'writeDoubleLE' (index out of range)", 1, true)) test.done() end return exports
local skynet = require "skynet" local log = require "log" local text = require("text").modbus local api = require "api" local validate = require "utils.validate" local client = require "modbus.client" local mpdu = require "modbus.pdu" local mdata = require "modbus.data" local tblins = table.insert local strfmt = string.format local MODBUS_SLAVE_MIN = 1 local MODBUS_SLAVE_MAX = 247 local MODBUS_ADDR_MIN = 0x0000 local MODBUS_ADDR_MAX = 0x270E local MODBUS_MAX_READ_BITS = 2000 local MODBUS_MAX_READ_REGISTERS = 125 local cli local cli_pack local registered = false local running = false local max_wait = 100 * 60 -- 1 min local poll_min = 10 -- ms local poll_max = 1000 * 60 * 60 -- 1 hour local devlist = {} local cmd_desc = { read = "<tag>", write = "{<tag>,<val>}", list = "list tags" } local function reg_cmd() for k, v in pairs(cmd_desc) do api.reg_cmd(k, v) end end function list(dev) if cli then local d = devlist[dev] if d then if not d.help then local h = { unitid = d.unitid, write = {}, read = {} } for name, t in pairs(d.tags) do if t.read then h.read[name] = { fc = t.fc, dtype = t.dt, addr = t.addr, number = t.number } end if t.write then h.write[name] = { fc = t.wfc, dtype = t.dt, addr = t.addr, number = t.number } end end d.help = h end return d.help else return false, text.invalid_dev end else return false, text.not_online end end function read(dev, tag) if cli then return pcall(function() assert(devlist[dev], text.invalid_dev) assert(devlist[dev].tags[tag], text.invalid_tag) local u = devlist[dev].unitid local t = devlist[dev].tags[tag] -- all tag can be read, no check here local ok, ret = cli:request(u, t.read) assert(ok, strfmt("%s:%s", text.req_fail, ret)) local uid = ret[1] assert(uid==u, strfmt("%s:%s:%s", text.invalid_unit, u, uid)) local fc = ret[2] assert(fc==t.fc, strfmt("%s:%s:%s", text.invalid_fc, t.fc, fc)) local data = ret[3] assert(type(data)=="table", strfmt("%s:%s", text.exception, data)) if t.fc == 3 or t.fc == 4 then local n = #data assert(n==t.number, strfmt("%s:%s:%s", text.invalid_num, t.number, n)) end return t.unpack(1, data) end) else return false, text.not_online end end function write(dev, arg) if cli then return pcall(function() assert(devlist[dev], text.invalid_dev) assert(type(arg) == "table" and type(arg[1]) == "string" and (type(arg[2]) == "number" or type(arg[2]) == "boolean" or type(arg[2]) == "string"), text.invalid_arg) assert(devlist[dev].tags[arg[1]], text.invalid_tag) local u = devlist[dev].unitid local t = devlist[dev].tags[arg[1]] assert(t.write, text.read_only) local val = arg[2] local ok = pcall(t.write, val) assert(ok, text.pack_fail) local ok, ret = cli:request(u, p) assert(ok, strfmt("%s:%s", text.req_fail, ret)) local uid = ret[1] assert(uid==u, strfmt("%s:%s:%s", text.invalid_unit, u, uid)) local fc = ret[2] assert(fc==t.wfc, strfmt("%s:%s:%s", text.invalid_fc, t.wfc, fc)) local addr = ret[3] local data = ret[4] assert(data ~= nil, strfmt("%s:%s", text.exception, addr)) assert(addr==t.addr, strfmt("%s:%s:%s", text.invalid_addr, t.addr, addr)) if fc == 5 or fc == 6 then local v = t.unpack(1, {data}) assert(val==v, strfmt("%s:%s:%s", text.invalid_write, val, v)) else assert(data==t.number, strfmt("%s:%s:%s", text.invalid_num, t.number, data)) end end) else return false, text.not_online end end local function post(dname, index, interval) local ts = {} local attr = {} for _, t in pairs(index) do if t.cov then if t.gain then t.val = t.val * t.gain + t.offset end api.post_cov(dname, { [t.name] = t.val }) log.debug(strfmt("%s:%s:%s cov posted", dname, t.name, tostring(t.val))) else if t.poll_cum + interval >= t.poll then t.poll_cum = 0 if t.gain then t.val = t.val * t.gain + t.offset end if t.mode == "ts" then tblins(ts, { [t.name] = t.val }) log.debug(strfmt("%s:%s:%s ts posted", dname, t.name, tostring(t.val))) else tblins(attr, { [t.name] = t.val }) log.debug(strfmt("%s:%s:%s attr posted", dname, t.name, tostring(t.val))) end else t.poll_cum = t.poll_cum + interval end end end if next(ts) then api.post_data(dname, ts) end if next(attr) then api.post_attr(dname, attr) end end local function make_poll(dname, unitid, fc, start, number, interval, index) local p = cli_pack(fc, start, number) local log_prefix = string.format("%s(%d): %d, %d(%d)", dname, unitid, fc, start, number) local timeout = interval // 10 local function poll() local ok, ret = cli:request(unitid, p) assert(ok, strfmt("%s %s:%s", log_prefix, text.req_fail, ret)) local uid = ret[1] assert(uid==unitid, strfmt("%s %s:%s:%s", log_prefix, text.invalid_unit, unitid, uid)) local c = ret[2] assert(c==fc, strfmt("%s %s:%s:%s", log_prefix, text.invalid_fc, fc, c)) local data = ret[3] assert(type(data)=="table", strfmt("%s %s:%s", log_prefix, text.exception, data)) if fc == 3 or fc == 4 then local n = #data assert(n==number, strfmt("%s %s:%s:%s", log_prefix, text.invalid_num, number, n)) end for i, t in pairs(index) do local v = t.unpack(i, data) t.val = v end post(dname, index, interval) if running then skynet.timeout(timeout, function() local ok, err = pcall(poll) if not ok then log.error(err) end end) end end return poll end local maxnumber = { [1] = MODBUS_MAX_READ_BITS, [2] = MODBUS_MAX_READ_BITS, [3] = MODBUS_MAX_READ_REGISTERS, [4] = MODBUS_MAX_READ_REGISTERS } local function make_polls(dname, unitid, addrlist, polls) for fc, addrinfo in pairs(addrlist) do local maxnumber = maxnumber[fc] local list = addrinfo.list local start = false local index local number local interval local function make() local poll = make_poll(dname, unitid, fc, start, number, interval, index) tblins(polls, poll) end local function init(addr, t) start = addr number = t.number interval = t.poll index = { [1] = t } end for a = addrinfo.min, addrinfo.max do local t = list[a] if type(t) == "table" then if not start then init(a, t) else if number + t.number <= maxnumber then index[number+1] = t number = number + t.number if t.poll < interval then interval = t.poll end else make() init(a, t) end end elseif t == nil then if start then make() start = false end end end make() end end local function validate_poll_addr(t, addrlist) if not addrlist[t.fc] then addrlist[t.fc] = { list = {} } end local addr = addrlist[t.fc] local list = addr.list local min = MODBUS_ADDR_MAX local max = MODBUS_ADDR_MIN for a = t.addr, t.addr+t.number-1 do assert(not list[a], text.invalid_addr_conf) if a == t.addr then list[a] = t if a <= min then addr.min = a end if a >= max then addr.max = a end else list[a] = true end end end local function validate_write_addr(t, addrlist) if not addrlist[t.fc] then addrlist[t.fc] = {} end local list = addrlist[t.fc] for a = t.addr, t.addr+t.number-1 do assert(not list[a], text.invalid_addr_conf) if a == t.addr then list[a] = t else list[a] = true end end end local function validate_addr(polllist, writelist) for fc, list in pairs(writelist) do if polllist[fc] then local poll = polllist[fc].list for a, t in pairs(list) do if type(poll[a]) == "table" then local pt = poll[a] assert(pt.number == t.number and pt.dt == t.dt and pt.le == t.le and pt.bit == t.bit, text.invalid_addr_conf) end end end end end local fc_map = { [5] = 1, [15] = 1, [6] = 3, [16] = 3 } local tag_schema = { fc = function(v) return v==1 or v==2 or v==3 or v==4 or v==5 or v==15 or v==6 or v==16 end, bit = function(v) return v==nil or (math.tointeger(v) and v>=1 and v<=16) end, addr = function(v) return math.tointeger(v) and v>=MODBUS_ADDR_MIN and v<=MODBUS_ADDR_MAX end, number = function(v) return math.tointeger(v) and v>0 end, dt = function(v) return v=="int" or v=="uint" or v=="string" or v=="float" or v=="boolean" end, mode = function(v) return v=="ts" or v=="attr" or v=="ctrl" end, cov = function(v) return v==nil or type(v)=="boolean" end, le = function(v) return v==nil or type(v)=="boolean" end, poll = function(v) return v==nil or (math.tointeger(v) and v>=poll_min and v<=poll_max) end, gain = function(v) return v==nil or type(v)=="number" end, offset = function(v) return v==nil or type(v)=="number" end } local function fill_tag(t, name, dev) t.name = name if t.le == nil then t.le = dev.le end if t.mode == "ts" then t.poll_cum = 0 t.poll = t.poll or dev.ts_poll elseif t.mode == "attr" then t.poll_cum = 0 t.poll = t.poll or dev.attr_poll end end local function validate_tags(dev, tle) local polllist = {} local writelist = {} local max_poll = 0 for name, t in pairs(dev.tags) do assert(type(name)=="string", text.invalid_tag_conf) local ok = pcall(validate, t, tag_schema) assert(ok, text.invalid_tag_conf) fill_tag(t, name, dev) t.read = cli_pack(t.fc, t.addr, t.number) t.unpack = mdata.unpack(t.fc, t.dt, t.number, tle, t.le, t.bit) if t.mode == "ctrl" then t.wfc = t.fc t.fc = assert(fc_map[t.fc], text.invalid_fc_conf) validate_write_addr(t, writelist) local pack = mdata.pack(t.wfc, t.dt, t.number, tle, t.le, t.bit) t.write = function(val) local v = pack(val) return cli_pack(t.wfc, t.addr, v) end else validate_poll_addr(t, polllist) if t.poll > max_poll then max_poll = t.poll end end end validate_addr(polllist, writelist) return polllist, max_poll end local d_schema = { unitid = function(v) return math.tointeger(v) and v>=MODBUS_SLAVE_MIN and v<=MODBUS_SLAVE_MAX end, store = function(v) if type(v)=="table" then elseif v==nil then return true else return false end end, attr_poll = function(v) return math.tointeger(v) and v>=poll_min and v<=poll_max end, ts_poll = function(v) return math.tointeger(v) and v>=poll_min and v<=poll_max end, le = function(v) return type(v)=="boolean" end, batch = function(v) return v==nil or (math.tointeger(v) and v<=api.batch_max) end } local function validate_devices(d, tle) local polls = {} local max = 0 for name, dev in pairs(d) do assert(type(name)=="string", text.invalid_device_conf) local ok = pcall(validate, dev, d_schema) assert(ok, text.invalid_device_conf) local addrlist, max_poll = validate_tags(dev, tle) if max_poll > max then max = max_poll end make_polls(name, dev.unitid, addrlist, polls) end return polls, max end local function unregdev() for name, _ in pairs(devlist) do api.unreg_dev(name) end devlist = {} end local function regdev(d) devlist = {} for name, dev in pairs(d) do local conf = { desc = string.format("unitid(%d)", dev.unitid), conf = dev.store } api.reg_dev(name, conf) if dev.batch then api.batch_size(name, dev.batch) end devlist[name] = dev end end local function stop() if cli then cli.channel:close() end if running then log.error(text.poll_stop) running = false unregdev() skynet.sleep(max_wait) end end local function start(d, polls) running = true -- wait for mqtt up skynet.sleep(500) regdev(d) math.randomseed(skynet.time()) for _, p in pairs(polls) do local ok, err = pcall(p) if not ok then log.error(err) end skynet.sleep(math.random(100, 200)) end end local function config_devices(d, tle) local ok, polls, max = pcall(validate_devices, d, tle) if ok then max_wait = max // 10 skynet.fork(start, d, polls) log.error(strfmt("%s: total(%d), max interval(%ds)", text.poll_start, #polls, max // 1000)) return ok else return ok, polls end end local t_schema = { mode = function(v) return v=="rtu" or v=="rtu_tcp" or v=="tcp" end, ascii = function(v) return v==nil or type(v)=="boolean" end, le = function(v) return type(v)=="boolean" end, timeout = function(v) return math.tointeger(v) and v>poll_min end, tcp = { host = function(v) return type(v)=="string" and v:match("^[%w%.%-]+$") end, port = function(v) return math.tointeger(v) and v>0 and v<0xFFFF end }, rtu = { port = function(v) return type(v)=="string" end, baudrate = function(v) return math.tointeger(v) and v>0 end, mode = function(v) return v=="rs232" or v=="rs485" end, databits = function(v) return math.tointeger(v) and v>0 end, parity = function(v) return v=="none" or v=="odd" or v=="even" end, stopbits = function(v) return math.tointeger(v) and v>=0 end, rtscts = function(v) return type(v)=="boolean" end, r_timeout = function(v) return math.tointeger(v) and v>0 end, b_timeout = function(v) return math.tointeger(v) and v>0 end } } local function config_transport(t) local ok = pcall(validate, t, t_schema) if not ok then return false else stop() local mode = t.mode local arg if mode == 'rtu' then arg = t.rtu arg.ascii = t.ascii arg.le = t.le arg.timeout = t.timeout cli = client.new_rtu(arg) cli_pack = mpdu.pack(t.le) elseif mode == 'rtu_tcp' then arg = t.tcp arg.ascii = t.ascii arg.le = t.le arg.timeout = t.timeout cli = client.new_rtu_tcp(arg) cli_pack = mpdu.pack(t.le) elseif mode == 'tcp' then arg = t.tcp arg.le = t.le arg.timeout = t.timeout cli = client.new_tcp(arg) cli_pack = mpdu.pack(t.le) end return true end end function on_conf(conf) if config_transport(conf.transport) then local ok, err = config_devices(conf.devices, conf.transport.le) if ok then if not registered then reg_cmd() registered = true end return ok else return ok, err end else return false, text.invalid_transport_conf end end function on_exit() stop() end
--[=[ @class SpawnServiceClient ]=] local require = require(script.Parent.loader).load(script) local SpawnServiceClient = {} function SpawnServiceClient:Init(serviceBag) assert(not self._serviceBag, "Already initialized") self._serviceBag = assert(serviceBag, "No serviceBag") self._serviceBag:GetService(require("CmdrServiceClient")) end return SpawnServiceClient
local ReplicatedStorage = game:GetService("ReplicatedStorage") local List = require(ReplicatedStorage.Utilities.List) local Books = {} local books = ReplicatedStorage:WaitForChild("GetBooks"):InvokeServer() local bookToAuthorNames = {} --[book][authorName:lower()] = true local bookToAuthorLine = {} --[book] = authorLine:lower() local bookToAuthorIds = {} --[book][authorId] = true local bookToTitle = {} --[book] = title:lower() local function lowerEachValue(t, anonymousValue) -- if anonymousValue provided, ensure it is all lowercase anonymousValue = anonymousValue or "" local new = {} for i, v in ipairs(t) do new[i] = type(v) == "string" and (v == "" and anonymousValue or v:lower()) or v end return new end local modelToBook = {} local idToBook = {} for _, book in ipairs(books) do bookToAuthorNames[book] = List.ToSet(lowerEachValue(book.Authors), "anonymous") bookToAuthorIds[book] = List.ToSet(lowerEachValue(book.AuthorIds)) bookToAuthorLine[book] = book.AuthorLine:lower() local lowerTitle = book.Title:lower() bookToTitle[book] = lowerTitle local id = book.Id if id then idToBook[id] = book end for _, model in ipairs(book.Models) do modelToBook[model] = book end end function Books:GetBooks() --[[Returns a list of books: { Id = number (The book's unique ID), Title = string (The book's name), AuthorLine = string (An author line. Example: "author1, author2, and author3"), Authors = List of authors, AuthorIds = List of author ids, PublishDate = string (The date on which the book was published), Librarian = string (The librarian's username), Genres = List of string Models = list of BookModel (The models of the book), } ]] return books end function Books:FromObj(obj) return modelToBook[obj] end function Books:FromId(id) return idToBook[id] end function Books:BookTitleContains(book, value) -- value must be :lower()'d return bookToTitle[book]:find(value, 1, true) end local function escape(s) return s:gsub("([%%%[%]()%.%+%-%*%?%^%$])", "%%%1") end function Books:AuthorNamesContainFullWord(book, value) -- value must be :lower()'d local safeValue = escape(value) return bookToAuthorNames[book][value] or bookToAuthorLine[book]:find("%f[%w_]" .. safeValue .. "%f[^%w_]") end function Books:AuthorNamesContain(book, value) -- value must be :lower()'d for author, _ in pairs(bookToAuthorNames[book]) do if author:find(value, 1, true) then return true end end return bookToAuthorLine[book]:find(value, 1, true) end function Books:AuthorIdsContain(book, userId) return bookToAuthorIds[book][userId] end function Books:GetAuthorIdLookup(book) return bookToAuthorIds[book] end return Books
if x then for i=1,10 do if a then print("okay") elseif b then print("b") break else break end end else print("else") end print("done")
local string = string local type = type local gsub = string.gsub local rep = string.rep local padding = {} function padding.pad(data, blocksize, optional) blocksize = blocksize or 16 if type(blocksize) ~= "number" then return nil, "invalid block size data type" end if blocksize < 1 or blocksize > 256 then return nil, "invalid block size" end local ps = blocksize - #data % blocksize if optional and ps == blocksize then return data end return data .. rep("\0", ps) end function padding.unpad(data, blocksize) blocksize = blocksize or 16 if type(blocksize) ~= "number" then return nil, "invalid block size data type" end if blocksize < 1 or blocksize > 256 then return nil, "invalid block size" end local len = #data if len % blocksize ~= 0 then return nil, "data length is not a multiple of the block size" end data = gsub(data, "%z+$", "") local rem = len - #data if rem < 0 or rem > blocksize then return nil, "data has invalid padding" end return data end return padding
-- funfacts function facts() local facts {"A","B","C","D","E","F","G"} net.Start("FunFacts") net.WriteString(facts[math.random(#facts)]) net.Broadcast() chat.AddText(facts[math.random(#facts)]) print(facts[math.random(#facts)]) end timer.create("FunFacts", 1800, 0, facts)
DBT_AllPersistentOptions = { ["Default"] = { ["DBM"] = { ["StartColorPR"] = 1, ["Scale"] = 0.899999976158142, ["EnlargeBarsPercent"] = 0.125, ["StartColorR"] = 1, ["EndColorPR"] = 0.501960784313726, ["TimerPoint"] = "TOPRIGHT", ["EndColorDG"] = 0, ["HugeTimerPoint"] = "CENTER", ["EndColorUIG"] = 0.92156862745098, ["StartColorUIR"] = 1, ["StartColorAG"] = 0.545098039215686, ["EndColorDR"] = 1, ["HugeBarXOffset"] = 0, ["StartColorRR"] = 0.501960784313726, ["StartColorUIG"] = 1, ["HugeScale"] = 1.04999995231628, ["BarYOffset"] = 0, ["StartColorDG"] = 0.301960784313726, ["StartColorAR"] = 0.376470588235294, ["EndColorAER"] = 1, ["StartColorIB"] = 1, ["EndColorAEB"] = 0.247058823529412, ["HugeTimerX"] = 0, ["BarXOffset"] = 0, ["EndColorB"] = 0, ["EndColorAR"] = 0.149019607843137, ["EndColorG"] = 0, ["Decimal"] = 60, ["EndColorIB"] = 1, ["EndColorRB"] = 0.301960784313726, ["TimerX"] = -223.000030517578, ["EndColorIR"] = 0.0470588235294118, ["EndColorRR"] = 0.109803921568627, ["EnlargeBarTime"] = 11, ["StartColorPG"] = 0.776470588235294, ["EndColorAB"] = 1, ["Width"] = 183, ["EndColorPG"] = 0.411764705882353, ["EndColorIG"] = 0.87843137254902, ["EndColorAEG"] = 0.0431372549019608, ["StartColorAEB"] = 0.458823529411765, ["HugeTimerY"] = -120, ["StartColorIG"] = 0.968627450980392, ["StartColorIR"] = 0.470588235294118, ["StartColorAB"] = 1, ["TimerY"] = -260, ["StartColorB"] = 0, ["HugeWidth"] = 200, ["StartColorAER"] = 1, ["StartColorAEG"] = 0.466666666666667, ["StartColorDR"] = 0.901960784313726, ["EndColorUIR"] = 1, ["EndColorRG"] = 1, ["StartColorUIB"] = 0.0627450980392157, ["StartColorG"] = 0.701960784313726, ["StartColorPB"] = 0.419607843137255, ["Height"] = 20, ["EndColorR"] = 1, ["StartColorRG"] = 1, ["FontSize"] = 10, ["StartColorRB"] = 0.501960784313726, ["EndColorAG"] = 0.384313725490196, ["EndColorPB"] = 0.286274509803922, ["StartColorDB"] = 1, ["EndColorUIB"] = 0.0117647058823529, ["EndColorDB"] = 1, ["HugeBarYOffset"] = 0, }, }, }
local optionsSelections = {} optionsSelections[0] = "Back" optionsSelections[1] = "Volume" optionsSelections[2] = settings.displayModes[settings.displayModesIndex] function DrawOptionsScreen() love.graphics.clear(unpack(colors.black)) GameFont:setLineHeight(1) love.graphics.setColor(0, 0, 0, 100) love.graphics.rectangle("fill", 0, 0, love.graphics.getWidth(), love.graphics.getHeight()) local blackImage = love.graphics.newImage(settings.black_screen_path) local blackImageScale = 3 local backW = (dimensions.window_width * 1 / 5) local backX = (dimensions.window_width / 2 - backW / 2) local backY = blackImage:getHeight() * blackImageScale + 10 local backH = 60 local volumeW = (dimensions.window_width * 1 / 3.75) local volumeX = (dimensions.window_width / 2 - volumeW / 2) local volumeY = blackImage:getHeight() * blackImageScale - 260 local volumeH = 60 local displaymodeW = (dimensions.window_width * 1 / 3.75 + love.graphics.newText(GameFont, optionsSelections[2]):getWidth()) local displaymodeX = (dimensions.window_width / 2 - displaymodeW / 2) local displaymodeY = blackImage:getHeight() * blackImageScale - 370 local displaymodeH = 60 local dx = 8 local dy = 8 love.graphics.setColor(0.44, 0.56, 0.89) if TitleSelection == "Volume" then love.graphics.rectangle("fill", volumeX - dx, volumeY - dy, volumeW + 2 * dx, volumeH + 2 * dy) elseif TitleSelection == optionsSelections[2] then love.graphics.rectangle( "fill", displaymodeX - dx, displaymodeY - dy, displaymodeW + 2 * dx, displaymodeH + 2 * dy ) else love.graphics.rectangle("fill", backX - dx, backY - dy, backW + 2 * dx, backH + 2 * dy) end love.graphics.setColor(222, 0, 0) love.graphics.rectangle("fill", backX, backY, backW, backH) love.graphics.setColor(0.3, 0.3, 0.3) love.graphics.rectangle("fill", volumeX, volumeY, volumeW, volumeH) love.graphics.setColor(0.3, 0.3, 0.3) love.graphics.rectangle("fill", displaymodeX, displaymodeY, displaymodeW, displaymodeH) love.graphics.setColor(1, 1, 1) local textScale = 3 local backText = love.graphics.newText(GameFont, "Back") love.graphics.draw( backText, backX + backW / 2 - (backText:getWidth() * textScale) / 2, backY + backH / 2 - (backText:getHeight() * textScale) / 2, 0, textScale, textScale ) local volumeText = love.graphics.newText(GameFont, "Volume Settings") love.graphics.draw( volumeText, volumeX + volumeW / 2 - (volumeText:getWidth() * textScale) / 2, volumeY + volumeH / 2 - (volumeText:getHeight() * textScale) / 2, 0, textScale, textScale ) local displaymodeText = love.graphics.newText(GameFont, optionsSelections[2]) love.graphics.draw( displaymodeText, displaymodeX + displaymodeW / 2 - (displaymodeText:getWidth() * textScale) / 2, displaymodeY + displaymodeH / 2 - (displaymodeText:getHeight() * textScale) / 2, 0, textScale, textScale ) return self end TitleSelection = "Back" SelectionIndex = 0 blip2 = love.audio.newSource("sounds/selectblip2.wav", "static") jingle = love.audio.newSource("sounds/selectjingle.wav", "static") blip2:setVolume(settings.sfx_volume / 100 / 2) jingle:setVolume(settings.sfx_volume / 100 / 2) OptionsConfig = { displayed = false, onKeyPressed = function(key) if key == controls.start_button then love.graphics.clear(0, 0, 0) if TitleSelection == "Back" then blip2:stop() blip2:play() if Episode.started then screens.options.displayed = false else screens.title.displayed = true DrawTitleScreen() screens.options.displayed = false SelectionIndex = 2 TitleSelection = "Settings" end elseif TitleSelection == "Volume" then blip2:stop() blip2:play() screens.volume.displayed = true DrawVolumeScreen() screens.options.displayed = false SelectionIndex = 0 elseif TitleSelection == optionsSelections[2] then blip2:stop() blip2:play() if optionsSelections[2] == "Fullscreen" then settings.displayModesIndex = settings.displayModesIndex + 1 love.window.setFullscreen(true) optionsSelections[2] = "Windowed-Fullscreen" elseif optionsSelections[2] == "Windowed-Fullscreen" then settings.displayModesIndex = settings.displayModesIndex - 1 love.window.setFullscreen(true, "desktop") optionsSelections[2] = "Fullscreen" end TitleSelection = optionsSelections[2] end elseif key == controls.pause_nav_up then blip2:stop() blip2:play() SelectionIndex = SelectionIndex + 1 if (SelectionIndex > 2) then SelectionIndex = 0 end TitleSelection = optionsSelections[SelectionIndex] elseif key == controls.pause_nav_down then blip2:stop() blip2:play() SelectionIndex = SelectionIndex - 1 if (SelectionIndex < 0) then SelectionIndex = 2 end TitleSelection = optionsSelections[SelectionIndex] end end, onKeyReleased = function(key) end, onDisplay = function() screens.pause.displayed = false screens.courtRecords.displayed = false screens.options.displayed = true screens.title.displayed = false screens.volume.displayed = false TitleSelection = "Back" SelectionIndex = 0 end, draw = function() if screens.options.displayed == true then DrawOptionsScreen() blip2:setVolume(settings.sfx_volume / 100 / 2) jingle:setVolume(settings.sfx_volume / 100 / 2) end end }
-- separator function foo() local a,b,c,d; a=1;b=2;c=3;d=4; return a,b,c,d; end; a,b,c,d=foo(); print(a,b,c,d); a,b,c,d=foo();print(a,b,c,d);
local dpdk = require "dpdk" local memory = require "memory" local device = require "device" local ts = require "timestamping" local dpdkc = require "dpdkc" local filter = require "filter" local ffi = require "ffi" function master(...) local txPort, rate, cores = tonumberall(...) if not txPort or not rate or not cores then return print("usage: txPort rate cores") end local rxMempool = memory.createMemPool() local txDev txDev = device.config(txPort, rxMempool, 1, cores) txDev:wait() for i = 0, cores - 1 do txDev:getTxQueue(i):setRate(rate / cores) dpdk.launchLua("loadSlave", txPort, i) end dpdk.waitForSlaves() end function loadSlave(port, queue) local core = queue local queue = device.get(port):getTxQueue(queue) local mem = memory.createMemPool(function(buf) local data = ffi.cast("uint8_t*", buf.pkt.data) -- src/dst mac for i = 0, 11 do data[i] = i end -- eth type data[12] = 0x12 data[13] = 0x34 end) local MAX_BURST_SIZE = 31 local lastPrint = dpdk.getTime() local totalSent = 0 local lastTotal = 0 local lastSent = 0 local bufs = mem:bufArray(MAX_BURST_SIZE) while dpdk.running() do bufs:alloc(60) totalSent = totalSent + queue:send(bufs) local time = dpdk.getTime() if time - lastPrint > 1 then local mpps = (totalSent - lastTotal) / (time - lastPrint) / 10^6 printf("[Queue %d] Sent %d packets, current rate %.2f Mpps, %.2f MBit/s, %.2f MBit/s wire rate", core, totalSent, mpps, mpps * 64 * 8, mpps * 84 * 8) lastTotal = totalSent lastPrint = time end end printf("[Queue %d] Sent %d packets", core, totalSent) end
return {'sipaliwini','sip','sipaliwinees','sipaliwinier','sipke','sip','sipma','sipkema','sipman','sipsma','sippe','sipper','sipst','sipaliwinese','sipaliwiniers','sipkes'}
local teleports = { [3178] = {value = 6, position = Position(33137, 31248, 6)}, [3179] = {value = 6, position = Position(33211, 31068, 9)}, [3180] = {value = 6, position = Position(33211, 31068, 9)}, function onStepIn(creature, item, position, fromPosition) local player = creature:getPlayer() if not player then return true end if player:getStorageValue(Storage.WrathoftheEmperor.TeleportAccess) >= teleports[item.uid].value then player:teleportTo(teleports[item.uid].position) player:getPosition():sendMagicEffect(teleports[item.uid].position, CONST_ME_TELEPORT) else player:teleportTo(fromPosition) end return true end
-- Declare the function, takes two arguments function AddAndPrint(x, y) local result = x + y; print (x .. "+" .. y .. "=" .. result) end -- Call the function a few times AddAndPrint(2, 3, 7) -- Will print 2+3=5 AddAndPrint(4, 5, 8, 9, 10) -- Will print 4+5=9 AddAndPrint(6, 7, 11, 12, 14) -- Will print 6+7=13 -- Declare the function, takes two arguments function PrintValues(x, y) print ("x: " .. tostring(x) .. ", y: " .. tostring(y)) end -- Call the function a few times PrintValues(3, 4) -- will print x: 3, y: 4 PrintValues(1) -- will print x: 1, y: nil PrintValues() -- will print x: nil, y: nil
--[[ Copyright (c) 2010 Wendell Misiedjan Edited by: Wendell Misiedjan Based on: Manuel König files. 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 object = {} object.id = "radiation_shield" object.slave_id = "radiation_shield_b" object.class = "RadiationShield" object.thob = 28 object.name = _S.object.radiation_shield object.tooltip = _S.tooltip.objects.radiation_shield object.ticks = true object.build_preview_animation = 922 object.show_in_town_map = true local function copy_north_to_south(t) t.south = t.north return t end object.idle_animations = copy_north_to_south { north = 794, } object.usage_animations = copy_north_to_south { north = { begin_use = {Doctor = 798}, -- Doctor sits down begin_use_2 = {Doctor = 806}, -- Pulls the handle in_use = {Doctor = { 810, -- Sits idle 814, -- Pushing buttons }}, finish_use = {Doctor = 802}, -- Doctor stands up }, } object.orientations = { north = { render_attach_position = {0, -1}, footprint = { {-2, -1}, {-1, -1}, {0, -1}, {-2, 0}, {-1, 0}, {0, 0, only_passable = true}, {-2, 1}, {-1, 1}, {0, 1}}, use_position = {0, 0} }, east = { render_attach_position = {0, -1}, footprint = { {-1, -2}, {0, -2},{1, -2}, {-1, -1}, {0, -1},{1, -1}, {-1, 0}, {0, 0, only_passable = true},{1, 0} }, use_position = {0, 0} }, } class "RadiationShield" (Object) ---@type RadiationShield local RadiationShield = _G["RadiationShield"] RadiationShield:slaveMixinClass() return object
-- -- Created by IntelliJ IDEA. -- User: nander -- Date: 09/02/2018 -- Time: 21:25 -- To change this template use File | Settings | File Templates. -- return function() LOADBYMAPFILE("assets/maps/final/cubetransporter.lua") --ember, purple, cyan, green, yellow scripts.objects.door(24, 12, true, false, nil, "closeDoor") scripts.objects.door(24, 17, false, false, nil, "openDoor") scripts.objects.movingBlock(17, 8, "moveDown", nil, nil, "moveUp") end
--3L·不可思议的国度 local m=37564848 local cm=_G["c"..m] if not pcall(function() require("expansions/script/c37564765") end) then require("script/c37564765") end cm.named_with_3L=true function cm.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,m+EFFECT_COUNT_CODE_OATH) e1:SetTarget(cm.target) e1:SetOperation(cm.activate) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetOperation(cm.desop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetCondition(cm.atkcon) e3:SetCost(cm.atkcost) e3:SetTarget(cm.atktg) e3:SetOperation(cm.atkop) c:RegisterEffect(e3) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(1,0) e2:SetTarget(function(e,c) return not senya.check_set_3L(c) end) c:RegisterEffect(e2) end function cm.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end function cm.filter2(c,e,tp,m,f,chkf) return c:IsType(TYPE_FUSION) and senya.check_set_3L(c) and (not f or f(c)) and c:GetLevel()==7 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) end function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp local mg1=senya.GetFusionMaterial(tp,LOCATION_DECK,nil,Card.IsAbleToRemove,nil) local res=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) if not res then local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() local mg2=fgroup(ce,e,tp) local mf=ce:GetValue() res=Duel.IsExistingMatchingCard(cm.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf) end end return res end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function cm.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp local mg1=senya.GetFusionMaterial(tp,LOCATION_DECK,nil,Card.IsAbleToRemove,nil,e) local sg1=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local mg2=nil local sg2=nil local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() mg2=fgroup(ce,e,tp) local mf=ce:GetValue() sg2=Duel.GetMatchingGroup(cm.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf) end if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then local sg=sg1:Clone() if sg2 then sg:Merge(sg2) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=sg:Select(tp,1,1,nil) local tc=tg:GetFirst() tc:RegisterFlagEffect(m,RESET_CHAIN,0,1) if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) tc:SetMaterial(mat1) Duel.Remove(mat1,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) else local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) local fop=ce:GetOperation() fop(ce,e,tp,tc,mat2) end tc:CompleteProcedure() e:GetHandler():SetCardTarget(tc) end end function cm.atkcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFirstCardTarget() end function cm.cfilter(c) return senya.check_set_3L(c) and c:IsDiscardable() end function cm.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cm.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,cm.cfilter,1,1,REASON_COST+REASON_DISCARD,nil) end function cm.sfilter(c,tp,fc,e) if not fc then return false end if e and not c:IsCanBeEffectTarget(e) then return false end return c:IsControler(tp) and c:IsLocation(LOCATION_REMOVED) and c:IsAbleToDeck() and c:IsType(TYPE_MONSTER) and senya.check_set_3L(c) and senya.lefffilter(c,fc) and bit.band(c:GetReason(),0x40008)==0x40008 and c:GetReasonCard()==fc end function cm.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local fc=e:GetHandler():GetFirstCardTarget() if chkc then return fc and fc:GetMaterial():IsContains(chkc) and cm.sfilter(chkc,tp,fc) end if chk==0 then return fc and fc:GetMaterial():IsExists(cm.sfilter,1,nil,tp,fc,e) end local g=fc:GetMaterial():Filter(cm.sfilter,nil,tp,fc,e) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local sg=g:Select(tp,1,1,nil) Duel.SetTargetCard(sg) Duel.SetOperationInfo(0,CATEGORY_TODECK,sg,1,0,0) end function cm.atkop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() local fc=e:GetHandler():GetFirstCardTarget() if not fc or not tc or not tc:IsRelateToEffect(e) then return end senya.lgeff(fc,tc) Duel.SendtoDeck(tc,nil,0,REASON_EFFECT) if tc:IsLocation(LOCATION_DECK) then Duel.ShuffleDeck(tc:GetControler()) end end
local tmux = require('Navigator.tmux') local A = vim.api local F = vim.fn local cmd = A.nvim_command -- Just some state and defaults local N = { last_pane = false, config = nil, } local function wincmd(direction) cmd('wincmd ' .. direction) end local function tabcmd(direction) if direction == 'n' then cmd('tabnext') elseif direction == 'p' then cmd('tabprevious') elseif direction == 'l' then -- g<Tab> goes to the last accessed tab cmd('normal! g\t') end end local function maybe_auto_save() local w = N.config.auto_save if w ~= nil then if w == 'current' then local cur_buf = A.nvim_get_current_buf() if F.exists(A.nvim_buf_get_name(cur_buf)) then cmd('update') end end if w == 'all' then for _, buf in pairs(A.nvim_list_bufs()) do if A.nvim_buf_is_loaded(buf) and F.exists(A.nvim_buf_get_name(buf)) then A.nvim_buf_call(buf, function() cmd('update') end) end end end end end -- For setting up the plugin with the user provided options function N.setup(opts) N.config = { disable_on_zoom = false, -- boolean auto_save = nil, -- 'current' | 'all' } if opts ~= nil then N.config = vim.tbl_extend('keep', opts, N.config) end function _G.__navigator_reset_last_pane() N.last_pane = false end vim.cmd([[ augroup NavigatorGroup au! autocmd WinEnter * lua __navigator_reset_last_pane() augroup END ]]) end function N.back_to_tmux(at_edge) if N.config.disable_on_zoom and tmux.is_zoomed() then return false end return N.last_pane or at_edge end -- For smoothly navigating through neovim splits and tmux panes function N.navigate(direction) -- For moments when you have this plugin installed -- but for some reason you didn't bother to install tmux if not tmux.is_tmux then wincmd(direction) return end -- window id before navigation local cur_win = A.nvim_get_current_win() local tmux_last_pane = direction == 'p' and N.last_pane if not tmux_last_pane then wincmd(direction) end -- window id after navigation local new_win = A.nvim_get_current_win() -- After navigation, if the old window and new window matches local at_edge = cur_win == new_win -- then we can assume that we hit the edge -- there is tmux pane besided the edge -- So we can navigate to the tmux pane if N.back_to_tmux(at_edge) then tmux.change_pane(direction) maybe_auto_save() N.last_pane = true else N.last_pane = false end end -- For smoothly navigating through neovim tabpages and tmux windows function N.navi_tab(direction) -- For moments when you have this plugin installed -- but for some reason you didn't bother to install tmux if not tmux.is_tmux then tabcmd(direction) return end -- tab nvaivation wraps around in neovim, so we need to check at edge before actually acting -- `nvim_list_tabpages` returns tab handles that are not the same as gettabinfo, which is used by bufferline local tabs = F.gettabinfo() local curr_tab = F.tabpagenr() local at_edge = (curr_tab == tabs[1].tabnr and direction == 'p') or (curr_tab == tabs[#tabs].tabnr and direction == 'n') local tmux_last_pane = direction == 'l' and N.last_pane if not at_edge and not tmux_last_pane then tabcmd(direction) return end -- go to tmux instead if N.back_to_tmux(at_edge) then tmux.change_window(direction) maybe_auto_save() N.last_pane = true else N.last_pane = false end end return N
local playsession = { {"rikkert", {869}}, {"redlabel", {354}}, {"Zymoran", {337}}, {"XnagitoX", {915}}, {"xiaoxi", {33427}}, {"Kamyk", {236518}}, {"651782904", {77998}}, {"CmonMate497", {3658}}, {"Ulygold", {2656}}, {"James_Hackett", {27840}}, {"Royal_X5", {1860}}, {"Decu", {5314}}, {"Jardee", {25418}} } return playsession
Background = Base:extend("Background", { sprite = nil, offset = nil, scale = nil, scroll = nil, color = "white", alpha = 1, dimensions = nil, sd = nil, quad = nil }) function Background:init(data) stache.checkArg("sprite", data.sprite, "asset", "Background:init") stache.checkArg("offset", data.offset, "vector", "Background:init", true) stache.checkArg("scale", data.scale, "vector", "Background:init", true) stache.checkArg("scroll", data.scroll, "vector", "Background:init", true) stache.checkArg("color", data.color, "asset", "Background:init", true) stache.checkArg("alpha", data.alpha, "number", "Background:init", true) data.sprite = stache.getAsset("sprite", data.sprite, stache.sprites, "Background:init") data.offset = data.offset or vec2() data.scale = data.scale or vec2(1) data.scroll = data.scroll or vec2(1) Base.init(self, data) self.dimensions = vec2(self.sprite:getWidth(), self.sprite:getHeight()) self.sd = self.dimensions ^ self.scale self.quad = lg.newQuad(0, 0, 0, 0, 0, 0) self.sprite:setWrap("repeat", "repeat") end function Background:update(tl, camera) end function Background:draw(camera) local width, height = lg.getDimensions() local center = vec2(width, height) / 2 local pos = nil if not camera.pos then stache.formatError("Background:draw() called with an invalid 'camera' argument: %q", camera) end pos = camera.pos pos = pos ^ self.scroll pos = pos - self.offset ^ self.scale self.quad:setViewport(pos.x - (width / 2) * BG_OVERDRAW + self.sd.x / 2, pos.y - (height / 2) * BG_OVERDRAW + self.sd.y / 2, width * BG_OVERDRAW, height * BG_OVERDRAW, self.sd.x, self.sd.y) lg.push("all") lg.translate(center:split()) lg.rotate(-camera.angle) lg.scale(camera.scale) lg.translate((-center * BG_OVERDRAW):split()) stache.setColor(self.color, self.alpha) lg.draw(self.sprite, self.quad) lg.pop() end
SWEP.Base = "arccw_base" SWEP.Spawnable = true -- this obviously has to be set to true SWEP.Category = "ArcCW - Halo Custom Edition" -- edit this if you like SWEP.AdminOnly = false SWEP.PrintName = "Assault Carbine" SWEP.TrueName = "MA5K Assault Carbine" SWEP.Trivia_Class = "Carbine" SWEP.Trivia_Desc = "The MA5K carbine is a firearm used almost exclusively by United Nations Space Command special operations forces, notably the Spartan-III supersoldiers. It is part of Misriah Armory's MA5 series, and is a cut-down version of the standard MA5B assault rifle. It is fully automatic and receives a thirty-round magazine of 7.62×51mm FMJ-AP ammunition. The most conspicuous difference between the MA5K and other MA5 models is the replacement of the distinctive electronics housing with a removable carrying handle similar to that of the BR55 battle rifle." SWEP.Trivia_Manufacturer = "Misriah Armory" SWEP.Trivia_Calibre = " M118 7.62x51mm FMJ-AP" SWEP.Trivia_Mechanism = "Automatic" SWEP.Trivia_Country = "never heard of her" SWEP.Slot = 3 if GetConVar("arccw_truenames"):GetBool() then SWEP.PrintName = SWEP.TrueName end SWEP.UseHands = true SWEP.ViewModel = "models/snowysnowtime/eonace/c_fp_ma5k.mdl" SWEP.WorldModel = "models/snowysnowtime/eonace/w_ma5k.mdl" SWEP.ViewModelFOV = 70 if GetConVar("arccw_hce_bal"):GetInt() == 0 then -- HaloCW SWEP.Recoil = 0.7 SWEP.RecoilSide = 0.7 SWEP.Damage = 25 SWEP.DamageMin = 15 -- damage done at maximum range SWEP.AccuracyMOA = 20 -- accuracy in Minutes of Angle. There are 60 MOA in a degree. SWEP.HipDispersion = 300 -- inaccuracy added by hip firing. SWEP.JumpDispersion = 0 SWEP.ChamberSize = 0 elseif GetConVar("arccw_hce_bal"):GetInt() == 1 then -- halo purist SWEP.Recoil = 0 SWEP.RecoilSide = 0 SWEP.Damage = 20 SWEP.DamageMin = 16 -- damage done at maximum range SWEP.JumpDispersion = 0 SWEP.HipDispersion = 0 SWEP.MoveDispersion = 0 SWEP.ChamberSize = 1 elseif GetConVar("arccw_hce_bal"):GetInt() == 2 then -- arccw SWEP.Recoil = 0.4 SWEP.RecoilSide = 0.4 SWEP.Damage = 30 SWEP.DamageMin = 10 -- damage done at maximum range SWEP.AccuracyMOA = 20 -- accuracy in Minutes of Angle. There are 60 MOA in a degree. SWEP.HipDispersion = 300 -- inaccuracy added by hip firing. SWEP.MoveDispersion = 120 SWEP.ChamberSize = 1 end SWEP.MeleeSwingSound = "" SWEP.MeleeMissSound = "" SWEP.MeleeHitSound = "hceworld" SWEP.MeleeHitNPCSound = "hceslap" SWEP.Range = 100 -- in METRES SWEP.Penetration = 25 SWEP.DamageType = DMG_BULLET SWEP.ShootEntity = nil -- entity to fire, if any SWEP.MuzzleVelocity = 300 -- projectile or phys bullet muzzle velocity -- IN M/S SWEP.TracerNum = 1 -- tracer every X SWEP.Tracer = "" SWEP.Primary.ClipSize = 30 -- DefaultClip is automatically set. SWEP.ExtendedClipSize = 60 SWEP.ReducedClipSize = 20 SWEP.Delay = 60 / 900 -- 60 / RPM. SWEP.Num = 1 -- number of shots per trigger pull. SWEP.Firemodes = { { Mode = 2, }, { Mode = 0 } } SWEP.NPCWeaponType = {"weapon_ar2","weapon_smg"} SWEP.NPCWeight = 25 SWEP.ManualAction = false SWEP.Primary.Ammo = "ar2" -- what ammo type the gun uses SWEP.MagID = "hs338" -- the magazine pool this gun draws from SWEP.ShootVol = 140 -- volume of shoot sound SWEP.ShootPitch = 100 -- pitch of shoot sound SWEP.ShootSound = Sound("ma5k_fire") SWEP.ShootSoundSilenced = "weapons/arccw/m4a1/m4a1_silencer_01.wav" SWEP.DistantShootSound = "ar_lod" SWEP.MuzzleEffect = "astw2_halo_spv3_muzzle_DMR" SWEP.ImpactEffect = "" SWEP.ShellModel = "models/shells/shell_338mag.mdl" SWEP.ShellPitch = 80 SWEP.ShellScale = 1.5 SWEP.MuzzleEffectAttachment = 1 -- which attachment to put the muzzle on SWEP.CaseEffectAttachment = 2 -- which attachment to put the case effect on SWEP.SightTime = 0.4 SWEP.SpeedMult = 0.85 SWEP.SightedSpeedMult = 0.25 SWEP.MeleeTime = 1 SWEP.BulletBones = { -- the bone that represents bullets in gun/mag -- [0] = "bulletchamber", -- [1] = "bullet1" } SWEP.ProceduralRegularFire = false SWEP.ProceduralIronFire = false SWEP.CaseBones = {} SWEP.IronSightStruct = { Pos = Vector(-4.51, -7, 1.23), Ang = Angle(-0.2, 0.01, 0), Magnification = 1.1, } SWEP.HoldtypeHolstered = "passive" SWEP.HoldtypeActive = "ar2" SWEP.HoldtypeSights = "rpg" SWEP.AnimShoot = ACT_HL2MP_GESTURE_RANGE_ATTACK_AR2 SWEP.ActivePos = Vector(0, -2, 1) SWEP.ActiveAng = Angle(0, 0, 0) SWEP.HolsterPos = Vector(3, -3, -0.5) SWEP.HolsterAng = Angle(-10, 30, -10) SWEP.BarrelOffsetSighted = Vector(0, 0, 0) SWEP.BarrelOffsetHip = Vector(2, 0, -2) SWEP.CustomizePos = Vector(3.824, -6, -0.897) SWEP.CustomizeAng = Angle(12.149, 30.547, 0) SWEP.BarrelLength = 30 SWEP.AttachmentElements = { ["ub"] = { VMBodygroups = {{ind = 1, bg = 1}}, WMBodygroups = {{ind = 1, bg = 1}}, }, } SWEP.ExtraSightDist = 7 SWEP.Attachments = { { PrintName = "Optic", -- print name DefaultAttName = "Iron Sights", Slot = {"optic", "optic_lp"}, -- what kind of attachments can fit here, can be string or table Bone = "frame gun", -- relevant bone any attachments will be mostly referring to Offset = { vpos = Vector(3.5, -6.5, -0.045), -- offset that the attachment will be relative to the bone vang = Angle(0, 0, -90), wpos = Vector(15.92, 0.75, -6.8), wang = Angle(-13, -1, 182.3) }, CorrectivePos = Vector(0, 0, 0), CorrectiveAng = Angle(0, 0, 0), InstalledEles = {"mount"} }, { PrintName = "Muzzle", DefaultAttName = "Standard Muzzle", Slot = {"muzzle"}, Bone = "frame gun", Offset = { vpos = Vector(15, -3.35, -0.03), vang = Angle(0, 0, -90), wpos = Vector(18.3, 0.85, -5.8), wang = Angle(-12.5, -0.5, 183) }, VMScale = Vector(1, 1, 1), }, { PrintName = "Underbarrel", Slot = {"foregrip", "ubgl", "bipod"}, Bone = "frame gun", Offset = { vpos = Vector(8.3, -0.5, 0), vang = Angle(0, 0, -90), wpos = Vector(0, 0, 0), wang = Angle(0, 0, 0) }, InstalledEles = {"ub"}, }, { PrintName = "Stock", Slot = "stock", DefaultAttName = "Standard Stock" }, { PrintName = "Tactical", Slot = "tac", Bone = "frame gun", Offset = { vpos = Vector(11, -3.25, -0.85), -- offset that the attachment will be relative to the bone vang = Angle(0, 0, 0), wpos = Vector(15.95, 1.7, -4.15), wang = Angle(-13, 0, -87.7) }, }, { PrintName = "Ammo Type", Slot = "ammo_bullet" }, { PrintName = "Firetype", Slot = {"ma5k", "fcg"}, FreeSlot = true, Installed = "ma5k_accel", DefaultAttName = "Factory FCG", }, { PrintName = "Perk", Slot = {"perk","go_perk"} }, { PrintName = "Charm", Slot = "charm", FreeSlot = true, Bone = "frame gun", -- relevant bone any attachments will be mostly referring to Offset = { vpos = Vector(1.8, -1.8, -0.95), -- offset that the attachment will be relative to the bone vang = Angle(0, 0, -92), wpos = Vector(7.03, 1.7, -3.85), wang = Angle(-10, 0, 180) }, }, { PrintName = "Passive", Slot = {"halo_passive"}, Installed = "passive_halo_non_prec_wep_mult", Integral = true }, } SWEP.Animations = { ["idle_sights"] = { Source = "aim", }, ["enter_sight"] = { Source = "aim", }, ["idle"] = { Source = "idle", Time = 100/30 }, ["exit_inspect"] = { Source = "fidget", Time = 60/30 }, ["fire_iron"] = { Source = "aim_fire", Time = 10/30, }, ["draw"] = { Source = "draw", Time = 27/45, LHIK = true, LHIKIn = 0, LHIKOut = 0.25, }, ["fire"] = { Source = "fire", Time = 10/45, }, ["bash"] = { Source = "melee", Time = 25/30, LHIK = true, LHIKIn = 0, LHIKOut = 0.2, }, ["reload"] = { Source = "reload", Time = 75/30, TPAnim = ACT_HL2MP_GESTURE_RELOAD_AR2, Checkpoints = {06, 15, 37, 47}, FrameRate = 75/30, LHIK = true, LHIKIn = 0.5, LHIKOut = 0.5, }, ["reload_empty"] = { Source = "reload_empty", Time = 80/30, TPAnim = ACT_HL2MP_GESTURE_RELOAD_AR2, Checkpoints = {11, 16, 36, 47, 57}, FrameRate = 30, LHIK = true, LHIKIn = 0.5, LHIKOut = 0.5, }, } if engine.ActiveGamemode() == "terrortown" then SWEP.CanDrop = false SWEP.LimitedStock = false SWEP.AutoSpawnable = false end -- nZombies Stuff SWEP.NZWonderWeapon = false -- Is this a Wonder-Weapon? If true, only one player can have it at a time. Cheats aren't stopped, though. --SWEP.NZRePaPText = "your text here" -- When RePaPing, what should be shown? Example: Press E to your text here for 2000 points. SWEP.NZPaPName = "The MA5K" --SWEP.NZPaPReplacement = "" -- If Pack-a-Punched, replace this gun with the entity class shown here. SWEP.NZPreventBox = false -- If true, this gun won't be placed in random boxes GENERATED. Users can still place it in manually. SWEP.NZTotalBlackList = false -- if true, this gun can't be placed in the box, even manually, and can't be bought off a wall, even if placed manually. Only code can give this gun. SWEP.Primary.MaxAmmo = 300 -- Max Ammo function function SWEP:NZMaxAmmo() local ammo_type = self:GetPrimaryAmmoType() or self.Primary.Ammo if SERVER then self.Owner:SetAmmo( self.Primary.MaxAmmo, ammo_type ) end end -- PaP Function function SWEP:OnPaP() self.Ispackapunched = 1 self.PrintName = "The MA5K" self.MagExtender = true self.ActivateElements = {"extendedmag"} self.Primary.MaxAmmo = 600 self.Damage = 35 self.DamageMin = 25 return true end
-- thread.lua -- -- Thread.lua exports a number of functions that deal with "threads". A -- "thread" consists of a *task* and a *coroutine*. -- -- Task Objects -- ------------- -- -- Task objects represent a pending operation, and store the following: -- -- * the dispatch context [needed to schedule a coroutine] -- * what the coroutine is waiting on [needed to dequeue it] -- * cleanup functions to be called when the coroutine exits -- * values returned from the coroutine's start function -- -- Dispatch Objects -- ---------------- -- -- Dispatch objects represent a context for dispatching -- i.e. the state -- associated with an invocation of `thread.dispatch()`. When a task is -- waiting on a blocking function -- e.g. read() -- it is stored in a queue -- owned by its dispatch context. When a task is being executed, it is being -- called (or resumed) from the instance of `dispatch()` associated with its -- dispatch context. local xpio = require "xpio" local Heap = require "heap" local Queue = require "queue" -- reverse of table.pack -- local function undoPack(t) return table.unpack(t, 1, t.n) end local thread = {} -- currentTask holds the task currently executing local currentTask local function taskAtExit(me, fn, ...) local id = table.pack(fn, ...) table.insert(me.atExits, id) return id end local function taskCancelAtExit(me, id) for n = #me.atExits, 1, -1 do if id == me.atExits[n] then table.remove(me.atExits, n) return true end end return nil end local function taskRunAtExits(me) while true do local oe = table.remove(me.atExits) if not oe then return end oe[1](table.unpack(oe, 2, oe.n)) end end local function taskDelete(me) if me._dequeue then me:_dequeue() end taskRunAtExits(me) me.dispatch.all[me] = nil end -- Task class thread.Task = {} -- Create a new task -- -- Other task members not assigned herein: -- me._dequeue -- me._dequeuedata -- local function taskNew(dispatch, fn, ...) local fargs = table.pack(...) local me = setmetatable({}, thread.Task) local function preamble() me.results = table.pack(xpcall(fn, debug.traceback, undoPack(fargs))) me.failed = not table.remove(me.results, 1) me.results.n = me.results.n - 1 if me.failed then dispatch.all[me] = nil end taskDelete(me) end me.coroutine = coroutine.create(preamble) me.dispatch = dispatch me.atExits = {} me._queue = dispatch._queue me.makeReady = dispatch.makeReady me:makeReady() dispatch.all[me] = true return me end function thread.new(fn, ...) return taskNew(currentTask.dispatch, fn, ...) end function thread.yield() currentTask:makeReady() coroutine.yield() end local function joinWake(task) task._dequeue = nil task._dequeueTask = nil task._dequeueID = nil task:makeReady() end local function joinDequeue(task) taskCancelAtExit(task._dequeueTask, task._dequeueID) task._dequeue = nil task._dequeueTask = nil task._dequeueID = nil end function thread.join(task) if not task.results then local id = taskAtExit(task, joinWake, currentTask) currentTask._dequeue = joinDequeue currentTask._dequeueTask = task currentTask._dequeueID = id coroutine.yield() end if task.failed then error(task.results[1], 0) else return undoPack(task.results) end end function thread.atExit(fn, ...) return taskAtExit(currentTask, fn, ...) end function thread.cancelAtExit(id) return taskCancelAtExit(currentTask, id) end function thread.kill(task) if not task.results then task.results = table.pack(nil, "killed") taskDelete(task) end end -- Create a new "dispatch" (dispatching context) -- local function newDispatch() local me = {} local ready = Queue:new() local sleepers = Heap:new() local tq = xpio.tqueue() me.all = {} -- all unfinished tasks me._queue = tq local function dqQueue(task) task._dequeuedata:remove(task) task._dequeuedata = nil task._dequeue = nil end function me.makeReady(task) assert(not task._dequeue) task._dequeue = dqQueue task._dequeuedata = ready ready:put(task) end local function dqSleeper(task) sleepers:remove(task) task._dequeue = nil end function me.wakeAt(task, timeDue) assert(not task._dequeue) task._dequeue = dqSleeper task.timeDue = timeDue sleepers:put(task, timeDue) end function me:dtor() while true do local t = ready:first() if not t then break end taskDelete(t) end end function me:dispatch() local thisTask = currentTask local run = Queue:new() while true do --printf("%d readers, %d writers, %d sleepers\n", -- count(readers), count(writers), #sleepers, ready:length()) -- Move ready tasks to the run queue, and then run them. During -- this time, any tasks placed on the ready queue will be run in -- the next iteration. run, ready = ready, run while true do currentTask = run:first() xpio.setCurrentTask(currentTask) if not currentTask then break end currentTask:_dequeue() local succ, err = coroutine.resume(currentTask.coroutine) if not succ then me:dtor() local msg = ("*** Uncaught error in thread:\n\t" .. tostring(err)):gsub("\n(.)", "\n | %1") error(msg, 0) end end local s = sleepers:first() local timeout = ready:first() and 0 or s and s.timeDue - xpio.gettime() local tasks = tq:wait(timeout) --printf("wait(%s) ->%s\n", tostring(timeout), tasks and #tasks or "nil") if tasks then for _, task in ipairs(tasks) do task:makeReady() end elseif not ready:first() then -- nothing to wait on break end -- wake sleepers local tNow = xpio.gettime() while true do local task = sleepers:first() if not task or task.timeDue > tNow then break end task:_dequeue() task:makeReady() end end currentTask = thisTask xpio.setCurrentTask(currentTask) end return me end function thread.dispatch(func, ...) local me = newDispatch() local t = taskNew(me, func, ...) me:dispatch() me:dtor() if t.failed then error(t.results[1], 0) end for task in pairs(me.all) do print("*** Dangling thread:") print(debug.traceback(task.coroutine)) end end function thread.sleepUntil(t) currentTask.dispatch.wakeAt(currentTask, t) coroutine.yield() end function thread.sleep(delay) thread.sleepUntil(delay + xpio.gettime()) end return thread