content
stringlengths
5
1.05M
--redis_queued.lua --redis消息队列处理 REDIS_QUEUED = {} setmetatable(REDIS_QUEUED, {__index = _G}) local _ENV = REDIS_QUEUED function deal_with_reply(reply) if not is_table(reply) then return end -- trace("__ REDIS_QUEUED:deal_with_reply() __ is %o ", reply) if reply.channel == REDIS_CHAT_CHANNEL_WORLD then CHAT_D.deal_with_new_chat(decode_json(reply.payload)) elseif reply.channel == SUBSCRIBE_ROOM_DETAIL_RECEIVE then ROOM_D.redis_room_detail(decode_json(reply.payload)) elseif reply.channel == REDIS_ACCOUNT_START_HIBERNATE then if not is_rid_vaild(reply.payload) then return end raise_issue(EVENT_ACCOUNT_START_HIBERNATE, reply.payload) elseif reply.channel == REDIS_ACCOUNT_END_HIBERNATE then if not is_rid_vaild(reply.payload) then return end raise_issue(EVENT_ACCOUNT_END_HIBERNATE, reply.payload) elseif reply.channel == REDIS_ACCOUNT_OBJECT_CONSTRUCT then if not is_rid_vaild(reply.payload) then return end raise_issue(EVENT_ACCOUNT_OBJECT_CONSTRUCT, reply.payload) elseif reply.channel == REDIS_ACCOUNT_OBJECT_DESTRUCT then if not is_rid_vaild(reply.payload) then return end raise_issue(EVENT_ACCOUNT_OBJECT_DESTRUCT, reply.payload) elseif reply.channel == REDIS_NOTIFY_ACCOUNT_OBJECT_DESTRUCT then if not is_rid_vaild(reply.payload) then return end raise_issue(EVENT_NOTIFY_ACCOUNT_OBJECT_DESTRUCT, reply.payload) elseif reply.channel == REDIS_ACCOUNT_WAIT_LOGIN then if not is_rid_vaild(reply.payload) then return end raise_issue(EVENT_ACCOUNT_WAIT_LOGIN, reply.payload) elseif reply.channel == REDIS_USER_ENTER_WORLD then local data = decode_json(reply.payload) if not is_rid_vaild(data.rid) then return end raise_issue(EVENT_USER_OBJECT_CONSTRUCT, data.rid, data.server_id) elseif reply.channel == REDIS_USER_CONNECTION_LOST then if not is_rid_vaild(reply.payload) then return end raise_issue(EVENT_USER_CONNECTION_LOST, reply.payload) else local room_name, user_rid, cookie = string.match(reply.channel, MATCH_ROOM_MSG_CHANNEL_USER) if room_name and user_rid then ROOM_D.redis_dispatch_message(room_name, user_rid, cookie, reply.payload) return end local server_id, user_rid, cookie = string.match(reply.channel, MATCH_SERVER_MSG_USER) if server_id and user_rid then local user = find_object_by_rid(user_rid) if not user then return end local name, net_msg = pack_raw_message(reply.payload) if not net_msg then return end if get_message_type(name) == MESSAGE_LOGIC then oper_message(user, name, net_msg) else user:send_net_msg(net_msg) end del_message(net_msg) return end local server_id, cookie = string.match(reply.channel, MATCH_RESPONE_SERVER_INFO) if server_id and cookie then INTERNAL_COMM_D.notify_internal_result(cookie, reply.payload) return end local room_name, cookie = string.match(reply.channel, MATCH_ROOM_MSG_CHANNEL_USER) if room_name and cookie then return end end end function deal_with_respone_list(respone_list) for _,reply in ipairs(respone_list) do deal_with_reply(reply) end end local function time_update() local respone_list = REDIS_D.subs_get_reply() if respone_list ~= nil and #respone_list > 0 then deal_with_respone_list(respone_list) end end function create() set_timer(100, time_update, nil, true) end create()
local i18n = require "i18n" local lfs = require "lfs" return function(self) -- Set locale self.i18n = i18n local locale = self.req.headers["Content-Language"] or "en" i18n.setLocale(locale) i18n.loadFile("src/locale/en.lua") -- Get locale file local path = "src/locale" for file in lfs.dir(path) do local name, ext = string.match(file, "^(.+)%.(.+)$") if name == locale and ext == "lua" then i18n.loadFile(string.format("%s/%s.lua", path, name)) end end end
local shared = require("scripts.stageapi.shared") local mod = require("scripts.stageapi.mod") StageAPI.LogMinor("Loading Boss Handler") StageAPI.FloorInfo = {} StageAPI.FloorInfoGreed = {} local stageToGreed = { [LevelStage.STAGE1_1] = LevelStage.STAGE1_GREED, [LevelStage.STAGE2_1] = LevelStage.STAGE2_GREED, [LevelStage.STAGE3_1] = LevelStage.STAGE3_GREED, [LevelStage.STAGE4_1] = LevelStage.STAGE4_GREED, } local stageToSecondStage = { [LevelStage.STAGE1_1] = LevelStage.STAGE1_2, [LevelStage.STAGE2_1] = LevelStage.STAGE2_2, [LevelStage.STAGE3_1] = LevelStage.STAGE3_2, [LevelStage.STAGE4_1] = LevelStage.STAGE4_2, } StageAPI.StageTypes = { StageType.STAGETYPE_ORIGINAL, StageType.STAGETYPE_WOTL, StageType.STAGETYPE_AFTERBIRTH, StageType.STAGETYPE_REPENTANCE, StageType.STAGETYPE_REPENTANCE_B } local noBossStages = { [LevelStage.STAGE3_2] = true, [LevelStage.STAGE4_2] = true } -- if doGreed is false, will not add to greed at all, if true, will only add to greed. nil for both. -- if stagetype is true, will set floorinfo for all stagetypes function StageAPI.SetFloorInfo(info, stage, stagetype, doGreed) if stagetype == true then for _, stype in ipairs(StageAPI.StageTypes) do StageAPI.SetFloorInfo(StageAPI.DeepCopy(info), stage, stype, doGreed) end return end if doGreed ~= true then StageAPI.FloorInfo[stage] = StageAPI.FloorInfo[stage] or {} StageAPI.FloorInfo[stage][stagetype] = info local stageTwo = stageToSecondStage[stage] if stageTwo then StageAPI.FloorInfo[stageTwo] = StageAPI.FloorInfo[stageTwo] or {} local stageTwoInfo = StageAPI.DeepCopy(info) if noBossStages[stageTwo] then stageTwoInfo.Bosses = nil end StageAPI.FloorInfo[stageTwo][stagetype] = stageTwoInfo end end if doGreed ~= false then local greedStage = stage if doGreed == nil then greedStage = stageToGreed[stage] or stage end local greedInfo = StageAPI.DeepCopy(info) greedInfo.Bosses = nil StageAPI.FloorInfoGreed[greedStage] = StageAPI.FloorInfoGreed[greedStage] or {} StageAPI.FloorInfoGreed[greedStage][stagetype] = greedInfo end end function StageAPI.GetBaseFloorInfo(stage, stageType, isGreed) if stage == nil and stageType == nil and isGreed == nil then stage, stageType, isGreed = shared.Level:GetStage(), shared.Level:GetStageType(), shared.Game:IsGreedMode() end if isGreed then return StageAPI.FloorInfoGreed[stage][stageType] else return StageAPI.FloorInfo[stage][stageType] end end StageAPI.PlayerBossInfo = { [PlayerType.PLAYER_ISAAC] = {name = "isaac", id = "01"}, [PlayerType.PLAYER_MAGDALENE] = {name = "magdalene", id = "02"}, [PlayerType.PLAYER_CAIN] = {name = "cain", id = "03"}, [PlayerType.PLAYER_JUDAS] = {name = "judas", id = "04"}, [PlayerType.PLAYER_EVE] = {name = "eve", id = "05"}, [PlayerType.PLAYER_BLUEBABY] = {name = "bluebaby", id = "06"}, [PlayerType.PLAYER_SAMSON] = {name = "samson", id = "07"}, [PlayerType.PLAYER_AZAZEL] = {name = "azazel", id = "08"}, [PlayerType.PLAYER_LAZARUS] = {name = "lazarus", id = "09"}, [PlayerType.PLAYER_EDEN] = {name = "eden", id = "09"}, [PlayerType.PLAYER_THELOST] = {name = "thelost", id = "12"}, [PlayerType.PLAYER_LILITH] = {name = "lilith", id = "13"}, [PlayerType.PLAYER_KEEPER] = {name = "keeper", bossname = "thekeeper", id = "14"}, [PlayerType.PLAYER_APOLLYON] = {name = "apollyon", id = "15"}, [PlayerType.PLAYER_THEFORGOTTEN] = {name = "theforgotten", id = "16"}, [PlayerType.PLAYER_THESOUL] = {name = "theforgotten", id = "16"}, [PlayerType.PLAYER_BETHANY] = {name = "bethany", id = "01x"}, -- Esau isn't used in the transitions [PlayerType.PLAYER_ISAAC_B] = {name = "isaac", id = "01", b = true}, [PlayerType.PLAYER_MAGDALENE_B] = {name = "magdalene", id = "02", b = true}, [PlayerType.PLAYER_CAIN_B] = {name = "cain", id = "03", b = true}, [PlayerType.PLAYER_JUDAS_B] = {name = "judas", id = "04", b = true}, [PlayerType.PLAYER_EVE_B] = {name = "eve", id = "05", b = true}, [PlayerType.PLAYER_BLUEBABY_B] = {name = "bluebaby", id = "06", b = true}, [PlayerType.PLAYER_SAMSON_B] = {name = "samson", id = "07", b = true}, [PlayerType.PLAYER_AZAZEL_B] = {name = "azazel", id = "08", b = true}, [PlayerType.PLAYER_LAZARUS_B] = {name = "lazarus", id = "09", b = true}, [PlayerType.PLAYER_EDEN_B] = {name = "eden", id = "09", b = true}, [PlayerType.PLAYER_THELOST_B] = {name = "thelost", id = "12", b = true}, [PlayerType.PLAYER_LILITH_B] = {name = "lilith", id = "13", b = true}, [PlayerType.PLAYER_KEEPER_B] = {name = "keeper", bossname = "thekeeper", id = "14", b = true}, [PlayerType.PLAYER_APOLLYON_B] = {name = "apollyon", id = "15", b = true}, [PlayerType.PLAYER_THEFORGOTTEN_B] = {name = "theforgotten", id = "16", b = true}, [PlayerType.PLAYER_THESOUL_B] = {name = "theforgotten", id = "16", b = true}, [PlayerType.PLAYER_BETHANY_B] = {name = "bethany", id = "01x", b = true}, } for k, v in pairs(StageAPI.PlayerBossInfo) do local use = v.name local name if v.bossname then name = "gfx/ui/boss/playername_" .. v.id .. "_" .. v.bossname .. ".png" else name = "gfx/ui/boss/playername_" .. v.id .. "_" .. use .. ".png" end local portraitPath if v.b then portraitPath = "gfx/ui/stage/playerportrait_" .. use .. "_b.png" else portraitPath = "gfx/ui/stage/playerportrait_" .. use .. ".png" end StageAPI.PlayerBossInfo[k] = { Portrait = portraitPath, Name = name, } end StageAPI.PlayerBossInfo[PlayerType.PLAYER_BLUEBABY].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_KEEPER].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_THEFORGOTTEN].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_THESOUL].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_THEFORGOTTEN].ControlsFrame = 1 StageAPI.PlayerBossInfo[PlayerType.PLAYER_THESOUL].ControlsFrame = 1 StageAPI.PlayerBossInfo[PlayerType.PLAYER_THELOST].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_BLUEBABY_B].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_KEEPER_B].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_THEFORGOTTEN_B].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_THESOUL_B].NoShake = true StageAPI.PlayerBossInfo[PlayerType.PLAYER_THEFORGOTTEN_B].ControlsFrame = 1 StageAPI.PlayerBossInfo[PlayerType.PLAYER_THESOUL_B].ControlsFrame = 1 StageAPI.PlayerBossInfo[PlayerType.PLAYER_THELOST_B].NoShake = true -- bossportrait is optional since Repentance, used if you want -- your character to have a different boss portrait than the stage one function StageAPI.AddPlayerGraphicsInfo(playertype, portrait, namefile, noshake, bossportrait) local args = portrait if type(args) ~= "table" then args = { Portrait = portrait, Name = namefile, BossPortrait = bossportrait, NoShake = noshake, Controls = nil, ControlsFrame = 0, ControlsOffset = nil, } end StageAPI.PlayerBossInfo[playertype] = args end StageAPI.AddPlayerGraphicsInfo(PlayerType.PLAYER_BLACKJUDAS, "gfx/ui/stage/playerportrait_darkjudas.png", "gfx/ui/boss/playername_04_judas.png") StageAPI.AddPlayerGraphicsInfo(PlayerType.PLAYER_LAZARUS2, "gfx/ui/stage/playerportrait_lazarus2.png", "gfx/ui/boss/playername_10_lazarus.png") StageAPI.AddPlayerGraphicsInfo(PlayerType.PLAYER_LAZARUS2_B, "gfx/ui/stage/playerportrait_lazarus_b_dead.png", "gfx/ui/boss/playername_10_lazarus.png") StageAPI.AddPlayerGraphicsInfo(PlayerType.PLAYER_JACOB, "gfx/ui/stage/playerportrait_jacob.png", "gfx/ui/boss/playername_02x_jacob_esau.png") StageAPI.AddPlayerGraphicsInfo(PlayerType.PLAYER_JACOB_B, "gfx/ui/stage/playerportrait_jacob_b.png", "gfx/ui/boss/playername_02x_jacob.png") StageAPI.PlayerBossInfo[PlayerType.PLAYER_JACOB].ControlsFrame = 2 function StageAPI.GetStageSpot() if StageAPI.InNewStage() then return StageAPI.CurrentStage.BossSpot or "gfx/ui/boss/bossspot.png", StageAPI.CurrentStage.PlayerSpot or "gfx/ui/boss/playerspot.png", StageAPI.CurrentStage.BackgroundColor or Color(30/255, 18/255, 15/255, 1, 0, 0, 0), StageAPI.CurrentStage.DirtColor or Color(94/255, 56/255, 54/255, 1, 0, 0, 0) else local spot = StageAPI.GetBaseFloorInfo().Prefix return "gfx/ui/boss/bossspot_" .. spot .. ".png", "gfx/ui/boss/playerspot_" .. spot .. ".png", StageAPI.GetBaseFloorInfo().VsBgColor, StageAPI.GetBaseFloorInfo().VsDirtColor end end -- returns nil if no special color function StageAPI.GetStageFloorTextColor() if StageAPI.InNewStage() then return StageAPI.CurrentStage.FloorTextColor else return StageAPI.GetBaseFloorInfo().FloorTextColor end end function StageAPI.TryGetPlayerGraphicsInfo(player) local playerType if type(player) == "number" then playerType = player else playerType = player:GetPlayerType() end if StageAPI.PlayerBossInfo[playerType] then return StageAPI.PlayerBossInfo[playerType] else -- worth a shot, most common naming convention local playerName if type(player) == "string" then playerName = player elseif type(player) ~= "number" then playerName = player:GetName() else return StageAPI.PlayerBossInfo[PlayerType.PLAYER_ISAAC] end playerName = string.gsub(string.lower(playerName), "%s+", "") return { Portrait = "gfx/ui/stage/playerportrait_" .. playerName .. ".png", Name = "gfx/ui/boss/playername_" .. playerName .. ".png", } end end StageAPI.BossSprite = Sprite() StageAPI.BossSprite:Load("gfx/ui/boss/versusscreen.anm2", false) StageAPI.BossSprite:ReplaceSpritesheet(0, "none.png") StageAPI.BossSprite:ReplaceSpritesheet(11, "stageapi/boss/overlay.png") StageAPI.BossSpriteBg = Sprite() StageAPI.BossSpriteBg:Load("gfx/ui/boss/versusscreen.anm2", true) for i=1, 14 do StageAPI.BossSpriteBg:ReplaceSpritesheet(i, "none.png") end StageAPI.BossSpriteDirt = Sprite() StageAPI.BossSpriteDirt:Load("gfx/ui/boss/versusscreen.anm2", true) for i=0, 14 do StageAPI.BossSpriteDirt:ReplaceSpritesheet(i, "none.png") end StageAPI.PlayingBossSprite = nil StageAPI.PlayingBossSpriteBg = nil StageAPI.PlayingBossSpriteDirt = nil StageAPI.UnskippableBossAnim = nil StageAPI.BossOffset = nil function StageAPI.PlayBossAnimationManual(portrait, name, spot, playerPortrait, playerName, playerSpot, portraitTwo, unskippable, bgColor, dirtColor, noSkake) local paramTable = portrait if type(paramTable) ~= "table" then paramTable = { BossPortrait = portrait, BossPortraitTwo = portraitTwo, BossName = name, BossSpot = spot, PlayerPortrait = playerPortrait, PlayerName = playerName, PlayerSpot = playerSpot, Unskippable = unskippable, BackgroundColor = bgColor, DirtColor = dirtColor, NoShake = noShake } end if paramTable.Sprite then -- if you need to use a different sprite (ex for a special boss animation) this could help StageAPI.PlayingBossSprite = paramTable.Sprite else StageAPI.PlayingBossSprite = StageAPI.BossSprite StageAPI.PlayingBossSpriteBg = StageAPI.BossSpriteBg StageAPI.PlayingBossSpriteDirt = StageAPI.BossSpriteDirt end if not paramTable.NoLoadGraphics then StageAPI.PlayingBossSprite:ReplaceSpritesheet(2, paramTable.BossSpot or "gfx/ui/boss/bossspot.png") StageAPI.PlayingBossSprite:ReplaceSpritesheet(3, paramTable.PlayerSpot or "gfx/ui/boss/bossspot.png") StageAPI.PlayingBossSprite:ReplaceSpritesheet(4, paramTable.BossPortrait or "gfx/ui/boss/portrait_20.0_monstro.png") StageAPI.PlayingBossSpriteDirt:ReplaceSpritesheet(13, paramTable.BossPortrait or "gfx/ui/boss/portrait_20.0_monstro.png") StageAPI.PlayingBossSprite:ReplaceSpritesheet(6, paramTable.PlayerName or "gfx/ui/boss/bossname_20.0_monstro.png") StageAPI.PlayingBossSprite:ReplaceSpritesheet(7, paramTable.BossName or "gfx/ui/boss/bossname_20.0_monstro.png") if paramTable.NoShake then StageAPI.PlayingBossSprite:ReplaceSpritesheet(5, "none.png") StageAPI.PlayingBossSprite:ReplaceSpritesheet(12, paramTable.PlayerPortrait or "gfx/ui/boss/portrait_20.0_monstro.png") else StageAPI.PlayingBossSprite:ReplaceSpritesheet(5, paramTable.PlayerPortrait or "gfx/ui/boss/portrait_20.0_monstro.png") StageAPI.PlayingBossSprite:ReplaceSpritesheet(12, "none.png") end if paramTable.BossPortraitTwo then StageAPI.PlayingBossSprite:ReplaceSpritesheet(9, paramTable.BossPortraitTwo) StageAPI.PlayingBossSpriteDirt:ReplaceSpritesheet(14, paramTable.BossPortraitTwo) paramTable.Animation = paramTable.Animation or "DoubleTrouble" end StageAPI.PlayingBossSprite:Play(paramTable.Animation or "Scene", true) StageAPI.PlayingBossSprite:LoadGraphics() StageAPI.PlayingBossSpriteBg.Color = paramTable.BackgroundColor or Color(0, 0, 0, 1, 0, 0, 0) StageAPI.PlayingBossSpriteBg:Play(paramTable.Animation or "Scene", true) StageAPI.PlayingBossSpriteDirt.Color = paramTable.DirtColor or Color(1, 1, 1, 1, 0, 0, 0) StageAPI.PlayingBossSpriteDirt:Play(paramTable.Animation or "Scene", true) StageAPI.PlayingBossSpriteDirt:LoadGraphics() end if paramTable.BossOffset then StageAPI.BossOffset = paramTable.BossOffset else StageAPI.BossOffset = nil end StageAPI.UnskippableBossAnim = paramTable.Unskippable end StageAPI.IsOddRenderFrame = nil local menuConfirmTriggered mod:AddCallback(ModCallbacks.MC_POST_RENDER, function() StageAPI.IsOddRenderFrame = not StageAPI.IsOddRenderFrame local isPlaying = StageAPI.PlayingBossSprite and StageAPI.PlayingBossSprite:IsPlaying() if isPlaying and ((shared.Game:IsPaused() and not menuConfirmTriggered) or StageAPI.UnskippableBossAnim) then if StageAPI.IsOddRenderFrame then StageAPI.PlayingBossSprite:Update() StageAPI.PlayingBossSpriteBg:Update() StageAPI.PlayingBossSpriteDirt:Update() end local centerPos = StageAPI.GetScreenCenterPosition() --local layerRenderOrder = {0,1,2,3,14,9,13,4,5,6,7,8,10} --ab+ classy vs screen's compability layer order local layerRenderOrder = {0,1,2,3,9,14,13,4,5,12,11,6,7,8,10} StageAPI.PlayingBossSpriteBg:RenderLayer(0, centerPos) for _, layer in ipairs(layerRenderOrder) do local pos = centerPos if StageAPI.BossOffset then local isDoubleTrouble = StageAPI.BossOffset.One or StageAPI.BossOffset.Two if isDoubleTrouble then -- Double trouble, table {One = Vector, Two = Vector} if layer == 4 or layer == 13 then pos = pos + StageAPI.BossOffset.One or Vector.Zero elseif layer == 9 or layer == 14 then pos = pos + StageAPI.BossOffset.Two or Vector.Zero end elseif layer == 4 or layer == 13 then pos = pos + StageAPI.BossOffset end end if layer == 13 or layer == 14 then StageAPI.PlayingBossSpriteDirt:RenderLayer(layer, pos) else StageAPI.PlayingBossSprite:RenderLayer(layer, pos) end end elseif isPlaying or StageAPI.PlayingBossSprite then StageAPI.PlayingBossSprite:Stop() StageAPI.PlayingBossSprite = nil StageAPI.PlayingBossSpriteBg:Stop() StageAPI.PlayingBossSpriteBg = nil StageAPI.PlayingBossSpriteDirt:Stop() StageAPI.PlayingBossSpriteDirt = nil end if not isPlaying then StageAPI.UnskippableBossAnim = nil StageAPI.BossOffset = nil end menuConfirmTriggered = nil for _, player in ipairs(shared.Players) do if Input.IsActionTriggered(ButtonAction.ACTION_MENUCONFIRM, player.ControllerIndex) then menuConfirmTriggered = true break end end end) StageAPI.Bosses = {} function StageAPI.AddBossData(id, bossData) StageAPI.Bosses[id] = bossData if not bossData.Name then bossData.Name = id end if not bossData.Weight then bossData.Weight = 1 end return id end function StageAPI.GetBossData(id) return StageAPI.Bosses[id] end function StageAPI.PlayBossAnimation(boss, unskippable) local bSpot, pSpot, bgColor, dirtColor = StageAPI.GetStageSpot() local gfxData = StageAPI.TryGetPlayerGraphicsInfo(shared.Players[1]) StageAPI.PlayBossAnimationManual({ BossPortrait = boss.Portrait, BossPortraitTwo = boss.PortraitTwo, BossName = boss.BossName or boss.Bossname, BossSpot = boss.Spot or bSpot, PlayerPortrait = gfxData.BossPortrait or gfxData.Portrait, PlayerName = gfxData.Name, PlayerSpot = pSpot, Unskippable = unskippable, BossOffset = boss.Offset, BackgroundColor = bgColor, DirtColor = dirtColor, NoShake = gfxData.NoShake }) end local horsemanRoomSubtypes = { 9, -- Famine 10, -- Pestilence 11, -- War 12, -- Death 22, -- Headless Horseman 38 -- Conquest } StageAPI.EncounteredBosses = {} function StageAPI.SetBossEncountered(name, encountered) if encountered == nil then encountered = true end StageAPI.EncounteredBosses[name] = encountered end function StageAPI.GetBossEncountered(name) return StageAPI.EncounteredBosses[name] end mod:AddCallback(ModCallbacks.MC_POST_GAME_STARTED, function(_, continued) if not continued then StageAPI.EncounteredBosses = {} end end) StageAPI.BossSelectRNG = RNG() function StageAPI.SelectBoss(bosses, rng, roomDesc, ignoreNoOptions) local bossID = StageAPI.CallCallbacks("PRE_BOSS_SELECT", true, bosses, rng, roomDesc, ignoreNoOptions) if type(bossID) == "table" then bosses = bossID bossID = nil end if not bossID then roomDesc = roomDesc or shared.Level:GetCurrentRoomDesc() local roomSubtype = roomDesc.Data.Subtype local isHorsemanRoom = StageAPI.IsIn(horsemanRoomSubtypes, roomSubtype) local floatWeights local totalUnencounteredWeight = 0 local totalValidWeight = 0 local totalForcedWeight = 0 local unencounteredBosses = {} local validBosses = {} local forcedBosses = {} local pool = bosses.Pool or bosses for _, potentialBossID in ipairs(pool) do local poolEntry if type(potentialBossID) == "table" then poolEntry = potentialBossID potentialBossID = poolEntry.BossID else poolEntry = { BossID = potentialBossID } end local potentialBoss = StageAPI.GetBossData(potentialBossID) local encountered = StageAPI.GetBossEncountered(potentialBoss.Name) if not encountered and potentialBoss.NameTwo then encountered = StageAPI.GetBossEncountered(potentialBoss.NameTwo) end local weight = poolEntry.Weight or potentialBoss.Weight or 1 local forced local invalid if potentialBoss.Rooms then local validRooms, validRoomWeights = StageAPI.GetValidRoomsForLayout{ RoomList = potentialBoss.Rooms, RoomDescriptor = roomDesc } if #validRooms == 0 or validRoomWeights == 0 then invalid = true end end if not invalid then if isHorsemanRoom then if poolEntry.AlwaysReplaceHorsemen or potentialBoss.AlwaysReplaceHorsemen then forced = true elseif not (poolEntry.Horseman or potentialBoss.Horseman) then invalid = true end elseif poolEntry.OnlyReplaceHorsemen or potentialBoss.OnlyReplaceHorsemen then invalid = true end if poolEntry.AlwaysReplaceSubtype and not invalid then if roomSubtype == poolEntry.AlwaysReplaceSubtype then forced = true end end if poolEntry.OnlyReplaceSubtype and not invalid then if roomSubtype ~= poolEntry.OnlyReplaceSubtype then invalid = true end end end if not invalid then if forced then totalForcedWeight = totalForcedWeight + weight forcedBosses[#forcedBosses + 1] = {potentialBossID, weight} end if not encountered then totalUnencounteredWeight = totalUnencounteredWeight + weight unencounteredBosses[#unencounteredBosses + 1] = {potentialBossID, weight} end totalValidWeight = totalValidWeight + weight validBosses[#validBosses + 1] = {potentialBossID, weight} end if weight % 1 ~= 0 then floatWeights = true end end if not rng then rng = StageAPI.BossSelectRNG rng:SetSeed(roomDesc.SpawnSeed, 0) end if #forcedBosses > 0 then bossID = StageAPI.WeightedRNG(forcedBosses, rng, nil, totalForcedWeight, floatWeights) elseif #unencounteredBosses > 0 then bossID = StageAPI.WeightedRNG(unencounteredBosses, rng, nil, totalUnencounteredWeight, floatWeights) elseif #validBosses > 0 then bossID = StageAPI.WeightedRNG(validBosses, rng, nil, totalValidWeight, floatWeights) elseif not ignoreNoOptions then local err = "Trying to select boss, but none are valid! Options were:\n" for _, potentialBossID in ipairs(bosses) do err = err .. potentialBossID .. "\n" end StageAPI.LogErr(err) end end return bossID end function StageAPI.AddBossToBaseFloorPool(poolEntry, stage, stageType, noStageTwo) if not poolEntry or type(poolEntry) ~= "table" or not poolEntry.BossID then StageAPI.LogErr("AddBossToBaseFloorPool requires a PoolEntry table with BossID set") return end if not StageAPI.GetBossData(poolEntry.BossID) then StageAPI.LogErr("Attempting to add invalid boss id " .. poolEntry.BossID .. " to pool") return end local floorInfo = StageAPI.GetBaseFloorInfo(stage, stageType, false) floorInfo.HasCustomBosses = true if not floorInfo.Bosses then floorInfo.Bosses = {Pool = {}} end floorInfo.Bosses.Pool[#floorInfo.Bosses.Pool + 1] = poolEntry if not noStageTwo then local stageTwo = stageToSecondStage[stage] if stageTwo and not noBossStages[stageTwo] then StageAPI.AddBossToBaseFloorPool(poolEntry, stageTwo, stageType, true) end end end
test_run = require('test_run').new() -- -- When master's registering an anonymous replica, it might ignore the replica's -- current vclock, and skip the data in range (replica_clock, master_clock). -- box.schema.user.grant('guest', 'replication') _ = box.schema.space.create('test') _ = box.space.test:create_index('pk') test_run:cmd('create server replica with rpl_master=default,\ script="replication/anon1.lua"') test_run:cmd('start server replica') test_run:wait_lsn('replica', 'default') box.error.injection.set('ERRINJ_RELAY_SEND_DELAY', true) box.space.test:insert{1} test_run:switch('replica') test_run:wait_upstream(1, {status='disconnected'}) box.space.test:select{} fiber = require('fiber') f = fiber.new(function() box.cfg{replication_anon=false} end) test_run:wait_upstream(1, {status='register'}) test_run:switch('default') box.error.injection.set('ERRINJ_RELAY_SEND_DELAY', false) box.space.test:insert{2} test_run:switch('replica') test_run:wait_lsn('replica', 'default') f:status() box.space.test:select{} -- Cleanup test_run:switch('default') test_run:cmd('stop server replica') test_run:cmd('delete server replica') box.space.test:drop() box.schema.user.revoke('guest', 'replication')
module 'mock' --TODO: a generic anim curve & attr manager -------------------------------------------------------------------- --Simple helpers -------------------------------------------------------------------- -- function simpleCurveAnim() -- local anim = MOAIAnim.new() -- end function buildAnimCurve( keys ) local curve = MOAIAnimCurve.new() local count = #keys curve:reserveKeys( count ) for i, entry in ipairs( keys ) do local t, value, ease, weight = unpack( entry ) curve:setKey( i, t, value, ease or MOAIEaseType.LINEAR, weight or 1 ) end return curve end function buildAttrAnim( prop, attr, keys, animMode, asDelta ) local curve = buildAnimCurve( keys ) local anim = MOAIAnim.new() anim:reserveLinks( 1 ) anim:setLink( 1, curve, prop, attr, asDelta ) anim:setMode( animMode or MOAITimer.NORMAL ) return anim, curve end function buildMultiAttrAnim( prop, attrs, keys, animMode, asDelta ) local curve = buildAnimCurve( keys ) local anim = MOAIAnim.new() anim:setMode( animMode or MOAITimer.NORMAL ) local count = #attrs anim:reserveLinks( count ) for i, attr in ipairs( attrs ) do anim:setLink( i, curve, prop, attr, asDelta ) end return anim, curve end function buildSimpleRotationAnim( prop, from, to, duration, easeMode, animMode, asDelta ) easeMode = easeMode or MOAIEaseType.LINEAR return buildAttrAnim( prop, MOAIProp.ATTR_Z_ROT, { { 0, from }, { duration, to, easeMode }, }, animMode, asDelta ) end
-- nvim-lspconfig -- Configure available LSPs -- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md -- -- Note that all languag e servers aside from `sumneko_lua` are installed via Nix. See: -- `../../../../home/neovim.nix`. vim.cmd 'packadd nvim-lspconfig' local lspconf = require 'lspconfig' lspconf.bashls.setup {} lspconf.ccls.setup {} lspconf.hls.setup {} lspconf.jsonls.setup {} lspconf.rnix.setup {} lspconf.sourcekit.setup {} local runtime_path = vim.split(package.path, ';') table.insert(runtime_path, "lua/?.lua") table.insert(runtime_path, "lua/?/init.lua") lspconf.sumneko_lua.setup { settings = { Lua = { runtime = { -- Tell the language server which version of Lua you're using (LuaJIT in the case of Neovim) version = 'LuaJIT', -- Setup your lua path path = runtime_path, }, diagnostics = { -- Get the language server to recognize the `vim` global globals = { 'vim' }, }, workspace = { -- Make the server aware of Neovim runtime files library = vim.api.nvim_get_runtime_file("", true), }, telemetry = { enable = false, }, }, }, } lspconf.tsserver.setup {} lspconf.vimls.setup { init_options = { iskeyword = '@,48-57,_,192-255,-#', vimruntime = vim.env.VIMRUNTIME, runtimepath = vim.o.runtimepath, diagnostic = { enable = true, }, indexes = { runtimepath = true, gap = 100, count = 8, projectRootPatterns = { "runtime", "nvim", ".git", "autoload", "plugin" }, }, suggest = { fromRuntimepath = true, fromVimruntime = true }, } } lspconf.yamlls.setup { settings = { yaml = { format = { printWidth = 100, singleQuote = true, }, }, }, } lspconf.hls.setup({ settings = { haskell = { hlintOn = true, formattingProvider = "fourmolu" } } })
package("muslcc") set_kind("toolchain") set_homepage("https://musl.cc/") set_description("static cross- and native- musl-based toolchains.") if is_host("windows") then if is_arch("arm64") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/aarch64-linux-musl-cross.win.zip") add_versions("20210202", "1fa7226fb2317fa8dd1571f2a8964e8e4bb973479ec18e35e04b6b0606ff2eba") elseif is_arch("arm.*") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/arm-linux-musleabi-cross.win.zip") add_versions("20210202", "87061cdc288b6a74b3414bb70ce91da524c126199548cf4b86ae40e074988291") elseif is_arch("x86", "i386") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/i686-linux-musl-cross.win.zip") add_versions("20210202", "5f2903646a4bdd45d6dadfa65652a3bfe4191eab2e5b0ae1dd9b2e6ccf87f629") else set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/x86_64-linux-musl-cross.win.zip") add_versions("20210202", "3a13f8bb3694b26ffbe3fe97d45db6cabadb662161cd5fc9cc80fc0adfb02091") end elseif is_host("linux") then if is_arch("arm64") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/aarch64-linux-musl-cross.linux.tgz") add_versions("20210202", "7e237ecd528d31cb3eadc48a95f4779467f588a89444c43276c77cdfe93787de") elseif is_arch("arm.*") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/arm-linux-musleabi-cross.linux.tgz") add_versions("20210202", "4e03e69f30eacf6bb573999b5a20c59e320720ed02edccfebfa6f89a9e76b445") elseif is_arch("x86", "i386") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/i686-linux-musl-cross.linux.tgz") add_versions("20210202", "411e98b50c2f965ec0c7d752896151dc2068060e583f0eb245f2c86556d749c3") else set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/x86_64-linux-musl-cross.linux.tgz") add_versions("20210202", "37ef7b69d4c4a20bb2c5e7e01ec7c60c1ac7de2c33b029eaa6c0d8b9e1869c6b") end elseif is_host("macosx") then if is_arch("arm64") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/aarch64-linux-musl-cross.mac.tgz") add_versions("20210202", "5b3e91ebc430428578fa2a443256aca866e61da886d5f645eee9725485877389") elseif is_arch("arm.*") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/arm-linux-musleabi-cross.mac.tgz") add_versions("20210202", "a177df3f847181c0c7f2b34b9bd7725b4c556c11a347aa0ae36e09ebf23fb480") elseif is_arch("x86", "i386") then set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/i686-linux-musl-cross.mac.tgz") add_versions("20210202", "12cd8be154c122f6957ce21a9a5ff2d55a8bd660707b17fb3248578ac955ba25") else set_urls("https://github.com/xmake-mirror/musl.cc/releases/download/$(version)/x86_64-linux-musl-cross.mac.tgz") add_versions("20210202", "09e63d9ec8d2e21643750b9543fb138e59c8e255e5a0ae86bc099368addead89") end end if is_host("macosx") then -- fix missing libisl.22.dylib add_deps("libisl 0.22", {host = true, configs = {shared = true}}) end on_install("@windows", "@msys", "@linux", "@macosx", function (package) os.tryrm("usr") -- remove soft link -- fix missing libisl.22.dylib if is_host("macosx") then local function patchbin(bin_name) local cross if package:is_targetarch("arm64") then cross = "aarch64-linux-musl-" elseif package:is_targetarch("arm.*") then cross = "arm-linux-musleabi-" elseif package:is_targetarch("x86", "i386") then cross = "i686-linux-musl-" else cross = "x86_64-linux-musl-" end local binfile = path.join("bin", cross .. bin_name) local binfile_raw = binfile .. "-raw" os.mv(binfile, binfile_raw) io.writefile(binfile, ([[ #!/usr/bin/env bash export DYLD_LIBRARY_PATH="%s" "%s" "$@"]]):format(package:dep("libisl"):installdir("lib"), path.join(package:installdir(), binfile_raw))) os.vrunv("chmod", {"777", binfile}) end patchbin("gcc") patchbin("g++") end os.vcp("*", package:installdir()) end) on_test(function (package) local gcc if package:is_targetarch("arm64") then gcc = "aarch64-linux-musl-gcc" elseif package:is_targetarch("arm.*") then gcc = "arm-linux-musleabi-gcc" elseif package:is_targetarch("x86", "i386") then gcc = "i686-linux-musl-gcc" else gcc = "x86_64-linux-musl-gcc" end if gcc and is_host("windows") then gcc = gcc .. ".exe" end local file = os.tmpfile() .. ".c" io.writefile(file, "int main(int argc, char** argv) {return 0;}") os.vrunv(gcc, {"-c", file}) end)
return { entities = { {"accumulator", {x = 1, y = -3}, {dead = 0.4}}, {"accumulator", {x = 3, y = -3}, {dead = 0.4}}, {"accumulator", {x = -3, y = -2}, {dead = 0.4}}, {"medium-electric-pole-remnants", {x = -0.5, y = -1.5}, {}}, {"laser-turret-remnants", {x = -2, y = 1}, {dir = "south", }}, {"laser-turret-remnants", {x = 1, y = 1}, {dir = "south", }}, {"stone-wall", {x = -2.5, y = 3.5}, {dead = 0.4}}, {"stone-wall", {x = -0.5, y = 3.5}, {dead = 0.4}}, {"stone-wall", {x = -1.5, y = 3.5}, {dead = 0.4}}, {"stone-wall", {x = 1.5, y = 3.5}, {dead = 0.4}}, {"stone-wall", {x = 0.5, y = 3.5}, {dead = 0.4}}, {"stone-wall", {x = 3.5, y = 3.5}, {dead = 0.4}}, }, tiles = { {"refined-hazard-concrete-right", {x = -4, y = -1}}, {"refined-hazard-concrete-right", {x = -4, y = 0}}, {"refined-hazard-concrete-right", {x = -4, y = 1}}, {"refined-hazard-concrete-right", {x = -4, y = 2}}, {"refined-hazard-concrete-right", {x = -3, y = -1}}, {"refined-concrete", {x = -3, y = 0}}, {"refined-hazard-concrete-right", {x = -3, y = 1}}, {"refined-hazard-concrete-right", {x = -3, y = 2}}, {"stone-path", {x = -2, y = -1}}, {"refined-concrete", {x = -2, y = 0}}, {"refined-hazard-concrete-right", {x = -2, y = 1}}, {"refined-hazard-concrete-right", {x = -2, y = 2}}, {"stone-path", {x = -1, y = -1}}, {"refined-hazard-concrete-right", {x = -1, y = 0}}, {"refined-hazard-concrete-right", {x = -1, y = 1}}, {"refined-hazard-concrete-right", {x = -1, y = 2}}, {"stone-path", {x = 0, y = -1}}, {"refined-hazard-concrete-right", {x = 0, y = 0}}, {"refined-hazard-concrete-right", {x = 0, y = 1}}, {"refined-concrete", {x = 0, y = 2}}, {"refined-concrete", {x = 1, y = -1}}, {"refined-hazard-concrete-right", {x = 1, y = 0}}, {"refined-hazard-concrete-right", {x = 1, y = 1}}, {"stone-path", {x = 1, y = 2}}, {"refined-hazard-concrete-right", {x = 2, y = -1}}, {"refined-hazard-concrete-right", {x = 2, y = 0}}, {"refined-hazard-concrete-right", {x = 2, y = 1}}, {"stone-path", {x = 2, y = 2}}, } }
ESX.Trace = function(msg) if Config.EnableDebug then print(('[es_extended] [^2TRACE^7] %s^7'):format(msg)) end end ESX.SetTimeout = function(msec, cb) local id = ESX.TimeoutCount + 1 SetTimeout(msec, function() if ESX.CancelledTimeouts[id] then ESX.CancelledTimeouts[id] = nil else cb() end end) ESX.TimeoutCount = id return id end ESX.RegisterCommand = function(name, group, cb, allowConsole, suggestion) if type(name) == 'table' then for k,v in ipairs(name) do ESX.RegisterCommand(v, group, cb, allowConsole, suggestion) end return end if ESX.RegisteredCommands[name] then print(('[es_extended] [^3WARNING^7] An command "%s" is already registered'):format(name)) else if suggestion then if not suggestion.arguments then suggestion.arguments = {} end if not suggestion.help then suggestion.help = '' end end ESX.RegisteredCommands[name] = {group = group, cb = cb, allowConsole = allowConsole, suggestion = suggestion} RegisterCommand(name, function(playerId, args, rawCommand) local command = ESX.RegisteredCommands[name] if not command.allowConsole and playerId == 0 then print('[es_extended] [^3WARNING^7] That command can not be run from console') else local xPlayer, error = ESX.GetPlayerFromId(playerId), nil if command.suggestion then if command.suggestion.validate then if #args ~= #command.suggestion.arguments then error = ('Argument count mismatch (passed %s, wanted %s)'):format(#args, #command.suggestion.arguments) end end if not error and command.suggestion.arguments then local newArgs = {} for k,v in ipairs(command.suggestion.arguments) do if v.type then if v.type == 'number' then local newArg = tonumber(args[k]) if newArg then newArgs[v.name] = newArg else error = ('Argument #%s type mismatch (passed string, wanted number)'):format(k) end elseif v.type == 'player' then local targetPlayer = tonumber(args[k]) if targetPlayer then local xTargetPlayer = ESX.GetPlayerFromId(targetPlayer) if xTargetPlayer then newArgs[v.name] = xTargetPlayer else error = 'Player not online' end else error = ('Argument #%s type mismatch (passed string, wanted number)'):format(k) end elseif v.type == 'string' then newArgs[v.name] = args[k] elseif v.type == 'item' then if ESX.Items[args[k]] then newArgs[v.name] = args[k] else error = _U('invalid_item') end elseif v.type == 'weapon' then if ESX.GetWeapon(args[k]) then newArgs[v.name] = string.upper(args[k]) else error = 'Invalid weapon' end elseif v.type == 'any' then newArgs[v.name] = args[k] end end if error then break end end args = newArgs end end if error then if playerId == 0 then print(('[es_extended] [^3WARNING^7] %s^7'):format(error)) else xPlayer.triggerEvent('chat:addMessage', {args = {'^1SYSTEM', error}}) end else cb(xPlayer, args, function(msg) if playerId == 0 then print(('[es_extended] [^3WARNING^7] %s^7'):format(msg)) else xPlayer.triggerEvent('chat:addMessage', {args = {'^1SYSTEM', msg}}) end end) end end end, true) ExecuteCommand(('add_ace group.%s command.%s allow'):format(group, name)) end end ESX.ClearTimeout = function(id) ESX.CancelledTimeouts[id] = true end ESX.RegisterServerCallback = function(name, cb) ESX.ServerCallbacks[name] = cb end ESX.TriggerServerCallback = function(name, requestId, source, cb, ...) if ESX.ServerCallbacks[name] ~= nil then ESX.ServerCallbacks[name](source, cb, ...) else print(('[es_extended] [^3WARNING^7] Server callback "%s" does not exist. Make sure that the server sided file really is loading, an error in that file might cause it to not load.'):format(name)) end end ESX.SavePlayer = function(xPlayer, cb) local asyncTasks = {} -- User accounts for k,v in ipairs(xPlayer.accounts) do if ESX.LastPlayerData[xPlayer.source].accounts[v.name] ~= v.money then table.insert(asyncTasks, function(cb) MySQL.Async.execute('UPDATE user_accounts SET money = @money WHERE identifier = @identifier AND name = @name', { ['@money'] = v.money, ['@identifier'] = xPlayer.identifier, ['@name'] = v.name }, function(rowsChanged) cb() end) end) ESX.LastPlayerData[xPlayer.source].accounts[v.name] = v.money end end -- Job, loadout, inventory and position table.insert(asyncTasks, function(cb) MySQL.Async.execute('UPDATE users SET job = @job, job_grade = @job_grade, loadout = @loadout, position = @position, inventory = @inventory WHERE identifier = @identifier', { ['@job'] = xPlayer.job.name, ['@job_grade'] = xPlayer.job.grade, ['@loadout'] = json.encode(xPlayer.getLoadout()), ['@position'] = json.encode(xPlayer.getCoords()), ['@identifier'] = xPlayer.identifier, ['@inventory'] = json.encode(xPlayer.getInventory(true)) }, function(rowsChanged) cb() end) end) Async.parallel(asyncTasks, function(results) print(('[es_extended] [^2INFO^7] Saved player "%s^7"'):format(xPlayer.getName())) if cb ~= nil then cb() end end) end ESX.SavePlayers = function(cb) local asyncTasks = {} local xPlayers = ESX.GetPlayers() for i=1, #xPlayers, 1 do table.insert(asyncTasks, function(cb) local xPlayer = ESX.GetPlayerFromId(xPlayers[i]) ESX.SavePlayer(xPlayer, cb) end) end Async.parallelLimit(asyncTasks, 8, function(results) print(('[es_extended] [^2INFO^7] Saved %s player(s)'):format(#xPlayers)) if cb ~= nil then cb() end end) end ESX.StartDBSync = function() function saveData() ESX.SavePlayers() SetTimeout(10 * 60 * 1000, saveData) end SetTimeout(10 * 60 * 1000, saveData) end ESX.GetPlayers = function() local sources = {} for k,v in pairs(ESX.Players) do table.insert(sources, k) end return sources end ESX.GetPlayerFromId = function(source) return ESX.Players[tonumber(source)] end ESX.GetPlayerFromIdentifier = function(identifier) for k,v in pairs(ESX.Players) do if v.identifier == identifier then return v end end end ESX.RegisterUsableItem = function(item, cb) ESX.UsableItemsCallbacks[item] = cb end ESX.UseItem = function(source, item) ESX.UsableItemsCallbacks[item](source) end ESX.GetItemLabel = function(item) if ESX.Items[item] ~= nil then return ESX.Items[item].label end end ESX.CreatePickup = function(type, name, count, label, playerId, components, tintIndex) local pickupId = (ESX.PickupId == 65635 and 0 or ESX.PickupId + 1) local xPlayer = ESX.GetPlayerFromId(playerId) ESX.Pickups[pickupId] = { type = type, name = name, count = count, label = label, coords = xPlayer.getCoords(), } if type == 'item_weapon' then ESX.Pickups[pickupId].components = components ESX.Pickups[pickupId].tintIndex = tintIndex end TriggerClientEvent('esx:createPickup', -1, pickupId, label, playerId, type, name, components, tintIndex) ESX.PickupId = pickupId end ESX.DoesJobExist = function(job, grade) grade = tostring(grade) if job and grade then if ESX.Jobs[job] and ESX.Jobs[job].grades[grade] then return true end end return false end
-- -- YATM Spacetime deals with instant transportion and other space and time manipulating nodes. -- local mod = foundation.new_module("yatm_spacetime", "1.1.0") mod:require("util.lua") mod:require("spacetime_meta.lua") mod:require("spacetime_network.lua") mod:require("api.lua") mod:require("nodes.lua") mod:require("items.lua") minetest.register_lbm({ name = "yatm_spacetime:addressable_spacetime_device_lbm", nodenames = { "group:addressable_spacetime_device", }, run_at_every_load = true, action = function (pos, node) yatm_spacetime.network:maybe_update_node(pos, node) end, }) if foundation.com.Luna then mod:require("tests.lua") end
includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_maul_legendary.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_sword_avatar_wke_toothpick.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_sword_kashyyk.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_sword_kun_massassi.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_sword_obsidian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_sword_pvp_bf.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_sword_scythe.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_sword_sith.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_2h_sword_tulrus.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_axe.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_axe_vibro.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_baton_avatar_trando_stun_stick.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_baton_gaderiffi.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_baton_stun.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_battleaxe.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_battleaxe_quest.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_blasterfist.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_bowcaster_assault.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_bowcaster_recon.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_alliance_needler.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_avatar_trandoshan.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_blaster_cdef.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_blaster_cdef_corsec.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_bothan_bola.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_czerka_dart.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_dc15.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_e11_mk2.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_e5.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_e5_legendary.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_ee3_bounty.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_gcw_charric.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_geo.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_heroic_sd.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_kun_massassi.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_mandalorian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_ngant_pvp.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_nym_slugthrower.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_proton.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_quest_smuggler_underslung.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_republic_sfor.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_slug.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_specops_bothan_carbine.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_underslung.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_carbine_wookiee_bowcaster.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_cleaver.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_executioners_hack.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_gaderiffi_elite.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_acid_beam.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_avatar_acid_beam.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_carbonite_rifle.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_cr1_pvp.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_lava_cannon.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_lightning_beam.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_mandalorian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_particle_beam.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_pulse_cannon.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_republic_flamer.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_rocket_launcher.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_heavy_shotgun.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_katana.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_katana_quest.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_donkuwah.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_janta.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_naktra_crystal.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_stone.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_survival.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_trando_skinner.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_twilek_dagger.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_vibroblade.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knife_vibroblade_quest.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knuckler_pvp.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_knuckler_vibro.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_avatar_wke_heartlance.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_cryo.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_energy_legendary.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_kaminoan.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_massassi.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_nightsister.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_obsidian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_shock.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_trando.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_vibro.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_vibro_controller_fp.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_vibro_nightsister.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_lance_xandank.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_blackbane.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_blackfalcon.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_blackhand.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_calibrated.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_corellian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_corestrike.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_darksting.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_dawnsorrow.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_deathrain.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_dragoneye.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_eventide.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_executer.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_firestar.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_grievance.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_heartstriker.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_hydra.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_lifeblood.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_liquidsilver.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_mark.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_necrosis.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_nullifier.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_pestilence.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_poisonspike.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_quicktrigger.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_retaliation.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_retribution.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_rhiss.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_rilctur.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_ripper.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_sharpshooter.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_sickle.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_silencer.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_soulstinger.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_strike.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_loot_void.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_massassiknuckler.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_maul.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_metal_fan_knuckler.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_alliance_disruptor.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_avatar_trando_special.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_cdef.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_cdef_corsec.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_d18.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_dh17.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_dl44.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_dl44_metal.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_power5.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_scout_trooper.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_scout_trooper_corsec.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_blaster_short_range_combat.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_dd6.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_deathhammer_needle.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_de_10.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_dh_18a.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_disrupter.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_disrupter_dx2.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_dl44_metal_light.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_flare.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_flechette.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_flechette_fwg5.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_flechette_fwg5_quest.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_fwg5_legendary.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_geo_sonic_blaster.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_heroic_exar.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_heroic_sd.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_intimidator.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_ion_relic.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_ion_stunner.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_jawa.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_kyd21.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_launcher.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_launcher_elite.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_launcher_medium.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_mandalorian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_projectile_striker.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_quest_imperial_navy_formal.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_rebel.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_renegade.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_republic_blaster.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_republic_blaster_quest.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_scatter.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_scatter_light.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_trando_suppressor.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_westar_pvp.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_wookiee.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_pistol_wookiee_bowcaster.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_polearm_electric.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_polearm_gcw_gand_shockprod.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_polearm_heroic_sd.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_polearm_kashyyk_bladestick.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_polearm_magnaguard_pvp.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_poleaxe_vibro.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_punch_dagger.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_battleaxe.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_heavy_acid_beam.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_heavy_particle_beam.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_maul.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_pistol_launcher.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_pistol_republic_blaster_quest.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_rifle_flame_thrower.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_rifle_lightning.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_quest_rifle_projectile_tusken.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_razor_knuckler.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_a280.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_acid_beam.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_adventurer_hv_sniper.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_avatar_laser_trando.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_beam.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_berserker.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_blaster_cdef.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_blaster_dlt20.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_blaster_dlt20a.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_blaster_e11.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_blaster_ionization_jawa.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_blaster_laser_rifle.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_bowcaster.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_bowcaster_master.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_dc15.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_dc15_bounty.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_deathtroopers.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_disrupter.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_disrupter_dxr6.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_dp23.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_eweb.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_faux_bowcaster.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_flame_thrower.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_flame_thrower_light.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_geo_drill.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_jinkins_j1.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_laser_light.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_ld1.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_legendary_t21.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_lightning.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_lightning_basic.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_lightning_heavy.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_dh17_carbine.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_dh17_carbine_black.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_dh17_carbine_snubnose.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_e11_carbine.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_e11_carbine_quest.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_e11_carbine_victor.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_ee3.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_imperial_scout_carbine.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_light_blaster_laser_carbine.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_mandalorian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_massassi_ink.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_naktra_crystal.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_odararissl.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_projectile_tusken.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_proton.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_quest_rebel_longrifle.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_rebel.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_sonic_sg82.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_spray_stick_stohli.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_t21.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_tangle_gun7.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_tc22.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_tenloss_disrupter.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_trando_hunter.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_trando_hunter_crafted.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_victor_projectile_tusken.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_rifle_westar_pvp.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_staff.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_staff_janta.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_staff_metal.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_staff_reinforced.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_stun_baton_legendary.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_acid.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_avatar_wke_spiritblade.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_bandit.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_curved.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_curved_nyax.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_junti_mace.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_mandalorian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_marauder.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_massassi.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_nyax.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_obsidian.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_pvp_bf.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_rantok.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_rebel.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_rsf.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_ryyk_blade.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_sword_wookiee.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_tusken_elite.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_victor_baton_gaderiffi.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_wod_1h_scyth.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_wod_1h_sword.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_wod_2h_scyth.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_wod_2h_sword.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_wod_polearm.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_wod_war_fan.lua") includeFile("custom_content/draft_schematic/weapon/appearance/weapon_appearance_wookiee_knuckler.lua")
function GetLivingPlayers( onTeam ) local allPly = team.GetPlayers( onTeam ) local livingPly = {} for _, v in pairs(allPly) do if( IsValid(v) && v:Alive() ) then livingPly[#livingPly + 1] = v end end return livingPly end -- now realised there is a flag to ignore ws, don't use this it's not done.... function isStuck( ply ) local pos = ply:GetPos() local ws = game.GetWorld() local td = {} td.start = pos td.endpos = pos td.filter = { ply, ply.chosenProp, ws } td.mins, td.maxs = ply:GetHitBoxBounds(0,0) local trace = util.TraceHull( td ) ent = trace.Entity -- should never be stuck in world --if ent && (ent:IsWorld() || ent:IsValid()) then if( ent && ent:IsValid() ) then return true end return false end function WouldBeStuck( ply, prop ) local pos = ply:GetPos() local td = {} td.start = pos td.endpos = pos td.filter = { ply, ply:GetProp() } local hbMin, hbMax = prop:GetHitBoxBounds( 0, 0 ) if( !hbMin || !hbMax ) then return true end local hbMin = Vector( math.Round(hbMin.x),math.Round(hbMin.y),math.Round(hbMin.z) ) local hbMax = Vector( math.Round(hbMax.x),math.Round(hbMax.y),math.Round(hbMax.z) ) -- Adjust height hbMax = Vector(hbMax.x,hbMax.y,hbMax.z + hbMax.z) hbMin = Vector(hbMin.x,hbMin.y,0) td.mins = hbMin td.maxs = hbMax local trace = util.TraceHull( td ) ent = trace.Entity if ent && (ent:IsWorld() || ent:IsValid()) then return true end return false end function LerpColor(frac,from,to) return Color( Lerp(frac,from.r,to.r), Lerp(frac,from.g,to.g), Lerp(frac,from.b,to.b), Lerp(frac,from.a,to.a) ) end function TeamString(teamID) if(teamID == TEAM_HUNTERS) then return "Hunters" elseif(teamID == TEAM_PROPS) then return "Props" elseif(teamID == TEAM_SPECTATOR) then return "Spectators" else return "UNKNOWN" end end function RoundToTime(round) local secs = CurTime() - round.startTime + round.timePad if( round.state == ROUND_WAIT ) then return OBJHUNT_PRE_ROUND_TIME - secs elseif ( round.state == ROUND_IN or round.state == ROUND_START ) then return OBJHUNT_ROUND_TIME - secs elseif ( round.state == ROUND_END ) then secs = CurTime() - round.endTime + round.timePad return OBJHUNT_POST_ROUND_TIME - secs else return 0 end end --[[ Ordered table iterator, allow to iterate on the natural order of the keys of a table. Example: ]] function __genOrderedIndex( t ) local orderedIndex = {} for key in pairs(t) do table.insert( orderedIndex, key ) end table.sort( orderedIndex ) return orderedIndex end function orderedNext(t, state) -- Equivalent of the next function, but returns the keys in the alphabetic -- order. We use a temporary ordered key table that is stored in the -- table being iterated. key = nil --print("orderedNext: state = "..tostring(state) ) if state == nil then -- the first time, generate the index t.__orderedIndex = __genOrderedIndex( t ) key = t.__orderedIndex[1] else -- fetch the next value for i = 1,table.getn(t.__orderedIndex) do if t.__orderedIndex[i] == state then key = t.__orderedIndex[i+1] end end end if key then return key, t[key] end -- no more value to return, cleanup t.__orderedIndex = nil return end function orderedPairs(t) -- Equivalent of the pairs() function on tables. Allows to iterate -- in order return orderedNext, t, nil end
local utils = require('util') local url = require('url') local fs = require('fs') local path = require('path') local uv = require('luv') local tap = require('util/tap') local assert = require('assert') local m3u8 = require('hls/m3u8') local tsWriter = require('hls/writer') local tsReader = require('hls/reader') local lmedia = require('lmedia') local basePath = utils.dirname() console.log(basePath) local function test_ts_writer() local hls = require('hls/writer') local StreamWriter = hls.StreamWriter local writer = StreamWriter:new() --console.log(writer) writer:start(function(packet, meta) --console.log('packet', #packet, meta) end) local list = {} for i = 1, 100 do list[#list + 1] = "abcdefghijklmn1234567890" end local data = table.concat(list) writer:writeSyncInfo(40) local startTime = uv.hrtime() for i = 1, 20000 do writer:write(data, 80) end local endTime = uv.hrtime() print((endTime - startTime) / 1000000) --writer:_writePAT() --writer:_writePMT() writer:close() end test_ts_writer()
-- Base16 Paraiso color -- Author: Jan T. Sott -- to be use in your theme.lua -- symlink or copy to config folder `local color = require('color')` local M = {} M.base00 = "#2f1e2e" -- ---- M.base01 = "#41323f" -- --- M.base02 = "#4f424c" -- -- M.base03 = "#776e71" -- - M.base04 = "#8d8687" -- + M.base05 = "#a39e9b" -- ++ M.base06 = "#b9b6b0" -- +++ M.base07 = "#e7e9db" -- ++++ M.base08 = "#ef6155" -- red M.base09 = "#f99b15" -- orange M.base0A = "#fec418" -- yellow M.base0B = "#48b685" -- green M.base0C = "#5bc4bf" -- aqua/cyan M.base0D = "#06b6ef" -- blue M.base0E = "#815ba4" -- purple M.base0F = "#e96ba8" -- brown return M
--|> SIMPLEX | Easy-to-use interaction system <|-- -- ShutoExpressway -- The global settings for Simplex. return { InteractionKeys = { Desktop = Enum.KeyCode.E, Console = Enum.KeyCode.ButtonX }, }
Socket,Address,Interface,Buffer = require('t.Net.Socket'),require('t.Net.Address'),require('t.Net.Interface'),require('t.Buffer') ipAddr = arg[1] and arg[1] or Interface.default( ).address.ip port = arg[2] and arg[2] or 8888 udpsock = Socket( 'UDP', 'ip4' ) adr = Address( ipAddr, port ) print( udpsock, adr ) udpsock:bind( adr ) ip_cli = Address() msg, len = udpsock:recv( ip_cli, 10 ) print( len, msg, ip_cli, "\n" )
-- AERGO BILLBOARDS -- UNDER DEVELOPMENT -- GLOBAL STATE VARIABLES state.var { __GEO = state.map(2), -- Geographic Coordinate System for outdoors map __OUTDOORS = state.map(1) -- outdoors collectable data --_b_aer_coupon = state.value() -- bignum aer of 1 collectable ticket } function constructor() __OUTDOORS["counter"] = 0 --_b_aer_coupon:set (bignum.tonumber("10000000")) -- ? end --------------------------------------------------------------------- -------- < PRIVATE FUNCTIONS > --------------------------------------------------------------------- --------------------------------------- -- Checks and converts GCS to valid latitude and longitude -- @type function -- @param gcs Geographic coordinate system -- @return latitude, longitude strings (25.6466799,-47.5589549 --> -25.64 -47.55) --------------------------------------- function gcs2latlong(gcs) local pattern = "^%s*(%-?%d?%d%.%d%d)%d*%s*.%s*(%-?1?%d?%d%.%d%d)%d*%s*$" assert(type(gcs)=="string" and gcs:find(pattern), "[gcs] invalid parameter") local lat, long = gcs:match(pattern) -- removes extras zeros, but NOT in decimal places lat, long = tonumber(lat.."5"), tonumber(long.."5") assert((lat >= -90 and lat <= 90) and (long >= -180 and long <= 180), "[gcs] invalid GCS") return tostring(lat):sub(1, -2), tostring(long):sub(1, -2) -- removes the "5" in the end end --------------------------------------- -- Check address correctness -- @type function -- @param address address to check -- @return boolean valid or not --------------------------------------- function isValidAddress(address) -- check existence of invalid alphabets if nil ~= string.match(address, '[^123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]') then return false end -- check length is in range if 52 ~= string.len(address) then return false end return true end --------------------------------------- -- Collect one coupon from outdoor (if avaliable) -- @type query -- @param address address to send the coupon prize -- @return nounce outdoor id --------------------------------------- function collect(address, nounce) if type(__OUTDOORS[nounce]) == "table" then -- exists? local outdoor = __OUTDOORS[nounce] -- verifica se está no tempo ainda -- verifica se possui total -- verifica se secret está correta -- trasnfere --outdoor end end --------------------------------------------------------------------- -------- </ PRIVATE FUNCTIONS > --------------------------------------------------------------------- --------------------------------------------------------------------- -------- < VIEW FUNCTIONS > --------------------------------------------------------------------- --------------------------------------- -- Gets all outdoors from region gcs -- @type view -- @param gcs Geographic coordinate system --------------------------------------- function view_region(gcs) local lat, long = gcs2latlong(gcs) return json.encode(__GEO[lat][long] or {}) end --------------------------------------------------------------------- -------- </ VIEW FUNCTIONS > --------------------------------------------------------------------- --------------------------------------------------------------------- -------- < PAYABLE FUNCTIONS > --------------------------------------------------------------------- --------------------------------------- -- Buy a new outdoor -- @type payable -- @param gcs Geographic Coordinate System -- @param payload payload of social network post (NOTICE: first char MUST BE the type (IG = 1, FB = 2, YT = 3...)) -- @param coupon 3 to 6 uppercase letters not-encrypted -- @param total how much collectable coupons are able to collect in units -- @param refer valid aergo address to receive 1 free coupon function payable_outdoor(gcs, payload, coupon, total, refer) local lat, long = gcs2latlong(gcs) local bignum_aer_amount = bignum.number(system.getAmount()) local sender = system.getSender() assert(type(coupon)=="string" and coupon:find("^%u%u%u%u?%u?%u?$"), "[coupon] invalid parameter") -- total it's a number? total = tostring(total) assert(total:find("^[0-9]+$") and #total <= 4 , "[total] invalid parameter") -- maximum total is 9999 collectables -- total minimum amount total = tonumber(total) assert(total >= 100, "[total] insufficient parameter (minimum is 100)") local bignum_div = bignum.div(bignum_aer_amount, bignum.number(total)) -- total minimum collectable assert(bignum.compare(bignum_div, bignum.number("5000000000000000")) > -1, "[total] unfair collectables division ") __OUTDOORS["counter"] = __OUTDOORS["counter"] + 1 local nounce = tostring(__OUTDOORS["counter"]) local now = system.getTimestamp() __OUTDOORS[nounce] = { now, -- check time if is valid bignum_div, -- prize total, -- avaliable crypto.sha256(coupon) -- secret } local outdoor = { nounce, -- id gcs, -- location payload, -- post tostring(bignum_aer_amount), -- z-order now -- creation time } if type(__GEO[lat][long]) == "table" then table.insert(__GEO[lat][long], outdoor) else __GEO[lat][long] = {outdoor} end if isValidAddress(tostring(refer)) then collect(refer, nounce) end end --------------------------------------------------------------------- -------- </ PAYABLE FUNCTIONS > --------------------------------------------------------------------- abi.register_view(view_region) abi.payable(new_outdoor)
local csv = require("utils.csv") local L = Class(require("levelhead.data.base")) function L:initialize() --parse data file local rawHeaders self.data, rawHeaders = csv.parseString(love.filesystem.read("data/propertyLists.tsv"),"\t") --parse headers self.headers = {} for _,v in ipairs(rawHeaders) do local raw = self:reduceSelector(v) if raw:match("^value") then self.headers.value = v end end end function L:valueToMapping(list, value) return self.data[value+1][list] end --the mapping gets reduced like a selector function L:mappingToValue(list, mapping) local check = self:reduceSelector(mapping) for i=1,#self.data,1 do if self:reduceSelector(self.data[i][list]) == check then return i-1 end end error("Illegal mapping for property list "..list..": "..tostring(mapping).." ("..type(mapping)..")") end return L:new()
-- fibonacci function with cache -- very inefficient fibonacci function function fib(n) N=N+1 if n<2 then return n else return fib(n-1)+fib(n-2) end end -- a general-purpose value cache function cache(f) local c={} return function (x) local y=c[x] if not y then y=f(x) c[x]=y end return y end end -- run and time it function test(s,f) N=0 local c=os.clock() local v=f(n) local t=os.clock()-c print(s,n,v,t,N) return v end n= 24 -- for other values, do lua fib.lua XX n=tonumber(n) print("","n","value","time","evals") v = test("plain",fib) assert (v == 46368) fib=cache(fib) v = test("cached",fib) assert (v == 46368)
local redis = require "skynet.db.redis" local rediscluster = require "skynet.db.redis.cluster" local mongo = require "skynet.db.mongo" local cdbmgr = class("cdbmgr") function cdbmgr:init() self.db_type = skynet.getenv("db_type") self.db_is_cluster = skynet.getenv("db_is_cluster") self.dbs = {} -- db_id-> {conf=配置,db=db实例} end function cdbmgr:new_db(db_config) local db_type = self.db_type local db_is_cluster = self.db_is_cluster if db_type == "redis" then if not db_is_cluster then return redis.connect(db_config) else return rediscluster.new(db_config.startup_nodes,db_config.opt) end else return mongo.client(db_config) end end function cdbmgr:getdb(db_id) db_id = db_id or skynet.getenv("id") local ok,obj = gg.sync:once_do(db_id,function () return self:_getdb(db_id) end) assert(ok,obj) local db = obj.db local conf = obj.conf -- 指定了数据库名? if conf.db then db = db[conf.db] end return db end function cdbmgr:_getdb(db_id) if not self.dbs[db_id] or not self.dbs[db_id].db then local conf = self:get_db_conf(db_id) local db = self:new_db(conf) self.dbs[db_id] = { conf = conf, db = db, } end return self.dbs[db_id] end function cdbmgr:get_db_conf(db_id) -- db_nodes中需要存放所有需要连接的db的配置,如果服务器只需要连本服数据库, -- 则可以不提供db_nodes,以第二种形式提供本服数据库配置即可 local db_nodes = skynet.getenv("db_nodes") if db_nodes then return db_nodes[db_id] end if db_id == skynet.getenv("id") then return skynet.getenv("db_config") end end function cdbmgr:shutdown() for db_id,obj in pairs(self.dbs) do local db = obj.db obj.db = nil if self.db_type == "redis" then if self.db_is_cluster then db:close_all_connection() else db:disconnect() end else db:disconnect() end end end return cdbmgr
local filesystem = require("filesystem") local dirent = {} function dirent.files(path) return filesystem.list(path) end return dirent
--- -- @module HumanoidTrackerService -- @author Quenty local require = require(script.Parent.loader).load(script) local Players = game:GetService("Players") local HumanoidTracker = require("HumanoidTracker") local HumanoidTrackerService = {} function HumanoidTrackerService:Init() assert(not self._humanoidTracker, "Already initialized") self._humanoidTracker = HumanoidTracker.new(Players.LocalPlayer) end function HumanoidTrackerService:GetHumanoidTracker() assert(self._humanoidTracker, "Not initialized") return self._humanoidTracker end return HumanoidTrackerService
-- Will track whether prompt is currently open local promptIsOpen = false --[[ table object: interface PromptInfo { placeholder: string; description: string; id: string; title: string; isClosable?: boolean; } ]] ---@param promptTable table --- --- NOTE: Need to handle an export spam triggering many prompts local function startPrompt(promptTable) debugPrint('Prompt opened >') debugPrint(json.encode(promptTable)) local p = promise.new() SendReactMessage('openPrompt', promptTable) local cbStr = ('promptNuiResp-%s'):format(promptTable.id) promptIsOpen = true RegisterRawNuiCallback(cbStr, function(data, cb) local resp = json.decode(data.body) p:resolve(resp) promptIsOpen = false cb({ body = '{}' }) UnregisterRawNuiCallback(`promptNuiResp-${props.id}`); end) local result = Citizen.Await(p) -- Returns two results as ['closed' | 'submitted', content | null] return result[1], result[2] end exports('startPrompt', startPrompt) ---@param promptId string Target prompt to close function closePrompt(promptId) local stringPromptId = tostring(promptId) SendReactMessage('closePrompt', stringPromptId) debugPrint(('Prompt ID %s | Closed'):format(stringPromptId)) end exports('closePrompt', closePrompt)
----------------------------------------- -- ID: 5004 -- Scroll of Valor Minuet III -- Teaches the song Valor Minuet III ----------------------------------------- function onItemCheck(target) return target:canLearnSpell(396) end function onItemUse(target) target:addSpell(396) end
1.Chop 2.Gum 3.Smoke 4.Buddha 5.Flame 6.Phoenix 7.Rumble 8.String 9.Ice 10.Magma 11.Light
mul = settings.startup["advanced-electric-multiplier-advanced-accumulator"].value data:extend( { { type = "recipe", name = "advanced-accumulator", energy_required = 30, enabled = false, ingredients = { {"accumulator", mul + 1}, {"iron-plate", 10}, {"electronic-circuit", 5} }, result = "advanced-accumulator" } } )
--[[ Option Data Modifiers Defines performance options selectable for individual systems ]] function navcomp.plotter:SetSegmentSmoothingOn () navcomp.data.useSegmentSmoothing = true navcomp.data.isOptionDataChanged = true end function navcomp.plotter:SetSegmentSmoothingOff () navcomp.data.useSegmentSmoothing = false navcomp.data.isOptionDataChanged = true end function navcomp.plotter:SetStormAvoidanceOn () navcomp.data.avoidStormSectors = true navcomp.data.isOptionDataChanged = true end function navcomp.plotter:SetStormAvoidanceOff () navcomp.data.avoidStormSectors = false navcomp.data.isOptionDataChanged = true end function navcomp.plotter:SetManualAvoidanceOn () navcomp.data.avoidManualSectors = true navcomp.data.isOptionDataChanged = true end function navcomp.plotter:SetManualAvoidanceOff () navcomp.data.avoidManualSectors = false navcomp.data.isOptionDataChanged = true end function navcomp.plotter:SetBlockableAvoidanceOn () navcomp.data.avoidBlockableSectors = true navcomp.data.isOptionDataChanged = true end function navcomp.plotter:SetBlockableAvoidanceOff () navcomp.data.avoidBlockableSectors = false navcomp.data.isOptionDataChanged = true end
local M = {} M.description = 'Integration between nvim-notify and telescope' M.requisite = { 'nvim-notify', 'telescope', } M.after = { 'nvim-notify', 'telescope', } M.activation = { wanted_by = { 'nvim-notify', 'telescope', } } function M.config() require("telescope").load_extension("notify") end return M
--[[ File name: init.lua Description: main module code for the serene quest system Author: oldmilk --]] local module = {} local class = require(script.class) local ridge = require(game.ReplicatedStorage:WaitForChild("modules").ridge) function getQuestProfile(player) local playerDataStore = ridge.getPlayerDataStore(player) local questProfile = playerDataStore:getAsync("questProfile") if questProfile == nil then questProfile = {} end return questProfile end function setQuestProfile(player, value) local playerDataStore = ridge.getPlayerDataStore(player) playerDataStore:setAsync("questProfile", value) end --importFromModule: import a quest from a module script module.importFromModule = function(path) if not path:IsA("ModuleScript") then error("Failed to load quest data: given Instance must be of class ModuleScript") end local coreData = { questData = require(path), modulePath = path } setmetatable(coreData, class) return coreData end --loadQuestData: execute events when the player joins the game for quests module.loadQuestData = function(player) local questProfile = getQuestProfile(player) print("Loading quest info for loadQuestData") print(questProfile) local quests = questProfile["currentQuests"] if quests == nil then print("nothing to update, player is not doing any quests.") else for questIndex, quest in pairs(quests) do if game.ReplicatedStorage.questLookup:FindFirstChild(questIndex) ~= nil then local questModule = require(game.ReplicatedStorage.questLookup:FindFirstChild(questIndex)) -- execute player join event local events = questModule["events"] if events["playerStartedQuest"] ~= nil then local returnValue = events.playerStartedQuest(player) if returnValue["client"] ~= nil then returnValue.client:FireClient(player) end end -- remove quest module questModule = nil else warn("Invalid quest name.") end end end end return module
local Base = GMethod.loadScript("game.UI.Dialog.ViewTemplates.BaseTemplate") do -- 仿Scroll的layout实现,简化代码实现 local LayoutImplement = {} Base.registerImplement("LayoutImplement", LayoutImplement) -- 加载 function LayoutImplement:_static_load(data) self._scrollCallback = data.callback self._callbackWithIdx = data.withIdx end function LayoutImplement:setLayoutDatas(infos) local maxIdx = 0 for i, info in ipairs(infos) do local cell if not self.children or not self.children[i] then if self._callbackWithIdx then cell = self._scrollCallback(false, self, i, info) else cell = self._scrollCallback(false, self, info) end self:addChild(cell) else cell = self.children[i] if self._callbackWithIdx then self._scrollCallback(cell, self, i, info) else self._scrollCallback(cell, self, info) end end cell:setVisible(true) maxIdx = i end while true do maxIdx = maxIdx + 1 if self.children and self.children[maxIdx] then self.children[maxIdx]:setVisible(false) else break end end end function LayoutImplement:refreshLayoutCell(idx, info) local cell = self.children[idx] if self._callbackWithIdx then self._scrollCallback(cell, self, idx, info) else self._scrollCallback(cell, self, info) end end end
function initiateProgram () -------------------------------------------------------------------------------- sprite = {} users={} char={} obj = {} sx, sy, xx, yy = 1, 1, 0, 0 -------------------------------------------------------------------------------- require "0modules0.loadingContent.loadAllLuaFiles" loadAllLuaFiles("0modules0") -------------------------------------------------------------------------------- addTimers(100) ----------------------------------------------------------------------------------------------------------------------- ---persistence module for saving/loading local write, writeIndent, writers, refCount; persistence = { store = function (path, ...) local file, e = io.open(path, "w"); if not file then return error(e); end local n = select("#", ...); -- Count references local objRefCount = {}; -- Stores reference that will be exported for i = 1, n do refCount(objRefCount, (select(i,...))); end; -- Export Objects with more than one ref and assign name -- First, create empty tables for each local objRefNames = {}; local objRefIdx = 0; file:write("-- Persistent Data\n"); file:write("local multiRefObjects = {\n"); for obj, count in pairs(objRefCount) do if count > 1 then objRefIdx = objRefIdx + 1; objRefNames[obj] = objRefIdx; file:write("{};"); -- table objRefIdx end; end; file:write("\n} -- multiRefObjects\n"); -- Then fill them (this requires all empty multiRefObjects to exist) for obj, idx in pairs(objRefNames) do for k, v in pairs(obj) do file:write("multiRefObjects["..idx.."]["); write(file, k, 0, objRefNames); file:write("] = "); write(file, v, 0, objRefNames); file:write(";\n"); end; end; -- Create the remaining objects for i = 1, n do file:write("local ".."obj"..i.." = "); write(file, (select(i,...)), 0, objRefNames); file:write("\n"); end -- Return them if n > 0 then file:write("return obj1"); for i = 2, n do file:write(" ,obj"..i); end; file:write("\n"); else file:write("return\n"); end; if type(path) == "string" then file:close(); end; end; load = function (path) local f, e; if type(path) == "string" then f, e = loadfile(path); else f, e = path:read('*a') end if f then return f(); else return nil, e; end; end; } -- Private methods -- write thing (dispatcher) write = function (file, item, level, objRefNames) writers[type(item)](file, item, level, objRefNames); end; -- write indent writeIndent = function (file, level) for i = 1, level do file:write("\t"); end; end; -- recursively count references refCount = function (objRefCount, item) -- only count reference types (tables) if type(item) == "table" then -- Increase ref count if objRefCount[item] then objRefCount[item] = objRefCount[item] + 1; else objRefCount[item] = 1; -- If first encounter, traverse for k, v in pairs(item) do refCount(objRefCount, k); refCount(objRefCount, v); end; end; end; end; -- Format items for the purpose of restoring writers = { ["nil"] = function (file, item) file:write("nil"); end; ["number"] = function (file, item) file:write(tostring(item)); end; ["string"] = function (file, item) file:write(string.format("%q", item)); end; ["boolean"] = function (file, item) if item then file:write("true"); else file:write("false"); end end; ["table"] = function (file, item, level, objRefNames) local refIdx = objRefNames[item]; if refIdx then -- Table with multiple references file:write("multiRefObjects["..refIdx.."]"); else -- Single use table file:write("{\n"); for k, v in pairs(item) do writeIndent(file, level+1); file:write("["); write(file, k, level+1, objRefNames); file:write("] = "); write(file, v, level+1, objRefNames); file:write(";\n"); end writeIndent(file, level); file:write("}"); end; end; ["function"] = function (file, item) -- Does only work for "normal" functions, not those -- with upvalues or c functions local dInfo = debug.getinfo(item, "uS"); if dInfo.nups > 0 then file:write("nil --[[functions with upvalue not supported]]"); elseif dInfo.what ~= "Lua" then file:write("nil --[[non-lua function not supported]]"); else local r, s = pcall(string.dump,item); if r then file:write(string.format("loadstring(%q)", s)); else file:write("nil --[[function could not be dumped]]"); end end end; ["thread"] = function (file, item) file:write("nil --[[thread]]\n"); end; ["userdata"] = function (file, item) file:write("nil --[[userdata]]\n"); end; } ---persistence module code ends here.... ----------------------------------------------------------------------------------------- buttonList = { } keyboardButtonList ={ } --???? should be a separate lua file color_change_shader = [[ extern vec4 colors; vec4 effect( vec4 color, Image texture, vec2 texture_coords, vec2 screen_coords ) { vec4 texcolor = Texel(texture, texture_coords); // This reads a color from our texture at the coordinates LOVE gave us (0-1, 0-1) return texcolor*colors; }]] color_change = love.graphics.newShader (color_change_shader) game = { screenResolution = {x=1024, y=768}, defaultCanvasSize = {x=1920, y=1080}, } ui.screen = { } defaultCanvas = love.graphics.newCanvas(game.defaultCanvasSize.x, game.defaultCanvasSize.y) defaultCanvas:setFilter('nearest', 'nearest') love.graphics.setDefaultFilter( 'nearest', 'nearest', 0 ) --function resetWindow() local a = love.graphics.getWidth() local b = love.graphics.getHeight() love.window.setMode( game.screenResolution.x, game.screenResolution.y, {fullscreen =false, fullscreentype="desktop", vsync=false,msaa=0,resizable = true,borderless = false,centered = true, display = 1,minwidth=0,minheight=0,highdpi=false} ) --end --read the settingfile and check if default mode is true or false --if default mode is true don't do anything if it's false --load the custom settings from before --create the canvas and set the filter to nearest neighbor -------------------------------------------------------------------------------- --draws important variables defaultFont = love.graphics.newFont( "YanoneKaffeesatz-Regular.ttf", 36 ) love.graphics.setFont(defaultFont) ui.tooltip.minSize (0, 0) ui.tooltip.maxWidth (700) ui.tooltip.colors ({0,0,0,220}, {0,0,0,255}, {255, 255, 255, 230}) ui.tooltip.outlineThickness(1) ui.tooltip.enableOutline() ui.tooltip.textOffset (10, 10) ui.tooltip.font (defaultFont) ui.tooltip.cursorOffset (30, 30) loadDeckLoading() --loadMainMenu() --loadCharCreation() --loadCharCreation2() --loadCharDerivedStats() end return initiateProgram
local ubus = require "ubus" local bit32 = require "bit32" local function get_wifi_interfaces() local u = ubus.connect() local status = u:call("network.wireless", "status", {}) local interfaces = {} for _, dev_table in pairs(status) do for _, intf in ipairs(dev_table['interfaces']) do table.insert(interfaces, intf['ifname']) end end return interfaces end local function scrape() local metric_hostapd_station_vht = metric("hostapd_station_vht", "gauge") local metric_hostapd_station_ht = metric("hostapd_station_ht", "gauge") local metric_hostapd_station_wmm = metric("hostapd_station_wmm", "gauge") local metric_hostapd_station_mfp = metric("hostapd_station_mfp", "gauge") local metric_hostapd_station_rx_packets = metric("hostapd_station_rx_packets", "counter") local metric_hostapd_station_rx_bytes = metric("hostapd_station_rx_bytes", "counter") local metric_hostapd_station_tx_packets = metric("hostapd_station_tx_packets", "counter") local metric_hostapd_station_tx_bytes = metric("hostapd_station_tx_bytes", "counter") local metric_hostapd_station_inactive_msec = metric("hostapd_station_inactive_msec", "counter") local metric_hostapd_station_signal = metric("hostapd_station_signal", "gauge") local metric_hostapd_station_connected_time = metric("hostapd_station_connected_time", "counter") local metric_hostapd_station_wpa = metric("hostapd_station_wpa", "gauge") local metric_hostapd_station_sae_group = metric("hostapd_station_sae_group", "gauge") local metric_hostapd_station_vht_capb_su_beamformee = metric("hostapd_station_vht_capb_su_beamformee", "gauge") local metric_hostapd_station_vht_capb_mu_beamformee = metric("hostapd_station_vht_capb_mu_beamformee", "gauge") local function evaluate_metrics(ifname, station, vals) local label_station = { ifname = ifname, station = station, } for k, v in pairs(vals) do if k == "flags" then if string.match(v, "[VHT]") then metric_hostapd_station_vht(label_station, 1) end if string.match(v, "[HT]") then metric_hostapd_station_ht(label_station, 1) end if string.match(v, "[WMM]") then metric_hostapd_station_wmm(label_station, 1) end if string.match(v, "[MFP]") then metric_hostapd_station_mfp(label_station, 1) end elseif k == "wpa" then metric_hostapd_station_wpa(label_station, v) elseif k == "rx_packets" then metric_hostapd_station_rx_packets(label_station, v) elseif k == "rx_bytes" then metric_hostapd_station_rx_bytes(label_station, v) elseif k == "tx_packets" then metric_hostapd_station_tx_packets(label_station, v) elseif k == "tx_bytes" then metric_hostapd_station_tx_bytes(label_station, v) elseif k == "inactive_msec" then metric_hostapd_station_inactive_msec(label_station, v) elseif k == "signal" then metric_hostapd_station_signal(label_station, v) elseif k == "connected_time" then metric_hostapd_station_connected_time(label_station, v) elseif k == "sae_group" then metric_hostapd_station_sae_group(label_station, v) elseif k == "vht_caps_info" then local caps = tonumber(string.gsub(v, "0x", ""), 16) metric_hostapd_station_vht_capb_su_beamformee(label_station, bit32.band(bit32.lshift(1, 12), caps) > 0 and 1 or 0) metric_hostapd_station_vht_capb_mu_beamformee(label_station, bit32.band(bit32.lshift(1, 20), caps) > 0 and 1 or 0) end end end for _, ifname in ipairs(get_wifi_interfaces()) do local handle = io.popen("hostapd_cli -i " .. ifname .." all_sta") local all_sta = handle:read("*a") handle:close() local current_station = nil local current_station_values = {} for line in all_sta:gmatch("[^\r\n]+") do if string.match(line, "^%x[0123456789aAbBcCdDeE]:%x%x:%x%x:%x%x:%x%x:%x%x$") then if current_station ~= nil then evaluate_metrics(ifname, current_station, current_station_values) end current_station = line current_station_values = {} else local name, value = string.match(line, "(.+)=(.+)") current_station_values[name] = value end end evaluate_metrics(ifname, current_station, current_station_values) end end return { scrape = scrape }
local GameObject = require 'squeak.gameObject' local Component = require 'squeak.component' local TestComponent = Component:extend() describe('gameObject', function() local c, g before_each(function() c = TestComponent() g = GameObject() end) it('works at all', function() assert.are.equal('table', type(GameObject)) end) it('sets position on new', function() local g = GameObject() assert.are.equal(0, g.x) assert.are.equal(0, g.y) local x, y = 3, 4 g = GameObject(3, 4) assert.are.equal(x, g.x) assert.are.equal(y, g.y) assert.are.equal('table', type(g.components)) end) it('can add components', function() local addedCalled = false c.added = function() addedCalled = true end local c2 = g:add(c) assert.are.equal(1, #g.components) assert.is_true(addedCalled) assert.are.equal(c2, c) end) it('can check for components', function() g:add(c) assert.is_true(g:has(TestComponent)) end) it('can remove previously added components', function() local removedCalled = false c.removed = function() removedCalled = true end g:add(c) assert.are.equal(1, #g.components) g:remove(c) assert.are.equal(0, #g.components) assert.is_true(removedCalled) end) it('calls gobAdded on its components', function() local gobAddedCalled = false c.gobAdded = function() gobAddedCalled = true end g:add(c) g:gobAdded() assert.is_true(gobAddedCalled) end) it('calls gobRemoved on its components', function() local gobRemovedCalled = false c.gobRemoved = function() gobRemovedCalled = true end g:add(c) g:gobRemoved() assert.is_true(gobRemovedCalled) end) it('calls draw on its components', function() local drawCalled = false c.draw = function() drawCalled = true end g:add(c) g:draw() assert.is_true(drawCalled) end) describe('update', function() before_each(function() g:add(c) end) it('exists', function() assert.are.equal('function', type(GameObject.update)) end) it('updates active components', function() c.active = true local updateCalled = false c.update = function() updateCalled = true end g:update() assert.is_true(updateCalled) end) it('does not update inactive components', function() c.active = false local updateCalled = false c.update = function() updateCalled = true end g:update() assert.is_false(updateCalled) end) it('removes components marked for removal after update', function() assert.are.equal(1, #g.components) local order = {} c.update = function() table.insert(order, 'update') end c.removed = function() table.insert(order, 'removed') end c.removeMe = true g:update() assert.are.equal(0, #g.components) assert.are.equal('update', order[1]) assert.are.equal('removed', order[2]) end) it('does not immediately remove during update loop thus screwing update loop up', function() local c2 = TestComponent() local cUpdate = 0 local c2Update = 0 c.update = function() cUpdate = cUpdate + 1 end c.removeMe = true c2.update = function() c2Update = c2Update + 1 end g:add(c2) g:update() assert.are.equal(1, cUpdate) assert.are.equal(1, c2Update) end) end) end)
function on_activate(parent, ability) local cur_mode = parent:get_active_mode() if cur_mode ~= nil then cur_mode:deactivate(parent) end local effect = parent:create_effect(ability:name()) effect:deactivate_with(ability) effect:add_num_bonus("ranged_accuracy", -10) local stats = parent:stats() if parent:ability_level(ability) > 1 then effect:add_num_bonus("graze_multiplier", 0.25) effect:add_damage(3, 9 + stats.level / 3, 0) else effect:add_damage(2, 5 + stats.level / 3, 0) end local cb = ability:create_callback(parent) cb:set_on_held_changed_fn("on_held_changed") effect:add_callback(cb) local gen = parent:create_anim("crossed_arrow") gen:set_moves_with_parent() gen:set_position(gen:param(-0.5), gen:param(-2.5)) gen:set_particle_size_dist(gen:fixed_dist(1.0), gen:fixed_dist(1.0)) effect:add_anim(gen) effect:apply() game:play_sfx("sfx/sword_sheath_2") ability:activate(parent) end function on_deactivate(parent, ability) ability:deactivate(parent) end function on_held_changed(parent, ability) if not parent:stats().attack_is_ranged then game:say_line("Powerful Shot Deactivated", parent) ability:deactivate(parent) end end
local cancel = THEME:GetString("ScreenSelectMusicTutorial", "FooterTextSingleSong") if PREFSMAN:GetPreference("ThreeKeyNavigation") then cancel = THEME:GetString("ScreenSelectMusicTutorial", "FooterTextSingleSong3Key") end return LoadFont("Common Normal")..{ InitCommand=function(self) self:xy(_screen.cx, _screen.h - 16):zoom(0.7):diffusealpha(0) end, SwitchFocusToGroupsMessageCommand=function(self) self:diffusealpha(0):settext(THEME:GetString("ScreenSelectMusicTutorial", "FooterTextGroups")):linear(0.15):diffusealpha(1) end, SwitchFocusToSongsMessageCommand=function(self) self:diffusealpha(0):settext(THEME:GetString("ScreenSelectMusicTutorial", "FooterTextSongs")):linear(0.15):diffusealpha(1) end, SwitchFocusToSingleSongMessageCommand=function(self) self:diffusealpha(0):settext( cancel ):linear(0.15):diffusealpha(1) end, }
-- .. "</br>" -- .. translate("For more information on different options check ") -- .. [[ <a href="https://adguard.com/en/adguard-dns/overview.html#instruction">]] -- .. "AdGuard.com" .. [[</a>]] .. ", " -- .. [[ <a href="https://cleanbrowsing.org/guides/dnsoverhttps">]] -- .. "CleanBrowsing.org" .. [[</a>]] .. " " .. translate("and") .. " " -- .. [[ <a href="https://www.quad9.net/doh-quad9-dns-servers/">]] -- .. "Quad9.net" .. [[</a>]] .. "." return { name = "CleanBrowsing-Security", label = _("CleanBrowsing (Security Filter)"), url_prefix = "https://doh.cleanbrowsing.org/doh/security-filter/?ct&", bootstrap_dns = "185.228.168.168" }
local PANEL = {} function PANEL:Init() self:SetFont("VBFONT_DERMANORMAL") self:SetTextColor(COLOR_WHITE) self.AlternativeColorScheme = false end function PANEL:Paint(w, h) if self.AlternativeColorScheme then draw.RoundedBox(0, 0, 0, w, h, COLOR_BUTTON_NORMAL) if self:IsHovered() then draw.RoundedBox(0, 0, 0, w, h, COLOR_BUTTON_HOVER) end if self:IsDown() then draw.RoundedBox(0, 0, 0, w, h, COLOR_BUTTON_CLICKED) end else draw.RoundedBox(0, 0, 0, w, h, COLOR_BUTTON_NORMAL_ALT) if self:IsHovered() then draw.RoundedBox(0, 0, 0, w, h, COLOR_BUTTON_HOVER_ALT) end if self:IsDown() then draw.RoundedBox(0, 0, 0, w, h, COLOR_BUTTON_CLICKED_ALT) end end end VBVGUI:Register("Button", PANEL, "DButton")
if arg[1] == "down" then turtle.dropDown() elseif arg[1] == nil then turtle.drop() elseif arg[1] == "up" then turtle.dropUp() else print("Invalid drop direction.") end
local T, C, L = Tukui:unpack() ---------------------------------------------------------------- -- Raid Cooldowns -- Author: Allez -- Editor: Luaerror ---------------------------------------------------------------- if (not C.RaidCD.Enable) then return end local RaidCooldowns = { ["DEATHKNIGHT"] = { [61999] = true, -- Raise Ally [48792] = true, -- Icebound Foritude }, ["DEMONHUNTER"] = { [196718] = true, -- Darkness }, ["DRUID"] = { [20484] = true, -- Rebirth -- Balance [29166] = true, -- Innervate -- Guardian [61336] = true, -- Survival Instincts -- Restoration [740] = true, -- Tranquility [33891] = true, -- Incarnation: Tree of Life [102342] = true, -- Ironbark [197721] = false, -- Flourish }, ["HUNTER"] = { [264667] = true, -- Primal Rage }, ["MAGE"] = { [80353] = true, -- Time Warp }, ["MONK"] = { -- Brewmaster [115176] = true, -- Zen Meditation [120954] = true, -- Fortigying Brew [122278] = true, -- Dampen Harm -- Mistweaver [115310] = true, -- Revival [116849] = true, -- Life Cocoon }, ["PALADIN"] = { [642] = true, -- Divine Shield [633] = true, -- Lay of Hands [1022] = true, -- Blessing of Protection [6940] = true, -- Blessing of Sacrifice [204018] = true, -- Blessing of Spellwarding -- Holy [498] = true, -- Divine Protection [31821] = true, -- Aura Mastery -- Protection [31850] = true, -- Ardent Defender [86659] = true, -- Guardian of Ancient Kings [204150] = true, -- Aegis of Light }, ["PRIEST"] = { -- Discipline [33206] = true, -- Pain Suppression [62618] = true, -- Power Word: Barrier [271466] = true, -- Luminous Barrier -- Holy [47788] = true, -- Guardian Spirit [64843] = true, -- Divine Hymn [64901] = true, -- Symbol of Hope [265202] = true, -- Holy Word: Salvation -- Shadow [15286] = true, -- Vampiric Embrace [47585] = true, -- Dispersion }, ["ROGUE"] = {}, ["SHAMAN"] = { [2825] = true, -- Bloodlust [32182] = true, -- Heroism [20608] = true, -- Reincarnation -- Elemental [108281] = true, -- Ancestral Guidance -- Restoration -- [98008] = true, -- Spirit Link Totem [108280] = true, -- Healing Tide Totem [207399] = true, -- Ancestral Protection Totem }, ["WARLOCK"] = { [20707] = true, -- Soulstone }, ["WARRIOR"] = { [97462] = true, -- Rallying Cry -- Protection [871] = true, -- Shield Wall [12975] = true, -- Last Stand }, ["ALL"] = {} } local ZoneTypes = { ["none"] = false, -- when outside an instance ["pvp"] = false, -- when in a battleground ["arena"] = true, -- when in an arena ["party"]= true, -- when in a 5-man instance ["raid"] = true, -- when in a raid instance ["scenario"] = false, -- when in a scenario -- nil when in an unknown kind of instance } local bars = {} local chatType = nil local BarWidth, BarHeight = unpack(C.RaidCD.BarSize) local BarSpacing = C.RaidCD.BarSpacing local MaxBars = C.RaidCD.MaxBars ---------------------------------------------------------------- -- Functions ---------------------------------------------------------------- local bor, band = bit.bor, bit.band local tinsert, tremove, tsort = table.insert, table.remove, table.sort local format = string.format local floor, random = math.floor, math.random local COMBATLOG_FILTER_GROUP_MEMBER = bor(COMBATLOG_OBJECT_AFFILIATION_RAID, COMBATLOG_OBJECT_AFFILIATION_PARTY, COMBATLOG_OBJECT_AFFILIATION_MINE) -- update bars position local function UpdateBarPosition() local Spacing = C.RaidCD.BarSpacing for i = 1, #bars do bars[i]:ClearAllPoints() if (i == 1) then bars[i]:SetPoint(unpack(C.RaidCD.Anchor)) else bars[i]:SetPoint("TOPLEFT", bars[i - 1], "BOTTOMLEFT", 0, -Spacing) end bars[i].id = i if (i >= MaxBars) then bars[i]:Hide() else bars[i]:Show() end end end -- stop cooldown bar, and remove it from table. local function StopTimer(bar) bar:SetScript("OnUpdate", nil) bar:Hide() tremove(bars, bar.id) bar = nil UpdateBarPosition() end -- display tooltip. local OnEnter = function(self) GameTooltip:SetOwner(self, "ANCHOR_RIGHT") GameTooltip:AddDoubleLine(self.spell, self.right:GetText()) GameTooltip:SetClampedToScreen(true) GameTooltip:Show() end -- hide tooltip. local OnLeave = function(self) GameTooltip:Hide() end -- send a chat message. local OnMouseDown = function(self, button) if (button == "LeftButton") then if (chatType) then SendChatMessage(format("Cooldown: %s - %s (%s remaining)!", self.caster, self.name, self.right:GetText()), chatType) end elseif (button == "RightButton") then StopTimer(self); end end -- creates a new cooldown bar local function CreateBar() local Font, FontSize, FontStyle = C.Medias.PixelFont, 12, "MONOCHROMEOUTLINE" local Width, Height = unpack(C.RaidCD.BarSize) local Spacing = C.RaidCD.BarSpacing local StatusBarTexture = C.Medias.Blank local bar = CreateFrame("Frame", nil, UIParent) bar:SetSize(Width, Height) bar:SetFrameStrata("HIGH") local button = CreateFrame("Button", nil, bar) button:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT", 0, 0) button:SetSize(Height, Height) button:CreateBackdrop("Default") local icon = button:CreateTexture(nil, "ARTWORK") icon:SetAllPoints(button) icon:SetTexCoord(unpack(T.IconCoord)) local status = CreateFrame("StatusBar", nil, bar) status:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", 0, 0) status:SetWidth(Width - Height - Spacing) status:SetHeight(C.RaidCD.StatusBarHeight) status:SetStatusBarTexture(StatusBarTexture) status:SetMinMaxValues(0, 100) status:SetFrameLevel(bar:GetFrameLevel() - 1) status:CreateBackdrop("Default") local left = bar:CreateFontString(nil, "OVERLAY") left:SetPoint("LEFT", status, "LEFT", 5, 12) left:SetJustifyH("LEFT") left:SetFont(Font, FontSize, FontStyle) local right = bar:CreateFontString(nil, "OVERLAY") right:SetPoint("RIGHT", status, "RIGHT", -3, 12) right:SetJustifyH("RIGHT") right:SetFont(Font, FontSize, FontStyle) bar.button = button bar.icon = icon bar.status = status bar.left = left bar.right = right return bar end -- update bar cooldown time local UpdateInterval = 0.1 local function OnUpdate(self, elapsed) self.LastUpdate = (self.LastUpdate or 0) + elapsed while (self.LastUpdate > UpdateInterval) do self.remaining = self.remaining - self.LastUpdate self.status:SetValue(100 * self.remaining / self.cooldown) self.right:SetText(T.FormatTime(self.remaining)) if (self.remaining <= 0) then StopTimer(self) return end self.LastUpdate = self.LastUpdate - UpdateInterval; end end -- start a new cooldown bar local function StartTimer(sourceName, class, spellID, cooldown) local spellName, spellRank, spellIcon = GetSpellInfo(spellID) -- check if spell bar already exists for _, v in pairs(bars) do if (v.caster == sourceName and v.name == spellName) then return end end local color = RAID_CLASS_COLORS[class] if (not color) then color = { r = 0.30, g = 0.30, b = 0.30 } end local bar = CreateBar() bar.caster = sourceName bar.name = spellName bar.cooldown = cooldown bar.remaining = cooldown if (spellIcon) then bar.icon:SetTexture(spellIcon) end bar.status:SetStatusBarColor(color.r, color.g, color.b) bar.left:SetText(sourceName) bar.right:SetText(T.FormatTime(cooldown)) bar:EnableMouse(true) bar:SetScript("OnUpdate", OnUpdate) bar:SetScript("OnEnter", OnEnter) bar:SetScript("OnLeave", OnLeave) bar:SetScript("OnMouseDown", OnMouseDown) -- insert new bar in to the list tinsert(bars, bar) -- sort cooldwons by remaining timer or spell name tsort(bars, function(a, b) if (a.remaining == b.remaining) then return a.name < b.name end return a.remaining < b.remaining end) UpdateBarPosition() end ---------------------------------------------------------------- -- Frame ---------------------------------------------------------------- local f = CreateFrame("Frame", "RaidCD", UIParent) f:SetPoint(unpack(C.RaidCD.Anchor)) f:SetWidth(BarWidth) f:SetHeight((MaxBars * BarHeight) + ((MaxBars - 1) * BarSpacing)) f:RegisterEvent("PLAYER_ENTERING_WORLD") f:SetScript("OnEvent", function(self, event, ...) -- call one of the functions below self[event](self, ...) end) function f:PLAYER_ENTERING_WORLD() local inInstance, instanceType = IsInInstance() if (instanceType and ZoneTypes[instanceType]) then if (IsInRaid()) then chatType = "RAID" elseif (IsInGroup(LE_PARTY_CATEGORY_INSTANCE)) then chatType = "INSTANCE_CHAT" elseif (IsInGroup()) then chatType = "PARTY" else chatType = "SAY" end self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") else self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED") -- stop all cooldown bars for key, bar in pairs(bars) do StopTimer(bar) end end end function f:COMBAT_LOG_EVENT_UNFILTERED() local timestamp, eventType, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = CombatLogGetCurrentEventInfo() -- check if caster is in party/raid member if (band(sourceFlags, COMBATLOG_FILTER_GROUP_MEMBER) == 0) then return end -- filter combat events type if (eventType == "SPELL_CAST_SUCCESS") or (eventType == "SPELL_AURA_APPLIED") or (eventType == "SPELL_RESURRECT") then -- spell standard local spellID, spellName, spellSchool = select(12, CombatLogGetCurrentEventInfo()) for class, data in pairs(RaidCooldowns) do for key, value in pairs(data) do if (key == spellID) and (value == true) then local cooldown = GetSpellBaseCooldown(spellID) / 1000 if (cooldown and cooldown > 0) then StartTimer(sourceName, class, spellID, cooldown) end end end end end end ---------------------------------------------------------------- -- Test Mode ---------------------------------------------------------------- SLASH_RAIDCD1 = "/raidcd" SlashCmdList["RAIDCD"] = function(cmd) local name = UnitName("player") if (cmd == "test") then -- simutate raidcd for class, tbl in pairs(RaidCooldowns) do for spellID, check in pairs(RaidCooldowns[class]) do if (check) then local cooldown = GetSpellBaseCooldown(spellID) / 1000 if (cooldown and cooldown < 300) then StartTimer(name, class, spellID, cooldown) end end end end elseif (cmd == "reset") then repeat -- stop all cooldown bars for _, bar in ipairs(bars) do StopTimer(bar) end until (#bars == 0) end end
require "util" local Screen = require "widgets/screen" local Button = require "widgets/button" local AnimButton = require "widgets/animbutton" local Image = require "widgets/image" local UIAnim = require "widgets/uianim" local NumericSpinner = require "widgets/numericspinner" local TextEdit = require "widgets/textedit" local Widget = require "widgets/widget" local VALID_CHARS = [[ abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.,:;[]\@!#$%&()'*+-/=?^_{|}~"]] -- fix syntax highlighting due to above list: "' local CONSOLE_HISTORY = {} local ConsoleScreen = Class(Screen, function(self) Screen._ctor(self, "ConsoleScreen") self:DoInit() end) function ConsoleScreen:OnBecomeActive() ConsoleScreen._base.OnBecomeActive(self) TheFrontEnd:ShowConsoleLog() self.console_edit:SetFocus() self.console_edit:SetEditing(true) TheFrontEnd:LockFocus(true) end function ConsoleScreen:OnControl(control, down) if ConsoleScreen._base.OnControl(self, control, down) then return true end if not down and (control == CONTROL_CANCEL or control == CONTROL_OPEN_DEBUG_CONSOLE) then self:Close() return true end end function ConsoleScreen:OnRawKey( key, down) if ConsoleScreen._base.OnRawKey(self, key, down) then return true end if down then return end if key == KEY_TAB then self:AutoComplete() elseif key == KEY_UP then local len = #CONSOLE_HISTORY if len > 0 then if self.history_idx ~= nil then self.history_idx = math.max( 1, self.history_idx - 1 ) else self.history_idx = len end self.console_edit:SetString( CONSOLE_HISTORY[ self.history_idx ] ) end elseif key == KEY_DOWN then local len = #CONSOLE_HISTORY if len > 0 then if self.history_idx ~= nil then if self.history_idx == len then self.console_edit:SetString( "" ) else self.history_idx = math.min( len, self.history_idx + 1 ) self.console_edit:SetString( CONSOLE_HISTORY[ self.history_idx ] ) end end end else self.autocompletePrefix = nil self.autocompleteObjName = "" self.autocompleteObj = nil self.autocompleteOffset = -1 return false end return true end function ConsoleScreen:Run() local fnstr = self.console_edit:GetString() SuUsedAdd("console_used") if fnstr ~= "" then table.insert( CONSOLE_HISTORY, fnstr ) end local status, r = pcall( loadstring( fnstr ) ) if not status then nolineprint(r) end end function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end -- For this to be improved, you really need to start knowing about the language that's -- being autocompleted and the string must be tokenized and fed into a lexer. -- -- For instance, what should you autocomplete here: -- print(TheSim:Get<tab> -- -- Given understanding of the language, we know that the object to get is TheSim and -- it's the metatable from that to autocomplete from. However, you need to know that -- "print(" is not part of that object. -- -- Conversely, if I have "SomeFunction().GetTheSim():Get<tab>" then I need to include -- "SomeFunction()." as opposed to stripping it off. Again, we're back to understanding -- the language. -- -- Something that might work is to cheat by starting from the last token, then iterating -- backwards evaluating pcalls until you don't get an error or you reach the front of the -- string. function ConsoleScreen:AutoComplete() local str = self.console_edit:GetString() if self.autocompletePrefix == nil and self.autocompleteObj == nil then local autocomplete_obj_name = nil local autocomplete_prefix = str local rev_str = string.reverse( str ) local idx = string.find( rev_str, ".", 1, true ) if idx == nil then idx = string.find( rev_str, ":", 1, true ) end if idx ~= nil then autocomplete_obj_name = string.sub( str, 1, string.len( str ) - idx ) autocomplete_prefix = string.sub( str, string.len( str ) - idx + 2, string.len( str ) - 1 ) end self.autocompletePrefix = autocomplete_prefix if autocomplete_obj_name ~= nil then local status, r = pcall( loadstring( "__KLEI_AUTOCOMPLETE=" .. autocomplete_obj_name ) ) if status then self.autocompleteObjName = string.sub( str, 1, string.len( str ) - idx + 1 ) -- must include that last character! self.autocompleteObj = getmetatable( __KLEI_AUTOCOMPLETE ) if self.autocompleteObj == nil then self.autocompleteObj = __KLEI_AUTOCOMPLETE end end end end local autocomplete_obj = self.autocompleteObj or _G local len = string.len( self.autocompletePrefix ) local found = false local counter = 0 for k, v in pairs( autocomplete_obj ) do if string.starts( k, self.autocompletePrefix ) then if self.autocompleteOffset == -1 or self.autocompleteOffset < counter then self.console_edit:SetString( self.autocompleteObjName .. k ) self.autocompleteOffset = counter found = true break end counter = counter + 1 end end if not found then self.autocompleteOffset = -1 for k, v in pairs( autocomplete_obj ) do if string.starts( k, self.autocompletePrefix ) then self.console_edit:SetString( self.autocompleteObjName .. k ) self.autocompleteOffset = 0 end end end end function ConsoleScreen:Close() SetPause(false) TheInput:EnableDebugToggle(true) TheFrontEnd:PopScreen() end function ConsoleScreen:OnTextEntered() self:Run() self:Close() if TheFrontEnd.consoletext.closeonrun then TheFrontEnd:HideConsoleLog() end end function GetConsoleHistory() return CONSOLE_HISTORY end function SetConsoleHistory(history) if type(history) == "table" and type(history[1]) == "string" then CONSOLE_HISTORY = history end end function ConsoleScreen:DoInit() SetPause(true,"console") TheInput:EnableDebugToggle(false) local label_width = 200 local label_height = 50 local label_offset = 450 local space_between = 30 local height_offset = -270 local fontsize = 30 local edit_width = 900 local edit_bg_padding = 100 self.autocompleteOffset = -1 self.autocompletePrefix = nil self.autocompleteObj = nil self.autocompleteObjName = "" self.root = self:AddChild(Widget("")) self.root:SetScaleMode(SCALEMODE_PROPORTIONAL) self.root:SetHAnchor(ANCHOR_MIDDLE) self.root:SetVAnchor(ANCHOR_BOTTOM) --self.root:SetMaxPropUpscale(MAX_HUD_SCALE) self.root = self.root:AddChild(Widget("")) self.root:SetPosition(0,120,0) self.edit_bg = self.root:AddChild( Image() ) self.edit_bg:SetTexture( "images/ui.xml", "textbox_long.tex" ) self.edit_bg:SetPosition( 0,0,0) self.edit_bg:ScaleToSize( edit_width + edit_bg_padding, label_height ) self.console_edit = self.root:AddChild( TextEdit( DEFAULTFONT, fontsize, "" ) ) self.console_edit:SetPosition( 0,0,0) self.console_edit:SetRegionSize( edit_width, label_height ) self.console_edit:SetHAlign(ANCHOR_LEFT) self.console_edit.OnTextEntered = function() self:OnTextEntered() end --self.console_edit:SetLeftMouseDown( function() self:SetFocus( self.console_edit ) end ) self.console_edit:SetFocusedImage( self.edit_bg, "images/ui.xml", "textbox_long_over.tex", "textbox_long.tex" ) self.console_edit:SetCharacterFilter( VALID_CHARS ) self.console_edit:SetString("") self.history_idx = nil self.console_edit.validrawkeys[KEY_TAB] = true self.console_edit.validrawkeys[KEY_UP] = true self.console_edit.validrawkeys[KEY_DOWN] = true end return ConsoleScreen
Enemy = class(Character) function Enemy:init(id, sprite, hp, moveSpeed, invincibilityTime, attackDist, attackDamage, attackDamageTime, collisionDist, detectDist, collisionDamage, pursueDist, startAttackDist) Character.init(self, id, sprite, hp, moveSpeed, invincibilityTime, attackDist, attackDamage, attackDamageTime) self.collisionDist = collisionDist self.detectDist = detectDist self.collisionDamage = collisionDamage self.pursueDist = pursueDist self.startAttackDist = startAttackDist self.nextPlayerHitTime = 0 self.nextPlayerHitQueued = false leftXOffset = math.max(leftXOffset, detectDist + biggestPivotWidth) rightXOffset = math.max(rightXOffset, detectDist) topYOffset = math.max(topYOffset, detectDist + biggestPivotHeight) bottomYOffset = math.max(bottomYOffset, detectDist) self.state.type = "Enemy" end hits = 0 function Enemy:update() local shouldBaseUpdate = false if self.state.hp <= 0 then if self.animationName ~= "death" then self.animationName = "death" self.aniDir = 1 self.aniFrame = 0 self.aniLooping = false self.isAlive = false local animation = self.sprite.animations[self.animationName] local aniDuration = animation[2] * (1 / animation[3]) self.despawnTime = (love.timer.getTime() + aniDuration * 2) * timeScale self.despawnQueued = true end shouldBaseUpdate = true else if love.timer.getTime() * timeScale >= self.stunEndTime then local dx = player.state.p.x - self.state.p.x local dy = player.state.p.y - self.state.p.y local distSq = dx * dx + dy * dy if distSq < self.detectDist * self.detectDist then local dist = math.sqrt(distSq) local distInv = 1 / dist local vx = dx * distInv local vy = dy * distInv self.facingDir = math.atan2(vy, vx) self.aniDir = self.sprite:getAniDirFromAngle(self.facingDir) if player.isAlive and dist < self.collisionDist then hits = hits + 1 player:gotHit(self, self.collisionDamage, 0.1, 30, 0) self.nextPlayerHitQueued = false end local newAniName = nil if player.isAlive and dist < self.detectDist and dist >= self.pursueDist then newAniName = "walk" local mult = self.moveSpeed * love.timer.getDelta() * timeScale self:move(vector(self.state.p.x + vx * mult, self.state.p.y + vy * mult)) else if not player.isAlive or self.animationName ~= "attack" then newAniName = "walk" self.aniLastChange = love.timer.getTime() * timeScale end end if player.isAlive and dist < self.startAttackDist then newAniName = "attack" if self.animationName ~= "attack" or (self.aniFrame == 0 and self.nextPlayerHitQueued == false) then self.nextPlayerHitTime = (love.timer.getTime() + self.attackDamageTime) * timeScale self.nextPlayerHitQueued = true end end if newAniName and self.animationName ~= newAniName then self.animationName = newAniName self.aniFrame = 0 end if self.animationName == "attack" then shouldBaseUpdate = true if love.timer.getTime() * timeScale >= self.nextPlayerHitTime and self.nextPlayerHitQueued and dist <= self.attackDist then self.nextPlayerHitQueued = false player:gotHit(self, self.attackDamage, 0.1, 90, 0) end end shouldBaseUpdate = true end end end if shouldBaseUpdate then Character.update(self) elseif #self.coroutines > 0 then Character.updateCoroutines(self) end end function Enemy:earlyDraw() if showAggro then local animation = self.sprite.animations[self.animationName] local x = mapP.x + self.state.p.x local y = mapP.y + self.state.p.y love.graphics.setColor(255, 0, 0, 255) love.graphics.circle("line", x, y, self.detectDist, 40) love.graphics.setColor(255, 0, 0, 50) love.graphics.circle("fill", x, y, self.detectDist, 40) love.graphics.setColor(255, 255, 255, 255) end Character.earlyDraw(self) end function Enemy:draw() Character.draw(self) end
VERSION = "1.0.1" local micro = import("micro") local util = import("micro/util") local config = import("micro/config") local buffer = import("micro/buffer") local utf8 = import("utf8") --get a half-finished word at the cursor position . local function getCurrentWordHead(bp) local curpos = -bp.Cursor.Loc local curlinetopos = " " .. util.String(bp.Buf:Substr(buffer.Loc(0,curpos.Y), curpos )) local matched = curlinetopos:match ("[ \t%!%@%#%$%%%^%&%*%(%)%-%_%+%=%\%~%`%[%{%]%}%;%:%'%\"%<%>%,%.%/%?]([^ \t%!%@%#%$%%%^%&%*%(%)%+%=%\%~%`%[%{%]%}%;%:%'%\"%<%>%,%.%/%?]+)$") if matched ~= nil then local word = matched:sub(1, #matched) return word else return nil end end --make a table of candidates by scanning the current document, -- in which the prefix of elements is similar to the half-finished word at current position. local function getCandidates (bp, word) local endpos = bp.Buf:End() local len = 0 local t = {} local keys = {} if word ~= nil then len = utf8.RuneCountInString(word) for i = 0 , endpos.Y do local line = " " .. bp.Buf:Line(i) for x in line:gmatch("[ \t%!%@%#%$%%%^%&%*%(%)%-%_%+%=%\%~%`%[%{%]%}%;%:%'%\"%<%>%,%.%/%?](" .. word .. "[^ \t%!%@%#%$%%%^%&%*%(%)%+%=%\%~%`%[%{%]%}%;%:%'%\"%<%>%,%.%/%?]*)") do if keys[x] == nil and x ~= word then table.insert(t , x) keys[x]= true end end end end return t, len end --Word completion functionality . --if the number of candidate is one , the current word stub is simply replaced with it. --Otherwise, all unique prefixed words in the current pane is listed on the instant bufferpane, -- then let user choose an index from the candidates. local function wordCompletion (bp) local word = getCurrentWordHead(bp) local cand, len = getCandidates(bp, word) if #cand == 1 then local loc = -bp.Cursor.Loc bp.Buf:Replace(buffer.Loc(loc.X - len, loc.Y), loc , cand[1]) elseif #cand ~= 0 then local tc = "" for k,v in ipairs(cand) do tc = tc .. k..") ".. v .."\n" end local id_pane = bp:Tab():GetPane(bp:ID()) local b = buffer.NewBuffer(tc, "/ Word completion candidates /") b.Type.Kind = 1 b.Type.Readonly = true b.Type.Scratch = true b.Type.Syntax = false local e = bp:HSplitIndex(b, true) local ib = micro.InfoBar() ib:Prompt("Input an index > ", "", "WordCompletion", nil, function(resp, canceled) local n = tonumber(resp) if canceled then ib:Message("Word completion is canceled") elseif not canceled and n and 0<n and n<=#cand then local loc = -bp.Cursor.Loc bp.Buf:Replace(buffer.Loc(loc.X - len, loc.Y), loc , cand[n]) end b:Close() e:Quit() bp:Tab():SetActive(id_pane) end ) --~ bp.Cursor:Relocate() --~ bp.Cursor.LastVisualX = bp.Cursor:GetVisualX() end end function init() config.MakeCommand("wordCompletion", wordCompletion, config.NoComplete) end
local gui = require("__flib__.gui-beta") local toolbar = require("gui/toolbar") local events_table = require("gui/events_table") local function header(gui_id) return { type = "flow", ref = {"titlebar"}, children = { {type = "label", style = "frame_title", caption = {"rocket-log.header"}, ignored_by_interaction = true}, {type = "empty-widget", style = "flib_titlebar_drag_handle", ignored_by_interaction = true}, { type = "sprite-button", style = "frame_action_button", sprite = "utility/close_white", hovered_sprite = "utility/close_black", clicked_sprite = "utility/close_black", actions = { on_click = { type = "generic", action = "close-window", gui_id = gui_id }, } } } } end local function open_gui(player) local gui_id = "gui-" .. player.name if not global.guis[gui_id] then --game.print(tostring(game.tick).." creating new gui") local gui_contents = { { type = "frame", direction = "vertical", ref = { "window" }, children = { header(gui_id), toolbar.create_toolbar(gui_id), { type = "tabbed-pane", ref = { "tabs", "pane" }, children = { { tab = { type = "tab", caption = { "rocket-log.tab-events" } }, content = { type = "flow", direction = "vertical", ref = { "tabs", "events_contents" } } }, { tab = { type = "tab", caption = { "rocket-log.tab-summary" } }, content = { type = "flow", direction = "vertical", ref = { "tabs", "summary_contents" } } } } }, } } } global.guis[gui_id] = { gui_id = gui_id, gui = gui.build(player.gui.screen, gui_contents), player = player } end local rocket_log_gui = global.guis[gui_id].gui if player.opened and player.opened ~= rocket_log_gui.window then --game.print(tostring(game.tick).." closing other gui before opening rocketlog") player.opened = nil end toolbar.refresh(gui_id) rocket_log_gui.window.visible = true rocket_log_gui.titlebar.drag_target = rocket_log_gui.window rocket_log_gui.window.force_auto_center() player.opened = rocket_log_gui.window --game.print(tostring(player.opened)) --game.print(tostring(game.tick).." showing rocketlog gui") events_table.create_events_table(gui_id) end local function destroy_gui(gui_id) if global.guis[gui_id] then --game.print(tostring(game.tick).." hiding gui") local rocket_log_gui = global.guis[gui_id].gui rocket_log_gui.window.visible = false if global.guis[gui_id].player.opened == rocket_log_gui.window then global.guis[gui_id].player.opened = nil --game.print(tostring(game.tick).." player cleared") end --global.guis[gui_id] = nil --else --game.print(tostring(game.tick).." no gui to hide") end end local function close_gui(player) local gui_id = "gui-" .. player.name -- Ignore close requests if we are not already open if global.guis[gui_id] and global.guis[gui_id].gui.window.visible then destroy_gui(gui_id) end end local function open_or_close_gui(player, always_open) local gui_id = "gui-" .. player.name if (not always_open) and global.guis[gui_id] and global.guis[gui_id].gui.window.visible then destroy_gui(gui_id) -- Hide existing gui else open_gui(player) -- Create new or show existing gui end end -- Close all player GUIs so they can be recreated (for migrations) local function kill_all_guis() for gui_id, gui_data in pairs(global.guis) do gui_data.gui.window.destroy() end global.guis = {} end local function refresh_all_guis() for gui_id, gui_data in pairs(global.guis) do if gui_data.gui.visible then toolbar.refresh(gui_id) end end end -- Handle actions when clicking the mod gui button or close button local function handle_action(action, event) if action.action == "close-window" then destroy_gui(action.gui_id) end if action.action == "open-rocket-log" then -- mod-gui-button local player = game.players[event.player_index] open_or_close_gui(player, event.control or event.shift) end end -- Handle actions when clicking on the launch and landing pad buttons local function handle_events_action(action, event) local player = event.player_index and game.players[event.player_index] --game.print(tostring(game.tick)..tostring(player.opened)) if player and (action.action == "remote-view" or action.action == "container-gui") then if remote.call("space-exploration", "remote_view_is_unlocked", {player=player}) then --game.print(tostring(game.tick).." closing rocketlog gui because remote view") close_gui(player) -- Must close the GUI before entering remote view for the first time, or the controller becomes disconnected. remote.call("space-exploration", "remote_view_start", {player=player, zone_name=action.zone_name, position=action.position, location_name=action.label, freeze_history=true}) if action.action == "container-gui" and event.button == defines.mouse_button_type.right then local surface = remote.call("space-exploration", "zone_get_surface", {zone_index = remote.call("space-exploration", "get_zone_from_name", {zone_name = action.zone_name}).index}) if surface and surface.valid then local container = surface.find_entities_filtered{type="container", position=action.position, limit=1} if container and container[1] and container[1].valid then --game.print(tostring(game.tick).." opening launchpad gui") player.opened = container[1] end end end end end --game.print(tostring(game.tick)..tostring(player.opened)) end gui.hook_events(function(event) local action = gui.read_action(event) if action then if action.type == "generic" then handle_action(action, event) elseif action.type == "table" then handle_events_action(action, event) elseif action.type == "toolbar" then toolbar.handle_action(action, event) end end end) return { open_or_close_gui = open_or_close_gui, open = open_gui, close = close_gui, kill_all_guis = kill_all_guis, refresh_all_guis = refresh_all_guis }
require("runtime-core/src/component") require("runtime-core/src/directives") require("@vue/shared") require("runtime-core/src/warning") require("runtime-core/src/vnode") require(".") function createAppContext() return {config={isNativeTag=NO, devtools=true, performance=false, globalProperties={}, optionMergeStrategies={}, isCustomElement=NO, errorHandler=undefined, warnHandler=undefined}, mixins={}, components={}, directives={}, provides=Object:create(nil)} end function createAppAPI(render, hydrate) return function createApp(rootComponent, rootProps) if rootProps == nil then rootProps=nil end if rootProps ~= nil and not isObject(rootProps) then __DEV__ and warn() rootProps = nil end local context = createAppContext() local installedPlugins = Set() local isMounted = false local app = {_component=rootComponent, _props=rootProps, _container=nil, _context=context, version=version, config=function() return context.config end , config=function(v) if __DEV__ then warn() end end , use=function(plugin, ...) if installedPlugins:has(plugin) then __DEV__ and warn() elseif plugin and isFunction(plugin.install) then installedPlugins:add(plugin) plugin:install(app, ...) elseif isFunction(plugin) then installedPlugins:add(plugin) plugin(app, ...) elseif __DEV__ then warn( + ) end return app end , mixin=function(mixin) if __FEATURE_OPTIONS__ then if not context.mixins:includes(mixin) then table.insert(context.mixins, mixin) elseif __DEV__ then -- [ts2lua]lua中0和空字符串也是true,此处mixin.name需要确认 warn('Mixin has already been applied to target app' .. (mixin.name and {} or {''})[1]) end elseif __DEV__ then warn('Mixins are only available in builds supporting Options API') end return app end , component=function(name, component) if __DEV__ then validateComponentName(name, context.config) end if not component then -- [ts2lua]context.components下标访问可能不正确 return context.components[name] end -- [ts2lua]context.components下标访问可能不正确 if __DEV__ and context.components[name] then warn() end -- [ts2lua]context.components下标访问可能不正确 context.components[name] = component return app end , directive=function(name, directive) if __DEV__ then validateDirectiveName(name) end if not directive then -- [ts2lua]context.directives下标访问可能不正确 return context.directives[name] end -- [ts2lua]context.directives下标访问可能不正确 if __DEV__ and context.directives[name] then warn() end -- [ts2lua]context.directives下标访问可能不正确 context.directives[name] = directive return app end , mount=function(rootContainer, isHydrate) if not isMounted then local vnode = createVNode(rootComponent, rootProps) vnode.appContext = context if __DEV__ then context.reload = function() render(cloneVNode(vnode), rootContainer) end end if isHydrate and hydrate then hydrate(vnode, rootContainer) else render(vnode, rootContainer) end isMounted = true app._container = rootContainer return ().proxy elseif __DEV__ then warn( + + + ) end end , unmount=function() if isMounted then render(nil, app._container) elseif __DEV__ then warn() end end , provide=function(key, value) if __DEV__ and context.provides[key] then warn( + ) end -- [ts2lua]context.provides下标访问可能不正确 context.provides[key] = value return app end } return app end end
local playsession = { {"mewmew", {652890}}, {"NekoBaron", {3517758}}, {"Giatros", {324457}}, {"dpoba", {562827}}, {"Bratanchikov", {10744}}, {"coucounoir", {19198}}, {"LT.Jack", {411925}}, {"Zorzzz", {2994001}}, {"ratboyboxshall", {3035963}}, {"peggeleg", {8147}}, {"Watermelon141", {8549}}, {"Sjetil", {601244}}, {"redlabel", {1514359}}, {"wotwotvodka", {255960}}, {"Birdz", {1529}}, {"Nick_Wilde_", {2718}}, {"Loriangrei", {47432}}, {"Toshio86", {243616}}, {"FlorisFireball", {571643}}, {"Tommy17", {177237}}, {"loers", {25107}}, {"Alpha_Blood", {5055}}, {"karl93", {15008}}, {"Volvary", {1255123}}, {"NoAndDot", {12234}}, {"L75", {491}}, {"LegendKG", {343808}}, {"StarLite", {8888}}, {"beranabus", {223935}}, {"dslrpotato", {10077}}, {"Erios", {1336}}, {"jure12345678", {5359}}, {"lazerandy", {289584}}, {"Laser_Einstein", {594987}}, {"BLURE4L", {10333}}, {"hobbitmax", {3459}}, {"NMSL", {16185}}, {"zw780", {134562}}, {"TheDinkster", {297261}}, {"Makri", {550629}}, {"GaryTsukla", {1343409}}, {"Julian1109", {336}}, {"M3at", {4397}}, {"SMikiS", {42727}}, {"petterah", {379361}}, {"zelrun", {5190}}, {"jimmy1235", {1794872}}, {"thefunnykinger", {3666}}, {"Kopernic", {627129}}, {"Pantherra1", {37789}}, {"TickTack0", {318022}}, {"maggens", {7681}}, {"xcube", {184743}}, {"PplzSht", {5436}}, {"Yardsnake", {539040}}, {"Irx99", {863338}}, {"SuddenDeathMP", {317223}}, {"ANV1L", {544974}}, {"Cheeseftw", {217820}}, {"Jaazinh", {6228}}, {"LazyMight", {182071}}, {"_SxG_", {19309}}, {"ikea", {7503}}, {"Revaliz", {22301}}, {"BlueBug", {11215}}, {"ETK03", {61987}}, {"boeljoet", {610729}}, {"ManLee", {57634}}, {"ScienceAndPasta", {359027}}, {"CommanderFrog", {64113}}, {"Evorionos", {5726}}, {"duckfin", {11921}}, {"Xheotris", {656455}}, {"joe9go", {169773}}, {"recklesssninja", {842958}}, {"YeeBurrito", {3116}}, {"falcon1209", {57477}}, {"skub", {507636}}, {"Appadeia", {119714}}, {"hsxu", {1203}}, {"gou", {1609}}, {"icedevml", {6708}}, {"clarkbarz", {80827}}, {"Ryxex", {2050}}, {"wraithax", {10876}}, {"allexdmb", {36297}}, {"jjasd", {8365}}, {"JC1223", {279908}}, {"The_Dirty_Carl", {11168}}, {"ShenanigansMC", {165}}, {"Nashoba", {128543}}, {"climbinguy", {17924}}, {"IIIllIIIlIllllIIIIII", {61473}}, {"Seyu", {11610}}, {"Wanzek", {4111}}, {"jimyloko1", {8829}}, {"captcougar1969", {161284}}, {"datadrian", {402866}}, {"bix06", {1038007}}, {"Mooono", {17720}}, {"JoeSchmoe", {2754}}, {"bappo", {16524}}, {"ZTX", {295794}}, {"Dr.Flizzle", {70058}}, {"fireenn", {4120}}, {"Doctor_Goose", {6407}}, {"Ladadoos", {3745}}, {"DelusVibes", {24166}}, {"Arcolyte", {98695}}, {"Mokomi", {22183}}, {"Shufti", {7092}}, {"Simmarn", {138}}, {"leviculus", {95962}}, {"TsijAzog", {667836}}, {"Chalureel", {314604}}, {"Mr.Candlestick", {354537}}, {"JSONROY", {28601}}, {"tbell91", {7475}}, {"Yaxley", {8018}}, {"miniclip1371", {793482}}, {"cowboygeeker", {2026}}, {"winibo", {142237}}, {"thoma5nator", {157589}}, {"Chewytheshark", {9250}}, {"ezocker", {32799}}, {"ChessIndustries", {3522}}, {"ZumbieHater", {3957}}, {"VincentMonster", {720098}}, {"smokabul", {729}}, {"RebuffedBrute44", {137352}}, {"tQuarella", {74520}}, {"alnmike", {25936}}, {"AlabamaSxS", {443722}}, {"EzeRamos", {7016}}, {"Javara1", {9895}}, {"SuperCoder79", {8442}}, {"NinSegaBros", {530}}, {"ForgottenGlory", {9173}}, {"BotSaber", {367}}, {"Sonikee", {20624}}, {"KevinoFactorioBoi", {30003}}, {"Arthfael208", {659491}}, {"Arotaes", {81072}}, {"joocebox", {7203}}, {"codekaiju", {11462}}, {"logloglog", {2849}}, {"three_days", {181375}}, {"crophlin", {691}}, {"RambaoEngineer", {11722}}, {"wengPC", {22225}}, {"Taylor-Swift", {8386}}, {"armaggeddon321", {4876}}, {"Therosfire", {101}}, {"steelhero", {64912}}, {"Morichalion", {1851}}, {"themostinternet", {3964}}, {"CommradCory870", {187806}}, {"Renoh", {33281}}, {"Darkren", {16670}}, {"Evo335", {12609}}, {"BluJester", {9087}}, {"fznsmiles", {24934}}, {"Borosaith", {15366}}, {"codedog14", {16493}}, {"Cham1137", {181}}, {"Grandma_x", {103120}}, {"Thuro", {376029}}, {"HeavenSxFire", {145}}, {"templarchon", {99008}}, {"ayakano", {55769}}, {"Bryce940", {740898}}, {"samueljr", {165169}}, {"OmegaLunch", {184462}}, {"Fluff44", {5243}}, {"ChiiChoTV", {3829}}, {"00null00", {34368}}, {"leeber2002", {75663}}, {"RemoChicken", {20007}}, {"torrimac", {106379}}, {"cheet0s", {42096}}, {"zachdyer", {35945}}, {"-slug-", {13962}}, {"Nathannerd", {3190}}, {"YaboiMuggy", {23775}}, {"--Drake--", {21514}}, {"Ravengyre", {4733}}, {"McCrow", {3493}}, {"Ryld", {20419}}, {"Mlasal2", {18647}}, {"InDstructR", {246413}}, {"quigro", {6991}}, {"Chevalier1200", {1022290}}, {"MrScottah", {55407}}, {"Knifetanner2", {170163}}, {"Felix0900", {6402}}, {"kkioos5034", {17591}}, {"seamus774", {46957}}, {"Powerpanda0", {916239}}, {"liujingmin", {4355}}, {"Klausausderkasse", {6086}}, {"TylerHoof", {7102}}, {"kumappo", {334}}, {"cocoilove", {98053}}, {"faerbit", {5716}}, {"Ran_Mw", {4049}}, {"Eric_the_Red", {15296}}, {"Spocks", {681740}}, {"ThatOrangeWorker", {16618}}, {"greensweet", {52036}}, {"Burny", {623826}}, {"replicantlp", {1356}}, {"WinKill", {90477}}, {"tigar", {5458}}, {"MasjazZ", {515}}, {"Catbert", {31789}}, {"kabutas", {18537}}, {"ItsWombo", {12428}}, {"rykstar", {51704}}, {"zultr0n", {32137}}, {"LaczkoUr", {47015}}, {"everLord", {65570}}, {"Kamikatze", {64677}}, {"Faalhaas", {9326}}, {"vedolv", {17479}} } return playsession
--- Array methods. -- Modules -- local af = require("arrayfire_lib") -- Exports -- local M = {} -- See also: https://github.com/arrayfire/arrayfire/blob/devel/src/api/cpp/array.cpp -- -- local Dims = {} -- function M.Add (array_module, meta) local Call = array_module.Call local CallWrap = array_module.CallWrap local GetLib = array_module.GetLib -- local function Get (name) name = "af_" .. name return function(arr) return Call(name, arr:get()) end end -- -- local SizeOf = {} for prefix, size in ("f32 f64 s32 u32 s64 u64 u8 b8 c32 c64 s16 u16"):gmatch "(%a)(%d+)" do local k = af[prefix .. size] if k then -- account for earlier versions SizeOf[k] = tonumber(size) / (prefix == "c" and 4 or 8) -- 8 bits to a byte; double complex types end end -- for k, v in pairs{ -- as = function(arr, atype) return CallWrap("af_cast", arr:get(), af[atype]) end, -- bytes = function(arr) local ha = arr:get() local n, dtype = Call("af_get_elements", ha), Call("af_get_type", ha) return n * (SizeOf[dtype] or 4) end, -- copy = function(arr) return CallWrap("af_copy_array", arr:get()) end, -- dims = function(arr, i) if i then return GetLib().getDims(arr, Dims)[i + 1] else return GetLib().getDims(arr) end end, -- elements = Get("get_elements"), -- eval = function(arr) Call("af_eval", arr:get()) end, -- get = array_module.GetHandle, -- isbool = Get("is_bool"), -- iscolumn = Get("is_column"), -- iscomplex = Get("is_complex"), -- isdouble = Get("is_double"), -- isempty = Get("is_empty"), -- isfloating = Get("is_floating"), -- isinteger = Get("is_integer"), -- isrealfloating = Get("is_real_floating"), -- isrow = Get("is_row"), -- isscalar = Get("is_scalar"), -- issingle = Get("is_single"), -- isvector = Get("is_vector"), -- H = function(arr) return GetLib().transpose(arr, true) end, -- numdims = function(arr) return GetLib().numDims(arr) end, -- set = array_module.SetHandle, -- T = function(arr) return GetLib().transpose(arr) end, type = Get("get_type") } do meta[k] = v end end -- Export the module. return M
local _tostring = tostring local _tonumber = tonumber local _unpack = unpack --VALIDATION if(not KEYS[1] or not _tostring(KEYS[1])) then return redis.error_reply('NO ROOM NAME KEY') end if(ARGV) then for x=1, #ARGV do if(not _tostring(ARGV[x])) then return redis.error_reply('ROOM PARAM INVALID') end end end --======================================================================== -- UTILITY Functions --======================================================================== local convertValueType = function(value) local newVal, isNumeric, isString, isJson isNumeric = _tonumber(value) if(isNumeric) then return isNumeric else isString = _tostring(value) if(not isString) then return nil elseif(isString == 'true' or isString == 'false') then return isString == 'true' else isJson = isString:sub(1, 1) == "{" or isString:sub(1, 1) == "[" if(isJson) then return cjson.decode(value) end return isString end end end --======================================================================== -- CORE Functions --======================================================================== local clientRoomName = KEYS[1] local roomInfoKeys = ARGV local rk = { roomInfo = 'rooms|'..clientRoomName..'|info', } local formatted = {} local data, x if(not roomInfoKeys) then data = redis.call('hgetall', rk.roomInfo) x = 1 while x <= #data do formatted[data[x]] = convertValueType(data[x+1]) x = x + 2 end else data = redis.call('hmget', rk.roomInfo, _unpack(roomInfoKeys)) for x=1, #data do formatted[roomInfoKeys[x]] = convertValueType(data[x]) end end formatted = cjson.encode(formatted) return redis.status_reply(formatted)
local DS = LibStub("AceAddon-3.0"):GetAddon("Doom Shards", true) if not DS then return end local WS = DS:NewModule("warningSound", "AceEvent-3.0") -- can't use sound since it's a legacy option :/ local LSM = LibStub("LibSharedMedia-3.0") -------------- -- Upvalues -- -------------- local GetTime = GetTime local pairs = pairs local PlaySoundFile = PlaySoundFile ------------ -- Frames -- ------------ local WSFrame = DS:CreateParentFrame("DS Sound Display", "sound") -- only used for OnUpdate WSFrame:Hide() --------------- -- Variables -- --------------- local db local counter = 0 local isOverOrbThreshold -- boolean to play sound local soundFile local soundInterval local timeFrame -------------- -- API Call -- -------------- function DoomShards:SetSound(bool) if bool then if UnitAffectingCombat("player") then WSFrame:Show() end else WSFrame:Hide() end end --------------- -- Functions -- --------------- do local previousOrbs = 0 function WS:DOOM_SHARDS_UPDATE() local updatedOrbs = DS.resource if updatedOrbs < previousOrbs then counter = 0 end previousOrbs = updatedOrbs local expectedShards = 0 local timeStamp = GetTime() + timeFrame for GUID, tbl in pairs(DS.auras) do local i = 0 for spellID, aura in pairs(tbl) do local tick, resourceChance, isLastTick repeat tick, resourceChance, isLastTick = aura:IterateTick(tick) if tick < timeStamp then expectedShards = expectedShards + resourceChance i = i + 1 end until isLastTick or tick > timeStamp or i > 100 end end isOverOrbThreshold = (updatedOrbs >= 3) and (updatedOrbs + expectedShards) >= 5 end end WSFrame:SetScript("OnUpdate", function(frame, elapsed) counter = counter - elapsed if counter <= 0 and isOverOrbThreshold then PlaySoundFile(soundFile, "Master") counter = soundInterval end end) function WS:PLAYER_REGEN_DISABLED() local _, instanceType = GetInstanceInfo() if instanceType == "party" and not IsInInstance() then instanceType = "none" end -- fix for Garrisons if db.instances[instanceType] then WSFrame:Show() end end function WS:PLAYER_REGEN_ENABLED() WSFrame:Hide() end function WS:Build() db = DS.db.warningSound soundFile = LSM:Fetch("sound", DS.db.warningSound.soundHandle) soundInterval = DS.db.warningSound.soundInterval timeFrame = db.timeFrame if UnitAffectingCombat("player") then self:PLAYER_REGEN_DISABLED() end end function WS:OnEnable() self:RegisterMessage("DOOM_SHARDS_UPDATE") self:RegisterEvent("PLAYER_REGEN_DISABLED") self:RegisterEvent("PLAYER_REGEN_ENABLED") end function WS:OnDisable() WSFrame:Hide() self:UnregisterMessage("DOOM_SHARDS_UPDATE") self:UnregisterEvent("PLAYER_REGEN_DISABLED") self:UnregisterEvent("PLAYER_REGEN_ENABLED") end
local config = require "api-umbrella.proxy.models.file_config" local http = require "resty.http" local is_empty = require("pl.types").is_empty local json_decode = require("cjson").decode local json_encode = require "api-umbrella.utils.json_encode" local server = config["elasticsearch"]["_first_server"] local _M = {} function _M.query(path, options) local httpc = http.new() if not options then options = {} end options["path"] = path if not options["headers"] then options["headers"] = {} end if server["userinfo"] and not options["headers"]["Authorization"] then options["headers"]["Authorization"] = "Basic " .. ngx.encode_base64(server["userinfo"]) end if options["body"] and type(options["body"]) == "table" then options["body"] = json_encode(options["body"]) if not options["headers"]["Content-Type"] then options["headers"]["Content-Type"] = "application/json" end end local connect_ok, connect_err = httpc:connect(server["host"], server["port"]) if not connect_ok then httpc:close() return nil, "elasticsearch connect error: " .. (connect_err or "") end if server["scheme"] == "https" then local ssl_ok, ssl_err = httpc:ssl_handshake(nil, server["host"], true) if not ssl_ok then httpc:close() return nil, "elasticsearch ssl handshake error: " .. (ssl_err or "") end end local res, err = httpc:request(options) if err then httpc:close() return nil, "elasticsearch request error: " .. (err or "") end local body, body_err = res:read_body() if body_err then httpc:close() return nil, "elasticsearch read body error: " .. (body_err or "") end res["body"] = body local keepalive_ok, keepalive_err = httpc:set_keepalive() if not keepalive_ok then httpc:close() return nil, "elasticsearch keepalive error: " .. (keepalive_err or "") end if res.status >= 400 and res.status ~= 404 then return nil, "Unsuccessful response: " .. (body or "") else if res.headers["Content-Type"] and string.sub(res.headers["Content-Type"], 1, 16) == "application/json" and not is_empty(body) then res["body_json"] = json_decode(body) end return res end end return _M
SB.Include(Path.Join(SB.DIRS.SRC, 'view/editor.lua')) TriggersWindow = Editor:extends{} TriggersWindow:Register({ name = "triggersWindow", tab = "Logic", caption = "Triggers", tooltip = "Edit triggers", image = Path.Join(SB.DIRS.IMG, 'cog.png'), order = 1, }) function TriggersWindow:init() self:super("init") self.btnAddTrigger = TabbedPanelButton({ x = 0, y = 0, tooltip = "Add trigger", children = { TabbedPanelImage({ file = Path.Join(SB.DIRS.IMG, 'trigger-add.png') }), TabbedPanelLabel({ caption = "Add" }), }, OnClick = { function() self:AddTrigger() self.btnAddTrigger:SetPressedState(true) end }, }) self:AddDefaultKeybinding({ self.btnAddTrigger }) self._triggers = StackPanel:New { itemMargin = {0, 0, 0, 0}, width = "100%", autosize = true, resizeItems = false, } local children = { ScrollPanel:New { x = 0, y = 80, bottom = 30, right = 0, borderColor = {0,0,0,0}, horizontalScrollbar = false, children = { self._triggers }, }, self.btnAddTrigger, } self:Populate() SB.model.triggerManager:addListener(TriggerManagerListenerWidget(self)) self:Finalize(children) end function TriggersWindow:AddTrigger() local trigger = { events = {}, conditions = {}, actions = {}, enabled = true, } -- generate new trigger name local triggers = Table.SortByAttr(SB.model.triggerManager:getAllTriggers(), "name") for i = 1, math.huge do trigger.name = "Trigger " .. tostring(i) local found = false for _, t in pairs(triggers) do if t.name == trigger.name then found = true break end end if not found then break end end self:MakeTriggerWindow(trigger, false) --[[ local newTrigger = model:NewTrigger() self:Populate() for i = 1, #self._triggers.children do local panel = self._triggers.children[i] if panel.triggerID == newTrigger.id then local btnEdit = panel.children[1] btnEdit:CallListeners(btnEdit.OnClick) return end end--]] end function TriggersWindow:MakeRemoveTriggerWindow(triggerID) local cmd = RemoveTriggerCommand(triggerID) SB.commandManager:execute(cmd) end function TriggersWindow:Populate() self._triggers:ClearChildren() local triggers = Table.SortByAttr(SB.model.triggerManager:getAllTriggers(), "name") for id, trigger in pairs(triggers) do local stackTriggerPanel = MakeComponentPanel(self._triggers) stackTriggerPanel.triggerID = trigger.id local btnEditTrigger = Button:New { caption = trigger.name, x = 1, right = SB.conf.B_HEIGHT * 2 + 10, --FIXME: figure out how to extend it a bit further height = SB.conf.B_HEIGHT, _toggle = nil, parent = stackTriggerPanel, tooltip = "Edit trigger", } btnEditTrigger.OnClick = { function() self:MakeTriggerWindow(trigger, true) end } local btnCloneTrigger = Button:New { caption = "", right = SB.conf.B_HEIGHT + 8, width = SB.conf.B_HEIGHT, height = SB.conf.B_HEIGHT, parent = stackTriggerPanel, padding = {0, 0, 0, 0}, tooltip = "Clone trigger", children = { Image:New { file = Path.Join(SB.DIRS.IMG, 'trigger-add.png'), height = SB.conf.B_HEIGHT, width = SB.conf.B_HEIGHT, padding = {0, 0, 0, 0}, margin = {0, 0, 0, 0}, }, }, OnClick = { function() local newTrigger = Table.DeepCopy(trigger) newTrigger.id = nil newTrigger.name = newTrigger.name .. " copy" local cmd = AddTriggerCommand(newTrigger) SB.commandManager:execute(cmd) end }, } local btnRemoveTrigger = Button:New { caption = "", right = 0, width = SB.conf.B_HEIGHT, height = SB.conf.B_HEIGHT, parent = stackTriggerPanel, padding = {2, 2, 2, 2}, tooltip = "Remove trigger", classname = "negative_button", children = { Image:New { tooltip = "Remove trigger", file = Path.Join(SB.DIRS.IMG, 'cancel.png'), height = "100%", width = "100%", }, }, OnClick = {function() self:MakeRemoveTriggerWindow(trigger.id) end}, } end end function TriggersWindow:MakeTriggerWindow(trigger, edit) local triggerCopy = Table.DeepCopy(trigger) local triggerWindow = TriggerWindow(triggerCopy) local sw = self.window local tw = triggerWindow.window tw.x = 500 tw.y = 500 SB.SetControlEnabled(sw, false) table.insert(tw.OnDispose, function() SB.SetControlEnabled(sw, true) self.btnAddTrigger:SetPressedState(false) if not triggerWindow.save then return end local cmd if edit then cmd = UpdateTriggerCommand(triggerCopy) else cmd = AddTriggerCommand(triggerWindow.trigger) end SB.commandManager:execute(cmd) end ) return triggerWindow end TriggerManagerListenerWidget = TriggerManagerListener:extends{} function TriggerManagerListenerWidget:init(triggerWindow) self.triggerWindow = triggerWindow end function TriggerManagerListenerWidget:onTriggerAdded(triggerID) self.triggerWindow:Populate() end function TriggerManagerListenerWidget:onTriggerRemoved(triggerID) self.triggerWindow:Populate() end function TriggerManagerListenerWidget:onTriggerUpdated(triggerID) self.triggerWindow:Populate() end
function func() return 69 end
local _G = _G local NeP = NeP ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("target.player", "", "") NeP.DSL:Register("player", function(target) return _G.UnitIsPlayer(target) end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("target.caster", "", "") NeP.DSL:Register("caster", function(target) local class = select(2, _G.UnitClass(target)) if class == "Priest" or class == "Mage" or class == "Warlock" then return true end end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("target.disarmclass", "", "") NeP.DSL:Register("disarmclass", function(target) local class = select(2, _G.UnitClass(target)) if class == "WARRIOR" or class == "PALADIN" or class == "HUNTER" or class == "ROGUE" or class == "DEATHKNIGHT" or class == "MONK" or class == "DEMONHUNTER" then return true end end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("player.infront.of.target", "", "") NeP.DSL:Register("infront.of.target", function(target) return NeP.Protected.Infront("target", target) end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("player.behind.of.target", "", "") NeP.DSL:Register("behind.of.target", function(target) return not NeP.Protected.Infront("target", target) end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("target.race", "", "") NeP.DSL:Register("race", function(target) return _G.UnitRace(target) end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("target.canAttack", "", "") NeP.DSL:Register("canAttack", function(target) return _G.UnitCanAttack(target, "player") and _G.UnitCanAttack("player", target) end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("target.faction.positive", "", "") NeP.DSL:Register("faction.positive", function(target) if _G.UnitFactionGroup("player") == _G.UnitFactionGroup(target) and _G.UnitIsPlayer(target) and not _G.UnitIsDeadOrGhost(target) then return true end end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("target.faction.negative", "", "") NeP.DSL:Register("faction.negative", function(target) if _G.UnitFactionGroup("player") ~= _G.UnitFactionGroup(target) and _G.UnitIsPlayer(target) and not _G.UnitIsDeadOrGhost(target) then return true end end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- --/dump NeP.DSL.Parse("flying", "", "") NeP.DSL:Register("flying", function() return _G.IsFlying() end) ------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------------- local last_fall = 0; local falling_for = 0; function buildFallTime() -- if we´re not falling then reset the counter and return 0 if not _G.IsFalling() then last_fall = 0 falling_for = 0 return; end -- if we have a time set then return the difference local time = _G.GetTime() if last_fall > 0 then falling_for = time - last_fall return; end -- otherwise set time and return 0 last_fall = time falling_for = 0 end C_Timer.NewTicker(0.1, buildFallTime) --/dump NeP.DSL.Parse("falling.duration", "", "") -- dump when you fall NeP.DSL:Register({"falling.duration", "fall.duration"}, function() return falling_for end) ------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------------------------------
local TP = {} --TODO FIX THIS TP.tp = 100 -- THE ACTUAL TP VALUE TP.visualtp = 0 -- What the WHITE/RED bar displays TP.laggedtp = 0 -- What the orange bar displays TP.maxtp = 100 -- The maximum amount of TP allowed! TP.highlighted = 0 -- How much TP is highlighted to show an action cost. 0 For no highlight. TP.color_backdrop = {0.5, 0, 0} TP.color_fill = {1, 160/255, 64/255} TP.color_float = {1, 1, 1} TP.color_sink = {1, 0, 0} TP.color_max = {1, 208/255, 32/255} function GetTP() return TP.tp end function SetTP(tp) TP.tp = math.min(tp,TP.maxtp) end function GetMaxTP() return TP.maxtp end function SetMaxTP(max) TP.maxtp = max end function AddTP(tp) TP.tp = TP.tp + math.min(tp,TP.maxtp-TP.tp) end TP.Init = function() TP.Frame = CreateSprite(Kromer_FindSprite("UI/Battle/tpbar"),"UpperUI") TP.Frame.MoveTo(50,342) TP.Background = CreateSprite(Kromer_FindSprite("UI/Battle/tpback")) TP.Background.SetParent(TP.Frame) TP.Background.Mask("sprite") TP.Background.MoveTo(0,0) TP.Float = CreateSprite("px") TP.Float.SetParent(TP.Background) TP.Float.MoveTo(0,-TP.Background.height/2) TP.Float.ypivot = 0 TP.Float.xscale = TP.Background.width TP.Sink = CreateSprite("px") TP.Sink.SetParent(TP.Background) TP.Sink.MoveTo(0,-TP.Background.height/2) TP.Sink.ypivot = 0 TP.Sink.xscale = TP.Background.width TP.Fill = CreateSprite("px") TP.Fill.SetParent(TP.Background) TP.Fill.MoveTo(0,-TP.Background.height/2) TP.Fill.ypivot = 0 TP.Fill.xscale = TP.Background.width TP.Highlight = CreateSprite("px") TP.Highlight.SetParent(TP.Background) TP.Highlight.MoveTo(0,-TP.Background.height/2) TP.Highlight.ypivot = 0 TP.Highlight.xscale = TP.Background.width TP.Indicator = CreateSprite(Kromer_FindSprite("UI/Battle/tpindicator")) TP.Indicator.SetParent(TP.Frame) TP.Indicator.MoveTo(-31,45) TP.Text = TextSystem.CreateText("[instant]Oopsie Doodle","BattleUIText",320,240,"UpperUI") TP.Text["text"].SetParent(TP.Indicator) TP.Text["text"].MoveTo(-10,-42) TP.Text.Set = function() local space = 0 local xscale = 1 local text = math.floor(math.min(TP.visualtp,TP.laggedtp)) TP.Percent.alpha = 1 if text < 10 then space = 2 end if text >= 10 then space = -5 end if text >= 100 then space = -9 xscale = 0.75 end if text >= TP.maxtp then text = "[linespacing:-10][color:ffff00]M\n A\n[charspacing:5] X" space = -2 xscale = 1 TP.Percent.alpha = 0 end TP.Text["text"].xscale = xscale TP.Text["text"].SetText("[font:uidialog][linespacing:-5][instant][charspacing:"..space.."] [charspacing:default]"..text) end TP.Percent = CreateSprite(Kromer_FindSprite("UI/Battle/tppercent")) TP.Percent.SetParent(TP.Frame) TP.Percent.MoveTo(-29,-13) TP.Text.Set() end TP.Update = function() TP.Frame.x = 50 + (UI.baseui.y-240)/3 TP.Float.y = -TP.Background.height/2 TP.Sink.y = -TP.Background.height/2 TP.Background.alpha = 1 TP.Highlight.alpha = 0 TP.Background.color = TP.color_backdrop TP.Fill.color = TP.color_fill TP.Float.color = TP.color_float TP.Sink.color = TP.color_sink if math.abs(TP.visualtp - TP.tp) < 10 then TP.visualtp = TP.tp end if TP.visualtp < TP.tp then TP.visualtp = TP.visualtp + 10 end if TP.visualtp > TP.tp then TP.visualtp = TP.visualtp - 10 end if TP.visualtp ~= TP.laggedtp then if TP.visualtp - TP.laggedtp > 0 then TP.laggedtp = TP.laggedtp + 1 end if TP.visualtp - TP.laggedtp > 10 then TP.laggedtp = TP.laggedtp + 1 end if TP.visualtp - TP.laggedtp > 25 then TP.laggedtp = TP.laggedtp + 1.5 end if TP.visualtp - TP.laggedtp > 50 then TP.laggedtp = TP.laggedtp + 2 end if TP.visualtp - TP.laggedtp > 100 then TP.laggedtp = TP.laggedtp + 2.5 end if TP.visualtp - TP.laggedtp < 0 then TP.laggedtp = TP.laggedtp - 1 end if TP.visualtp - TP.laggedtp < -10 then TP.laggedtp = TP.laggedtp - 1 end if TP.visualtp - TP.laggedtp < -25 then TP.laggedtp = TP.laggedtp - 1.5 end if TP.visualtp - TP.laggedtp < -50 then TP.laggedtp = TP.laggedtp - 2 end if TP.visualtp - TP.laggedtp < -100 then TP.laggedtp = TP.laggedtp - 2.5 end if math.abs(TP.visualtp - TP.laggedtp) < 1 then TP.laggedtp = TP.visualtp end TP.Text.Set() end if TP.visualtp < TP.laggedtp then TP.Sink.yscale = (TP.laggedtp / TP.maxtp) * TP.Background.height TP.Float.yscale = TP.Sink.yscale + 2 TP.Fill.yscale = (TP.visualtp / TP.maxtp) * TP.Background.height elseif TP.visualtp > TP.laggedtp then TP.Float.yscale = (TP.visualtp / TP.maxtp) * TP.Background.height + 2 if TP.laggedtp == TP.maxtp then TP.Fill.color = TP.color_max end TP.Fill.yscale = (TP.laggedtp / TP.maxtp) * TP.Background.height elseif TP.visualtp == TP.laggedtp then TP.Sink.yscale = 0 if TP.laggedtp == TP.maxtp then TP.Fill.color = TP.color_max end TP.Fill.yscale = (TP.laggedtp / TP.maxtp) * TP.Background.height TP.Float.yscale = TP.Fill.yscale + 2 end if TP.highlighted > 0 then -- Extremely funky way to achieve the highlight effect with only the currently loaded sprites. -- Background is hidden, fill is lowered, float becomes a bar, sink becomes the background local height_tp = (TP.tp / TP.maxtp) * TP.Background.height -- Set highlight color local highlightcolor = {1,1,1} highlightcolor[4] = math.abs(math.sin(Time.time*2) * 0.5) + 0.2 local aftercost = ((TP.tp - TP.highlighted) / TP.maxtp) * TP.Background.height -- This little maneuver is gonna cost us all our TP if aftercost <= 0 then highlightcolor = {0.25,0.25,0.25} highlightcolor[4] = 0.7 end -- Gah hah hah!! THOUST FOOLS! That wasn'tst the REAL highlight colore! For some reason. highlightcolor = {lerp(highlightcolor[1],TP.color_fill[1],highlightcolor[4]),lerp(highlightcolor[2],TP.color_fill[2],highlightcolor[4]),lerp(highlightcolor[3],TP.color_fill[3],highlightcolor[4]),0.7} -- Just make float the little white bar TP.Float.y = -TP.Background.height/2 + height_tp TP.Float.yscale = 2 -- Make the sink the fake background -- TODO: Replace this in case people use non-solid color sprites for their TP background? TP.Sink.color = TP.color_backdrop TP.Sink.yscale = TP.Background.height - height_tp TP.Sink.y = -TP.Background.height/2 + height_tp + 2 -- Change fill height TP.Fill.yscale = aftercost -- Add the highlight where the fill left off TP.Highlight.color = highlightcolor TP.Highlight.yscale = (TP.highlighted / TP.maxtp) * TP.Background.height TP.Highlight.y = -TP.Background.height/2 + TP.Fill.yscale TP.Background.alpha = 0.01 -- Hopefully no one will notice. A workaround for that gosh-dern mask! end end return TP
return function() require'nvim-treesitter.configs'.setup { highlight = { enable = true, -- false will disable the whole extension }, incremental_selection = { enable = true, keymaps = { -- mappings for incremental selection (visual mappings) init_selection = "gnn", -- maps in normal mode to init the node/scope selection node_incremental = "grn", -- increment to the upper named parent scope_incremental = "grc", -- increment to the upper scope (as defined in locals.scm) node_decremental = "grm", -- decrement to the previous node } }, refactor = { highlight_definitions = { enable = true }, highlight_current_scope = { enable = true }, smart_rename = { enable = true, keymaps = { smart_rename = "grr" -- mapping to rename reference under cursor } }, navigation = { enable = true, keymaps = { goto_definition = "gnd", -- mapping to go to definition of symbol under cursor list_definitions = "gnD" -- mapping to list all definitions in current file } } }, textobjects = { -- syntax-aware textobjects enable = true, disable = {}, keymaps = { ["iL"] = { -- you can define your own textobjects directly here python = "(function_definition) @function", cpp = "(function_definition) @function", c = "(function_definition) @function", java = "(metheclaration) @function" }, -- or you use the queries from supported languages with textobjects.scm ["af"] = "@function.outer", ["if"] = "@function.inner", ["aC"] = "@class.outer", ["iC"] = "@class.inner", ["ac"] = "@conditional.outer", ["ic"] = "@conditional.inner", ["ae"] = "@block.outer", ["ie"] = "@block.inner", ["al"] = "@loop.outer", ["il"] = "@loop.inner", ["is"] = "@statement.inner", ["as"] = "@statement.outer", ["ad"] = "@comment.outer", ["am"] = "@call.outer", ["im"] = "@call.inner" } }, ensure_installed = "all" -- one of "all", "language", or a list of languages } end
local Character = {} local RunServ = game:GetService("RunService") local PlayerServ = game:GetService("Players") local Settings = require(script.Parent.Settings) Character.Container = nil Character.CharacterObject = nil Character._connection = nil function Character:CreateContainer() self.Container = Instance.new("BloomEffect") self.Container.Name = PlayerServ.LocalPlayer.Name .. "'s Character" self.Container.Parent = workspace end function Character:GetContainer() if self.Container == nil then self:CreateContainer() elseif self.Container.Parent ~= workspace then self.Container.Parent = workspace end return(self.Container) end function Character:CreateCharacter() self.CharacterObject = script.Parent.DefaultRig:Clone() self.CharacterObject.Parent = self.Container local HumanoidDescription = PlayerServ:GetHumanoidDescriptionFromUserId(PlayerServ.LocalPlayer.UserId) --print("Enabled?: " .. tostring(Settings:GetUserAppearanceEnabled())) if Settings:GetUserAppearanceEnabled() == true then --print(Settings:GetUserAppearance()) if tonumber(Settings:GetUserAppearance()) == true then --print("UserId") local success = pcall(function() PlayerServ:GetPlayerByUserId(Settings:GetUserAppearance()) end) if success then HumanoidDescription = PlayerServ:GetHumanoidDescriptionFromUserId(Settings:GetUserAppearance()) end else local success, userId = pcall(function() return(PlayerServ:GetUserIdFromNameAsync(Settings:GetUserAppearance())) end) if success then HumanoidDescription = PlayerServ:GetHumanoidDescriptionFromUserId(userId) end end end --Scaling inputs HumanoidDescription.WidthScale = Settings:GetWidth() HumanoidDescription.HeightScale = Settings:GetHeight() HumanoidDescription.DepthScale = Settings:GetDepth() HumanoidDescription.HeadScale = Settings:GetHeadScale() self.CharacterObject:WaitForChild("Humanoid"):ApplyDescription(HumanoidDescription) end function Character:GetCharacter() if self.CharacterObject == nil then self:CreateCharacter() elseif self.CharacterObject.Parent ~= self.Container then self.CharacterObject.Parent = self.Container end return(Character.CharacterObject) end function Character:Reconnect() --print("Redrawing Character") Character.Disconnect() Character.Connect() end function CharacterMove() Character:GetContainer() Character:GetCharacter():SetPrimaryPartCFrame(workspace.CurrentCamera.CFrame) end function Character.Connect() Character._connection = RunServ.RenderStepped:Connect(CharacterMove) end function Character.Disconnect() Character._connection:Disconnect() Character.CharacterObject:Destroy() Character.CharacterObject = nil Character.Container:Destroy() Character.Container = nil end return Character
--[[ Save Structure The SaveStructure module contains the default SaveStructure. To add something to the SaveStructure simply add an Item to the SaveStructure table like this.We're going to add gems to the SaveStructure. And that's it it updates new and old player data structures local saveStructure = { Coins = 0; Xp = 0; Inventory = {}; Gems = 0; DataService:GetPlayerData(Player) Returns a player's data and will throw a warn if player is nil local PlayerData = DataService:GetPlayerData(Player) To edit the data you should not edit it directly you should use the next function of DataService which is SetPlayerData() DataService:SetPlayerData(Player, ChangedData, Function) This sets the datakey to the value. local PlayerData = DataService:GetPlayerData(Player) DataService:SetPlayerData(Player, {"Coins"}, function() PlayerData.Coins = 100 end) DataService.DataChanged This event is fired whenever a player's data changes To connect this event simply do this. DataService.DataChanged:Connect(function(player, ChangedData) print(player.Name.. "'s data has been changed") print("ChangedData") if ChangedValues["Coins"] then print("Coins Changed") end end) Do's and Don'ts If you want to update a value alot(Multiple times per second) and don't need to :Connect it to a change you can directly index it and edit it this will not call DataChanged and prevents :Connect from running or just update a variable to the value you wand and update the it on a differnt thread. local PlayerData = DataService:GetPlayerData(Player) PlayerData.LastLocation = Vector3.new(10, 01, 10) PlayerData["Last Location"] = Vector3.new(10, 01, 10) OR local location task.Spawn(function() local PlayerData = DataService:GetPlayerData(Player) wait(5) PlayerData["Last Location"] = location end) while wait() do location = Vector3.new() end location might be updating 1000 times per second. But the actual cached data is only updated every 5 seconds and thus only calling the :Connect every 5 seconds. Please see the basic DataServiceExampleService for a full code example ]]
-- vim: ts=4:sw=4:sts=4:expandtab local checks = require('checks') local Registry = require('metrics.registry') local Counter = require('metrics.collectors.counter') local Gauge = require('metrics.collectors.gauge') local Histogram = require('metrics.collectors.histogram') local Summary = require('metrics.collectors.summary') local registry = Registry.new() local function collectors() return registry.collectors end local function register_callback(...) return registry:register_callback(...) end local function invoke_callbacks() return registry:invoke_callbacks() end local function collect() return registry:collect() end local function clear() registry:clear() end local function counter(name, help) checks('string', '?string') return registry:find_or_create(Counter, name, help) end local function gauge(name, help) checks('string', '?string') return registry:find_or_create(Gauge, name, help) end local function histogram(name, help, buckets) checks('string', '?string', '?table') if buckets ~= nil and not Histogram.check_buckets(buckets) then error('Invalid value for buckets') end return registry:find_or_create(Histogram, name, help, buckets) end local function summary(name, help, objectives) checks('string', '?string', '?table') if objectives ~= nil and not Summary.check_quantiles(objectives) then error('Invalid value for objectives') end return registry:find_or_create(Summary, name, help, objectives) end local function set_global_labels(label_pairs) checks('?table') label_pairs = label_pairs or {} -- Verify label table for k, _ in pairs(label_pairs) do if type(k) ~= 'string' then error(("bad label key (string expected, got %s)"):format(type(k))) end end registry:set_labels(label_pairs) end return { registry = registry, counter = counter, gauge = gauge, histogram = histogram, summary = summary, INF = math.huge, NAN = math.huge * 0, clear = clear, collectors = collectors, register_callback = register_callback, invoke_callbacks = invoke_callbacks, set_global_labels = set_global_labels, enable_default_metrics = function() require('metrics.tarantool.luajit').enable() require('metrics.default_metrics.tarantool').enable() end, enable_cartridge_metrics = function() return require('metrics.cartridge').enable() end, http_middleware = require('metrics.http_middleware'), collect = collect, }
local Modules = {} function import(modname, dir) dir = dir or "server" modname = dir.."/"..modname local oldModule = Modules[modname] if oldModule then return oldModule end local pathname = modname .. ".lua" local newModule = {} Modules[modname] = newModule setmetatable(newModule, {__index = _G}) local func = loadfile(pathname, "bt", newModule) func() return newModule end function importall(env, modname, dir) local mod = import(modname, dir) for k,v in pairs(mod) do env[k] = mod[k] end return mod end function reload(modname, dir) dir = dir or "server" modname = dir.."/"..modname local pathname = modname .. ".lua" local oldModule = Modules[modname] if not oldModule then return end local oldCache = {} for k,v in pairs(oldModule) do if type(v) == 'table' then oldCache[k] = v end end local newModule = oldModule local func = loadfile(pathname, "bt", newModule) func() for k,v in pairs(oldCache) do if type(v) == 'table' and v ~= newModule[k] then local mt = getmetatable(newModule[k]) if mt then setmetatable(v, mt) end for newkey,newvalue in pairs(newModule[k]) do v[newkey] = newvalue end newModule[k] = v end end return newModule end function getmodes() return Modules end
require'gitsigns'.setup{ signs = { add = {text = '▋'}, change = {text = '▋'}, delete = {text = '▁'}, topdelete = {text = '▔'}, changedelete = {text = '▋'}, }, keymaps = {}, preview_config = { border = '', }, } local map = require'map' map.n{'<leader><leader>gp', '<cmd>Gitsigns preview_hunk<cr>'} map.n{'<leader><leader>gr', '<cmd>Gitsigns reset_hunk<cr>'} map.n{'<leader><leader>gn', '<cmd>Gitsigns next_hunk<cr>'} map.n{'<leader><leader>gN', '<cmd>Gitsigns prev_hunk<cr>'} map.n{'<leader><leader>gb', '<cmd>Gitsigns blame_line<cr>'} local hl = require'highlight' hl.add{'GitSignsChange', guifg=require'onedark.colors'.orange, guibg='none'}
local PATH = (...):gsub('%.[^%.]+$', '') local Ffi = require("ffi") local Transform = require(PATH..".transform") -- Localize 'cos' and 'sin' for a bit more performance in VoxelBatch:updateVoxel local cos = math.cos local sin = math.sin -- Define the module, as well as the vertex format local VoxelBatch = { vertexFormat = { {"VertexPosition", "float", 3}, {"VertexTexCoord", "float", 2}, }, instanceFormat = { {"MatRow1", "float", 4}, {"MatRow2", "float", 4}, {"MatRow3", "float", 4}, {"MatRow4", "float", 4}, {"VertexColor", "byte", 4} } } VoxelBatch.__index = VoxelBatch local function newModelAttributes(voxelCount) local memoryUsage = voxelCount * Transform.instanceSize local instanceData = love.data.newByteData(memoryUsage) local vertexBuffer = Transform.castInstances(instanceData:getPointer()) local modelAttributes = love.graphics.newMesh(VoxelBatch.instanceFormat, instanceData, usage) modelAttributes:setVertices(instanceData) return modelAttributes, instanceData, vertexBuffer end local function newVertices(width, height, layers) local uvStep = 1 / layers local vertices = {} for layer = 0, layers - 1 do -- Tbh this part is magic and if anything ever breaks here, just redo it all local start_v, end_v = 1 - (layer + 1) * uvStep, 1 - layer * uvStep local o = (layer * 4) local z = layer vertices[o+1] = {-width/2, -height/2, layer, 0, start_v} vertices[o+2] = { width/2, -height/2, layer, 1, start_v} vertices[o+3] = {-width/2, height/2, layer, 0, end_v } vertices[o+4] = { width/2, height/2, layer, 1, end_v } end return vertices end local function newVertexMap(layers) local vertexMap = {} for i = 0, layers - 1 do local v, o = i * 6, i * 4 vertexMap[v+1] = o + 1 vertexMap[v+2] = o + 2 vertexMap[v+3] = o + 3 vertexMap[v+4] = o + 4 vertexMap[v+5] = o + 3 vertexMap[v+6] = o + 2 end return vertexMap end --- Creates a new mesh for voxels. -- @param width, height, layer The dimensions of the source texture. -- @param voxelCount The amount of voxels the mesh can hold. -- @param usage How the mesh is supposed to be used (stream, dynamic, static). -- @returns A new VoxelBatch object. function VoxelBatch.new(texture, layers, voxelCount, usage) local vertices = newVertices(texture:getWidth(), texture:getHeight() / layers, layers) local modelAttributes, instanceData, vertexBuffer = newModelAttributes(voxelCount) local mesh = love.graphics.newMesh(VoxelBatch.vertexFormat, vertices, "triangles", usage) mesh:setVertexMap(newVertexMap(layers)) mesh:setTexture(texture) mesh:attachAttribute("MatRow1", modelAttributes, "perinstance") mesh:attachAttribute("MatRow2", modelAttributes, "perinstance") mesh:attachAttribute("MatRow3", modelAttributes, "perinstance") mesh:attachAttribute("MatRow4", modelAttributes, "perinstance") mesh:attachAttribute("VertexColor", modelAttributes, "perinstance") return setmetatable({ voxelCount = voxelCount, mesh = mesh, modelAttributes = modelAttributes, instanceData = instanceData, vertexBuffer = vertexBuffer, nextFreeIndex = 1, isDirty = false, }, VoxelBatch) end --- Applies updated voxels to the mesh. -- @returns self function VoxelBatch:flush() self.modelAttributes:setVertices(self.instanceData) self.isDirty = false return self end function VoxelBatch:set(index, ...) -- TODO Check if index is < nextFreeIndex local instance = self.vertexBuffer[index - 1] instance:setTransformation(...) local r, g, b = love.graphics.getColor() instance.r = r * 255 instance.g = g * 255 instance.b = b * 255 instance.a = 255 self.isDirty = true return self end function VoxelBatch:add(...) -- TODO Check if the index is < voxelCount local index = self.nextFreeIndex self.nextFreeIndex = index + 1 self:set(index, ...) return index end function VoxelBatch:clear() Ffi.fill(self.instanceData:getPointer(), self.instanceData:getSize()) self.nextFreeIndex = 1 self.isDirty = true return self end function VoxelBatch:getCount() return self.nextFreeIndex - 1 end function VoxelBatch:getBufferSize() return self.voxelCount end function VoxelBatch:attachAttribute(...) self.mesh:attachAttribute(...) end function VoxelBatch:getTexture() return self.mesh:getTexture() end -- function VoxelBatch:setTexture(texture) -- -- Should this reevaluate the mesh? -- -- Mesh size is static so you would need to keep the number of layers -- self.mesh:setTexture(texture) -- end --- Draws a voxel. -- @returns self function VoxelBatch:draw() if self.isDirty then self:flush() end love.graphics.drawInstanced(self.mesh, self.voxelCount) return self end return setmetatable(VoxelBatch, { __call = function(_, ...) return VoxelBatch.new(...) end, })
--- Utilities -- local Table = require(script.Parent.Table) local TableMerge = Table.Merge local Utilities = {} --Constants local REMOTE_EVENT_ENUM = { PLAYER_READY = 0; ENTITY_CREATE = 1; ENTITY_ADD_COMPONENTS = 2; ENTITY_REMOVE_COMPONENTS = 3; ENTITY_ADD_REMOVE_COMPONENTS = 4; ENTITY_REMOVE = 5; ENTITY_CREATE_FROM_INSTANCE = 6; } Utilities.REMOTE_EVENT_ENUM = REMOTE_EVENT_ENUM local ENTITY_INSTANCE_COMPONENT_DATA_NAME = "COMPONENTS" local ENTITY_INSTANCE_PREFAB_DATA_NAME = "PREFABS" local COMPONENT_DESC_CLASSNAME = "ECSComponentDescription" local SYSTEM_CLASSNAME = "ECSSystem" local INVALID_ENTITY_INSTANCE_NAMES = { [ENTITY_INSTANCE_COMPONENT_DATA_NAME] = true; [ENTITY_INSTANCE_PREFAB_DATA_NAME] = true; } Utilities.ENTITY_INSTANCE_COMPONENT_DATA_NAME = ENTITY_INSTANCE_COMPONENT_DATA_NAME Utilities.ENTITY_INSTANCE_PREFAB_DATA_NAME = ENTITY_INSTANCE_PREFAB_DATA_NAME Utilities.COMPONENT_DESC_CLASSNAME = COMPONENT_DESC_CLASSNAME Utilities.SYSTEM_CLASSNAME = SYSTEM_CLASSNAME Utilities.INVALID_ENTITY_INSTANCE_NAMES = INVALID_ENTITY_INSTANCE_NAMES local SYSTEM_UPDATE_TYPE = { NO_UPDATE = 0; RENDER_STEPPED = 1; STEPPED = 2; HEARTBEAT = 3; UI = 4; } Utilities.SYSTEM_UPDATE_TYPE = SYSTEM_UPDATE_TYPE --Functions function Utilities.IsEntity(object) return type(object) == "table" and object._IsEntity == true end function Utilities.IsComponent(object) return type(object) == "table" and object._IsComponent == true end function Utilities.IsComponentDescription(object) return type(object) == "table" and object._IsComponentDescription == true end function Utilities.IsComponentGroup(object) return type(object) == "table" and object._IsComponentGroup == true end function Utilities.IsSystem(object) return type(object) == "table" and object._IsSystem == true end function Utilities.IsEngineConfiguration(object) return type(object) == "table" and object._IsEngineConfiguration == true end function Utilities.IsResource(object) return type(object) == "table" and object._IsResource == true end local function CanInstanceBeAnEntity(instance) return instance:FindFirstChild(ENTITY_INSTANCE_PREFAB_DATA_NAME) == nil and instance:FindFirstChild(ENTITY_INSTANCE_COMPONENT_DATA_NAME) ~= nil end Utilities.CanInstanceBeAnEntity = CanInstanceBeAnEntity local function GetDataFromInstance(instance) local data = instance if (data:IsA("ValueBase") == true) then data = instance.Value end return data end local function GetComponentDataFromDataContainer(instance) local data = {} for _, valueInstance in pairs(instance:GetChildren()) do local valueName = valueInstance.Name data[valueName] = GetDataFromInstance(valueInstance) end return data end local function GetComponentsDataFromEntityInstance(instance, deleteData) local componentList = {} if (typeof(instance) ~= "Instance") then return componentList end local entityInstanceComponentData = instance:FindFirstChild(ENTITY_INSTANCE_COMPONENT_DATA_NAME) if (entityInstanceComponentData ~= nil) then for _, componentInstanceData in pairs(entityInstanceComponentData:GetChildren()) do local componentName = componentInstanceData.Name componentList[componentName] = GetComponentDataFromDataContainer(componentInstanceData) end if (deleteData == true) then entityInstanceComponentData:Destroy() end end return componentList end Utilities.GetComponentsDataFromEntityInstance = GetComponentsDataFromEntityInstance function Utilities.MergeComponentData(mainComponentData, otherComponentData) for componentName, componentData in pairs(otherComponentData) do local currentComponentData = mainComponentData[componentName] if (currentComponentData == nil) then mainComponentData[componentName] = componentData else mainComponentData[componentName] = TableMerge(currentComponentData, componentData) end end return mainComponentData end local function GetEntityInstancesFromInstance(instance, entityInstances) entityInstances = entityInstances or {} if (INVALID_ENTITY_INSTANCE_NAMES[instance.Name] ~= true and CanInstanceBeAnEntity(instance) == true) then table.insert(entityInstances, instance) end for _, child in pairs(instance:GetChildren()) do GetEntityInstancesFromInstance(child, entityInstances) end return entityInstances end Utilities.GetEntityInstancesFromInstance = GetEntityInstancesFromInstance local function PrintComponentList(componentList) assert(type(componentList) == "table") for componentName, componentData in pairs(componentList) do if (type(componentData) == "table") then print("[\"" ..componentName .. "\"]") for index, value in pairs(componentData) do print(" -", index, "=", value) end print() end end end Utilities.PrintComponentList = PrintComponentList local function AddSystemToListByPriority(system, list) local priority = system.UpdatePriority --find a place to put it local wasInserted = false if (priority >= 0) then for index, system in pairs(list) do local otherPriority = system.UpdatePriority if (otherPriority < 0) then break elseif (otherPriority < priority) then table.insert(list, index, system) wasInserted = true break end end end if (wasInserted == false) then table.insert(list, system) end end Utilities.AddSystemToListByPriority = AddSystemToListByPriority function Utilities.GetEntityInListFromInstance(entityList, instance) if (instance == nil) then return nil end assert(typeof(instance) == "Instance") for _, entity in pairs(entityList) do if (entity.Instance == instance) then return entity end end return nil end function Utilities.GetEntityInListContainingInstance(entityList, instance) if (instance == nil) then return nil end assert(typeof(instance) == "Instance") local currentEntity = nil for _, entity in pairs(entityList) do if (entity:ContainsInstance(instance) == true) then if (currentEntity == nil or currentEntity.Instance:IsAncestorOf(entity.Instance) == true) then currentEntity = entity end end end return currentEntity end return Utilities
--Mr.Z<zenghuaguo@hotmail.com> local NXFS = require "nixio.fs" local SYS = require "luci.sys" local HTTP = require "luci.http" local DISP = require "luci.dispatcher" local m,s,o local LUCI_VER,ADBYBY_VER,Status LUCI_VER=SYS.exec("awk '/^Version/{print $2}' /usr/lib/opkg/info/luci-app-adbyby.control") if SYS.call("[ -x /usr/share/adbyby/adbyby ]") == 0 then ADBYBY_VER = SYS.exec("/usr/share/adbyby/adbyby --version | awk '{print substr($3,1,3)}'") else ADBYBY_VER = "???" end if SYS.call("pidof adbyby >/dev/null") == 0 then Status = "广告屏蔽大师 运行中" else Status = "广告屏蔽大师 未运行" end m = Map("adbyby") m.title = translate(string.format([[</a><a href="javascript:alert('版本信息\n\nluci-app-adbyby\n\t版本:\t%s\n\nadbyby\n\t版本:\t%s')">广告屏蔽大师]],LUCI_VER,ADBYBY_VER)) m.description = translate(string.format("<strong><font color=\"0x008000\">广告屏蔽大师可以全面过滤各种横幅、弹窗、视频广告,同时阻止跟踪、隐私窃取及各种恶意网站。</font></strong><br />%s", Status)) s = m:section(TypedSection, "adbyby") s.anonymous = true --基本设置 s:tab("basic", translate("基本设置")) o = s:taboption("basic", Flag, "enable") o.title = translate("启用") o.default = 0 o.rmempty = false o = s:taboption("basic", ListValue, "daemon") o.title = translate("守护进程") o:value("0", translate("禁用")) o:value("1", translate("脚本监视")) o:value("2", translate("内置监视")) o.default = 2 o.rmempty = false o = s:taboption("basic", Button, "proxy") o.title = translate("透明代理") if SYS.call("iptables-save | grep ADBYBY >/dev/null") == 0 then o.inputtitle = translate("点击关闭") o.inputstyle = "reset" o.write = function() SYS.call("/etc/init.d/adbyby del_rule") HTTP.redirect(DISP.build_url("admin", "services", "adbyby")) end else o.inputtitle = translate("点击开启") o.inputstyle = "apply" o.write = function() SYS.call('[ -n "$(pgrep adbyby)" ] && /etc/init.d/adbyby add_rule') HTTP.redirect(DISP.build_url("admin", "services", "adbyby")) end end local DL = SYS.exec("head -1 /usr/share/adbyby/data/lazy.txt | awk -F' ' '{print $3,$4}'") local DV = SYS.exec("head -1 /usr/share/adbyby/data/video.txt | awk -F' ' '{print $3,$4}'") local NR = SYS.exec("grep -v '^!' /usr/share/adbyby/data/rules.txt | wc -l") local NU = SYS.exec("cat /usr/share/adbyby/data/user.txt | wc -l") local NW = SYS.exec("uci get adbyby.@adbyby[-1].domain 2>/dev/null | wc -l") o = s:taboption("basic", Button, "restart") o.title = translate("规则状态") o.inputtitle = translate("重启更新") o.description = translate(string.format("规则日期/条目:<br /><strong>Lazy规则:%s<br />Video规则:%s<br />第三方规则:%d条<br />自定义规则:%d条</strong>", DL, DV, math.abs(NR+NW-NU), NR)) o.inputstyle = "reload" o.write = function() SYS.call("/etc/init.d/adbyby restart") HTTP.redirect(DISP.build_url("admin", "services", "adbyby")) end --高级设置 s:tab("advanced", translate("高级设置")) o = s:taboption("advanced", Flag, "cron_mode") o.title = translate("每天6点重启") o.default = 0 o.rmempty = false o = s:taboption("advanced", ListValue, "lan_mode") o.title = translate("内网控制") o:value("0", translate("禁用")) o:value("1", translate("仅允许过滤列表内")) o:value("2", translate("仅允许过滤列表外")) o.default = 0 o.rmempty = false o = s:taboption("advanced", DynamicList, "lan_ip") o.title = translate("内网IP列表") o.datatype = "ipaddr" o.placeholder = "IP address | IP/Mask" luci.ip.neighbors({ family = 4 }, function(entry) if entry.reachable then o:value(entry.dest:string()) end end) o:depends("lan_mode", 1) o:depends("lan_mode", 2) o = s:taboption("advanced", ListValue, "wan_mode") o.title = translate("网站控制") o:value("0", translate("禁用")) o:value("1", translate("仅允许过滤列表内")) o:value("2", translate("仅允许过滤列表外")) o.default = 0 o.rmempty = false o = s:taboption("advanced", DynamicList, "wan_ip") o.title = translate("域名") o.datatype = "host" o.placeholder = "Hostname | IP address | IP/Mask" o:depends("wan_mode", 1) o:depends("wan_mode", 2) o = s:taboption("advanced", DynamicList, "domain") o.title = translate("域名白名单") o.placeholder = "baidu.com|cn.bing.com|google.com" o = s:taboption("advanced", DynamicList, "exrule") o.title = translate("第三方规则") o.placeholder = "[https|http|ftp]://[Hostname]/[File]" local file = "/usr/share/adbyby/adhook.ini" o = s:taboption("advanced", TextValue, "adhook") o.title = translate("配置文件") o.size = 30 o.rows = 15 o.wrap = "off" o.cfgvalue = function(self, section) return NXFS.readfile(file) or "" end o.write = function(self, section, value) NXFS.writefile(file, value:gsub("\r\n", "\n")) end --自定义规则 s:tab("user", translate("自定义规则")) local file = "/usr/share/adbyby/data/rules.txt" o = s:taboption("user", TextValue, "rules") o.description = translate("开头感叹号(!)的每一行被视为注释。") o.rows = 20 o.wrap = "off" o.cfgvalue = function(self, section) return NXFS.readfile(file) or "" end o.write = function(self, section, value) NXFS.writefile(file, value:gsub("\r\n", "\n")) end --技术支持 s:tab("help", translate("技术支持")) o = s:taboption("help", Button, "web") o.title = translate("官方网站") o.inputtitle = translate("访问") o.inputstyle = "apply" o.write = function() HTTP.redirect("http://www.adbyby.com") end return m
local common = require('ntb.common'); local ninjaFileBuilderMt = {}; local function getNinjaBuildCmd_(explicitOutputs, rule, inputs, implicitDependencies, orderOnlyDependencies, implicitOutputs, vars) local into = {}; table.insert(into, "build " .. common.ninjaEscapePaths(explicitOutputs)); if implicitOutputs and #implicitOutputs > 0 then table.insert(into, " | " .. common.ninjaEscapePaths(implicitOutputs)); end table.insert(into, ": " .. rule); if inputs and #inputs > 0 then table.insert(into, " " .. common.ninjaEscapePaths(inputs)); end if implicitDependencies and #implicitDependencies > 0 then -- Implicit dependencies table.insert(into, " | " .. common.ninjaEscapePaths(implicitDependencies)); end if orderOnlyDependencies and #orderOnlyDependencies > 0 then -- Order-only dependencies table.insert(into, " || " .. common.ninjaEscapePaths(orderOnlyDependencies)); end table.insert(into, "\n"); if vars and #vars > 0 then for _, kv in ipairs(vars) do table.insert(into, ' ' .. kv[1] .. ' = ' .. kv[2] .. '\n'); end end return table.concat(into, ''); end ninjaFileBuilderMt.rule = function(self, spec) if type(spec) == "string" then spec = { command = spec; }; end if type(spec) ~= "table" then error("rule must be a string or table"); end if type(spec.command) ~= "string" then error("rule command must be a string"); end local existingRule = self.rulesByCommand[spec.command]; if existingRule then return existingRule[1]; end local name = 'r' .. self.rulesCounter; self.rulesCounter = self.rulesCounter + 1; local r = {name, spec}; self.rulesByCommand[spec.command] = r; self.rulesByName[name] = r; table.insert(self.rules, r); return name; end; local function getNinjaBuildCmd_(explicitOutputs, rule, inputs, implicitDependencies, orderOnlyDependencies, implicitOutputs, vars) local into = {}; table.insert(into, "build " .. common.ninjaEscapePaths(explicitOutputs)); if implicitOutputs and #implicitOutputs > 0 then table.insert(into, " | " .. common.ninjaEscapePaths(implicitOutputs)); end table.insert(into, ": " .. rule); if inputs and #inputs > 0 then table.insert(into, " " .. common.ninjaEscapePaths(inputs)); end if implicitDependencies and #implicitDependencies > 0 then -- Implicit dependencies table.insert(into, " | " .. common.ninjaEscapePaths(implicitDependencies)); end if orderOnlyDependencies and #orderOnlyDependencies > 0 then -- Order-only dependencies table.insert(into, " || " .. common.ninjaEscapePaths(orderOnlyDependencies)); end table.insert(into, "\n"); if vars and #vars > 0 then for _, kv in ipairs(vars) do table.insert(into, ' ' .. kv[1] .. ' = ' .. kv[2] .. '\n'); end end return table.concat(into, ''); end local function build_(self, output, rule, input, deps, odeps, implicitOutputs, vars) if not output then error("output not provided"); end if type(output) ~= "string" and type(output) ~= "table" then error("output must be a string or table of strings (" .. type(output) .. " provided)"); end if type(output) == "string" then output = { output }; end table.sort(output); if not rule then error("rule not provided"); end if type(rule) ~= "string" then error("rule must be a string"); end if not input then input = {}; end if type(input) ~= "string" and type(input) ~= "table" then error("input must be a string or table of strings (" .. type(input) .. " provided)"); end if type(input) == "string" then input = { input }; end table.sort(input); if deps then if type(deps) ~= "string" and type(deps) ~= "table" then error("dependencies must be a string or table of strings (" .. type(deps) .. " provided)"); end if type(deps) == "string" then deps = { deps }; end table.sort(deps); end if odeps then if type(odeps) ~= "string" and type(odeps) ~= "table" then error("order-only dependencies must be a string or table of strings (" .. type(odeps) .. " provided)"); end if type(odeps) == "string" then odeps = { odeps }; end table.sort(odeps); end if implicitOutputs then if type(implicitOutputs) ~= "string" and type(implicitOutputs) ~= "table" then error("implicit outputs must be a string or table of strings (" .. type(implicitOutputs) .. " provided)"); end if type(implicitOutputs) == "string" then implicitOutputs = { implicitOutputs }; end table.sort(implicitOutputs); end local buildCmd = getNinjaBuildCmd_(output, rule, input, deps, odeps, implicitOutputs, vars); local insert = true; for _, out in ipairs(output) do local existing = self.buildsByOutput[out]; if existing then if existing.buildCmd ~= buildCmd then error("duplicate build rule detected - attempting to build '" .. out .. "' in [" .. tostring(ntb.scriptPath) .. "] but already built this output in [" .. tostring(existing.location) .. "]"); end insert = false; else self.buildsByOutput[out] = { location = ntb.scriptPath; buildCmd = buildCmd; }; end end if insert then table.insert(self.builds, buildCmd); end end ninjaFileBuilderMt.build = function(self, output, rule, input, deps, odeps, implicitOutputs, vars) if rule ~= "phony" and not self.rulesByName[rule] then error("rule '" .. tostring(rule) .. "' not found"); end build_(self, output, rule, input, deps, odeps, implicitOutputs, vars); end; ninjaFileBuilderMt.phony = function(self, output, input, deps, odeps, implicitOutputs) build_(self, output, "phony", input, deps, odeps, implicitOutputs); end ninjaFileBuilderMt.default = function(self, targets) if not targets then error("targets not provided"); end if type(targets) ~= "string" and type(targets) ~= "table" then error("targets must be a string or table of strings (" .. type(targets) .. " provided)"); end if type(targets) == "string" then targets = { targets }; end for _, target in ipairs(targets) do table.insert(self.defaults, target); end end ninjaFileBuilderMt.registerGlobals = function(self) _G.rule = func.bind1(self.rule, self); _G.build = func.bind1(self.build, self); _G.phony = func.bind1(self.phony, self); _G.default = func.bind1(self.default, self); end; local function ninjaFileBuilderCreate() return setmetatable( { rules = {}; rulesByName = {}; rulesByCommand = {}; rulesCounter = 1; builds = {}; buildsByOutput = {}; defaults = {}; }, { __index = ninjaFileBuilderMt; } ); end return ninjaFileBuilderCreate;
data:extend({ { type = "electric-pole", name = "substation-mk2", icon_size = 32, icon = "__FactorioExtended-Power__/graphics/icons/substation-mk2.png", flags = {"placeable-neutral", "player-creation"}, minable = {hardness = 0.2, mining_time = 0.5, result = "substation-mk2"}, max_health = 400, corpse = "medium-remnants", track_coverage_during_build_by_moving = true, resistances = { { type = "fire", percent = 90 } }, collision_box = {{-0.9, -0.9}, {0.9, 0.9}}, selection_box = {{-1, -1}, {1, 1}}, drawing_box = {{-1, -1.5}, {1, 1}}, maximum_wire_distance = 28, supply_area_distance = 14, pictures = { filename = "__FactorioExtended-Power__/graphics/entity/substations/substation-mk2.png", priority = "high", width = 132, height = 144, axially_symmetrical = false, direction_count = 4, shift = {0.9, -1} }, vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, working_sound = { sound = { filename = "__base__/sound/substation.ogg" }, apparent_volume = 1.5, audible_distance_modifier = 0.5, probability = 1 / (3 * 60) -- average pause between the sound is 3 seconds }, connection_points = { { shadow = { copper = {1.9, -0.6}, green = {1.3, -0.6}, red = {2.65, -0.6} }, wire = { copper = {-0.23, -2.65}, green = {-0.85,-2.65}, red = {0.35,-2.65} } }, { shadow = { copper = {1.9, -0.6}, green = {1.2, -0.8}, red = {2.5, -0.35} }, wire = { copper = {-0.26, -2.71}, green = {-0.67,-3}, red = {0.17,-2.47} } }, { shadow = { copper = {1.9, -0.6}, green = {1.9, -0.9}, red = {1.9, -0.3} }, wire = { copper = {-0.23, -2.7}, green = {-0.23,-3.2}, red = {-0.23,-2.35} } }, { shadow = { copper = {1.8, -0.7}, green = {1.3, -0.6}, red = {2.4, -1.15} }, wire = { copper = {-0.2, -2.7}, green = {-0.62,-2.45}, red = {0.25,-2.98} } } }, radius_visualisation_picture = { filename = "__base__/graphics/entity/small-electric-pole/electric-pole-radius-visualization.png", width = 12, height = 12 }, fast_replaceable_group = "electric-pole-2x2" }, { type = "electric-pole", name = "substation-mk3", icon_size = 32, icon = "__FactorioExtended-Power__/graphics/icons/substation-mk3.png", flags = {"placeable-neutral", "player-creation"}, minable = {hardness = 0.2, mining_time = 0.5, result = "substation-mk3"}, max_health = 600, corpse = "medium-remnants", track_coverage_during_build_by_moving = true, resistances = { { type = "fire", percent = 90 } }, collision_box = {{-0.9, -0.9}, {0.9, 0.9}}, selection_box = {{-1, -1}, {1, 1}}, drawing_box = {{-1, -1.5}, {1, 1}}, maximum_wire_distance = 42, supply_area_distance = 21, pictures = { filename = "__FactorioExtended-Power__/graphics/entity/substations/substation-mk3.png", priority = "high", width = 132, height = 144, axially_symmetrical = false, direction_count = 4, shift = {0.9, -1} }, vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, working_sound = { sound = { filename = "__base__/sound/substation.ogg" }, apparent_volume = 1.5, audible_distance_modifier = 0.5, probability = 1 / (3 * 60) -- average pause between the sound is 3 seconds }, connection_points = { { shadow = { copper = {1.9, -0.6}, green = {1.3, -0.6}, red = {2.65, -0.6} }, wire = { copper = {-0.23, -2.65}, green = {-0.85,-2.65}, red = {0.35,-2.65} } }, { shadow = { copper = {1.9, -0.6}, green = {1.2, -0.8}, red = {2.5, -0.35} }, wire = { copper = {-0.26, -2.71}, green = {-0.67,-3}, red = {0.17,-2.47} } }, { shadow = { copper = {1.9, -0.6}, green = {1.9, -0.9}, red = {1.9, -0.3} }, wire = { copper = {-0.23, -2.7}, green = {-0.23,-3.2}, red = {-0.23,-2.35} } }, { shadow = { copper = {1.8, -0.7}, green = {1.3, -0.6}, red = {2.4, -1.15} }, wire = { copper = {-0.2, -2.7}, green = {-0.62,-2.45}, red = {0.25,-2.98} } } }, copper_wire_picture = { filename = "__base__/graphics/entity/small-electric-pole/copper-wire.png", priority = "extra-high-no-scale", width = 224, height = 46 }, green_wire_picture = { filename = "__base__/graphics/entity/small-electric-pole/green-wire.png", priority = "extra-high-no-scale", width = 224, height = 46 }, radius_visualisation_picture = { filename = "__base__/graphics/entity/small-electric-pole/electric-pole-radius-visualization.png", width = 12, height = 12 }, red_wire_picture = { filename = "__base__/graphics/entity/small-electric-pole/red-wire.png", priority = "extra-high-no-scale", width = 224, height = 46 }, wire_shadow_picture = { filename = "__base__/graphics/entity/small-electric-pole/wire-shadow.png", priority = "extra-high-no-scale", width = 224, height = 46 }, fast_replaceable_group = "electric-pole-2x2" } })
description = [[ Decodes the VSNNUM version number from an Oracle TNS listener. ]] local shortport = require "shortport" local nmap = require "nmap" local comm = require "comm" local stdnse = require "stdnse" local string = require "string" local U = require "lpeg-utility" author = "Daniel Miller" license = "Same as Nmap--See https://nmap.org/book/man-legal.html" categories = {"version", "safe"} portrule = function (host, port) return ( -- -sV has an actual version for this, no need to send more probes and decode. not (port.version and port.version.version and port.version.version ~= "") -- Otherwise, normal checking for port numbers etc. and shortport.version_port_or_service({1521,1522,1523}, "oracle-tns")(host, port) ) end -- Lifted from nmap-service-probes -- TODO: Figure out if we can send a better probe than this. We might need to -- send ADDRESS, CID, etc. local oracle_tns_probe = "\0Z\0\0\x01\0\0\0\x016\x01,\0\0\x08\0\x7F\xFF\x7F\x08\0\0\0\x01\0 \0:\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x004\xE6\0\0\0\x01\0\0\0\0\0\0\0\0(CONNECT_DATA=(COMMAND=version))" local ERR_CODES = { ["1189"] = "unauthorized", ["1194"] = "insecure transport", ["12154"] = "unknown identifier", ["12504"] = "requires service name", ["12505"] = "unknown sid", ["12514"] = "unknown service name", } local function decode_vsnnum (vsnnum) local hex = stdnse.tohex(tonumber(vsnnum)) local maj, min, a, b, c = string.unpack("c1 c1 c2 c1 c2", hex) return string.format("%d.%d.%d.%d.%d", tonumber(maj, 16), tonumber(min, 16), tonumber(a, 16), tonumber(b, 16), tonumber(c, 16) ) end action = function (host, port) local response -- Did the service engine already do the hard work? if port.version and port.version.service_fp then -- Probes sent, replies received, but no match. response = U.get_response(port.version.service_fp, "oracle-tns") end if not response then -- Have to send the probe ourselves local status status, response = comm.exchange(host, port, oracle_tns_probe) if not status then stdnse.debug1("Couldn't get a response: %s", response) return nil end end local vsnnum = response and response:match("%(VSNNUM=(%d+)%)", 12) port.version = port.version or {} if vsnnum then local version = decode_vsnnum(vsnnum) port.version.product = "Oracle TNS listener" port.version.version = version local cpes = port.version.cpe or {} cpes[#cpes+1] = "cpe:/a:oracle:database_server:" .. version port.version.cpe = cpes end local errno = response and response:match("%(ERR=(%d+)%)", 12) if errno then port.version.extrainfo = ERR_CODES[errno] or ("error: "..errno) end if vsnnum or errno then nmap.set_port_version(host, port, "hardmatched") end end
--returns the powerset of s, out of order. function powerset(s, start) start = start or 1 if(start > #s) then return {{}} end local ret = powerset(s, start + 1) for i = 1, #ret do ret[#ret + 1] = {s[start], unpack(ret[i])} end return ret end --non-recurse implementation function powerset(s) local t = {{}} for i = 1, #s do for j = 1, #t do t[#t+1] = {s[i],unpack(t[j])} end end return t end --alternative, copied from the Python implementation function powerset2(s) local ret = {{}} for i = 1, #s do local k = #ret for j = 1, k do ret[k + j] = {s[i], unpack(ret[j])} end end return ret end
--[[ /////// ////////////////// /////// PROJECT: MTA iLife - German Fun Reallife Gamemode /////// VERSION: 1.7.2 /////// DEVELOPERS: See DEVELOPERS.md in the top folder /////// LICENSE: See LICENSE.md in the top folder /////// ///////////////// ]] UserVehicles = {} UserVehiclesByPlayer = {} CUserVehicle = inherit(CVehicle) addEvent("onVehicleSwitchLock", true) function CUserVehicle:constructor(iID,iOwnerID,iInt,iDim,iVID,sKoords,sColor,sTuning,sPlate,fFuel,fKM,iHealth,sHeadLights, iDirtLevel) -- Klassenvariablen -- self.ID = iID self.OwnerID = iOwnerID self.Owner = Players[self.OwnerID] self.OwnerName = PlayerNames[self.OwnerID] self.Int = iInt self.Dim = iDim self.VID = iVID self.Koords = sKoords self.Color = sColor self.Tuning = sTuning self.HeadLights = sHeadLights or "255|255|255"; self.Plate = sPlate self.Fuel = fFuel self.KM = fKM self.Health = iHealth self.Locked = true self.Engine = false self.tuningTeilPreise = TuningTeilPreise:New(); -- Methoden -- self:setData("Locked", self.Locked) self:setData("Engine", self.Engine) self:setData("Plate", self.Plate) self:setData("OwnerName", self.OwnerName) self:setData("ID", self.ID) self:setData("UserVehicle", true) self:setInterior(self.Int) self:setDimension(self.Dim) self:setPlateText(self.Plate) self:setLocked(true) self:setEngineState(false) self:setHealth(self.Health) self:setInterior(self.Int) self:setDimension(self.Dim) self:setDirtLevel(iDirtLevel) UserVehicles[tonumber(self.ID)] = self if (not (type(UserVehiclesByPlayer[self.OwnerID]) == "table")) then UserVehiclesByPlayer[self.OwnerID] = {} end table.insert(UserVehiclesByPlayer[self.OwnerID] , {["ID"]=self.ID,["VID"]=self.VID,["Plate"]=self.Plate}) --Events self.eOnVehicleEnter = bind(CUserVehicle.onVehicleEnter,self) addEventHandler("onVehicleEnter", self, self.eOnVehicleEnter) self.eOnVehicleExit = bind(CUserVehicle.onVehicleExit,self) addEventHandler("onVehicleStartExit", self, self.eOnVehicleExit) addEventHandler("onVehicleExit", self, self.eOnVehicleExit) self.eOnVehicleExplode = bind(CUserVehicle.onVehicleExplode, self) addEventHandler("onVehicleExplode", self, self.eOnVehicleExplode) self.eOnVehicleSwitchLock = bind(CUserVehicle.switchLocked, self) addEventHandler("onVehicleSwitchLock", self, self.eOnVehicleSwitchLock) self.switchEngineBla = bind(function(self, player, key, state) carStart:Toggle(player, key, state, self) end, self); --Binds self.bSwitchEngine = bind(CUserVehicle.switchEngine, self) --Timer self.tDestroy = bind(CElement.destroy, self) self:tune() -- Tunt das Fahrzeug --Konstruktor CVehicle CVehicle.constructor(self, "User", true) end function CUserVehicle:tune() if(self.Color) and (#tostring(self.Color) > 1) then local tbl = split(self.Color, "|", -1); for index, wert in pairs(tbl) do tbl[index] = (tonumber(wert) or 255) end setVehicleColor(self, unpack(tbl)); end if(self.HeadLights) and (#tostring(self.HeadLights) > 1) then local tbl = split(self.HeadLights, "|", -1); for index, wert in pairs(tbl) do tbl[index] = (tonumber(wert) or 255) end setVehicleHeadLightColor(self, unpack(tbl)); end -- Tuning if(self.Tuning) and (#tostring(self.Tuning) > 1) then local tbl = split(self.Tuning, "|", -1); for index, wert in pairs(tbl) do local wat = (tonumber(wert) or 0) if(wat == 1) then if(self.tuningTeilPreise.customItemSlot[index]) then self:AddCustomUpgrade(self.tuningTeilPreise.customItemSlot[index]); end else addVehicleUpgrade(self, wat) end end end end function CUserVehicle:destructor() outputServerLog("Fahrzeug mit der ID "..self.ID.." wurde zerstoert!") UserVehicles[self.ID] = nil end function CUserVehicle:getID() return self.ID end function CUserVehicle:getOwnerID() return self.OwnerID end function CUserVehicle:onVehicleExit(thePlayer, seat, jacked) self:save() if(isKeyBound(thePlayer, "x", "both", self.switchEngineBla)) then unbindKey(thePlayer, "x", "both", self.switchEngineBla) end end function CUserVehicle:onVehicleEnter(thePlayer, seat, jacked) self:save() if( thePlayer:hasKeyForVehicle(self) ) then if(seat == 0) then if not(isKeyBound(thePlayer, "x", "both", self.switchEngineBla)) then bindKey(thePlayer, "x", "both", self.switchEngineBla) end end end end function CUserVehicle:onVehicleDamage(loss) if( not(self:isOwnerOnline()) ) then self:setHealth(self:getHealth()) else self:setHealth(self:getHealth()-loss/10) end end function CUserVehicle:onVehicleExplode() self.Destroyed = true if( (self:isOwnerReachable()) ) then Players[self:getOwnerID()]:showInfoBox("warning", "Dein Fahrzeug mit dem Nummernschild: "..self.Plate.." wurde zerstört!") CDatabase:getInstance():query("DELETE FROM Vehicles WHERE ID=?", self.ID) setTimer(self.tDestroy, 2000, 1) else setTimer(function() respawnVehicle(self) end, 5000, 1 ) end end function CUserVehicle:switchLocked(thePlayer) if not(clientcheck(thePlayer, client)) then return end if(thePlayer:hasKeyForVehicle(self)) then if (self:isLocked()) then self:setLocked(false) self.Locked = false local x,y,z = self:getPosition() triggerClientEvent("onServerPlaySound", self, x, y, z, "res/sounds/car_unlock.mp3") else self:setLocked(true) self.Locked = true local x,y,z = self:getPosition() triggerClientEvent("onServerPlaySound", self, x, y, z, "res/sounds/car_lock.mp3") end self:setData("Locked", self.Locked) else thePlayer:showInfoBox("error", "Für dieses Fahrzeug besitzt du keinen Schlüssel!") end end function CUserVehicle:switchEngine(thePlayer) local yes = false if (self:getEngineState()) then self:setEngineState(false) else if (thePlayer:hasKeyForVehicle(self)) then self:setEngineState(true) else yes = true end end self:setData("Engine", self:getEngineState()) if(yes) then return "nope" end end function CUserVehicle:isOwnerReachable() if isElement((Players[self.OwnerID])) then local x,y,z = getElementPosition(self) local x1,y1,z1 = getElementPosition(Players[self.OwnerID]) if (getDistanceBetweenPoints3D(x,y,z,x1,y1,z1) < 250) then return Players[self.OwnerID] end end return false end function CUserVehicle:park(thePlayer) if (self:getOwnerID() == thePlayer:getID()) then self.Int = self:getInterior() self.Dim = self:getDimension() local x,y,z = self:getPosition() local rx,ry,rz = self:getRotation() self.Koords = tostring(x).."|"..tostring(y).."|"..tostring(z).."|"..tostring(rx).."|"..tostring(ry).."|"..tostring(rz) setVehicleRespawnPosition(self, x, y, z, rx, ry, rz) self:save() thePlayer:showInfoBox("info","Du hast das Fahrzeug erfolgreich geparkt!") else thePlayer:showInfoBox("error", "Dieses Fahrzeug gehört dir nicht!") end end function CUserVehicle:save() if (not (self.Destroyed)) then self.Health=self:getHealth() CDatabase:getInstance():query("UPDATE Vehicles SET `OwnerID`=?, `Int`=?, `Dim`=?, `Koords`=?, `Color`=?, `Tuning`=?, `Plate`=?, `Fuel`=?, `KM`=?, `Health`=?, `LichtFarbe`=?, `Dirtlevel`=? WHERE `ID`=?;", tonumber(self.OwnerID), tonumber(self.Int), self.Dim, self.Koords, self.Color, self.Tuning, self.Plate, self.Fuel, self.KM, self.Health, self.HeadLights, self.DirtLevel, self.ID) end end function CUserVehicle:respawn(thePlayer) if (self:getOwnerID() == thePlayer:getID()) then if ( getTableSize(getVehicleOccupants(self)) == 0) then local health = getElementHealth(self) respawnVehicle(self) self.Engine = false setVehicleEngineState(self, false) setVehicleOverrideLights(self, 0); self.Locked = true setVehicleLocked(self, true) setElementHealth(self, health) thePlayer:showInfoBox("info", "Du hast dein Fahrzeug erfolgreich respawnt!") self:tune(); else thePlayer:showInfoBox("error", "Dieses Fahrzeug ist nicht leer!") end else thePlayer:showInfoBox("error", "Dieses Fahrzeug gehört dir nicht!") end end addEvent("onPlayerUserVehicleRespawn", true) addEventHandler("onPlayerUserVehicleRespawn", getRootElement(), function(ID) if (not(clientcheck(source, client))) then return false end if (UserVehicles[ID]) then UserVehicles[ID]:respawn(client) end end ) addEvent("onPlayerRequestUserVehicles", true) addEventHandler("onPlayerRequestUserVehicles", getRootElement(), function() if (not(clientcheck(source, client))) then return false end if (not(type(UserVehiclesByPlayer[client:getID()]) == "table")) then UserVehiclesByPlayer[client:getID()] = {} end triggerClientEvent(client, "onClientReceivUserVehicles", client, UserVehiclesByPlayer[client:getID()]) end ) addEvent("onUserVehicleRespawnRequest", true) addEventHandler("onUserVehicleRespawnRequest", getRootElement(), function(ID) if (not(clientcheck(source, client))) then return false end UserVehicles[tonumber(ID)]:respawn(source) end)
----------------------------------- -- Area: Beadeaux (254) -- Mob: Zircon Quadav -- Note: PH for Zo'Khu Blackcloud ----------------------------------- local ID = require("scripts/zones/Beadeaux/IDs"); require("scripts/globals/mobs"); function onMobDeath(mob, player, isKiller) end; function onMobDespawn(mob) tpz.mob.phOnDespawn(mob,ID.mob.ZO_KHU_BLACKCLOUD_PH,10,math.random(3600,18000)); -- 1 to 5 hours end;
object_tangible_loot_creature_loot_collections_dejarik_ghhhk = object_tangible_loot_creature_loot_collections_shared_dejarik_ghhhk:new { } ObjectTemplates:addTemplate(object_tangible_loot_creature_loot_collections_dejarik_ghhhk, "object/tangible/loot/creature/loot/collections/dejarik_ghhhk.iff")
local _, addon = ... local Store = addon.magi.GetStore('Base') local General = addon.magi.AddStoreCategory(Store, 'General') addon.magi.AddIds(addon.magi.AddCategorySection(General, 'Alcohol', addon.magi.CategoryTypes.Consumable), { 182121, 183616, 37898, 80914, }) addon.magi.AddIds(addon.magi.AddCategorySection(General, 'Battle Pets'), { 116420 }) addon.magi.AddIds(addon.magi.AddCategorySection(General, 'Currency'), { 116394, 116395, 116415, 118099, 118100, 118720, 119297, 119299, 137642, 163036, -- Polished Pet Charm 173363, 178040, 184304, -- Anima Touched Weapon Fragments 21100, 32897, 42780, 47242, 52027, 52029, 71617, }) addon.magi.AddIds(addon.magi.AddCategorySection(General, 'Novelty'), { 113545, 163695, 183616, 27944, 80914, 8383, }) addon.magi.AddIds(addon.magi.AddCategorySection(General, 'Toy'), { 117550, }) addon.magi.AddIds(addon.magi.AddCategorySection(General, 'Speed Gear'), { 184841, })
local method = ngx.req.get_method() local key = "12345" local h = ngx.req.get_headers() local token = h.Authorization ngx.say("step 5") if token == nil then ngx.exit(ngx.HTTP_FORBIDDEN) end md_hash = token:match("([^Token ].+)") if method == "POST" or method == "PUT" then ngx.req.read_body() -- explicitly read the req body local body = ngx.req.get_body_data() if body then local data = body .. key ngx.say("body:", ngx.md5(data)) if ngx.md5(data) ~= md_hash then ngx.exit(ngx.HTTP_FORBIDDEN) end ngx.say("Ok") return end -- ngx.say("no body, POST") ngx.exit(ngx.HTTP_FORBIDDEN) return end if method == "GET" or method == "DELETE" then local str = ngx.var.uri .. '?' .. ngx.var.args .. key ngx.say("method GET:\t", ngx.md5( str) ) if md_hash == ngx.md5(str) then ngx.say("Authorization:\tOk") return end ngx.say("Authorization:\tFalse") return end ngx.say("send by method:", ngx.req.get_method()) ngx.exit(ngx.HTTP_FORBIDDEN)
local Debug = require("OOP.Config").Debug; local Number1 = enum("One","Two","Three"); assert(Number1.One == 1); assert(Number1.Two == 2); assert(Number1.Three == 3); local Number2 = enum { Four = 4, Five = 5, Six = 6 }; assert(Number2.Four == 4); assert(Number2.Five == 5); assert(Number2.Six == 6); local Number3 = enum { Seven = enum(7), Eight = enum(), Nine = enum() }; assert(Number3.Seven == 7); assert(Number3.Eight == 8); assert(Number3.Nine == 9); local ok = pcall(function () Number3.Nine = 10; end); if Debug then assert(not ok); else assert(ok); end local Test = class(); Test.Number1 = Number1; Test.static.Number2 = Number2; local test = Test.new(); assert(test.Number1 == Test.Number1); assert(Test.Number2.Four == 4); ok = pcall(function () return test.Number2.Four; end); assert(not ok);
--Very First install only script --It will install "gitTrans" which download/upload manager from github code local GITTRANSURL='https://raw.githubusercontent.com/SemteulGaram/OpenComputers-Remi/master/src/gitTrans.lua' local comp = require 'component' local fs = require 'filesystem' local inet = nil local function check() if not comp.isAvailable('internet') then print('Internet component not available. Please insert internet card.') return 1 end inet=comp.getPrimary('internet') if not inet.isHttpEnabled() then print('This server didn\'t allow http access. Please download script manually(via pastebin or wget).') return 2 end return 0 end local function install() --Ensure Dir fs.makeDirectory('src') local req=inet.request(GITTRANSURL) local file=io.open("src/gitTrans.lua", "w") local byteCount = 1024 local data=req.read(byteCount) while data do file:write(data) file:flush() data=req.read(byteCount) end file:close() return 0 end print('Remi check...') local code = check() if code~=0 then print('setup process terminated with error code: '..code) return end print('Remi install...') code=install() if code~=0 then print('install process terminated with error code: '..code) return end print('gitTrans force pulling...') local gitTrans=require 'src/gitTrans' code=gitTrans.forcePull() if code~=0 then print('gitTrans.forcePull() process terminated with error code: '..code) return end print('Remi installation SUCCESS')
return PlaceObj("ModDef", { "title", "Just Music", "version", 1, "version_major", 0, "version_minor", 1, "saved", 0, "image", "Preview.png", "id", "ChoGGi_OnlyRadioMusic", "steam_id", "1701116117", "pops_any_uuid", "a92baeaf-5c48-41c0-8b48-e8b48a0dcb94", "author", "ChoGGi", "lua_revision", 249143, "code", { "Code/Script.lua", }, "description", [[Skips all the other tracks and just plays music.]], })
GUI.AddSpriteSheetItem("Mainmenubackground", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "0", VPixelOffset = "136", UPixelScale = "200", VPixelScale = "120", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuCircle_anim00", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "120", VPixelOffset = "16", UPixelScale = "60", VPixelScale = "60", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuCircle_anim03", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "120", VPixelOffset = "76", UPixelScale = "60", VPixelScale = "60", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuCircle_anim02", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "60", VPixelOffset = "76", UPixelScale = "60", VPixelScale = "60", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuCircle_anim01", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "0", VPixelOffset = "76", UPixelScale = "60", VPixelScale = "60", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuCircleBig", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "60", VPixelOffset = "16", UPixelScale = "60", VPixelScale = "60", AngleOffset = "0" }) GUI.AddSpriteSheetItem("Mainmenupadlock", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "0", VPixelOffset = "16", UPixelScale = "60", VPixelScale = "60", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuCellschozo03", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "234", VPixelOffset = "20", UPixelScale = "22", VPixelScale = "1", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuCellschozo02", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "254", VPixelOffset = "0", UPixelScale = "1", VPixelScale = "22", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuCellschozo01", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "234", VPixelOffset = "0", UPixelScale = "22", VPixelScale = "22", AngleOffset = "0" }) GUI.AddSpriteSheetItem("MainmenuFXLine", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "0", VPixelOffset = "0", UPixelScale = "190", VPixelScale = "3", AngleOffset = "0" }) GUI.AddSpriteSheetItem("Flare", "gui/textures/texturehudmainmenu.bctex", { TextureWidth = "256", TextureHeight = "256", UPixelOffset = "200", VPixelOffset = "52", UPixelScale = "54", VPixelScale = "204", AngleOffset = "0" })
cnt = redis.call('INCR', KEYS[1]) if cnt > ARGV[1] then return 1 end if cnt == 1 then redis.call('PEXPIRE', KEYS[1], ARGV[2]) end return 0
tusk_walrus_wallop_nb2017 = class({}) LinkLuaModifier( "modifier_tusk_walrus_wallop_nb2017", "modifiers/modifier_tusk_walrus_wallop_nb2017", LUA_MODIFIER_MOTION_NONE ) LinkLuaModifier( "modifier_tusk_walrus_wallop_enemy_nb2017", "modifiers/modifier_tusk_walrus_wallop_enemy_nb2017", LUA_MODIFIER_MOTION_HORIZONTAL ) -------------------------------------------------------------------------------- function tusk_walrus_wallop_nb2017:GetIntrinsicModifierName() return "modifier_tusk_walrus_wallop_nb2017" end -------------------------------------------------------------------------------- function tusk_walrus_wallop_nb2017:GetCastRange( vLocation, hTarget ) return self:GetCaster():GetAttackRange() end --------------------------------------------------------------------------------
require'nvim-web-devicons'.setup { override = { ['vim'] = { icon = '', color = '#3C8376', name = 'Vim' }, ['.vimrc'] = { icon = '', color = '#3C8376', name = 'Vimrc' }, ['.gvimrc'] = { icon = '', color = '#3C8376', name = 'Gvimrc' }, ['angular.json'] = { icon = "", color = "#E23237", name = 'Angular' }, ['yarn.lock'] = { icon = '', color = '#2188B6', name = 'Yarn' }, --------------------------------------------- -- Git --------------------------------------------- ['git'] = { icon = '', color = '#DD4C35', name = 'GitLogo' }, ['.gitattributes'] = { icon = '', color = '#DD4C35', name = 'GitAttributes' }, ['.gitconfig'] = { icon = '', color = '#DD4C35', name = 'GitConfig' }, ['.gitignore'] = { icon = '', color = '#DD4C35', name = 'GitIgnore' }, ['.gitmodules'] = { icon = '', color = '#DD4C35', name = 'GitModules' }, ['.gitkeep'] = { icon = '', color = '#DD4C35', name = 'GitKeep' }, --------------------------------------------- -- Files --------------------------------------------- ['Makefile'] = { icon = "", color = '#fff', name = 'Makefile' }, ["Dockerfile"] = { icon = "", color = "#27B9EC", name = "Dockerfile" }, ["Gemfile$"] = { icon = "", color = "#701516", name = "Gemfile" }, ["Brewfile"] = { icon = "", color = "#6F4E37", name = "Gemfile" }, --------------------------------------------- -- Files --------------------------------------------- ['.npmrc'] = { icon = "", color = "#E8274B", name = 'npmrc' }, ['package.json'] = { icon = "", color = "#E8274B", name = 'package' }, ['package-lock.json'] = { icon = "", color = "#E8274B", name = 'packageJson' }, --------------------------------------------- -- Configs --------------------------------------------- ['.editorconfig'] = { icon = '', name = 'editorconfig' }, ['.browserslistrc'] = { icon = '', name = 'browserslistrc' }, } }
Data.Input = { --No id ["FlashCtrl"] = -1, ["FlashScrollDown"] = -1, ["FlashScrollUp"] = -1, ["FlashCancel"] = -1, ["FlashHome"] = -1, ["Action1"] = 1, ["FlashLeftMouse"] = {1, 4}, ["FlashRightMouse"] = 2, ["FlashMiddleMouse"] = 3, ["FlashAlt"] = 62, ["ActionMenu"] = 110, ["CameraCenter"] = 111, ["CameraToggleMouseRotate"] = 112, ["CameraBackward"] = 113, ["CameraForward"] = 114, ["CameraLeft"] = 115, ["CameraRight"] = 116, ["CameraZoomIn"] = 117, ["CameraZoomOut"] = 118, ["CameraRotateLeft"] = 119, ["CameraRotateRight"] = 120, ["CameraRotateMouseLeft"] = 121, ["CameraRotateMouseRight"] = 122, ["FreeCameraToggleMouseRotate"] = 123, ["FreeCameraMoveForward"] = 124, ["FreeCameraMoveBackward"] = 125, ["FreeCameraMoveLeft"] = 126, ["FreeCameraMoveRight"] = 127, ["FreeCameraFoVInc"] = 128, ["FreeCameraFoVDec"] = 129, ["FreeCameraSpeedInc"] = 130, ["FreeCameraSpeedDec"] = 131, ["FreeCameraSpeedReset"] = 132, ["FreeCameraRotSpeedInc"] = 133, ["FreeCameraRotSpeedDec"] = 134, ["FreeCameraRotateControllerLeft"] = 135, ["FreeCameraRotateControllerRight"] = 136, ["FreeCameraRotateControllerUp"] = 137, ["FreeCameraRotateMouseLeft"] = 139, ["FreeCameraRotateMouseRight"] = 140, ["FreeCameraRotateMouseUp"] = 141, ["FreeCameraRotateMouseDown"] = 142, ["FreeCameraHeightInc"] = 143, ["FreeCameraHeightDec"] = 144, ["FreeCameraSlowdown"] = 145, ["FreeCameraFreezeGameTime"] = 146, ["CharacterCreationRotateLeft"] = 147, ["CharacterCreationRotateRight"] = 148, ["CharacterCreationAccept"] = 149, ["CharacterMoveForward"] = 150, ["CharacterMoveBackward"] = 151, ["CharacterMoveLeft"] = 152, ["CharacterMoveRight"] = 153, ["ClearSurface"] = 154, ["CreateWaterSurface"] = 155, ["CreateFrozenWaterSurface"] = 156, ["CreateBloodSurface"] = 157, ["CreatePoisonSurface"] = 158, ["CreateOilSurface"] = 159, ["CreateFireSurface"] = 160, ["CreateLavaSurface"] = 162, ["CreateWaterCloud"] = 163, ["CreateBloodCloud"] = 164, ["CreatePoisonCloud"] = 165, ["CreateFireCloud"] = 167, ["BlessSurface"] = 168, ["CurseSurface"] = 169, ["ElectrifySurface"] = 170, ["FreezeSurface"] = 171, ["MeltSurface"] = 172, ["IncreaseSurfaceBrush"] = 175, ["DecreaseSurfaceBrush"] = 176, ["DebugViewHide"] = 177, ["DebugViewScrollUp"] = 178, ["DebugViewScrollDown"] = 179, ["DebugAIGridTakeStep"] = 180, ["DebugToggleCharacter"] = 181, ["DebugLevelUp"] = 182, ["DebugTogglePartyEdit"] = 183, ["DebugKillCombat"] = 184, ["ToggleFlyCam"] = 185, ["DebugSelectCharacter"] = 186, ["DebugDeselectCharacter"] = 187, ["SwitchDebugParty"] = 190, ["ShowSoundDebugWindow"] = 191, ["ForceKillApp"] = 192, ["TelemetryStart"] = 193, ["TelemetryStop"] = 194, ["ForceEndDialog"] = 195, ["JoinLocalLobby"] = 196, ["ForceKillObject"] = 197, ["ForceRemoveObject"] = 198, ["ForceKillParty"] = 199, ["GiveSomeGold"] = 200, ["Revive"] = 201, ["ShowWayPointMenu"] = 202, ["EnableController"] = 203, ["IggyExplorerNext"] = 204, ["IggyExplorerPrev"] = 205, ["ForceEndTurn"] = 206, ["ToggleAiGrid"] = 207, ["TogglePhysics"] = 208, ["ToggleAIBounds"] = 209, ["ToggleDecalBounds"] = 210, ["ToggleBlindToCriminals"] = 211, ["ForceAnimation"] = 212, ["DragSingleToggle"] = 213, ["TogglePresentation"] = 214, ["PartyManagement"] = 215, ["MoveCharacterUpInGroup"] = 216, ["PanelSelect"] = 217, ["CycleCharactersNext"] = 218, ["CycleCharactersPrev"] = 219, ["DestructionToggle"] = 220, ["HighlightCharacters"] = 221, ["Interact"] = 222, ["ActionCancel"] = 223, ["NextObject"] = 224, ["Pause"] = 225, ["PrevObject"] = 226, ["QueueCommand"] = 227, ["QuickLoad"] = 228, ["QuickSave"] = 229, ["ShowChat"] = 230, ["SkipVideo"] = 231, ["SplitItemToggle"] = 232, ["RotateItemLeft"] = 233, ["RotateItemRight"] = 234, ["TeleportPlayer"] = 235, ["ToggleCombatMode"] = 237, ["ToggleSplitscreen"] = 238, ["ToggleEquipment"] = 239, ["ToggleHomestead"] = 240, ["ToggleInGameMenu"] = 241, ["ToggleInfo"] = 242, ["ToggleInputMode"] = 243, ["CancelSelectorMode"] = 244, ["ToggleCharacterPane"] = 245, ["ToggleInventory"] = 246, ["ToggleCraft"] = 247, ["ToggleRecipes"] = 248, ["ToggleJournal"] = 249, ["ToggleMap"] = 250, ["ToggleSkills"] = 251, ["ToggleSneak"] = 252, ["WidgetToggleStats"] = 253, ["AreaPickup"] = 254, ["ToggleMonsterSelect"] = 255, ["ToggleSetStartPoint"] = 256, ["ToggleSurfacePainter"] = 257, ["ToggleOverviewMap"] = 258, ["ToggleVignette"] = 259, ["ToggleGMPause"] = 260, ["ToggleGMShroud"] = 261, ["ToggleRollPanel"] = 262, ["ToggleGMInventory"] = 263, ["ToggleManageTarget"] = 264, ["ToggleGMMiniMap"] = 265, ["GMKillResurrect"] = 266, ["GMSetHealth"] = 267, ["SwitchGMMode"] = 268, ["GMNormalAlignMode"] = 269, ["ToggleGMRewardPanel"] = 270, ["ToggleGMItemGeneratorPane"] = 271, ["ToggleGMMoodPanel"] = 272, ["ToggleStatusPanel"] = 273, ["ToggleReputationPanel"] = 274, ["TogglePartyManagement"] = 275, ["ContextMenu"] = 276, ["ControllerContextMenu"] = 277, ["Combine"] = 278, ["ToggleTacticalCamera"] = 279, ["ShowWorldTooltips"] = 280, ["SelectorMoveBackward"] = 281, ["SelectorMoveForward"] = 282, ["SelectorMoveLeft"] = 283, ["SelectorMoveRight"] = 284, ["ShowSneakCones"] = 285, ["UIDelete"] = 286, ["UIAccept"] = 287, ["UIBack"] = 288, ["UICancel"] = 289, ["UITakeAll"] = 290, ["UIEndTurn"] = 291, ["UIHotBarNext"] = 292, ["UIHotBarPrev"] = 293, ["UIRadialLeft"] = 294, ["UIRadialRight"] = 295, ["UIRadialUp"] = 296, ["UIRadialDown"] = 297, ["UILeft"] = 298, ["UIRight"] = 299, ["UIUp"] = 300, ["UIDown"] = {301, 302}, ["UISelectChar1"] = 303, ["UISelectChar2"] = 304, ["UISelectChar3"] = 305, ["UISelectChar4"] = 306, ["UISelectSlot0"] = 307, ["UISelectSlot1"] = 308, ["UISelectSlot2"] = 309, ["UISelectSlot3"] = 310, ["UISelectSlot4"] = 311, ["UISelectSlot5"] = 312, ["UISelectSlot6"] = 313, ["UISelectSlot7"] = 314, ["UISelectSlot8"] = 315, ["UISelectSlot9"] = 316, ["UISelectSlot11"] = 317, ["UISelectSlot12"] = 318, ["UIToggleEquipment"] = 319, ["CCZoomIn"] = 320, ["CCZoomOut"] = 321, ["UIRefresh"] = 322, ["UITabPrev"] = 323, ["UITabNext"] = 324, ["UIShowTooltip"] = 325, ["UICompareItems"] = 326, ["WidgetScrollUp"] = 327, ["WidgetScrollDown"] = 328, ["UIDialogTextUp"] = 329, ["UIDialogTextDown"] = 330, ["UIRequestTrade"] = 331, ["UIAddPoints"] = 332, ["UIRemovePoints"] = 333, ["UIDialogRPSRock"] = 334, ["UIDialogRPSPaper"] = 335, ["UIDialogRPSScissors"] = 336, ["UICreateProfile"] = 337, ["UIDeleteProfile"] = 338, ["UIRemoveItemSelection"] = {339, 364}, ["UICreationPrev"] = 340, ["UICreationNext"] = 341, ["UICreationEditClassPrev"] = 342, ["UICreationEditClassNext"] = 343, ["UICreationTabPrev"] = 344, ["UICreationTabNext"] = 345, ["UIStartGame"] = 346, ["UIEditCharacter"] = 347, ["UIShowInfo"] = 350, ["UIRename"] = 351, ["UIFilter"] = 352, ["UIMapDown"] = 353, ["UIMapUp"] = 354, ["UIMapLeft"] = 355, ["UIMapRight"] = 356, ["UIMapZoomIn"] = 357, ["UIMapZoomOut"] = 358, ["UIMapReset"] = 359, ["UIMapRemoveMarker"] = 360, ["UITradeSwitchWindow"] = 361, ["UITradeRemoveOffer"] = 362, ["UITradeBalance"] = 363, ["UIMessageBoxA"] = 365, ["UIMessageBoxB"] = 366, ["UIMessageBoxX"] = 367, ["UIMessageBoxY"] = 368, ["UIInvite"] = 369, ["UIToggleTutorials"] = 370, ["UICreationAddSkill"] = 371, ["UICreationRemoveSkill"] = 372, ["UIModPrev"] = 373, ["UIModNext"] = 374, ["UIAddonUp"] = 375, ["UIAddonDown"] = 376, ["Ping"] = 377, ["UICopy"] = 378, ["UICut"] = 379, ["UIPaste"] = 380, ["UIMarkWares"] = 381, ["UIToggleMultiselection"] = 382, ["UIToggleActions"] = 383, ["UIToggleHelmet"] = 384, ["CopyVersionToClipboard"] = 385, ["UISend"] = 386 } Data.InputEnum = { [1] = {"FlashLeftMouse", "Action1"}, [2] = "FlashRightMouse", [3] = "FlashMiddleMouse", [4] = "FlashLeftMouse", [62] = "FlashAlt", [110] = "ActionMenu", [111] = "CameraCenter", [112] = "CameraToggleMouseRotate", [113] = "CameraBackward", [114] = "CameraForward", [115] = "CameraLeft", [116] = "CameraRight", [117] = "CameraZoomIn", [118] = "CameraZoomOut", [119] = "CameraRotateLeft", [120] = "CameraRotateRight", [121] = "CameraRotateMouseLeft", [122] = "CameraRotateMouseRight", [123] = "FreeCameraToggleMouseRotate", [124] = "FreeCameraMoveForward", [125] = "FreeCameraMoveBackward", [126] = "FreeCameraMoveLeft", [127] = "FreeCameraMoveRight", [128] = "FreeCameraFoVInc", [129] = "FreeCameraFoVDec", [130] = "FreeCameraSpeedInc", [131] = "FreeCameraSpeedDec", [132] = "FreeCameraSpeedReset", [133] = "FreeCameraRotSpeedInc", [134] = "FreeCameraRotSpeedDec", [135] = "FreeCameraRotateControllerLeft", [136] = "FreeCameraRotateControllerRight", [137] = "FreeCameraRotateControllerUp", [139] = "FreeCameraRotateMouseLeft", [140] = "FreeCameraRotateMouseRight", [141] = "FreeCameraRotateMouseUp", [142] = "FreeCameraRotateMouseDown", [143] = "FreeCameraHeightInc", [144] = "FreeCameraHeightDec", [145] = "FreeCameraSlowdown", [146] = "FreeCameraFreezeGameTime", [147] = "CharacterCreationRotateLeft", [148] = "CharacterCreationRotateRight", [149] = "CharacterCreationAccept", [150] = "CharacterMoveForward", [151] = "CharacterMoveBackward", [152] = "CharacterMoveLeft", [153] = "CharacterMoveRight", [154] = "ClearSurface", [155] = "CreateWaterSurface", [156] = "CreateFrozenWaterSurface", [157] = "CreateBloodSurface", [158] = "CreatePoisonSurface", [159] = "CreateOilSurface", [160] = "CreateFireSurface", [162] = "CreateLavaSurface", [163] = "CreateWaterCloud", [164] = "CreateBloodCloud", [165] = "CreatePoisonCloud", [167] = "CreateFireCloud", [168] = "BlessSurface", [169] = "CurseSurface", [170] = "ElectrifySurface", [171] = "FreezeSurface", [172] = "MeltSurface", [175] = "IncreaseSurfaceBrush", [176] = "DecreaseSurfaceBrush", [177] = "DebugViewHide", [178] = "DebugViewScrollUp", [179] = "DebugViewScrollDown", [180] = "DebugAIGridTakeStep", [181] = "DebugToggleCharacter", [182] = "DebugLevelUp", [183] = "DebugTogglePartyEdit", [184] = "DebugKillCombat", [185] = "ToggleFlyCam", [186] = "DebugSelectCharacter", [187] = "DebugDeselectCharacter", [190] = "SwitchDebugParty", [191] = "ShowSoundDebugWindow", [192] = "ForceKillApp", [193] = "TelemetryStart", [194] = "TelemetryStop", [195] = "ForceEndDialog", [196] = "JoinLocalLobby", [197] = "ForceKillObject", [198] = "ForceRemoveObject", [199] = "ForceKillParty", [200] = "GiveSomeGold", [201] = "Revive", [202] = "ShowWayPointMenu", [203] = "EnableController", [204] = "IggyExplorerNext", [205] = "IggyExplorerPrev", [206] = "ForceEndTurn", [207] = "ToggleAiGrid", [208] = "TogglePhysics", [209] = "ToggleAIBounds", [210] = "ToggleDecalBounds", [211] = "ToggleBlindToCriminals", [212] = "ForceAnimation", [213] = "DragSingleToggle", [214] = "TogglePresentation", [215] = "PartyManagement", [216] = "MoveCharacterUpInGroup", [217] = "PanelSelect", [218] = "CycleCharactersNext", [219] = "CycleCharactersPrev", [220] = "DestructionToggle", [221] = "HighlightCharacters", [222] = "Interact", [223] = "ActionCancel", [224] = "NextObject", [225] = "Pause", [226] = "PrevObject", [227] = "QueueCommand", [228] = "QuickLoad", [229] = "QuickSave", [230] = "ShowChat", [231] = "SkipVideo", [232] = "SplitItemToggle", [233] = "RotateItemLeft", [234] = "RotateItemRight", [235] = "TeleportPlayer", [237] = "ToggleCombatMode", [238] = "ToggleSplitscreen", [239] = "ToggleEquipment", [240] = "ToggleHomestead", [241] = "ToggleInGameMenu", [242] = "ToggleInfo", [243] = "ToggleInputMode", [244] = "CancelSelectorMode", [245] = "ToggleCharacterPane", [246] = "ToggleInventory", [247] = "ToggleCraft", [248] = "ToggleRecipes", [249] = "ToggleJournal", [250] = "ToggleMap", [251] = "ToggleSkills", [252] = "ToggleSneak", [253] = "WidgetToggleStats", [254] = "AreaPickup", [255] = "ToggleMonsterSelect", [256] = "ToggleSetStartPoint", [257] = "ToggleSurfacePainter", [258] = "ToggleOverviewMap", [259] = "ToggleVignette", [260] = "ToggleGMPause", [261] = "ToggleGMShroud", [262] = "ToggleRollPanel", [263] = "ToggleGMInventory", [264] = "ToggleManageTarget", [265] = "ToggleGMMiniMap", [266] = "GMKillResurrect", [267] = "GMSetHealth", [268] = "SwitchGMMode", [269] = "GMNormalAlignMode", [270] = "ToggleGMRewardPanel", [271] = "ToggleGMItemGeneratorPane", [272] = "ToggleGMMoodPanel", [273] = "ToggleStatusPanel", [274] = "ToggleReputationPanel", [275] = "TogglePartyManagement", [276] = "ContextMenu", [277] = "ControllerContextMenu", [278] = "Combine", [279] = "ToggleTacticalCamera", [280] = "ShowWorldTooltips", [281] = "SelectorMoveBackward", [282] = "SelectorMoveForward", [283] = "SelectorMoveLeft", [284] = "SelectorMoveRight", [285] = "ShowSneakCones", [286] = "UIDelete", [287] = "UIAccept", [288] = "UIBack", [289] = "UICancel", [290] = "UITakeAll", [291] = "UIEndTurn", [292] = "UIHotBarNext", [293] = "UIHotBarPrev", [294] = "UIRadialLeft", [295] = "UIRadialRight", [296] = "UIRadialUp", [297] = "UIRadialDown", [298] = "UILeft", [299] = "UIRight", [300] = "UIUp", [301] = "UIDown", [302] = "UIDown", [303] = "UISelectChar1", [304] = "UISelectChar2", [305] = "UISelectChar3", [306] = "UISelectChar4", [307] = "UISelectSlot0", [308] = "UISelectSlot1", [309] = "UISelectSlot2", [310] = "UISelectSlot3", [311] = "UISelectSlot4", [312] = "UISelectSlot5", [313] = "UISelectSlot6", [314] = "UISelectSlot7", [315] = "UISelectSlot8", [316] = "UISelectSlot9", [317] = "UISelectSlot11", [318] = "UISelectSlot12", [319] = "UIToggleEquipment", [320] = "CCZoomIn", [321] = "CCZoomOut", [322] = "UIRefresh", [323] = "UITabPrev", [324] = "UITabNext", [325] = "UIShowTooltip", [326] = "UICompareItems", [327] = "WidgetScrollUp", [328] = "WidgetScrollDown", [329] = "UIDialogTextUp", [330] = "UIDialogTextDown", [331] = "UIRequestTrade", [332] = "UIAddPoints", [333] = "UIRemovePoints", [334] = "UIDialogRPSRock", [335] = "UIDialogRPSPaper", [336] = "UIDialogRPSScissors", [337] = "UICreateProfile", [338] = "UIDeleteProfile", [339] = "UIRemoveItemSelection", [340] = "UICreationPrev", [341] = "UICreationNext", [342] = "UICreationEditClassPrev", [343] = "UICreationEditClassNext", [344] = "UICreationTabPrev", [345] = "UICreationTabNext", [346] = "UIStartGame", [347] = "UIEditCharacter", [350] = "UIShowInfo", [351] = "UIRename", [352] = "UIFilter", [353] = "UIMapDown", [354] = "UIMapUp", [355] = "UIMapLeft", [356] = "UIMapRight", [357] = "UIMapZoomIn", [358] = "UIMapZoomOut", [359] = "UIMapReset", [360] = "UIMapRemoveMarker", [361] = "UITradeSwitchWindow", [362] = "UITradeRemoveOffer", [363] = "UITradeBalance", [364] = "UIRemoveItemSelection", [365] = "UIMessageBoxA", [366] = "UIMessageBoxB", [367] = "UIMessageBoxX", [368] = "UIMessageBoxY", [369] = "UIInvite", [370] = "UIToggleTutorials", [371] = "UICreationAddSkill", [372] = "UICreationRemoveSkill", [373] = "UIModPrev", [374] = "UIModNext", [375] = "UIAddonUp", [376] = "UIAddonDown", [377] = "Ping", [378] = "UICopy", [379] = "UICut", [380] = "UIPaste", [381] = "UIMarkWares", [382] = "UIToggleMultiselection", [383] = "UIToggleActions", [384] = "UIToggleHelmet", [385] = "CopyVersionToClipboard", [386] = "UISend" }
json = require("cjson") Wrangler = require("init")() time = require("time") Wrangler:addFilter("id", function(self, object, name, value) return object.id == value end) Wrangler:addFilter("first_name", function(self, object, name, value) return object.first_name:match(value) ~= nil end) Wrangler:addFilter("last_name", function(self, object, name, value) return object.last_name:match(value) ~= nil end) Wrangler:addFilter("email", function(self, object, name, value) return object.email:match(value) ~= nil end) Wrangler:addFilter("gender", function(self, object, name, value) return object.gender:match(value) ~= nil end) Wrangler:addFilter("color", function(self, object, name, value) return object.color:match(value) ~= nil end) Wrangler:addFilter("leet", function(self, object, name, value) return object.leet:match(value) ~= nil end) sampleFile = io.open("test.json") sampletxt = sampleFile:read("*a") sampleFile:close() sample = json.decode(sampletxt) sampleLen = #sample print("Press enter to begin filtering...") io.read() print("Find all males from reddit.com ...") start = time.clock() Wrangler:filter(sample, { gender = "^Male$", email = "reddit.com" }) finish = time.clock() print("Started at " .. start) print("Finished at " .. finish) print("Processed " .. sampleLen .. " entries in " .. (finish - start) .. "s")
--startup.lua version="2.1.0" ip="192.168.254.72" -- setup I2c and connect display function init_i2c_display() -- SDA and SCL can be assigned freely to available GPIOs local sda = 6 local scl = 5 local sla = 0x3c print(" initializng I2c OLED display on pins "..sda.." and "..scl) i2c.setup(0, sda, scl, i2c.SLOW) disp = u8g.ssd1306_128x64_i2c(sla) disp:setFont(u8g.font_6x10) disp:setFontRefHeightExtendedText() disp:setDefaultForegroundColor() disp:setFontPosTop() disp:setColorIndex(1) end function draw(str) disp:drawStr(10,10,str) end print('\n *** startup.lua ver 2.1') wifi.setmode(wifi.STATION); wifi.sta.config("FrontierHSI","passfire") wifi.sta.sethostname("sen06") print(' set mode=STATION (mode='..wifi.getmode()..')') print(' MAC: ',wifi.sta.getmac()) print(' chip: ',node.chipid()) print(' heap: ',node.heap()) print(' ') tmr.alarm(1,1000,1,function() if wifi.sta.getip()==nil then print(" IP unavailable, waiting") else tmr.stop(1) print("\n Config done, IP is "..wifi.sta.getip()) print(" hostname: "..wifi.sta.gethostname()) print(" ESP8266 mode is: " .. wifi.getmode()) print(" MAC address is: " .. wifi.ap.getmac()) init_i2c_display() print("\n starting sensor read loop") print(" sending data to: " ..ip) dofile("post.lua") end end)
local compatibility = {} local event = require("__flib__.event") local constants = require("scripts.constants") local infinity_loader = require("scripts.entity.infinity-loader") function compatibility.add_cursor_enhancements_overrides() if remote.interfaces["CursorEnhancements"] and remote.call("CursorEnhancements", "version") == constants.cursor_enhancements_interface_version then remote.call("CursorEnhancements", "add_overrides", constants.cursor_enhancements_overrides) end end function compatibility.check_for_space_exploration() return script.active_mods["space-exploration"] and true or false end function compatibility.in_se_satellite_view(player) return compatibility.check_for_space_exploration() and player.controller_type == defines.controllers.god end function compatibility.in_qis_window(player) local opened = player.opened if opened and player.opened_gui_type == defines.gui_type.custom and string.find(opened.name, "^qis") then return true end return false end function compatibility.check_for_testing_scenario() return remote.interfaces["EditorExtensions_TestingScenario"] and true or false end function compatibility.register_picker_dollies() if remote.interfaces["PickerDollies"] then event.register(remote.call("PickerDollies", "dolly_moved_entity_id"), infinity_loader.picker_dollies_move) end end return compatibility
--[[ Copyright 2019 Teverse @File core/client/cameraController.lua @Author(s) Jay --]] local controller = {} controller.camera = workspace.camera local target = nil controller.setTarget = function(t) target = t controller.camera.position = target.position + vector3(0,20,-50) controller.camera:lookAt(target.position) target:changed(function () -- controller.camera.position = target.position + vector3(0,20,-30) -- controller.camera:lookAt(target.position) end) end return controller
--#if profiler -- profiler window -- usage: -- 1. require this file as `profiler` -- 2a. initialise stat labels with the color you want (default: white): -- profiler.window:fill_stats(color) -- then, each time you need to show the profiler, use: -- profiler.window:show() -- 2b. alternatively, use the lazy init shortcut: -- profiler.window:show(color) -- 3. call profiler.window:update() in your loop update -- 4. call profiler.window:render() in your loop render -- 5. when done, hide the profiler with: -- profiler.window:hide() local debug_window = require("engine/debug/debug_window") local wtk = require("wtk/pico8wtk") local profiler = {} local stats_info = { {"memory", 0}, {"total cpu", 1}, {"system cpu", 2}, {"fps", 7}, {"target fps", 8}, {"actual fps", 9} } -- in order to align all stat values, we will draw them after the longest -- stat name (+ a small margin) local max_stat_name_length = 0 for stat_info in all(stats_info) do local stat_name = stat_info[1] max_stat_name_length = max(max_stat_name_length, #stat_name) end local stat_value_char_offset = max_stat_name_length + 1 -- return a callback function to use for stat labels -- exposed via profiler for testing only function profiler.get_stat_function(stat_index) return function() local stat_info = stats_info[stat_index] local stat_name = stat_info[1] -- pad stat name with spaces until it reaches a fixed length for stat value alignment local space_padding_size = stat_value_char_offset - #stat_name local space_padding = "" for i = 1, space_padding_size do space_padding = space_padding.." " end -- example: "total cpu 0.032" return stat_name..space_padding..stat(stat_info[2]) end end profiler.stat_functions = {} for i = 1, #stats_info do profiler.stat_functions[i] = profiler.get_stat_function(i) end profiler.window = derived_singleton(debug_window, function (self) self._initialized_stats = false self.panel = wtk.panel.new(80, 40, 0, true) self.gui:add_child(self.panel, 0, 0) end) -- add all stat labels function profiler.window:fill_stats(c) c = c or colors.white for i = 1, #stats_info do local label = wtk.label.new(profiler.stat_functions[i], c) -- align vertically (consider using vertical_layout) -- luamin known issue: parentheses are lost in product + sum operations -- so make sure to compute step by step -- (see https://github.com/mathiasbynens/luamin/issues/50) local y = 6*(i-1) y = y + 2 -- margin self.panel:add_child(label, 2, y) end self._initialized_stats = true end -- helper method that replaces the base show method to lazily initialise colors -- and show the window at the same time (color is ignored if already initialized) function profiler.window:show(c) if not self._initialized_stats then self:fill_stats(c) end debug_window.show(self) end --#endif -- prevent busted from parsing both versions of profiler --[[#pico8 -- fallback implementation if profiler symbol is not defined -- (picotool fails on empty file due to empty self._tokens) --#ifn profiler local profiler = {"symbol profiler is undefined"} --#endif --#pico8]] return profiler
local function demarshal(value) local slen,val = string.match(value,"([0-9]+):(.*)") local nlen = tonumber(slen) local demarshal_name = string.sub(val,1,nlen) local demarshaller = KeyStore.demarshallers[demarshal_name] if demarshaller == nil then ScenEdit_SpecialMessage(ScenEdit_PlayerSide(), "Error from " .. demarshal_name) end return demarshaller(string.sub(val,nlen+1)) end KeyStore = { keys = { }, demarshallers = { prim_str = function(strval) return strval end, prim_num = function(strval) return tonumber(strval) end, prim_nil = function(strval) return nil end, prim_bool= function(strval) return strval=="true" end, prim_func= function(strval) return nil end, prim_tab = function(strval) local istr = strval local outt = {} while istr:len() > 0 do local kslen,rval = string.match(istr,"([0-9]+):(.*)") local klen = tonumber(kslen) local keyStr = string.sub(rval,1,klen) local key = demarshal(keyStr) local vslen,vval = string.match(string.sub(rval,klen+1),"([0-9]+):(.*)") local vlen = tonumber(vslen) local value = demarshal(string.sub(vval,1,vlen)) outt[key] = value istr = string.sub(vval,vlen+1) end return outt end } } --metatable local persister = {} local function contains(t, e) for i = 1,#t do if t[i] == e then return true end end return false end function persister.__index(table, key) local result = ScenEdit_GetKeyValue(key) if result == "" then return nil end if (string.sub(result,1,1) == ":") then --unmarshalled return string.sub(result,2) else return demarshal(result) end end function persister.__newindex(_table,key,value) function marshal(value) local function marshalTable( table ) -- format: keylen:key .. vallen:value local outp = "" for key,value in pairs(table) do local mk = marshal(key) local mv = marshal(value) outp = outp .. mk:len() .. ":" .. mk .. mv:len() .. ":" .. mv end return outp end local mt = getmetatable(value) local name,marshalled = nil,nil if mt == nil or (mt ~= nil and mt.__marshal == nil) then if type(value) == "string" then name,marshalled = "prim_str",value elseif type(value) == "number" then name,marshalled = "prim_num",tostring(value) elseif type(value) == "nil" then name,marshalled = "prim_nil","" elseif type(value) == "boolean" then name,marshalled = "prim_bool",tostring(value) elseif type(value) == "function" then name,marshalled = "prim_func","" --TODO elseif type(value) == "table" then name,marshalled = "prim_tab",marshalTable(value) else name,marshalled = "prim_str",tostring(value) --default to str end end if mt ~= nil and mt.__marshal ~= nil then name,marshalled = mt.__marshal(value) name = "mrsh_" .. name end return string.len(name) .. ":" .. name .. marshalled end if contains(_table.keys,key) then ScenEdit_SetKeyValue(key,marshal(value)) else table.insert(_table.keys, key) ScenEdit_SetKeyValue(key,marshal(value)) end end function persister.__call(table, key, demarshaller) table.demarshallers["mrsh_" .. key] = demarshaller end setmetatable(KeyStore, persister)
-- bekiroj addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() for i, player in pairs(getElementsByType("player")) do exports.mrp_anticheat:changeProtectedElementDataEx(player, "usingThisShop", false, false, true) end end) function setShopCurrentUser(shop, player) local oldShop = getElementData(player, "usingThisShop") if oldShop then return false end if shop and getElementType(shop) == "ped" and getElementType(player) == "player" then exports.mrp_anticheat:changeProtectedElementDataEx(shop, "usingThisShop", player, false, true) exports.mrp_anticheat:changeProtectedElementDataEx(player, "usingThisShop", shop, false, true) outputDebugString("Created") return true else return false end end function isPlayerUsingThisShop(thePlayer, theShop) if not isElement(thePlayer) or not isElement(theShop) then return false, "Player or shop doesn't exist anymore." end local usingShop = getElementData(thePlayer, "usingThisShop") if not usingShop or not isElement(usingShop) then return false, "Player isn't using any shop at the moment." end local usingPlayer = getElementData(usingShop, "usingThisShop") if not usingPlayer or not isElement(usingPlayer) then return false, "Noone is using this shop at the moment." end if usingPlayer == thePlayer and usingShop == theShop then return true else return false, "This player isn't using this shop." end end function removeMeFromCurrentShopUser(player) if player then source = player end local shop = getElementData(source, "usingThisShop") exports.mrp_anticheat:changeProtectedElementDataEx(source, "usingThisShop", nil, false, true) if not shop or not isElement(shop) or not (getElementType(shop) == "ped") then outputDebugString("Can't get shop from client") return false end exports.mrp_anticheat:changeProtectedElementDataEx(shop, "usingThisShop", nil, false, true) outputDebugString("Removed") return true end addEvent("shop:removeMeFromCurrentShopUser", true) addEventHandler("shop:removeMeFromCurrentShopUser", root, removeMeFromCurrentShopUser) function canIAccessThisShop(shop, player) if not shop or not isElement(shop) or not (getElementType(shop) == "ped") or not player or not isElement(player) or not (getElementType(player) == "player") then return false, "Unknown" end local whoIsUsingIt = getElementData(shop, "usingThisShop") if not whoIsUsingIt then --outputDebugString("Checked : Good") return true elseif not whoIsUsingIt then --outputDebugString("Checked : Good") return true else --outputDebugString("Checked: Bad") if whoIsUsingIt and isElement(whoIsUsingIt) and getElementType(whoIsUsingIt) == "player" then return false , exports.mrp_global:getPlayerName(whoIsUsingIt) else return true end end end
local ffi = require("ffi") --require ("compiler"); local Lib_table = ffi.load("openvswitch") local stringz = require("stringz") local json = require("ovs.lib.json"); ffi.cdef[[ struct table_style; /* Manipulating tables and their rows and columns. */ struct table { struct cell *cells; struct column *columns; size_t n_columns, allocated_columns; size_t n_rows, allocated_rows; size_t current_column; char *caption; bool timestamp; }; void table_init(struct table *); void table_destroy(struct table *); void table_set_caption(struct table *, char *caption); void table_set_timestamp(struct table *, bool timestamp); void table_add_column(struct table *, const char *heading, ...); void table_add_row(struct table *); ]] ffi.cdef[[ /* Table cells. */ struct cell { /* Literal text. */ char *text; /* JSON. */ struct json *json; const struct ovsdb_type *type; }; struct cell *table_add_cell(struct table *); ]] ffi.cdef[[ /* Table formatting. */ enum table_format { TF_TABLE, /* 2-d table. */ TF_LIST, /* One cell per line, one row per paragraph. */ TF_HTML, /* HTML table. */ TF_CSV, /* Comma-separated lines. */ TF_JSON /* JSON. */ }; enum cell_format { CF_STRING, /* String format. */ CF_BARE, /* String format without most punctuation. */ CF_JSON /* JSON. */ }; struct table_style { enum table_format format; /* TF_*. */ enum cell_format cell_format; /* CF_*. */ bool headings; /* Include headings? */ int json_flags; /* CF_JSON: Flags for json_to_string(). */ }; ]] ffi.cdef[[ void table_parse_format(struct table_style *, const char *format); void table_parse_cell_format(struct table_style *, const char *format); void table_print(const struct table *, const struct table_style *); ]] local TABLE_STYLE_DEFAULT = ffi.new("struct table_style", ffi.C.TF_TABLE, ffi.C.CF_STRING, true, ffi.C.JSSF_SORT); --[[ #define TABLE_STYLE_DEFAULT { TF_TABLE, CF_STRING, true, JSSF_SORT } #define TABLE_OPTION_ENUMS \ OPT_NO_HEADINGS, \ OPT_PRETTY, \ OPT_BARE #define TABLE_LONG_OPTIONS \ {"format", required_argument, NULL, 'f'}, \ {"data", required_argument, NULL, 'd'}, \ {"no-headings", no_argument, NULL, OPT_NO_HEADINGS}, \ {"pretty", no_argument, NULL, OPT_PRETTY}, \ {"bare", no_argument, NULL, OPT_BARE} #define TABLE_OPTION_HANDLERS(STYLE) \ case 'f': \ table_parse_format(STYLE, optarg); \ break; \ \ case 'd': \ table_parse_cell_format(STYLE, optarg); \ break; \ \ case OPT_NO_HEADINGS: \ (STYLE)->headings = false; \ break; \ \ case OPT_PRETTY: \ (STYLE)->json_flags |= JSSF_PRETTY; \ break; \ \ case OPT_BARE: \ (STYLE)->format = TF_LIST; \ (STYLE)->cell_format = CF_BARE; \ (STYLE)->headings = false; \ break; --]] local ovs_table = ffi.typeof("struct table"); local ovs_table_style = ffi.typeof("struct table_style"); local OVSTable = {} setmetatable(OVSTable, { __call = function(self,...) return self:new(...) end, }) local OVSTable_mt = { __index = OVSTable; } function OVSTable.init(self, handle, caption) local obj = { Handle = handle; } setmetatable(obj, OVSTable_mt); obj:setCaption(caption); return obj; end function OVSTable.new(self, caption) local structSize = ffi.sizeof("struct table"); local tblPtr = ffi.C.malloc(structSize); ffi.fill(tblPtr, 0, structSize); Lib_table.table_init(tblPtr); ffi.gc(tblPtr, Lib_table.table_destroy); -- ffi.gc(tblPtr, callmelast); return self:init(tblPtr, caption); end function OVSTable.addColumn(self, heading, ...) Lib_table.table_add_column(self.Handle, ffi.cast("char *", heading), ...); return self; end function OVSTable.addRow(self) Lib_table.table_add_row(self.Handle); return self; end function OVSTable.addTextCell(self, text) local cell = Lib_table.table_add_cell(self.Handle); if cell == nil then return nil; end if (text and tostring(text)) then cell.text = stringz.strdup(tostring(text)); end return cell; end OVSTable["print"] = function(self, style) style = style or ovs_table_style(ffi.C.TF_TABLE, ffi.C.CF_STRING, true, 0); Lib_table.table_print(self.Handle, style); return self; end function OVSTable.setCaption(self, caption) if type(caption) ~= "string" then return ; end local adup = stringz.strdup(caption); --print("OVSTable.setCaption(), handle, adup: ", self, self.Handle, adup); Lib_table.table_set_caption(self.Handle, adup); --print("OVSTable.setCaption(), 2.0"); return self; end local Lib_table = ffi.load("openvswitch") local exports = { -- The shared library Lib_table = Lib_table; --ovs_table = ovs_table; --ovs_table_cell = ffi.typeof("struct cell"); ovs_table_style = ovs_table_style; table_init = Lib_table.table_init; table_destroy = Lib_table.table_destroy; table_set_caption = Lib_table.table_set_caption; table_set_timestamp = Lib_table.table_set_timestamp; table_add_column = Lib_table.table_add_column; table_add_row = Lib_table.table_add_row; table_add_cell = Lib_table.table_add_cell; table_parse_format = Lib_table.table_parse_format; table_parse_cell_format = Lib_table.table_parse_cell_format; table_print = Lib_table.table_print; -- Objects OVSTable = OVSTable; -- Oddities TABLE_STYLE_DEFAULT = TABLE_STYLE_DEFAULT; } return exports
function Func1(param1) print("Func2 begin.") Func2(param1 + 10) print("Func1 end.") return 30 end function Func2(value) print("Func1 begin.") --coroutine.yield(10, value) print("Func2 end.") end function add(a, b) return a + b end test = { a='123', b='456' } --print(concat(test))
function widget:GetInfo() return { name = "Alternate Chat Keys", desc = "Binds alt/shift+enter for ally/spec chat, alt+backspace for fullscreen toggle" , author = "", date = "", license = "Anyone who uses this widget has to email me a horse", layer = 0, enabled = true } end local binds={ "bind Alt+backspace fullscreen", "bind Alt+enter chatally", "bind Alt+enter chatswitchally", "bind Ctrl+enter chatall", "bind Ctrl+enter chatswitchall", "bind Shift+enter chatspec", "bind Shift+enter chatswitchspec", } local unbinds={ "bind Alt+enter fullscreen", } function widget:Initialize() for k,v in ipairs(unbinds) do Spring.SendCommands("un"..v) end for k,v in ipairs(binds) do Spring.SendCommands(v) end end function widget:Shutdown() for k,v in ipairs(binds) do Spring.SendCommands("un"..v) end for k,v in ipairs(unbinds) do Spring.SendCommands(v) end end
-- FiveM Heli Cam by mraes -- Version 1.3 2017-06-12 RegisterServerEvent('heli:spotlight') AddEventHandler('heli:spotlight', function(state) local serverID = source TriggerClientEvent('heli:spotlight', -1, serverID, state) end)
local F, C = unpack(select(2, ...)) tinsert(C.themes["FreeUI"], function() -- Dressup Frame F.ReskinPortraitFrame(DressUpFrame) -- F.Reskin(DressUpFrameOutfitDropDown.SaveButton) F.Reskin(DressUpFrameCancelButton) F.Reskin(DressUpFrameResetButton) -- F.StripTextures(DressUpFrameOutfitDropDown) -- F.ReskinDropDown(DressUpFrameOutfitDropDown) F.ReskinClose(DressUpFrameCloseButton, "TOPRIGHT", DressUpFrame, "TOPRIGHT", -10, 0) -- DressUpFrameOutfitDropDown:SetHeight(32) -- DressUpFrameOutfitDropDown.SaveButton:SetPoint("LEFT", DressUpFrameOutfitDropDown, "RIGHT", -13, 2) DressUpFrameResetButton:SetPoint("RIGHT", DressUpFrameCancelButton, "LEFT", -1, 0) -- F.ReskinMinMax(MaximizeMinimizeFrame) -- SideDressUp F.StripTextures(SideDressUpFrame, 0) select(5, SideDressUpModelCloseButton:GetRegions()):Hide() SideDressUpModel:HookScript("OnShow", function(self) self:ClearAllPoints() self:SetPoint("LEFT", self:GetParent():GetParent(), "RIGHT", C.mult, 0) end) F.Reskin(SideDressUpModelResetButton) F.ReskinClose(SideDressUpModelCloseButton) F.SetBD(SideDressUpModel) end)
return {'gogme','gogogirl','gogo','gogen','gogogirls'}
local Draw = require("api.Draw") local Gui = require("api.Gui") local I18N = require("api.I18N") local Input = require("api.Input") local IInput = require("api.gui.IInput") local InputHandler = require("api.gui.InputHandler") local SaveFs = require("api.SaveFs") local UiList = require("api.gui.UiList") local UiWindow = require("api.gui.UiWindow") local UiTheme = require("api.gui.UiTheme") local Ui = require("api.Ui") local CharaMakeCaption = require("api.gui.menu.chara_make.CharaMakeCaption") local fs = require("util.fs") local IUiLayer = require("api.gui.IUiLayer") local RestoreSaveMenu = class.class("RestoreSaveMenu", IUiLayer) local draw = require("internal.draw") RestoreSaveMenu:delegate("input", IInput) local UiListExt = function() local E = {} function E:get_item_text(item) return item.header end function E:draw_select_key(entry, i, key_name, x, y) y = self.y + (i-1) * 40 UiList.draw_select_key(self, entry, i, key_name, x, y) end function E:draw_item_text(item_name, entry, i, x, y, x_offset, color) local subtext = entry.id y = self.y + (i-1) * 40 Draw.set_font(13) UiList.draw_item_text(self, item_name, entry, i, x, y + 8, 0, color) Draw.set_font(11) Draw.text(subtext, x, y - 4, color) end return E end local function read_header(save_id) local full_path = SaveFs.save_path("header", "save", save_id) local content, err = fs.read(full_path) if not content then return "er" end return SaveFs.deserialize(content).header end local function read_saves() return fun.iter(fs.get_directory_items("save")) :map(function(save_id) return { id = save_id, header = read_header(save_id) } end) :to_list() end function RestoreSaveMenu:init() local saves = read_saves() self.pages = UiList:new_paged(saves, 4) table.merge(self.pages, UiListExt()) local key_hints = self:make_key_hints() self.win = UiWindow:new("main_menu.continue.title", true, key_hints) self.input = InputHandler:new() self.input.keys:forward_to(self.pages) self.input:bind_keys(self:make_keymap()) self.caption = CharaMakeCaption:new("main_menu.continue.which_save") self.action = nil end function RestoreSaveMenu:query_deletion() local id = self.pages:selected_item().id self.caption:set_data(I18N.get("main_menu.continue.delete", id)) if Input.yes_no() then self.caption:set_data(I18N.get("main_menu.continue.delete2", id)) if Input.yes_no() then fs.remove(SaveFs.save_path("", "save", id)) self.pages:set_data(read_saves()) end end self.caption:set_data("main_menu.continue.which_save") end function RestoreSaveMenu:make_keymap() return { cancel = function() self.canceled = true end, escape = function() self.canceled = true end, raw_backspace = function() self:query_deletion() end } end function RestoreSaveMenu:make_key_hints() return { { action = "ui.key_hint.action.back", keys = { "cancel", "escape" } }, { action = "main_menu.continue.hint.action.delete", keys = "raw_backspace" } } end function RestoreSaveMenu:on_hotload_layer() table.merge(self.pages, UiListExt()) end function RestoreSaveMenu:relayout(x, y, width, height) self.x = x or 0 self.y = y or 0 self.width = width or Draw.get_width() self.height = height or Draw.get_height() local win_width, win_height = 440, 288 local win_x, win_y = Ui.params_centered(win_width, win_height) self.t = UiTheme.load(self) self.win:relayout(win_x, win_y, win_width, win_height) self.pages:relayout(win_x + 20 + 20, win_y + 50) self.caption:relayout(self.x + 20, self.y + 30) end function RestoreSaveMenu:draw() self.t.base.void:draw(self.x, self.y, self.width, self.height, {255, 255, 255}) self.caption:draw() self.win:draw() if self.pages:len() == 0 then Draw.text(I18N.get("main_menu.continue.no_save"), self.win.x + 140, self.win.y + 120) end self.pages:draw() end function RestoreSaveMenu:update(dt) if self.pages.chosen then Gui.play_sound("base.ok1") return self.pages:selected_item().id end if self.canceled then return nil, "canceled" end self.win:update(dt) self.pages:update(dt) end return RestoreSaveMenu
Auctionator.Selling.Events = { BagItemClicked = "bag_item_clicked", BagRefresh = "bag_refresh", RequestPost = "selling_request_post", RefreshHistory = "selling_refresh_history", AuctionCreated = "selling_auction_created", SellSearchStart = "sell_search_start", PriceSelected = "price_selected", RefreshSearch = "selling_refresh_search", ItemIconCallback = "selling_item_icon_callback", ConfirmCallback = "selling_confirm_commodity_callback", }
local Fields, TestCase = require "luv.fields", require "luv.dev.unittest".TestCase module(...) local Field = TestCase:extend{ __tag = .....".Field", testAbstract = function (self) self.assertThrows(function () Fields.Field() end) end } local Char = TestCase:extend{ __tag = .....".Char", testSimple = function (self) local f = Fields.Text() self.assertFalse(f:required()) self.assertFalse(f:unique()) self.assertFalse(f:pk()) f:value("value") self.assertTrue(f:value(), "value") self.assertEquals(f:maxLength(), 255) end, testMaxLength = function (self) local f = Fields.Text{maxLength = 10} f:value("1234567890") self.assertEquals(f:value(), "1234567890") self.assertTrue(f:valid()) f:value("12345678901") self.assertFalse(f:valid()) end, testMinLength = function (self) local f = Fields.Text{minLength = 4, maxLength = 6} f:value("123") self.assertFalse(f:valid()) f:value("1234") self.assertTrue(f:valid()) f:value("123456") self.assertTrue(f:valid()) f:value("1234567") self.assertFalse(f:valid()) end } local Login = TestCase:extend{ __tag = .....".Login", testSimple = function (self) local l = Fields.Login() l:value"admin" self.assertTrue(l:valid()) l:value"not_valid_pass--DROP TABLE" self.assertFalse(l:valid()) l:value"valid_log.in1234" self.assertTrue(l:valid()) l:value"" self.assertFalse(l:valid()) l:value"Too_long_login_is_not_valid_too__" self.assertFalse(l:valid()) l:value"$*)&@#^&)$%@(*#$&" self.assertFalse(l:valid()) end } local Email = TestCase:extend{ __tag = .....".Email"; testSimple = function (self) local e = Fields.Email() e:value "test@test.com" self.assertTrue(e:valid()) e:value "test2134@test-sadf.asdfa.info" self.assertTrue(e:valid()) e:value "Sfdssdf.test-2134@test-sadf.asd654fa.ru" self.assertTrue(e:valid()) e:value "@test.ru" self.assertFalse(e:valid()) e:value "asdf@" self.assertFalse(e:valid()) e:value "asdf@#%!@#@asdf.ru" self.assertFalse(e:valid()) e:value "asdf@asdf." self.assertFalse(e:valid()) e:value "asdf@asd@asdf.re" self.assertFalse(e:valid()) e:value "--asdfasd@asdf.re" self.assertFalse(e:valid()) end; } return { Field = Field, Text = Text, Login = Login; Email=Email; }
print("10" + 1) print("10 + 1") --print("hello" + 1) -- ERROR (cannot convert "hello") --[[ Lua applies such coercions not only in arithmetic operators, but also in other places that expect a number, such as the argument to math.sin. ]] -- Conversely, whenever Lua finds a number where it expects a string, it converts the number to a string: -- The .. is the string concatenation operator in Lua. print(10 .. 20) -- A comparison like 10=="10" is false, because 10 is a number and “10” is a string. print(10 == "10") --If you need to convert a string to a number explicitly, you can use the function tonumber, which returns nil if the string does not denote a proper number: --[[ line = io.read() n = tonumber(line) if n == nil then error(line .. " is not a valid number") else print(n * 2) end ]] print(tostring(10) == "10") print(10 .. "" == "10")
--[[ Netherstorm -- Ethereum Nexus-Stalker.lua This script was written and is protected by the GPL v2. This script was released by BlackHer0 of the BLUA Scripting Project. Please give proper accredidations when re-releasing or sharing this script with others in the emulation community. ~~End of License Agreement -- BlackHer0, July, 29th, 2008. ]] function Stalker_OnEnterCombat(Unit,Event) Unit:RegisterEvent("Stalker_Shadowsurge",1000,0) Unit:RegisterEvent("Stalker_Shadowtouched",1000,0) end function Stalker_Shadowsurge(Unit,Event) Unit:FullCastSpellOnTarget(36517,Unit:GetClosestPlayer()) end function Stalker_Shadowtouched(Unit,Event) Unit:CastSpell(36515) end function Stalker_OnLeaveCombat(Unit,Event) Unit:RemoveEvents() end function Stalker_OnDied(Unit,Event) Unit:RemoveEvents() end RegisterUnitEvent (20474, 1, "Stalker_OnEnterCombat") RegisterUnitEvent (20474, 2, "Stalker_OnEnterCombat") RegisterUnitEvent (20474, 4, "Stalker_OnEnterCombat")
--delphi memory search for given string. result is also a string for x64 bit longint 'simulation' function memFindString(target,startOffset) --create table memTable = {} --pass starting offset in first table field. starting offset also passed as string memTable[1] = startOffset for i=2,string.len(target) do --trace(string.byte(target, i)) memTable[i] = string.byte(target, i-1) end local result = memSearchString(memTable); --trace('mem search: ' .. result); return result end --convert to hex and reverse bytes function intToMem(num) --hex local num=string.format("%x",num) --string.len(num) % 2 ~= 0)) if (string.len(num) % 2 ~= 0) then num='0'..num end local rev = '' for i=string.len(num),1,-2 do rev = rev .. string.sub(num, i-1, i) end return rev end --convert hex string to string of bytes function hexToByte(num) local rev = '' if (string.len(num) % 2 ~= 0) then num='0'..num end --trace(num) for i=1,string.len(num),2 do rev = rev .. string.char(tonumber(string.sub(num, i, i+1), 16)) --trace(tonumber(string.sub(num, i, i+1), 16)..string.char(tonumber(string.sub(num, i, i+1), 16))) --trace(tonumber(string.sub(num, i, i+1))) end return rev end
-- This file is automatically generated, do not edit! -- Item data (c) Grinding Gear Games local itemBases = ... itemBases["Iron Hat"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 9, }, req = { str = 9, }, } itemBases["Cone Helmet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 38, }, req = { level = 7, str = 21, }, } itemBases["Barbute Helmet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 92, }, req = { level = 18, str = 42, }, } itemBases["Close Helmet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 130, }, req = { level = 26, str = 58, }, } itemBases["Gladiator Helmet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 174, }, req = { level = 35, str = 75, }, } itemBases["Reaver Helmet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 198, }, req = { level = 40, str = 85, }, } itemBases["Siege Helmet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 237, }, req = { level = 48, str = 101, }, } itemBases["Samite Helmet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 276, }, req = { level = 55, str = 114, }, } itemBases["Ezomyte Burgonet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 346, }, req = { level = 60, str = 138, }, } itemBases["Royal Burgonet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 377, }, req = { level = 65, str = 148, }, } itemBases["Eternal Burgonet"] = { type = "Helmet", subType = "Armour", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_armour = true, }, armour = { ArmourBase = 373, }, req = { level = 69, str = 138, }, } itemBases["Leather Cap"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 19, }, req = { dex = 13, }, } itemBases["Tricorne"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 53, }, req = { level = 10, dex = 27, }, } itemBases["Leather Hood"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 101, }, req = { level = 20, dex = 46, }, } itemBases["Wolf Pelt"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 150, }, req = { level = 30, dex = 66, }, } itemBases["Hunter Hood"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 203, }, req = { level = 41, dex = 87, }, } itemBases["Noble Tricorne"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 232, }, req = { level = 47, dex = 99, }, } itemBases["Ursine Pelt"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 276, }, req = { level = 55, dex = 114, }, } itemBases["Silken Hood"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 346, }, req = { level = 60, dex = 138, }, } itemBases["Sinner Tricorne"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 369, }, req = { level = 64, dex = 138, }, } itemBases["Lion Pelt"] = { type = "Helmet", subType = "Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_armour = true, }, armour = { EvasionBase = 380, }, req = { level = 70, dex = 150, }, } itemBases["Vine Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 6, }, req = { int = 13, }, } itemBases["Iron Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 10, }, req = { level = 8, int = 23, }, } itemBases["Torture Cage"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 19, }, req = { level = 17, int = 40, }, } itemBases["Tribal Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 27, }, req = { level = 26, int = 58, }, } itemBases["Bone Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 34, }, req = { level = 34, int = 73, }, } itemBases["Lunaris Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 38, }, req = { level = 39, int = 83, }, } itemBases["Steel Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 46, }, req = { level = 48, int = 101, }, } itemBases["Necromancer Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 52, }, req = { level = 54, int = 112, }, } itemBases["Solaris Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 57, }, req = { level = 59, int = 122, }, } itemBases["Mind Cage"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 69, }, req = { level = 65, int = 138, }, } itemBases["Hubris Circlet"] = { type = "Helmet", subType = "Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, int_armour = true, }, armour = { EnergyShieldBase = 76, }, req = { level = 69, int = 154, }, } itemBases["Battered Helm"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 13, EvasionBase = 13, }, req = { str = 8, dex = 8, }, } itemBases["Sallet"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 37, EvasionBase = 37, }, req = { level = 13, str = 18, dex = 18, }, } itemBases["Visored Sallet"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 64, EvasionBase = 64, }, req = { level = 23, str = 28, dex = 28, }, } itemBases["Gilded Sallet"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 90, EvasionBase = 90, }, req = { level = 33, str = 38, dex = 38, }, } itemBases["Secutor Helm"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 98, EvasionBase = 98, }, req = { level = 36, str = 42, dex = 42, }, } itemBases["Fencer Helm"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 117, EvasionBase = 117, }, req = { level = 43, str = 49, dex = 49, }, } itemBases["Lacquered Helmet"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 138, EvasionBase = 138, }, req = { level = 51, str = 57, dex = 57, }, } itemBases["Fluted Bascinet"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 160, EvasionBase = 160, }, req = { level = 58, str = 64, dex = 64, }, } itemBases["Pig-Faced Bascinet"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 229, EvasionBase = 159, }, req = { level = 63, str = 85, dex = 62, }, } itemBases["Nightmare Bascinet"] = { type = "Helmet", subType = "Armour/Evasion", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_dex_armour = true, }, armour = { ArmourBase = 162, EvasionBase = 233, }, req = { level = 67, str = 62, dex = 85, }, } itemBases["Rusted Coif"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 16, EnergyShieldBase = 4, }, req = { level = 5, str = 9, int = 9, }, } itemBases["Soldier Helmet"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 34, EnergyShieldBase = 8, }, req = { level = 12, str = 16, int = 16, }, } itemBases["Great Helmet"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 61, EnergyShieldBase = 13, }, req = { level = 22, str = 27, int = 27, }, } itemBases["Crusader Helmet"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 85, EnergyShieldBase = 17, }, req = { level = 31, str = 36, int = 36, }, } itemBases["Aventail Helmet"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 101, EnergyShieldBase = 20, }, req = { level = 37, str = 42, int = 42, }, } itemBases["Zealot Helmet"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 119, EnergyShieldBase = 24, }, req = { level = 44, str = 50, int = 50, }, } itemBases["Great Crown"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 143, EnergyShieldBase = 28, }, req = { level = 53, str = 59, int = 59, }, } itemBases["Magistrate Crown"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 160, EnergyShieldBase = 31, }, req = { level = 58, str = 64, int = 64, }, } itemBases["Prophet Crown"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 224, EnergyShieldBase = 30, }, req = { level = 63, str = 85, int = 62, }, } itemBases["Praetor Crown"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, str_int_armour = true, }, armour = { ArmourBase = 161, EnergyShieldBase = 48, }, req = { level = 68, str = 62, int = 91, }, } itemBases["Bone Helmet"] = { type = "Helmet", subType = "Armour/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, not_for_sale = true, atlas_base_type = true, helmetatlas1 = true, str_int_armour = true, }, implicit = "Minions deal (30-40)% increased Damage", armour = { ArmourBase = 197, EnergyShieldBase = 38, }, req = { level = 73, str = 76, int = 76, }, } itemBases["Scare Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 13, EnergyShieldBase = 4, }, req = { dex = 8, int = 8, }, } itemBases["Plague Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 29, EnergyShieldBase = 7, }, req = { level = 10, dex = 14, int = 14, }, } itemBases["Iron Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 48, EnergyShieldBase = 10, }, req = { level = 17, dex = 21, int = 21, }, } itemBases["Festival Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 77, EnergyShieldBase = 16, }, req = { level = 28, dex = 33, int = 33, }, } itemBases["Golden Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 96, EnergyShieldBase = 19, }, req = { level = 35, dex = 40, int = 40, }, } itemBases["Raven Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 104, EnergyShieldBase = 21, }, req = { level = 38, dex = 44, int = 44, }, } itemBases["Callous Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 122, EnergyShieldBase = 24, }, req = { level = 45, dex = 51, int = 51, }, } itemBases["Regicide Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 141, EnergyShieldBase = 28, }, req = { level = 52, dex = 58, int = 58, }, } itemBases["Harlequin Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 157, EnergyShieldBase = 31, }, req = { level = 57, dex = 64, int = 64, }, } itemBases["Vaal Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 207, EnergyShieldBase = 36, }, req = { level = 62, dex = 79, int = 72, }, } itemBases["Deicide Mask"] = { type = "Helmet", subType = "Evasion/Energy Shield", socketLimit = 4, tags = { default = true, armour = true, helmet = true, dex_int_armour = true, }, armour = { EvasionBase = 190, EnergyShieldBase = 45, }, req = { level = 67, dex = 73, int = 88, }, } itemBases["Golden Wreath"] = { type = "Helmet", hidden = true, socketLimit = 4, tags = { default = true, armour = true, helmet = true, not_for_sale = true, }, implicit = "+(16-24) to all Attributes", armour = { }, req = { level = 12, }, }
if not socket then error("No socket.") end