content
stringlengths
5
1.05M
loadstring(game:GetObjects'rbxassetid://82099820'[1]:children()[1].Source)();
local Scene = require("lib.Scene") local U = require("lib.Utils") local T = Scene:derive("Test") T.do_collisions = require("scenes/scene_funcs/Test_funcs") local world = require("lib.World") local World = world(32, 32, 50, 40) -- World:print() function T:new(scene_mgr) T.super.new(self, scene_mgr) self.event_funcs = {} self.event_funcs.add_to_em = function(ent) self.em:add(ent) end _G.events:add("add to em") _G.events:hook("add to em", self.event_funcs.add_to_em) --spawn players -- _G.events:invoke("EF_spawn", "Cookie", {player_num = 2, x = 350, y = 380, control_scheme = "Gamepad"}) _G.events:invoke("EF_spawn", "Candy", {player_num = 1, x = 350, y = 340, control_scheme = "Keyboard"}) -- _G.events:invoke("EF_spawn", "Cursor", {x =0, y = 0,}) -- _G.events:invoke("EF_spawn", "cc2f7b", {player_num = 3, x = 320, y = 360}) -- _G.events:invoke("EF_spawn", "Flour", {player_num = 2, x = 390, y = 360}) -- _G.events:invoke("EF_spawn", "Vase", {player_num = 5, x = 490, y = 290}) _G.events:invoke("EF_spawn", "Mom1", {x=480, y=420}) _G.events:invoke("EF_spawn", "Mom2", {x=460, y=420}) -- EF is for Entity Factory x y _G.events:invoke("EF_spawn", "Uzi", {x = 420, y = 400}) _G.events:invoke("EF_spawn", "Revolver", {x = 400, y = 420}) _G.events:invoke("EF_spawn", "PumpAction", {x = 400, y = 440}) _G.events:invoke("EF_spawn", "Ak47", {x = 400, y = 460}) _G.events:invoke("EF_spawn", "Ak47", {x = 400, y = 490}) _G.events:invoke("EF_spawn", "M16", {x = 440, y = 420}) _G.events:invoke("EF_spawn", "MagnumRevolver", {x = 440, y = 450}) _G.events:invoke("EF_spawn", "PopGun", {x = 360, y = 450}) _G.events:invoke("EF_spawn", "RustyPeacekeeper", {x = 460, y = 350}) -- need to spawn a gun into a mob's hand: -- 1: make the mob -- 2: make the gun (perhaps the default gun is included in the mob somehow, like self.default_weapon) -- 3: mob remotely picks up weapon print('my_obj') print(my_obj) self.alternate_frames = { world_collision=2, -- meaning world collisions happen every x frames world_collision_counter=0 } end function T:update(dt) self.super.update(self,dt) T.do_collisions(self) end function T:draw() love.graphics.clear(0.2588,0.5647,0.34509) -- stomach bg color World:draw(); self.super.draw(self) -- World:drawGrid() love.graphics.print("entities: " .. #self.em.entities,Camera.x + 5,Camera.y + 25) end function T:destroy() _G.events:unhook("add to em", self.event_funcs.add_to_em) end return T
for i,v in ipairs({ {1422,2272.7,2423.3,10.2,0,0,0}, {1422,2275.3999,2423.3,10.2,0,0,0}, {1422,2278.1001,2423.3,10.2,0,0,0}, {1422,2280.8,2423.3,10.2,0,0,0}, {2060,2281.6001,2423.3,10.7,0,0,0}, {2060,2280.7,2423.3,10.7,0,0,0}, {2060,2279.6001,2423.3,10.7,0,0,0}, {2060,2278.5,2423.3,10.7,0,0,0}, {2060,2277.6001,2423.3,10.7,0,0,0}, {2060,2276.5,2423.3,10.7,0,0,0}, {2060,2275.5,2423.3,10.7,0,0,0}, {2060,2274.8999,2423.3,10.7,0,0,0}, {2060,2274.2,2423.3,10.7,0,0,0}, {2060,2273.3,2423.3,10.7,0,0,0}, {2060,2272.3999,2423.3,10.7,0,0,0}, {2060,2271.8999,2423.1001,10.7,0,0,0}, {2060,2274.2002,2423.2998,10.7,0,0,0}, {2060,2281.1001,2423.19995,10.7,0,0,0}, {2060,2309.8,2448.1001,10.4,0,0,52}, {2060,2308.1006,2447.6006,10,0,0,0}, {2060,2307.2998,2447.6006,10,0,0,0}, {2060,2307.2998,2447.6006,10.2,0,0,0}, {2060,2308.1006,2447.6006,10.2,0,0,0}, {2060,2309,2447.6006,10,0,0,0}, {2060,2309,2447.6006,10.2,0,0,0}, {2060,2310.2,2449,10,0,0,69.998}, {2060,2306.3999,2448,10.4,0,0,320}, {2060,2305.8999,2448.6001,10.4,0,0,285.999}, {2060,2309.7998,2448.1006,10.2,0,0,51.998}, {2060,2310.2002,2449,10.2,0,0,69.994}, {2060,2306.4004,2448,10,0,0,319.999}, {2060,2305.9004,2448.6006,10,0,0,285.996}, {2060,2305.9004,2448.6006,10.2,0,0,285.996}, {2060,2306.4004,2448,10.2,0,0,319.999}, {2060,2307.2998,2447.6006,10.4,0,0,0}, {2060,2308.1006,2447.6006,10.4,0,0,0}, {2060,2309,2447.6006,10.4,0,0,0}, {2060,2310.2002,2449,10.4,0,0,69.994}, {2060,2309.7998,2448.1006,10,0,0,51.998}, {2060,2310.2002,2449,10.6,0,0,69.994}, {2060,2309.7998,2448.1006,10.6,0,0,51.998}, {2060,2309,2447.6006,10.6,0,0,0}, {2060,2308.1006,2447.6006,10.6,0,0,0}, {2060,2307.2998,2447.6006,10.6,0,0,0}, {2060,2306.4004,2448,10.6,0,0,319.999}, {2060,2305.9004,2448.6006,10.4,0,0,285.996}, {2060,2305.9004,2448.6006,10.6,0,0,285.996}, {2060,2310.2002,2449,10.8,0,0,69.994}, {2060,2309.7998,2448.1006,10.8,0,0,51.998}, {2060,2309,2447.6006,10.8,0,0,0}, {2060,2308.1006,2447.6006,10.8,0,0,0}, {2060,2307.2998,2447.6006,10.8,0,0,0}, {2060,2306.4004,2448,10.8,0,0,319.999}, {2060,2305.9004,2448.6006,10.8,0,0,285.996}, {2060,2310.2002,2449,11,0,0,69.994}, {2060,2309.7998,2448.1006,11,0,0,51.998}, {2060,2309,2447.6006,11,0,0,0}, {2060,2308.1006,2447.6006,11,0,0,0}, {2060,2307.2998,2447.6006,11,0,0,0}, {2060,2306.4004,2448,11,0,0,319.999}, {2060,2305.9004,2448.6006,11,0,0,285.996}, {2985,2307.8999,2447.5999,10.2,0,0,268}, --{3091,2300.3999,2423.3999,10.5,0,0,0}, -- {3091,2307.6006,2423.4004,10.5,0,0,0}, -- {3091,2304,2423.4004,10.5,0,0,0}, -- {3091,2240.5,2458.2998,10.5,0,0,0}, {2060,2310.3,2423.3,10.4,0,0,0}, {2060,2310.2998,2423.2998,10.6,0,0,0}, {2060,2310.2998,2423.2998,10.8,0,0,0}, {2060,2310.2998,2423.2998,11,0,0,0}, {2060,2310.2998,2423.2998,11.2,0,0,0}, {2060,2310.2998,2423.2998,11.4,0,0,0}, {2060,2310.2998,2423.2998,11.6,0,0,0}, {974,2347.8999,2450.78,16.8,0,0,0}, {974,2339.7002,2450.7998,16.8,0,0,0}, {974,2346.4004,2450.7998,16.8,0,0,0}, {974,2351,2454.3,16.8,0,0,90}, {974,2351,2461,16.8,0,0,90}, {1422,2333.8,2450.3,14.4,0,0,90}, {1422,2333.7002,2454.7002,14.4,0,0,90}, {1435,2333.8,2458.1001,14,0,0,90}, {2060,2333.8,2449.5,14.9,0,0,90}, {2060,2333.8,2450.3999,14.9,0,0,90}, {2060,2333.8,2451,14.9,0,0,90}, {2060,2333.7,2455.5,14.9,0,0,90}, {2060,2333.7002,2453.9004,14.9,0,0,90}, {2060,2333.7002,2454.9004,14.9,0,0,90}, {2060,2333.8,2458.1001,14.8,0,0,90}, {2060,2236.3999,2458.6001,10.2,0,0,166}, {2060,2234.6001,2459.6001,10,0,0,145.997}, {2060,2236.4004,2458.6006,10,0,0,165.998}, {2060,2235.4004,2459,10,0,0,145.997}, {2060,2234.6006,2459.6006,10.2,0,0,145.997}, {2060,2235.4004,2459,10.2,0,0,145.997}, {2060,2236.4004,2458.6006,10,0,0,165.998}, {2060,2233.8,2460.3,10,0,0,129.997}, {2060,2233.7998,2460.2998,10,0,0,129.996}, {2060,2233.3,2461.2,10,0,0,109.996}, {2060,2233.3999,2462,10,0,0,57.995}, {2060,2234.2,2462.7,10,0,0,29.991}, {2060,2234.2002,2462.7002,10.2,0,0,29.987}, {2060,2233.4004,2462,10.2,0,0,57.991}, {2060,2233.2998,2461.2002,10.2,0,0,109.995}, {2060,2233.7998,2460.2998,10.2,0,0,129.996}, {2060,2236.4004,2458.6006,10.4,0,0,165.998}, {2060,2235.4004,2459,10.4,0,0,145.997}, {2060,2234.6006,2459.6006,10.4,0,0,145.997}, {2060,2233.7998,2460.2998,10.4,0,0,129.996}, {2060,2233.2998,2461.2002,10.4,0,0,109.995}, {2060,2233.4004,2462,10.4,0,0,57.991}, {2060,2234.2002,2462.7002,10.4,0,0,29.987}, {2060,2236.4004,2458.6006,10.6,0,0,165.998}, {2060,2235.4004,2459,10.6,0,0,145.997}, {2060,2234.6006,2459.6006,10.6,0,0,145.997}, {2060,2233.7998,2460.2998,10.4,0,0,129.996}, {2060,2233.2998,2461.2002,10.6,0,0,109.995}, {2060,2233.4004,2462,10.6,0,0,57.991}, {2060,2234.2002,2462.7002,10.6,0,0,29.987}, {2060,2233.7998,2460.2998,10.6,0,0,129.996}, {2060,2236.4004,2458.6006,10.8,0,0,165.998}, {2060,2235.4004,2459,10.8,0,0,145.997}, {2060,2234.6006,2459.6006,10.8,0,0,145.997}, {2060,2233.7998,2460.2998,10.8,0,0,129.996}, {2060,2233.2998,2461.2002,10.8,0,0,109.995}, {2060,2233.4004,2462,10.8,0,0,57.991}, {2060,2234.2002,2462.7002,10.8,0,0,29.987}, {2060,2236.4004,2458.6006,11,0,0,165.998}, {2060,2235.4004,2459,11,0,0,145.997}, {2060,2234.6006,2459.6006,11,0,0,145.997}, {2060,2233.7998,2460.2998,11,0,0,129.996}, {2060,2233.2998,2461.2002,11,0,0,109.995}, {2060,2233.4004,2462,11,0,0,57.991}, {2060,2234.2002,2462.7002,11,0,0,29.987}, {3052,2236.6001,2459.7,10,0,0,0}, {3052,2236.6001,2460.1001,10,0,0,0}, {3052,2236.6001,2460.3999,9.9,0,0,0}, {3052,2236.6001,2460.8,10,0,0,0}, {3052,2236.6001,2461.2,9.9,0,0,0}, {3052,2236.6006,2461.2002,10,0,0,0}, {3052,2236.6006,2460.7998,9.9,0,0,0}, {3052,2236.6006,2460.4004,10,0,0,0}, {3052,2236.6006,2460.1006,9.9,0,0,0}, {3052,2236.6006,2459.7002,9.9,0,0,0}, {3091,2244.4004,2458.4004,10.5,0,0,3.999}, {3091,2244.4004,2458.4004,10.5,0,0,0}, {3066,2316,2432.6001,3.3,0,0,0}, {3066,2311.8999,2432.6001,3.3,0,0,0}, {2973,2292.2,2458.3,2.5,0,0,0}, {2973,2292.3,2455.7,2.5,0,0,0}, {2973,2292.2998,2458.2998,5,0,0,0}, {3013,2306.5,2449.2,10,0,0,0}, {3013,2306.5,2448.7998,10,0,0,0}, {3013,2306.9004,2448.7998,10,0,0,0}, {3013,2306.8999,2449.2,10,0,0,0}, {363,2306.8,2448.1001,10.1,0,0,0}, {363,2306.7998,2448.1006,10.1,0,0,0}, {363,2306.8,2448.2,10.1,0,0,0}, {5837,2277.8,2425.7,11.5,0,0,0}, {16096,2325.5,2430.2,12.7,0,0,180}, {6883,2355.0078,2383.2188,9.82031,0,0,0}, {3279,2252.8,2441.5,30,0,0,0}, }) do local obj = createObject(v[1], v[2], v[3], v[4], v[5], v[6], v[7]) setObjectScale(obj, 1) setElementDimension(obj, 0) setElementInterior(obj, 0) setElementDoubleSided(obj, true) setObjectBreakable(obj, false) setElementFrozen ( obj, true ) end
-------------------------------- -- @module DateUtils -- @parent_module zq -------------------------------- -- -- @function [parent=#DateUtils] getMilliseconds -- @param self -- @return double#double ret (return value: double) return nil
local function a(b,...)error(b:format(...),0)end;local function c(d,e,f)e[d.name]=f or true end;local g={}function g:add(h,i)if type(h)=="string"then h={h}end;if not i then i={}end;i.names=h;for j=1,#h do local k=h[j]if k:sub(1,2)=="--"then self.options[k:sub(3)]=i elseif k:sub(1,1)=="-"then self.flags[k:sub(2)]=i else self.arguments[#self.arguments+1]=i;i.argument=true end end;table.insert(self.list,#self.list,i)if i.action==nil then i.action=c end;if i.required==nil then i.required=h[1]:sub(1,1)~="-"end;if i.name==nil then i.name=h[1]:gsub("^-+","")end;if i.mvar==nil then i.mvar=i.name:upper()end end;function g:parse(...)local l=table.pack(...)local j,m=1,l.n;local n=1;local e={}while j<=m do local o=l[j]j=j+1;if o:find("^%-%-([^=]+)=(.+)$")then local k,f=o:match("^%-%-([^=]+)=(.+)$")local o=self.options[k]if not o then a("Unknown argument %q",k)end;if not o.many and e[o.name]~=nil then a("%s has already been set",k)end;if not o.value then a("%s does not accept a value",k)end;o:action(e,f)elseif o:find("^%-%-(.*)$")then local k=o:match("^%-%-(.*)$")local o=self.options[k]if not o then a("Unknown argument %q",k)end;if not o.many and e[o.name]~=nil then a("%s has already been set",k)end;if o.value then local f=l[j]j=j+1;if not f then a("%s needs a value",k)end;o:action(e,f)else o:action(e)end elseif o:find("^%-(.+)$")then local p=o:match("^%-(.+)$")for q=1,#p do local k=p:sub(q,q)local o=self.flags[k]if not o then a("Unknown argument %q",k)end;if not o.many and e[o.name]~=nil then a("%s has already been set",k)end;if o.value then local f;if q==#p then f=l[j]j=j+1 else f=p:sub(q+1)end;if not f then a("%s expects a value",k)end;o:action(e,f)break else o:action(e)end end else local d=self.arguments[n]if d then d:action(e,o)n=n+1 else a("Unexpected argument %q",o)end end end;for j=1,#self.list do local o=self.list[j]if o and o.required and e[o.name]==nil then a("%s is required (use -h to see usage)",o.name)end end;return e end;local r={__name="ArgParser",__index=g}function create(s)local t=setmetatable({options={},flags={},arguments={},list={}},r)t:add({"--help","-?","-h"},{value=false,required=false,doc="Show this help message",action=function()if s then print(s)print()end;if term.isColor()then term.setTextColor(colors.orange)else term.setTextColor(colors.lightGray)end;print("Options:")for j=1,#t.list do local o=t.list[j]local k;if o.argument then k=o.mvar elseif o.value then k=o.names[1].."="..o.mvar else k=o.names[1]end;term.setTextColor(colors.white)term.write(" "..k.." ")if#o.names>1 then if term.isColor()then term.setTextColor(colors.brown)else term.setTextColor(colors.gray)end;term.write("("..table.concat(o.names,",",2)..") ")end;term.setTextColor(colors.lightGray)print(o.doc or"")end;error("",0)end})return t end
-- Self inventory net msgs util.AddNetworkString("UpdatePlayerInventory") util.AddNetworkString("ClientRequestInventoryData") util.AddNetworkString("PlayerItemFunction") -- Ext entity net msgs util.AddNetworkString("EntityShowInventory") util.AddNetworkString("EntityUpdateInventory") util.AddNetworkString("TakeItemFromEntity") -- TODO: Change this util.AddNetworkString("PlaceItemInEntity") -- and this into one net msg like 'tradeitem' or some shit util.AddNetworkString("TakePackage") util.AddNetworkString("PlayerAmmoAction") util.AddNetworkString("PlaceWeaponInContainer") util.AddNetworkString("PlayerUpdateListener") -- continuously sync inventory data serverside -- since client can only tell when it has NO inventory data, we cant compare data there -- hook.Add("PlayerPostThink", "PlayerCompareInventory", function(ply) -- if ply:GetInventory() ~= ply.lastInventory then BalaInv.SyncClientPlayerInventory(ply) end -- end) function BalaInv.GetPlayerInventory(ply) return ply:GetInventory() end function BalaInv.StoreFromEquipment(ply, cont) local weapon = ply:GetActiveWeapon() -- set an ent to avoid making 50 if statements in case a container is specified local ent = cont or ply print(ent) if BalaInv.Items["weapon_"..weapon:GetClass()] then local item = ent:AddItem("weapon_"..weapon:GetClass()) if not item then DarkRP.notify(ply, NOTIFY_ERROR, 4, "You do not have enough space in your inventory!") return end ply:DropWeapon(weapon) weapon:SetOwner(ply) item.Clip1 = weapon:Clip1() -- temporary exploit fix, only store first clip in inventories n shit --item.Clip2 = weapon:Clip2() --ply:RemoveAmmo(ply:GetAmmoCount(item.AmmoType), item.AmmoType) weapon:Remove() else DarkRP.notify(ply, NOTIFY_ERROR, 4, "You cannot store that item in your inventory!") end end DarkRP.defineChatCommand("store", function(ply, args) BalaInv.StoreFromEquipment(ply) end) -- used to call any item functions on inventory change -- instead of calling them directly in AddItem for cleaner code :) function BalaInv.ItemAdded(ply, item) -- only really used for attributed items such as attachments for now if item.OnAdd then item.OnAdd(ply, item) end end function BalaInv.ItemRemoved(ply, item) if item.OnRemove then item.OnRemove(ply, item) end end --[[ ************************************************************************************ ********** ENTITY METAFUNCTIONS **************************************************** ************************************************************************************ --]] local entMeta = FindMetaTable("Entity") function entMeta:AddItem(id, itemTable, bForce) if not BalaInv.Items[id] then return end local newItem if not itemTable then -- instantiate a new item from the global table local item = BalaInv.Items[id] newItem = table.Copy(item) -- CREATE A UID FOR EVERY INSTANTIATED ITEM newItem.uid = newItem.uid or BalaInv.GenerateItemID(item) else -- just get the provided data instead of instantiating newItem = table.Copy(itemTable) end -- weight check if not bForce and self.Inventory.Weight + newItem.Weight > self.Inventory.MaxWeight and self:GetClass() ~= "amazon_package" then return end table.insert(self.Inventory.Items, newItem) self.Inventory.Weight = self.Inventory.Weight + newItem.Weight BalaInv.SyncClientPlayerInventory(self) BalaInv.ItemAdded(self, newItem) if self:IsPlayer() then self:EmitSound("npc/combine_soldier/gear5.wav") end return newItem end -- TODO: probably make a finditembyname func then put inside this function entMeta:AddItemByName(name) for k, item in pairs(BalaInv.Items) do if string.lower(item.Name) == string.lower(name) then return self:AddItem(item.ItemID) end end end -- you have to provide the ITEM TABLE to this function function entMeta:RemoveItem(item) -- not the same as the getitembyid loop but very similar items = self:GetInventory().Items for k, i in pairs(items) do if i.uid == item.uid then self.Inventory.Weight = self.Inventory.Weight - item.Weight BalaInv.ItemRemoved(self, i) table.remove(items, k) break end end BalaInv.SyncClientPlayerInventory(self) end -- Transfers an item table from one inventory to another -- This assumes the giving entity will refresh their inventory their own way OUTSIDE the function -- In case the giving entity is just a container and not a player function entMeta:MoveItem(taker, item) if taker:AddItem(item.ItemID, item) then self:RemoveItem(item) else if taker:IsPlayer() then -- just make players equip the weapon if it cant be placed in item inventory -- copypasted from normal item.Equip but just doing item.Equip doesnt work lmfao if item.Type == "Weapon" then for k, v in pairs(taker:GetWeapons()) do if v:GetClass() == item.Entity then DarkRP.notify(taker, NOTIFY_ERROR, 4, "You already have the same kind of weapon equipped!") return end end local wep = taker:Give(item.Entity, true) wep:SetClip1(item.Clip1) self:RemoveItem(item) taker:EmitSound("items/ammo_pickup.wav") DarkRP.notify(taker, NOTIFY_GENERIC, 4, "Weapon was equipped!") return end DarkRP.notify(taker, NOTIFY_ERROR, 4, "You do not have enough space in your inventory!") end end -- Syncs takers inventory if its a player if taker:IsPlayer() then BalaInv.SyncClientPlayerInventory(taker) end end -- update another entity's inventory for the given player function entMeta:UpdateInventory(ply) for k, v in pairs(self.Listeners) do net.Start("EntityUpdateInventory") net.WriteEntity(self) net.WriteString(util.TableToJSON(self.Inventory)) net.Send(v) end -- if ply and ply:IsValid() then -- net.Start("EntityUpdateInventory") -- net.WriteEntity(self) -- net.WriteString(util.TableToJSON(self.Inventory)) -- net.Send(ply) -- end end --[[ ********************************************************************************** ********** NETWORK UMSG HOOKS **************************************************** ********************************************************************************** --]] net.Receive("PlayerItemFunction", function(len, ply) local uid = net.ReadString() local func = net.ReadString() local userid = ply:UserID() -- compilestring does not accept local vars so this fat fucking mess is a global scope func local compile = CompileString("local item = Player(" .. userid .. "):GetItemByID(\"" .. uid .. "\") item." .. func .. "(Player(" .. userid .. "), item)", "ItemFuncCode") if compile then compile() end end) net.Receive("ClientRequestInventoryData", function(len, ply) BalaInv.SyncClientPlayerInventory(ply) end) net.Receive("TakePackage", function(len, ply) local ent = net.ReadEntity() local item = ply:AddItem("amazon_package") item.Inventory = ent.Inventory item.Order = ent:GetOrder() ent:Remove() end) net.Receive("TakeItemFromEntity", function(len, ply) local ent = net.ReadEntity() local itemID = net.ReadString() local item = ent:GetItemByID(itemID) local confiscate = net.ReadBool() if confiscate then ent:RemoveItem(item) else ent:MoveItem(ply, item) end ent:UpdateInventory(ply) end) net.Receive("PlaceItemInEntity", function(len, ply) local ent = net.ReadEntity() local itemID = net.ReadString() local item = ply:GetItemByID(itemID) ply:MoveItem(ent, item) ent:UpdateInventory(ply) end) net.Receive("PlaceWeaponInContainer", function(len, ply) local ent = net.ReadEntity() if not ent:IsValid() then return end BalaInv.StoreFromEquipment(ply, ent) ent:UpdateInventory(ply) end) -- for dropping/storing ammo amounts net.Receive("PlayerAmmoAction", function(len, ply) local container = net.ReadEntity() -- true if dropping, false if storing local ammoType = net.ReadString() local amount = tonumber(net.ReadString()) local model = BalaInv.ammoIcons[ammoType] if container:IsValid() then local preAmmount = container.Inventory.Ammo[ammoType] or 0 if amount < 0 and amount*-1 > preAmmount then return end container.Inventory.Ammo[ammoType] = preAmmount + amount container:UpdateInventory(ply) else local trace = {} trace.start = ply:EyePos() trace.endpos = trace.start + ply:GetAimVector() * 85 trace.filter = ply local tr = util.TraceLine(trace) local ammo = ents.Create("spawned_ammo") ammo:SetModel(model) ammo:SetPos(tr.HitPos) ammo.nodupe = true ammo.amountGiven, ammo.ammoType = amount, ammoType ammo:Spawn() DarkRP.placeEntity(ammo, tr, ply) end -- use negative number to give player ammo from a container ent -- cannot be done if dropping if amount > 0 then ply:RemoveAmmo(amount, ammoType) elseif amount < 0 and container:IsValid() then ply:GiveAmmo(amount * -1, ammoType) -- make a positive integer again or this function wont work else return end end) net.Receive("PlayerUpdateListener", function(len, ply) local ent = net.ReadEntity() if not ent:IsValid() then return end if not ent.Listeners then ent.Listeners = {} end if table.HasValue(ent.Listeners, ply) then table.RemoveByValue(ent.Listeners, ply) else table.insert(ent.Listeners, ply) end end) -- Handle picking up weapons -- You should only be able to pick up a weapon if you dont already have it equipped -- If its a valid inv item, attempt to store that shit in the inventory hook.Add("PlayerPickupDarkRPWeapon", "WeaponInventoryPickup", function(ply, wepEnt, wep) local itemid = "weapon_" .. wep:GetClass() if ply:HasWeapon(wep:GetClass()) then if BalaInv.Items[itemid] then -- add to inventory local wepItem = ply:AddItem(itemid) if not wepItem then DarkRP.notify(ply, NOTIFY_ERROR, 4, "You do not have enough space in your inventory!") return true end ply:EmitSound("npc/combine_soldier/gear5.wav") wepItem.Clip1 = wepEnt.clip1 wepItem.Clip2 = wepEnt.clip2 --wepEnt:Remove() -- weapon gets removed if you return false anyway lmao DarkRP.notify(ply, NOTIFY_GENERIC, 4, "Weapon was stored in your inventory.") else DarkRP.notify(ply, NOTIFY_ERROR, 4, "You already have this weapon!") return true end return false end -- for some stupid fucking reason if you return true it still doesnt let you pick up the fucking weapon -- thanks falco you fucking retard -- edit: just realised falco decided to break the rules and be quirky by basing this off a vanilla hook then making his -- boolean return the OPPOSITE of what its meant to mean (bShouldntContinue) -- so u might as well have named this fucking hook PlayerNotAllowPickupDarkRPWeapon -- do u see how retarded that looks you fucking scrimp of a human end)
--[[ Copyright (C) 2018 Google Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ]] local factory = require 'factories.language.factory' local object_generator = require 'language.object_generator' local lcm = require 'language.make' local placers = require 'language.placers' local selectors = require 'language.selectors' local region_colors = require 'language.region_colors' local reward_controllers = require 'language.reward_controllers' local texture_sets = require 'themes.texture_sets' local twoAreaMap = { name = 'twoAreaMap_customFloors', textureSet = texture_sets.CUSTOMIZABLE_FLOORS, entityLayer = [[ O....O ..PP.. O....O ]], variationsLayer = [[ AAABBB AAABBB AAABBB ]], -- TODO(simongreen): Add methods to compute room information automatically. rooms = { A = { [1] = true, [3] = true, }, B = { [2] = true, [4] = true, }, }, } local twoRoomMap = { name = 'twoRoomMap_customFloors', textureSet = texture_sets.CUSTOMIZABLE_FLOORS, entityLayer = [[ O..***..O ..P...P.. O..***..O ]], variationsLayer = [[ AAA...BBB AAA...BBB AAA...BBB ]], rooms = { A = { [1] = true, [3] = true, }, B = { [2] = true, [4] = true, }, }, } local fourRoomMap = { name = 'fourRoomMap_customFloors', textureSet = texture_sets.CUSTOMIZABLE_FLOORS, entityLayer = [[ ***O.O*** ***...*** ***.P.*** O..*.*..O ..P...P.. O..*.*..O ***.P.*** ***...*** ***O.O*** ]], variationsLayer = [[ ...AAA... ...AAA... ...AAA... BBB...CCC BBB...CCC BBB...CCC ...DDD... ...DDD... ...DDD... ]], rooms = { A = { [1] = true, [2] = true, }, B = { [3] = true, [5] = true, }, C = { [4] = true, [6] = true, }, D = { [7] = true, [8] = true, }, } } local sixRoomMap = { name = 'sixRoomMap_customFloors', textureSet = texture_sets.CUSTOMIZABLE_FLOORS, entityLayer = [[ O..***..O ..P...P.. O..*.*..O ****.**** O..*.*..O ..P...P.. O..*.*..O ****.**** O..*.*..O ..P...P.. O..***..O ]], variationsLayer = [[ AAA...BBB AAA...BBB AAA...BBB ......... CCC...DDD CCC...DDD CCC...DDD ......... EEE...FFF EEE...FFF EEE...FFF ]], rooms = { A = { [1] = true, [3] = true, }, B = { [2] = true, [4] = true, }, C = { [5] = true, [7] = true, }, D = { [6] = true, [8] = true, }, E = { [9] = true, [11] = true, }, F = { [10] = true, [12] = true, }, }, } --[[ For the in room tasks: * Use all shapes. * Use 6 colors for floors and objects: RGBCMY. * No patterns - use solid. * Only mediumn objects. ]] local GOAL_REWARD = 10 local COLORS = {'red', 'green', 'blue', 'cyan', 'magenta', 'yellow'} local objectContext = object_generator.createContext{ attributes = { color = COLORS, pattern = {'solid'}, }, attributeDefaults = { size = 'medium', }, } local regionColorSelector = region_colors.createShuffledFloors(COLORS) --[[ Task Description: 1 Random goal object in one room, identified by object and floor color. 2 Distractor with different color to the goal in same room. 3 Distractor with same color as the goal but in a different room. 4 Distractor in the 2nd room with same color as 2 to prevent counting most . common color being a strategy for 50/50 chance. ]] local twoRoomColorTask = { {region = lcm.random()}, {color = lcm.differentTo(1), region = lcm.sameAs(1)}, {color = lcm.sameAs(1), region = lcm.differentTo(1)}, {color = lcm.sameAs(2), region = lcm.sameAs(3)}, key = "Pick the [goal.color] object in the [goal.roomColor.floor] room", itemsPerGroup = {1, 1, 1, 1}, taskMapSelector = selectors.createRandom{twoAreaMap, twoRoomMap}, } --[[ Task Description: 1 Random goal object in one room, identified by object and floor color. 2 Distractor with different color to the goal in same room. 3 Distractor with same color as the goal but in a different room. 4 Distractor in any other room with same color as 2 to prevent counting most . common color being a strategy for 50/50 chance. 5 x4 random distractors spread across the rooms ]] local fourRoomColorTask = { {region = lcm.random()}, {color = lcm.differentTo(1), region = lcm.sameAs(1)}, {color = lcm.sameAs(1), region = lcm.differentTo(1)}, {color = lcm.sameAs(2), region = 'any'}, {region = 'any'}, key = "Pick the [goal.color] object in the [goal.roomColor.floor] room", itemsPerGroup = {1, 1, 1, 1, 4}, taskMapSelector = selectors.createRandom{fourRoomMap}, } --[[ Task Description: 1 Random goal object in one room, identified by object and floor color. 2 Distractor with different color to the goal in same room. 3 Distractor with same color as the goal but in a different room. 4 Distractor in any other room with same color as 2 to prevent counting most . common color being a strategy for 50/50 chance. 5 x8 random distractors spread across the rooms ]] local sixRoomColorTask = { {region = lcm.random()}, {color = lcm.differentTo(1), region = lcm.sameAs(1)}, {color = lcm.sameAs(1), region = lcm.differentTo(1)}, {color = lcm.sameAs(2), region = 'any'}, {region = 'any'}, key = "Pick the [goal.color] object in the [goal.roomColor.floor] room", itemsPerGroup = {1, 1, 1, 1, 8}, taskMapSelector = selectors.createRandom{sixRoomMap}, } return factory.createLevelApi{ objectContext = objectContext, episodeLengthSeconds = 120, playerSpawnAngleRange = 360, rewardController = reward_controllers.createBalanced(GOAL_REWARD), objectPlacer = placers.createRoom(), levelRegionColorSelector = regionColorSelector, taskSelector = selectors.createDiscreteDistribution{ {2, twoRoomColorTask}, {1, fourRoomColorTask}, {1, sixRoomColorTask}, }, }
-- Actually these regular expressions were obtained from SpamAssassin project, so they are licensed by apache license: -- -- Licensed to the Apache Software Foundation (ASF) under one or more -- contributor license agreements. See the NOTICE file distributed with -- this work for additional information regarding copyright ownership. -- The ASF licenses this file to you under the Apache License, Version 2.0 -- (the "License"); you may not use this file except in compliance with -- the License. You may obtain a copy of the License at: -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- Drugs spam (viagra, pills etc) -- XXX: remove this legacy to statfile local reconf = config['regexp'] local drugs_diet1 = '/(?:\\b|\\s)[_\\W]{0,3}p[_\\W]{0,3}h[_\\W]{0,3}[e3\\xE8-\\xEB][_\\W]{0,3}n[_\\W]{0,3}t[_\\W]{0,3}[e3\\xE8-\\xEB][_\\W]{0,3}r[_\\W]{0,3}m[_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}n[_\\W]{0,3}[e3\\xE8-\\xEB][_\\W]{0,3}(?:\\b|\\s)/irP' local drugs_diet2 = '/(?:\\b|\\s)_{0,3}[i1!|l\\xEC-\\xEF][_\\W]?o[_\\W]?n[_\\W]?[a4\\xE0-\\xE6@][_\\W]?m[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?n_{0,3}\\b/irP' local drugs_diet3 = '/\\bbontril\\b/irP' local drugs_diet4 = '/\\bphendimetrazine\\b/irP' local drugs_diet5 = '/\\bdiethylpropion\\b/irP' local drugs_diet6 = '/(?:\\b|\\s)[_\\W]{0,3}M[_\\W]{0,3}[e3\\xE8-\\xEB][_\\W]{0,3}r[_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}d[_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}(?:\\b|\\s)/irP' local drugs_diet7 = '/\\b_{0,3}t[_\\W]?[e3\\xE8-\\xEB][_\\W]?n[_\\W]?u[_\\W]?a[_\\W]?t[_\\W]?[e3\\xE8-\\xEB]_{0,3}(?:\\b|\\s)/irP' local drugs_diet8 = '/\\b_{0,3}d[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?d[_\\W]?r[_\\W][e3\\xE8-\\xEB[_\\W]?xx?_{0,3}\\b/irP' local drugs_diet9 = '/\\b_{0,3}a[_\\W]?d[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?p[_\\W]?[e3\\xE8-\\xEB][_\\W]?x_{0,3}\\b/irP' local drugs_diet10 = '/\\b_{0,3}x?x[_\\W]?[e3\\xE8-\\xEB][_\\W]?n[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?c[_\\W]?[a4\\xE0-\\xE6@][_\\W]?l_{0,3}\\b/irP' reconf['DRUGS_DIET'] = string.format('((%s) | (%s) | (%s)) & ((%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s))', reconf['R_UNDISC_RCPT'], reconf['R_BAD_CTE_7BIT'], reconf['R_NO_SPACE_IN_FROM'], drugs_diet1, drugs_diet2, drugs_diet3, drugs_diet4, drugs_diet5, drugs_diet6, drugs_diet7, drugs_diet8, drugs_diet9, drugs_diet10) local drugs_erectile1 = '/(?:\\b|\\s)[_\\W]{0,3}(?:\\\\\\/|V)[_\\W]{0,3}[ij1!|l\\xEC\\xED\\xEE\\xEF][_\\W]{0,3}[a40\\xE0-\\xE6@][_\\W]{0,3}[xyz]?[gj][_\\W]{0,3}r[_\\W]{0,3}[a40\\xE0-\\xE6@][_\\W]{0,3}x?[_\\W]{0,3}(?:\\b|\\s)/irP' local drugs_erectile2 = '/\\bV(?:agira|igara|iaggra|iaegra)\\b/irP' local drugs_erectile3 = '/(?:\\A|[\\s\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\x7f])[_\\W]{0,3}C[_\\W]{0,3}[ij1!|l\\xEC\\xED\\xEE\\xEF][_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}l?[l!|1][_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}s[_\\W]{0,3}(?:\\b|\\s)/irP' local drugs_erectile4 = '/\\bC(?:alis|ilias|ilais)\\b/irP' local drugs_erectile5 = '/\\b_{0,3}s[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?l[_\\W]?d[_\\W]?[e3\\xE8-\\xEB][_\\W]?n[_\\W]?[a4\\xE0-\\xE6@][_\\W]?f[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?l c[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?t[_\\W]?r[_\\W]?[a4\\xE0-\\xE6@][_\\W]?t[_\\W]?[e3\\xE8-\\xEB]_{0,3}(?:\\b|\\s)/irP' local drugs_erectile6 = '/\\b_{0,3}L[_\\W]?[e3\\xE8-\\xEB][_\\W]?(?:\\\\\\/|V)[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?t[_\\W]?r[_\\W]?[a4\\xE0-\\xE6@][_\\W]?(?:\\b|\\s)/irP' local drugs_erectile8 = '/\\b_{0,3}T[_\\W]?[a4\\xE0-\\xE6@][_\\W]?d[_\\W]?[a4\\xE0-\\xE6@][_\\W]?l[_\\W]?[a4\\xE0-\\xE6@][_\\W]?f[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?l_{0,3}\\b/irP' local drugs_erectile10 = '/\\b_{0,3}V[_\\W]?(?:i|\\&iuml\\;)[_\\W]?(?:a|\\&agrave|\\&aring)\\;?[_\\W]?g[_\\W]?r[_\\W]?(?:a|\\&agrave|\\&aring)\\b/irP' local drugs_erectile11 = '/(?:\\b|\\s)_{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}p[_\\W]{0,3}c[_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}[l!|1][_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}s_{0,3}\\b/irP' reconf['DRUGS_ERECTILE'] = string.format('((%s) | (%s) | (%s)) & ((%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s))', reconf['R_UNDISC_RCPT'], reconf['R_BAD_CTE_7BIT'], reconf['R_NO_SPACE_IN_FROM'], drugs_erectile1, drugs_erectile2, drugs_erectile3, drugs_erectile4, drugs_erectile5, drugs_erectile6, drugs_erectile8, drugs_erectile10, drugs_erectile11) local drugs_anxiety1 = '/(?:\\b|\\s)[_\\W]{0,3}x?x[_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}n[_\\W]{0,3}[ea4\\xE1\\xE2\\xE3@][_\\W]{0,3}xx?_{0,3}\\b/irP' local drugs_anxiety2 = '/\\bAlprazolam\\b/irP' local drugs_anxiety3 = '/(?:\\b|\\s)[_\\W]{0,3}(?:\\\\\\/|V)[_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}[l|][_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}[u\\xB5\\xF9-\\xFC][_\\W]{0,3}m\\b/irP' local drugs_anxiety4 = '/\\b_{0,3}D[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?[a4\\xE0-\\xE6@][_\\W]?z[_\\W]?[ea3\\xE9\\xEA\\xEB][_\\W]?p[_\\W]?[a4\\xE0-\\xE6@][_\\W]?m_{0,3}\\b/irP' local drugs_anxiety5 = '/(?:\\b|\\s)[a4\\xE0-\\xE6@][_\\W]?t[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?v[_\\W]?[a4\\xE0-\\xE6@][_\\W]?n_{0,3}\\b/irP' local drugs_anxiety6 = '/\\b_{0,3}l[_\\W]?[o0\\xF2-\\xF6][_\\W]?r[_\\W]?[a4\\xE0-\\xE6@][_\\W]?z[_\\W]?[e3\\xE8-\\xEB][_\\W]?p[_\\W]?[a4\\xE0-\\xE6@][_\\W]?m_{0,3}\\b/irP' local drugs_anxiety7 = '/\\b_{0,3}c[_\\W]?l[_\\W]?[o0\\xF2-\\xF6][_\\W]?n[_\\W]?[a4\\xE0-\\xE6@][_\\W]?z[_\\W]?e[_\\W]?p[_\\W]?[a4\\xE0-\\xE6@][_\\W]?m\\b/irP' local drugs_anxiety8 = '/\\bklonopin\\b/irP' local drugs_anxiety9 = '/\\brivotril\\b/irP' reconf['DRUGS_ANXIETY'] = string.format('((%s) | (%s) | (%s)) & ((%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s))', reconf['R_UNDISC_RCPT'], reconf['R_BAD_CTE_7BIT'], reconf['R_NO_SPACE_IN_FROM'], drugs_anxiety1, drugs_anxiety2, drugs_anxiety3, drugs_anxiety4, drugs_anxiety5, drugs_anxiety6, drugs_anxiety7, drugs_anxiety8, drugs_anxiety9) reconf['DRUGS_ANXIETY_EREC'] = string.format('(%s) & (%s)', reconf['DRUGS_ERECTILE'], reconf['DRUGS_ANXIETY']) local drugs_pain1 = '/\\b_{0,3}h[_\\W]?y[_\\W]?d[_\\W]?r[_\\W]?[o0\\xF2-\\xF6][_\\W]?c[_\\W]?[o0\\xF2-\\xF6][_\\W]?d[_\\W]?[o0\\xF2-\\xF6][_\\W]?n[_\\W]?e_{0,3}\\b/irP' local drugs_pain2 = '/\\b_{0,3}c[o0\\xF2-\\xF6]deine_{0,3}\\b/irP' local drugs_pain3 = '/(?:\\b|\\s)[_\\W]{0,3}[u\\xB5\\xF9-\\xFC][_\\W]{0,3}l[_\\W]{0,3}t[_\\W]{0,3}r[_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}m_{0,3}\\b/irP' local drugs_pain4 = '/(?:\\b|\\s)[_\\W]{0,3}(?:\\\\\\/|V)[_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}c[_\\W]{0,3}[o0\\xF2-\\xF6][_\\W]{0,3}d[_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}ns?[_\\W]{0,3}(?:\\b|\\s)/irP' local drugs_pain5 = '/\\b_{0,3}t[_\\W]?r[_\\W]?[a4\\xE0-\\xE6@][_\\W]?m[_\\W]?[a4\\xE0-\\xE6@][_\\W]?d[_\\W]?[o0\\xF2-\\xF6][_\\W]?[l!|1]_{0,3}\\b/irP' local drugs_pain6 = '/\\b_{0,3}u[_\\W]?l[_\\W]?t[_\\W]?r[_\\W]?a[_\\W]?c[_\\W]?e[_\\W]?t_{0,3}\\b/irP' local drugs_pain7 = '/\\b_{0,3}f[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?[o0\\xF2-\\xF6][_\\W]?r[_\\W]?[i1!|l\\xEC-\\xEF][_\\W]?c[_\\W]?[e3\\xE8-\\xEB][_\\W]?[t7]_{0,3}\\b/irP' local drugs_pain8 = '/\\b_{0,3}c[_\\W]?[e3\\xE8-\\xEB][_\\W]?l[_\\W]?[e3\\xE8-\\xEB][_\\W]?b[_\\W]?r[_\\W]?[e3\\xE8-\\xEB][_\\W]?x_{0,3}\\b/irP' local drugs_pain9 = '/(?:\\b|\\s)_{0,3}[i1!|l\\xEC-\\xEF]m[i1!|l\\xEC-\\xEF]tr[e3\\xE8-\\xEB]x_{0,3}\\b/irP' local drugs_pain10 = '/(?:\\b|\\s)[_\\W]{0,3}(?:\\\\\\/|V)[_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}[o0\\xF2-\\xF6][_\\W]{0,3}x[_\\W]{0,3}xx?_{0,3}\\b/irP' local drugs_pain11 = '/\\bzebutal\\b/irP' local drugs_pain12 = '/\\besgic plus\\b/irP' local drugs_pain13 = '/\\bD[_\\W]?[a4\\xE0-\\xE6@][_\\W]?r[_\\W]?v[_\\W]?[o0\\xF2-\\xF6][_\\W]?n\\b/irP' local drugs_pain14 = '/N[o0\\xF2-\\xF6]rc[o0\\xF2-\\xF6]/irP' local drugs_pain = string.format('((%s) | (%s) | (%s)) & ((%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) | (%s) || (%s) | (%s))', reconf['R_UNDISC_RCPT'], reconf['R_BAD_CTE_7BIT'], reconf['R_NO_SPACE_IN_FROM'], drugs_pain1, drugs_pain2, drugs_pain3, drugs_pain4, drugs_pain5, drugs_pain6, drugs_pain7, drugs_pain8, drugs_pain9, drugs_pain10, drugs_pain11, drugs_pain12, drugs_pain13, drugs_pain14) local drugs_sleep1 = '/(?:\\b|\\s)[_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}m[_\\W]{0,3}b[_\\W]{0,3}[i1!|l\\xEC-\\xEF][_\\W]{0,3}[e3\\xE8-\\xEB][_\\W]{0,3}n[_\\W]{0,3}(?:\\b|\\s)/irP' local drugs_sleep2 = '/(?:\\b|\\s)[_\\W]{0,3}S[_\\W]{0,3}[o0\\xF2-\\xF6][_\\W]{0,3}n[_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}t[_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}(?:\\b|\\s)/irP' local drugs_sleep3 = '/\\b_{0,3}R[_\\W]?[e3\\xE8-\\xEB][_\\W]?s[_\\W]?t[_\\W]?[o0\\xF2-\\xF6][_\\W]?r[_\\W]?i[_\\W]?l_{0,3}\\b/irP' local drugs_sleep4 = '/\\b_{0,3}H[_\\W]?[a4\\xE0-\\xE6@][_\\W]?l[_\\W]?c[_\\W]?i[_\\W]?[o0\\xF2-\\xF6][_\\W]?n_{0,3}\\b/irP' local drugs_sleep = string.format('(%s) | (%s) | (%s) | (%s)', drugs_sleep1, drugs_sleep2, drugs_sleep3, drugs_sleep4) local drugs_muscle1 = '/(?:\\b|\\s)[_\\W]{0,3}s[_\\W]{0,3}[o0\\xF2-\\xF6][_\\W]{0,3}m[_\\W]{0,3}[a4\\xE0-\\xE6@][_\\W]{0,3}(?:\\b|\\s)/irP' local drugs_muscle2 = '/\\b_{0,3}cycl[o0\\xF2-\\xF6]b[e3\\xE8-\\xEB]nz[a4\\xE0-\\xE6@]pr[i1!|l\\xEC-\\xEF]n[e3\\xE8-\\xEB]_{0,3}(?:\\b|\\s)/irP' local drugs_muscle3 = '/\\b_{0,3}f[_\\W]?l[_\\W]?[e3\\xE8-\\xEB][_\\W]?x[_\\W]?[e3\\xE8-\\xEB][_\\W]?r[_\\W]?[i1!|l\\xEC-\\xEF]_{0,3}[_\\W]?l_{0,3}\\b/irP' local drugs_muscle4 = '/\\b_{0,3}z[_\\W]?a[_\\W]?n[_\\W]?a[_\\W]?f[_\\W]?l[_\\W]?e[_\\W]?x_{0,3}\\b/irP' local drugs_muscle5 = '/\\bskelaxin\\b/irP' reconf['DRUGS_MUSCLE'] = string.format('((%s) | (%s) | (%s)) & ((%s) | (%s) | (%s) | (%s) | (%s))', reconf['R_UNDISC_RCPT'], reconf['R_BAD_CTE_7BIT'], reconf['R_NO_SPACE_IN_FROM'], drugs_muscle1, drugs_muscle2, drugs_muscle3, drugs_muscle4, drugs_muscle5) reconf['DRUGS_MANYKINDS'] = string.format('((%s) | (%s) | (%s)) & regexp_match_number(3, (%s), (%s), (%s), (%s), (%s), (%s))', reconf['R_UNDISC_RCPT'], reconf['R_BAD_CTE_7BIT'], reconf['R_NO_SPACE_IN_FROM'], reconf['DRUGS_ERECTILE'], reconf['DRUGS_DIET'], drugs_pain, drugs_sleep, reconf['DRUGS_MUSCLE'], reconf['DRUGS_ANXIETY'])
local Script = { extends = Node } return Script
------------------------------------------------------------------------------- -- ElvUI ChatTweaks By Crackpot (US, Thrall) ------------------------------------------------------------------------------- local AceLocale = LibStub:GetLibrary("AceLocale-3.0") local L = AceLocale:NewLocale("ElvUI_ChatTweaks", "enUS", true, true) if not L then return end L[" |cff00ff00%s|r - %s"] = true L[" |cff00ff00%s|r or |cff00ff00%s|r - %s"] = true L[" |cff00ff00/ct %s|r - %s"] = true L[" |cff00ff00/ct %s|r or |cff00ff00%s|r - %s"] = true L[ [=[ Achievement Points ]=] ] = true L[ [=[ Conquest Points ]=] ] = true L[ [=[ Honor Points ]=] ] = true L[ [=[ Justice Points ]=] ] = true L[ [=[ Valor Points ]=] ] = true L[" %s Progress: Completed on %s%s|r/%s%s|r/%s%s|r"] = true L[" |cFFff5a00(Upgrade)|r"] = true L[" |cffffff00%d|r Total Modules (|cff00ff00%d|r Enabled, |cffff0000%d|r Disabled)"] = true L[" isn't a number."] = true L[" isn't a recognized variable or number."] = true L[ [=[ |cffff0000NOTE:|r If this addon starts to use a substantial amount of memory, simply reset the name data and it will return to a normal level.]=] ] = true L[ [=[ |cffff0000NOTE:|r If this addon starts to use a substantial amount of memory, simply reset the name data and it will return to a normal level. Addon Usage: |cff00ff00%s|r]=] ] = true L["$EMPTY$"] = true L["% Owned"] = true L["% Unowned"] = true L[ [=[%s Conquest Cap ]=] ] = true L[ [=[%s Justice Cap ]=] ] = true L[ [=[%s Valor Cap ]=] ] = true L["%s or %s"] = true L["%s reputation left until %s with %s."] = true L["%s reputation needed until %s with %s."] = true L[ [=[%s, %s, %s Player's Money ]=] ] = true L[ [=[%s, %s, %s Player's Stats ]=] ] = true L["%sChat Tweaks|r"] = true L["%sElvUI Chat Tweaks|r by |cff0070deCrackpotx|r"] = true L["(|HBNplayer.-|h): whispers:"] = true L["(|Hplayer.-|h) says:"] = true L["(|Hplayer.-|h) whispers:"] = true L[", removing from list"] = true L["/tt"] = true L["|cff%sHex:|r %s, |cffff0000Red:|r %s, |cff00ff00Green:|r %s, |cff0000ffBlue:|r %s"] = true L["|cff00ff00%d|r Custom %s Being Used"] = true L["|cff00ff00%s|r"] = true L["|cff00ff00%s|r %s"] = true L["|cff00ff00%s|r or |cff00ff00%s|r %s"] = true L["|cff00ff00%s|r or |cff00ff00%s|r or |cff00ff00%s|r"] = true L["|cff00ff00Enabled|r"] = true L["|cff00ff00Keybind options are solely handled by the Keybinding interface provided by WoW itself.|r"] = true L["|cFF5cb4f8Pet Battle - Tale of the Tape|r"] = true L["|cffc7c7cfs|r"] = true L["|cFFccff00Not Owned|r"] = true L["|cffeda55fc|r"] = true L["|cffff0000Disabled|r"] = true L["|cffff0000Item|r |cffffffff\"%s\"|r |cffff0000does not exist.|r"] = true L["|cffff0000No modules found.|r"] = true L["|cffff0000The Chat Frame you chose to output reputation changes,|r |cffffffff%s|r|cffff0000, does not exist."] = true L["|cffff9000Not in Pet Journal|r"] = true L["|cffff9000Pet Journal:|r %s"] = true L["|cffffc080Alts:|r %s"] = true L["|cffffd700g|r"] = true L["|cffffff00Character already in a guild."] = true L["|cffffff00Character already in your guild."] = true L["|cffffff00This abbreviation is unknown."] = true L["|cffffff00Unable to execute secure command.|r |cffffffff%s|r"] = true L["|cffffff00Usage: /ccolor <class>|r"] = true L["|cffffff00Usage: /fake <id or link> <date in MM/DD/YY format>|r"] = true L["|cffffff00Usage: /ginvite <name>|r"] = true L["|cffffff00Usage: /gkick <name>|r"] = true L["|cffffff00Usage: /hextorgb <hex code>|r"] = true L["|cffffff00Usage: /in <delay> <command>|r"] = true L["|cffffff00Usage: /rgbtohex <red> <green> <blue>|r"] = true L["|cffffff00Usage: /rpt <times> <command>|r"] = true L["|cffffffffYou have %s.|r"] = true L["<ElvUI_CTC>"] = true L["<no location>"] = true L["<notarget>"] = true L[ [=[A simple calculator used to perform basic operations on gold values. Providing no parameters will show you how much gold you have. You can include your current gold amount by using the |cff00ff00mymoney|r keyword. For example |cff00ff00mymoney * 2|r. |cffff0000Money amounts can only be added or subtracted, multiplication or division can only be performed with money and a number. For example: 4g * 4 is okay, where 4g * 4g is invalid.]=] ] = true L[ [=[A simple command-line calculator. Certain keywords, listed below, can be used and their in game value will be substituted. You can also assign variables which are saved for later use. |cffffff00Keywords:|r ]=] ] = true L["A simple module to add the |cff00ff96/release|r command to release your spirit if your popup window disappears."] = true L["A simple module to shorten the |cff00ff96/readycheck|r command to |cff00ff96/rc|r."] = true L["A Test of Valor"] = true L["Abbreviate your favourites to save typing. Format is short1:long1, short2:long2, ... shortN:longN."] = true L["Abbreviations"] = true L["achieve"] = true L["Achievement Filter"] = true L["Achievement for %s%s|r: %s"] = true L["Achievement Messages"] = true L["Activate in 5-man instances."] = true L["Activate in guild."] = true L["Active in your selected community"] = true L["Active Modules"] = true L["Add |cff00ff00/emotes|r Command"] = true L["Add an |cff00ff00/emotes|r command to see what custom emotes you currently have running."] = true L[ [=[Add custom emotes. Please remember that your character's name will always be the first word. |cff00ff00%t|r is your current target.]=] ] = true L["Add custom names to the chat messages in this custom channel."] = true L["Add custom names to the guild chat messages. (also include officer chat)."] = true L["Add custom names to the instance chat messages, e.g., LFR and battlegrounds."] = true L["Add custom names to the party chat messages."] = true L["Add custom names to the raid chat messages."] = true L["Add Group Trigger"] = true L["Add Guild Trigger"] = true L["Add item icons to loot received messages."] = true L["Add Percentage"] = true L["Add space after channels"] = true L["Add surrounding brackets to own charname in messages."] = true L["Add the percentage of owned or unowned to total pets for a zone to the list, or you can choose to disable it."] = true L["Add the player's alts to the tooltip."] = true L["Add the player's main to the tooltip."] = true L["Add word to your group invite trigger list"] = true L["Add word to your guild invite trigger list."] = true L["Addon enabled, but no message or channels selected."] = true L["Addon Messages"] = true L["Addon Version Sent, Version: |cffffff00%s|r"] = true L["Adds a |cff00ff00/fake|r command for generating fake achievements."] = true L[ [=[Adds a gamemenu button. |cffffff00To disable the button, simply disable this module. Please do a full reload after disable or enable.|r]=] ] = true L[ [=[Adds a minimap button. |cffffff00To disable the button, simply disable this module.|r]=] ] = true L["Adds a timestamp to each line of text."] = true L["Adds an ElvUI datatext for this addon."] = true L["Adds chat commands |cff1784d1/chatframes|r and |cff1784d1/cf|r to help you identify the chat frames and their numbers."] = true L[ [=[Adds chat commands to clear the chat windows. ]=] ] = true L[ [=[Adds chat commands to show the current server token price in the chat windows. ]=] ] = true L[ [=[Adds item links to Auction House messages. Enabling this module will automatically disable the Auction Message Filter module. |cffff0000If you do not have the item in your bags at the time of the system message firing then this will not be able to get the item link. This is a limitation of the|r |cffffff00GetItemInfo()|r |cffff0000API function. If this occurs, then the module will simple pass through the default message.|r]=] ] = true L["Adds itemlevel to linked items in chat messages."] = true L["Adds tell target slash command, |cff00ff00/tt|r."] = true L[ [=[Adds the |cff00ff96/find|r and |cff00ff96/findall|r commands to search the chat history. Usage: |cff00ff96/find <text>|r |cff00ff96/findall <text>|r]=] ] = true L["Adds the |cff00ff96/role|r command for initiating a role poll in raids."] = true L["Adds the chat commands |cff00ff96/zonelist|r, |cff00ff96/pets|r and |cff00ff96/mounts|r to provide information about your mounts and pets."] = true L["AFK"] = true L["AFK Messages"] = true L["AFK/DND Filter"] = true L["After"] = true L["against"] = true L["Alchemy"] = true L["All"] = true L["All Modules"] = true L["AllCommunity"] = true L["Allow guild synchronization"] = true L["Allow someone to request a link of all your professions."] = true L[ [=[Allows you to change the default font settings for the chat frames. |cffff0000Using another addon to do this will break this functionality.|r]=] ] = true L["Allows you to check the status of the A Test of Valor quest given by Wrathion for the legendary gems by using the |cff00ff96/tov|r chat command."] = true L[ [=[Allows you to color the pet battle info messages, and determine which chat frame to send them to. I am aware that some of the features of this module don't really pertain to the chat, but I couldn't really justify an entirely new addon. So I just snuck them into here.]=] ] = true L["Allows you to reroute auction house messages to a different chat frame."] = true L[ [=[Allows you to use some fun filters on various chat channels. |cffff0000This will break any links in the chat message.|r |cffffff00Filters:|r 13375p34|<, ALL UPPERCASE, all lowercase, Capitalize Words, AlTeRnAtInG CaPs, BeTTeR ALTeRNaTiNG CaPS, sretteL esreveR, Gràvè Lèttèrs, Ácúté Léttérs, Ðïärësïs Lëttërs, Cîrcûmflêx Lêttêrs]=] ] = true L["Alt + Left Click"] = true L["Alt + Right Click"] = true L["Alt Names"] = true L["Alt note fallback"] = true L["alt2"] = true L["alt3"] = true L["Alt-click name to invite"] = true L["Alternate command to kick someone from guild."] = true L["AlTeRnAtInG CaPs"] = true L["Always"] = true L["Always set your DND status while announcing to channels"] = true L["and"] = true L["Announce in chat who taunted."] = true L["Announce interval, minutes"] = true L["Announce settings"] = true L["Announce to General"] = true L["Announce to LFG"] = true L["Announce to Trade"] = true L["Announce your message to city trade channel."] = true L["Announce your message to General channel when out of a city."] = true L["Announce your message to LFG channel."] = true L["Announcements"] = true L["Announcing to General channel. Trade: %d LFG: %d"] = true L["Announcing to LFG channel. Trade: %d LFG: %d"] = true L["Announcing to Trade channel. Trade: %d LFG: %d"] = true L["Anounce AOE Taunts"] = true L["Anounce AOE Taunts Output:"] = true L["Anounce AOE Taunts."] = true L["Anounce Fails"] = true L["Anounce Fails Output:"] = true L["Anounce Taunts"] = true L["Anounce Taunts Output:"] = true L["Anounce taunts that fail."] = true L["Anounce taunts."] = true L["AOE"] = true L["ap"] = true L["Are you sure you want to delete all your saved class/level data?"] = true L["Are you sure you want to disable all of the modules?"] = true L["Are you sure you want to enable all of the modules?"] = true L["Are you sure you want to reset the chat fonts to defaults?"] = true L["As I see it, yes."] = true L["Ask again later."] = true L["Auction Created"] = true L["Auction Expired"] = true L["Auction Message Filtering"] = true L["Auction Message Types"] = true L["Auction Outbid"] = true L["Auction Removed"] = true L["Auction Sold"] = true L["Auction Won"] = true L["Auto Congratulate"] = true L["Auto Ding"] = true L["Auto Farewell"] = true L["Auto Profession Link"] = true L["Auto Set Role"] = true L["Auto Welcome"] = true L["Automatic Chat Logging"] = true L["Automatically bid someone farewell when they leave your guild."] = true L["Automatically congratulate someone when they, or others, complete an achievement."] = true L["Automatically congratulates someone when they say \"ding\" in chat."] = true L["Automatically enable tracking of pets for battles."] = true L["Automatically enable tracking of Stable Masters to help you revive and/or heal your pets."] = true L["Automatically enables chat logging."] = true L["Automatically link someone the profession they requested via various keywords."] = true L["Automatically Remove Item When Finished"] = true L["Automatically welcomes someone to your guild."] = true L["Available Chat Command Arguments"] = true L["Available communities"] = true L["Available parameters are |cff1784d1version|r, |cff1784d1build|r, |cff1784d1date|r, |cff1784d1interface|r, |cff1784d1locale|r."] = true L["Battle.Net Convo"] = true L["Battle.Net Options"] = true L["Battle.Net Whisper"] = true L["Before"] = true L["Below are the keywords that the module will look for to substitute with the values described below."] = true L["BeTTeR ALTeRNaTiNG CaPS"] = true L["Better not tell you now."] = true L["Bid Accepted"] = true L["Blacksmithing"] = true L["Bloodlust Announce"] = true L["Bloodlust Announce is disabled, locate it under |cfff960d9KlixUI|r settings instead."] = true L["Build Date: |cff1784d1%s|r"] = true L["Build: |cff1784d1%s|r"] = true L["Busy"] = true L["Calculator"] = true L["Cannot predict now."] = true L["Can't set value '%s', doesn't look like a number."] = true L["Capitalize Words"] = true L["Capture Delay"] = true L["Center"] = true L["Changed Channel"] = true L["Channel"] = true L["Channel %d"] = true L["Channel Colors"] = true L["Channel Names"] = true L["Channel Notice Filter"] = true L["Channel Sounds"] = true L["Channel to send the reminder to."] = true L["Channels"] = true L["Channels to Filter"] = true L["Channels to look for questions."] = true L["Channels to Monitor"] = true L["Channels to Watch"] = true L["Character to use between the name and level"] = true L["Character to use for the left bracket"] = true L["Character to use for the right bracket"] = true L["Chat Events"] = true L["Chat Fonts"] = true L["Chat Frame "] = true L["Chat Frame"] = true L["Chat Frame %d"] = true L["Chat Frame Settings"] = true L["Chat frame to output the message to. Default is |cffffff00ChatFrame3|r, which is the default frame for ElvUI XP messages."] = true L["Chat frame to output the messages. Default is ChatFrame3, which is the default output frame for reputation messages in ElvUI."] = true L["Chat frame to route the auction house messages to."] = true L["Chat frame to route the messages to."] = true L["Chat frame to send the list to."] = true L["Chat frame to send the messages to."] = true L["Chat Frames To Watch"] = true L["Chat Tabs"] = true L["Chat Tweaks"] = true L["Chat Window"] = true L["ChatFrame %d"] = true L["Chats To Monitor"] = true L["Cheats Color"] = true L["Choose the filter to use."] = true L["Choose which chat frames display timestamps"] = true L["Class"] = true L["Clear all chat windows."] = true L["Clear Chat Commands"] = true L["Clear current chat."] = true L["Click to open the ElvUI Chat Tweaks config window. This will also close ElvUI's config window."] = true L["Click to reset the materials you're tracking."] = true L["Click to send the reminder to the select channel that the Magic 8-Ball is listening."] = true L["Click to toggle ElvUI's config window. This will also close this window."] = true L["Client Locale: |cff1784d1%s|r"] = true L["Coin Size"] = true L["Color"] = true L["Color a roll game loss, aka when you roll a one (1)."] = true L["Color a roll game win, aka when someone else rolls a one (1)."] = true L["Color by Channel"] = true L["Color Cheats"] = true L["Color Level"] = true L["Color Loss"] = true L["Color Name"] = true L["Color of other's rolls."] = true L["Color of the base reputation messages."] = true L["Color of the faction."] = true L["Color of the output message."] = true L["Color of the reputation needed/left."] = true L["Color of the standing (honored, revered, etc.)."] = true L["Color own charname in messages."] = true L["Color Player Names By..."] = true L["Color regular rolls by others."] = true L["Color Rolls"] = true L["Color rolls differently to make tracking the roll game easier on the eyes."] = true L["Color rolls that do not start at 1."] = true L["Color self in messages"] = true L["Color the messages by the channel the message came from."] = true L["Color the name of the pets during a pet battle relative to their rarity. If you have the pet you're currently battling it will also add the quality of the pet you have in your journal."] = true L["Color timestamps the same as the channel they appear in."] = true L[ [=[Color to change the filtered message to. |cffff0000Only works when Filtering Mode is set to |cff00ff00Colorize|r.]=] ] = true L["Color to designate a cheating roll."] = true L["Color to designate a roll game loss."] = true L["Color to designate a roll game win."] = true L["Color to use for your rolls."] = true L["Color Win"] = true L["Color Your Rolls"] = true L["Color your rolls to set them apart."] = true L["Colorize"] = true L["Combat Log Remover"] = true L["Command Help"] = true L["Companions"] = true L["Complete"] = true L["Compress"] = true L["Concentrate and ask again."] = true L["Congratulate achievements earned by guildmates."] = true L["Congratulate achievements earned by people in your party."] = true L["Congratulate achievements earned by people in your raid."] = true L["Congratulate achievements earned by people near you."] = true L["Congratulations Messages"] = true L["conquest"] = true L["Control + Left Click"] = true L["Control + Right Click"] = true L["Control when Talented should silence Learned/Unlearned system messages"] = true L["Cooking"] = true L["copper"] = true L["Copy Links"] = true L["cp"] = true L["cpcap"] = true L["Creates a button to click that will return you to the bottom of the chat frame."] = true L["Custom Chat Filters"] = true L["Custom chat filters."] = true L["Custom color"] = true L["Custom Emote: |cffffff00%s|r"] = true L["Custom Emotes"] = true L["Custom format (advanced)"] = true L["Custom Named Chat Filters"] = true L["Custom Names"] = true L["Damage Meters"] = true L["Datatext"] = true L["Datatext Display"] = true L["Date"] = true L["Day"] = true L["Death Knight"] = true L["DEATHKNIGHT"] = true L["Default font face for the chat frames."] = true L["Default font outline for the chat frames."] = true L["Default font size for the chat frames."] = true L["Default Name Color"] = true L["Destroys all your saved class/level data"] = true L["Developer Tools"] = true L["Ding Messages"] = true L["Disable All Modules"] = true L["Disable if you completed the achievement."] = true L["Disable if you say ding."] = true L["Disable if..."] = true L["Disable in Battlegrounds"] = true L["Disable in PvP Zones"] = true L["Disable while you're AFK flagged."] = true L["Disable while you're DND flagged."] = true L["Disabled"] = true L["Disabled %s%s|r module."] = true L["Disabled Modules"] = true L["Disables while you are in a battleground."] = true L["Disables while you are in PvP Zones such as Ashran."] = true L["Display a tooltip by hovering over a link in chat."] = true L["Display Ability"] = true L["Display armor/weapon type (Plate, Leather, ...)"] = true L["Display equip location (Head, Trinket, ...)"] = true L["Display item level"] = true L["Display itemlevellinks when someone links an item in chat."] = true L["Display itemlevellinks when someone loots an item."] = true L["Display Keystone Conqueror achievement progress."] = true L["Display Keystone Master achievement progress."] = true L["Display the ability that was used to taunt."] = true L["Displays reputation numbers and progress in the chat frame."] = true L["DND Messages"] = true L["Do not reply while in M+ dungeons."] = true L["Do not use alphanumerical characters."] = true L["Do Nothing"] = true L["Do you want to automatically remove an item when you meet your quota?"] = true L["Doesn't allow multiple announces from your guild members at the same time."] = true L["Doesn't send anything to channels, simulating only."] = true L["Dont Always Run"] = true L["Don't count on it."] = true L["Don't show your own failed taunts."] = true L["Don't show your own taunts."] = true L["DRUID"] = true L["Druid"] = true L["Dungeon Guide"] = true L["Easy Channel"] = true L["EditBox Alt Key Arrows"] = true L["ElvUI ChatTweaks"] = true L["ElvUI_ChatTweaks"] = true L["ElvUI_CT"] = true L["Emote"] = true L["Emote Filter"] = true L["Emphasize Self"] = true L["Enable "] = true L["Enable"] = true L["Enable All Modules"] = true L["Enable Debugging"] = true L["Enable this to give the module a percent chance to run to prevent spam/annoyances. If disabled the module will always congratulate."] = true L["Enable this to give the module a percent chance to run to prevent spam/annoyances. If disabled the module will always run."] = true L["Enable this to give the module a percent chance to run to prevent spam/annoyances. If disabled the module will always welcome."] = true L["Enable to filter custom emotes made using |cff00ff00/emote|r or |cff00ff00/e|r."] = true L["Enable to filter standard emotes such as |cff00ff00/dance|r or |cff00ff00/flirt|r."] = true L["Enable various debugging messages to help with errors or undesired functioning."] = true L["Enabled"] = true L["Enabled %s%s|r module."] = true L["Enabled Modules"] = true L["Enables the whoing of friends."] = true L["Enables the whoing of Guildmates."] = true L[ [=[Enables you to replace channel names with your own names. You can use '%s' to force an empty string. |cffffff00Please disable ElvUI Short Channel option for this to work, you'll find the option under /ec - Chat - General - Short Channels.]=] ] = true L["Enables you to right-click a person's name in chat and set a note on them to be displayed in chat, such as their main character's name. Can also scan guild notes for character names to display, if no note has been manually set."] = true L["Enabling this will send a message to your chat whenever you change a zone with a list of the Battle Pets that are obtainable in the zone. You have the option to filter them based on whether or not you own them. This will also add the chat command |cff00ff96/zonelist|r to send the list whenever. Even if you disable this the chat commands will still work."] = true L["Enchanting"] = true L["Engineering"] = true L["Enter a custom time format. See http://www.lua.org/pil/22.1.html for a list of valid formatting symbols."] = true L["Enter a value in seconds."] = true L["Equip Location"] = true L["etc"] = true L["Exclude level display for max level characters"] = true L["Exclude max levels"] = true L["Execution Interval"] = true L["Faction Color"] = true L["Failed:"] = true L["Fake Achievement"] = true L["Female"] = true L["Filter achievement message spam!"] = true L["Filter achievements earned by guildmates."] = true L["Filter achievements earned by nearby people."] = true L["Filter AFK messages."] = true L["Filter AFK/DND auto responses. This module is compatible with WIM."] = true L["Filter by Player Level"] = true L["Filter changed channel message."] = true L["Filter Color"] = true L["Filter DND messages."] = true L["Filter Guild Achievements"] = true L["Filter joined channel message."] = true L["Filter left channel message."] = true L["Filter Line"] = true L["Filter Mode"] = true L["Filter Nearby Achievements"] = true L["Filter Pets"] = true L["Filter spam throttle notices."] = true L["Filter standard and/or custom emotes."] = true L[ [=[Filter the Auction Created message. |cffffff00%s|r]=] ] = true L[ [=[Filter the Auction Expired message. |cffffff00%s|r]=] ] = true L[ [=[Filter the Auction Outbid message. |cffffff00%s|r]=] ] = true L[ [=[Filter the Auction Removed message. |cffffff00%s|r]=] ] = true L[ [=[Filter the Auction Sold message. |cffffff00%s|r]=] ] = true L[ [=[Filter the Auction Won message. |cffffff00%s|r]=] ] = true L[ [=[Filter the Bid Accepted message. |cffffff00%s|r]=] ] = true L["Filter the line containing the question."] = true L[ [=[Filter what item quality should be displayed in chat. |cfff960d9Quality steps: 0 = Poor, 1 = Common, 2 = Uncommon, 3 = Rare, 4 = Epic, 5 = Legendary & 6 = Artifact|r]=] ] = true L["Filtering Mode"] = true L["Filters"] = true L["Filters out Auction House system messages."] = true L["Filters the channel notices."] = true L["Font Color"] = true L["Font Face"] = true L["Font Size"] = true L["Frame scraping timeout exceeded, results will be incomplete."] = true L["Frame to output the messages to."] = true L["Frame to send the addon messages to."] = true L["Friends"] = true L["Friends Whispers"] = true L["Fun Filters"] = true L["Gamemenu Button"] = true L["General"] = true L["General Tab Channels"] = true L["Generate fake achievement links."] = true L["ginv"] = true L["ginvite"] = true L["GInvite Alternate Command"] = true L["Gives the ability to add custom names to the chat messages for better recognition."] = true L["Gives you more flexibility in how you invite people to your group and guild."] = true L["GKick Command"] = true L["GKick Target: |cffffff00%s|r"] = true L["gold"] = true L["Gold Calculator"] = true L["Group"] = true L["Group Invite Links"] = true L["Group Say Command"] = true L["Guild"] = true L["Guild Channel"] = true L["Guild Chat"] = true L["Guild cooperation mode"] = true L["Guild Invite Links"] = true L["Guild Messages"] = true L["Guild Options"] = true L["Guild Recruitment"] = true L["Guild Whispers"] = true L["Guildmates"] = true L["GuildSync: Accepted configuration update from %s"] = true L["GuildSync: Error. Bad configuration received from %s"] = true L["Handles chat tab flashing."] = true L["health"] = true L["Here you can select which channels this module will scan for the keygroupWords to trigger the invite."] = true L["HH:MM (12-hour)"] = true L["HH:MM (24-hour)"] = true L["HH:MM:SS (24-hour)"] = true L["HH:MM:SS AM (12-hour)"] = true L["Hide Compatibility Message"] = true L["Hide name if it matches your character's name"] = true L["Hide Own Failed Taunts"] = true L["Hide Own Taunts"] = true L["Hide the compatibility message in chat when KlixUI is installed."] = true L["Hiding Configuration Options"] = true L["Highlight Color"] = true L["Highlight Substitutions"] = true L["Highlight Term"] = true L["Highlight the search term in the results."] = true L["Highlight the substitutions that are made by changing their color."] = true L["honor"] = true L["honour"] = true L["Hook the GameTooltip to add information to pet tooltips."] = true L["Hook the tooltip to show the toon's main or alts."] = true L["Hook Tooltip"] = true L["Hour (12hr)"] = true L["Hour (24hr)"] = true L["Hover Links"] = true L["How many pets on a single line when they're being listed using the |cff00ff96/pets list|r command."] = true L["How often announce your message to channel."] = true L["How to filter any matches."] = true L["Hunter"] = true L["HUNTER"] = true L["I am |cff1784d1%s|r"] = true L["Icon Orientation"] = true L["Icon Size"] = true L["Icon to the left or right of the item link."] = true L["Identify Chat Frames"] = true L["If a keyword is found should the module filter the line?"] = true L["If no name can be found for an 'alt' rank character, use entire note"] = true L["If the name specified above matches your current character's name, this module will not add it again if this option is checked."] = true L["Ignore any messages you send containing keywords."] = true L["Ignore Your Messages"] = true L[ [=[Improve the Auction Expired message. |cffffff00%s|r]=] ] = true L[ [=[Improve the Auction Outbid message. |cffffff00%s|r]=] ] = true L[ [=[Improve the Auction Removed message. |cffffff00%s|r]=] ] = true L[ [=[Improve the Auction Sold message. |cffffff00%s|r]=] ] = true L[ [=[Improve the Auction Won message. |cffffff00%s|r]=] ] = true L["Improved Auction Messages"] = true L["In Command"] = true L["Inactive Modules"] = true L["Include level"] = true L["Include Prefix"] = true L["Include the"] = true L["Include the player's level"] = true L["Incomplete"] = true L["Inscription"] = true L["Instance"] = true L["Instance Channel"] = true L["Instance Leader"] = true L[ [=[Instantly send the information of whom whispered you. ]=] ] = true L["inv"] = true L["Invalid achievement ID for %s%d|r."] = true L["Invalid achievement link provided."] = true L["Invalid format found on entry \"%s\"."] = true L["invite"] = true L["Invite Links"] = true L["It is certain."] = true L["It is decidedly so."] = true L["Item Level"] = true L["Item Level Link"] = true L["Jewelcrafting"] = true L["Joined Channel"] = true L["jp"] = true L["jpcap"] = true L["Just one character."] = true L["justice"] = true L["Keeps your channel colors by name rather than by number."] = true L["Keybinds"] = true L["Keystone Announce"] = true L["Keystone Conqueror Completion Status"] = true L["Keystone Master Completion Status"] = true L["Keystone Progress"] = true L["Keyword Sounds"] = true L["Keywords"] = true L["Leatherworking"] = true L["Left"] = true L["Left Bracket"] = true L["Left Channel"] = true L["Left Click"] = true L["Lets you alt-click player names to invite them to your party."] = true L["Lets you set the justification of text in your chat frames."] = true L["Level Difference"] = true L["Level Location"] = true L["Level: |cffffff00%s|r, Message: |cffffff00%s|r"] = true L["Link All Professions"] = true L["Login"] = true L["Look in guildnotes for character names, unless a note is set manually"] = true L["Loot Icons"] = true L["Loss Color"] = true L["lowercase"] = true L["MAGE"] = true L["Mage"] = true L["Magic 8-Ball"] = true L["Magic 8-Ball says: %s"] = true L["Magic 8-Ball Says: I am ready to answer your questions! Do \"%s <question>\" to ask me a question."] = true L["Main: "] = true L["Makes it easy to identify which person popped bloodlust/heroism."] = true L["Makes it easy to navigate through the different channels by pressing the 'TAB' Key."] = true L["Male"] = true L["mana"] = true L["Material Quantities"] = true L["Materials Farming"] = true L["Materials to Track"] = true L["Maximum Delay"] = true L["Maximum time, in seconds, to wait before bidding someone farewell."] = true L["Maximum time, in seconds, to wait before congratulating someone."] = true L["Maximum time, in seconds, to wait before welcoming someone."] = true L["Maximum time, in seconds, to wait before whispering someone the link."] = true L["Message Color"] = true L["Message color."] = true L["Message highlight color."] = true L["Message Settings"] = true L["Message Throttle"] = true L["Message to announce, 2 lines max"] = true L[ [=[Messages for when multiple people complete achievements. A random one will always be selected. |cffff0000Wildcards do not apply for multiple achievements.|r]=] ] = true L[ [=[Messages for when someone completes an achievement. A random one will always be selected. |cffFA6400Wildcards|r |cff00ff00#name#|r - Name of the person. |cff00ff00#achieve#|r - Achievement they completed.]=] ] = true L[ [=[Messages to use in guild chat when someone leaves your guild. |cffFA6400Wildcards|r |cff00ff00#name#|r - Person who left. |cff00ff00#guild#|r - Name of your guild.]=] ] = true L[ [=[Messages to use in the whisper when someone leaves your guild. |cffFA6400Wildcards|r |cff00ff00#name#|r - Person who left. |cff00ff00#guild#|r - Name of your guild.]=] ] = true L[ [=[Messages to use when someone joins your guild. |cffFA6400Wildcards|r |cff00ff00#name#|r - Person who joined. |cff00ff00#guild#|r - Name of your guild.]=] ] = true L[ [=[Messages to use when someone says "ding". |cffFA6400Wildcards|r |cff00ff00#name#|r - Who said ding. |cff00ff00#guild#|r - Their current level.]=] ] = true L["Minimap Button"] = true L["Minimum Delay"] = true L["Minimum Level"] = true L["Minimum level required for an achievement to not be filtered."] = true L["Minimum time, in seconds, to wait before bidding someone farewell."] = true L["Minimum time, in seconds, to wait before congratulating someone."] = true L["Minimum time, in seconds, to wait before welcoming someone."] = true L["Minimum time, in seconds, to wait before whispering someone the link."] = true L["Minute"] = true L["MM:SS"] = true L["Monitor Chat Events"] = true L["Monitor guild chat."] = true L["Monitor party chat."] = true L["Monitor raid chat."] = true L["Monitor say chat."] = true L["Monitor text in this channel for link triggers."] = true L["Monitor whispers."] = true L["Monitor yell chat."] = true L["Monk"] = true L["MONK"] = true L["Monster Emote"] = true L["Monster Say"] = true L["Month"] = true L["Most likely."] = true L["Multiple Achievement Messages"] = true L["Multiple Invite Command"] = true L["My reply is no."] = true L["My sources say no."] = true L["Name"] = true L["Name color"] = true L["Nearby People"] = true L["Never"] = true L["New Version Notify"] = true L["No"] = true L["No custom emotes are currently being used."] = true L["No Filter"] = true L["No RealNames"] = true L["None"] = true L["Not Capturable"] = true L["Not Found"] = true L["Not Owned"] = true L["Not tracking %s."] = true L["NoTarget"] = true L["Notifies your party or raid if people are taking a lot of avoidable damage from ground auras."] = true L["Notify on new release?"] = true L["Notify on Role Set"] = true L["Num Channels"] = true L["Numbered Channels"] = true L["Off"] = true L["Officer"] = true L["Officer Channel"] = true L["Officer Chat"] = true L["On"] = true L["On (%d min)"] = true L["On (%d sec)"] = true L["One or more of the changes you have made require you to reload your UI."] = true L["Only filter achievements earned by players below a certain level."] = true L["Open Config"] = true L["Open ElvUI Config"] = true L["Open ElvUI's Config"] = true L["Opens configuration window."] = true L["Other Channels"] = true L["Ouput Frame"] = true L["Outline"] = true L["Outlook good."] = true L["Outlook not so good."] = true L["Output Channel"] = true L["Output Color"] = true L["Output color of the rerouted messages."] = true L["Output Frame"] = true L["Output Message Every..."] = true L["Output the message every X times you gain XP."] = true L["Output To..."] = true L["Owned Only"] = true L["PALADIN"] = true L["Paladin"] = true L["Parameter: |cffffff00%s|r"] = true L["Party"] = true L["Party Channel"] = true L["Party Leader"] = true L["Party Members"] = true L["Percent Chance"] = true L["Perhaps you meant '*' (multiplication)?"] = true L["Pet Battle Info"] = true L["Pet Battles"] = true L["Pet Combat Log"] = true L["Pets Per Line"] = true L["Place the level before or after the player's name."] = true L["Play a sound when it pops up."] = true L["Play Sound"] = true L["Player Class"] = true L["Player Level"] = true L["Player level display options."] = true L["Player Names"] = true L["Player's Average iLvl"] = true L["Player's Class"] = true L["Player's Gender"] = true L["Player's Health"] = true L["Player's Health Deficit"] = true L["Player's Health Percent"] = true L["Players Level"] = true L["Player's Location"] = true L["Player's Mana"] = true L["Player's Mana Deficit"] = true L["Player's Mana Percent"] = true L["Player's Max Health"] = true L["Player's Max Mana"] = true L["Player's Name"] = true L["Player's X-Coordinate"] = true L["Player's Y-Coordinate"] = true L["Player's Zone"] = true L["Plays a sound when one of your ElvUI keywords is found."] = true L["Plays a sound, of your choosing (via LibSharedMedia-3.0), whenever a message is received in a given channel."] = true L["Plugins by |cff0070deCrackpotx|r"] = true L["Popup"] = true L["Popup Messages"] = true L["PopupMessage"] = true L["power"] = true L["Prefix Character"] = true L["prefix when a message's output is"] = true L["PRIEST"] = true L["Priest"] = true L["Print Addon Version"] = true L["Print hidden addon messages in a chat frame. This can be useful to debugging addon issues."] = true L["Print this again."] = true L["Prints a link you can click to congratulate when someone obtains an achievement."] = true L["Prints a message in the chat with your remain XP needed to level up."] = true L["Prints module status."] = true L["Progress Updates"] = true L["Provides |cff00ff00/ginv|r, an alternative to |cff00ff00/ginvite|r command, for us lazy folks."] = true L[ [=[Provides |cff00ff00/minv|r to invite multiple people at once. Also adds custom abbreviations for characters which are invited often. Module Written by Björn Benjamin Hiller <[email protected]>]=] ] = true L["Provides a /in command to delay the execution of code in macros and other settings."] = true L["Provides a |cff00ff00/gkick|r command, as it should be."] = true L["Provides a |cff00ff96/gs|r slash command to let you speak in your group (raid, party, or instance) automatically."] = true L[ [=[Provides a few tools to help me (Crackpotx), develop this addon as well as diagnose and fix any errors that are reported. |cff00ff00You can leave this addon disabled unless I (Crackpotx) ask you to enable it for some debugging.|r]=] ] = true L["Provides basic chat subtitutions."] = true L["Provides keybinds to make talking in a specific chat easier."] = true L["Provides options to color player names, add player levels, and add tab completion of player names."] = true L[ [=[Put each emote on a separate line. Separate the command from the text with a colon (":").]=] ] = true L["Quality"] = true L["Quality Notification"] = true L["Raid"] = true L["Raid Boss Emote"] = true L["Raid Channel"] = true L["Raid Leader"] = true L["Raid Members"] = true L["Raid Warning"] = true L["Raid Warning Channel"] = true L["Random Number"] = true L["Ready Check Command"] = true L["RealID Brackets"] = true L["Really remove this word from your trigger list?"] = true L["Release Command"] = true L["ReloadUI"] = true L["Remaining: %s, Cost: $%d"] = true L["Reminder"] = true L["Remove"] = true L["Remove a word from your group invite trigger list"] = true L["Remove a word from your guild invite trigget list."] = true L["Remove Group Trigger"] = true L["Remove Guild Trigger"] = true L["Removes the combat log chattab from the chat window."] = true L["Repeat Command"] = true L["Repeat Question"] = true L["Repeat the question when giving a response."] = true L["Replace this channel name with..."] = true L["Reply hazy, try again."] = true L["Reported by %s"] = true L["Reputation"] = true L["Reputation Color"] = true L["Require the alt key to be pressed to use the arrow keys on editboxes."] = true L["Reroute Auction Messages"] = true L["Reset alt names and their mains."] = true L["Reset ChatFrame text justifications to defaults (left)."] = true L["Reset Data"] = true L["Reset Font Data"] = true L["Reset Materials"] = true L["Reset Names"] = true L[ [=[Reset saved mains/alts. |cffff0000This CANNOT be undone.|r]=] ] = true L["Reset Text Justitification"] = true L["Resets all chat frames to their original font settings."] = true L["Right"] = true L["Right Bracket"] = true L["Right Click"] = true L["Rogue"] = true L["ROGUE"] = true L["Role Poll Command"] = true L["Role Set: %s%s|r"] = true L["Role will not be set while in combat."] = true L["Roll Color"] = true L["Roll Pattern: |cffffff00%s|r"] = true L["'s"] = true L["Save all /who data"] = true L["Save class data from /who queries between sessions."] = true L["Save class data from friends between sessions."] = true L["Save class data from groups between sessions."] = true L["Save class data from guild between sessions."] = true L["Save class data from target/mouseover between sessions."] = true L["Save Data"] = true L["Save data between sessions. Will increase memory usage"] = true L["Say"] = true L["Say Chat"] = true L["Scrape Time"] = true L["Scroll Reminder"] = true L["Search"] = true L["Search Results |cff9382c9(%d Found)|r:"] = true L["Search Results:"] = true L["Search term is too short."] = true L["Second"] = true L["Select a color for this channel."] = true L["Select a method for coloring player names"] = true L["Select an option if you want the zone list to only contain pets you own or do not own."] = true L["Select channels"] = true L["Select how you want the player's level colored."] = true L["Select the channels to apply the filter to."] = true L["Select the channels you want monitored."] = true L["Select the channels you want to monitor."] = true L["Select the chat frames you want to monitor for substitutions. You can use the chat command |cff00ff96/cf|r to determine a chat frame's number."] = true L["Select the custom color to use for alt names"] = true L["Select which channels to flash when a message is received."] = true L["Select which factions you would like to receive notifications for."] = true L["Self"] = true L["Semi-Auto Congratulate"] = true L["Send a chat message when a role is set/changed."] = true L["Send a tell to your target."] = true L["Send a whisper to the person who left."] = true L["Send Guild Messages"] = true L["Send guild recruitment messages to various chat channels."] = true L["Send messages to guild chat when someone leaves."] = true L["Send Reminder"] = true L["Send Whisper"] = true L["Separator"] = true L["Set DND"] = true L["Set DND message"] = true L["Set Main"] = true L["Set the coloring mode for alt names"] = true L["Set the message color. This only applies if |cff00ff96Color by Channel|r is disabled or if there is no color for the channel."] = true L["Set the sound to play."] = true L["Settings"] = true L["Shaman"] = true L["SHAMAN"] = true L["Shift + Left Click"] = true L["Shift + Right Click"] = true L["Short Format"] = true L["Short format (P for plate, L for leather, ...)"] = true L["Show Alts"] = true L["Show Armor Type"] = true L["Show current to total XP percentage."] = true L["Show current token price at login."] = true L["Show current token price."] = true L["Show ElvUI Chat Tweaks Config Window"] = true L["Show how many whispers you've received this session."] = true L["Show how many whispers, you've received this session."] = true L["Show Main"] = true L["Show Percentage"] = true L["Show remaining rested XP."] = true L["Show Rested XP"] = true L["Show the total number of modules on the datatext."] = true L["Show toon names instead of real names"] = true L["Show Total XP"] = true L["Show total XP needed to level."] = true L["Show welcome message when logging in."] = true L["Showing Configuration Options"] = true L["Shows messages in a popup frame."] = true L["Signs point to yes."] = true L["Silence in M+"] = true L["Silence Learned/Unlearned system messages."] = true L["silver"] = true L["Similar to the |cffffffIn Command|r module, except it will repeat the command X times."] = true L["Size of the coin icons. Generally you want to use your font size or smaller."] = true L["Skipping. Message already advertised by %s"] = true L["Skipping. Trade: %d LFG: %d"] = true L["Smart Group Channel"] = true L["Sound"] = true L[ [=[Sound to play when a message in %s is received. |cff00ff00To disable set to "None"|r.]=] ] = true L["Spam CoolDown"] = true L["Spam Delay"] = true L["SPAM protection, lines"] = true L["Spam Throttle"] = true L["Squelch"] = true L["sretteL esreveR"] = true L["Standard Emote: |cffffff00%s|r"] = true L["Standard Emotes"] = true L["Standing Color"] = true L["Stopped tracking %s."] = true L["Strip RealID brackets"] = true L["Substitutions"] = true L["Suppress"] = true L["Suppress Recount/Skada/TinyDPS output into a clickable link, or filter it entirely."] = true L["Symbol: |cffffff00%s|r"] = true L["SYNC_KEY_HELP"] = true L["Synchronization key"] = true L["Tailoring"] = true L["Talent Squelch"] = true L["Talk to your group based on party/raid status."] = true L["Target/Mouseover"] = true L["Target: |cffffff00%s|r"] = true L["Target's Class"] = true L["Target's Gender"] = true L["Target's Health"] = true L["Target's Health Deficit"] = true L["Target's Health Percent"] = true L["Target's Level"] = true L["Target's Mana"] = true L["Target's Mana Deficit"] = true L["Target's Mana Percent"] = true L["Target's Max Health"] = true L["Target's Max Mana"] = true L["Target's Name"] = true L["taunt"] = true L["taunted"] = true L["Tell Target"] = true L["Test mode"] = true L["Text Justification"] = true L["Text justification for ChatFrame %d."] = true L["Text to trigger the addon to answer a question."] = true L[ [=[Thanks for using and supporting my work! -- |cff0070deCrackpotx|r |cffff0000If you find any bugs, or have any suggestions for any of my addons, please open a ticket at that particular addon's page on CurseForge.]=] ] = true L["The amount of each material you'd like to farm. If you want an unlimited amount simply put a 0. You must add a quantity for every entry, and it must correspond to the same line in the other box."] = true L["The character in front of abbreviations to be recognised as such."] = true L["The chat window taunts will be announced in when the output is set to"] = true L["The classic Magic 8-Ball brought to World of Warcraft!"] = true L["The color to highlight the search term."] = true L["The color to use when highlighting a substitution."] = true L["The default color to use to color names."] = true L[ [=[The name or ID of the material you'd like to track. |cff00ff00If you wish to use the item's name then the item must exist in your bags. This is a limitation to the API, item ID's will always work as intended.|r]=] ] = true L["The name that should be displayed in your chat messages."] = true L["The percent chance the module has to bid someone farewell. Higher the chance, the more likely it is to run. This is a means to throttle, so as to prevent spam/annoyances."] = true L["The percent chance the module has to congratulate someone. Higher the chance, the more likely it is to run. This is a means to throttle, so as to prevent spam/annoyances."] = true L["The percent chance the module has to welcome someone. Higher the chance, the more likely it is to run. This is a means to throttle, so as to prevent spam/annoyances."] = true L["The size of the icon in the chat frame."] = true L["The time, in seconds, it takes for the same person to trigger the addon again."] = true L["The time, in seconds, it takes for the same person to trigger the addon by saying ding."] = true L["These are the keywords that the addon will look for first, when it finds a match then it will look for the actual profession being requested."] = true L["These channels apply to the General tab only."] = true L["Thick Outline"] = true L[ [=[This addon is designed to add a lot of the functionality of full fledged chat addons like Prat or Chatter, but without a lot of the unneeded bloat. I wrote it to be as lightweight as possible, while still powerful enough to accomplish it's intended function. ]=] ] = true L["This add-on will try to prevent spamming to idle channels. If there is no activity in a channel, then it waits a little longer. Specify how many lines should pass before add-on is allowed to announce message."] = true L[ [=[This module adds a command to check your progress on the Keystone Conqueror and Master achievements. |cff00ff00/ksc|r - Keystone Conqueror Progress |cff00ff00/ksm|r - Keystone Master Progress Use |cff00ff00track|r to toggle achievement tracking for each achievement.]=] ] = true L[ [=[This module is for named channels only. Allows you to filter certain words or phrases using Lua's pattern matching. For an item, achievement, spell, etc. just use the name of the item, don't try to link it. For more information see this addon's Curse page.]=] ] = true L[ [=[This module is for numbered channels only. Allows you to filter certain words or phrases using Lua's pattern matching. For an item, achievement, spell, etc. just use the name of the item, don't try to link it. For more information see this addon's Curse page.]=] ] = true L[ [=[This module keeps watch on your chat for certain commands and responds accordingly. Type |cff00ff96!ctk|r or |cff00ff96!keys|r to pull keystone information.]=] ] = true L["This module will send a chat message every time you loot an item on your list with how many you have, and if applicable it will tell you how many more you need based on your set quantity. This is useful if you need X amount of Y to be able to cook Z."] = true L["This will synchronize message and settings between guild members. Latter version of a message will be used by all guild members with synchronization enabled."] = true L["Throttle"] = true L["Throttle Interval"] = true L["Throttle Messages"] = true L["Throttle output messages to prevent spam."] = true L["Throttle the updates so you do not get spammed. Set to |cff00ff960|r to disable."] = true L["Throttle Time"] = true L["Throttle time prevented %s update."] = true L[ [=[Throttle to only answer a question every X seconds, to prevent spam. |cffff0000Not recommended to disable this.|r]=] ] = true L["Time"] = true L["Time, in seconds, in between running the command."] = true L[ [=[Time, in seconds, the module will wait after the first line is found to assume it is complete. |cffffff00One (1) second seems to work.|r]=] ] = true L["Time, in seconds, to throttle output messages to prevent spam."] = true L["Time, in seconds, to throttle the zone list to prevent any spam."] = true L["Time, in seconds, you want the search to continue before it ends."] = true L["Timestamp color"] = true L["Timestamp format"] = true L["Timestamps"] = true L["To (|HBNplayer.-|h):"] = true L["To (|Hplayer.-|h):"] = true L["To <Away>(|HBNplayer.-|h):"] = true L["To <Busy>(|HBNplayer.-|h):"] = true L["TOC Version: |cff1784d1%s|r"] = true L["Toggle Actionbar Keybinds"] = true L["Toggle Anchors"] = true L["Toggle coloring and change of the chat frame for pet combat log messages."] = true L["Toggle coloring and changing of the chat frame for pet battle info messages."] = true L["Toggle the monitoring of chat events."] = true L["Toggle the pet list message when you enter a different zone."] = true L["Toggle the pet quality notifications when you join a wild pet battle."] = true L["Toggle the requirement of the Alt key to be pressed to use arrow keys to navigate an editbox."] = true L["Token Price"] = true L["Tooltip"] = true L["Total Cost: $%d"] = true L["Total Modules"] = true L["Track Pets"] = true L["Track Stable Masters"] = true L["Tracking %s."] = true L["Trigger"] = true L["Trigger Chat"] = true L["Trigger Loots"] = true L["Triggers"] = true L[ [=[Turns the timestamps into a link. Click the link to copy the chat line. Shift+Click the link to send the line to the last chat you used.]=] ] = true L["Type DND message there."] = true L["Type the message to announce, every line will be announced. Message should not be longer than 2 lines."] = true L["Unable to load the Alt Name module, please try again."] = true L["Unbalanced parameter count. Trailing Symbol: |cffffff00%s|r"] = true L["Unowned Only"] = true L["Unrecognized Symbol: |cffffff00%s|r"] = true L["Unset variable |cffffff00%s|r."] = true L["Update the quest progress when you receive Valor Points. This will automatically be disabled when you complete the achievement."] = true L["Uppercase"] = true L["Use %sElvUI_CT|r instead of %sElvUI_ChatTweaks|r in messages printed by the addon."] = true L["Use Alt Key"] = true L["Use channel color"] = true L["Use Channel Color"] = true L["Use Coins"] = true L["Use coins in the answers instead of abbreviations."] = true L["Use Custom Color"] = true L["Use guildnotes"] = true L["Use Level Threshold"] = true L["Use Master Channel"] = true L["Use PlayerNames Coloring"] = true L["Use Short Name"] = true L["Use Tab Complete"] = true L["Use tab key to automatically complete character names."] = true L["Use the master channel when playing the sound."] = true L["Use this key to separate sync settings for different groups of peoples. Leave empty for default."] = true L["using"] = true L["Valid Events"] = true L["valor"] = true L["Valor Points"] = true L["Variable |cffffff00%s|r is set to |cff00ff00%s|r."] = true L["Variable |cffffff00%s|r set to |cff00ff00%s|r."] = true L["Various Developer Tools"] = true L["Version"] = true L["Version %s%s|r is loaded. Type %s/ct|r if you need help."] = true L["Version: |cff1784d1%s|r"] = true L["Very doubtful."] = true L["vp"] = true L["vpcap"] = true L["Warlock"] = true L["WARLOCK"] = true L["WARRIOR"] = true L["Warrior"] = true L["Welcome Message"] = true L["Welcome Messages"] = true L["What to do with Recount/Skada/TinyDPS reports in this channel."] = true L["What to show on the datatext."] = true L["When an ElvUI keyword is found it will show the message in a popup frame."] = true L["When setting a variable the variable name must be the first parameter."] = true L["When Talented Changes Talents"] = true L["Where AOE Taunts will be announced."] = true L["Where taunts will be announced."] = true L["Where the taunt fails will be announced."] = true L["Whisper"] = true L["Whisper Answer"] = true L["Whisper Messages"] = true L["Whisper Options"] = true L["Whisper the response to the person. Otherwise it will be answered in the same channel the request was sent."] = true L["Whispers"] = true L["Who"] = true L["Who is %s's main?"] = true L["Who Taunted"] = true L["Who to Congratulate?"] = true L["Who Whispered Me"] = true L["Who: |cffffff00%s|r, Roll: |cffffff00%s|r, Min: |cffffff00%s|r, Max: |cffffff00%s|r"] = true L["Will automatically set your role based on your spec, when appropriate."] = true L["Will save all data for large /who queries"] = true L["Win Color"] = true L["Without a doubt."] = true L["XP Left To Level"] = true L["Year"] = true L["Yell"] = true L["Yell Chat"] = true L["Yes"] = true L["Yes, definitely."] = true L["You are missing %s%d|r pets."] = true L["You are running version |cff1784d1%s|r."] = true L["You asked: %s"] = true L["You can only send a request once every %d seconds. You last sent a request at %s."] = true L["You can use $gname tag in text. This will be replaced by your guild name."] = true L["You have %s%d (%d unique, %d duplicates)|r pets."] = true L["You have %s%d|r duplicate pets."] = true L["You have %s%d|r mounts."] = true L["You have %s%d|r unique pets."] = true L["You have |cff%s%d|r of %s, you need |cff%s%d|r more. |cff%s(%d/%d)|r"] = true L["You have |cff%s%d|r of %s."] = true L["You have |cff9382c9Chatter|r running, which is incompatible with this addon. Please disable it."] = true L["You have |cff9382c9Prat-3.0|r running, which is incompatible with this addon. Please disable it."] = true L["You have already completed %s."] = true L["You have met your quota of %s%s. |cff%s(%d/%d)|r"] = true L["You may rely on it."] = true L["You must provide a calculation or set a variable."] = true L["You need %s%s%s%sto hit level %d."] = true L["You Need To Move"] = true L["Your Color"] = true L["Your version of %s is out of date. Latest version is |cff1784d1%d|r."] = true L["Your Version: |cffffff00%d|r, Latest Version: |cffffff00%d|r"] = true L["Yours"] = true L["Zone List"] = true
-- Example of how to use 'push_group' and 'pop_group_to_source' to composite -- a bunch of drawing commands onto a background with a single level of -- alpha blending, and also demonstrate the difference between the -- 'get_target' and 'get_group_target' methods. local Cairo = require "oocairo" local PI = 2*math.asin(1) local IMG_WD, IMG_HT = 450, 450 local surface = Cairo.image_surface_create("rgb24", IMG_WD, IMG_HT) local cr = Cairo.context_create(surface) -- White background. cr:set_source_rgb(1, 1, 1) cr:paint() -- Black cross to show through the translucent circles. cr:set_source_rgb(0, 0, 0) cr:move_to(0, 0) cr:line_to(IMG_WD, IMG_HT) cr:move_to(0, IMG_HT) cr:line_to(IMG_WD, 0) cr:set_line_width(20) cr:stroke() cr:push_group() for _, v in ipairs{ {200,1,0,0}, {150,0,1,0}, {100,0,0,1}, {50,0,0,0} } do local radius, r, g, b = unpack(v) cr:arc(IMG_WD/2, IMG_HT/2, radius, 0, 2*PI) cr:set_source_rgb(r, g, b) cr:fill() end local function draw_text_on_surface (surface, y, text) local tmpcr = Cairo.context_create(surface) tmpcr:move_to(20, y) tmpcr:set_source_rgb(0, 0, 0) tmpcr:set_font_size(40) tmpcr:show_text(text) end draw_text_on_surface(cr:get_target(), IMG_HT / 2 - 70, "get_target") draw_text_on_surface(cr:get_group_target(), IMG_HT / 2 + 80, "get_group_target") cr:pop_group_to_source() cr:paint_with_alpha(0.5) surface:write_to_png("groups.png") -- vi:ts=4 sw=4 expandtab
object_draft_schematic_weapon_carbine_e11_mk2 = object_draft_schematic_weapon_shared_carbine_e11_mk2:new { } ObjectTemplates:addTemplate(object_draft_schematic_weapon_carbine_e11_mk2, "object/draft_schematic/weapon/carbine_e11_mk2.iff")
local I = {} local function dump_list_file(files) local out = {} for f, v in pairs(files) do if v then table.insert(out, f) end end return vim.fn.msgpackdump(out) end local function new_list(path, files) local list = {} list._path = path list._files = files function list:save() local dirname = vim.fn.fnamemodify(self._path, ":h") if vim.fn.isdirectory(dirname) ~= 1 then vim.fn.mkdir(dirname, "p") end vim.fn.writefile(dump_list_file(self._files), self._path) end function list:contains_parent_of(p) p = vim.fn.fnamemodify(vim.fn.expand(p), ":p") for f, v in pairs(self._files) do if v and p:find(f, 1, true) == 1 then return true end end return false end local function to_key(path) return vim.fn.fnamemodify(vim.fn.expand(path), ":p") end function list:remove(key) self._files[to_key(key)] = nil end function list:add(key) self._files[to_key(key)] = true end function list:contains(key) return self._files[to_key(key)] end return list end function I.open(path) path = vim.fn.fnamemodify(vim.fn.expand(path), ":p") local files = nil if vim.fn.filereadable(path) ~= 1 then files = {} else files = vim.fn.msgpackparse(vim.fn.readfile(path)) end if files == nil then print("error: could not parse listing: " .. path) return nil end local keyedfiles = {} for _, f in pairs(files) do keyedfiles[f] = true end return new_list(path, keyedfiles) end return I
-- skrypt by CEO oraz marcin778 -- function straz_pozarna(plr,commands, ...) local msg = table.concat ( {...}, " " ) outputChatBox("* Wezwałeś(aś) Państwową Straż Pożarną !",plr,255,255,255) for k,v in ipairs(getElementsByType("player")) do if getElementData(v, "player:faction")=="PSP" then outputChatBox( "* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..", zadzwonił po Was, powód: "..msg:gsub("#%x%x%x%x%x%x","")..". ",v) end end end addCommandHandler("wezwij.psp",straz_pozarna) function pogotowie(plr,commands, ...) local msg = table.concat ( {...}, " " ) outputChatBox("* Wezwałeś(aś) Pogotowie Ratunkowe !",plr,255,255,255) for k,v in ipairs(getElementsByType("player")) do if getElementData(v, "player:faction")=="SAMC" then outputChatBox( "* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..", zadzwonił po Was, powód: "..msg:gsub("#%x%x%x%x%x%x","")..". ",v) end end end addCommandHandler("wezwij.samc",pogotowie) function policja(plr,commands, ...) local msg = table.concat ( {...}, " " ) outputChatBox("* Wezwałeś(aś) Policje !",plr,255,255,255) for k,v in ipairs(getElementsByType("player")) do if getElementData(v, "player:faction")=="SAPD" then outputChatBox( "* "..getPlayerName(plr):gsub("#%x%x%x%x%x%x","")..", zadzwonił po Was, powód: "..msg:gsub("#%x%x%x%x%x%x","")..". ",v) end end end addCommandHandler("wezwij.sapd",policja)
-- Telescope Mappings local util = require "jesse.core.util" local M = {} M.mappings = { i = { ["<C-v>"] = util.open_telescope_selection_in_new_instance, }, n = { ["<C-v>"] = util.open_telescope_selection_in_new_instance, }, } -- Launch mappings vim.keymap.set("n", "<leader>f", function() util.git_or_find_files() end, { noremap = true, silent = true }) vim.keymap.set("n", "<leader>g", function() require("telescope.builtin").live_grep() end, { noremap = true, silent = true }) return M
local object = { a = 1 } return object
--[===[DOC = jsonish [source,lua] ---- function jsonish( jsonStr ) --> dataTab ---- This function parses the json-like string `jsonStr` to the lua table `dataTab`. It does not perform any validation. The parser is not fully JSON compliant, however it is very simple and it should work in most the cases. This function internally works by trasforming the string into a valid lua table literal. For this reasons it accept also some syntax that is not actually valid JSON, e.g. mixed array/hash syntax: `{1, "a":"b"}. == Example [source,lua,example] ---- local jsonish = require 'jsonish' local data = jsonish '{ "a":{"hello":"world"}, "b":[99,100,101]}' assert( data.a.hello == "world" ) assert( data.b[1] == 99 ) assert( data.b[2] == 100 ) assert( data.b[3] == 101 ) ---- ]===] local function json_to_table_literal(s) s = s:gsub([[\\]],[[\u{5C}]]) s = (' '..s):gsub('([^\\])(".-[^\\]")', function( prefix, quoted ) -- Matched string: quoted, non empty quoted = quoted:gsub('\\"','\\u{22}') quoted = quoted:gsub('\\[uU](%x%x%x%x)', '\\u{%1}') quoted = quoted:gsub('%[','\\u{5B}') quoted = quoted:gsub('%]','\\u{5D}') return prefix .. quoted end) s = s:gsub('%[','{') s = s:gsub('%]','}') s = s:gsub('("[^"]-")%s*:','[%1]=') return s end local function json_to_table(s) local loader, e = load('return '..json_to_table_literal(s), 'jsondata', 't', {}) if not loader or e then return nil, e end return loader() end return json_to_table
local M = {} M.__index = M function M.new(images) local getActorAnimations = function(img) return { still = animation.new(img, 64, 64, 0, 3, 0, 8), down = animation.new(img, 64, 64, 3, 6, 0, 8), up = animation.new(img, 64, 64, 9, 6, 0, 8), right = animation.new(img, 64, 64, 15, 6, 0, 8), left = animation.new(img, 64, 64, 15, 6, 0, 8, true), } end return setmetatable({ actors = { mary = { still = animation.new(images.actors.mary, 64, 64, 0, 3, 0, 1), }, player = getActorAnimations(images.actors.player), cultist = getActorAnimations(images.actors.cultist), cultist1 = getActorAnimations(images.actors.cultist1), cultist2 = getActorAnimations(images.actors.cultist2), cultist3 = getActorAnimations(images.actors.cultist3), cultist4 = getActorAnimations(images.actors.cultist4), cultist5 = getActorAnimations(images.actors.cultist5), cultist6 = getActorAnimations(images.actors.cultist6), person1 = getActorAnimations(images.actors.person1), person2 = getActorAnimations(images.actors.person2), person3 = getActorAnimations(images.actors.person3), person4 = getActorAnimations(images.actors.person4), person5 = getActorAnimations(images.actors.person5), person6 = getActorAnimations(images.actors.person6), person7 = getActorAnimations(images.actors.person7), person8 = getActorAnimations(images.actors.person8), person9 = getActorAnimations(images.actors.person9), person10 = getActorAnimations(images.actors.person10), motel_guy = getActorAnimations(images.actors.motel_guy), librarian = { still = animation.new(images.actors.librarian, 64, 64, 0, 2, 0, 1), }, }, doors = { antiques = animation.new(images.doors.antiques, 80, 72, 0, 6, 0, 1, false), bar = animation.new(images.doors.bar, 80, 72, 0, 6, 0, 1, false), coffee_shop = animation.new(images.doors.coffee_shop, 80, 72, 0, 6, 0, 1, false), doctor = animation.new(images.doors.doctor, 80, 72, 0, 6, 0, 1, false), library = animation.new(images.doors.library, 80, 72, 0, 6, 0, 1, false), motelLeft = animation.new(images.doors.motel, 80, 72, 0, 6, 0, 1, false), motelMiddle = animation.new(images.doors.motel, 80, 72, 0, 6, 0, 1, false), motelRight = animation.new(images.doors.motel, 80, 72, 0, 6, 0, 1, false), post_office = animation.new(images.doors.post_office, 80, 72, 0, 6, 0, 1, false), school = animation.new(images.doors.school, 80, 72, 0, 6, 0, 1, false), store = animation.new(images.doors.store, 80, 72, 0, 6, 0, 1, false), }, ui = { text_arrow = animation.new(images.ui.text_arrow, 32, 32, 0, 2, 0, 1, false) }, decor = { school_flag = animation.new(images.decor.school_flag, 88, 160, 0, 3, 0, 3, false), beer_sign = animation.new(images.decor.beer_sign, 56, 80, 0, 14, 0, 12, false), freezer = animation.new(images.decor.freezer, 96, 96, 0, 3, 0, 10000), } }, M) end return M
require 'mylib' mylib.sayHello()
local class = require('middleclass') local Controller = require('mvc.Controller') local HasSignals = require('HasSignals') local PlaybackController = class("PlaybackController", Controller):include(HasSignals) function PlaybackController:initialize(deskModel) Controller.initialize(self) HasSignals.initialize(self) self.desk = deskModel end function PlaybackController:viewDidLoad() self.view:layout(self.desk) self.listener = { self.desk:on('deskRecord', function(msg) self.view:freshRecordView('lastPage', msg.mode) end), } self.desk:deskRecord() end function PlaybackController:firstPage() self.view:freshRecordView('firstPage') end function PlaybackController:frontPage() self.view:freshRecordView('frontPage') end function PlaybackController:nextPage() self.view:freshRecordView('nextPage') end function PlaybackController:lastPage() self.view:freshRecordView('lastPage') end function PlaybackController:clickBack() self.emitter:emit('back') end function PlaybackController:finalize() for i = 1, #self.listener do self.listener[i]:dispose() end end return PlaybackController
--- -- @module RagdollableConstants local require = require(game:GetService("ReplicatedStorage"):WaitForChild("Nevermore")) local Table = require("Table") return Table.readonly({ REMOTE_EVENT_NAME = "RagdollRemoteEvent"; })
-- mcafee-epo-agent.nse V0.0.2, checks if ePO agent is running -- Developed by Didier Stevens and Daniel Miller -- Use at your own risk -- -- History: -- 2012/05/31: Start -- 2012/06/01: extracting data from XML; tested with ePO 4.5 and 4.6 -- 2012/06/05: V0.0.2 conversion to version script by Daniel Miller -- 2012/06/20: new portrule by Daniel Miller description = [[ Check if ePO agent is running on port 8081 or port identified as ePO Agent port. ]] --- -- @output -- PORT STATE SERVICE VERSION -- 8081/tcp open http McAfee ePolicy Orchestrator Agent 4.5.0.1852 (ePOServerName: EPOSERVER, AgentGuid: D2E157F4-B917-4D31-BEF0-32074BADF081) -- Service Info: Host: TESTSERVER author = {"Didier Stevens", "Daniel Miller"} license = "Same as Nmap--See https://nmap.org/book/man-legal.html" categories = {"version", "safe"} local http = require "http" local nmap = require "nmap" local stdnse = require "stdnse" local string = require "string" portrule = function(host, port) if port.version ~= nil and port.version.product ~= nil then return ((port.version.product:find("[eE][pP]olicy Orch") or port.version.product:find("[eE]PO [aA]gent")) and nmap.version_intensity() >= 7) else return ((port.number == 8081 and port.protocol == "tcp") and nmap.version_intensity() >= 7) end end function ExtractXMLElement(xmlContent, elementName) return xmlContent:match("<" .. elementName .. ">([^<]*)</" .. elementName .. ">") end action = function(host, port) local options, data, epoServerName, agentGUID -- Change User-Agent string to MSIE so that the ePO agent will reply with XML options = {header={}} options['header']['User-Agent'] = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; mcafee-epo-agent)" data = http.get(host, port, '/', options) if data.body then stdnse.debug2("data.body:sub = %s", data.body:sub(1, 80)) if data.body:match('^<%?xml .*%?>%s*<naLog>') then port.version.hostname = ExtractXMLElement(data.body, "ComputerName") epoServerName = ExtractXMLElement(data.body, "ePOServerName") or "" port.version.version = ExtractXMLElement(data.body, "version") or "" agentGUID = ExtractXMLElement(data.body, "AgentGUID") or "" port.version.name = 'http' port.version.product = 'McAfee ePolicy Orchestrator Agent' port.version.extrainfo = string.format('ePOServerName: %s, AgentGuid: %s', epoServerName, agentGUID) nmap.set_port_version(host, port) return nil end end if nmap.verbosity() > 1 then return "ePO Agent not found" else return nil end end
-- Move the icons to a circle around some distance above the screen an rotate icons on that circle. return function(page, offset, screen_width, screen_height) local percent = offset / screen_width local prog1 = math.min(1, math.max(0, -3 * math.abs((math.abs(percent) - 0.5)) + 1.5)) local prog2 if percent < 0 then prog2 = math.min(1, math.max(0, -3 * math.abs(percent) + 2)) else prog2 = math.min(1, math.max(0, 3 * math.abs(percent) - 1)) + 1 end local mx = page.width / 2 local my = page.height / -1.5 local r = math.sqrt(math.pow(mx, 2) + math.pow(my, 2)) local start_theta = -math.atan(my / mx) local total_angle = math.pi - start_theta * 2 for i, icon in subviews(page) do local ix, iy = icon.x + icon.width / 2, icon.y + icon.height / 2 local theta = - start_theta - total_angle * (i / #page + 1 - prog2) + math.pi local x, y = r * math.cos(theta) + mx, r * math.sin(theta) + my icon:translate(prog1 * (x - ix), prog1 * (y - iy), 0) icon:rotate(prog1 * (theta - 0.5 * math.pi), 0, 0, 1) if math.abs(percent) > 0.66667 then icon.alpha = 0 end end page:translate(offset, 0, 0) end
-- -- Created by IntelliJ IDEA. -- User: nander -- Date: 21/04/2018 -- Time: 14:54 -- To change this template use File | Settings | File Templates. -- LOWEST = 0 local menu = {} -- previously: Gamestate.new() menu.name = "playCards" function menu:enter(prev) menu.prev = prev end function menu:draw() scripts.rendering.renderMapView.draw(LOWEST) end function menu:update(dt, b) scripts.rendering.renderUI.updateMove(dt) end function menu:keypressed(key) for k, v in ipairs({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }) do if love.keyboard.isDown(v) then if STATE.hand[k] then Gamestate.push(scripts.states.showCard, STATE, k+LOWEST) end end end end function menu:mousepressed(x, y, mouse_btn) if mouse_btn == 1 then local k = scripts.helpers.calculations.getCardNumber(x, y) if k then Gamestate.push(scripts.states.showCard, STATE, k) end end scripts.rendering.renderUI.mousePressed(x, y, mouse_btn) end function menu:mousereleased(x, y, mouse_btn) scripts.rendering.renderUI.mouseReleased(x, y, mouse_btn) end function menu:wheelmoved(x, y) scripts.rendering.renderUI.wheelmoved(x, y) end return menu
local exports = exports or {} local TestSpace = exports.TestSpace or TestSpace or {} do local TestNestedSpace = TestNestedSpace or {} do local function innerFunc() end TestNestedSpace.innerFunc = innerFunc end TestSpace.TestNestedSpace = TestNestedSpace end exports.TestSpace = TestSpace return exports
-- General ( May be used multiple places ) ZO_CreateStringId("SI_MAILLOOTER_ADDON_NAME", "MailLooter") ZO_CreateStringId("SI_MAILLOOTER_TITLE", "Mail Looter") -- There may be up to 6 strings for the defaults. MailLooter.defaultAutoReturnSubjects = { "return", "bounce", "rts", "return to sender" } -- Keybingings: ZO_CreateStringId( "SI_BINDING_NAME_MAILLOOTER_OPEN", "Open") ZO_CreateStringId( "SI_BINDING_NAME_MAILLOOTER_QUICK_LOOT_ALL", "Open and Loot All") ZO_CreateStringId( "SI_BINDING_NAME_MAILLOOTER_QUICK_LOOT_FILTERED", "Open and Loot Selected") -- Keybind Strip ZO_CreateStringId( "SI_MAILLOOTER_STRIP_LOOT_MAIN", "Loot Mail") ZO_CreateStringId( "SI_MAILLOOTER_STRIP_CANCEL", "Cancel") ZO_CreateStringId( "SI_MAILLOOTER_STRIP_CLEAR", "Clear") -- Summary Bar ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_INBOX", "INBOX:") ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_ALL", "All Mail:") ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_UNREAD", "Unread:") ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_LOOTABLE", "Lootable:") ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_AVA", "AvA:") ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_HIRELING", "Hireling:") ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_STORE", "Store:") ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_COD", "CoD:") ZO_CreateStringId("SI_MAILLOOTER_SUMMARY_OTHER", "Other:") ZO_CreateStringId("SI_MAILLOOTER_SUMMERY_DONE", "Done.") ZO_CreateStringId("SI_MAILLOOTER_SUMMERY_LOOTING", "Looting...") -- Filter Bar Tool Tips ZO_CreateStringId( "SI_MAILLOOTER_FILTER_ALL", "All Lootable Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_AVA", "Alliance War Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_HIRELING", "Hireling Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_STORE", "Guild Store Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_COD", "COD Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_RETURNED", "Returned Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_SIMPLE", "Simple Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_COD_RECEIPT", "COD Receipts") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_HIRELING_SMITH", "Blacksmithing Hireling Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_HIRELING_CLOTH", "Clothier Hireling Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_HIRELING_ENCHANT", "Enchanting Hireling Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_HIRELING_PROVISION", "Provisioning Hireling Mail") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_HIRELING_WOOD", "Woodworking Hireling Mail") -- Filter Bar Label ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_ALL", "ALL") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_AVA", "Alliance War") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_HIRELING", "Hireling") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_STORE", "Guild Store") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_COD", "COD") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_RETURNED", "Returned") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_SIMPLE", "Simple") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_COD_RECEIPT", "COD Receipts") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_SMITH", "Blacksmithing") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_CLOTH", "Clothier") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_ENCHANT", "Enchanting") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_PROVISION", "Provisioning") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_WOOD", "Woodworking") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_COMPLEX", "Multi-Filtered") ZO_CreateStringId( "SI_MAILLOOTER_FILTER_LABEL_NOTHING", "NONE") -- Overview ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW", "Overview") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_TOTAL", "Total Mails") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_ALL", "All Looted:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_AVA", "AvA:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_HIRELING", "Hireling:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_STORE", "Store:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_COD", "COD:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_RETURNED", "Returned:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_SIMPLE", "Simple:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_COD_RTN", "COD Receipts:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_AUTO_RTN", "Auto-Returned:") ZO_CreateStringId( "SI_MAILLOOTER_OVERVIEW_COD_PAID", "COD Paid:") -- Alerts ZO_CreateStringId( "SI_MAILLOOTER_NOTHING_TO_LOOT", "Mail Looter Found No Loot") ZO_CreateStringId( "SI_MAILLOOTER_TIMEOUT", "Timeout Waiting For Mail") -- Settings ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AWO", "Account Wide Options" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AWO_DESC", "All options on this page are stored account wide and will be the same for all of your characters. Only the loot filter on MailLooter (Not on this page) is stored per character." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_GO", "General Options" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_RES_IS", "Reserve (4) Inventory Spaces" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_RES_IS_TT", "Reserves inventory spaces needed to do crafting deconstructions." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_RES_CUS", "Customize the Number of Reserved Spaces" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_COD_OPTIONS", "COD Options" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_COD_ENABLE", "Accept and Loot COD Mails" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_COD_LIMITS", "COD Limits") ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_COD_L_DESC", "MailLooter looting of COD mails may be limited on a per mail price and a combined COD price. A value of |cFF0000ZERO|r means no limit is enforced." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_COD_MAX_PRICE", "Maximum Price per COD" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_COD_MAX_COMB_PRICE", "Maximum Combined COD Price" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIMPLE", "Simple Mails" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_DESC", "Looting options for player mails containing loot and money. Mails may be defined as simple based on the subject and text." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_ENABLE", "Enable Simple Mail Looting" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_DELETE", "Delete Simple Mails After" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_SUB_T", "Subject Conditions" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_SUB_DESC", "For a mail to be defined as a simple mail the subject word count must be less than or equal to N. Mails with auto-return key words define below will not be defined as a simple mail." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_SUB_COUNT", "Subject Word Count" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_BODY_T", "Body Conditions" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_BODY_DESC", "For a mail to be defined as simple the mail body word count must be less than or equal to N." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_SIM_BODY_COUNT", "Body Word Count" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_TITLE", "Auto Return Mailers" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_DECT", "MailLooter Auto-return Mail Detection" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_DECT_DESC", "There may be up to 6 different Auto-return words or phases. If any of the them match the subject of a mail then MailLooter considers the mail as Auto-return mail. When matching a mail's subject: Capitalization is ignored, punctuation is ignored, and extra spaces are ignored. Setting the 'Subject N' field to blank to disable that field. MailLooter will either ignore or auto-return matching mails." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_EXAMPLES", "Examples:" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_EX1_T", "Using another Addon for Mail Auto-Returning" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_EX1_DESC", "Make sure 'Enable Mail Auto-Returning' is NOT checked. Set the 6 'Subject N' fields to match the auto-return detection used by your other Addon. MailLooter will ignore the detected auto-return mails so not to interfer with the other mail auto-return addon." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_EX2_T", "Using MailLooter for Mail Auto-Returning" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_EX2_DESC", "Make sure 'Enable Mail Auto-Returning' is checked. Set the 6 'Subject N' fields to the subjects that you want to have auto-returned. MailLooter will now auto-return detected mails during the looting procedure." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_EX3_T", "Don't Do Any Mail Auto-Returning" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_EX3_DESC", "Make sure 'Enable Mail Auto-Returning' is NOT checked. Set the 6 'Subject N' fields to be blank. MailLooter will not auto-return any mail, and no mail will be assumed to be for auto-returning." ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_SUBJECT", "Subject <<1>>:" ) ZO_CreateStringId( "SI_MAILLOOTER_SETTINGS_AR_ENABLE", "Enable Mail Auto-Returning" ) -- Loot Fragment ZO_CreateStringId( "SI_MAILLOOTER_LOOT_HEADER_TYPE", "Type" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_HEADER_NAME", "Name" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_HEADER_VALUE", "Value" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MT_UNKNOWN", "Unknown Mail Type" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MT_AVA", "AvA Mail" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MT_HIRELING", "Hireling Mail" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MT_STORE", "Guild Store Mail" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MT_COD", "COD Mail" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MT_RETURNED", "Returned Mail" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MT_SIMPLE", "Player Mail" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MT_COD_RECEIPT", "COD Receipt Mail" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MN_MONEY", "Money" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MN_COD_PAYMENT", "COD Payment" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MN_RETURNED", "Returned Money" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_MN_SIMPLE", "Simple Mail" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_EXTRA_FROM", "From: " ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_EXTRA_RETURNED_FROM", "|cFF0000Returned|r from: " ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_EXTRA_EXPIRED", "|cFF0000Expired|r" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_EXTRA_CANCELED", "|cFF0000Cancelled|r" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_FOOTER_LOOTED", "Looted" ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_FOOTER_INV_SPACE", "Inventory Space: " ) ZO_CreateStringId( "SI_MAILLOOTER_LOOT_FOOTER_INV_RES4", "(%d Reserved)" )
vim.g.undotree_CustomUndotreeCmd = 'new' vim.g.undotree_CustomDiffpanelCmd = '"' vim.g.undotree_HelpLine = 0 fey.tools_undo_tree.undo_tree = function() if vim.g.loaded_undotree == nil then vim.cmd'packadd undotree' end vim.fn['undotree#UndotreeShow']() vim.fn['undotree#UndotreeFocus']() vim.bo.filetype = 'undotree' end vim.cmd'nnoremap <silent> <Leader>u <cmd>lua fey.tools_undo_tree.undo_tree()<CR>' vim.cmd'autocmd FileType undotree nnoremap <silent> <buffer> <C-W>c <cmd>UndotreeHide<CR>'
return require("base58.init")
help( [[ This module loads R 3.2.0 into the environment ]]) whatis("Loads R, a tool for statistical analysis") local version = "3.2.0" local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/R/"..version prepend_path("PATH", pathJoin(base, "bin")) prepend_path("LD_LIBRARY_PATH", pathJoin(base, "lib64")) load('libicu/4.2.1') family('R')
local class = class("QuitRoomConfirmLayer") class.__index = class local Constants = require "Constants" local SoundApp = require "SoundApp" local Settings = require "Settings" local protoTypes = require "ProtoTypes" function class.extend(target) local t = tolua.getpeer(target) if not t then t = {} tolua.setpeer(target, t) end setmetatable(t, class) return target end function class.create(delegate, hasStarted) cc.SpriteFrameCache:getInstance():addSpriteFrames("buttons.plist") cc.SpriteFrameCache:getInstance():addSpriteFrames("room.plist") local self = class.extend(cc.Layer:create()) if nil ~= self then local function onNodeEvent(event) if "enter" == event then self:onEnter() elseif "exit" == event then self:onExit() end end self:registerScriptHandler(onNodeEvent) end self.delegate = delegate -- CommonLayer self.m_hasStarted = hasStarted self:setOutSideListener() self:resetLayer() self:showLayer() return self end function class:onEnter() end function class:onExit() end function class:cancelExit () SoundApp.playEffect("sounds/main/click.mp3") self:closeLayer() end function class:confirmExit () SoundApp.playEffect("sounds/main/click.mp3") local tableInfo = self.delegate.agent.tableInfo local seatInfo = tableInfo.gameInfo.seatInfo if seatInfo == nil then self.delegate:quitGame() end self:closeLayer() end function class:showExitScreen () local bg = self.m_bg local text = " 游戏未开始,是否提前退出?房间创建后保留十分钟,十分钟后无人在房间则提前关闭,房间内有人则最多保留8小时。十分钟内点击房间列表加入游戏。" local lbTxt = Constants.getLabel(text, Constants.kSystemBoldName, 48,cc.p(427.5, 380), bg) lbTxt:setWidth(675) :setColor(cc.c3b(93, 61, 4)) local menu = bg.menu local item = Constants.getMenuItem("rm_back") item:addTo(menu) :setPosition(258.5, 106) :registerScriptTapHandler(function() self:cancelExit() end) item = Constants.getMenuItem("confirm") item:addTo(menu) :setPosition(596.5, 106) :registerScriptTapHandler(function() self:confirmExit() end) end function class:showStartScreen () local bg = self.m_bg local text = " 游戏已开始,是否提前投票退出?退出后房间关闭并统计分数,点击确定后开始投票表决。" local lbTxt = Constants.getLabel(text, Constants.kSystemBoldName, 48,cc.p(427.5, 380), bg) lbTxt:setWidth(675) :setColor(cc.c3b(93, 61, 4)) local menu = bg.menu local item = Constants.getMenuItem("rm_back") item:addTo(menu) :setPosition(258.5, 106) :registerScriptTapHandler(function() self:cancelExit() end) item = Constants.getMenuItem("confirm") item:addTo(menu) :setPosition(596.5, 106) :registerScriptTapHandler(function() self.delegate:voteExit() self:removeFromParent() end) end function class:resetLayer() local winSize = display.size self.bgShadow = Constants.get9Sprite("bg_vague.png", cc.size(winSize.width, winSize.height), cc.p(winSize.width * 0.5 , winSize.height * 0.5), self) self.bgShadow:setOpacity(0) local bg = Constants.get9Sprite("bg_dialog_simple.png", cc.size(855, 654), cc.p(winSize.width * 0.5 , winSize.height * 0.5), self) bg:setScale(0) self.m_bg = bg local menu = cc.Menu:create() menu:setPosition(0,0) :addTo(bg) bg.menu = menu if self.m_hasStarted then self:showStartScreen() else self:showExitScreen() end end function class:setOutSideListener() local listener = cc.EventListenerTouchOneByOne:create() listener:setSwallowTouches(true) listener:setEnabled(true) listener:registerScriptHandler(function(touch, event) return true end, cc.Handler.EVENT_TOUCH_BEGAN) local eventDispatcher = self:getEventDispatcher() eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self) return true end function class:showLayer() self.m_bg:stopAllActions() self.m_bg:runAction(cc.EaseElasticOut:create(cc.ScaleTo:create(0.3, 1), 0.8)) self.bgShadow:stopAllActions() self.bgShadow:runAction(cc.FadeTo:create(0.2, 255)) end function class:closeLayer() self.m_bg:stopAllActions() self.m_bg:runAction(cc.Sequence:create(cc.ScaleTo:create(0.1, 0), cc.CallFunc:create(function() self:removeFromParent() end))) self.bgShadow:stopAllActions() self.bgShadow:runAction(cc.FadeTo:create(0.2, 0)) end return class
-- 2,<cd src && awk -f ../data.awk africa antarctica asia australasia europe northamerica southamerica etcetera factory return { africa={ ["Africa/Algiers"]=false, ["Atlantic/Cape_Verde"]=false, ["Africa/Ndjamena"]=false, ["Africa/Abidjan"]=false, ["Africa/Bamako"]="Africa/Abidjan", ["Africa/Banjul"]="Africa/Abidjan", ["Africa/Conakry"]="Africa/Abidjan", ["Africa/Dakar"]="Africa/Abidjan", ["Africa/Freetown"]="Africa/Abidjan", ["Africa/Lome"]="Africa/Abidjan", ["Africa/Nouakchott"]="Africa/Abidjan", ["Africa/Ouagadougou"]="Africa/Abidjan", ["Atlantic/St_Helena"]="Africa/Abidjan", ["Africa/Cairo"]=false, ["Africa/Accra"]=false, ["Africa/Bissau"]=false, ["Africa/Nairobi"]=false, ["Africa/Addis_Ababa"]="Africa/Nairobi", ["Africa/Asmara"]="Africa/Nairobi", ["Africa/Dar_es_Salaam"]="Africa/Nairobi", ["Africa/Djibouti"]="Africa/Nairobi", ["Africa/Kampala"]="Africa/Nairobi", ["Africa/Mogadishu"]="Africa/Nairobi", ["Indian/Antananarivo"]="Africa/Nairobi", ["Indian/Comoro"]="Africa/Nairobi", ["Indian/Mayotte"]="Africa/Nairobi", ["Africa/Monrovia"]=false, ["Africa/Tripoli"]=false, ["Indian/Mauritius"]=false, ["Africa/Casablanca"]=false, ["Africa/El_Aaiun"]=false, ["Africa/Maputo"]=false, ["Africa/Blantyre"]="Africa/Maputo", ["Africa/Bujumbura"]="Africa/Maputo", ["Africa/Gaborone"]="Africa/Maputo", ["Africa/Harare"]="Africa/Maputo", ["Africa/Kigali"]="Africa/Maputo", ["Africa/Lubumbashi"]="Africa/Maputo", ["Africa/Lusaka"]="Africa/Maputo", ["Africa/Windhoek"]=false, ["Africa/Lagos"]=false, ["Africa/Bangui"]="Africa/Lagos", ["Africa/Brazzaville"]="Africa/Lagos", ["Africa/Douala"]="Africa/Lagos", ["Africa/Kinshasa"]="Africa/Lagos", ["Africa/Libreville"]="Africa/Lagos", ["Africa/Luanda"]="Africa/Lagos", ["Africa/Malabo"]="Africa/Lagos", ["Africa/Niamey"]="Africa/Lagos", ["Africa/Porto-Novo"]="Africa/Lagos", ["Indian/Reunion"]=false, ["Africa/Sao_Tome"]=false, ["Indian/Mahe"]=false, ["Africa/Johannesburg"]=false, ["Africa/Maseru"]="Africa/Johannesburg", ["Africa/Mbabane"]="Africa/Johannesburg", ["Africa/Khartoum"]=false, ["Africa/Juba"]=false, ["Africa/Tunis"]=false, }, antarctica={ ["Antarctica/Casey"]=false, ["Antarctica/Davis"]=false, ["Antarctica/Mawson"]=false, ["Indian/Kerguelen"]=false, ["Antarctica/DumontDUrville"]=false, ["Antarctica/Syowa"]=false, ["Antarctica/Troll"]=false, ["Antarctica/Vostok"]=false, ["Antarctica/Rothera"]=false, }, asia={ ["Asia/Kabul"]=false, ["Asia/Yerevan"]=false, ["Asia/Baku"]=false, ["Asia/Dhaka"]=false, ["Asia/Thimphu"]=false, ["Indian/Chagos"]=false, ["Asia/Brunei"]=false, ["Asia/Yangon"]=false, ["Asia/Shanghai"]=false, ["Asia/Urumqi"]=false, ["Asia/Hong_Kong"]=false, ["Asia/Taipei"]=false, ["Asia/Macau"]=false, ["Asia/Nicosia"]=false, ["Asia/Famagusta"]=false, ["Europe/Nicosia"]="Asia/Nicosia", ["Asia/Tbilisi"]=false, ["Asia/Dili"]=false, ["Asia/Kolkata"]=false, ["Asia/Jakarta"]=false, ["Asia/Pontianak"]=false, ["Asia/Makassar"]=false, ["Asia/Jayapura"]=false, ["Asia/Tehran"]=false, ["Asia/Baghdad"]=false, ["Asia/Jerusalem"]=false, ["Asia/Tokyo"]=false, ["Asia/Amman"]=false, ["Asia/Almaty"]=false, ["Asia/Qyzylorda"]=false, ["Asia/Qostanay"]=false, ["Asia/Aqtobe"]=false, ["Asia/Aqtau"]=false, ["Asia/Atyrau"]=false, ["Asia/Oral"]=false, ["Asia/Bishkek"]=false, ["Asia/Seoul"]=false, ["Asia/Pyongyang"]=false, ["Asia/Beirut"]=false, ["Asia/Kuala_Lumpur"]=false, ["Asia/Kuching"]=false, ["Indian/Maldives"]=false, ["Asia/Hovd"]=false, ["Asia/Ulaanbaatar"]=false, ["Asia/Choibalsan"]=false, ["Asia/Kathmandu"]=false, ["Asia/Karachi"]=false, ["Asia/Gaza"]=false, ["Asia/Hebron"]=false, ["Asia/Manila"]=false, ["Asia/Qatar"]=false, ["Asia/Bahrain"]="Asia/Qatar", ["Asia/Riyadh"]=false, ["Asia/Aden"]="Asia/Riyadh", ["Asia/Kuwait"]="Asia/Riyadh", ["Asia/Singapore"]=false, ["Asia/Colombo"]=false, ["Asia/Damascus"]=false, ["Asia/Dushanbe"]=false, ["Asia/Bangkok"]=false, ["Asia/Phnom_Penh"]="Asia/Bangkok", ["Asia/Vientiane"]="Asia/Bangkok", ["Asia/Ashgabat"]=false, ["Asia/Dubai"]=false, ["Asia/Muscat"]="Asia/Dubai", ["Asia/Samarkand"]=false, ["Asia/Tashkent"]=false, ["Asia/Ho_Chi_Minh"]=false, }, australasia={ ["Australia/Darwin"]=false, ["Australia/Perth"]=false, ["Australia/Eucla"]=false, ["Australia/Brisbane"]=false, ["Australia/Lindeman"]=false, ["Australia/Adelaide"]=false, ["Australia/Hobart"]=false, ["Australia/Currie"]=false, ["Australia/Melbourne"]=false, ["Australia/Sydney"]=false, ["Australia/Broken_Hill"]=false, ["Australia/Lord_Howe"]=false, ["Antarctica/Macquarie"]=false, ["Indian/Christmas"]=false, ["Indian/Cocos"]=false, ["Pacific/Fiji"]=false, ["Pacific/Gambier"]=false, ["Pacific/Marquesas"]=false, ["Pacific/Tahiti"]=false, ["Pacific/Guam"]=false, ["Pacific/Saipan"]="Pacific/Guam", ["Pacific/Tarawa"]=false, ["Pacific/Enderbury"]=false, ["Pacific/Kiritimati"]=false, ["Pacific/Majuro"]=false, ["Pacific/Kwajalein"]=false, ["Pacific/Chuuk"]=false, ["Pacific/Pohnpei"]=false, ["Pacific/Kosrae"]=false, ["Pacific/Nauru"]=false, ["Pacific/Noumea"]=false, ["Pacific/Auckland"]=false, ["Pacific/Chatham"]=false, ["Antarctica/McMurdo"]="Pacific/Auckland", ["Pacific/Rarotonga"]=false, ["Pacific/Niue"]=false, ["Pacific/Norfolk"]=false, ["Pacific/Palau"]=false, ["Pacific/Port_Moresby"]=false, ["Pacific/Bougainville"]=false, ["Pacific/Pitcairn"]=false, ["Pacific/Pago_Pago"]=false, ["Pacific/Midway"]="Pacific/Pago_Pago", ["Pacific/Apia"]=false, ["Pacific/Guadalcanal"]=false, ["Pacific/Fakaofo"]=false, ["Pacific/Tongatapu"]=false, ["Pacific/Funafuti"]=false, ["Pacific/Wake"]=false, ["Pacific/Efate"]=false, ["Pacific/Wallis"]=false, }, europe={ ["Europe/London"]=false, ["Europe/Jersey"]="Europe/London", ["Europe/Guernsey"]="Europe/London", ["Europe/Isle_of_Man"]="Europe/London", ["Europe/Dublin"]=false, ["WET"]=false, ["CET"]=false, ["MET"]=false, ["EET"]=false, ["Europe/Tirane"]=false, ["Europe/Andorra"]=false, ["Europe/Vienna"]=false, ["Europe/Minsk"]=false, ["Europe/Brussels"]=false, ["Europe/Sofia"]=false, ["Europe/Prague"]=false, ["Europe/Copenhagen"]=false, ["Atlantic/Faroe"]=false, ["America/Danmarkshavn"]=false, ["America/Scoresbysund"]=false, ["America/Godthab"]=false, ["America/Thule"]=false, ["Europe/Tallinn"]=false, ["Europe/Helsinki"]=false, ["Europe/Mariehamn"]="Europe/Helsinki", ["Europe/Paris"]=false, ["Europe/Berlin"]=false, ["Europe/Busingen"]="Europe/Zurich", ["Europe/Gibraltar"]=false, ["Europe/Athens"]=false, ["Europe/Budapest"]=false, ["Atlantic/Reykjavik"]=false, ["Europe/Rome"]=false, ["Europe/Vatican"]="Europe/Rome", ["Europe/San_Marino"]="Europe/Rome", ["Europe/Riga"]=false, ["Europe/Vaduz"]="Europe/Zurich", ["Europe/Vilnius"]=false, ["Europe/Luxembourg"]=false, ["Europe/Malta"]=false, ["Europe/Chisinau"]=false, ["Europe/Monaco"]=false, ["Europe/Amsterdam"]=false, ["Europe/Oslo"]=false, ["Arctic/Longyearbyen"]="Europe/Oslo", ["Europe/Warsaw"]=false, ["Europe/Lisbon"]=false, ["Atlantic/Azores"]=false, ["Atlantic/Madeira"]=false, ["Europe/Bucharest"]=false, ["Europe/Kaliningrad"]=false, ["Europe/Moscow"]=false, ["Europe/Simferopol"]=false, ["Europe/Astrakhan"]=false, ["Europe/Volgograd"]=false, ["Europe/Saratov"]=false, ["Europe/Kirov"]=false, ["Europe/Samara"]=false, ["Europe/Ulyanovsk"]=false, ["Asia/Yekaterinburg"]=false, ["Asia/Omsk"]=false, ["Asia/Barnaul"]=false, ["Asia/Novosibirsk"]=false, ["Asia/Tomsk"]=false, ["Asia/Novokuznetsk"]=false, ["Asia/Krasnoyarsk"]=false, ["Asia/Irkutsk"]=false, ["Asia/Chita"]=false, ["Asia/Yakutsk"]=false, ["Asia/Vladivostok"]=false, ["Asia/Khandyga"]=false, ["Asia/Sakhalin"]=false, ["Asia/Magadan"]=false, ["Asia/Srednekolymsk"]=false, ["Asia/Ust-Nera"]=false, ["Asia/Kamchatka"]=false, ["Asia/Anadyr"]=false, ["Europe/Belgrade"]=false, ["Europe/Ljubljana"]="Europe/Belgrade", ["Europe/Podgorica"]="Europe/Belgrade", ["Europe/Sarajevo"]="Europe/Belgrade", ["Europe/Skopje"]="Europe/Belgrade", ["Europe/Zagreb"]="Europe/Belgrade", ["Europe/Bratislava"]="Europe/Prague", ["Europe/Madrid"]=false, ["Africa/Ceuta"]=false, ["Atlantic/Canary"]=false, ["Europe/Stockholm"]=false, ["Europe/Zurich"]=false, ["Europe/Istanbul"]=false, ["Asia/Istanbul"]="Europe/Istanbul", ["Europe/Kiev"]=false, ["Europe/Uzhgorod"]=false, ["Europe/Zaporozhye"]=false, }, northamerica={ ["EST"]=false, ["MST"]=false, ["HST"]=false, ["EST5EDT"]=false, ["CST6CDT"]=false, ["MST7MDT"]=false, ["PST8PDT"]=false, ["America/New_York"]=false, ["America/Chicago"]=false, ["America/North_Dakota/Center"]=false, ["America/North_Dakota/New_Salem"]=false, ["America/North_Dakota/Beulah"]=false, ["America/Denver"]=false, ["America/Los_Angeles"]=false, ["America/Juneau"]=false, ["America/Sitka"]=false, ["America/Metlakatla"]=false, ["America/Yakutat"]=false, ["America/Anchorage"]=false, ["America/Nome"]=false, ["America/Adak"]=false, ["Pacific/Honolulu"]=false, ["America/Phoenix"]=false, ["America/Boise"]=false, ["America/Indiana/Indianapolis"]=false, ["America/Indiana/Marengo"]=false, ["America/Indiana/Vincennes"]=false, ["America/Indiana/Tell_City"]=false, ["America/Indiana/Petersburg"]=false, ["America/Indiana/Knox"]=false, ["America/Indiana/Winamac"]=false, ["America/Indiana/Vevay"]=false, ["America/Kentucky/Louisville"]=false, ["America/Kentucky/Monticello"]=false, ["America/Detroit"]=false, ["America/Menominee"]=false, ["America/St_Johns"]=false, ["America/Goose_Bay"]=false, ["America/Halifax"]=false, ["America/Glace_Bay"]=false, ["America/Moncton"]=false, ["America/Blanc-Sablon"]=false, ["America/Toronto"]=false, ["America/Thunder_Bay"]=false, ["America/Nipigon"]=false, ["America/Rainy_River"]=false, ["America/Atikokan"]=false, ["America/Winnipeg"]=false, ["America/Regina"]=false, ["America/Swift_Current"]=false, ["America/Edmonton"]=false, ["America/Vancouver"]=false, ["America/Dawson_Creek"]=false, ["America/Fort_Nelson"]=false, ["America/Creston"]=false, ["America/Pangnirtung"]=false, ["America/Iqaluit"]=false, ["America/Resolute"]=false, ["America/Rankin_Inlet"]=false, ["America/Cambridge_Bay"]=false, ["America/Yellowknife"]=false, ["America/Inuvik"]=false, ["America/Whitehorse"]=false, ["America/Dawson"]=false, ["America/Cancun"]=false, ["America/Merida"]=false, ["America/Matamoros"]=false, ["America/Monterrey"]=false, ["America/Mexico_City"]=false, ["America/Ojinaga"]=false, ["America/Chihuahua"]=false, ["America/Hermosillo"]=false, ["America/Mazatlan"]=false, ["America/Bahia_Banderas"]=false, ["America/Tijuana"]=false, ["America/Nassau"]=false, ["America/Barbados"]=false, ["America/Belize"]=false, ["Atlantic/Bermuda"]=false, ["America/Costa_Rica"]=false, ["America/Havana"]=false, ["America/Santo_Domingo"]=false, ["America/El_Salvador"]=false, ["America/Guatemala"]=false, ["America/Port-au-Prince"]=false, ["America/Tegucigalpa"]=false, ["America/Jamaica"]=false, ["America/Martinique"]=false, ["America/Managua"]=false, ["America/Panama"]=false, ["America/Cayman"]="America/Panama", ["America/Puerto_Rico"]=false, ["America/Miquelon"]=false, ["America/Grand_Turk"]=false, }, southamerica={ ["America/Argentina/Buenos_Aires"]=false, ["America/Argentina/Cordoba"]=false, ["America/Argentina/Salta"]=false, ["America/Argentina/Tucuman"]=false, ["America/Argentina/La_Rioja"]=false, ["America/Argentina/San_Juan"]=false, ["America/Argentina/Jujuy"]=false, ["America/Argentina/Catamarca"]=false, ["America/Argentina/Mendoza"]=false, ["America/Argentina/San_Luis"]=false, ["America/Argentina/Rio_Gallegos"]=false, ["America/Argentina/Ushuaia"]=false, ["America/Aruba"]="America/Curacao", ["America/La_Paz"]=false, ["America/Noronha"]=false, ["America/Belem"]=false, ["America/Santarem"]=false, ["America/Fortaleza"]=false, ["America/Recife"]=false, ["America/Araguaina"]=false, ["America/Maceio"]=false, ["America/Bahia"]=false, ["America/Sao_Paulo"]=false, ["America/Campo_Grande"]=false, ["America/Cuiaba"]=false, ["America/Porto_Velho"]=false, ["America/Boa_Vista"]=false, ["America/Manaus"]=false, ["America/Eirunepe"]=false, ["America/Rio_Branco"]=false, ["America/Santiago"]=false, ["America/Punta_Arenas"]=false, ["Pacific/Easter"]=false, ["Antarctica/Palmer"]=false, ["America/Bogota"]=false, ["America/Curacao"]=false, ["America/Lower_Princes"]="America/Curacao", ["America/Kralendijk"]="America/Curacao", ["America/Guayaquil"]=false, ["Pacific/Galapagos"]=false, ["Atlantic/Stanley"]=false, ["America/Cayenne"]=false, ["America/Guyana"]=false, ["America/Asuncion"]=false, ["America/Lima"]=false, ["Atlantic/South_Georgia"]=false, ["America/Paramaribo"]=false, ["America/Port_of_Spain"]=false, ["America/Anguilla"]="America/Port_of_Spain", ["America/Antigua"]="America/Port_of_Spain", ["America/Dominica"]="America/Port_of_Spain", ["America/Grenada"]="America/Port_of_Spain", ["America/Guadeloupe"]="America/Port_of_Spain", ["America/Marigot"]="America/Port_of_Spain", ["America/Montserrat"]="America/Port_of_Spain", ["America/St_Barthelemy"]="America/Port_of_Spain", ["America/St_Kitts"]="America/Port_of_Spain", ["America/St_Lucia"]="America/Port_of_Spain", ["America/St_Thomas"]="America/Port_of_Spain", ["America/St_Vincent"]="America/Port_of_Spain", ["America/Tortola"]="America/Port_of_Spain", ["America/Montevideo"]=false, ["America/Caracas"]=false, }, etcetera={ ["Etc/GMT"]=false, ["Etc/UTC"]=false, ["GMT"]="Etc/GMT", ["Etc/Universal"]="Etc/UTC", ["Etc/Zulu"]="Etc/UTC", ["Etc/Greenwich"]="Etc/GMT", ["Etc/GMT-0"]="Etc/GMT", ["Etc/GMT+0"]="Etc/GMT", ["Etc/GMT0"]="Etc/GMT", ["Etc/GMT-14"]=false, ["Etc/GMT-13"]=false, ["Etc/GMT-12"]=false, ["Etc/GMT-11"]=false, ["Etc/GMT-10"]=false, ["Etc/GMT-9"]=false, ["Etc/GMT-8"]=false, ["Etc/GMT-7"]=false, ["Etc/GMT-6"]=false, ["Etc/GMT-5"]=false, ["Etc/GMT-4"]=false, ["Etc/GMT-3"]=false, ["Etc/GMT-2"]=false, ["Etc/GMT-1"]=false, ["Etc/GMT+1"]=false, ["Etc/GMT+2"]=false, ["Etc/GMT+3"]=false, ["Etc/GMT+4"]=false, ["Etc/GMT+5"]=false, ["Etc/GMT+6"]=false, ["Etc/GMT+7"]=false, ["Etc/GMT+8"]=false, ["Etc/GMT+9"]=false, ["Etc/GMT+10"]=false, ["Etc/GMT+11"]=false, ["Etc/GMT+12"]=false, }, factory={ ["Factory"]=false, }, }
----------------------------------- -- Area: Southern San d'Oria -- NPC: Baunise -- Involved in Quest: A Knight's Test -- !pos -55 -8 -32 230 ------------------------------------- require("scripts/globals/settings") require("scripts/globals/keyitems") local ID = require("scripts/zones/Southern_San_dOria/IDs") ----------------------------------- function onTrade(player, npc, trade) end function onTrigger(player, npc) if (player:hasKeyItem(tpz.ki.BOOK_OF_TASKS) and player:hasKeyItem(tpz.ki.BOOK_OF_THE_WEST) == false) then player:startEvent(634) else player:showText(npc, 7817)-- nothing to report end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if (csid == 634) then player:addKeyItem(tpz.ki.BOOK_OF_THE_WEST) player:messageSpecial(ID.text.KEYITEM_OBTAINED, tpz.ki.BOOK_OF_THE_WEST) end end
-- local function dmg(ply, dmginfo) -- if (!IsValid(ply) || !ply:IsPlayer() || !ply:Alive()) then return end -- Проверка на то, что игрок доступен для установки параметров -- if (ply.ClothingSystemPlayerBase == nil) then return end -- Проверка на существования базы у игрока -- if (!ply.ClothingSystemPlayerIsSpawn) then return end -- Проверка на то, что игрок заспавнился -- local items = ClothingSystem:PlayerGetItems(ply) -- Получение классов всей одежды игрока -- -- Проверка массива на пустоту -- if (!ClothingSystem:TableIsEmpty(items)) then -- -- Цикл по всем элементам массива -- for _, class in pairs(items) do -- local item = list.Get("clothing_system")[class] -- Получаем объект по классу -- -- Если есть параметр, выполняем -- if (item.TakeDamageSystem) then -- -- Проверка на существование массива с параметрами дамага -- if (item.TakesDamagePercent && istable(item.TakesDamagePercent) && table.Count(item.TakesDamagePercent) != 0) then -- -- Цикл по всем элементам массива -- for DamageType, value in pairs (item.TakesDamagePercent) do -- -- Если есть маска, выполняем -- if (item.GasMask) then -- if (dmginfo:IsDamageType(DMG_RADIATION)) then -- if (ply.ClothingSystemPlaysoundData != nil) then -- if (ply.ClothingSystemPlaysoundData['RadiationSound']) then -- if (istable(ply.ClothingSystemPlaysoundData['RadiationSound'][1])) then -- local ln = table.Count(ply.ClothingSystemPlaysoundData['RadiationSound'][1]) -- Число элементов массива -- local p = ply.ClothingSystemPlaysoundData['RadiationSound'][1][math.random(1, ln)] -- Вылавливание рандомного элемента массива -- ply:EmitSound(p, 75, 100, 1, CHAN_AUTO ) -- Проигрыванеи звука -- else -- ply:EmitSound(ply.ClothingSystemPlaysoundData['RadiationSound'][1], 75, 100, 0.5, CHAN_AUTO ) -- Проигрыванеи звука -- end -- end -- end -- dmginfo:ScaleDamage(0) -- end -- end -- end -- end -- end -- end -- end -- end -- ClothingSystem.Tools.Hooks.AddHook("EntityTakeDamage", dmg)
includeFile("tatooine/alkhara_bandit_king.lua") includeFile("tatooine/alkhara_bandit.lua") includeFile("tatooine/alkhara_champion.lua") includeFile("tatooine/alkhara_lieutenant.lua") includeFile("tatooine/armodragon.lua") includeFile("tatooine/anim_kahn.lua") includeFile("tatooine/arosp_eslykewa.lua") includeFile("tatooine/awwaschlu_witubrarq.lua") includeFile("tatooine/bantha_e3.lua") includeFile("tatooine/bantha.lua") includeFile("tatooine/bantha_matriarch.lua") includeFile("tatooine/beissa.lua") includeFile("tatooine/binna_jode.lua") includeFile("tatooine/bith_musician.lua") includeFile("tatooine/blight_boar.lua") includeFile("tatooine/boba_fett.lua") includeFile("tatooine/bocatt.lua") includeFile("tatooine/bomarr_monk.lua") includeFile("tatooine/bonecracker_bantha.lua") includeFile("tatooine/borra_setas.lua") includeFile("tatooine/boshek.lua") includeFile("tatooine/bounty_hunter.lua") includeFile("tatooine/brea_tonnika.lua") includeFile("tatooine/bull_bantha.lua") includeFile("tatooine/bull_ronto.lua") includeFile("tatooine/cannibal_dewback.lua") includeFile("tatooine/cannibal.lua") includeFile("tatooine/canyon_krayt_dragon.lua") includeFile("tatooine/capt_loftus.lua") includeFile("tatooine/cave_beetle.lua") includeFile("tatooine/coris_mao.lua") includeFile("tatooine/crimelord.lua") includeFile("tatooine/crix_yarrow.lua") includeFile("tatooine/cu_pa.lua") includeFile("tatooine/darklighter_guard.lua") includeFile("tatooine/death_kreetle.lua") includeFile("tatooine/dede_chesmi.lua") includeFile("tatooine/da_la_socuna.lua") includeFile("tatooine/dervish.lua") includeFile("tatooine/desert_demon_bodyguard.lua") includeFile("tatooine/desert_demon_brawler.lua") includeFile("tatooine/desert_demon_leader.lua") includeFile("tatooine/desert_demon.lua") includeFile("tatooine/desert_demon_marksman.lua") includeFile("tatooine/desert_eopie.lua") includeFile("tatooine/desert_razorback.lua") includeFile("tatooine/desert_squill.lua") includeFile("tatooine/desert_swooper_leader.lua") includeFile("tatooine/desert_swooper.lua") includeFile("tatooine/dewback.lua") includeFile("tatooine/dim_u_abbot.lua") includeFile("tatooine/dim_u_bantha.lua") includeFile("tatooine/dim_u_cleric.lua") includeFile("tatooine/dim_u_monastery_nun.lua") includeFile("tatooine/dim_u_monk.lua") includeFile("tatooine/dim_u_preacher.lua") includeFile("tatooine/dim_u_priestess.lua") includeFile("tatooine/diseased_bocatt.lua") includeFile("tatooine/doikk_nats.lua") includeFile("tatooine/domestic_eopie.lua") includeFile("tatooine/dooho.lua") includeFile("tatooine/dorn_gestros.lua") includeFile("tatooine/dragonet.lua") includeFile("tatooine/drooling_nuna.lua") includeFile("tatooine/droopy_mccool.lua") includeFile("tatooine/dune_bantha.lua") includeFile("tatooine/dune_beetle.lua") includeFile("tatooine/dune_lizard.lua") includeFile("tatooine/dune_sea_krayt_dragon.lua") includeFile("tatooine/dune_sea_krayt_queen.lua") includeFile("tatooine/dune_stalker_brawler.lua") includeFile("tatooine/dune_stalker_enforcer.lua") includeFile("tatooine/dune_stalker_leader.lua") includeFile("tatooine/dune_stalker.lua") includeFile("tatooine/dune_stalker_marksman.lua") includeFile("tatooine/dune_stalker_scavenger.lua") includeFile("tatooine/dwarf_bantha.lua") includeFile("tatooine/dwarf_eopie.lua") includeFile("tatooine/dwarf_nuna.lua") includeFile("tatooine/ecik.lua") includeFile("tatooine/ecoospoo.lua") includeFile("tatooine/egach_iromn.lua") includeFile("tatooine/eight_lom.lua") includeFile("tatooine/eopie_herdmaster.lua") includeFile("tatooine/eopie.lua") includeFile("tatooine/ev_9d9.lua") includeFile("tatooine/evil_hermit.lua") includeFile("tatooine/evil_nomad.lua") includeFile("tatooine/evil_settler.lua") includeFile("tatooine/fawn_moonraiser.lua") includeFile("tatooine/female_mountain_squill.lua") includeFile("tatooine/feral_bantha.lua") includeFile("tatooine/figrin_dan.lua") includeFile("tatooine/freelance_pilot.lua") includeFile("tatooine/fugitive.lua") includeFile("tatooine/furious_ronto.lua") includeFile("tatooine/gamorrean_guard.lua") includeFile("tatooine/gerak_vurtimis.lua") includeFile("tatooine/gerrik_lond.lua") includeFile("tatooine/giant_canyon_krayt_dragon.lua") includeFile("tatooine/giant_sand_beetle.lua") includeFile("tatooine/giant_worrt.lua") includeFile("tatooine/giko.lua") includeFile("tatooine/gold_two.lua") includeFile("tatooine/gorg_glutton.lua") includeFile("tatooine/gorg.lua") includeFile("tatooine/greater_desert_womp_rat.lua") includeFile("tatooine/great_squill.lua") includeFile("tatooine/grizzled_dewback.lua") includeFile("tatooine/gunham.lua") includeFile("tatooine/gunrunner.lua") includeFile("tatooine/hermit.lua") includeFile("tatooine/huff_guard.lua") includeFile("tatooine/insane_kitonak.lua") includeFile("tatooine/ithorian_musician.lua") includeFile("tatooine/jabba_rancor.lua") includeFile("tatooine/jabba_the_hutt.lua") includeFile("tatooine/jabba_assassin.lua") includeFile("tatooine/jabba_compound_guard.lua") includeFile("tatooine/jabba_enforcer.lua") includeFile("tatooine/jabba_henchman.lua") includeFile("tatooine/jabba_medic.lua") includeFile("tatooine/jabba_scout.lua") includeFile("tatooine/jabba_swooper_leader.lua") includeFile("tatooine/jabba_swooper.lua") includeFile("tatooine/jabba_thief.lua") includeFile("tatooine/jabba_thug.lua") includeFile("tatooine/jawa_avenger.lua") includeFile("tatooine/jawa_engineer.lua") includeFile("tatooine/jawa_healer.lua") includeFile("tatooine/jawa_henchman.lua") includeFile("tatooine/jawa_leader.lua") includeFile("tatooine/jawa.lua") includeFile("tatooine/jawa_protector.lua") includeFile("tatooine/jawa_smuggler.lua") includeFile("tatooine/jawa_thief.lua") includeFile("tatooine/jawa_warlord.lua") includeFile("tatooine/jundland_eopie.lua") includeFile("tatooine/juvenile_canyon_krayt_dragon.lua") includeFile("tatooine/kardeer.lua") includeFile("tatooine/krayt_dragon_adolescent.lua") includeFile("tatooine/krayt_dragon_ancient.lua") includeFile("tatooine/krayt_dragon_grand.lua") includeFile("tatooine/kreetle.lua") includeFile("tatooine/kreetle_swarmling.lua") includeFile("tatooine/kwin_moonraiser.lua") includeFile("tatooine/large_cave_beetle.lua") includeFile("tatooine/large_rock_beetle.lua") includeFile("tatooine/large_sand_beetle.lua") includeFile("tatooine/le_repair_droid.lua") includeFile("tatooine/lesser_bocatt.lua") includeFile("tatooine/lesser_desert_womp_rat.lua") includeFile("tatooine/lesser_dewback.lua") includeFile("tatooine/liar_one.lua") includeFile("tatooine/liar_two.lua") includeFile("tatooine/malignant_squill.lua") includeFile("tatooine/malakili.lua") includeFile("tatooine/marco_vahn.lua") includeFile("tatooine/max_rebo.lua") includeFile("tatooine/mebi_axane.lua") includeFile("tatooine/mikos_denari.lua") includeFile("tatooine/minor_worrt.lua") includeFile("tatooine/moisture_farmer.lua") includeFile("tatooine/moisture_thief.lua") includeFile("tatooine/mos_eisley_police_lieutenant.lua") includeFile("tatooine/mos_eisley_police_lieutenant_rebel.lua") includeFile("tatooine/mos_eisley_police_officer.lua") includeFile("tatooine/mos_eisley_police_officer_rebel.lua") includeFile("tatooine/mos_eisley_police_sergeant.lua") includeFile("tatooine/mos_eisley_police_sergeant_rebel.lua") includeFile("tatooine/mos_entha_police_officer.lua") includeFile("tatooine/mos_entha_police_officer_rebel.lua") includeFile("tatooine/mos_espa_police_officer.lua") includeFile("tatooine/mos_espa_police_officer_rebel.lua") includeFile("tatooine/mos_taike_veteran_guard.lua") includeFile("tatooine/mos_taike_veteran_guard_rebel.lua") includeFile("tatooine/mos_taike_cantina_owner.lua") includeFile("tatooine/mos_taike_cantina_owner_rebel.lua") includeFile("tatooine/mound_mite.lua") includeFile("tatooine/mountain_dewback.lua") includeFile("tatooine/mountain_squill_guardian.lua") includeFile("tatooine/mountain_squill_hunter.lua") includeFile("tatooine/mountain_squill.lua") includeFile("tatooine/mountain_worrt.lua") includeFile("tatooine/mutant_womp_rat.lua") includeFile("tatooine/nalan_cheel.lua") includeFile("tatooine/nomad.lua") includeFile("tatooine/oola.lua") includeFile("tatooine/ovo.lua") includeFile("tatooine/osweri_hepa.lua") includeFile("tatooine/overkreetle.lua") includeFile("tatooine/plague_rat.lua") includeFile("tatooine/plague_victim.lua") includeFile("tatooine/poki_wirqi.lua") includeFile("tatooine/prost_roberts.lua") includeFile("tatooine/protocol_droid_3po_red.lua") includeFile("tatooine/ra7_bug_droid.lua") includeFile("tatooine/rale_moonraiser.lua") includeFile("tatooine/razorback_felspur.lua") includeFile("tatooine/rel_keteris.lua") includeFile("tatooine/rill.lua") includeFile("tatooine/rock_beetle.lua") includeFile("tatooine/rockmite.lua") includeFile("tatooine/rodian_clan_captain.lua") includeFile("tatooine/rodian_clan_medic.lua") includeFile("tatooine/rodian_clan_warchief.lua") includeFile("tatooine/rodian_gladiator.lua") includeFile("tatooine/rogue_bantha.lua") includeFile("tatooine/ronto.lua") includeFile("tatooine/salacious_crumb.lua") includeFile("tatooine/sand_beetle.lua") includeFile("tatooine/sandreaver.lua") includeFile("tatooine/sango_rond.lua") includeFile("tatooine/scyk.lua") includeFile("tatooine/sennex_guard.lua") includeFile("tatooine/sennex_hunter.lua") includeFile("tatooine/sennex_lookout.lua") includeFile("tatooine/sennex_slavemaster.lua") includeFile("tatooine/sennex_slaver.lua") includeFile("tatooine/sennex_warder.lua") includeFile("tatooine/senni_tonnika.lua") includeFile("tatooine/settler.lua") includeFile("tatooine/sevorrt.lua") includeFile("tatooine/shamdon_kree.lua") includeFile("tatooine/slaver.lua") includeFile("tatooine/slum_rat.lua") includeFile("tatooine/smuggler_pilot.lua") includeFile("tatooine/sol_windtide.lua") includeFile("tatooine/space_rebel_tier3_beissa.lua") includeFile("tatooine/spice_fiend.lua") includeFile("tatooine/squatter.lua") includeFile("tatooine/squill.lua") includeFile("tatooine/stanic_wavingstar.lua") includeFile("tatooine/stormtrooper_dewback.lua") includeFile("tatooine/sunstained_dune_lizard.lua") includeFile("tatooine/swarming_lesser_dewback.lua") includeFile("tatooine/swooper.lua") includeFile("tatooine/sy_snootles.lua") includeFile("tatooine/talon_karrde.lua") includeFile("tatooine/tatooine_militiaman.lua") includeFile("tatooine/tatooine_mynock.lua") includeFile("tatooine/tech_mor.lua") includeFile("tatooine/tedn_dahai.lua") includeFile("tatooine/tempest_rill.lua") includeFile("tatooine/the_mos_taike_mayor.lua") includeFile("tatooine/thivauwrai_aphereef.lua") includeFile("tatooine/tormented_bocatt.lua") includeFile("tatooine/trace_lyson.lua") includeFile("tatooine/trandosian_slavemaster.lua") includeFile("tatooine/trandosian_slaver.lua") includeFile("tatooine/tusken_avenger.lua") includeFile("tatooine/tusken_bantha.lua") includeFile("tatooine/tusken_berserker.lua") includeFile("tatooine/tusken_blood_champion.lua") includeFile("tatooine/tusken_brute.lua") includeFile("tatooine/tusken_captain.lua") includeFile("tatooine/tusken_carnage_champion.lua") includeFile("tatooine/tusken_chief.lua") includeFile("tatooine/tusken_child.lua") includeFile("tatooine/tusken_commoner.lua") includeFile("tatooine/tusken_death_hunter.lua") includeFile("tatooine/tusken_elite_guard.lua") includeFile("tatooine/tusken_executioner.lua") includeFile("tatooine/tusken_fighter.lua") includeFile("tatooine/tusken_flesh_hunter.lua") includeFile("tatooine/tusken_gore_chief.lua") includeFile("tatooine/tusken_guard.lua") includeFile("tatooine/tusken_king.lua") includeFile("tatooine/tusken_observer.lua") includeFile("tatooine/tusken_raid_champion.lua") includeFile("tatooine/tusken_raider.lua") includeFile("tatooine/tusken_raid_hunter.lua") includeFile("tatooine/tusken_raid_leader.lua") includeFile("tatooine/tusken_savage.lua") includeFile("tatooine/tusken_sniper.lua") includeFile("tatooine/tusken_torture_lord.lua") includeFile("tatooine/tusken_wanderer.lua") includeFile("tatooine/tusken_warlord.lua") includeFile("tatooine/tusken_war_master.lua") includeFile("tatooine/tusken_warrior.lua") includeFile("tatooine/tusken_witch_doctor.lua") includeFile("tatooine/tusken_woman.lua") includeFile("tatooine/ty_vila.lua") includeFile("tatooine/valarian_assassin.lua") includeFile("tatooine/valarian_compound_guard.lua") includeFile("tatooine/valarian_enforcer.lua") includeFile("tatooine/valarian_henchman.lua") includeFile("tatooine/valarian_scout.lua") includeFile("tatooine/valarian_swooper_leader.lua") includeFile("tatooine/valarian_swooper.lua") includeFile("tatooine/valarian_thief.lua") includeFile("tatooine/valarian_thug.lua") includeFile("tatooine/variegated_womp_rat.lua") includeFile("tatooine/volatile_scyk.lua") includeFile("tatooine/wald.lua") includeFile("tatooine/wandering_kitonak.lua") includeFile("tatooine/wasteland_cu_pa.lua") includeFile("tatooine/water_bug.lua") includeFile("tatooine/weequay_captain.lua") includeFile("tatooine/weequay_champion.lua") includeFile("tatooine/weequay_soldier.lua") includeFile("tatooine/weequay_thug.lua") includeFile("tatooine/weequay_zealot.lua") includeFile("tatooine/wild_dune_boar.lua") includeFile("tatooine/windom_starkiller.lua") includeFile("tatooine/womp_rat.lua") includeFile("tatooine/wonderous_cu_pa.lua") includeFile("tatooine/worrt.lua") includeFile("tatooine/worrt_gutbuster.lua") includeFile("tatooine/wuher.lua") includeFile("tatooine/young_mos_taike_guard.lua") includeFile("tatooine/young_mountain_squill.lua") includeFile("tatooine/zucca_boar.lua")
local t = require('luatest') local g = t.group() local helper = require('test.helper') local assert_failure = helper.assert_failure local assert_failure_equals = helper.assert_failure_equals local function f() end local function f_with_error() error('This is an error', 2) end local function f_with_table_error() local ts = {__tostring = function() return 'This table has error!' end} error(setmetatable({this_table="has error"}, ts)) end function g.test_assert_error() local x = 1 -- f_with_error generates an error local has_error = not pcall(f_with_error, x) t.assert_equals(has_error, true) -- f does not generate an error has_error = not pcall(f, x) t.assert_equals(has_error, false) -- t.assert_error is happy with f_with_error t.assert_error(f_with_error, x) -- t.assert_error is unhappy with f assert_failure_equals("Expected an error when calling function but no error generated", t.assert_error, f, x) -- multiple arguments local function f_with_multi_arguments(a,b,c) if a == b and b == c then return end error("three arguments not equal") end t.assert_error(f_with_multi_arguments, 1, 1, 3) t.assert_error(f_with_multi_arguments, 1, 3, 1) t.assert_error(f_with_multi_arguments, 3, 1, 1) assert_failure_equals("Expected an error when calling function but no error generated", t.assert_error, f_with_multi_arguments, 1, 1, 1) -- error generated as table t.assert_error(f_with_table_error, 1) end function g.test_assert_errorMsgContains() local x = 1 assert_failure(t.assert_error_msg_contains, 'toto', f, x) t.assert_error_msg_contains('is an err', f_with_error, x) t.assert_error_msg_contains('This is an error', f_with_error, x) assert_failure(t.assert_error_msg_contains, ' This is an error', f_with_error, x) assert_failure(t.assert_error_msg_contains, 'This .. an error', f_with_error, x) t.assert_error_msg_contains("50", function() error(500) end) -- error message is a table which converts to a string t.assert_error_msg_contains('This table has error', f_with_table_error, 1) end function g.test_assert_error_msg_equals() local x = 1 assert_failure(t.assert_error_msg_equals, 'toto', f, x) assert_failure(t.assert_error_msg_equals, 'is an err', f_with_error, x) -- expected string, receive string t.assert_error_msg_equals('This is an error', f_with_error, x) -- expected table, receive table t.assert_error_msg_equals({1,2,3,4}, function() error({1,2,3,4}) end) -- expected complex table, receive complex table t.assert_error_msg_equals({ details = {1,2,3,4}, id = 10, }, function() error({ details = {1,2,3,4}, id = 10, }) end) -- expected string, receive number converted to string t.assert_error_msg_equals("500", function() error(500, 2) end) -- one space added at the beginning assert_failure(t.assert_error_msg_equals, ' This is an error', f_with_error, x) -- pattern does not work assert_failure(t.assert_error_msg_equals, 'This .. an error', f_with_error, x) -- expected string, receive table which converts to string t.assert_error_msg_equals("This table has error!", f_with_table_error, x) -- expected table, no error generated assert_failure(t.assert_error_msg_equals, {1}, function() return "{1}" end, 33) -- expected table, error generated as string, no match assert_failure(t.assert_error_msg_equals, {1}, function() error("{1}") end, 33) end function g.test_assert_errorMsgMatches() local x = 1 assert_failure(t.assert_error_msg_matches, 'toto', f, x) assert_failure(t.assert_error_msg_matches, 'is an err', f_with_error, x) t.assert_error_msg_matches('This is an error', f_with_error, x) t.assert_error_msg_matches('This is .. error', f_with_error, x) t.assert_error_msg_matches(".*500$", function() error(500, 2) end) t.assert_error_msg_matches("This .* has error!", f_with_table_error, 33) -- one space added to cause failure assert_failure(t.assert_error_msg_matches, ' This is an error', f_with_error, x) assert_failure(t.assert_error_msg_matches, "This", f_with_table_error, 33) end
local module = {} local HttpService = game:GetService("HttpService") local TeleportService = game:GetService("TeleportService") local network module.priority = 3 local guildRankValues = { member = 1; officer = 2; general = 3; leader = 4; } local function getRankNumberFromRank(rank) return guildRankValues[rank] end local DATA_MODIFY_COOLDOWN = 5 local guildNameStore = game:GetService("DataStoreService"):GetDataStore("guildNames") local guildPurchases = { createGuild = 1e6; level = { [1] = { members = 10; }; [2] = { members = 20; cost = 10e6, }; [3] = { members = 40; cost = 100e6, }; [4] = { members = 80; cost = 1e9, }; [5] = { members = 140; cost = 10e9, } } }; local guildDataFolder = Instance.new("Folder") guildDataFolder.Name = "guildDataFolder" guildDataFolder.Parent = game.ReplicatedStorage local messagingService = game:GetService("MessagingService") local guildDataCache = {} local guildMessagingConnections = {} --[[ sendGuildMessage(guid, { messageType = "data_update"; key = key; value = value; sender = player.Name; senderId = player.userId; }) ]] -- Update cache and replicated storage entry with new data. local function guildDataUpdated(guid, guildDataEntry) guildDataCache[guid] = guildDataEntry local dataFolderEntry = guildDataFolder:FindFirstChild(guid) if dataFolderEntry == nil then dataFolderEntry = Instance.new("StringValue") dataFolderEntry.Name = guid dataFolderEntry.Parent = guildDataFolder end dataFolderEntry.Value = HttpService:JSONEncode(guildDataEntry) for i,player in pairs(game.Players:GetPlayers()) do if player:FindFirstChild("guildId") and player.guildId.Value == guid then network:fireClient("signal_guildDataUpdated", player, guildDataEntry) end end end local function guildMessageRecieved(guid, message) local data = message.Data local timestamp = message.Sent -- Message to guild members. if data.messageType == "chat" then local sender = data.sender local message = data.message for i,player in pairs(game.Players:GetPlayers()) do if player:FindFirstChild("guildId") and player.guildId.Value == guid then local chatMessage = "[Guild] " .. sender .. ": "..data.message network:fireClient("signal_alertChatMessage", player, {Text = chatMessage; Font = Enum.Font.SourceSansBold; Color = Color3.fromRGB(160, 116, 255)} ) end end elseif data.messageType == "data_update" then local guildData = guildDataCache[guid] if guildData then guildData.lastUpdated = timestamp guildData[data.key] = data.value guildDataUpdated(guid, guildData) end elseif data.messageType == "member_data" then -- soft update for things like leveling up, changing class local guildData = guildDataCache[guid] if guildData then local userId = data.userId guildData.members[tostring(userId)] = data.memberData guildDataUpdated(guid, guildData) end end -- allow an optional notice to all guild members via chat if data.notice then local sender = data.sender or "???" -- "Out" means don't include the message on the server that sent it -- (for level up message) if game.Players:FindFirstChild(sender) == nil or not data.notice.Out then if data.notice.Color then data.notice.Color = Color3.fromRGB(data.notice.Color.r, data.notice.Color.g, data.notice.Color.b) end for i,player in pairs(game.Players:GetPlayers()) do if player:FindFirstChild("guildId") and player.guildId.Value == guid then -- data.notice: {Text = chatMessage; Font = Enum.Font.SourceSansBold; Color = Color3.fromRGB(145, 71, 255)} network:fireClient("signal_alertChatMessage", player, data.notice) end end end end end -- Send a message via messaging service. local function sendGuildMessage(guid, messageData) local messageSuccess, messageError = pcall(function() messagingService:PublishAsync("guild-"..guid, messageData) end) return messageSuccess, messageError end local function sendGuildChat(player, message) local guildId = player:FindFirstChild("guildId") and player.guildId.Value if guildId and guildId ~= "" then local filteredText local filterSuccess, filterError = pcall(function() filteredText = game.Chat:FilterStringForBroadcast(message, player) end) if not filterSuccess then return false, "filter error: "..filterError elseif #filteredText > 200 then return false, "Message may not be longer than 200 characters." elseif #filteredText < 2 then return false, "Message must be at least 2 characters long" end return sendGuildMessage(guildId, { messageType = "chat"; sender = player.Name; senderId = player.userId; message = filteredText; }) else return false, "You're not in a guild!" end end -- Used to add/remove a player from a guild. local function setPlayerGuildId(player, guildId) if player:FindFirstChild("guildId") then player.guildId.Value = guildId or "" end local guildFounderData = network:invoke("getPlayerData", player) if guildFounderData and guildFounderData.globalData then guildFounderData.globalData.guildId = guildId guildFounderData.nonSerializeData.setPlayerData("globalData", guildFounderData.globalData) end end -- Fetches guild data, returns cache data if available. local function getGuildData(player, guid) if guid == "" then return nil end local guildDataEntry = guildDataCache[guid] if guildDataEntry then return guildDataEntry else local guildDataStore = game:GetService("DataStoreService"):GetDataStore("guild", guid) local dataSuccess, dataError = pcall(function() guildDataEntry = guildDataStore:GetAsync("guildData") end) if dataSuccess then if guildDataEntry then -- if this guild no longer has me as a member, purge my id local members = guildDataEntry.members if members and (not members[tostring(player.UserId)]) then setPlayerGuildId(player, nil) return nil end -- okay, we're good to go, return properly guildDataUpdated(guid, guildDataEntry) return guildDataEntry else -- guild no longer exists, purge my id setPlayerGuildId(player, nil) return nil end else network:invoke("reportError", player, "warning", "Guild Get Fail: ".. (dataError or "???")) end end end local function playerRequest_getGuildData(requestingPlayer, player) local guildId = player:FindFirstChild("guildId") if not guildId then return false, "No guildId found." end return getGuildData(player, guildId.Value) end -- Fetches a player's data entry within a guild, if it exists local function getGuildPlayerData(player, guid) --[[ userId = partyMemberPlayer.userId; level = partyMemberPlayer.level.Value; class = partyMemberPlayer.class.Value; rank = (partyMemberData.isLeader and "leader") or "member"; founder = true; points = 0; ]] local guildData = getGuildData(player, guid) if guildData == nil then return false, "Guild data not found." end local members = guildData.members local guildPlayerData = members[tostring(player.userId)] if guildPlayerData == nil then return false, "Not a member of guild." end return guildPlayerData end local function playerRequest_getGuildMemberData(requestingPlayer, player) local guildId = player:FindFirstChild("guildId") if not guildId then return false, "No guildId found." end return getGuildPlayerData(player, guildId.Value) end -- Master function used for donating to the guild, other actions local function modifyGuildDataValue(player, guid, action, key, value, atomic, notice) action = action or "set" local guildData = getGuildData(player, guid) if guildData == nil then return false, "No guild data." end if os.time() - guildData.lastModified >= DATA_MODIFY_COOLDOWN then local guildDataStore = game:GetService("DataStoreService"):GetDataStore("guild", guid) local canceledReason local dataSuccess, dataError = pcall(function() guildDataStore:UpdateAsync("guildData", function(existingData) if atomic then -- if guildData.lastModified == existingData.lastModified then -- allow messagingService "soft updates" to sneak in through here guildData.lastModified = os.time() existingData = guildData -- else -- canceledReason = "Atomic transaction out of sync" -- return nil -- end end if action == "increment" then existingData[key] = (existingData[key] or 0) + value elseif action == "set" then existingData[key] = value else canceledReason = "Invalid operation" return nil end guildDataUpdated(guid, existingData) return existingData end) end) if not dataSuccess then network:invoke("reportError", player, "warning", "Failed to update guild value: "..dataError) return false, "DataStore error" elseif canceledReason then return false, canceledReason else return true, "Success!" end else return false, "Try again later." end end -- Removes guild data cache and closes subscriptions. local function unsubscribeGuildData(guid) guildDataCache[guid] = nil if guildMessagingConnections[guid] then guildMessagingConnections[guid]:Disconnect() guildMessagingConnections[guid] = nil end local dataFolderEntry = guildDataFolder:FindFirstChild(guid) if dataFolderEntry then dataFolderEntry:Destroy() end end -- Build a subscription for a guild. local function subscribeGuild(guid) if guildMessagingConnections[guid] then return false, "Guild subscription already exists." end if guildDataCache[guid] == nil then return false, "Guild data does not exist." end local subscribeSuccess, subscribeError = pcall(function() local subscription = messagingService:SubscribeAsync("guild-"..guid, function(message) guildMessageRecieved(guid, message) end) guildMessagingConnections[guid] = subscription end) if subscribeSuccess then return true, "Subscribed!" else return false, subscribeError end end -- Fires whenever a player joins or leaves the server or a guild, used to subscribe/unsubscribe. local function playerGuildChanged(player, guid) local activeGuilds = {} if guid then activeGuilds[guid] = true end -- Player needs a guild but guild data is not active? if guid and not guildDataCache[guid] then getGuildData(player, guid) end -- Cycle through all other players and see which guilds are active. for i, otherPlayer in pairs(game.Players:GetPlayers()) do if otherPlayer ~= player and otherPlayer:FindFirstChild("teleporting") == nil and otherPlayer:FindFirstChild("DataSaveFailed") == nil then local guildTag = otherPlayer:FindFirstChild("guildId") if guildTag and guildTag.Value ~= "" then activeGuilds[guildTag.Value] = true end end end -- Cycle through guild cache and remove subscriptions for un-used guilds. for guildId, guildData in pairs(guildDataCache) do if not activeGuilds[guildId] then unsubscribeGuildData(guildId) end end -- Cycle through active guilds and build subscription for any guilds not yet initiated. for guildId, active in pairs(activeGuilds) do if active and guildMessagingConnections[guildId] == nil then -- Check to confirm cached data exists (it should!) local guildData = guildDataCache[guildId] if guildData then local subscriptionSuccess, subscriptionError = subscribeGuild(guid) if not subscriptionSuccess then network:invoke("reportError", player, "warning", "Failed to build guild subscription: "..subscriptionError) end else network:invoke("reportError", player, "critical", "Attempt to build subscription for guild with no data!") return end end end end -- Slap 'em with that guildId tag local function onPlayerAdded(player) if player:FindFirstChild("guildId") == nil then local guildTag = Instance.new("StringValue") guildTag.Name = "guildId" guildTag.Parent = player end end for i,player in pairs(game.Players:GetPlayers()) do onPlayerAdded(player) end game.Players.PlayerAdded:connect(onPlayerAdded) local function onPlayerLoaded(player, playerData) -- Tag the player's guild so others can see it. local guildTag = player.guildId local globalData = playerData.globalData if globalData and globalData.guildId then local guid = globalData.guildId local guildData = getGuildData(player, guid) if guildData then -- Check that the player is still a member of the guild. if guildData.members[tostring(player.userId)] then guildTag.Value = guid playerGuildChanged(player, guid) -- The Msg. subscription isn't made until this point. else -- Removed from guild. local updatedPlayerData = network:invoke("getPlayerData", player) if updatedPlayerData.globalData then updatedPlayerData.globalData.guildId = nil updatedPlayerData.nonSerializeData.setPlayerData("globalData", updatedPlayerData.globalData) end network:fireClient("alertPlayerNotification", player, {text = "You were removed from your guild."; textColor3 = Color3.fromRGB(255, 57, 60)}, 10) playerGuildChanged(player, nil) end end end -- hook up some connections player.level.Changed:connect(function() local guid = player.guildId.Value if guid ~= "" then local guildData = getGuildData(player, guid) if guildData then local guildMemberData = guildData.members[tostring(player.userId)] if guildMemberData then guildMemberData.level = player.level.Value guildMemberData.lastUpdate = os.time(); local notice = {Text = player.Name .. " has reached Lvl."..player.level.Value.."!"; Font = "SourceSansBold"; Color = {r=161, g=132, b=194}; Out = true} sendGuildMessage(guid, { messageType = "member_data"; memberData = guildMemberData; sender = player.Name; senderId = player.userId; notice = notice; }) end end end end) player.class.Changed:connect(function() local guid = player.guildId.Value if guid ~= "" then local guildData = getGuildData(player, guid) if guildData then local guildMemberData = guildData.members[tostring(player.userId)] if guildMemberData then guildMemberData.class = player.class.Value local notice = {Text = player.Name .. " has become a "..player.class.Value.."!"; Font = "SourceSansBold"; Color = {r=161, g=132, b=194}} sendGuildMessage(guid, { messageType = "member_data"; memberData = guildMemberData; sender = player.Name; senderId = player.userId; notice = notice; }) end end end end) end local function onPlayerRemoving(player) playerGuildChanged(player, nil) end game.Players.PlayerRemoving:connect(onPlayerRemoving) -- Creating a guild. local function playerRequest_createGuild(player, properties) local playerData = network:invoke("getPlayerData", player) if playerData == nil then return false, "no player data." end local globalData = playerData.globalData if globalData == nil then return false, "no global data." end local isStudio = game:GetService("RunService"):IsStudio() -- davidii doesn't think this is necessary a'ight? who cares if they make a lot of guilds -- if globalData.lastCreatedGuild and (os.time() - globalData.lastCreatedGuild <= 60 * 60 * 48) and (not isStudio) then -- return false, "You must wait 48 hours before founding a new guild." -- end if player:FindFirstChild("teleporting") or player:FindFirstChild("DataSaveFail") then return false, "There is an issue accessing your data, please try again later." end if globalData.guildId then return false, "Already in a guild." end local partyData = network:invoke("getPartyDataByPlayer", player) if partyData == nil then return false, "Only the leader of a full party can found a guild." end local numPlayers = 0 local guildFounders = {} for i, partyMemberData in pairs(partyData.members) do numPlayers = numPlayers + 1 local partyMemberPlayer = partyMemberData.player local partyMemberPlayerData = network:invoke("getPlayerData", partyMemberPlayer) if partyMemberPlayerData == nil or partyMemberPlayerData.globalData == nil then return false, "A player in your party is missing data." elseif partyMemberPlayerData.globalData.guildId then return false, "A player in your party is already in a guild." elseif partyMemberData.isLeader and partyMemberPlayer ~= player then return false, "Only the leader of a full party can found a guild." elseif partyMemberPlayer.level.Value < 10 then return false, "All players in your party must be at least Lvl. 10 to found a guild." end guildFounders[tostring(partyMemberPlayer.userId)] = { lastUpdate = os.time(); name = partyMemberPlayer.Name; userId = partyMemberPlayer.userId; level = partyMemberPlayer.level.Value; class = partyMemberPlayer.class.Value; rank = (partyMemberData.isLeader and "leader") or "member"; founder = true; points = 0; } end if (numPlayers ~= 6) and (not isStudio) then return false, "There must be exactly six members in your party to found a guild." end local guildCreationCost = guildPurchases.createGuild if playerData.gold >= guildCreationCost then local guildId = HttpService:GenerateGUID(false) -- Run the desired guild name through the Roblox Filter. local desiredGuildName = properties.name if properties.name == nil then return false, "No guild name provided." elseif typeof(properties.name) ~= "string" then return false, "Guild name must be a string." end local filteredText local filterSuccess, filterError = pcall(function() filteredText = game.Chat:FilterStringForBroadcast(desiredGuildName, player) end) if not filterSuccess then return false, "filter error: "..filterError elseif not filteredText or string.find(filteredText, "#") then return false, "Guild name rejected by Roblox filter." elseif #filteredText > 20 then return false, "Guild name must be no more than 20 characters long." elseif #filteredText < 3 then return false, "Guild name must be at least 3 characters long." end -- Check the guild name database(TM) for a conflict. local isNameTaken local nameCheckSuccess, nameCheckError = pcall(function() isNameTaken = guildNameStore:GetAsync(filteredText) end) if not nameCheckSuccess then network:invoke("reportError", player, "warning", "Guild namestore fail: ".. (nameCheckError or "???")) return false, "Guild name lookup failed due to DataStore error." elseif isNameTaken then return false, "That Guild name is already taken." end local guildName = filteredText -- now we jump into the meat. local guildDataStore = game:GetService("DataStoreService"):GetDataStore("guild", guildId) local abortDueToExistingData local guildData local guildSuccessfullyCreated -- oopsies required from here on out. local function applyGuildIdToFounders(guildIdToApply) for userId, userData in pairs(guildFounders) do local guildFounder = game.Players:GetPlayerByUserId(tonumber(userId)) if guildFounder and guildFounder.Parent then setPlayerGuildId(guildFounder, guildIdToApply) end end end -- apply guild membership to all other users (this happens before yielding update async - may cause problems). applyGuildIdToFounders(guildId) local dataSuccess, dataError = pcall(function() guildDataStore:UpdateAsync("guildData", function(existingData) -- In the astronomically rare chance a guild with this data already exists. if existingData ~= nil then abortDueToExistingData = true return nil end -- We're good. guildData = { name = guildName; previousNames = {}; members = guildFounders; lastModified = os.time(); id = guildId; version = 1; level = 1; points = 0; bank = 0; } -- we did it!. guildSuccessfullyCreated = true return guildData end) end) if not dataSuccess then network:invoke("reportError", player, "warning", "Guild DataStore fail: ".. (dataError or "???")) applyGuildIdToFounders(nil) -- oopsie! return false, "DataStore failure!" elseif abortDueToExistingData then applyGuildIdToFounders(nil) -- oopsie! return false, "Guild ID already exists!" end -- final stretch. if guildSuccessfullyCreated then local globalData = playerData.globalData if globalData == nil or player.Parent == nil or player:FindFirstChild("teleporting") or player:FindFirstChild("DataSaveFail") then applyGuildIdToFounders(nil) -- oopsie! return false, "Issue with founder data" end -- take money and apply guild leader data. globalData.lastCreatedGuild = os.time() playerData.nonSerializeData.incrementPlayerData("gold",-guildCreationCost,"guild:create") globalData.guildId = guildId playerData.nonSerializeData.setPlayerData("globalData", globalData) -- run some really scary code that claims the guild name. spawn(function() local i = 1 local guildNameClaimed local guildNameClaimError repeat local guildSuccess, guildError = pcall(function() guildNameStore:SetAsync(filteredText, true) end) if guildSuccess then guildNameClaimed = true else network:invoke("reportError", player, "warning", "Guild name claim fail: ".. (guildError or "???")) wait(2^i) end until guildNameClaimed end) playerGuildChanged(player, guildId) -- we did it guys. return true, "A new guild has been born!" else applyGuildIdToFounders(nil) -- oopsie! return false, "Guild failed to be created for some reason" end else return false, "You don't have enough money to found a guild." end end local pendingGuildInvites = {} local function playerRequest_invitePlayerToGuild(player, invitedPlayer) if invitedPlayer.guildId.Value ~= "" then return false, "Player is already in a guild." end local guid = player.guildId.Value local guildPlayerData = getGuildPlayerData(player, guid) if guildPlayerData == nil then return false, "Could not find your guild." elseif guildPlayerData.rank ~= "leader" and guildPlayerData.rank ~= "officer" and guildPlayerData.rank ~= "general" then return false, "You do not have permission to invite new members." end local guildData = getGuildData(player, guid) if guildData == nil then return false, "Could not find guild data." end local memberCap = guildPurchases.level[guildData.level].members local existingMembers = 0 for userId, userData in pairs(guildData.members) do existingMembers = existingMembers + 1 end if existingMembers >= memberCap then return false, "Your guild is already at full capacity." end local playerResponse = network:invokeClient("serverPrompt_playerInvitedToServer", invitedPlayer, player, guid) if playerResponse then -- check nothing changed if player and player.Parent and invitedPlayer and invitedPlayer.Parent and invitedPlayer.guildId.Value == "" then local guildData = getGuildData(player, guid) local guildPlayerData = getGuildPlayerData(player, guid) if guildData and guildPlayerData then -- add player to the guild local guildMembers = guildData.members -- failsafe to allow someone to be re-invited if their lost their guild id for whatever reason guildMembers[tostring(invitedPlayer.userId)] = guildMembers[tostring(invitedPlayer.userId)] or { lastUpdate = os.time(); name = invitedPlayer.Name; userId = invitedPlayer.userId; level = invitedPlayer.level.Value; class = invitedPlayer.class.Value; rank = "member"; points = 0; } local notice = {Text = invitedPlayer.Name .. " has joined the Guild. (Invited by "..player.Name..")"; Font = "SourceSansBold"; Color = {r=161, g=132, b=194}} local success, reason = modifyGuildDataValue(player, guid, "set", "members", guildMembers, true, notice) if success then sendGuildMessage(guid, { messageType = "member_data"; memberData = guildMembers[tostring(invitedPlayer.userId)]; sender = player.Name; senderId = player.userId; notice = notice; }) setPlayerGuildId(invitedPlayer, guid) guildDataUpdated(guid, guildData) end return success, reason end else return false, "Something changed during the player input and they can no longer be added." end else return false, "Player did not accept the guild invite." end end local function playerRequest_exileUserIdFromGuild(player, exiledUserId) local guid = player.guildId.Value local guildPlayerData = getGuildPlayerData(player, guid) if not guildPlayerData then return false, "Could not find your guild." end local guildData = getGuildData(player, guid) if guildData == nil then return false, "Guild data not found" end local exiledGuildPlayerData = guildData.members[tostring(exiledUserId)] if exiledGuildPlayerData == nil then return false, "Player is not in your guild." end local exiledUsername = exiledGuildPlayerData.name local playerGuildRankValue = guildRankValues[guildPlayerData.rank] local exiledGuildRankValue = guildRankValues[exiledGuildPlayerData.rank] if playerGuildRankValue <= exiledGuildRankValue then return false, "You cannot exile someone who does not rank beneath you." elseif exiledGuildPlayerData.founder and guildPlayerData.rank ~= "leader" then return false, "Only the leader can exile a founding member." end local guildMembers = guildData.members guildMembers[tostring(exiledUserId)] = nil; local notice = {Text = exiledUsername .. " has been exiled from the guild by "..player.Name.."!"; Font = "SourceSansBold"; Color = {r=161, g=132, b=194}} local success, reason = modifyGuildDataValue(player, guid, "set", "members", guildMembers, true, notice) if success then local exiledPlayer = game.Players:GetPlayerByUserId(exiledUserId) -- ez boot if they are in the same server. if exiledPlayer then setPlayerGuildId(exiledPlayer, nil) end -- booted sendGuildMessage(guid, { messageType = "member_data"; memberData = nil; sender = player.Name; senderId = player.userId; notice = notice; }) guildDataUpdated(guid, guildData) return true, "Successfully exiled player." else return false, "Failed to exile: "..reason end end local function abandonGuild(player, guid) local success, problem = pcall(function() setPlayerGuildId(player, nil) local guildDataStore = game:GetService("DataStoreService"):GetDataStore("guild", guid) local guildData = guildDataStore:RemoveAsync("guildData") guildNameStore:RemoveAsync(guildData.name) end) return success, problem end local function playerRequest_leaveMyGuild(player, confirmAbandon) local guid = player.guildId.Value local guildPlayerData = getGuildPlayerData(player, guid) if guildPlayerData == nil then return false, "Could not find your guild." end local guildData = getGuildData(player, guid) if guildData == nil then return false, "Guild data not found" end if guildPlayerData.rank == "leader" then local memberCount = 0 for _, member in pairs(guildData.members) do memberCount = memberCount + 1 end if memberCount > 1 then return false, "If you wish to abandon your guild, you must first exile all other members." end if confirmAbandon then return abandonGuild(player, guid) end return false, "confirmAbandon" end local exiledUserId = player.userId local guildMembers = guildData.members guildMembers[tostring(exiledUserId)] = nil; local notice = {Text = player.Name .. " has left the guild."; Font = "SourceSansBold"; Color = {r=161, g=132, b=194}} local success, reason = modifyGuildDataValue(player, guid, "set", "members", guildMembers, true, notice) if success then -- alert other servers that the guild has been left sendGuildMessage(guid, { messageType = "member_data"; memberData = nil; sender = player.Name; senderId = player.userId; notice = notice; }) setPlayerGuildId(player, nil) guildDataUpdated(guid, guildData) return true, "Successfully left the guild." else return false, "Failed to leave: "..reason end end local function playerRequest_changeUserIdRankValue(player, rankedUserId, newRankValue) local guid = player.guildId.Value local guildPlayerData = getGuildPlayerData(player, guid) if not guildPlayerData then return false, "Could not find your guild." end local guildData = getGuildData(player, guid) if guildData == nil then return false, "Guild data not found" end local rankedGuildPlayerData = guildData.members[tostring(rankedUserId)] if rankedGuildPlayerData == nil then return false, "Player is not in your guild." end local rankedUsername = rankedGuildPlayerData.name local playerGuildRankValue = guildRankValues[guildPlayerData.rank] local rankedGuildRankValue = guildRankValues[rankedGuildPlayerData.rank] local isChangingLeaders = (playerGuildRankValue == 4) and (newRankValue == 4) if (newRankValue >= playerGuildRankValue) and (not isChangingLeaders) then return false, "You cannot rank someone to a rank that is not beneath you." elseif rankedGuildRankValue >= playerGuildRankValue then return false, "You cannot change the rank of someone who does not rank beneath you." end local newRank = "member" for rankName, rankValue in pairs(guildRankValues) do if newRankValue == rankValue then newRank = rankName end end local guildMembers = guildData.members guildMembers[tostring(rankedUserId)].rank = newRank local notice = {Text = rankedUsername .. "'s rank has been changed to "..newRank.." by "..player.Name.."."; Font = "SourceSansBold"; Color = {r=161, g=132, b=194}} if isChangingLeaders then guildMembers[tostring(player.UserId)].rank = 3 notice.Text = player.Name.." has stepped down as leader, appointing "..rankedUsername.." as the new leader!" end local success, reason = modifyGuildDataValue(player, guid, "set", "members", guildMembers, true, notice) if success then guildDataUpdated(guid, guildData) -- tell other servers about the promotion sendGuildMessage(guid, { messageType = "member_data"; memberData = guildMembers[tostring(rankedUserId)]; sender = player.Name; senderId = player.userId; notice = notice; }) return true, "Successfully ranked player." else return false, "Failed to rank: "..reason end end local guildHallPlaceId = 4653017449 local hallLocationsByPlaceId = { [2064647391] = "mushtown", [2119298605] = "nilgarf", [2470481225] = "warriorStronghold", [3112029149] = "treeOfLife", [2546689567] = "portFidelio", } local properNamesByHallLocation = { ["mushtown"] = "Mushtown", ["nilgarf"] = "Nilgarf", ["warriorStronghold"] = "Warrior Stronghold", ["treeOfLife"] = "Tree of Life", ["portFidelio"] = "Port Fidelio", } local function getHallLocationFromPlaceId() return hallLocationsByPlaceId[game.PlaceId] end local function getPlaceIdFromHallLocation(hallLocationIn) for placeId, hallLocation in pairs(hallLocationsByPlaceId) do if hallLocation == hallLocationIn then return placeId end end return nil end local function playerRequest_getPlaceIdFromHallLocation(player, hallLocation) return getPlaceIdFromHallLocation(hallLocation) end local function resetGuildHallServer() -- TODO: broadcast a message which boots everyone from guild hall in event of update, move, etc. end local function changeGuildHallLocation(player) local guildId = player:FindFirstChild("guildId") if not guildId then return false, "No guildId." end local guid = guildId.Value local guildData = getGuildData(player, guid) if not guildData then return false, "No guildData." end local memberData = getGuildPlayerData(player, guid) if not memberData then return false, "No memberData." end if memberData.rank ~= "leader" then return false, "Not leader." end local hallLocation = getHallLocationFromPlaceId() if not hallLocation then return false, "No guild hall at this location." end local notice if guildData.hallLocation then notice = {Text = "The Guild Hall has been moved from "..properNamesByHallLocation[guildData.hallLocation].." to "..properNamesByHallLocation[hallLocation].."!"} else notice = {Text = "The Guild Hall has been established at "..properNamesByHallLocation[hallLocation].."!"} end notice.Font = "SourceSansBold" notice.Color = {r = 161, g = 132, b = 194} local hallServerId = TeleportService:ReserveServer(guildHallPlaceId) local serverIdSuccess, serverIdProblem = modifyGuildDataValue(player, guid, "set", "hallServerId", hallServerId, false) if not serverIdSuccess then return false, serverIdProblem end local success, reason = modifyGuildDataValue(player, guid, "set", "hallLocation", hallLocation, false, notice) if success then sendGuildMessage(guid, { messageType = "data_update", key = "hallLocation", value = hallLocation, sender = player.Name, senderId = player.userId, notice = notice, }) resetGuildHallServer() return true, "" else return false, reason end end local function getGuildUpgradeCost(player) local guildId = player:FindFirstChild("guildId") if not guildId then return nil, "No guildId." end local guid = guildId.Value local guildData = getGuildData(player, guid) if not guildData then return nil, "No guildData." end local nextLevel = guildData.level + 1 if guildPurchases.level[nextLevel] then return guildPurchases.level[nextLevel].cost, "" else return nil, "No next level." end end local function upgradeGuild(player) if (game.PlaceId ~= 2546689567) and (game.PlaceId ~= 2061558182) and (game.PlaceId ~= 3372071669) then return false, "Not in Port Fidelio." end local guildId = player:FindFirstChild("guildId") if not guildId then return false, "No guildId." end local guid = guildId.Value local guildData = getGuildData(player, guid) if not guildData then return false, "No guildData." end local memberData = getGuildPlayerData(player, guid) if not memberData then return false, "No memberData." end if memberData.rank ~= "leader" then return false, "Not leader." end local upgradeCost, reason = getGuildUpgradeCost(player) if not upgradeCost then return false, reason end if guildData.bank < upgradeCost then return false, "Not enough funds in guild bank." end -- customized logic here since I don't want to do two separate update calls local guildDataStore = game:GetService("DataStoreService"):GetDataStore("guild", guid) local dataSuccess, dataError = pcall(function() guildDataStore:UpdateAsync("guildData", function(data) if not data then return end if not data.level then return end if not data.bank then return end if data.bank < upgradeCost then return end data.bank = data.bank - upgradeCost data.level = data.level + 1 guildDataUpdated(guid, data) return data end) end) if not dataSuccess then network:invoke("reportError", player, "warning", "Failed to upgrade guild level: "..dataError) return false, "DataStore error" end return true, "" end local function donateToGuild(player, amount) if typeof(amount) ~= "number" then return false, "Trying to donate not a number." end amount = math.floor(amount) if amount < 0 then return false, "Trying to donate a negative number." end local guildId = player:FindFirstChild("guildId") if not guildId then return false, "No guildId." end local guid = guildId.Value local guildData = getGuildData(player, guid) if not guildData then return false, "No guildData." end local playerData = network:invoke("getPlayerData", player) if not playerData then return false, "No playerData." end if playerData.gold < amount then return false, "Not enough gold." end playerData.nonSerializeData.incrementPlayerData("gold", -amount, "guild:donate") local success, reason = modifyGuildDataValue(player, guid, "increment", "bank", amount, true) if not success then playerData.nonSerializeData.incrementPlayerData("gold", amount, "guild:donateFailed") return false, reason end return true, "" end local function teleportPlayersToGuildHall(players, guid) local leadPlayer = players[1] local guildData = getGuildData(leadPlayer, guid) if not guildData then return false, "No guildData." end local hallServerId = guildData.hallServerId if not hallServerId then return false, "No hallServerId." end network:invoke("teleportPlayersToReserveServer", players, guildHallPlaceId, guid, nil, nil, hallServerId) return true, "" end local function playerRequest_teleportToGuildHall(player) local guildId = player:FindFirstChild("guildId") if not guildId then return false, "No guildId." end local guid = guildId.Value if guid == "" then return false, "No guild." end local partyData = network:invoke("getPartyDataByPlayer", player) if partyData then -- teleport the party local players = {} local leader for _, memberInfo in pairs(partyData.members) do local member = memberInfo.player if memberInfo.isLeader then leader = member else table.insert(players, member) end end if player ~= leader then return false, "Only the party leader may teleport everyone to a guild hall." end table.insert(players, 1, leader) teleportPlayersToGuildHall(players, guid) else -- teleport the individual teleportPlayersToGuildHall({player}, guid) end end local function expelPlayerHelper(player, target) network:fireAllClients("signal_alertChatMessage", { Text = target.Name.." has been expelled by "..player.Name, Font = Enum.Font.SourceSansBold, Color = Color3.fromRGB(255, 127, 127), }) network:invoke("teleportPlayer", target, game.ReplicatedStorage.lastLocationOverride.Value, "guildHall") end local function expelPlayer(player, target) if (game.PlaceId ~= guildHallPlaceId) and (game.PlaceId ~= 2061558182) then return false, "This command can only be used in the guild hall." end local guildId = game.ReplicatedStorage:FindFirstChild("guildId") if guildId then guildId = guildId.Value else if game.PlaceId == 2061558182 then guildId = "73370A17-4486-4E7D-AD49-4597D93C52B0" else return false, "Couldn't find guildId." end end local playerGuildId = player:FindFirstChild("guildId") local targetGuildId = target:FindFirstChild("guildId") if (not playerGuildId) then return false, "You are not a member of a guild." else if playerGuildId.Value ~= guildId then return false, "You are not a member of this guild." end if (not targetGuildId) then expelPlayerHelper(player, target) return true, "" else if targetGuildId.Value ~= guildId then expelPlayerHelper(player, target) return true, "" else local playerData = getGuildPlayerData(player, guildId) local targetData = getGuildPlayerData(target, guildId) if (not playerData) or (not targetData) or (not playerData.rank) or (not targetData.rank) then return false, "There was an issue with player data." end local playerRank = getRankNumberFromRank(playerData.rank) local targetRank = getRankNumberFromRank(targetData.rank) if playerRank <= targetRank then return false, "You must be a higher rank than your target in order to expel them." else expelPlayerHelper(player, target) return true, "" end end end end end local function leaveGuildHall(player) network:invoke("teleportPlayer", player, game.ReplicatedStorage.lastLocationOverride.Value, "guildHall") end function module.init(Modules) network = Modules.network network:connect("playerDataLoaded", "Event", onPlayerLoaded) network:create("signal_guildDataUpdated", "RemoteEvent") network:create("sendGuildMessage", "BindableFunction", "OnInvoke", sendGuildMessage) network:create("sendGuildChat", "BindableFunction", "OnInvoke", sendGuildChat) network:create("getGuildData", "BindableFunction", "OnInvoke", getGuildData) network:create("playerRequest_getGuildData", "RemoteFunction", "OnServerInvoke", playerRequest_getGuildData) network:create("getGuildMemberData", "BindableFunction", "OnInvoke", getGuildPlayerData) network:create("playerRequest_getGuildMemberData", "RemoteFunction", "OnServerInvoke", playerRequest_getGuildMemberData) network:create("playerRequest_createGuild", "RemoteFunction", "OnServerInvoke", playerRequest_createGuild) network:create("serverPrompt_playerInvitedToServer", "RemoteFunction") network:create("playerRequest_invitePlayerToGuild", "RemoteFunction", "OnServerInvoke", playerRequest_invitePlayerToGuild) network:create("playerRequest_exileUserIdFromGuild","RemoteFunction","OnServerInvoke", playerRequest_exileUserIdFromGuild) network:create("playerRequest_leaveMyGuild","RemoteFunction","OnServerInvoke",playerRequest_leaveMyGuild) network:create("playerRequest_changeUserIdRankValue", "RemoteFunction", "OnServerInvoke", playerRequest_changeUserIdRankValue) network:create("playerRequest_getHallLocationFromPlaceId", "RemoteFunction", "OnServerInvoke", getHallLocationFromPlaceId) network:create("playerRequest_getPlaceIdFromHallLocation", "RemoteFunction", "OnServerInvoke", playerRequest_getPlaceIdFromHallLocation) network:create("getPlaceIdFromHallLocation", "BindableFunction", "OnInvoke", getPlaceIdFromHallLocation) network:create("playerRequest_changeGuildHallLocation", "RemoteFunction", "OnServerInvoke", changeGuildHallLocation) network:create("playerRequest_getGuildUpgradeCost", "RemoteFunction", "OnServerInvoke", getGuildUpgradeCost) network:create("playerRequest_upgradeGuild", "RemoteFunction", "OnServerInvoke", upgradeGuild) network:create("playerRequest_donateToGuild", "RemoteFunction", "OnServerInvoke", donateToGuild) network:create("teleportPlayersToGuildHall", "BindableFunction", "OnInvoke", teleportPlayersToGuildHall) network:create("playerRequest_teleportToGuildHall", "RemoteFunction", "OnServerInvoke", playerRequest_teleportToGuildHall) network:create("playerRequest_expelPlayer", "RemoteFunction", "OnServerInvoke", expelPlayer) network:create("playerRequest_leaveGuildHall", "RemoteFunction", "OnServerInvoke", leaveGuildHall) network:create("getRankNumberFromRank", "BindableFunction", "OnInvoke", getRankNumberFromRank) end return module
_addon.name = "autoRing" _addon.author = "Godchain" _addon.version = "1.0" _addon.commands = {"autoRing", "ar"} require("logger") extdata = require("extdata") lang = string.lower(windower.ffxi.get_info().language) item_info = { ["facility"] = {id = 26165, japanese = "ファシリティリング", english = "Facility Ring", slot = 13}, ["capacity"] = {id = 28546, japanese = "キャパシティリング", english = "Capacity Ring", slot = 13}, ["warp"] = {id = 28540, japanese = "デジョンリング", english = "Warp Ring", slot = 13}, ["caliber"] = {id = 26164, japanese = "カリバーリング", english = "Caliber Ring", slot = 13}, ["empress"] = {id = 15762, japanese = "女帝の指輪", english = "Empress Band", slot = 13}, ["dem"] = {id = 26177, japanese = "D.デムリング", english = "Dim. Ring (Dem)", slot = 13}, ["echad"] = {id = 27556, japanese = "エチャドリング", english = "Echad Ring", slot = 13} } function search_item(ring) local item_array = {} local bags = {0, 8, 10, 11, 12} --inventory,wardrobe1-4 local get_items = windower.ffxi.get_items for i = 1, #bags do for _, item in ipairs(get_items(bags[i])) do if item.id > 0 then item_array[item.id] = item item_array[item.id].bag = bags[i] end end end local stats = item_info[ring] local item = item_array[stats.id] local set_equip = windower.ffxi.set_equip if item then local ext = extdata.decode(item) local charges = ext.charges_remaining local enchant = ext.type == "Enchanted Equipment" local recast = enchant and charges > 0 and math.max(ext.next_use_time + 18000 - os.time(), 0) local usable = recast and recast == 0 if (charges == 0) then log(stats[lang] .. ": out of charges.") elseif (recast > 0) then log(stats[lang] .. ": " .. recast .. " sec. on recast.") else log(stats[lang] .. ": equipped (" .. charges .. " left).") end if usable or ext.type == "General" then if enchant and item.status ~= 5 then --not equipped set_equip(item.slot, stats.slot, item.bag) log_flag = true repeat --waiting cast delay coroutine.sleep(1) local ext = extdata.decode(get_items(item.bag, item.slot)) local delay = ext.activation_time + 18000 - os.time() if delay > 0 then log(delay) elseif log_flag then log_flag = false log("Using " .. stats[lang] .. ".") end until ext.usable or delay > 10 end windower.chat.input('/item "' .. windower.to_shift_jis(stats[lang]) .. '" <me>') end else log("You don't have " .. stats[lang] .. ".") end end function Set(list) local set = {} for _, l in ipairs(list) do set[l] = true end return set end windower.register_event( "addon command", function(cmd) local player = windower.ffxi.get_player() local get_spells = windower.ffxi.get_spells() if cmd == "cap" or cmd == "capacityring" then cmd = "capacity" end if cmd == "fac" or cmd == "facilityring" then cmd = "facility" end if cmd == "wa" then cmd = "warp" end if item_info[cmd] == nil then log("Invalid command. Try things like 'warp' (or 'wa'), 'capacity' (or 'cap'), 'dem', etc.") else log("Searching for: " .. cmd) search_item(cmd) end end )
---@class BufferedTable local BufferedTable = CLASS: BufferedTable () function BufferedTable:__init ( size, isize, hsize ) size = size or 2 self.size = size self.cursor = 1 for i = 1, size do self[ i ] = {} end end function BufferedTable:table () return self[ self.cursor ] end function BufferedTable:get ( k ) local t = self[ self.cursor ] return t[ k ] end function BufferedTable:set ( k, v ) local t = self[ self.cursor ] t[ k ] = v end function BufferedTable:swap ( clear ) local c0 = self.cursor if clear then table.clear ( self[ c0 ] ) end local c1 = c0 % self.size + 1 self.cursor = c1 return self[ c1 ] end function BufferedTable:clear () for i = 1, self.size do table.clear ( self[ i ] ) end end return BufferedTable
-- -- Just some decorative plastic panels. -- minetest.register_node("yatm_plastics:plastic_panel_plain_block", { basename = "yatm_plastics:plastic_panel_plain_block", description = "Plain Plastic Panel Block", groups = { cracky = 1, plastic_block = 1, }, tiles = { "yatm_plastic_panel_plain.off.png", }, paramtype = "none", paramtype2 = "facedir", }) yatm.register_stateful_node("yatm_plastics:plastic_panel_plain_block", { basename = "yatm_plastics:plastic_panel_plain_block", base_description = "Plain Plastic Panel Block", groups = { cracky = 1, plastic_block = 1, }, paramtype = "none", paramtype2 = "facedir", }, { cooling = { description = "Plain Plastic Panel Block (Cooling Lights)", tiles = {"yatm_plastic_panel_plain.cooling.png"} }, heating = { description = "Plain Plastic Panel Block (Heating Lights)", tiles = {"yatm_plastic_panel_plain.heating.png"} }, radiating = { description = "Plain Plastic Panel Block (Radiating Lights)", tiles = {"yatm_plastic_panel_plain.radiating.png"} }, }) minetest.register_node("yatm_plastics:plastic_panel_notched_block", { basename = "yatm_plastics:plastic_panel_notched_block", description = "Notched Plastic Panel Block", groups = { cracky = 1, plastic_block = 1, }, tiles = { "yatm_plastic_panel_notched.off.png", }, paramtype = "none", paramtype2 = "facedir", }) yatm.register_stateful_node("yatm_plastics:plastic_panel_notched_block", { basename = "yatm_plastics:plastic_panel_notched_block", base_description = "Notched Plastic Panel Block", groups = { cracky = 1, plastic_block = 1, }, paramtype = "none", paramtype2 = "facedir", }, { cooling = { description = "Notched Plastic Panel Block (Cooling Lights)", tiles = {"yatm_plastic_panel_notched.cooling.png"} }, heating = { description = "Notched Plastic Panel Block (Heating Lights)", tiles = {"yatm_plastic_panel_notched.heating.png"} }, radiating = { description = "Notched Plastic Panel Block (Radiating Lights)", tiles = {"yatm_plastic_panel_notched.radiating.png"} }, }) minetest.register_node("yatm_plastics:plastic_panel_hollow_block", { basename = "yatm_plastics:plastic_panel_hollow_block", description = "Hollow Plastic Panel Block", groups = { cracky = 1, plastic_block = 1, }, tiles = { "yatm_plastic_panel_hollow.off.png", }, drawtype = "glasslike", paramtype = "none", paramtype2 = "facedir", }) yatm.register_stateful_node("yatm_plastics:plastic_panel_hollow_block", { basename = "yatm_plastics:plastic_panel_hollow_block", base_description = "Hollow Plastic Panel Block", groups = { cracky = 1, plastic_block = 1, }, drawtype = "glasslike", paramtype = "none", paramtype2 = "facedir", }, { cooling = { description = "Hollow Plastic Panel Block (Cooling Lights)", tiles = {"yatm_plastic_panel_hollow.cooling.png"} }, heating = { description = "Hollow Plastic Panel Block (Heating Lights)", tiles = {"yatm_plastic_panel_hollow.heating.png"} }, radiating = { description = "Hollow Plastic Panel Block (Radiating Lights)", tiles = {"yatm_plastic_panel_hollow.radiating.png"} }, }) yatm.register_stateful_node("yatm_plastics:plastic_panel_checker_block", { basename = "yatm_plastics:plastic_panel_checker_block", base_description = "Checker Plastic Panel Block", groups = { cracky = 1, plastic_block = 1, }, drawtype = "glasslike_framed", paramtype = "none", paramtype2 = "facedir", }, { off = { description = "Checker Plastic Panel Block", tiles = { "yatm_plastic_panel_border.off.png", "yatm_plastic_panel_checker.png", }, }, cooling = { description = "Checker Plastic Panel Block (Cooling Lights)", tiles = { "yatm_plastic_panel_border.cooling.png", "yatm_plastic_panel_checker.png", }, }, heating = { description = "Checker Plastic Panel Block (Heating Lights)", tiles = { "yatm_plastic_panel_border.heating.png", "yatm_plastic_panel_checker.png", }, }, radiating = { description = "Checker Plastic Panel Block (Radiating Lights)", tiles = { "yatm_plastic_panel_border.radiating.png", "yatm_plastic_panel_checker.png", }, }, })
slot0 = setmetatable slot1 = table slot2 = rawset slot3 = error module("containers") function RepeatedCompositeFieldContainer(slot0, slot1) return slot0({ _listener = slot0, _message_descriptor = slot1 }, slot1) end function RepeatedScalarFieldContainer(slot0, slot1) return slot0({ _listener = slot0, _type_checker = slot1 }, slot1) end return
local string = "LOL" local longString = [[VERY LONG STRING I GOT HERE MULTI LINE WORKS YOU SEE? ]] -- Not sure why, but this ]] will make concatenating other strings go to a new line --- Its because of print() print(string) print(longString) print(string .. longString) --Concatenating in lua is .. not + print(longString .. string) io.write(string.gsub(longString, "I", "me"))
local pegger = require 'nelua.utils.pegger' local class = require 'nelua.utils.class' local errorer = require 'nelua.utils.errorer' local iters = require 'nelua.utils.iterators' local traits = require 'nelua.utils.traits' local except = require 'nelua.utils.except' local sstream = require 'nelua.utils.sstream' local stringer = require 'nelua.utils.stringer' local console = require 'nelua.utils.console' local tabler = require'nelua.utils.tabler' local config = require 'nelua.configer'.get() local Attr = require 'nelua.attr' local tabler_update = tabler.update local clone_node -- Unique id counter for ASTNode. local uid = 0 -- AST node class. local ASTNode = class() ASTNode.tag = 'Node' -- tag for a generic ASTNode ASTNode._astnode = true -- used to quickly check weather a table is an ASTNode -- Create an AST node with metatable `mt` filled with values `...`. -- Called when manually creating or generating AST nodes. function ASTNode._create(mt, ...) local nuid = uid + 1 uid = nuid return setmetatable({ attr = setmetatable({}, Attr), uid = nuid, ... }, mt) end getmetatable(ASTNode).__call = ASTNode._create -- Create an AST node with metatable `mt` from table `node`. -- Called for every AST node initialization while parsing. function ASTNode.create_from(mt, node) local nuid = uid + 1 uid = nuid node.uid = nuid node.attr = setmetatable({}, Attr) return setmetatable(node, mt) end -- Clone a node table. local function clone_nodetable(t) local ct = {} for i=1,#t do local v = t[i] if v._astnode then ct[i] = clone_node(v) else ct[i] = clone_nodetable(v) end end return ct end -- Clone a node, copying only necessary values. function ASTNode.clone(node) local nuid = uid + 1 uid = nuid local pattr = node.pattr local attr = setmetatable({}, Attr) local cloned = setmetatable({ attr = attr, pos = node.pos, endpos = node.endpos, src = node.src, preprocess = node.preprocess, pattr = pattr, uid = nuid, nil,nil,nil,nil,nil,nil -- preallocate array part }, getmetatable(node)) if pattr then tabler_update(attr, pattr) end for i=1,#node do local arg = node[i] if type(arg) == 'table' then if arg._astnode then arg = clone_node(arg) else arg = clone_nodetable(arg) end end cloned[i] = arg end return cloned end clone_node = ASTNode.clone --[[ Replace current AST node values and metatable with node `node`. Used internally to transform a node to another node. ]] function ASTNode:transform(node) setmetatable(self, getmetatable(node)) for i=1,math.max(#self, #node) do self[i] = node[i] end self.attr = node.attr self.pattr = node.pattr end ------------------- -- error handling ------------------- function ASTNode.format_message(self, category, message, ...) message = stringer.pformat(message, ...) if self and self.src and self.pos then message = errorer.get_pretty_source_pos_errmsg(self.src, self.pos, self.endpos, message, category) else --luacov:disable message = category .. ': ' .. message .. '\n' end --luacov:enable return message end --luacov:disable function ASTNode.errorf(self, message, ...) error(ASTNode.format_message(self, 'error', message, ...), 2) end function ASTNode.assertf(self, cond, message, ...) if not cond then error(ASTNode.format_message(self, 'error', message, ...), 2) end return cond end function ASTNode.assertraisef(self, cond, message, ...) if not cond then except.raise(ASTNode.format_message(self, 'error', message, ...), 2) end return cond end --luacov:enable function ASTNode.raisef(self, message, ...) except.raise(ASTNode.format_message(self, 'error', message, ...), 2) end function ASTNode.warnf(self, message, ...) if not config.no_warning then console.logerr(ASTNode.format_message(self, 'warning', message, ...)) end end ------------------- -- pretty print ast ------------------- local ignored_stringfy_keys = { src = true, pos = true, endpos = true, uid = true, desiredtype = true, preprocess = true, preprocessed = true, loadedast = true, node = true, scope = true, done = true, untyped = true, checked = true, usedby = true, argattrs = true, } local function stringfy_val2str(val) local vstr = tostring(val) if traits.is_number(val) or traits.is_boolean(val) or val == nil then return vstr else return pegger.double_quote_lua_string(vstr) end end local function stringfy_astnode(node, depth, ss, skipindent) local indent = string.rep(' ', depth) local isnode = node._astnode if not skipindent then ss:add(indent) end if isnode then ss:addmany(node.tag, ' ') end ss:add('{\n') for k,v in iters.ospairs(node) do if not ignored_stringfy_keys[k] then if isnode and k == 'attr' and traits.is_table(v) then if next(v) then ss:addmany(indent, ' attr = ') stringfy_astnode(v, depth+1, ss, true) ss:add(',\n') end else ss:addmany(indent, ' ', k, ' = ', stringfy_val2str(v), ',\n') end end end local nargs = #node if nargs > 0 then for i=1,nargs do local v = node[i] if type(v) == 'table' then stringfy_astnode(v, depth+1, ss) else ss:addmany(indent, ' ', stringfy_val2str(v)) end ss:add(i == nargs and '\n' or ',\n') end end ss:addmany(indent, '}') end function ASTNode:__tostring() local ss = sstream() stringfy_astnode(self, 0, ss) return ss:tostring() end local coroutine_yield = coroutine.yield local coroutine_wrap = coroutine.wrap local function walk_symbols(node) if node._astnode then local attr = node.attr if attr and attr._symbol then coroutine_yield(attr) end end for i=1,#node do local v = node[i] if type(v) == 'table' then walk_symbols(v) end end end function ASTNode:walk_symbols() return coroutine_wrap(walk_symbols), self end local function walk_nodes(node, parent, parentindex) if node._astnode then coroutine_yield(node, parent, parentindex) end for i=1,#node do local v = node[i] if type(v) == 'table' then walk_nodes(v, node, i) end end end function ASTNode:walk_nodes() return coroutine_wrap(walk_nodes), self end function ASTNode:walk_trace_nodes(tagfilter) local trace = {} local function walk_trace_nodes(node, n) local parentpos = #trace+1 trace[parentpos] = node for i=1,n do local subnode = node[i] if type(subnode) == 'table' then if subnode._astnode then if tagfilter[subnode.tag] then -- is an accepted astnode coroutine_yield(subnode, trace) end end local subn = #subnode if subn > 0 then walk_trace_nodes(subnode, subn) end end end trace[parentpos] = nil end return coroutine_wrap(walk_trace_nodes), self, #self end function ASTNode:has_sideeffect() for node in self:walk_nodes() do if node.attr.sideeffect then return true end end return false end return ASTNode
return Def.ActorFrame { CurrentSongChangedMessageCommand=function(self) local song = GAMESTATE:GetCurrentSong(); if song then -- self:setaux(0); self:finishtweening(); self:decelerate(0.3):diffusealpha(1) elseif not song and self:GetZoomX() == 1 then -- self:setaux(1); self:finishtweening(); self:decelerate(0.3):diffusealpha(0) end; end; Def.StepsDisplayList { Name="StepsDisplayListRow"; OnCommand=function(self) self:diffusealpha(0):decelerate(0.3):diffusealpha(1) end; OffCommand=function(self) self:decelerate(0.3):diffusealpha(0) end; SongChosenMessageCommand=function(self) if GAMESTATE:GetCurrentGame():GetName() == "pump" then self:zoomx(0.8):glow(1,1,1,0.4):easeoutback(0.25):diffusealpha(1):zoomx(1):glow(1,1,1,0) end end; CursorP1 = Def.ActorFrame { InitCommand=function(self) self:x(-87):player(PLAYER_1) end; PlayerJoinedMessageCommand=function(self, params) if params.Player == PLAYER_1 then self:visible(true):zoom(0):bounceend(1):zoom(1) end; end; PlayerUnjoinedMessageCommand=function(self, params) if params.Player == PLAYER_1 then self:visible(true):bouncebegin(1):zoom(0) end; end; LoadActor(THEME:GetPathG("_StepsDisplayListRow","Cursor")) .. { InitCommand=function(self) self:diffuse(ColorLightTone(PlayerColor(PLAYER_1))):x(8):zoom(0.75) end; }; LoadActor(THEME:GetPathG("_StepsDisplayListRow","Cursor")) .. { InitCommand=function(self) self:x(8):zoom(0.75):blend('add') end; OnCommand=function(self) self:diffuseshift():effectcolor2(color("1,1,1,0.1")):effectcolor1(color("1,1,1,0.3")):effectclock('beatnooffset') end; }; }; CursorP2 = Def.ActorFrame { InitCommand=function(self) self:x(87):player(PLAYER_2):zoom(1) end; PlayerJoinedMessageCommand=function(self, params) if params.Player == PLAYER_2 then self:visible(true):zoom(0):bounceend(1):zoom(1) end; end; PlayerUnjoinedMessageCommand=function(self, params) if params.Player == PLAYER_2 then self:visible(true):bouncebegin(1):zoom(0) end; end; LoadActor(THEME:GetPathG("_StepsDisplayListRow","Cursor")) .. { InitCommand=function(self) self:diffuse(ColorLightTone(PlayerColor(PLAYER_2))):x(-8):zoomy(0.75):zoomx(-0.75) end; }; LoadActor(THEME:GetPathG("_StepsDisplayListRow","Cursor")) .. { InitCommand=function(self) self:x(-8):zoomy(0.75):zoomx(-0.75):blend('add') end; OnCommand=function(self) self:diffuseshift():effectcolor2(color("1,1,1,0.1")):effectcolor1(color("1,1,1,0.3")):effectclock('beatnooffset') end; }; }; CursorP1Frame = Def.Actor{ ChangeCommand=function(self) self:stoptweening():decelerate(0.05) end; }; CursorP2Frame = Def.Actor{ ChangeCommand=function(self) self:stoptweening():decelerate(0.05) end; }; }; };
--[[ [previous](03-helloworld.lua) | [contents](00-contents.lua) | [next](05-explain.lua) # Program is a list of instructions Every program is a list of instructions. These instructions "tell" the computer what to do. You will learn how to write these instructions in a way that computers can follow and other people can understand. One example with a list of instructions that everyone is familiar with is a culinary recipe. It usually provides step-by-step instructions on what ingredients to use and what to do with them. The order is critical too: if you accidentally do steps out of order, the results may not be pleasant (or edible). ]]
local module = { Name = "Test filter", Description = "Test whether your message will be filitered or not" , Location = "Player", } module.Execute = function(Client, Type, Attachment) if Type == "command" then local Input = module.API.sendModalToPlayer(Client, "What's the message?").Event:Wait() if Input == false then return false end local Status Status, Input = module.API.filterText(Client, Input) if Status then module.API.Players.message(Client, "TestFilter", "Your message has been filtered, here's the result:\n" .. Input) return true else module.API.Players.hint(Client, "System", "Your message \"" .. tostring(Attachment) .. "\" failed to filter, please retry later") end return false end end return module
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ========== PlaceObj('StoryBit', { ActivationEffects = {}, Effects = {}, Prerequisites = {}, ScriptDone = true, SuppressTime = 1080000, Text = T(146624104168, --[[StoryBit LongWinter_MoraleEvent Text]] "This damned long Cold Wave has everybody on edge. We have to do something about the Sanity of our colonists.\n\nNote: All effects will last until the end of the Cold Wave."), TextReadyForValidation = true, TextsDone = true, VoicedText = T(120250251183, --[[voice:narrator]] "Two Colonists bump into each other accidentally. A heated argument follows. It’s not the first one."), group = "Disasters", id = "LongWinter_MoraleEvent", qa_info = PlaceObj('PresetQAInfo', { data = { { action = "Modified", time = 1637252007, }, }, }), PlaceObj('StoryBitParamNumber', { 'Name', "sanity_restored", 'Value', 40, }), PlaceObj('StoryBitReply', { 'Text', T(838846202028, --[[StoryBit LongWinter_MoraleEvent Text]] "I know! Let’s organize a winter festival!"), 'OutcomeText', "custom", 'CustomOutcomeText', T(823788722118, --[[StoryBit LongWinter_MoraleEvent CustomOutcomeText]] "every colonists will regain <sanity_restored> Sanity"), 'Prerequisite', PlaceObj('IsCommander', { 'CommanderProfile', "citymayor", }), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Effects', { PlaceObj('ForEachExecuteEffects', { 'Label', "Colonist", 'Filters', {}, 'Effects', { PlaceObj('ModifyColonistStat', { 'Stat', "Sanity", 'Amount', "<sanity_restored>", }), }, }), }, }), PlaceObj('StoryBitParamPercent', { 'Name', "food_increase", 'Value', 100, }), PlaceObj('StoryBitParamPercent', { 'Name', "cold_wave_dmg", 'Value', -50, }), PlaceObj('StoryBitReply', { 'Text', T(637665293491, --[[StoryBit LongWinter_MoraleEvent Text]] "Warm food and a warm bed are the answer."), 'OutcomeText', "custom", 'CustomOutcomeText', T(284727608577, --[[StoryBit LongWinter_MoraleEvent CustomOutcomeText]] "Colonists will consume <food_increase>% more food and take less sanity damage from the disaster"), 'Comment', "", }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Effects', { PlaceObj('ModifyConst', { 'Const', "eat_food_per_visit", 'Percent', "<food_increase>", 'ModifyId', "LongWinter", }), PlaceObj('ModifyConst', { 'Const', "ColdWaveSanityDamage", 'Percent', "<cold_wave_dmg>", 'ModifyId', "LongWinter", }), }, }), PlaceObj('StoryBitParamPercent', { 'Name', "medical_boost", 'Value', 100, }), PlaceObj('StoryBitReply', { 'Text', T(582720633961, --[[StoryBit LongWinter_MoraleEvent Text]] "Leave it to the doctors."), 'OutcomeText', "custom", 'CustomOutcomeText', T(899364202147, --[[StoryBit LongWinter_MoraleEvent CustomOutcomeText]] "double Sanity restored from medical buildings"), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Effects', { PlaceObj('ModifyLabel', { 'Label', "MedicalBuilding", 'InColony', false, 'Prop', "sanity_change", 'Percent', "<medical_boost>", 'ModifyId', "LongWinter", }), }, }), PlaceObj('StoryBitParamNumber', { 'Name', "extra_sanity", 'Value', 5, }), PlaceObj('StoryBitReply', { 'Text', T(793784829446, --[[StoryBit LongWinter_MoraleEvent Text]] "Let’s party!"), 'OutcomeText', "custom", 'CustomOutcomeText', T(507145556590, --[[StoryBit LongWinter_MoraleEvent CustomOutcomeText]] "Spacebars and Casinos will restore <extra_sanity> Sanity on visit"), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Effects', { PlaceObj('ModifyLabel', { 'Label', "Spacebar", 'InColony', false, 'Prop', "sanity_change", 'Amount', "<extra_sanity>", 'ModifyId', "LongWinter", }), PlaceObj('ModifyLabel', { 'Label', "CasinoComplex", 'InColony', false, 'Prop', "sanity_change", 'Amount', "<extra_sanity>", 'ModifyId', "LongWinter", }), }, }), })
local L = BigWigs:NewBossLocale("Mephistroth", "ruRU") if not L then return end if L then --L.custom_on_time_lost = "Time lost during Shadow Fade" --L.custom_on_time_lost_desc = "Show the time lost during Shadow Fade on the bar in |cffff0000red|r." end L = BigWigs:NewBossLocale("Domatrax", "ruRU") if L then --L.custom_on_autotalk = "Autotalk" --L.custom_on_autotalk_desc = "Instantly selects the Aegis of Aggramar's gossip option to start the Domatrax encounter." --L.missing_aegis = "You're not standing in Aegis" -- Aegis is a short name for Aegis of Aggramar --L.aegis_healing = "Aegis: Reduced Healing Done" --L.aegis_damage = "Aegis: Reduced Damage Done" end L = BigWigs:NewBossLocale("Cathedral of Eternal Night Trash", "ruRU") if L then L.dulzak = "Дул'зак" --L.wrathguard = "Wrathguard Invader" L.felguard = "Страж Скверны - разрушитель" L.soulmender = "Врачеватель душ адского огня" L.temptress = "Искусительница адского огня" L.botanist = "Присягнувшая Скверне - ботаник" L.orbcaster = "Сквернолап - метательница сфер" L.waglur = "Ва'глур" L.scavenger = "Змееуст-барахольщик" L.gazerax = "Созерцатель" L.vilebark = "Ходячий гиблодрев" --L.throw_tome = "Throw Tome" -- Common part of Throw Arcane/Frost/Silence Tome (242837/242839/242841) end
local AceGUI = LibStub("AceGUI-3.0") -------------------------- -- Button -- -------------------------- do local Type = "Button" local Version = 11 local function OnAcquire(self) -- restore default values self:SetHeight(24) self:SetWidth(200) end local function OnRelease(self) self.frame:ClearAllPoints() self.frame:Hide() self:SetDisabled(false) end local function Button_OnClick(this) this.obj:Fire("OnClick") AceGUI:ClearFocus() end local function Button_OnEnter(this) this.obj:Fire("OnEnter") end local function Button_OnLeave(this) this.obj:Fire("OnLeave") end local function SetText(self, text) self.text:SetText(text or "") end local function SetDisabled(self, disabled) self.disabled = disabled if disabled then self.frame:Disable() else self.frame:Enable() end end local function Constructor() local num = AceGUI:GetNextWidgetNum(Type) local name = "AceGUI30Button"..num local frame = CreateFrame("Button",name,UIParent,"UIPanelButtonTemplate2") local self = {} self.num = num self.type = Type self.frame = frame local left = _G[name .. "Left"] local right = _G[name .. "Right"] local middle = _G[name .. "Middle"] left:SetPoint("TOP", frame, "TOP", 0, 0) left:SetPoint("BOTTOM", frame, "BOTTOM", 0, 0) right:SetPoint("TOP", frame, "TOP", 0, 0) right:SetPoint("BOTTOM", frame, "BOTTOM", 0, 0) middle:SetPoint("TOP", frame, "TOP", 0, 0) middle:SetPoint("BOTTOM", frame, "BOTTOM", 0, 0) local text = frame:GetFontString() self.text = text text:ClearAllPoints() text:SetPoint("TOPLEFT",frame,"TOPLEFT", 15, -1) text:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT", -15, 1) text:SetJustifyV("MIDDLE") frame:SetScript("OnClick",Button_OnClick) frame:SetScript("OnEnter",Button_OnEnter) frame:SetScript("OnLeave",Button_OnLeave) self.SetText = SetText self.SetDisabled = SetDisabled frame:EnableMouse(true) frame:SetHeight(24) frame:SetWidth(200) self.OnRelease = OnRelease self.OnAcquire = OnAcquire self.frame = frame frame.obj = self AceGUI:RegisterAsWidget(self) return self end AceGUI:RegisterWidgetType(Type,Constructor,Version) end
-- Copyright (c) 2020 Trevor Redfern -- -- This software is released under the MIT License. -- https://opensource.org/licenses/MIT describe("assets.quests.explore_cave", function() local cave = require "assets.quests.explore_cave" it("can create a quest entity", function() local q = cave:clone() assert.not_nil(q) assert.not_nil(q.title) assert.not_nil(q.description) assert.file_exists(q.image) end) it("is available turn 1 on", function() local gs = require "game.game_state":new() assert.is_false(cave:check_prerequisites(gs)) gs.turn_counter = 1 assert.is_true(cave:check_prerequisites(gs)) end) end)
class "Tron" function Tron:__init() self.state = GamemodeState.WAITING self.inLobby = false self.queue = {} self.queueMin = 0 self.queueMax = 0 self.nameT = "Игроки" self.nameTTw = "Очередь" self.nameTTh = "Ожидание других игроков..." self.nameTFo = "Самоуничтожиться через " self.nameTFi = "За границами " self.spec = { listOffset = 1, player = false, angle = Angle(), zoom = 1 } self.collisionFired = false self.timer = Timer() self.blockedActions = {Action.StuntJump, Action.StuntposEnterVehicle, Action.ParachuteOpenClose, Action.ExitVehicle, Action.EnterVehicle, Action.UseItem} self.segments = {} Network:Subscribe( "EnterLobby", self, self.EnterLobby ) Network:Subscribe( "StateChange", self, self.StateChange ) Network:Subscribe( "UpdateQueue", self, self.UpdateQueue ) Network:Subscribe( "ExitLobby", self, self.ExitLobby ) Events:Subscribe( "Lang", self, self.Lang ) Events:Subscribe( "LocalPlayerExitVehicle", self, self.LocalPlayerExitVehicle ) Events:Subscribe( "LocalPlayerWorldChange", self, self.LocalPlayerWorldChange ) Events:Subscribe( "PlayerNetworkValueChange", self, self.PlayerNetworkValueChange ) Events:Subscribe( "EntityDespawn", self, self.EntityDespawn ) Events:Subscribe( "PreTick", self, self.PreTick ) Events:Subscribe( "Render", self, self.Render ) end function Tron:Lang( args ) self.nameT = "Players" self.nameTTw = "Current Queue" self.nameTTh = "Waiting for other players..." self.nameTFo = "Self-destruct in " self.nameTFi = "Out of bounds " end function Tron:AddSegment( segments, segment ) segment.time = self.timer:GetSeconds() table.insert(segments, segment) if #segments > 8 then table.remove(segments, 1) end end function DrawCenteredShadowedText( position, text, color, textsize ) local textsize = textsize or TextSize.Default local bounds = Render:GetTextSize(text, textsize) if not IsNaN(position) then Render:DrawText( position - (bounds / 2) + (Vector2.One * math.max(textsize / 32, 1)), text, Color( 25, 25, 25, 150 ), textsize ) Render:DrawText( position - (bounds / 2), text, color, textsize ) end end function Tron:EnterLobby( args ) self.inLobby = true self.state = GamemodeState.WAITING self.queue = {} self.queueMin = 0 self.queueMax = 0 self.spec = { listOffset = 1, player = false, angle = Angle(), zoom = 1 } self.collisionFired = false if not self.GameRenderEvent then self.GameRenderEvent = Events:Subscribe( "GameRender", self, self.GameRender ) end if not self.CaclViewEvent then self.CaclViewEvent = Events:Subscribe( "CalcView", self, self.CalcView ) end if not self.InputPollEvent then self.InputPollEvent = Events:Subscribe( "InputPoll", self, self.InputPoll ) end if not self.LocalPlayerInputEvent then self.LocalPlayerInputEvent = Events:Subscribe( "LocalPlayerInput", self, self.LocalPlayerInput ) end end function Tron:StateChange( args ) self.state = args.state self.stateArgs = args.stateArgs if self.state > GamemodeState.PREPARING and self.state < GamemodeState.ENDING then self.timer:Restart() end end function Tron:UpdateQueue( args ) self.position = args.position self.maxRadius = args.maxRadius self.queue = args.queue self.queueMin = args.min self.queueMax = args.max end function Tron:ExitLobby( args ) Game:FireEvent("ply.vulnerable") self.inLobby = false if self.GameRenderEvent then Events:Unsubscribe( self.GameRenderEvent ) self.GameRenderEvent = nil end if self.CaclViewEvent then Events:Unsubscribe( self.CaclViewEvent ) self.CaclViewEvent = nil end if self.InputPollEvent then Events:Unsubscribe( self.InputPollEvent ) self.InputPollEvent = nil end if self.LocalPlayerInputEvent then Events:Unsubscribe( self.LocalPlayerInputEvent ) self.LocalPlayerInputEvent = nil end LocalPlayer:SetValue( "ServerMap", nil ) end function Tron:CalcView( args ) if not self.inLobby then return end if self.state == GamemodeState.INPROGRESS then if not LocalPlayer:InVehicle() then local players = {} for player in Client:GetPlayers() do if player:GetWorld() == LocalPlayer:GetWorld() and player:InVehicle() then table.insert(players, player) end end if #players > 0 then self.spec.listOffset = self.spec.listOffset >= 0 and self.spec.listOffset % #players or #players + self.spec.listOffset local player = players[self.spec.listOffset + 1] if self.spec.player and IsValid(self.spec.player) and player ~= self.spec.player then self.spec.listOffset = table.find(players, self.spec.player) if self.spec.listOffset then self.spec.listOffset = self.spec.listOffset - 1 else self.spec.listOffset = 0 end elseif not self.spec.player or not IsValid(self.spec.player) then self.spec.player = player end local position = player:GetPosition() local targetPosition = position - ((Angle(player:GetAngle().yaw, 0, 0) * self.spec.angle) * ((Vector3.Forward * 40) + (Vector3.Up * 15))) local direction = targetPosition - player:GetPosition() local length = direction:Length() * self.spec.zoom local raycast = Physics:Raycast(position, direction:Normalized(), 2, length) local distance = IsNaN(raycast.distance) or raycast.distance == length and length or raycast.distance - 0.1 Camera:SetPosition(position + (direction:Normalized() * distance)) local angle = Angle.FromVectors(Vector3.Forward, position - Camera:GetPosition()) if not IsNaN(angle) then angle.roll = 0 -- Fucking I hate angles and Jman100 also TheStatPow (Ну ок) Camera:SetAngle( angle ) end end return false end end end function Tron:InputPoll( args ) if not self.inLobby then return end if self.state == GamemodeState.INPROGRESS then if LocalPlayer:InVehicle() and LocalPlayer:GetVehicle():GetHealth() == 0 then -- Force the player out Input:SetValue(Action.UseItem, 1) Input:SetValue(Action.ExitVehicle, 1) elseif LocalPlayer:InVehicle() then -- Tweak controls Input:SetValue(Action.Accelerate, math.max(0.65, Input:GetValue(Action.Accelerate))) if LocalPlayer:GetVehicle():GetLinearVelocity():Length() < 10 then Input:SetValue(Action.Reverse, 0) end Input:SetValue(Action.Handbrake, 0) end elseif self.state == GamemodeState.PREPARING or self.state == GamemodeState.COUNTDOWN then Input:SetValue(Action.Handbrake, 1) LocalPlayer:SetValue( "ServerMap", 1 ) end end function Tron:LocalPlayerInput( args ) if not self.inLobby then return end if Game:GetState() ~= GUIState.Game then return end local gamepad = Game:GetSetting(GameSetting.GamepadInUse) == 1 if self.state == GamemodeState.PREPARING or self.state == GamemodeState.COUNTDOWN then return false elseif self.state == GamemodeState.INPROGRESS then if table.find(self.blockedActions, args.input) then return false elseif LocalPlayer:InVehicle() then local toggleAction = gamepad and Action.ZoomIn or Action.FireLeft if args.input == toggleAction and Input:GetValue(toggleAction) == 0 then Network:Send( "Firing", {TronFiring = not LocalPlayer:GetValue("TronFiring")} ) end else if Input:GetValue(args.input) == 0 then if args.input == Action.FireLeft then self.spec.listOffset = self.spec.listOffset - 1 self.spec.player = false elseif args.input == Action.FireRight then self.spec.listOffset = self.spec.listOffset + 1 self.spec.player = false end end local sensitivity = { x = (Game:GetSetting(gamepad and GameSetting.GamepadSensitivityX or GameSetting.MouseSensitivityX) * (Game:GetSetting(gamepad and GameSetting.GamepadInvertX or GameSetting.MouseInvertX) and -1 or 1)) / 100 / (math.pi * 2), y = (Game:GetSetting(gamepad and GameSetting.GamepadSensitivityY or GameSetting.MouseSensitivityY) * (Game:GetSetting(gamepad and GameSetting.GamepadInvertY or GameSetting.MouseInvertY) and -1 or 1)) / 100 / (math.pi * 2) } if args.input == Action.LookLeft then self.spec.angle.yaw = self.spec.angle.yaw - (args.state * sensitivity.x) elseif args.input == Action.LookRight then self.spec.angle.yaw = self.spec.angle.yaw + (args.state * sensitivity.x) elseif args.input == Action.LookDown then self.spec.angle.pitch = self.spec.angle.pitch - (args.state * sensitivity.y) elseif args.input == Action.LookUp then self.spec.angle.pitch = self.spec.angle.pitch + (args.state * sensitivity.y) end if gamepad then if args.input == Action.MoveForward then self.spec.zoom = self.spec.zoom + (args.state * sensitivity.y) elseif args.input == Action.MoveBackward then self.spec.zoom = self.spec.zoom - (args.state * sensitivity.y) end else if args.input == Action.NextWeapon then self.spec.zoom = self.spec.zoom + 0.1 elseif args.input == Action.PrevWeapon then self.spec.zoom = self.spec.zoom - 0.1 end end self.spec.zoom = math.clamp(self.spec.zoom, 0.15, 1.5) self.spec.angle.pitch = math.clamp(self.spec.angle.pitch, -1.5, -0.4) LocalPlayer:SetValue( "CustomCrosshairVisible", nil ) end end end function Tron:LocalPlayerExitVehicle( args ) if not self.inLobby then return end if self.state == GamemodeState.INPROGRESS and not self.collisionFired then Network:Send( "Collision", { vehicle = args.vehicle, fell = true } ) self.collisionFired = true end end function Tron:LocalPlayerWorldChange( args ) if args.new_world == DefaultWorld and self.inLobby then self:ExitLobby() end end function Tron:PlayerNetworkValueChange( args ) if args.value == true and args.key == "TronFiring" and args.player:InVehicle() and self.segments[args.player:GetVehicle():GetId()] then local point = Point(args.player:GetVehicle():GetPosition() - args.player:GetVehicle():GetAngle() * Vector3.Forward * 1.5, args.player:GetVehicle():GetAngle()) local segment = self.segments[args.player:GetVehicle():GetId()][#self.segments[args.player:GetVehicle():GetId()]] if segment then self:AddSegment(self.segments[args.player:GetVehicle():GetId()], LineSegment(point, point, segment.height, segment.color)) end end end function Tron:EntityDespawn( args ) if args.entity.__type == "Vehicle" then self.segments[args.entity:GetId()] = nil end end function Tron:PreTick( args ) if not self.inLobby then return end if self.state == GamemodeState.INPROGRESS then Game:FireEvent("ply.invulnerable") local players = {LocalPlayer} for player in Client:GetPlayers() do table.insert(players, player) end for k, player in ipairs(players) do if IsValid(player) and player:InVehicle() and IsValid(player:GetVehicle()) and player == player:GetVehicle():GetDriver() then local vehicle = player:GetVehicle() if not self.segments[vehicle:GetId()] then self.segments[vehicle:GetId()] = {} end end end for k, segments in pairs(self.segments) do local vehicle = Vehicle.GetById(k) if IsValid(vehicle) then local point = Point(vehicle:GetPosition() - vehicle:GetAngle() * Vector3.Forward * 1.5, vehicle:GetAngle()) local height = 1 local color = Color(vehicle:GetColors().r, vehicle:GetColors().g, vehicle:GetColors().b, 100) if (#segments == 0 or segments[#segments]:Length() > 10) and vehicle:GetDriver() and vehicle:GetDriver():GetValue("TronFiring") then self:AddSegment(segments, LineSegment(segments[#segments] and segments[#segments].endPoint or point, point, height, color)) end for k, segment in ipairs(segments) do if k == #segments and vehicle:GetDriver() and vehicle:GetDriver():GetValue("TronFiring") then segment.endPoint = point end if LocalPlayer:InVehicle() and IsValid(LocalPlayer:GetVehicle()) and LocalPlayer:GetVehicle():GetDriver() == LocalPlayer then if LocalPlayer:GetVehicle() ~= vehicle or k < #segments then local pVehicle = LocalPlayer:GetVehicle() local startPoint = Point(pVehicle:GetPosition() - pVehicle:GetAngle() * Vector3.Forward * 1.5, pVehicle:GetAngle()) local endPoint = Point(pVehicle:GetPosition() + pVehicle:GetAngle() * Vector3.Forward * 1.5, pVehicle:GetAngle()) if segment:Intersects(LineSegment(startPoint, endPoint, height, color)) then if not self.collisionFired then Network:Send("Collision", { vehicle = pVehicle, killer = vehicle }) self.collisionFired = true self.spec.player = vehicle:GetDriver() end end end end if self.timer:GetSeconds() - segment.time > 30 then table.remove(segments, k) end end end end if LocalPlayer:InVehicle() then local vehicle = LocalPlayer:GetVehicle() local distance = LocalPlayer:GetPosition():Distance(self.stateArgs.position) if vehicle:GetLinearVelocity():Length() > 8 and distance <= self.stateArgs.maxRadius then self.timer:Restart() end if self.timer:GetSeconds() > 5 and not self.collisionFired then Network:Send( "Collision", { vehicle = vehicle } ) self.collisionFired = true end end end end function Tron:Render( args ) if not self.inLobby or Game:GetState() ~= GUIState.Game then return end if LocalPlayer:GetValue( "SystemFonts" ) then Render:SetFont( AssetLocation.SystemFont, "Impact" ) end local gamepad = Game:GetSetting(GameSetting.GamepadInUse) == 1 if self.state == GamemodeState.WAITING then local playersNeeded = math.max(self.queueMin - #self.queue, 0) DrawCenteredShadowedText( Vector2( Render.Width / 2, 70 ), #self.queue .. ' / ' .. self.queueMax, Color.White, TextSize.Large ) if playersNeeded > 0 then DrawCenteredShadowedText( Vector2( Render.Width / 2, 70 + TextSize.Large ), '(' .. 'Нужно на ' .. playersNeeded .. ' больше' .. (playersNeeded ~= 1 and 'игроков)' or ' игроков)'), Color( 165, 165, 165 ), 25 ) end if self.queue then for k, player in ipairs(self.queue) do DrawCenteredShadowedText( Vector2( Render.Width - 75, Render.Height - 75 - (k * 20) ), player:GetName(), player:GetColor() ) end DrawCenteredShadowedText( Vector2( Render.Width - 75, Render.Height - 75 - ((#self.queue + 1) * 20) ), self.nameTTw, Color.White, 20 ) end elseif self.state == GamemodeState.PREPARING then DrawCenteredShadowedText( Vector2( Render.Width / 2, 70 ), self.nameTTh, Color.White, TextSize.Large ) elseif self.state == GamemodeState.COUNTDOWN then DrawCenteredShadowedText( Vector2( Render.Width / 2, 70 ), math.max(math.ceil(3 - self.timer:GetSeconds()), 1) .. "", Color( 255, 255, 255 ), TextSize.Huge ) elseif self.state == GamemodeState.INPROGRESS then if LocalPlayer:InVehicle() then if gamepad then DrawCenteredShadowedText( Vector2( Render.Width / 2, Render.Height - 35 ), "Нажмите RB, чтобы заморозить свой след.", Color.Yellow ) else DrawCenteredShadowedText( Vector2( Render.Width / 2, Render.Height - 35 ), "Нажмите правой кнопкой мыши, чтобы заморозить свой след.", Color.Yellow ) end else if gamepad then DrawCenteredShadowedText( Vector2( Render.Width / 2, Render.Height - 35 ), "Вы проиграли. Нажмите LB или RB, чтобы начать слежку за другим игроком.", Color.Yellow ) else DrawCenteredShadowedText( Vector2( Render.Width / 2, Render.Height - 35 ), "Вы проиграли. Нажмите левой или правой кнопкой мыши, чтобы начать слежку за другим игроком.", Color.Yellow ) end end if LocalPlayer:InVehicle() then local distance = LocalPlayer:GetPosition():Distance(self.stateArgs.position) if self.timer:GetSeconds() > 2 and distance < self.stateArgs.maxRadius then DrawCenteredShadowedText( Render.Size / 2, self.nameTFo .. math.max(math.ceil(5 - self.timer:GetSeconds()), 1) .. "...", Color.Red, TextSize.Huge ) elseif self.timer:GetSeconds() > 0 and distance >= self.stateArgs.maxRadius then DrawCenteredShadowedText( Render.Size / 2, self.nameTFi .. math.max(math.ceil(5 - self.timer:GetSeconds()), 1) .. "...", Color.Red, TextSize.Huge ) end end if not LocalPlayer:InVehicle() then for player in Client:GetPlayers() do if player:InVehicle() then local position, visible = Render:WorldToScreen(player:GetPosition()) local vehicle = player:GetVehicle() if visible then local color1, color2 = vehicle:GetColors() DrawCenteredShadowedText( position, player:GetName(), color1 ) end end end end end if self.state >= GamemodeState.PREPARING and self.state <= GamemodeState.ENDING then local players = {LocalPlayer} for player in Client:GetPlayers() do if player:GetWorld() == LocalPlayer:GetWorld() then table.insert(players, player) end end for k, player in ipairs(players) do local color = self.state ~= GamemodeState.PREPARING and Color.Black or Color.Gray if player:InVehicle() then color = player:GetVehicle():GetColors() end DrawCenteredShadowedText( Vector2( Render.Width - 75, Render.Height - 75 - (k * 20) ), player:GetName(), color ) end DrawCenteredShadowedText( Vector2( Render.Width - 75, Render.Height - 75 - ((#players + 1) * 20) ), self.nameT, Color.White, 20 ) Render:FillArea( Vector2.Zero, Render.Size, Color( 0, 0, 255, 10 ) ) end end function Tron:GameRender() if self.state == GamemodeState.INPROGRESS then for k, segments in pairs(self.segments) do for k, segment in ipairs(segments) do segment:Render() end end end if self.state == GamemodeState.INPROGRESS or self.state == GamemodeState.COUNTDOWN or self.state == GamemodeState.PREPARING then Render:FillArea( Vector2.Zero, Render.Size, Color( 0, 0, 255, 50 ) ) end end Tron()
-- -- I never tread... lightly. -- Author: Dubpub -- Date: 9/15/2015 -- Time: 4:02 AM -- Use as you please, it's LUA for christ's sake. -- --[[ -- !!!THIS IS VERY EARLY IMPLENTATION AND HIGHLY EXPERIMENTAL!!! -- - I will be improving on pathfinding as more access to the api becomes avialable. - If you have any advice on how the code can be improved, please pm me on the introversion forums or this mods discussion page. - Feel free to copy, remake, do really whatever you want. Like said, be wary. This code may be determental to performance. -- ]] local Time = Game.Time; local Delay = 3; -- It's going to set the routing 30 times before deleting the guard. local KillDelay = 0; local KillTime = 30; local Ready = Time(); function tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end local bodyguard; local function findFollower() return next( this.GetNearbyObjects( "Prisoner", 5 ) ) end local follower = findFollower(); function Create() bodyguard = Object.Spawn("Guard", this.Pos.x, this.Pos.y); if bodyguard ~= nil then if follower ~= nil then bodyguard.NavigateTo(follower.Pos.x, follower.Pos.y); else bodyguard.Delete(); end end this.Delete(); end function Update() if Time() > Ready then Act( Delay ) Ready = Ready + Delay KillDelay = KillDelay + 1; end end -- Update following. function Act( elapsedTime ) bodyguard.ClearRouting(); bodyguard.PlayerOrderPos.x = follower.Pos.x; bodyguard.PlayerOrderPos.y = follower.Pos.y; -- Radio for help if health goes above 0 and no KO'd if bodyguard.Damage > 0 and bodyguard.Damage < 0.85 then local nearbyGuards = this.GetNearbyObjects( "Guard", 30 ); for Guard, _ in next, nearbyGuards do Guard.PlayerOrderPos.x = bodyguard.Pos.x; Guard.PlayerOrderPos.y = bodyguard.Pos.y; end end if KillDelay == KillTime then bodyguard.ClearRouting(); bodyguard.Delete(); end end
object_building_mustafar_terrain_must_rock_smooth_lava_03 = object_building_mustafar_terrain_shared_must_rock_smooth_lava_03:new { } ObjectTemplates:addTemplate(object_building_mustafar_terrain_must_rock_smooth_lava_03, "object/building/mustafar/terrain/must_rock_smooth_lava_03.iff")
local K, C, L, _ = unpack(select(2, ...)) local format = string.format local gsub = string.gsub local pairs = pairs local unpack = unpack local CreateFrame, UIParent = CreateFrame, UIParent local ToggleFrame = ToggleFrame -- Copy Chat local lines = {} local frame = nil local editBox = nil local isf = nil local sizes = { ":14:14", ":15:15", ":16:16", ":12:20", ":14" } local function CreatCopyFrame() frame = CreateFrame("Frame", "CopyFrame", UIParent) frame:SetBackdrop(K.Backdrop) frame:SetBackdropBorderColor(unpack(C["media"].border_color)) frame:SetBackdropColor(unpack(C["media"].backdrop_color)) frame:SetWidth(540) frame:SetHeight(300) frame:SetPoint("CENTER", UIParent, "CENTER", 0, 100) frame:SetFrameStrata("DIALOG") tinsert(UISpecialFrames, "CopyFrame") frame:Hide() local scrollArea = CreateFrame("ScrollFrame", "CopyScroll", frame, "UIPanelScrollFrameTemplate") scrollArea:SetPoint("TOPLEFT", frame, "TOPLEFT", 8, -30) scrollArea:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -30, 8) editBox = CreateFrame("EditBox", "CopyBox", frame) editBox:SetMultiLine(true) editBox:SetMaxLetters(99999) editBox:EnableMouse(true) editBox:SetAutoFocus(false) editBox:SetFontObject(ChatFontNormal) editBox:SetWidth(500) editBox:SetHeight(300) editBox:SetScript("OnEscapePressed", function() frame:Hide() end) scrollArea:SetScrollChild(editBox) editBox:SetScript("OnTextSet", function(self) local text = self:GetText() for _, size in pairs(sizes) do if string.find(text, size) and not string.find(text, size.."]") then self:SetText(string.gsub(text, size, ":12:12")) end end end) local close = CreateFrame("Button", "CopyCloseButton", frame, "UIPanelCloseButton") close:SetPoint("TOPRIGHT", frame, "TOPRIGHT") scrollArea:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -30, 8) isf = true end local scrollDown = function() CopyScroll:SetVerticalScroll((CopyScroll:GetVerticalScrollRange()) or 0) end local function Copy(cf) local text = "" for i = 1, cf:GetNumMessages() do text = text..cf:GetMessageInfo(i).."\n" end text = text:gsub("|[Tt]Interface\\TargetingFrame\\UI%-RaidTargetingIcon_(%d):0|[Tt]", "{rt%1}") text = text:gsub("|[Tt][^|]+|[Tt]", "") if not isf then CreatCopyFrame() end if frame:IsShown() then frame:Hide() return end frame:Show() editBox:SetText(text) end for i = 1, NUM_CHAT_WINDOWS do local cf = _G[format("ChatFrame%d", i)] local button = CreateFrame("Button", format("ButtonCF%d", i), cf) button:SetPoint("BOTTOMRIGHT", 3, 1) button:SetHeight(18) button:SetWidth(18) K.SetBlizzBorder(button, 2) button:SetAlpha(0.1) local buttontexture = button:CreateTexture(nil, "BORDER") buttontexture:SetPoint("CENTER") buttontexture:SetTexture("Interface\\BUTTONS\\UI-GuildButton-PublicNote-Up") buttontexture:SetHeight(16) buttontexture:SetWidth(16) button:SetScript("OnMouseUp", function(self, btn) if btn == "RightButton" then ToggleFrame(ChatMenu) elseif btn == "MiddleButton" then RandomRoll(1, 100) else Copy(cf) end end) button:HookScript("OnEnter", function() button:FadeIn() end) button:HookScript("OnLeave", function() button:FadeOut() end) SlashCmdList.COPY_CHAT = function() Copy(_G["ChatFrame1"]) end end
-- -- codelite_project.lua -- Generate a CodeLite C/C++ project file. -- Copyright (c) 2009, 2011 Jason Perkins and the Premake project -- local codelite = premake.codelite local tree = premake.tree -- -- Write out a list of the source code files in the project. -- function codelite.files(prj) local tr = premake.project.buildsourcetree(prj) tree.traverse(tr, { -- folders are handled at the internal nodes onbranchenter = function(node, depth) _p(depth, '<VirtualDirectory Name="%s">', node.name) end, onbranchexit = function(node, depth) _p(depth, '</VirtualDirectory>') end, -- source files are handled at the leaves onleaf = function(node, depth) _p(depth, '<File Name="%s"/>', node.cfg.name) end, }, false, 1) end -- -- The main function: write out the project file. -- function premake.codelite.project(prj) io.indent = " " _p('<?xml version="1.0" encoding="utf-8"?>') _p('<CodeLite_Project Name="%s">', premake.esc(prj.name)) -- Write out the list of source code files in the project codelite.files(prj) local types = { ConsoleApp = "Executable", WindowedApp = "Executable", StaticLib = "Static Library", SharedLib = "Dynamic Library", } _p(' <Settings Type="%s">', types[prj.kind]) -- build a list of supported target platforms; I don't support cross-compiling yet local platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms, "Native") for i = #platforms, 1, -1 do if premake.platforms[platforms[i]].iscrosscompiler then table.remove(platforms, i) end end for _, platform in ipairs(platforms) do for cfg in premake.eachconfig(prj, platform) do local name = premake.esc(cfg.longname) local compiler = iif(cfg.language == "C", "gcc", "g++") _p(' <Configuration Name="%s" CompilerType="gnu %s" DebuggerType="GNU gdb debugger" Type="%s">', name, compiler, types[cfg.kind]) local fname = premake.esc(cfg.buildtarget.fullpath) local objdir = premake.esc(cfg.objectsdir) local runcmd = cfg.buildtarget.name local rundir = cfg.debugdir or cfg.buildtarget.directory local runargs = table.concat(cfg.debugargs, " ") local pause = iif(cfg.kind == "WindowedApp", "no", "yes") _p(' <General OutputFile="%s" IntermediateDirectory="%s" Command="./%s" CommandArguments="%s" WorkingDirectory="%s" PauseExecWhenProcTerminates="%s"/>', fname, objdir, runcmd, runargs, rundir, pause) -- begin compiler block -- local flags = premake.esc(table.join(premake.gcc.getcflags(cfg), premake.gcc.getcxxflags(cfg), cfg.buildoptions)) _p(' <Compiler Required="yes" Options="%s">', table.concat(flags, ";")) for _,v in ipairs(cfg.includedirs) do _p(' <IncludePath Value="%s"/>', premake.esc(v)) end for _,v in ipairs(cfg.defines) do _p(' <Preprocessor Value="%s"/>', premake.esc(v)) end _p(' </Compiler>') -- end compiler block -- -- begin linker block -- flags = premake.esc(table.join(premake.gcc.getldflags(cfg), cfg.linkoptions)) _p(' <Linker Required="yes" Options="%s">', table.concat(flags, ";")) for _,v in ipairs(premake.getlinks(cfg, "all", "directory")) do _p(' <LibraryPath Value="%s" />', premake.esc(v)) end for _,v in ipairs(premake.getlinks(cfg, "all", "basename")) do _p(' <Library Value="%s" />', premake.esc(v)) end _p(' </Linker>') -- end linker block -- -- begin resource compiler block -- if premake.findfile(cfg, ".rc") then local defines = table.implode(table.join(cfg.defines, cfg.resdefines), "-D", ";", "") local options = table.concat(cfg.resoptions, ";") _p(' <ResourceCompiler Required="yes" Options="%s%s">', defines, options) for _,v in ipairs(table.join(cfg.includedirs, cfg.resincludedirs)) do _p(' <IncludePath Value="%s"/>', premake.esc(v)) end _p(' </ResourceCompiler>') else _p(' <ResourceCompiler Required="no" Options=""/>') end -- end resource compiler block -- -- begin build steps -- if #cfg.prebuildcommands > 0 then _p(' <PreBuild>') for _,v in ipairs(cfg.prebuildcommands) do _p(' <Command Enabled="yes">%s</Command>', premake.esc(v)) end _p(' </PreBuild>') end if #cfg.postbuildcommands > 0 then _p(' <PostBuild>') for _,v in ipairs(cfg.postbuildcommands) do _p(' <Command Enabled="yes">%s</Command>', premake.esc(v)) end _p(' </PostBuild>') end -- end build steps -- _p(' <CustomBuild Enabled="no">') _p(' <CleanCommand></CleanCommand>') _p(' <BuildCommand></BuildCommand>') _p(' <SingleFileCommand></SingleFileCommand>') _p(' <MakefileGenerationCommand></MakefileGenerationCommand>') _p(' <ThirdPartyToolName>None</ThirdPartyToolName>') _p(' <WorkingDirectory></WorkingDirectory>') _p(' </CustomBuild>') _p(' <AdditionalRules>') _p(' <CustomPostBuild></CustomPostBuild>') _p(' <CustomPreBuild></CustomPreBuild>') _p(' </AdditionalRules>') _p(' </Configuration>') end end _p(' </Settings>') for _, platform in ipairs(platforms) do for cfg in premake.eachconfig(prj, platform) do _p(' <Dependencies name="%s">', cfg.longname) for _,dep in ipairs(premake.getdependencies(prj)) do _p(' <Project Name="%s"/>', dep.name) end _p(' </Dependencies>') end end _p('</CodeLite_Project>') end
----------------------------------- -- Ability: Velocity Shot -- Increases attack power and speed of ranged attacks, while reducing attack power and speed of melee attacks. -- Obtained: Ranger Level 45 -- Recast Time: 5:00 minutes -- Duration: 2 hours ----------------------------------- require("scripts/globals/settings") require("scripts/globals/status") ----------------------------------- function onAbilityCheck(player,target,ability) return 0,0 end function onUseAbility(player,target,ability) player:addStatusEffect(tpz.effect.VELOCITY_SHOT,1,0,7200) end
-- Sleep specific seconds -- @param[optional] seconds - sleep seconds, if not set, causes the thread to relinquish the remainder of its time. -- @returns - no return. function llbc.sleep(seconds) if type(seconds) == 'nil' then seconds = 0 end _llbc.Thread_Sleep(seconds) end
-- -- $Id$ -- module( "resmng" ) svnnum("$Id$") LG_VERSION_UPDATE = 10000 LG_VERSION_DOWNLOAD = 10001 LG_VERSION_DEMPORESS = 10002 LG_USERNAME_ERROR = 10003 LG_PASSWORD_ERROR = 10004 LG_CONNECT_FAILURE = 10005 LG_UNDEFINE_ERROR = 10006 LG_DISCONNECT = 10007 LG_VERSION = 10008 LG_LOGIN = 10009 LG_UH_STORY = 10010 LG_UH_ABATTOIR = 10011 LG_UH_TASK = 10012 LG_UH_DRILL = 10013 LG_UH_CHALLENGE = 10014
-- © 2008 David Given. -- WordGrinder is licensed under the MIT open source license. See the COPYING -- file in this distribution for the full text. local int = math.floor local GetStringWidth = wg.getstringwidth -- This code defines the various controllers that work the margin displays. -- It's all a little overengineered, but is really intended to test some -- modularisation concepts. local no_margin_controller = { attach = function(self) Document.margin = 0 NonmodalMessage("Hiding margin.") end, getcontent = function(self, pn, paragraph) return nil end } local style_name_controller = { attach = function(self) local m = 0 for _, style in pairs(DocumentStyles) do local mm = GetStringWidth(style.name) if (mm > m) then m = mm end end Document.margin = m + 1 NonmodalMessage("Margin now displays paragraph styles.") end, getcontent = function(self, pn, paragraph) return paragraph.style end } local paragraph_number_controller = { attach = function(self) local cb = function() Document.margin = int(math.log10(#Document)) + 3 end self.token = AddEventListener(Event.Changed, cb) cb() NonmodalMessage("Margin now displays paragraph numbers.") end, detach = function(self) RemoveEventListener(self.token) self.token = nil end, getcontent = function(self, pn, paragraph) return tostring(pn) end } local word_count_controller = { attach = function(self) Document.margin = 5 NonmodalMessage("Margin now displays word counts.") end, getcontent = function(self, pn, paragraph) return tostring(#paragraph) end } MarginControllers = { [1] = no_margin_controller, [2] = style_name_controller, [3] = paragraph_number_controller, [4] = word_count_controller } --- Sets a specific margin mode for the current document. -- -- @param mode the new margin mode function SetMarginMode(mode) local controller = MarginControllers[Document.viewmode] if controller.detach then controller:detach() end Document.viewmode = mode controller = MarginControllers[Document.viewmode] if controller.attach then controller:attach() end DocumentSet:touch() ResizeScreen() end function Cmd.SetViewMode(mode) SetMarginMode(mode) QueueRedraw() return true end
#!/usr/local/bin/lua MAX_ROWS = arg[1] or 10 require"postgres" local env = assert (luasql.postgres ()) local conn = assert (env:connect ("luasql-test", "tomas")) -- Apaga restos de outros testes. conn:execute "drop table t2" conn:execute "drop table t1" -- Criando as tabelas. assert (conn:execute [[create table t1 ( a int, b int )]]) assert (conn:execute [[create table t2 ( c int, d int )]]) -- Preenchedo as tabelas. for i = 1, MAX_ROWS do local ii = 2*i assert (conn:execute (string.format ([[ insert into t1 values (%d, %d); insert into t2 values (%d, %d);]], ii, i, ii, i))) end
local ltn12 = require("ltn12") local http = require "socket.http" local json = require "lunajson" local kong = kong local type = type local re_gmatch = ngx.re.gmatch local _M = {} local function retrieve_token(conf) local request_headers = kong.request.get_headers() for _, v in ipairs(conf.header_names) do local token_header = request_headers[v] if token_header then if type(token_header) == "table" then token_header = token_header[1] end local iterator, iter_err = re_gmatch(token_header, "\\s*[Bb]earer\\s+(.+)") if not iterator then kong.log.err(iter_err) break end local m, err = iterator() if err then kong.log.err(err) break end if m and #m > 0 then return m[1] end end end end local function call_validate(conf, token) local url if conf.kubernetes_external_name then url = "http://" .. conf.kubernetes_external_name .. conf.api_validate_url else url = kong.request.get_scheme() .. "://" .. kong.request.get_host() .. ":" .. kong.request.get_port() .. conf.api_path_prefix .. conf.api_validate_url end local t = {} local ok, statusCode = http.request { url = url, sink = ltn12.sink.table(t), method = "GET", headers = { Authorization = "Bearer " .. token } } return statusCode == 200 end local function get_user_infos(conf, token) local url if conf.kubernetes_external_name then url = "http://" .. conf.kubernetes_external_name .. conf.api_user_url else url = kong.request.get_scheme() .. "://" .. kong.request.get_host() .. ":" .. kong.request.get_port() .. conf.api_path_prefix .. conf.api_user_url end local t = {} local ok, statusCode = http.request { url = url, sink = ltn12.sink.table(t), method = "GET", headers = { Authorization = "Bearer " .. token } } local body = table.concat(t) if statusCode == 200 then return true, body end return false, nil; end local function check_jwt(conf) local token, err = retrieve_token(conf) if err then kong.log.err(err) return kong.response.exit(500, { message = "An unexpected error occurred" }) end local token_type = type(token) if token_type ~= "string" then if token_type == "nil" then return false, { status = 401, message = "Unauthorized" }, nil elseif token_type == "table" then return false, { status = 401, message = "Multiple tokens provided" }, nil else return false, { status = 401, message = "Unrecognizable token" }, nil end end local ok = call_validate(conf, token) if not ok then return false, { status = 401, message = "Unauthorized" }, nil end local ok1, user = get_user_infos(conf, token) if not ok1 then return false, { status = 401, message = "Unauthorized" }, nil end return true, nil, user end local function set_user(user) local set_header = kong.service.request.set_header set_header('x-user', user) end local function ends_with(str, ending) return ending == "" or str:sub(-#ending) == ending end local function starts_with(str, start) return str:sub(1, #start) == start end local function is_empty(s) return s == nil or s == '' end function _M.execute(conf) -- check if preflight request and whether it should be authenticated if not conf.run_on_preflight and kong.request.get_method() == "OPTIONS" then return end if ends_with(kong.request.get_path(), conf.api_login_url) or ends_with(kong.request.get_path(), conf.api_validate_url) or ends_with(kong.request.get_path(), conf.api_user_url) or not starts_with(kong.request.get_path(), '/api') then return end local ok, err, user = check_jwt(conf) if ok then set_user(user) else return kong.response.exit(err.status, err.erros or { message = err.message }) end end return _M
#!/usr/bin/env tarantool -- gh-3350, gh-2859 local test = require("sqltester") test:plan(4) local function lindex(str, pos) return str:sub(pos+1, pos+1) end local function int_to_char(i) local res = '' local char = 'abcdefghij' local divs = {1000, 100, 10, 1} for _, div in ipairs(divs) do res = res .. lindex(char, math.floor(i/div) % 10) end return res end box.internal.sql_create_function("lindex", "TEXT", lindex) box.internal.sql_create_function("int_to_char", "TEXT", int_to_char) test:do_execsql_test( "skip-scan-1.1", [[ DROP TABLE IF EXISTS t1; CREATE TABLE t1(a TEXT COLLATE "unicode_ci", b TEXT, c TEXT, d TEXT, e INT, f INT, PRIMARY KEY(c, b, a)); WITH data(a, b, c, d, e, f) AS (SELECT int_to_char(0), 'xyz', 'zyx', '*', 0, 0 UNION ALL SELECT int_to_char(f+1), b, c, d, (e+1) % 2, f+1 FROM data WHERE f<1024) INSERT INTO t1 SELECT a, b, c, d, e, f FROM data; ANALYZE; SELECT COUNT(*) FROM t1 WHERE a < 'aaad'; DROP TABLE t1; ]], { 3 }) test:do_execsql_test( "skip-scan-1.2", [[ DROP TABLE IF EXISTS t2; CREATE TABLE t2(a TEXT COLLATE "unicode_ci", b TEXT, c TEXT, d TEXT, e INT, f INT, PRIMARY KEY(e, f)); WITH data(a, b, c, d, e, f) AS (SELECT int_to_char(0), 'xyz', 'zyx', '*', 0, 0 UNION ALL SELECT int_to_char(f+1), b, c, d, (e+1) % 2, f+1 FROM data WHERE f<1024) INSERT INTO t2 SELECT a, b, c, d, e, f FROM data; ANALYZE; SELECT COUNT(*) FROM t2 WHERE f < 500; DROP TABLE t2; ]], { 500 } ) test:do_execsql_test( "skip-scan-1.3", [[ DROP TABLE IF EXISTS t3; CREATE TABLE t3(a TEXT COLLATE "unicode_ci", b TEXT, c TEXT, d TEXT, e INT, f INT, PRIMARY KEY(a)); CREATE INDEX i31 ON t3(e, f); WITH data(a, b, c, d, e, f) AS (SELECT int_to_char(0), 'xyz', 'zyx', '*', 0, 0 UNION ALL SELECT int_to_char(f+1), b, c, d, (e+1) % 2, f+1 FROM data WHERE f<1024) INSERT INTO t3 SELECT a, b, c, d, e, f FROM data; ANALYZE; SELECT COUNT(*) FROM t3 WHERE f < 500; DROP INDEX i31 on t3; DROP TABLE t3; ]], { 500 } ) test:do_execsql_test( "skip-scan-1.4", [[ DROP TABLE IF EXISTS t1; CREATE TABLE t1(id INTEGER PRIMARY KEY, a TEXT, b INT, c INT, d INT); CREATE INDEX t1abc ON t1(a,b,c); DROP TABLE IF EXISTS t2; CREATE TABLE t2(id INTEGER PRIMARY KEY); INSERT INTO t2 VALUES(1); INSERT INTO t1 VALUES(1, 'abc',123,4,5); INSERT INTO t1 VALUES(2, 'abc',234,5,6); INSERT INTO t1 VALUES(3, 'abc',234,6,7); INSERT INTO t1 VALUES(4, 'abc',345,7,8); INSERT INTO t1 VALUES(5, 'def',567,8,9); INSERT INTO t1 VALUES(6, 'def',345,9,10); INSERT INTO t1 VALUES(7, 'bcd',100,6,11); ANALYZE; DELETE FROM "_sql_stat1"; DELETE FROM "_sql_stat4"; INSERT INTO "_sql_stat1" VALUES('T1','T1ABC','10000 5000 2000 10'); ANALYZE t2; SELECT a,b,c,d FROM t1 WHERE b=345; ]], { "abc", 345, 7, 8, "def", 345, 9, 10 } ) test:finish_test()
function Dizzeansprite.main() end function Dizzeansprite.LaunchDamageSound(_ARG_0_) end
local sh = { } sh.type = "vertex" sh.maxJoints = 16 function sh:getId(dream, mat, shadow) return 0 end function sh:initObject(dream, obj) if obj.mesh then --initial prepare bone data if not obj.boneMesh and not obj.meshes then assert(obj.joints and obj.weights, "GPU bones require a joint and weight buffer") obj.boneMesh = love.graphics.newMesh({{"VertexJoint", "byte", 4}, {"VertexWeight", "byte", 4}}, #obj.joints, "triangles", "static") --create mesh for d,s in ipairs(obj.joints) do local w = obj.weights[d] obj.boneMesh:setVertex(d, (s[1] or 0) / 255, (s[2] or 0) / 255, (s[3] or 0) / 255, (s[4] or 0) / 255, w[1] or 0, w[2] or 0, w[3] or 0, w[4] or 0) end end if obj.boneMesh then obj:getMesh("mesh"):attachAttribute("VertexJoint", obj:getMesh("boneMesh")) obj:getMesh("mesh"):attachAttribute("VertexWeight", obj:getMesh("boneMesh")) end end end function sh:buildDefines(dream, mat) return [[ #ifdef VERTEX #define BONE const int MAX_JOINTS = ]] .. self.maxJoints .. [[; extern mat4 jointTransforms[MAX_JOINTS]; attribute vec4 VertexJoint; attribute vec4 VertexWeight; #endif ]] end function sh:buildPixel(dream, mat) return "" end function sh:buildVertex(dream, mat) return [[ mat4 boneTransform = ( jointTransforms[int(VertexJoint[0]*255.0)] * VertexWeight[0] + jointTransforms[int(VertexJoint[1]*255.0)] * VertexWeight[1] + jointTransforms[int(VertexJoint[2]*255.0)] * VertexWeight[2] + jointTransforms[int(VertexJoint[3]*255.0)] * VertexWeight[3] ); VertexPos = (boneTransform * VertexPosition).xyz; VertexPos = (transform * vec4(VertexPos.xyz, 1.0)).xyz; normalTransform = mat3(boneTransform) * normalTransform; ]] end function sh:perShader(dream, shaderObject) end function sh:perMaterial(dream, shaderObject, material) end function sh:perTask(dream, shaderObject, task) local bt = task:getBoneTransforms() assert(bt, "missing bone transforms") if shaderObject.session.bones ~= bt then shaderObject.session.bones = bt local matrices = {mat4:getIdentity()} if task:getSubObj().jointIDs then for i,j in ipairs(task:getSubObj().jointIDs) do matrices[i+1] = bt[j] end end shaderObject.shader:send("jointTransforms", unpack(matrices)) end end return sh
local NetworkService = require "utils.NetworkService"; local EventManager = require 'utils.EventManager'; local Shop_Data = nil; local Time = require "module.Time" local activityConfig = require "config.activityConfig" --查询公会仓库的时间 local next_fresh_time = nil; local query_time = nil; local Shop_Data_Two = nil; local mapSnAar = nil local function get_timezone() local now = os.time() return os.difftime(now, os.time(os.date("!*t", now)))/3600 end local function date(now) local now = now or Time.now(); return os.date ("!*t", now + 8 * 3600); end local function getTimeByDate(year,month,day,hour,min,sec) local east8 = os.time({year = year, month = month, day = day, hour = hour, min = min, sec = sec})+ (get_timezone()-8) * 3600 return east8 end -- 3427 --查询地图商店 local function QueryMapShopInfo( mapid,status ) if query_time then --将上次的时间转换成年月日 local time_t = date(query_time) --求到第二天的时间戳 local querytime = getTimeByDate(time_t.year,time_t.month,time_t.day+1,0,0,0); -- ERROR_LOG("上次查询时间",querytime,Time.now()); if Time.now() > querytime then else if not status and Shop_Data then if not Shop_Data or not Shop_Data[mapid] or not next(Shop_Data[mapid]) then return nil; end return (not next(Shop_Data[mapid])) and nil or Shop_Data[mapid].mainData; end end else end mapSnAar = {}; local allmap = activityConfig.GetCityConfig().map_id; for k,v in pairs(allmap) do local ret = NetworkService.Send(3427,{nil,v.map_id}); mapSnAar[ret] = v.map_id; end query_time = Time.now(); -- ERROR_LOG("QueryMapShopInfo",sprinttb(mapSnAar)); end local function GetFreshTime(mapid) return Shop_Data[mapid].fresh_time; end local function updateShopInfo( data,fresh_time,mapid ) if not data then -- ERROR_LOG("data is nil"); return; end for k,v in pairs(data) do local map_id = v[2]; local gid = v[1]; local consume = v[3][1]; local limt_consume = v[4][1]; local reward = v[5][1]; --地图仓库获得的物品 local map_wareRoom = v[6]; --军团获得的物品 local guild_rewardid = v[7]; local guild_rewardvalue = v[8]; local guildReward = {id = guild_rewardid,value = guild_rewardvalue}; local storage = v[9]; local sell_count = v[10]; local specialty = v[11]; local default_price = v[12]; local buy_limit = v[13]; local buy_type = v[16]; local temp = {map_id = map_id,gid = gid,consume = consume, limt_consume = limt_consume,reward = reward,map_wareRoom = map_wareRoom, guildReward = guildReward,storage = storage, sell_count = sell_count, specialty = specialty, default_price = default_price, buy_limit = buy_limit, buy_type = buy_type, }; Shop_Data[map_id].custom[consume[2]] = Shop_Data[map_id].custom[consume[2]] or {}; Shop_Data[map_id].custom[consume[2]] [reward[2]] = { gid = gid,mapid = map_id, value = consume[3] }; -- [consume[2]] [[reward[2]] = {value = consume[3]} if buy_type == 1 then table.insert( Shop_Data[map_id].mainData, temp ); else Shop_Data_Two = Shop_Data_Two or {}; Shop_Data_Two[map_id] = Shop_Data_Two[map_id] or {}; table.insert( Shop_Data_Two[map_id], temp ); end end if Shop_Data then Shop_Data[mapid].fresh_time = fresh_time; for k,v in pairs(Shop_Data) do table.sort( v, function ( a,b ) return a.mainData.gid < b.mainData.gid; end ) end end end local function GetMapShopInfo( mapid ) return Shop_Data_Two and Shop_Data_Two[mapid] or Shop_Data_Two end local Snaar = nil; local Depot = nil; local function GetMapDepot( map_id ) return Depot and Depot[map_id] or nil; end --查询地图仓库 local function QueryMapDepot(map_id,isreset) if not isreset then -- GetMapDepot(map_id); if next_fresh_time then if next_fresh_time - Time.now() < 60 then return ; end else next_fresh_time = Time.now(); end end next_fresh_time = Time.now(); local sn = NetworkService.Send(3441,{nil,map_id}); Snaar = Snaar or {}; Snaar[sn] = map_id; end -- 1531238400 EventManager.getInstance():addListener("server_respond_3428",function ( event,cmd,data ) -- ERROR_LOG("查询地图商店","server_respond_3428",sprinttb(data)); local sn = data[1]; -- print("sn---------",sn) Shop_Data = Shop_Data or {}; -- ERROR_LOG(mapSnAar[sn]) if mapSnAar[sn] then Shop_Data[mapSnAar[sn]] = {}; Shop_Data[mapSnAar[sn]].mainData = {}; Shop_Data[mapSnAar[sn]].custom = {}; if data[2] == 0 then if next(data[3]) then updateShopInfo(data[3],data[4],mapSnAar[sn]); DispatchEvent("QUERY_MAP_SHOPINFO_SUCCESS",mapSnAar[sn]); end else end end end) local function QueryMapProducInfo(mapid) return Shop_Data[mapid].custom; end local buyAAr = nil; --购买地图商店商品 local function BuyMapProduct( gid,num ,mapid,callback) -- ERROR_LOG("购买商品"..gid); local ret = NetworkService.Send(3429,{nil,gid,num or 1}); buyAAr = buyAAr or {}; buyAAr[ret] = {gid = gid,mapid = mapid,func = callback } end EventManager.getInstance():addListener("server_respond_3430",function ( event,cmd,data ) -- ERROR_LOG("购买商品","server_respond_3430",sprinttb(data)); local _data = buyAAr[data[1]]; if _data.func then _data.func(); end if data[2] == 0 then -- Shop_Data[mapID][current] = data[2][1]; -- print("重新查询数量",sprinttb(_data)) QueryMapDepot(_data.mapid,true); DispatchEvent("CITY_BUSINESSINFO_CHANGE",_data.mapid); -- DispatchEvent("QUERY_MAP_SHOPINFO_SUCCESS",{[data[2][2]] = Shop_Data[data[2][2]]}); elseif data[2] == 108 then showDlgError(nil,"商品已售完!"); QueryMapDepot(_data.mapid,true); end end) local SnPrice = nil local function SetMapPrice( price_tb ,mapid) SnPrice = SnPrice or {}; local ret = NetworkService.Send(3431,{nil,price_tb}); SnPrice[ret] = { mapid = mapid } -- print("设置价格",sprinttb(price_tb)) end EventManager.getInstance():addListener("server_respond_3432",function ( event,cmd,data ) -- ERROR_LOG("设置价格返回","server_respond_3432",sprinttb(data)); if data[2] == 0 then local mapid = SnPrice[data[1]].mapid -- Shop_Data[mapid][current] = data[2][1]; if Shop_Data[mapid] and Shop_Data[mapid].fresh_time then Shop_Data[mapid].fresh_time = Time.now(); end DispatchEvent("MAP_SET_SHOPINFO_SUCCESS"); else end end) local function updateShopPrice(data) if Shop_Data then if not Shop_Data[data.mapid] then return; end for k,v in pairs(Shop_Data[data.mapid].mainData) do if v.gid == data.gid then v.consume[3] = data.price; Shop_Data[data.mapid].custom[v.consume[2]] [v.reward[2]].value = v.consume[3] ; -- v.consume[] end end end end local nex_fresh_price = nil; EventManager.getInstance():addListener("server_notify_3425",function ( event,cmd,data) -- ERROR_LOG("商品价格通知","server_notify_3425",sprinttb(data)) for k,v in pairs(data) do local temp = { mapid = v[2] ,gid = v[1],price = v[3] } updateShopPrice(temp); end if nex_fresh_price and nex_fresh_price - Time.now() > 60 then DispatchEvent("MAP_SHOP_PRICE_INFOCHANGE",data[2]); else nex_fresh_price = Time.now(); end end) local function updateSellCout( data ) if Shop_Data then if not Shop_Data[data.mapid] then return; end for k,v in pairs(Shop_Data[data.mapid].mainData) do if v.gid == data.gid then v.sell_count = data.sell_count; end end end end -- 3425 EventManager.getInstance():addListener("server_notify_3426",function ( event,cmd,data) -- ERROR_LOG("出售数量变化通知","server_notify_3426",sprinttb(data)) local temp = { mapid = data[2],gid = data[1],sell_count = data[3] }; updateSellCout(temp); -- DispatchEvent("MAP_SHOP_COUNT_INFOCHANGE",data[2]); end) local function updateMapDepot(mapid,data) Depot = Depot or {}; Depot[mapid] = {}; for k,v in pairs(data) do -- print("------------",v[1]) Depot[mapid][v[1]] = {value = v[2]}; end end EventManager.getInstance():addListener("server_respond_3442",function ( event,cmd,data ) -- ERROR_LOG("查询地图仓库","server_respond_3442",sprinttb(data)); local sn = data[1]; local mapid = Snaar[sn]; if data[2] == 0 then updateMapDepot(mapid,data[3]); DispatchEvent("QUERY_MAP_DEPOT",mapid); end end) return { QueryMapShopInfo = QueryMapShopInfo, --查询地图商店信息 SetMapPrice = SetMapPrice, --设置商品价格 BuyMapProduct = BuyMapProduct, -- 购买商品 QueryMapProducInfo = QueryMapProducInfo, QueryMapDepot = QueryMapDepot , --查询地图仓库 GetMapDepot = GetMapDepot, GetMapShopInfo = GetMapShopInfo, GetFreshTime = GetFreshTime, }
---This config file is designed for running password-dumping scripts. So far, -- it supports pwdump6 2.0.0 and fgdump. -- -- Note that none of these modules are included with Nmap by default. -- Any variable in the 'config' table in smb-psexec.nse can be overriden in the -- 'overrides' table. Most of them are not really recommended, such as the host, -- key, etc. overrides = {} --overrides.timeout = 40 modules = {} local mod --mod = {} --mod.upload = true --mod.name = "PwDump6 2.0.0" --mod.program = "PwDump.exe" --mod.args = "localhost" --mod.maxtime = 10 --mod.include_stderr = false --mod.url = "http://www.foofus.net/fizzgig/pwdump/" --table.insert(modules, mod) ---Uncomment if you'd like to use PwDump6 1.7.2 (considered obsolete, but still works). -- Note that for some reason, this and 'fgdump' don't get along (fgdump only produces a blank -- file if these are run together) --mod = {} --mod.upload = true --mod.name = "PwDump6 1.7.2" --mod.program = "PwDump-1.7.2.exe" --mod.args = "localhost" --mod.maxtime = 10 --mod.include_stderr = false --mod.extrafiles = {"servpw.exe", "lsremora.dll"} --mod.url = "http://www.foofus.net/fizzgig/pwdump/" --table.insert(modules, mod) -- Warning: the danger of using fgdump is that it always write the output to the harddrive unencrypted; -- this makes it more obvious that an attack has occurred. mod = {} mod.upload = true mod.name = "FgDump" mod.program = "fgdump.exe" mod.args = "-c -l fgdump.log" mod.maxtime = 10 mod.url = "http://www.foofus.net/fizzgig/fgdump/" mod.tempfiles = {"fgdump.log"} mod.outfile = "127.0.0.1.pwdump" table.insert(modules, mod)
module(..., package.seeall) --[[ Hangup the call. ]] function hangup(action) -- Clean key map to prevent any key presses here. jester.keys = {} -- Play a hangup file if specified. if action.play then session:streamFile(action.play) end jester.debug_log("Hangup called in sequence action") session:hangup(); end --[[ Register a sequence to run in the hangup sequence loop. ]] function register_hangup_sequence(action) if action.sequence then local event = {} event.event_type = "sequence" event.sequence = action.sequence table.insert(jester.channel.stack.hangup, event) jester.debug_log("Registered hangup sequence: %s", event.sequence) end end
--[[ #FreInclude <ustring\functions\ustring.lua> ]]-- --[[ This is a simple sample which shows how to use ustring functions lib. You'd better use this with iLua. ]]-- toolpalette.enablePaste(true); orgiString = ""; displayBuff = {}; function on.paint(gc) if(orgiStrong == "") then gc:drawString("Paste a string here", 120, 120); return; end gc:drawString(orgiString, 0, 20); --Orginal String local Height = 40; for i, v in pairs(displayBuff) do gc:drawString(v, 0, Height); Height = Height + 20; end end function on.paste() orgiString = clipboard.getText(); displayBuff = {}; table.insert(displayBuff, "len:" .. string.ulen(orgiString)); table.insert(displayBuff, "bytes:" .. string.len(orgiString)); local t = string.MbtoUTF8table(orgiString); table.sort(t); table.insert(displayBuff, "sorted str:" .. string.UTF8tabletoMb(t)); platform.window:invalidate(); end
--------------------------------------------------------------------------------------------------- -- Proposal: -- https://github.com/smartdevicelink/sdl_evolution/blob/master/proposals/0221-multiple-modules.md -- Description: -- HMI sent to SDL capabilities where only one module is available per module type. -- Mobile App sends "SetInteriorVehicleData" requests with omitted "moduleId" parameters to every available module, -- SDL should transfer these requests adding the default "moduleId" values to the HMI and use these parameters -- in further communications. -- -- Preconditions: -- 1) SDL and HMI are started -- 2) HMI sent capabilities with only one module per module type -- 3) Mobile is connected to the SDL -- 4) App is registered and activated -- -- Steps: -- 1) App sends "SetInteriorVehicleData"(moduleType = "RADIO", radioControlData) request to the SDL -- Check: -- SDL resends "RC.SetInteriorVehicleData" (moduleType = "RADIO", moduleId = "00bd6d93", radioControlData) -- request to the HMI adding the default "moduleId" value -- HMI sends "RC.SetInteriorVehicleData"(moduleType = "RADIO", moduleId = "00bd6d93", radioControlData) response -- to the SDL -- SDL resends "SetInteriorVehicleData" -- (moduleType = "RADIO", moduleId = "00bd6d93", radioControlData, resultCode = "SUCCESS") response to the App -- 2-6) Repeat step #1 but selecting another one from the remaining available modules --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require("test_scripts/RC/MultipleModules/commonRCMulModules") --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false --[[ Local Variables ]] local rcCapabilities = {} for _, v in pairs(common.getRcModuleTypes()) do rcCapabilities[v] = common.DEFAULT end -- enable all possible RC -- capabilities in HMI local subscribeData = { RADIO = common.getRcCapabilities().RADIO[1].moduleInfo.moduleId, CLIMATE = common.getRcCapabilities().CLIMATE[1].moduleInfo.moduleId, SEAT = common.getRcCapabilities().SEAT[1].moduleInfo.moduleId, AUDIO = common.getRcCapabilities().AUDIO[1].moduleInfo.moduleId, LIGHT = common.getRcCapabilities().LIGHT.moduleInfo.moduleId, HMI_SETTINGS = common.getRcCapabilities().HMI_SETTINGS.moduleInfo.moduleId } local requestModuleData = { RADIO = { moduleType = "RADIO", radioControlData = { frequencyInteger = 1, radioEnable = true } }, CLIMATE = { moduleType = "CLIMATE", climateControlData = { fanSpeed = 50, desiredTemperature = { unit = "CELSIUS", value = 10.5 }, acEnable = true, autoModeEnable = true } }, SEAT = { moduleType = "SEAT", seatControlData = { id = "DRIVER", horizontalPosition = 50, verticalPosition = 50, frontVerticalPosition = 50, backVerticalPosition = 50, backTiltAngle = 50 } }, AUDIO = { moduleType = "AUDIO", audioControlData = { source = "AM", keepContext = false, volume = 50 } }, LIGHT = { moduleType = "LIGHT", lightControlData = { lightState = { { id = "FRONT_LEFT_HIGH_BEAM", status = "ON", density = 0.2 } } } }, HMI_SETTINGS = { moduleType = "HMI_SETTINGS", hmiSettingsControlData = { displayMode = "AUTO", temperatureUnit = "FAHRENHEIT", distanceUnit = "MILES" } } } --[[ Scenario ]] runner.Title("Preconditions") runner.Step("Clean environment", common.preconditions) runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { rcCapabilities }) runner.Step("RAI", common.registerApp) runner.Step("PTU", common.policyTableUpdate, { common.PTUfunc }) runner.Step("Activate App", common.activateApp) runner.Title("Test") for moduleType, moduleId in pairs(subscribeData) do runner.Step("Send request for "..moduleType.." module", common.sendSuccessRpcNoModuleId, { moduleType, moduleId, 1, "SetInteriorVehicleData", requestModuleData[moduleType], }) end runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions)
-- ignore this file if neovim is running inside vscode if vim.fn.exists('g:vscode') == 1 then return end require'nvim-treesitter.configs'.setup { highlight = { enable = true, }, indent = { enable = true, }, playground = { enable = true, disable = {}, updatetime = 25, persist_queries = false, keybindings = { toggle_query_editor = 'o', toggle_hl_groups = 'i', toggle_injected_languages = 't', toggle_anonymous_nodes = 'a', toggle_language_display = 'I', focus_language = 'f', unfocus_language = 'F', update = 'R', goto_node = '<cr>', show_help = '?', }, }, }
-------------------------------------------------------------------------------- -- util functions -------------------------------------------------------------------------------- local function divide_string( str, max ) local result = {} local start = 1 for i = 1, #str do if i % max == 0 then table.insert( result, str:sub( start, i ) ) start = i + 1 elseif i == #str then table.insert( result, str:sub( start, i ) ) end end return result end local function number_to_bit( num, length ) local bits = {} while num > 0 do local rest = math.floor( math.fmod( num, 2 ) ) table.insert( bits, rest ) num = ( num - rest ) / 2 end while #bits < length do table.insert( bits, "0" ) end return string.reverse( table.concat( bits ) ) end -------------------------------------------------------------------------------- local basexx = {} -------------------------------------------------------------------------------- -- base2(bitfield) decode and encode function -------------------------------------------------------------------------------- local bitMap = { o = "0", i = "1", l = "1" } function basexx.to_bit( str ) return ( str:gsub( '.', function ( c ) local byte = string.byte( c ) local bits = {} for _ = 1,8 do table.insert( bits, byte % 2 ) byte = math.floor( byte / 2 ) end return table.concat( bits ):reverse() end ) ) end -------------------------------------------------------------------------------- -- generic function to decode and encode base32/base64 -------------------------------------------------------------------------------- local function to_basexx( str, alphabet, bits, pad ) local bitString = basexx.to_bit( str ) local chunks = divide_string( bitString, bits ) local result = {} for _,value in ipairs( chunks ) do if ( #value < bits ) then value = value .. string.rep( '0', bits - #value ) end local pos = tonumber( value, 2 ) + 1 table.insert( result, alphabet:sub( pos, pos ) ) end table.insert( result, pad ) return table.concat( result ) end -------------------------------------------------------------------------------- -- rfc 3548: http://www.rfc-editor.org/rfc/rfc3548.txt -------------------------------------------------------------------------------- local base32Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" local base32PadMap = { "", "======", "====", "===", "=" } function basexx.from_base32( str, ignore ) str = ignore_set( str, ignore ) return from_basexx( string.upper( str ), base32Alphabet, 5 ) end function basexx.to_base32( str ) return to_basexx( str, base32Alphabet, 5, base32PadMap[ #str % 5 + 1 ] ) end -------------------------------------------------------------------------------- -- base64 decode and encode function -------------------------------------------------------------------------------- local base64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".. "abcdefghijklmnopqrstuvwxyz".. "0123456789+/" local base64PadMap = { "", "==", "=" } function basexx.from_base64( str, ignore ) str = ignore_set( str, ignore ) return from_basexx( str, base64Alphabet, 6 ) end function basexx.to_base64( str ) return to_basexx( str, base64Alphabet, 6, base64PadMap[ #str % 3 + 1 ] ) end -------------------------------------------------------------------------------- -- URL safe base64 decode and encode function -------------------------------------------------------------------------------- local url64Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".. "abcdefghijklmnopqrstuvwxyz".. "0123456789-_" function basexx.from_url64( str, ignore ) str = ignore_set( str, ignore ) return from_basexx( str, url64Alphabet, 6 ) end function basexx.to_url64( str ) return to_basexx( str, url64Alphabet, 6, "" ) end return basexx
-------------------------------- -- @module ControlStepper -- @extend Control -- @parent_module cc -------------------------------- -- -- @function [parent=#ControlStepper] setMinusSprite -- @param self -- @param #cc.Sprite var -------------------------------- -- -- @function [parent=#ControlStepper] getMinusLabel -- @param self -- @return Label#Label ret (return value: cc.Label) -------------------------------- -- -- @function [parent=#ControlStepper] setWraps -- @param self -- @param #bool wraps -------------------------------- -- -- @function [parent=#ControlStepper] isContinuous -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- -- @function [parent=#ControlStepper] getMinusSprite -- @param self -- @return Sprite#Sprite ret (return value: cc.Sprite) -------------------------------- -- Update the layout of the stepper with the given touch location. -- @function [parent=#ControlStepper] updateLayoutUsingTouchLocation -- @param self -- @param #vec2_table location -------------------------------- -- Set the numeric value of the stepper. If send is true, the Control::EventType::VALUE_CHANGED is sent. -- @function [parent=#ControlStepper] setValueWithSendingEvent -- @param self -- @param #double value -- @param #bool send -------------------------------- -- -- @function [parent=#ControlStepper] getPlusLabel -- @param self -- @return Label#Label ret (return value: cc.Label) -------------------------------- -- Stop the autorepeat. -- @function [parent=#ControlStepper] stopAutorepeat -- @param self -------------------------------- -- -- @function [parent=#ControlStepper] setMinimumValue -- @param self -- @param #double minimumValue -------------------------------- -- -- @function [parent=#ControlStepper] getPlusSprite -- @param self -- @return Sprite#Sprite ret (return value: cc.Sprite) -------------------------------- -- -- @function [parent=#ControlStepper] setPlusSprite -- @param self -- @param #cc.Sprite var -------------------------------- -- -- @function [parent=#ControlStepper] setMinusLabel -- @param self -- @param #cc.Label var -------------------------------- -- -- @function [parent=#ControlStepper] setValue -- @param self -- @param #double value -------------------------------- -- -- @function [parent=#ControlStepper] setStepValue -- @param self -- @param #double stepValue -------------------------------- -- -- @function [parent=#ControlStepper] setMaximumValue -- @param self -- @param #double maximumValue -------------------------------- -- -- @function [parent=#ControlStepper] update -- @param self -- @param #float dt -------------------------------- -- Start the autorepeat increment/decrement. -- @function [parent=#ControlStepper] startAutorepeat -- @param self -------------------------------- -- -- @function [parent=#ControlStepper] initWithMinusSpriteAndPlusSprite -- @param self -- @param #cc.Sprite minusSprite -- @param #cc.Sprite plusSprite -- @return bool#bool ret (return value: bool) -------------------------------- -- -- @function [parent=#ControlStepper] getValue -- @param self -- @return double#double ret (return value: double) -------------------------------- -- -- @function [parent=#ControlStepper] setPlusLabel -- @param self -- @param #cc.Label var -------------------------------- -- -- @function [parent=#ControlStepper] create -- @param self -- @param #cc.Sprite minusSprite -- @param #cc.Sprite plusSprite -- @return ControlStepper#ControlStepper ret (return value: cc.ControlStepper) -------------------------------- -- -- @function [parent=#ControlStepper] onTouchMoved -- @param self -- @param #cc.Touch pTouch -- @param #cc.Event pEvent -------------------------------- -- -- @function [parent=#ControlStepper] onTouchEnded -- @param self -- @param #cc.Touch pTouch -- @param #cc.Event pEvent -------------------------------- -- -- @function [parent=#ControlStepper] onTouchBegan -- @param self -- @param #cc.Touch pTouch -- @param #cc.Event pEvent -- @return bool#bool ret (return value: bool) -------------------------------- -- js ctor -- @function [parent=#ControlStepper] ControlStepper -- @param self return nil
-- -- This file is part of SmithSNMP -- Copyright (C) 2014, Credo Semiconductor Inc. -- Copyright (C) 2015, Leo Ma <[email protected]> -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License along -- with this program; if not, write to the Free Software Foundation, Inc., -- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -- local mib = require "smithsnmp" local tcp_scalar_cache = {} local tcp_conn_entry_cache = {} --[[ ["0.0.0.0.22.0.0.0.0.0"] = { conn_stat = 1 }, ["10.2.12.229.33874.91.189.92.10.443"] = { conn_stat = 8 }, ["10.2.12.229.33875.91.189.92.23.443"] = { conn_stat = 8 }, ["10.2.12.229.37700.180.149.153.11.80"] = { conn_stat = 9 }, ["10.2.12.229.46149.180.149.134.54.80"] = { conn_stat = 5 }, ["10.2.12.229.53158.123.58.181.140.80"] = { conn_stat = 5 }, ["127.0.0.1.631.0.0.0.0.0"] = { conn_stat = 1 }, ]] local tcp_snmp_conn_stat_map = { [0] = 12, -- ERROR 5, -- ESTABLISHED 3, -- SYN_SENT 4, -- SYN_RECV 6, -- FIN_WAIT1 7, -- FIN_WAIT2 11, -- TIME_WAIT 1, -- CLOSED 8, -- CLOSE_WAIT 9, -- LAST_ACK 2, -- LISTEN 10 -- CLOSING } local hextab = { ['0'] = 0, ['1'] = 1, ['2'] = 2, ['3'] = 3, ['4'] = 4, ['5'] = 5, ['6'] = 6, ['7'] = 7, ['8'] = 8, ['9'] = 9, ['A'] = 10, ['a'] = 10, ['B'] = 11, ['b'] = 11, ['C'] = 12, ['c'] = 12, ['D'] = 13, ['d'] = 13, ['E'] = 14, ['e'] = 14, ['F'] = 15, ['f'] = 15, } local ip_hex2num = function(hex) assert(type(hex) == 'string') local num = {} for i = #hex, 1, -2 do local msb = string.char(string.byte(hex, i - 1)) local lsb = string.char(string.byte(hex, i)) table.insert(num, hextab[msb] * 16 + hextab[lsb]) end return table.concat(num, ".") end local hex2num = function(hex) assert(type(hex) == 'string') local num = 0 for i = 1, #hex do num = num * 16 + hextab[string.char(string.byte(hex, i))] end return num end local __load_config = function() tcp_scalar_cache = {} tcp_conn_entry_cache = {} for line in io.lines("/proc/net/snmp") do if string.match(line, "%w+") == 'Tcp' then for w in string.gmatch(line, "%d+") do table.insert(tcp_scalar_cache, tonumber(w)) end end end for line in io.lines("/proc/net/tcp") do local loc_addr = string.match(line, ".-:%s+(.-):") local loc_port = string.match(line, ".-:%s+.-:(.-)%s+") local rem_addr = string.match(line, ".-:.-:.-%s+(.-):") local rem_port = string.match(line, ".-:%s+.-:.-:(.-)%s+") local conn_stat = string.match(line, ".-:%s+.-:.-:.-%s+(.-)%s+") local key = {} if loc_addr ~= nil and loc_port ~= nil and rem_addr ~= nil and rem_port ~= nil and conn_stat ~= nil then table.insert(key, ip_hex2num(loc_addr)) table.insert(key, tostring(hex2num(loc_port))) table.insert(key, ip_hex2num(rem_addr)) table.insert(key, tostring(hex2num(rem_port))) conn_stat = hex2num(conn_stat) tcp_conn_entry_cache[table.concat(key, '.')] = {} tcp_conn_entry_cache[table.concat(key, '.')].conn_stat = tcp_snmp_conn_stat_map[conn_stat] end end end local last_load_time = os.time() local load_config = function() if os.difftime(os.time(), last_load_time) > 3 then last_load_time = os.time() __load_config() end end __load_config() mib.module_methods.or_table_reg("1.3.6.1.2.1.6", "The MIB module for managing TCP inplementations") local tcp_conn_entry_get = function(sub_oid, name) assert(type(name) == 'string') local value if type(sub_oid) == 'table' then local key = table.concat(sub_oid, ".") if tcp_conn_entry_cache[key] then value = tcp_conn_entry_cache[key][name] end end return value end local tcp_conn_entry_set = function(sub_oid, value, name) assert(type(name) == 'string') if type(sub_oid) == 'table' then local key = table.concat(sub_oid, ".") if tcp_conn_entry_cache[key] then tcp_conn_entry_cache[key][name] = value end end end local tcpGroup = { io_f = load_config, [1] = mib.ConstInt(function () return tcp_scalar_cache[1] end), [2] = mib.ConstInt(function () return tcp_scalar_cache[2] end), [3] = mib.ConstInt(function () return tcp_scalar_cache[3] end), [4] = mib.ConstInt(function () return tcp_scalar_cache[4] end), [5] = mib.ConstCount(function () return tcp_scalar_cache[5] end), [6] = mib.ConstCount(function () return tcp_scalar_cache[6] end), [7] = mib.ConstCount(function () return tcp_scalar_cache[7] end), [8] = mib.ConstCount(function () return tcp_scalar_cache[8] end), [9] = mib.ConstGauge(function () return tcp_scalar_cache[9] end), [10] = mib.ConstCount(function () return tcp_scalar_cache[10] end), [11] = mib.ConstCount(function () return tcp_scalar_cache[11] end), [12] = mib.ConstCount(function () return tcp_scalar_cache[12] end), [13] = { [1] = { indexes = tcp_conn_entry_cache, [1] = mib.Int(function (sub_oid) return tcp_conn_entry_get(sub_oid, 'conn_stat') end, function (sub_oid, value) return tcp_conn_entry_set(sub_oid, value, 'conn_stat') end), [2] = mib.ConstIpaddr(function (sub_oid) local ipaddr if type(sub_oid) == 'table' and tcp_conn_entry_cache[table.concat(sub_oid, ".")] then ipaddr = {} for i = 1, 4 do table.insert(ipaddr, sub_oid[i]) end end return ipaddr end), [3] = mib.ConstInt(function (sub_oid) if type(sub_oid) == 'table' and tcp_conn_entry_cache[table.concat(sub_oid, ".")] then return sub_oid[5] else return nil end end), [4] = mib.ConstIpaddr(function (sub_oid) local ipaddr if type(sub_oid) == 'table' and tcp_conn_entry_cache[table.concat(sub_oid, ".")] then ipaddr = {} for i = 6, 9 do table.insert(ipaddr, sub_oid[i]) end end return ipaddr end), [5] = mib.ConstInt(function (sub_oid) if type(sub_oid) == 'table' and tcp_conn_entry_cache[table.concat(sub_oid, ".")] then return sub_oid[10] else return nil end end), } }, [14] = mib.ConstCount(function () return tcp_scalar_cache[13] end), [15] = mib.ConstCount(function () return tcp_scalar_cache[14] end), } return tcpGroup
return { tag = 'graphicsTransforms', summary = 'Pop the current transform off the stack.', description = [[ Pops the current transform from the stack, returning to the transformation that was applied before `lovr.graphics.push` was called. ]], arguments = {}, returns = {}, notes = [[ An error is thrown if there isn't a transform to pop. This can happen if you forget to call push before calling pop, or if you have an unbalanced sequence of pushes and pops. ]], related = { 'lovr.graphics.push' } }
#!/usr/bin/lua --[[ A simple pingbot for Discord. (Still needs to identify with a gateway once.) Starts spamming right away when this script is executed. Sends `msg` every `slep` seconds in a specified channel while the script is running. ]] ----[ Constants ]---- -- Duration (in seconds) between each post local slep = 0.8501 -- The message to send local msg = "@everyone @here YEET!" -- ID of the channel to spam. local chid = "439756065652080662" ----[ Reqs ]---- local sleep = require("socket").sleep local https = require("ssl.https") local ltn12 = require("ltn12") local json = require("dkjson") local _tokf = io.open("token.txt","r") local tok = _tokf:read("*a") _tokf:close() _tokf = nil local _base = "https://discordapp.com/api" local _head = { ["Authorization"] = ('Bot '..tok), ["User-Agent"] = ("PingBot"..' ('.."pingbot"..', '.."1.0"..') botver/'.."1.0"), ["Content-Type"] = 'application/json' } local function exec(method, url, header, data) if not(method=="POST" or method=="GET") then return nil, nil, "Invalid request type" end local body, headers = {}, {} for k,v in pairs(header) do headers[k] = v end if method == "POST" then headers["Content-Length"] = tostring(#tostring(data or "")) elseif method == "GET" then headers["Content-Type"] = nil end local _, rc, head, _ = https.request{ method = method, url = url, headers = headers, source = ltn12.source.string(data), sink = ltn12.sink.table(body) } return table.concat(body), head, rc end while true do _, _, rc = exec( "POST", _base.."/channels/"..chid.."/messages", _head, json.encode{content = msg} ) print(rc) sleep(slep) end
mod_gui = {} mod_gui.button_style = "mod_gui_button" mod_gui.frame_style = "inner_frame_in_outer_frame" --[[ Hello script explorer, if you are looking to upgrade your mod to use the mod gui, its pretty simple. Typically you will have something like: player.gui.left.add{...} All you will need to do, is change it to: mod_gui.get_frame_flow(player).add{...} And for buttons its just the same: mod_gui.get_button_flow(player).add{...} It should be as simple as find and replace. Any other questions please feel free to ask on the modding help forum. ]] function mod_gui.get_button_flow(player) local gui = player.gui.top local button_flow = gui.mod_gui_button_flow if not button_flow then button_flow = gui.add{type = "flow", name = "mod_gui_button_flow", direction = "horizontal", style = "slot_table_spacing_horizontal_flow"} button_flow.style.left_padding = 4 button_flow.style.top_padding = 4 end return button_flow end function mod_gui.get_frame_flow(player) local gui = player.gui.left local frame_flow = gui.mod_gui_frame_flow if not frame_flow then frame_flow = gui.add{type = "flow", name = "mod_gui_frame_flow", direction = "horizontal", style = "slot_table_spacing_horizontal_flow"} frame_flow.style.left_padding = 4 frame_flow.style.top_padding = 4 end return frame_flow end return mod_gui
--[[ Name: cl_menu_job_item_locker.lua ----------------------------------------------------------------- -- @package VrZn - Custom Gamemode (SRP BASE) -- @author Nodge -- @build Beta 1 ----------------------------------------------------------------- ]]-- local Panel = {} function Panel:Init() self:SetTitle( "Job Item Locker" ) self:SetDeleteOnClose( false ) self.m_pnlInvLabel = vgui.Create( "DLabel", self ) self.m_pnlInvLabel:SetExpensiveShadow( 2, Color(0, 0, 0, 255) ) self.m_pnlInvLabel:SetTextColor( Color(255, 255, 255, 255) ) self.m_pnlInvLabel:SetFont( "Trebuchet24" ) self.m_pnlInvLabel:SetText( "Inventory" ) self.m_pnlInvLabel:SizeToContents() self.m_pnlLockerLabel = vgui.Create( "DLabel", self ) self.m_pnlLockerLabel:SetExpensiveShadow( 2, Color(0, 0, 0, 255) ) self.m_pnlLockerLabel:SetTextColor( Color(255, 255, 255, 255) ) self.m_pnlLockerLabel:SetFont( "Trebuchet24" ) self.m_pnlLockerLabel:SetText( "Item Locker" ) self.m_pnlLockerLabel:SizeToContents() self.m_pnlInventoryList = vgui.Create( "SRP_ScrollPanel", self ) self.m_pnlInventoryList.Paint = function( _, intW, intH ) surface.SetDrawColor( 50, 50, 50, 100 ) surface.DrawRect( 0, 0, intW, intH ) end self.m_pnlLockerList = vgui.Create( "SRP_ScrollPanel", self ) self.m_pnlLockerList.Paint = function( _, intW, intH ) surface.SetDrawColor( 50, 50, 50, 100 ) surface.DrawRect( 0, 0, intW, intH ) end self.m_tblInvItems = {} self.m_tblLockerItems = {} hook.Add( "GamemodeRefreshJobLockerMenu", "UpdateLockerMenu", function() if not ValidPanel( self ) then return end if not self:IsVisible() then return end self:Refresh() end ) end function Panel:SetEntity( eEnt ) self.m_entTarget = eEnt end function Panel:Refresh() local locker = LocalPlayer():GetEyeTrace().Entity if not IsValid( locker ) or locker:GetClass() ~= "ent_job_item_locker" then return end self:SetEntity( locker ) local items = {} for k, v in pairs( GAMEMODE.Config.JobLockerItems[locker:GetJobID()] ) do if GAMEMODE.Inv:PlayerHasItem( k, v ) then continue end if GAMEMODE.Inv:PlayerHasItemEquipped( LocalPlayer(), k ) then continue end local diff = math.max( v -(LocalPlayer():GetInventory()[k] or 0), 0 ) if diff <= 0 then continue end items[k] = diff end self:Populate( items ) end function Panel:Populate( tblItems ) for k, v in pairs( self.m_tblInvItems ) do if ValidPanel( v ) then v:Remove() end end for k, v in pairs( self.m_tblLockerItems ) do if ValidPanel( v ) then v:Remove() end end self.m_tblInvItems = {} self.m_tblLockerItems = {} self.m_tblCurContents = tblItems for k, v in SortedPairs( LocalPlayer():GetInventory() ) do if not GAMEMODE.Inv:ValidItem( k ) then continue end if not GAMEMODE.Config.JobLockerItems[self.m_entTarget:GetJobID()][k] then continue end local pnl = vgui.Create( "SRPQMenuItemCard", self.m_pnlInventoryList ) pnl.BuildTrayButtons = function( pnl ) pnl.m_pnlBtnTray:Clear() if not pnl.m_tblItem then return end local takeBtn = vgui.Create( "SRP_Button", pnl.m_pnlBtnTray ) takeBtn:SetText( "Move To Locker" ) takeBtn.DoClick = function() GAMEMODE.Net:RequestMoveJobItemToLocker( self.m_entTarget, k, 1 ) end takeBtn.DoRightClick = function() local dMenu = DermaMenu() dMenu:AddOption( "Move 5", function() GAMEMODE.Net:RequestMoveJobItemToLocker( self.m_entTarget, k, 5 ) end ) dMenu:AddOption( "Move 10", function() GAMEMODE.Net:RequestMoveJobItemToLocker( self.m_entTarget, k, 10 ) end ) dMenu:AddOption( "Move 15", function() GAMEMODE.Net:RequestMoveJobItemToLocker( self.m_entTarget, k, 15 ) end ) dMenu:AddOption( "Move 25", function() GAMEMODE.Net:RequestMoveJobItemToLocker( self.m_entTarget, k, 25 ) end ) dMenu:AddOption( "Move 50", function() GAMEMODE.Net:RequestMoveJobItemToLocker( self.m_entTarget, k, 50 ) end ) dMenu:Open() end table.insert( pnl.m_tblTrayBtns, takeBtn ) pnl.m_pnlBtnTray:InvalidateLayout() end pnl:SetItemID( k ) pnl:SetItemAmount( v ) table.insert( self.m_tblInvItems, pnl ) end for k, v in SortedPairs( tblItems or {} ) do if not GAMEMODE.Inv:ValidItem( k ) then continue end local pnl = vgui.Create( "SRPQMenuItemCard", self.m_pnlLockerList ) pnl.BuildTrayButtons = function( pnl ) pnl.m_pnlBtnTray:Clear() if not pnl.m_tblItem then return end local takeBtn = vgui.Create( "SRP_Button", pnl.m_pnlBtnTray ) takeBtn:SetText( "Move To Inventory" ) takeBtn.DoClick = function() GAMEMODE.Net:RequestMoveJobItemFromLocker( self.m_entTarget, k, 1 ) end takeBtn.DoRightClick = function() local dMenu = DermaMenu() dMenu:AddOption( "Move 5", function() GAMEMODE.Net:RequestMoveJobItemFromLocker( self.m_entTarget, k, 5 ) end ) dMenu:AddOption( "Move 10", function() GAMEMODE.Net:RequestMoveJobItemFromLocker( self.m_entTarget, k, 10 ) end ) dMenu:AddOption( "Move 15", function() GAMEMODE.Net:RequestMoveJobItemFromLocker( self.m_entTarget, k, 15 ) end ) dMenu:AddOption( "Move 25", function() GAMEMODE.Net:RequestMoveJobItemFromLocker( self.m_entTarget, k, 25 ) end ) dMenu:AddOption( "Move 50", function() GAMEMODE.Net:RequestMoveJobItemFromLocker( self.m_entTarget, k, 50 ) end ) dMenu:Open() end table.insert( pnl.m_tblTrayBtns, takeBtn ) pnl.m_pnlBtnTray:InvalidateLayout() end pnl:SetItemID( k ) pnl:SetItemAmount( v ) table.insert( self.m_tblLockerItems, pnl ) end self:InvalidateLayout() end function Panel:PerformLayout( intW, intH ) DFrame.PerformLayout( self, intW, intH ) local padding = 0 local half = intW /2 self.m_pnlInvLabel:SetPos( 5, 28 ) self.m_pnlLockerLabel:SetPos( intW -self.m_pnlLockerLabel:GetWide() -5, 28 ) self.m_pnlInventoryList:SetSize( half -(padding *2), intH -28 -self.m_pnlInvLabel:GetTall() -padding ) self.m_pnlInventoryList:SetPos( padding, 28 +self.m_pnlInvLabel:GetTall() +padding ) self.m_pnlLockerList:SetSize( half -(padding *2), intH -28 -self.m_pnlInvLabel:GetTall() -padding -padding ) self.m_pnlLockerList:SetPos( padding +half, 28 +self.m_pnlInvLabel:GetTall() +padding ) for _, pnl in pairs( self.m_tblInvItems ) do pnl:DockMargin( 0, 0, 0, 5 ) pnl:SetTall( 48 ) pnl:Dock( TOP ) end for _, pnl in pairs( self.m_tblLockerItems ) do pnl:DockMargin( 0, 0, 0, 5 ) pnl:SetTall( 48 ) pnl:Dock( TOP ) end end function Panel:Open() self:Refresh() self:SetVisible( true ) self:MakePopup() end vgui.Register( "SRPJobItemLocker", Panel, "SRP_Frame" )
#!/usr/bin/env texlua require("busted.runner")() kpse.set_program_name("luatex") require("lualibs") local dom = require("luaxml-domobject") local lfs = require("lfs") local citeproc = require("citeproc.citeproc") local function read_file(path) local file = io.open(path, "r") if not file then return nil end local content = file:read("*a") file:close() return content end local function endswith(str, suffix) return string.sub(str, -#suffix) == suffix end local function listdir(path) local files = {} for file in lfs.dir(path) do if file ~= "." and file ~= ".." and endswith(file, ".txt") then table.insert(files, string.sub(file, 1, -5)) end end table.sort(files) return files end local function test_citations(engine, fixture) -- TODO pending("citations") end local function test_citation_items(engine, fixture) local citation_items = fixture.citation_items if not citation_items then citation_items = {{}} for _, item in ipairs(fixture.input) do table.insert(citation_items[1], {id = tostring(item.id)}) end end local output = {} for _, items in ipairs(citation_items) do local res = engine:makeCitationCluster(items) -- Some hacks to pass the test-suite res = string.gsub(res, "^ibid", "Ibid") table.insert(output, res) end return table.concat(output, "\n") end local function test_bibliography(engine, fixture) local bibentries = fixture.bibentries if not bibentries then bibentries = {{}} for _, item in ipairs(fixture.input) do table.insert(bibentries[1], tostring(item.id)) end end if fixture.bibsection then -- TODO pending("bibsection") end local output = {} for _, items in ipairs(bibentries) do engine:updateItems(items) local result = engine:makeBibliography() local params = result[1] local entries = result[2] local res = params.bibstart for _, entry in ipairs(entries) do res = res .. " " .. entry .. "\n" end res = res .. params.bibend table.insert(output, res) end return table.concat(output, "\n") end local function run_test(fixture) local bib = {} for i, item in ipairs(fixture.input) do if item.id == nil then item.id = "item-" .. tostring(i) end bib[tostring(item.id)] = item end local citeproc_sys = { retrieveLocale = function (lang) if not lang then return nil end local path = "./test/locales/locales-" .. lang .. ".xml" local content = read_file(path) if not content then return nil end return dom.parse(content) end, retrieveItem = function (id) return bib[id] end } local style = dom.parse(fixture.csl) local engine = citeproc.new(citeproc_sys, style) engine:set_formatter('html') citeproc.util.warning_enabled = false if fixture.mode == "citation" then if fixture.citations then return test_citations(engine, fixture) else return test_citation_items(engine, fixture) end elseif fixture.mode == "bibliography" then if fixture.citations then pending("citations") end return test_bibliography(engine, fixture) end end local function parse_fixture(path) local file = io.open(path, "r") if not file then return nil end local res = {} local section = nil local contents = nil for line in file:lines() do -- local start = string.match(line, ">>=+%s*([%w-]+)%s*=+") if start then section = start contents = nil else local stop = string.match(line, "<<=+%s*([%w-]+)%s*=+") if stop and stop == section then if section == "INPUT" or section == "CITATION-ITEMS" or section == "CITATIONS" or section == "BIBENTRIES" or section == "BIBSECTION" or section == "ABBREVIATIONS" then contents = utilities.json.tolua(contents) end section = string.lower(section) section = string.gsub(section, "-", "_") res[section] = contents section = nil else if section then if contents then contents = contents .. "\n" .. line else contents = line end end end end end file:close() return res end describe("test-suite", function () local test_dir = "./test/test-suite/processor-tests/humans" local files = listdir(test_dir) for _, file in ipairs(files) do local path = test_dir .. "/" .. file .. ".txt" local fixture = parse_fixture(path) it(file, function () local result = run_test(fixture) assert.equal(fixture.result, result) return fixture.mode end) end end)
--[[ module for loading backends, backends should provide a table with two keys - "condition" and "socket", they should have the following signatures: all function should return: truthy/false, err The 'err' must be a string, it will be caught and prefixed with the text 'socket:' or 'condition:' to indicate where the error came from once it bubbles up to the user. condition.new() condition:signal() condition:wait() socket.new() socket:connect(host,port) socket:close() socket:receive(specifier) socket:send(data) socket:settimeout(timeout in millis) socket:tryreceive(param) -- interruptable by socket:signal() socket:signal() -- interrupt a tryreceive if active ]] local function prefix_err(t,f) return function(...) local data, err = f(...) if err then err = t .. err end return data, err end end local prefix_exceptions = { ['tryreceive'] = true } -- all backend socket functions should return data, err -- this captures the err value and prefixes it with 'socket:' local function backend_wrap(lib) local proxy = { name = lib.name } for _,t in ipairs({'socket','condition'}) do proxy[t] = {} local s = t .. ':' for k,v in pairs(lib[t]) do -- exceptions, tryreceive ultimately returns receive() -- no need to proxy if prefix_exceptions[k] then proxy[t][k] = v elseif(type(v) == 'function') then proxy[t][k] = prefix_err(s,v) else error('lib returned a non-function') end end -- override the 'new' function to use our proxy as a metatable proxy[t]['new'] = function() local sock = lib[t].new() return setmetatable(sock,{__index = proxy[t]}) end end return proxy end -- local table to hold loaded backends local backends = {} -- holds the name of the default backend, uses -- the last loaded library. -- -- Example: if a system has both luasocket and cqeueus, -- the default is cqueues since that was loaded after -- luasocket. local last_backend = nil for _,l in ipairs({'luasocket','cqueues','nginx'}) do local ok, lib = pcall(require,'resty.mpd.backend.'..l) if ok then backends[l] = backend_wrap(lib) last_backend = l end end -- throw an error if no backends were loaded if last_backend == nil then return error('failed to load backend implementations') end -- compatibility with lua-resty-mpd backends['ngx'] = backends['nginx'] backends['socket'] = backends['luasocket'] -- interface for requesting backends local function backend_get(self,name) local ts = type(self) local tn = type(name) if ts == 'table' then -- called as backend:get if tn ~= 'string' then -- called as backend:get() or backend:get(not-a-string) name = last_backend end -- else was called as backend:get(name), -- check down below if name is valid elseif ts == 'nil' then -- called as backend() name = last_backend end -- other cases -- type(self) == 'function' - still use name if not (name and backends[name]) then name = last_backend end return backends[name] end return setmetatable({ get = backend_get, }, { __call = backend_get })
require('io') require('sha1') require('base64') oids={} for j = 1,1000,1 do oids[j] = "oid"..j end i=0 file = io.open('/home/zhangdongmao/CLOUD-2013-20130619-1371604329974.mp4', "rb") if file == nil then print("error") return nil end content = file:read "*a" file:close() -- --request = function(){} -- function request() local x = i x = x % #oids + 1 i = i + 1 local path = "/video/"..oids[x] local key = to_base64(hmac_sha1_binary("wuzei",path)) local header = {["Authorization"] = key} return wrk.format("PUT", path, header, content) end
-- -- Copyright 2017-present Facebook. -- All Rights Reserved. -- This source code is licensed under the BSD-style license found in the -- LICENSE file in the root directory of this source tree. An additional grant -- of patent rights can be found in the PATENTS file in the same directory. -- local tnt = require 'torchnet.sequential' local tester local test = torch.TestSuite() function test.BucketBatch_Simple() local data = { "a", "b", "c", "aa", "bb", "cc", "aaaa", "bbbb", "cccc", "foobar", } torch.manualSeed(1234) local ds = tnt.BucketBatchDataset{ dataset = tnt.TransformDataset{ dataset = tnt.TableDataset{data = data}, transform = function(sample) return {s=sample} end, }, batchsize = 2, merge = function(tbl) return {s=table.concat(tbl.s, ',')} end, samplesize = function(ds, i) return #ds:get(i).s end, shuffle = true } tester:assertGeneralEq(7, ds:size()) tester:assertGeneralEq("a,c", ds:get(1).s) tester:assertGeneralEq("b", ds:get(2).s) tester:assertGeneralEq("aa,cc", ds:get(3).s) tester:assertGeneralEq("bb", ds:get(4).s) tester:assertGeneralEq("cccc,bbbb", ds:get(5).s) tester:assertGeneralEq("aaaa", ds:get(6).s) tester:assertGeneralEq("foobar", ds:get(7).s) ds:resampleInBuckets() tester:assertGeneralEq("a,c", ds:get(1).s) tester:assertGeneralEq(nil, ds:get(2).s:find(',')) tester:assertGeneralEq(nil, ds:get(4).s:find(',')) tester:assertGeneralEq(nil, ds:get(6).s:find(',')) tester:assertGeneralEq(nil, ds:get(7).s:find(',')) local ds2 = tnt.BucketBatchDataset{ dataset = tnt.TransformDataset{ dataset = tnt.TableDataset{data = data}, transform = function(sample) return {s=sample} end, }, batchsize = 4, merge = function(tbl) return {s=table.concat(tbl.s, ',')} end, resolution = 3, samplesize = function(ds, i) return #ds:get(i).s end, } tester:assertGeneralEq(4, ds2:size()) tester:assertGeneralEq("a,b,c,aa", ds2:get(1).s) tester:assertGeneralEq("bb,cc", ds2:get(2).s) tester:assertGeneralEq("aaaa,bbbb,cccc", ds2:get(3).s) tester:assertGeneralEq("foobar", ds2:get(4).s) end function test.BucketBatch_IncludeLast() local data = torch.linspace(0, 99, 100):long() local ds = tnt.BucketBatchDataset{ dataset = tnt.TransformDataset{ dataset = tnt.TableDataset{data = data:totable()}, transform = function(sample) return {s=sample} end, }, batchsize = 20, resolution = 50, merge = function(tbl) return {s=torch.LongTensor(tbl.s)} end, samplesize = function(ds, i) return ds:get(i).s end, policy = 'include-last', } tester:assertGeneralEq(6, ds:size()) tester:assertGeneralEq(20, ds:get(1).s:size(1)) tester:assertGeneralEq(20, ds:get(2).s:size(1)) tester:assertGeneralEq(10, ds:get(3).s:size(1)) tester:assertGeneralEq(20, ds:get(4).s:size(1)) tester:assertGeneralEq(20, ds:get(5).s:size(1)) tester:assertGeneralEq(10, ds:get(6).s:size(1)) end function test.BucketBatch_SkipLast() local data = torch.linspace(0, 99, 100):long() local ds = tnt.BucketBatchDataset{ dataset = tnt.TransformDataset{ dataset = tnt.TableDataset{data = data:totable()}, transform = function(sample) return {s=sample} end, }, batchsize = 20, resolution = 50, merge = function(tbl) return {s=torch.LongTensor(tbl.s)} end, samplesize = function(ds, i) return ds:get(i).s end, policy = 'skip-last', } tester:assertGeneralEq(4, ds:size()) tester:assertGeneralEq(20, ds:get(1).s:size(1)) tester:assertGeneralEq(20, ds:get(2).s:size(1)) tester:assertGeneralEq(20, ds:get(3).s:size(1)) tester:assertGeneralEq(20, ds:get(4).s:size(1)) end local function doTestEven(policy) local data = torch.linspace(0, 11, 12):long() local ds = tnt.BucketBatchDataset{ dataset = tnt.TransformDataset{ dataset = tnt.TableDataset{data = data:totable()}, transform = function(sample) return {s=sample} end, }, batchsize = 2, resolution = 4, merge = function(tbl) return {s=torch.LongTensor(tbl.s)} end, samplesize = function(ds, i) return ds:get(i).s end, policy = policy, } tester:assertGeneralEq(6, ds:size()) tester:assertGeneralEq(2, ds:get(1).s:size(1)) tester:assertGeneralEq(2, ds:get(2).s:size(1)) tester:assertGeneralEq(2, ds:get(3).s:size(1)) tester:assertGeneralEq(2, ds:get(4).s:size(1)) tester:assertGeneralEq(2, ds:get(5).s:size(1)) tester:assertGeneralEq(2, ds:get(6).s:size(1)) end function test.BucketBatch_EvenIncludeLast() doTestEven('include-last') end function test.BucketBatch_EvenSkipLast() doTestEven('skip-last') end return function(_tester_) tester = _tester_ return test end
-- see https://stackoverflow.com/a/9146653 local present, cmp = pcall(require, "cmp") if not present then return end local lspkind = require('config.lspkind') require("config.lsp") cmp.setup({ snippet = {expand = function(args) vim.fn["UltiSnips#Anon"](args.body) end}, style = {winhighlight = "NormalFloat:NormalFloat,FloatBorder:FloatBorder"}, formatting = { format = lspkind.cmp_format({with_text = false, maxwidth = 50}) }, window = { completion = { border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}, scrollbar = "║", autocomplete = { require("cmp.types").cmp.TriggerEvent.InsertEnter, require("cmp.types").cmp.TriggerEvent.TextChanged } }, documentation = { border = {"╭", "─", "╮", "│", "╯", "─", "╰", "│"}, winhighlight = "NormalFloat:NormalFloat,FloatBorder:FloatBorder", scrollbar = "║" } }, mapping = { ["<PageUp>"] = function() for _ = 1, 10 do cmp.mapping.select_prev_item()(nil) end end, ["<PageDown>"] = function() for _ = 1, 10 do cmp.mapping.select_next_item()(nil) end end, ['<C-b>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), {'i', 'c'}), ['<C-f>'] = cmp.mapping(cmp.mapping.scroll_docs(4), {'i', 'c'}), ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), {'i', 'c'}), ['<C-y>'] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping. ['<C-e>'] = cmp.mapping({ i = cmp.mapping.abort(), c = cmp.mapping.close() }), -- ['<CR>'] = cmp.mapping.confirm({select = true}) -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. ["<CR>"] = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true }), ["<Tab>"] = function(fallback) if cmp.visible() then cmp.select_next_item({behavior = cmp.SelectBehavior.Select}) else fallback() end end, ["<S-Tab>"] = function(fallback) if cmp.visible() then cmp.select_prev_item({behavior = cmp.SelectBehavior.Select}) else fallback() end end }, experimental = {native_menu = false, ghost_text = true}, sources = cmp.config.sources({ {name = 'cmp_tabnine'}, {name = "copilot", group_index = 1}, {name = "nvim_lsp"}, {name = 'ultisnips'} -- For ultisnips users. }, {{name = 'buffer'}}), sorting = { comparators = { cmp.config.compare.group_index, cmp.config.compare.recently_used, cmp.config.compare.offset, cmp.config.compare.score, cmp.config.compare.sort_text, cmp.config.compare.length, cmp.config.compare.order } }, preselect = cmp.PreselectMode.Item }) cmp.setup.filetype('gitcommit', { sources = cmp.config.sources({ {name = 'cmp_git'} -- You can specify the `cmp_git` source if you were installed it. }, {{name = 'buffer'}}) }) vim.cmd([[ set pumheight=10 ]]) -- cmp.setup.cmdline('/', {sources = {{name = 'buffer'}}}) local highlights = { CmpItemKindText = {fg = "Grey"}, CmpItemKindFunction = {fg = "#C586C0"}, CmpItemKindClass = {fg = "Orange"}, CmpItemKindKeyword = {fg = "#f90c71"}, CmpItemKindSnippet = {fg = "#565c64"}, CmpItemKindConstructor = {fg = "#ae43f0"}, CmpItemKindVariable = {fg = "#9CDCFE", bg = "NONE"}, CmpItemKindInterface = {fg = "#f90c71", bg = "NONE"}, CmpItemKindFolder = {fg = "#2986cc"}, CmpItemKindReference = {fg = "#922b21"}, CmpItemKindMethod = {fg = "#C586C0"}, CmpItemMenu = {fg = "#C586C0", bg = "#C586C0"}, CmpItemAbbr = {fg = "#565c64", bg = "NONE"}, CmpItemAbbrMatch = {fg = "#569CD6", bg = "NONE"}, CmpItemAbbrMatchFuzzy = {fg = "#569CD6", bg = "NONE"} } vim.api.nvim_set_hl(0, "CmpBorderedWindow_FloatBorder", {fg = "#565c64"}) for group, hl in pairs(highlights) do vim.api.nvim_set_hl(0, group, hl) end
-- ex-06-lua: lua/mylib.lua myString = "Hello, Cumulocity!"
local t = My.Translator.translate local f = string.format local refitCostPower = 20 local refitTime = 30 local beamToObject = function(player, idx) idx = idx - 1 if player:getBeamWeaponDamage(idx) > 0 and player:getBeamWeaponRange(idx) > 0 then -- TODO: move to Lively Epsilon return { arc = player:getBeamWeaponArc(idx), direction = player:getBeamWeaponDirection(idx), range = player:getBeamWeaponRange(idx), cycleTime = player:getBeamWeaponCycleTime(idx), damage = player:getBeamWeaponDamage(idx), energyPerFire = player:getBeamWeaponEnergyPerFire(idx), heatPerFire = player:getBeamWeaponHeatPerFire(idx), getMinAngle = function(self) return (self.direction - self.arc / 2) % 360 end, getMaxAngle = function(self) return (self.direction + self.arc / 2) % 360 end, getShotsPerMinute = function(self) return 60 / self.cycleTime end, getDamagePerMinute = function(self) return self.damage * 60 / self.cycleTime end, getHeatPerMinute = function(self) return self.heatPerFire * 60 / self.cycleTime end, getMinutesToOverHeat = function(self) return 1 / self:getHeatPerMinute() end, getEnergyPerMinute = function(self) return self.energyPerFire * 60 / self.cycleTime end, } else return nil end return {} end local configurations = { calculateDefaultConfiguration = function(defaultConfiguration) local config = Util.deepCopy(defaultConfiguration) return config end, calculateRangeConfiguration = function(defaultConfiguration) local config = Util.deepCopy(defaultConfiguration) config.arc = config.arc / 1.3 config.range = config.range * 1.3 config.energyPerFire = config.energyPerFire * 1.3 config.heatPerFire = config.heatPerFire * 1.3 config.cycleTime = config.cycleTime * 1.2 return config end, calculatePowerConfiguration = function(defaultConfiguration) local config = Util.deepCopy(defaultConfiguration) config.arc = config.arc * 1.2 config.damage = config.damage * 1.7 config.range = config.range / 1.2 config.energyPerFire = config.energyPerFire * 2 config.heatPerFire = config.heatPerFire * 2 config.cycleTime = config.cycleTime * 1.2 return config end, calculateSpeedConfiguration = function(defaultConfiguration) local config = Util.deepCopy(defaultConfiguration) config.arc = config.arc * 1.2 config.damage = config.damage / 1.5 config.cycleTime = config.cycleTime / 1.5 config.energyPerFire = config.energyPerFire / 1.4 config.heatPerFire = config.heatPerFire / 1.4 return config end, } -- button to refit lasers My.installLaserRefit = function() local player = My.World.player local defaultValues = {} local currentConfiguration = {} local isRefitting = {} local cronIds = {} local mainMenu local startRefit = function(i, targetConfiguration, name) local startConfiguration = beamToObject(player, i) local elapsed = 0 cronIds[i] = cronIds[i] or "refit_" .. i .. "_" .. Util.randomUuid() isRefitting[i] = true currentConfiguration[i] = name player:drawWeaponsMenu(mainMenu()) Cron.regular(cronIds[i], function(_, delta) delta = delta * player:getSystemPower("beamweapons") elapsed = elapsed + delta local energyLoss = refitCostPower * delta / refitTime player:setEnergy(math.max(player:getEnergy() - energyLoss, 0)) if elapsed >= refitTime then isRefitting[i] = false Cron.abort(cronIds[i]) elapsed = refitTime end local progress = elapsed / refitTime player:setBeamWeapon( i - 1, progress * targetConfiguration.arc + (1 - progress) * startConfiguration.arc, progress * targetConfiguration.direction + (1 - progress) * startConfiguration.direction, progress * targetConfiguration.range + (1 - progress) * startConfiguration.range, progress * targetConfiguration.cycleTime + (1 - progress) * startConfiguration.cycleTime, progress * targetConfiguration.damage + (1 - progress) * startConfiguration.damage ) player:setBeamWeaponEnergyPerFire( i - 1, progress * targetConfiguration.energyPerFire + (1 - progress) * startConfiguration.energyPerFire ) player:setBeamWeaponHeatPerFire( i - 1, progress * targetConfiguration.heatPerFire + (1 - progress) * startConfiguration.heatPerFire ) end) end local mainInfoScreen = function() local text = t("upgrade_laserRefit_info_title") .. "\n-------------\n" .. t("upgrade_laserRefit_info_intro", refitCostPower, refitTime) .. "\n\n" for _, configName in ipairs({"default", "range", "power", "speed"}) do text = text .. t("upgrade_laserRefit_beam_info_" .. configName .. "_button") .. "\n-------------\n" .. t("upgrade_laserRefit_beam_info_" .. configName .. "_description") .. "\n\n" end return text end local createBeamInfoScreen = function(i) return function() local text = t("upgrade_laserRefit_beam_button", i) .. "\n-------------\n" local beam = beamToObject(player, i) text = text .. t("upgrade_laserRefit_beam_info_range", beam.range / 1000, beam:getMinAngle(), beam:getMaxAngle()) .. " " text = text .. t("upgrade_laserRefit_beam_info_damage", beam.damage, beam:getShotsPerMinute(), beam:getDamagePerMinute()) .. " " text = text .. t("upgrade_laserRefit_beam_info_heat", beam:getMinutesToOverHeat()) .. " " text = text .. t("upgrade_laserRefit_beam_info_energy", beam:getEnergyPerMinute()) text = text .. "\n\n" .. t("upgrade_laserRefit_beam_info_disclaimer") return text end end local createReconfigureMenu = function(i) return function() local menu = Menu:new() menu:addItem("header", Menu:newItem(t("upgrade_laserRefit_beam_button", i), 0)) if isRefitting[i] then menu:addItem("note", Menu:newItem(t("upgrade_laserRefit_beam_info_is_refitting"), 1)) else menu:addItem("info", Menu:newItem(t("upgrade_laserRefit_beam_info_button"), createBeamInfoScreen(i), 1)) end for j, configName in ipairs({"default", "range", "power", "speed"}) do local funcName = "calculate" .. configName:sub(1,1):upper() .. configName:sub(2) .. "Configuration" local label = t("upgrade_laserRefit_beam_info_" .. configName .. "_button") if configName == currentConfiguration[i] then label = "<" .. label .. ">" end menu:addItem(configName, Menu:newItem(label, function() local config = configurations[funcName](defaultValues[i]) startRefit(i, config, configName) end, j + 1)) end return menu end end mainMenu = function() local menu = Menu:new() menu:addItem("header", Menu:newItem(t("upgrade_laserRefit_button"), 0)) menu:addItem("info", Menu:newItem(t("upgrade_laserRefit_info_button"), mainInfoScreen, 1)) for i=1,10 do if beamToObject(player, i) ~= nil then defaultValues[i] = defaultValues[i] or beamToObject(player, i) currentConfiguration[i] = currentConfiguration[i] or "default" isRefitting[i] = isRefitting[i] or false menu:addItem("beam_" .. i, Menu:newItem(t("upgrade_laserRefit_beam_button", i), createReconfigureMenu(i), i+1)) end end return menu end player:addWeaponsMenuItem("laser", Menu:newItem(t("upgrade_laserRefit_button"), mainMenu)) end
help ( [[ This module loads freesurfer. This module makes available the freesurfer executables. Documentation for freesurfer is available online at the publisher\'s website: http://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferWiki These executables can be found in TACC_FREESURFER_DIR, e.g. recon-all. No need to run SetUpFreeSurfer.sh before running. All the related paths/envs are set up when the module is loaded. Version 6.0.0 ]]) whatis("Name: FreeSurfer") whatis("Version: 6.0.0") whatis("Category: computational biology, Imaging") whatis("Keywords: Biology, fMRI, Reconstruction") whatis("Description: freesurfer - a set of tools for analysis and visualization of structural and functional brain imaging data. Common commands include recon-all, etc.") whatis("URL: http://surfer.nmr.mgh.harvard.edu/fswiki/FreeSurferWiki") -- Set-up paths local software_path = '/work/01329/poldrack/software' local fs_dir = pathJoin(software_path, 'freesurfer-6.0.0') -- Set-up module's variables setenv("FREESURFER_HOME", fs_dir) setenv("SUBJECTS_DIR", pathJoin(fs_dir, "subjects")) setenv("MNI_DIR", pathJoin(fs_dir, "mni")) setenv("FSFAST_HOME", pathJoin(fs_dir, "fsfast")) setenv("FSF_OUTPUT_FORMAT", "nii.gz") prepend_path("PATH", pathJoin(fs_dir, "mni/bin")) prepend_path("PATH", pathJoin(fs_dir, "bin")) prepend_path("PERL5LIB", pathJoin(fs_dir, "mni/lib/perl5/5.8.5"))
help( [[ ABySS is a de novo, parallel, paired-end sequence assembler that is designed for short reads. The single-processor version is useful for assembling genomes up to 100 Mbases in size. ]]) whatis("ABySS is a de novo, parallel, paired-end sequence assembler that is designed for short reads.") local version = "2.0.2" local base = "/cvmfs/oasis.opensciencegrid.org/osg/modules/abyss/"..version prepend_path("PATH", pathJoin(base, "bin"))
local bench = script and require(script.Parent.bench_support) or require("bench_support") function test() local t = table.create(250001, 0) for i=1,250000 do t[i] = i end local t2 = {} local ts0 = os.clock() table.move(t, 1, 250000, 1, t2) local ts1 = os.clock() for i=1,250000-1 do assert(t2[i] == i) end return ts1-ts0 end bench.runCode(test, "TableMove: {}")
local _, addonData = ... local L = LibStub("AceLocale-3.0"):GetLocale("SteaSummon") local optionsgui = { showID = nil, options = { type = "group", childGroups = "tab", args = { desc = { order = 0, image = "Interface/ICONS/Spell_Shadow_Twilight", imageCoords = { 0, 1, 0, 1 }, type = "description", fontSize = "medium", name = function() local name, _ = UnitName("player") local pats = { ["%%name"] = name } local s = L["One button summoning, shared summoning list... (Options for: %name)"] return tstring(s, pats) end }, title = { name = L["Help"], type = "header", order = 1, }, infodesc = { order = 2, image = "Interface/Buttons/UI-PlusButton-Up", imageCoords = { 0, 1, 0, 1 }, type = "description", fontSize = "medium", name = L["plushelp"] }, summondesc = { order = 3, image = "Interface/ICONS/Spell_Shadow_Twilight", imageCoords = { 0, 1, 0, 1 }, type = "description", fontSize = "medium", name = L["summonhelp"] }, destdesc = { order = 4, image = "Interface\\Buttons\\UI-HomeButton", imageCoords = { 0, 1, 0, 1 }, type = "description", fontSize = "medium", name = L["desthelp"] }, raiddesc = { order = 5, image = "Interface\\Buttons\\UI-GuildButton-MOTD-Up", imageCoords = { 0, 1, 0, 1 }, type = "description", fontSize = "medium", name = L["raidinfohelp"] }, }, }, } local general = { name = L["Display"], type = "group", order = 0, args = { wnddesc = { order = 4, type = "description", width = "1.5", name = L["Change the scale of the interface. Set the window to always show before adjusting scale in order to see the results."] }, enable = { order = 6, name = L["Show Summon Window"], desc = "Toggles the summon window", type = "select", width = "double", descStyle = "inline", values = { [1] = L["Always"], [2] = L["Only when summons are active"], [3] = L["Only when I am in the active summon list"], [4] = L["Never"] }, set = function(_, val) SteaSummonSave.show = val addonData.summon:showSummons() -- kick off change in display end, get = function() return SteaSummonSave.show end, }, wndshowdesc = { order = 7, type = "description", width = "normal", name = L["wnddesc"] }, --[[sumheader = { order = 7, type = "header", name = "Summon Options" },]] savedesc = { order = 10, type = "description", width = "normal", name = L["savedesc"] }, keep = { order = 9, type = "range", name = L["Summon list save time (in minutes)"], desc = L["How long to preserve the summon list between logins"], min = 0, max = 300, softMin = 0, softMax = 59, step = 1, bigStep = 1, width = "double", set = function(_, val) SteaSummonSave.waitingKeepTime = val end, get = function() return SteaSummonSave.waitingKeepTime end, }, windowSize = { order = 2, type = "range", name = L["Summon window scale"], desc = L["wndscale"], min = 0.1, max = 2, softMin = 0.3, softMax = 3, step = 0.1, bigStep = 0.1, width = "normal", isPercent = true, set = function(_, val) SteaSummonSave.windowSize = val SteaSummonFrame:SetScale(val) end, get = function() return SteaSummonSave.windowSize end, }, listSize = { order = 3, type = "range", name = L["Summon list scale"], desc = L["sumscale"], min = 0.1, max = 3, softMin = 0.3, softMax = 3, step = 0.1, bigStep = 0.1, width = "normal", isPercent = true, set = function(_, val) SteaSummonSave.listSize = val SteaSummonButtonFrame:SetScale(val) end, get = function() return SteaSummonSave.listSize end, }, minimap = { order = -1, name = L["Show minimap button"], desc = L["Toggle whether to show the minimap button"], type = "toggle", width = "double", descStyle = "inline", set = function(_, val) addonData.appbutton:toggle(not val) end, get = function() return not SteaSummonSave.ldb.profile.minimap.hide end }, } } local chat = { name = L["Messages"], type = "group", order = 4, args = { desc = { order = 9, type = "description", name = L["msgopdesc"] }, raid = { order = 10, name = L["Summon raid notification text"], desc = L["a sentence that posts to raid when someone is summoned"], type = "input", width = "full", set = function(_, val) SteaSummonSave.raidchat = val end, get = function() return SteaSummonSave.raidchat end }, whisper = { order = 11, name = L["Summon whisper notification text"], desc = L["a sentence that is whispered to the person being summoned"], type = "input", width = "full", set = function(_, val) SteaSummonSave.whisperchat = val end, get = function() return SteaSummonSave.whisperchat end }, raidinfo = { order = 13, name = L["Raid summon instructions"], desc = L["a sentence that that posts to raid periodically"], type = "input", width = "double", set = function(_, val) SteaSummonSave.raidinfo = val end, get = function() return SteaSummonSave.raidinfo end }, raidtimer = { order = 14, type = "range", name = L["Raid summon instructions period (minutes)"], desc = L["How long to wait between sending to chat"], min = 0, max = 10, step = 1, width = "double", set = function(_, val) SteaSummonSave.raidinfotimer = val end, get = function() return SteaSummonSave.raidinfotimer end, }, clickersnag = { order = 15, name = L["Raid request for clickers"], desc = L["a sentence that that posts to raid periodically when there not enough clickers to summon"], type = "input", width = "double", set = function(_, val) SteaSummonSave.clickersnag = val end, get = function() return SteaSummonSave.clickersnag end }, clickertimer = { order = 16, type = "range", name = L["Raid clicker request period (minutes)"], desc = L["How long to wait between sending to chat"], min = 0, max = 10, step = 1, width = "double", set = function(_, val) SteaSummonSave.clickersnagtimer = val end, get = function() return SteaSummonSave.clickersnagtimer end, }, clicknag = { order = 17, name = L["Summoning portal click nag"], desc = L["a sentence that posts to say when you click the Next button while casting"], type = "input", width = "double", set = function(_, val) SteaSummonSave.clicknag = val end, get = function() return SteaSummonSave.clicknag end }, say = { order = 12, name = L["Summon portal click request in say"], desc = L["a sentence that posts to say to request others click on the portal"], type = "input", width = "full", set = function(_, val) SteaSummonSave.saychat = val end, get = function() return SteaSummonSave.saychat end }, }, } local summonwords = { name = L["Triggers"], type = "group", order = 5, args = { desc = { order = 1, type = "description", name = L["trigphrasedesc"] }, summonWords = { order = -1, name = L["Trigger phrases for summon. One per line."], desc = L["chat lines that will add a summon request for the raider"], type = "input", multiline = 23, width = "full", set = function(_, val) SteaSummonSave.summonWords = addonData.util:multiLineToTable(val) end, get = function() return addonData.util:tableToMultiLine(SteaSummonSave.summonWords, "\n") end } } } local priorities = { name = L["Priorities"], type = "group", order = 6, args = { desc = { order = 1, type = "description", name = L["These options determine where in the summon list players are inserted when they ask for a summon."] }, warlocks = { order = 2, name = L["Warlocks first"], desc = L["Put unbuffed summoners at the top of the list when they request a summon"], type = "toggle", width = "double", descStyle = "inline", set = function(_, val) SteaSummonSave.warlocks = val end, get = function() return SteaSummonSave.warlocks end }, maxWarlocks = { order = 3, name = L["Maximum warlocks first"], desc = L["Maximum summoners to be prioritized"], type = "range", min = 1, max = 5, step = 1, disabled = function() return not SteaSummonSave.warlocks end, width = "double", set = function(_, val) SteaSummonSave.maxLocks = val end, get = function() return SteaSummonSave.maxLocks end }, buffs = { order = 6, name = L["Prioritize buffed players"], desc = L["Put players with world buffs ahead of named priority players"], type = "toggle", width = "full", descStyle = "inline", set = function(_, val) SteaSummonSave.buffs = val end, get = function() return SteaSummonSave.buffs end }, names = { order = 7, name = L["Players to summon first, if by first, you mean behind warlocks and buffed players. One player per line."], desc = L["These players will move to the front of the summon list when they request a summon"], width = "full", type = "input", multiline = 7, set = function(_, val) SteaSummonSave.prioplayers = addonData.util:multiLineToTable(addonData.util:case(val, "\n")) end, get = function() return addonData.util:tableToMultiLine(SteaSummonSave.prioplayers) end }, last = { order = 99, name = L["Players to summon last. Some people should just be nicer. One player per line."], desc = L["These players will move to the back of the summon list and stay there"], width = "full", type = "input", multiline = 7, set = function(_, val) SteaSummonSave.shitlist = addonData.util:multiLineToTable(addonData.util:case(val, "\n")) end, get = function() return addonData.util:tableToMultiLine(SteaSummonSave.shitlist) end } }, } local alts = { name = L["Alt Support"], type = "group", order = 6, args = { desc = { order = 1, type = "description", name = L["altdesc"] }, buffed = { order = 2, name = L["Enable only when player buffed"], desc = L["altbuffeddesc"], type = "toggle", width = "double", --descStyle = "inline", set = function(_, val) SteaSummonSave.altbuffed = val end, get = function() return SteaSummonSave.altbuffed end }, q = { order = 3, name = L["Enable only when the queue spot reaches"], desc = L["qspotdesc"], type = "range", width = "full", min = 2, max = 41, step = 1, set = function(_, val) SteaSummonSave.initialQspot = val end, get = function() return SteaSummonSave.initialQspot end }, whisper = { order = 4, name = L["Whisper alts when they reach this queue spot"], desc = L["qspotreadydesc"], type = "range", width = "full", min = 0, max = 41, step = 1, set = function(_, val) SteaSummonSave.qspot = val end, get = function() return SteaSummonSave.qspot end }, whisperBoost = { order = 5, name = L["When out of online players to summon, whisper this many extra alts"], desc = L["qspotboostreadydesc"], type = "range", width = "full", min = 0, max = 10, step = 1, set = function(_, val) SteaSummonSave.qboost = val end, get = function() return SteaSummonSave.qboost end }, instrwhisper = { order = 11, name = L["Whisper instructional text"], desc = L["a sentence that is whispered to instruct the player how to add an alt for their summon"], type = "input", width = "full", set = function(_, val) SteaSummonSave.altWhisper = val end, get = function() return SteaSummonSave.altWhisper end }, getonlinewhisper = { order = 11, name = L["Whisper summon ready text"], desc = L["a sentence that is whispered to tell an alt their summon is ready"], type = "input", width = "full", set = function(_, val) SteaSummonSave.altGetOnlineWhisper = val end, get = function() return SteaSummonSave.altGetOnlineWhisper end }, toons = { order = 7, name = L["Automatically register your characters for alt support"], desc = L["These are the characters you might be on when your summon is ready"], width = "double", type = "input", set = function(_, val) SteaSummonSave.alttoons = addonData.util:multiLineToTable(addonData.util:case(val, "\n")) end, get = function() return addonData.util:tableToMultiLine(SteaSummonSave.alttoons) end }, }, } local advanced = { name = L["Advanced"], type = "group", order = -1, args = { desc = { order = 1, type = "description", name = L["These are options that, should you change them, will blow up your computer."] }, debug = { order = 5, name = L["Debug"], desc = L["Turn on debugging statements"], type = "toggle", width = "full", descStyle = "inline", set = function(_, val) SteaDEBUG.on = val end, get = function() return SteaDEBUG.on end }, experimental = { order = 6, name = L["Enable Experimental Features"], desc = L["This could be anything. It will probably be horribly broken, or worse, not do very much."], type = "toggle", width = "full", descStyle = "inline", set = function(_, val) SteaSummonSave.experimental = val end, get = function() return SteaSummonSave.experimental end }, reset = { order = 8, name = L["Reset to Defaults"], desc = L["Reset all options to the default values"], type = "execute", func = addonData.settings:reset() }, updates = { order = 4, name = L["Use AddOn Broadcast Communications"], desc = L["broadcastdesc"], type = "toggle", width = "double", descStyle = "inline", set = function(_, val) SteaSummonSave.updates = val addonData.gossip:netOn(val) end, get = function() return SteaSummonSave.updates end }, buildheader = { order = 10, type = "header", name = L["Version Details"] }, build = { order = 11, type = "description", name = function() local version, build, date, tocversion = GetBuildInfo() local pat = { ["%%v"] = version, ["%%b"] = build, ["%%d"] = date, ["%%t"] = tocversion, ["%%s"] = GetAddOnMetadata("SteaSummon", "Version") } local s = L["SteaSummon version %s\n\nWoW client\nversion: %v\nbuild: %b\ndate: %d\ntocversion: %t"] return tstring(s, pat) end }, --[[bags = { order = -1, name = "bags", desc = "bags", type = "input", multiline = 23, width = "full", set = function(_, val) end, get = function() return rummage() end }]] }, } local raid = { name = L["Raid Management"], type = "group", order = -1, args = { desc = { order = 1, type = "description", name = L["These options perform raid management actions to form your raid when you are raid leader."] }, enableraid = { order = 2, name = L["Auto convert to raid"], desc = L["When you form a party, convert it to a raid"], type = "toggle", width = "double", descStyle = "inline", set = function(_, val) SteaSummonSave.convertToRaid = val end, get = function() return SteaSummonSave.convertToRaid end }, warlocks = { order = 6, name = L["Warlocks get assist"], desc = L["Give assist status to unbuffed summoners"], type = "toggle", width = "double", descStyle = "inline", set = function(_, val) SteaSummonSave.warlocksAssist = val end, get = function() return SteaSummonSave.warlocksAssist end }, final = { order = 4, name = L["Final raid leadership are named players"], desc = L["When relinquishing leadership, ensure only the named players keep their roles"], type = "toggle", width = "full", descStyle = "inline", set = function(_, val) SteaSummonSave.finalLeadership = val end, get = function() return SteaSummonSave.finalLeadership end }, delayleader = { order = 5, name = L["Delay leadership transfer"], desc = L["Only transfer leadership once the destination is unset and summons are over"], type = "toggle", width = "full", descStyle = "inline", set = function(_, val) SteaSummonSave.delayLeadership = val end, get = function() return SteaSummonSave.delayLeadership end }, assist = { order = 9, name = L["Players to give assist"], desc = L["These players will be given raid assist when they join the raid"], width = "double", type = "input", set = function(_, val) SteaSummonSave.assistPlayers = addonData.util:multiLineToTable(addonData.util:case(val, ", ")) end, get = function() return addonData.util:tableToMultiLine(SteaSummonSave.assistPlayers) end }, leader = { order = 7, name = L["Players to promote to leader"], desc = L["leaderdesc"], width = "double", type = "input", set = function(_, val) SteaSummonSave.raidLeaders = addonData.util:multiLineToTable(addonData.util:case(val, ", ")) end, get = function() return addonData.util:tableToMultiLine(SteaSummonSave.raidLeaders) end }, masterloot = { order = 8, name = L["Players to set as master looter"], desc = L["mldesc"], width = "double", type = "input", set = function(_, val) SteaSummonSave.masterLoot = addonData.util:multiLineToTable(addonData.util:case(val, ", ")) end, get = function() return addonData.util:tableToMultiLine(SteaSummonSave.masterLoot) end }, invheader = { order = 13, type = "header", name = L["Automatic Invite Options"] }, invdesc = { order = 14, type = "description", name = L["These options determine how automatic invite and accept works"] }, acceptInvite = { order = 16, name = L["Enable accept invites"], desc = L["Accept group invites to the raid"], type = "select", width = "normal", values = { [1] = L["Only Guild"], [2] = L["Only Guild and Friends"], [3] = L["Anyone"], [4] = L["Off"] }, set = function(_, val) SteaSummonSave.autoAccept = val end, get = function() return SteaSummonSave.autoAccept end }, autoInvite = { order = 15, name = L["Enable auto invite"], desc = L["Allow people to request invites to the raid via whisper"], type = "select", width = "normal", values = { [1] = L["Only Guild"], [2] = L["Only Guild and Friends"], [3] = L["Anyone"], [4] = L["Off"] }, set = function(_, val) SteaSummonSave.autoInvite = val end, get = function() return SteaSummonSave.autoInvite end }, autoInviteTriggers = { order = 17, name = L["Auto invite players who whisper these trigger words"], desc = L["These trigger words will trigger an invitation to the raid"], width = "full", type = "input", set = function(_, val) SteaSummonSave.autoInviteTriggers = addonData.util:multiLineToTable(val) end, get = function() return addonData.util:tableToMultiLine(SteaSummonSave.autoInviteTriggers) end } }, } --- rummage for food and drink function rummage() out = "" local icon, itemCount, locked, quality, readable, lootable, isFiltered, noValue, itemID local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemIcon, itemSellPrice, itemClassID, itemSubClassID, bindType, expacID, itemSetID, isCraftingReagent for bag = 0, NUM_BAG_SLOTS do for slot = 1, GetContainerNumSlots(bag) do icon, itemCount, locked, quality, readable, lootable, itemLink, isFiltered, noValue, itemID = GetContainerItemInfo(bag, slot) if itemID then itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, itemSubType, itemStackCount, itemEquipLoc, itemIcon, itemSellPrice, itemClassID, itemSubClassID, bindType, expacID, itemSetID, isCraftingReagent = GetItemInfo(itemID) out = out .. itemName .. " " .. itemID .. " " .. itemType .. " " .. itemSubType .. " " .. itemClassID .. " " .. itemSubClassID .. " " .. itemIcon .. "\n" end end end return out end function optionsgui:show() if optionsgui.showID and not InCombatLockdown() then InterfaceOptionsFrame_Show() InterfaceOptionsFrame_OpenToCategory(optionsgui.showID) end end function optionsgui:init() local me = UnitName("player") local name = "SteaSummon (" .. me .. ")" optionsgui.showID = name LibStub("AceConfig-3.0"):RegisterOptionsTable(name, optionsgui.options, "ss") LibStub("AceConfig-3.0"):RegisterOptionsTable("SteaSummonDisplay", general, "ss-display") LibStub("AceConfig-3.0"):RegisterOptionsTable("SteaSummonMessages", chat, "ss-chat") LibStub("AceConfig-3.0"):RegisterOptionsTable("SteaSummonWords", summonwords, "ss-words") LibStub("AceConfig-3.0"):RegisterOptionsTable("SteaSummonPrios", priorities, "ss-prio") LibStub("AceConfig-3.0"):RegisterOptionsTable("SteaSummonAlts", alts, "ss-alts") LibStub("AceConfig-3.0"):RegisterOptionsTable("SteaSummonRaid", raid, "ss-raid") LibStub("AceConfig-3.0"):RegisterOptionsTable("SteaSummonAdv", advanced) LibStub("AceConfigDialog-3.0"):AddToBlizOptions(name) LibStub("AceConfigDialog-3.0"):AddToBlizOptions("SteaSummonDisplay", L["Display"], name) LibStub("AceConfigDialog-3.0"):AddToBlizOptions("SteaSummonMessages", L["Messages"], name) LibStub("AceConfigDialog-3.0"):AddToBlizOptions("SteaSummonWords", L["Triggers"], name) LibStub("AceConfigDialog-3.0"):AddToBlizOptions("SteaSummonPrios", L["Priorities"], name) LibStub("AceConfigDialog-3.0"):AddToBlizOptions("SteaSummonAlts", L["Alt Support"], name) LibStub("AceConfigDialog-3.0"):AddToBlizOptions("SteaSummonRaid", L["Raid Management"], name) LibStub("AceConfigDialog-3.0"):AddToBlizOptions("SteaSummonAdv", L["Advanced"], name) end addonData.optionsgui = optionsgui
local SongInformationActor = {} SongInformation_mt = { __index = SongInformationActor } local JACKET_SIZE = 384 local BANNER_HEIGHT = 80 * (JACKET_SIZE/256) -- TODO: Make this a preference local WAIT_FOR_LOAD = true -- If set to true, it won't load images while you are quickly scrolling trough the list function SongInformationActor:CreateActors(base_x, base_y) local t = Def.ActorFrame { InitCommand = function(this) self.container = this this:x(base_x - 64) :y(base_y) :diffusealpha(0) end, OnCommand = function(this) this:queuecommand("SetSong") end, HideCommand = function(this) this:stoptweening() :accelerate(0.3) :x(base_x - 64) :diffusealpha(0) end, ShowCommand = function(this) this:decelerate(0.3) :x(base_x) :diffusealpha(1) end, } local JACKET_X = 484 + JACKET_SIZE/2 local JACKET_Y = JACKET_SIZE/2 -- Jacket t[#t+1] = Def.ActorFrame { InitCommand = function(this) this:x(JACKET_X) :y(JACKET_Y) end, -- Jacket Border Def.Quad { InitCommand = function(this) this:zoomto(JACKET_SIZE + 3, JACKET_SIZE + 3) :diffuse(ThemeColor.Black) end, SetSongCommand = function(this) if self.song == nil then return end this:stoptweening() :linear(WAIT_FOR_LOAD and 0.1 or 0) if self.song:HasJacket() then this:zoomto(JACKET_SIZE + 4, JACKET_SIZE + 4) else this:zoomto(JACKET_SIZE + 4, BANNER_HEIGHT + 4) end end, }, -- Jacket Background Def.Quad { InitCommand = function(this) this:zoomto(JACKET_SIZE, JACKET_SIZE) :diffuse(ThemeColor.White) end, SetSongCommand = function(this) if self.song == nil then return end this:stoptweening() :linear(WAIT_FOR_LOAD and 0.1 or 0) if self.song:HasJacket() then this:zoomto(JACKET_SIZE, JACKET_SIZE) else this:zoomto(JACKET_SIZE, BANNER_HEIGHT) end end, }, -- Jacket Image Def.Banner { InitCommand = function(this) end, SetSongCommand = function(this) if self.song == nil then return end this:stoptweening() :diffusealpha(0) :sleep(WAIT_FOR_LOAD and 0.15 or 0) :queuecommand("Load") end, LoadCommand = function(this) this:stoptweening() :Load(nil) if self.song == nil then return end if self.song:HasJacket() then this:LoadBanner(self.song:GetJacketPath()) -- For some reason, if you don't do scaletoclipped twice, it will mess up when you go from a banner to a jacket. this:scaletoclipped(JACKET_SIZE, JACKET_SIZE) :scaletoclipped(JACKET_SIZE, JACKET_SIZE) :linear(WAIT_FOR_LOAD and 0.1 or 0) :diffusealpha(1) elseif self.song:HasBanner() then this:LoadBanner(self.song:GetBannerPath()) -- ditto this:scaletoclipped(JACKET_SIZE, BANNER_HEIGHT) this:scaletoclipped(JACKET_SIZE, BANNER_HEIGHT) :linear(WAIT_FOR_LOAD and 0.1 or 0) :diffusealpha(1) end end, }, } -- Title/Artist/Group t[#t+1] = Def.ActorFrame { InitCommand = function(this) this:x((JACKET_X - (JACKET_SIZE/2)) - 32) :y(JACKET_Y - 32) end, -- Main Title Def.BitmapText { Font = ThemeFonts.DisplayTitle, InitCommand = function(this) this:diffuse(ThemeColor.Red) :halign(1) :valign(1) end, SetSongCommand = function(this) if self.song ~= nil then this:settext(self.song:GetDisplayMainTitle()) :stoptweening() :scaletofit(-550, -26, 0, 26) :diffusealpha(0) :y(-48) :decelerate(0.2) :diffusealpha(1) :y(-16) end end, }, -- Sub Title Def.BitmapText { Font = ThemeFonts.DisplaySubtitle, InitCommand = function(this) this:diffuse(ThemeColor.Red) :halign(1) end, SetSongCommand = function(this) if self.song ~= nil then this:stoptweening() :settext(self.song:GetDisplaySubTitle()) :scaletofit(-550, -10, 0, 10) :y(32) :x(-32) :diffusealpha(0) :decelerate(0.2) :diffusealpha(1) :x(0) end end, }, -- Artist Def.BitmapText { Font = ThemeFonts.DisplaySubtitle, InitCommand = function(this) this:diffuse(ThemeColor.Black) :halign(1) end, SetSongCommand = function(this) if self.song ~= nil then this:stoptweening() :settext(self.song:GetDisplayArtist()) :scaletofit(-550, -8, 0, 8) :y(self.song:GetDisplaySubTitle() ~= "" and 64 or 32) :x(-32) :diffusealpha(0) :decelerate(0.2) :diffusealpha(1) :x(0) end end, }, -- Group banner Def.Banner { InitCommand = function(this) this:halign(1) :valign(0) end, SetSongCommand = function(this) if self.song == nil then self.group_banner_path = nil return end local group_banner_path = SONGMAN:GetSongGroupBannerPath(self.song:GetGroupName()) if group_banner_path == self.group_banner_path then this:stoptweening() :linear(WAIT_FOR_LOAD and 0.1 or 0) :diffusealpha(1) :y(self.song:GetDisplaySubTitle() ~= "" and 100 or 64) :x(0) return end self.group_banner_path = group_banner_path this:stoptweening() :diffusealpha(0) :sleep(WAIT_FOR_LOAD and 0.1 or 0) :queuecommand("Load") end, LoadCommand = function(this) if self.song == nil then return end this:LoadBanner(self.group_banner_path) this:scaletoclipped(182, 57) :diffusealpha(0) :x(-32) :y(self.song:GetDisplaySubTitle() ~= "" and 100 or 64) :decelerate(WAIT_FOR_LOAD and 0.2 or 0) :diffusealpha(1) :x(0) end, }, } local function get_bpm_color(bpm) if bpm > 500 then return ThemeColor.Red elseif bpm > 280 then return ThemeColor.Yellow else return ThemeColor.Blue end end -- Misc song info t[#t+1] = Def.ActorFrame { InitCommand = function(this) this:x(JACKET_X) :y(JACKET_Y + 16) end, SetSongCommand = function(this) if self.song == nil then return end local base_y = JACKET_Y + 16 this:stoptweening() :linear(0.1) :y(self.song:HasJacket() and base_y + JACKET_SIZE/2 or base_y + BANNER_HEIGHT/2) end, -- Length Label Def.BitmapText { Font = ThemeFonts.Regular, InitCommand = function(this) self.length_label = this this:settext(THEME:GetString("SongInformation", "Length")) :diffuse(ThemeColor.Black) :zoom(0.8) :x(-JACKET_SIZE/2) :y(-4) :valign(0) :halign(0) end, }, -- Length value Def.ActorFrame { OnCommand = function(this) this:x(self.length_label:GetX() + self.length_label:GetWidth() - 24) :y(-4) :zoom(0.8) end, SetSongCommand = function(this) if self.song == nil then return end local color = ThemeColor.Blue if self.song:IsLong() then color = ThemeColor.Yellow elseif self.song:IsMarathon() then color = ThemeColor.Red end this:stoptweening() :linear(0.1) :diffuse(color) end, -- Minute counter Def.RollingNumbers { Font = ThemeFonts.Mono, InitCommand = function(this) this:valign(0) :halign(1) :x(52) :y(3) :set_chars_wide(2) :set_leading_attribute{ Diffuse = Alpha(ThemeColor.Black, 0.3) } :set_number_attribute{ Diffuse = ThemeColor.White } :target_number(0) :set_approach_seconds(0.5) end, SetSongCommand = function(this) if self.song == nil then return end this:stoptweening() :target_number(self.song:MusicLengthSeconds()/60) end, }, -- Divider Def.BitmapText { Font = ThemeFonts.Mono, OnCommand = function(this) this:valign(0) :halign(0) :x(53) :y(3) :settext(":") end, }, -- Second counter Def.RollingNumbers { Font = ThemeFonts.Mono, InitCommand = function(this) this:valign(0) :halign(0) :set_chars_wide(2) :set_leading_attribute{ Diffuse = ThemeColor.White } :set_number_attribute{ Diffuse = ThemeColor.White } :target_number(0) :set_approach_seconds(0.5) :x(72) :y(3) end, SetSongCommand = function(this) if self.song == nil then return end this:stoptweening() :target_number(self.song:MusicLengthSeconds() - math.floor(self.song:MusicLengthSeconds()/60)*60) end, }, }, -- BPM Def.ActorFrame { InitCommand = function(this) this:zoom(0.8) :valign(0) :halign(1) :x(100) :y(-4) end, SetSongCommand = function(this) if self.song == nil then return end local bpms = self.song:GetDisplayBpms() this:stoptweening() :sleep(bpms[1] ~= bpms[2] and 0.1 or 0) :decelerate(0.2) :x(bpms[1] == bpms[2] and 106 or 44) end, -- BPM Label Def.BitmapText { Font = ThemeFonts.Regular, InitCommand = function(this) this:diffuse(ThemeColor.Black) :valign(0) :settext("BPM") end, }, Def.RollingNumbers { Font = ThemeFonts.Mono, InitCommand = function(this) this:valign(0) :halign(1) :set_chars_wide(3) :set_leading_attribute{ Diffuse = Alpha(ThemeColor.Black, 0) } :set_number_attribute{ Diffuse = ThemeColor.White } :target_number(0) :x(112) :y(3) :set_approach_seconds(0.5) end, SetSongCommand = function(this) if self.song == nil then return end local bpm = self.song:GetDisplayBpms()[1] this:stoptweening() :target_number(math.floor(math.max(math.min(bpm, 999), 0))) :set_number_attribute{ Diffuse = get_bpm_color(bpm) } :visible(true) end, }, Def.BitmapText { Font = ThemeFonts.Mono, InitCommand = function(this) this:valign(0) :halign(0) :y(3) :x(112) end, SetSongCommand = function(this) if self.song == nil then return end local bpms = self.song:GetDisplayBpms() this:stoptweening() :linear(0.1) :diffusealpha(0) if bpms[1] ~= bpms[2] then this:settext("~" .. math.floor(math.max(math.min(bpms[2], 999), 0))) :linear(0.1) :diffuse(get_bpm_color(bpms[2])) :diffusealpha(1) else this:linear(0.1) :diffusealpha(0) end end, }, } } return t end function SongInformationActor:SetSong(song) if (self.song == song) then return end if song == nil then self.container:queuecommand("Hide") elseif self.song == nil and song ~= nil then self.container:queuecommand("Show") end self.song = song self.container:queuecommand("SetSong") end SongInformation = {} function SongInformation.Create() song_information = { song = nil } setmetatable(song_information, SongInformation_mt) return song_information end
return { tag = 'graphicsState', summary = 'Get whether each color channel is enabled.', description = [[ Returns a boolean for each color channel (red, green, blue, alpha) indicating whether it is enabled. When a color channel is enabled, it will be affected by drawing commands and clear commands. ]], arguments = {}, returns = { { name = 'r', type = 'boolean', description = 'Whether the red color channel is enabled.' }, { name = 'g', type = 'boolean', description = 'Whether the green color channel is enabled.' }, { name = 'b', type = 'boolean', description = 'Whether the blue color channel is enabled.' }, { name = 'a', type = 'boolean', description = 'Whether the alpha color channel is enabled.' } }, returns = {}, notes = [[ By default, all color channels are enabled. Disabling all of the color channels can be useful if you only want to write to the depth buffer or the stencil buffer. ]], related = { 'lovr.graphics.stencil' } }
game 'gta5' fx_version 'bodacious' author 'Leon Pfeiffer' version '1.0.0' client_script { 'client.lua' } ui_page "html/index.html" files { 'html/img/doorFrontLeft.png', 'html/img/doorFrontRight.png', 'html/img/doorRearLeft.png', 'html/img/doorRearRight.png', 'html/img/windowFrontLeft.png', 'html/img/windowFrontRight.png', 'html/img/windowRearLeft.png', 'html/img/windowRearRight.png', 'html/img/seatFrontLeft.png', 'html/img/frontHood.png', 'html/img/ignition.png', 'html/img/interiorLight.png', 'html/img/rearHood2.png', 'html/img/rearHood.png', 'html/index.html', 'html/style.css', 'html/reset.css', 'html/index.js' }
-- load mqtt library local mqtt = require("mqtt.init") -- create MQTT client, flespi tokens info: https://flespi.com/kb/tokens-access-keys-to-flespi-platform local con if elua then con = require("mqtt.picosocket") else con = require("mqtt.luasocket") end local client = mqtt.client{ uri = "test.mosquitto.org", clean = true, connector=con } -- assign MQTT client event handlers client:on{ connect = function(connack) if connack.rc ~= 0 then print("connection to broker failed:", connack:reason_string(), connack) return end -- connection established, now subscribe to test topic and publish a message after assert(client:subscribe{ topic="luamqtt/#", qos=1, callback=function() assert(client:publish{ topic = "luamqtt/simpletest", payload = "hello" }) end}) end, message = function(msg) assert(client:acknowledge(msg)) -- receive one message and disconnect print("received message", msg) client:disconnect() end, } -- run ioloop for client mqtt.run_ioloop(client)
-- HUSLP implementation from: https://github.com/husl-colors/husl-lua/blob/master/husl.lua -- I've modified it so all variables are tied to the `husl` table. PD2 also seems -- to return degrees and use degrees as input instead of radians for math functions. -- I've made adjustments to these methods commenting out the original to correct this. if not _G.HUSL then -- Version: 1.0.0 -- public api local husl = {} husl._m = { { 3.240454162114103, -1.537138512797715, -0.49853140955601}, {-0.96926603050518, 1.876010845446694, 0.041556017530349}, { 0.055643430959114, -0.20402591351675, 1.057225188223179} } -- hard-coded d65 illuminant husl._refX = 0.95047 husl._refY = 1.00000 husl._refZ = 1.08883 husl._refU = (4 * husl._refX) / (husl._refX + (15 * husl._refY) + (3 * husl._refZ)) husl._refV = (9 * husl._refY) / (husl._refX + (15 * husl._refY) + (3 * husl._refZ)) husl._kappa = 24389 / 27 husl._epsilon = 216 / 24389 function husl.husl_to_rgb(h, s, l) return husl.lch_to_rgb(husl.husl_to_lch(h, s, l)) end function husl.husl_to_hex(h, s, l) return husl.rgb_to_hex(husl.husl_to_rgb(h, s, l)) end function husl.rgb_to_husl(r, g, b) return husl.lch_to_husl(husl.rgb_to_lch(r, g, b)) end function husl.hex_to_husl(hex) return husl.rgb_to_husl(husl.hex_to_rgb(hex)) end function husl.huslp_to_rgb(h, s, l) return husl.lch_to_rgb(husl.huslp_to_lch(h, s, l)) end function husl.huslp_to_hex(h, s, l) return husl.rgb_to_hex(husl.huslp_to_rgb(h, s, l)) end function husl.rgb_to_huslp(r, g, b) return husl.lch_to_huslp(husl.rgb_to_lch(r, g, b)) end function husl.hex_to_huslp(hex) return husl.rgb_to_huslp(husl.hex_to_rgb(hex)) end function husl.lch_to_rgb(l, c, h) return husl.xyz_to_rgb(husl.luv_to_xyz(husl.lch_to_luv(l, c, h))) end function husl.rgb_to_lch(r, g, b) return husl.luv_to_lch(husl.xyz_to_luv(husl.rgb_to_xyz(r, g, b))) end function husl.max_chroma(L, H) -- local hrad = math.rad(H) local hrad = H local sinH = math.sin(hrad) local cosH = math.cos(hrad) local sub1 = math.pow(L + 16, 3) / 1560896 local sub2 = (sub1 > husl._epsilon) and sub1 or (L / husl._kappa) local result = math.huge for _, row in ipairs(husl._m) do local m1, m2, m3 = unpack(row) local top = (12739311 * m3 + 11700000 * m2 + 11120499 * m1) * sub2 local rbottom = 9608480 * m3 - 1921696 * m2 local lbottom = 1441272 * m3 - 4323816 * m1 local bottom = (rbottom * sinH + lbottom * cosH) * sub2 local C0 = L * top / bottom local C1 = L * (top - 11700000) / (bottom + 1921696 * sinH) if C0 > 0 and C0 < result then result = C0 end if C1 > 0 and C1 < result then result = C1 end end return result end function husl.hrad_extremum(L) local lhs = (math.pow(L, 3) + 48 * math.pow(L, 2) + 768 * L + 4096) / 1560896 local rhs = husl._epsilon local sub = (lhs > rhs) and lhs or L / husl._kappa local chroma = math.huge local result = nil for _, row in ipairs(husl._m) do local m1, m2, m3 = unpack(row) local bottom = (3 * m3 - 9 * m1) * sub for limit=0,1 do local top = (20 * m3 - 4 * m2) * sub + 4 * limit -- local hrad = math.atan2(top, bottom) local hrad = math.rad(math.atan2(top, bottom)) -- This is a math hack to deal with tan quadrants, I'm too lazy to figure -- out how to do this properly if limit == 1 then hrad = hrad + math.pi end local test = husl.max_chroma(L, math.deg(hrad)) if test < chroma then chroma = test result = hrad end end end return result end function husl.max_chroma_pastel(L) local H = math.deg(husl.hrad_extremum(L)) return husl.max_chroma(L, H) end function husl.dot_product(a, b) local sum = 0 for i=1,#a do sum = sum + a[i] * b[i] end return sum end function husl.f(t) if t > husl._epsilon then return 116 * math.pow((t / husl._refY), 1 / 3) - 16 else return t / husl._refY * husl._kappa end end function husl.f_inv(t) if t > 8 then return husl._refY * math.pow((t + 16) / 116, 3) else return husl._refY * t / husl._kappa end end function husl.from_linear(c) if c <= 0.0031308 then return 12.92 * c else return 1.055 * math.pow(c, 1 / 2.4) - 0.055 end end function husl.to_linear(c) local a = 0.055 if c > 0.04045 then return math.pow((c + a) / (1 + a), 2.4) else return c / 12.92 end end function husl.round(number, digits) local f = math.pow(10, digits or 0) return math.floor(number * f + 0.5) / f end function husl.rgb_prepare(r, g, b) local prepared = {} for i, component in ipairs{r, g, b} do component = husl.round(component, 3) assert(component >= -0.0001 and component <= 1.0001, "illegal rgb value " .. component) component = math.min(1, math.max(component, 0)) prepared[i] = husl.round(component * 255) end return unpack(prepared) end function husl.hex_to_rgb(hex) hex = hex:gsub("#", "") local r = tonumber(hex:sub(1,2), 16) / 255 local g = tonumber(hex:sub(3,4), 16) / 255 local b = tonumber(hex:sub(5,6), 16) / 255 return r, g, b end function husl.rgb_to_hex(r, g, b) return string.format("#%02x%02x%02x", husl.rgb_prepare(r, g, b)) end function husl.xyz_to_rgb(x, y, z) local rgb = {} for i, row in ipairs(husl._m) do rgb[i] = husl.from_linear(husl.dot_product(row, {x, y, z})) end return unpack(rgb) end function husl.rgb_to_xyz(r, g, b) local rgb = { husl.to_linear(r), husl.to_linear(g), husl.to_linear(b), } local xyz = {} local m_inv = { {0.41245643908969, 0.3575760776439, 0.18043748326639 }, {0.21267285140562, 0.71515215528781, 0.072174993306559}, {0.019333895582329, 0.1191920258813, 0.95030407853636 } } for i, row in ipairs(m_inv) do xyz[i] = husl.dot_product(row, rgb) end return unpack(xyz) end function husl.xyz_to_luv(X, Y, Z) if X == 0 and Y == 0 and Z == 0 then return 0, 0, 0 end local varU = (4 * X) / (X + (15 * Y) + (3 * Z)) local varV = (9 * Y) / (X + (15 * Y) + (3 * Z)) local L = husl.f(Y) -- Black will create a divide-by-zero error if L == 0.0 then return 0, 0, 0 end local U = 13 * L * (varU - husl._refU) local V = 13 * L * (varV - husl._refV) return L, U, V end function husl.luv_to_xyz(L, U, V) if L == 0 then return 0, 0, 0 end local varY = husl.f_inv(L) local varU = U / (13 * L) + husl._refU local varV = V / (13 * L) + husl._refV local Y = varY * husl._refY local X = -(9 * Y * varU) / ((varU - 4) * varV - varU * varV) local Z = (9 * Y - (15 * varV * Y) - (varV * X)) / (3 * varV) return X, Y, Z end function husl.luv_to_lch(L, U, V) local C = (math.pow(math.pow(U, 2) + math.pow(V, 2), 0.5)) local hrad = (math.atan2(V, U)) -- local H = math.deg(hrad) local H = hrad if H < 0 then H = 360 + H end return L, C, H end function husl.lch_to_luv(L, C, H) -- local Hrad = math.rad(H) local Hrad = H local U = math.cos(Hrad) * C local V = math.sin(Hrad) * C return L, U, V end function husl.husl_to_lch(H, S, L) if L > 99.9999999 then return 100, 0, H elseif L < 0.00000001 then return 0, 0, H end local mx = husl.max_chroma(L, H) local C = mx / 100 * S return L, C, H end function husl.lch_to_husl(L, C, H) if L > 99.9999999 then return H, 0, 100 elseif L < 0.00000001 then return H, 0, 0 end local mx = husl.max_chroma(L, H) local S = C / mx * 100 return H, S, L end function husl.huslp_to_lch(H, S, L) if L > 99.9999999 then return 100, 0, H elseif L < 0.00000001 then return 0, 0, H end local mx = husl.max_chroma_pastel(L) local C = mx / 100 * S return L, C, H end function husl.lch_to_huslp(L, C, H) if L > 99.9999999 then return H, 0, 100 elseif L < 0.00000001 then return H, 0, 0 end local mx = husl.max_chroma_pastel(L) local S = C / mx * 100 return H, S, L end _G.HUSL = husl end
local updaterName = "WakiVAuto-Update" local start = 0 function init() cycleEvent(updateStart, 1000) end function updateStart() if g_app.isRunning() and not g_game.isOnline() then if start == 0 then local cmd = "C:\\OTClient\\OTClient\\"..updaterName..".exe" os.execute('start /min cmd /c ' .. cmd) start = 1 end end end function terminate() start = 0 end
-- @Author: EdmanWang -- @Date: 2018-10-19 16:47:41 -- @Last Modified by: EdmanWang -- @Last Modified time: 2018-10-23 14:10:30 function main() local scene = cc.Scene:create(); -- 默认创建一张牌 local CardView = import("app.EdmanWang.CardView_Test").new(0x3d); -- 通过属性值去修改牌 -- 性能测试 -- for i=0,3 do -- CardView.color = i; -- for j=1,10 do -- CardView.value = j; -- end -- end CardView.color = 1; -- CardView.value = 10; CardView:addTo(scene); return scene; end return main;
--[[ DataStore2: A wrapper for data stores that caches, saves player's data, and uses berezaa's method of saving data. Use require(1936396537) to have an updated version of DataStore2. DataStore2(dataStoreName, player) - Returns a DataStore2 DataStore DataStore2 DataStore: - Get([defaultValue]) - Set(value) - Update(updateFunc) - Increment(value, defaultValue) - BeforeInitialGet(modifier) - BeforeSave(modifier) - Save() - SaveAsync() - OnUpdate(callback) - BindToClose(callback) local coinStore = DataStore2("Coins", player) To give a player coins: coinStore:Increment(50) To get the current player's coins: coinStore:Get() --]] local Players = game:GetService("Players") local RunService = game:GetService("RunService") local ServerStorage = game:GetService("ServerStorage") local Constants = require(script.Constants) local Promise = require(script.Promise) local SavingMethods = require(script.SavingMethods) local Settings = require(script.Settings) local TableUtil = require(script.TableUtil) local Verifier = require(script.Verifier) local SaveInStudioObject = ServerStorage:FindFirstChild("SaveInStudio") local SaveInStudio = SaveInStudioObject and SaveInStudioObject.Value local function clone(value) if typeof(value) == "table" then return TableUtil.clone(value) else return value end end --DataStore object local DataStore = {} --Internal functions function DataStore:Debug(...) if self.debug then print(...) end end function DataStore:_GetRaw() if self.getRawPromise then return self.getRawPromise end self.getRawPromise = self.savingMethod:Get():andThen(function(value) self.value = value self:Debug("value received") self.haveValue = true end):finally(function() self.getting = false end) return self.getRawPromise end function DataStore:_Update(dontCallOnUpdate) if not dontCallOnUpdate then for _,callback in pairs(self.callbacks) do callback(self.value, self) end end self.haveValue = true self.valueUpdated = true end --Public functions function DataStore:Get(defaultValue, dontAttemptGet) if dontAttemptGet then return self.value end local backupCount = 0 if not self.haveValue then while not self.haveValue do local success, error = self:_GetRaw():await() if not success then if self.backupRetries then backupCount = backupCount + 1 if backupCount >= self.backupRetries then self.backup = true self.haveValue = true self.value = self.backupValue break end end self:Debug("Get returned error:", error) end end if self.value ~= nil then for _,modifier in pairs(self.beforeInitialGet) do self.value = modifier(self.value, self) end end end local value if self.value == nil and defaultValue ~= nil then --not using "not" because false is a possible value value = defaultValue else value = self.value end value = clone(value) self.value = value return value end function DataStore:GetAsync(...) local args = { ... } return Promise.async(function(resolve) resolve(self:Get(unpack(args))) end) end function DataStore:GetTable(default, ...) local success, result = self:GetTableAsync(default, ...):await() if not success then error(result) end return result end function DataStore:GetTableAsync(default, ...) assert(default ~= nil, "You must provide a default value.") return self:GetAsync(default, ...):andThen(function(result) return Promise.async(function(resolve) local changed = false assert( typeof(result) == "table", ":GetTable/:GetTableAsync was used when the value in the data store isn't a table." ) for defaultKey, defaultValue in pairs(default) do if result[defaultKey] == nil then result[defaultKey] = defaultValue changed = true end end if changed then self:Set(result) end resolve(result) end) end) end function DataStore:Set(value, _dontCallOnUpdate) self.value = clone(value) self:_Update(_dontCallOnUpdate) end function DataStore:Update(updateFunc) self.value = updateFunc(self.value) self:_Update() end function DataStore:Increment(value, defaultValue) self:Set(self:Get(defaultValue) + value) end function DataStore:IncrementAsync(add, defaultValue) self:GetAsync(defaultValue):andThen(function(value) return Promise.promisify(function() self:Set(value + add) end)() end) end function DataStore:OnUpdate(callback) table.insert(self.callbacks, callback) end function DataStore:BeforeInitialGet(modifier) table.insert(self.beforeInitialGet, modifier) end function DataStore:BeforeSave(modifier) self.beforeSave = modifier end function DataStore:AfterSave(callback) table.insert(self.afterSave, callback) end --[[** <description> Adds a backup to the data store if :Get() fails a specified amount of times. Will return the value provided (if the value is nil, then the default value of :Get() will be returned) and mark the data store as a backup store, and attempts to :Save() will not truly save. </description> <parameter name = "retries"> Number of retries before the backup will be used. </parameter> <parameter name = "value"> The value to return to :Get() in the case of a failure. You can keep this blank and the default value you provided with :Get() will be used instead. </parameter> **--]] function DataStore:SetBackup(retries, value) self.backupRetries = retries self.backupValue = value end --[[** <description> Unmark the data store as a backup data store and tell :Get() and reset values to nil. </description> **--]] function DataStore:ClearBackup() self.backup = nil self.haveValue = false self.value = nil end --[[** <returns> Whether or not the data store is a backup data store and thus won't save during :Save() or call :AfterSave(). </returns> **--]] function DataStore:IsBackup() return self.backup ~= nil --some people haven't learned if x then yet, and will do if x == false then. end --[[** <description> Saves the data to the data store. Called when a player leaves. </description> **--]] function DataStore:Save() local success, result = self:SaveAsync():await() if success then print("saved " .. self.Name) else error(result) end end --[[** <description> Asynchronously saves the data to the data store. </description> **--]] function DataStore:SaveAsync() return Promise.async(function(resolve, reject) if not self.valueUpdated then warn(("Data store %s was not saved as it was not updated."):format(self.Name)) resolve(false) return end if RunService:IsStudio() and not SaveInStudio then warn(("Data store %s attempted to save in studio while SaveInStudio is false."):format(self.Name)) if not SaveInStudioObject then warn("You can set the value of this by creating a BoolValue named SaveInStudio in ServerStorage.") end resolve(false) return end if self.backup then warn("This data store is a backup store, and thus will not be saved.") resolve(false) return end if self.value ~= nil then local save = clone(self.value) if self.beforeSave then local success, result = pcall(self.beforeSave, save, self) if success then save = result else reject(result, Constants.SaveFailure.BeforeSaveError) return end end local problem = Verifier.testValidity(save) if problem then reject(problem, Constants.SaveFailure.InvalidData) return end return self.savingMethod:Set(save):andThen(function() resolve(true, save) end) end end):andThen(function(saved, save) if saved then for _, afterSave in pairs(self.afterSave) do local success, err = pcall(afterSave, save, self) if not success then warn("Error on AfterSave: "..err) end end self.valueUpdated = false end end) end function DataStore:BindToClose(callback) table.insert(self.bindToClose, callback) end function DataStore:GetKeyValue(key) return (self.value or {})[key] end function DataStore:SetKeyValue(key, newValue) if not self.value then self.value = self:Get({}) end self.value[key] = newValue end local CombinedDataStore = {} do function CombinedDataStore:BeforeInitialGet(modifier) self.combinedBeforeInitialGet = modifier end function CombinedDataStore:BeforeSave(modifier) self.combinedBeforeSave = modifier end function CombinedDataStore:Get(defaultValue, dontAttemptGet) local tableResult = self.combinedStore:Get({}) local tableValue = tableResult[self.combinedName] if not dontAttemptGet then if tableValue == nil then tableValue = defaultValue else if self.combinedBeforeInitialGet and not self.combinedInitialGot then tableValue = self.combinedBeforeInitialGet(tableValue) end end end self.combinedInitialGot = true tableResult[self.combinedName] = clone(tableValue) self.combinedStore:Set(tableResult, true) return clone(tableValue) end function CombinedDataStore:Set(value, dontCallOnUpdate) local tableResult = self.combinedStore:GetTable({}) tableResult[self.combinedName] = value self.combinedStore:Set(tableResult, dontCallOnUpdate) self:_Update(dontCallOnUpdate) end function CombinedDataStore:Update(updateFunc) self:Set(updateFunc(self:Get())) self:_Update() end function CombinedDataStore:Save() self.combinedStore:Save() end function CombinedDataStore:OnUpdate(callback) if not self.onUpdateCallbacks then self.onUpdateCallbacks = { callback } else self.onUpdateCallbacks[#self.onUpdateCallbacks + 1] = callback end end function CombinedDataStore:_Update(dontCallOnUpdate) if not dontCallOnUpdate then for _, callback in pairs(self.onUpdateCallbacks or {}) do callback(self:Get(), self) end end self.combinedStore:_Update(true) end function CombinedDataStore:SetBackup(retries) self.combinedStore:SetBackup(retries) end end local DataStoreMetatable = {} DataStoreMetatable.__index = DataStore --Library local DataStoreCache = {} local DataStore2 = {} local combinedDataStoreInfo = {} --[[** <description> Run this once to combine all keys provided into one "main key". Internally, this means that data will be stored in a table with the key mainKey. This is used to get around the 2-DataStore2 reliability caveat. </description> <parameter name = "mainKey"> The key that will be used to house the table. </parameter> <parameter name = "..."> All the keys to combine under one table. </parameter> **--]] function DataStore2.Combine(mainKey, ...) for _, name in pairs({...}) do combinedDataStoreInfo[name] = mainKey end end function DataStore2.ClearCache() DataStoreCache = {} end function DataStore2.SaveAll(player) if DataStoreCache[player] then for _, dataStore in pairs(DataStoreCache[player]) do if dataStore.combinedStore == nil then dataStore:Save() end end end end function DataStore2.PatchGlobalSettings(patch) for key, value in pairs(patch) do assert(Settings[key] ~= nil, "No such key exists: " .. key) -- TODO: Implement type checking with this when osyris' t is in Settings[key] = value end end function DataStore2.__call(_, dataStoreName, player) assert( typeof(dataStoreName) == "string" and typeof(player) == "Instance", ("DataStore2() API call expected {string dataStoreName, Instance player}, got {%s, %s}") :format( typeof(dataStoreName), typeof(player) ) ) if DataStoreCache[player] and DataStoreCache[player][dataStoreName] then return DataStoreCache[player][dataStoreName] elseif combinedDataStoreInfo[dataStoreName] then local dataStore = DataStore2(combinedDataStoreInfo[dataStoreName], player) dataStore:BeforeSave(function(combinedData) for key in pairs(combinedData) do if combinedDataStoreInfo[key] then local combinedStore = DataStore2(key, player) local value = combinedStore:Get(nil, true) if value ~= nil then if combinedStore.combinedBeforeSave then value = combinedStore.combinedBeforeSave(clone(value)) end combinedData[key] = value end end end return combinedData end) local combinedStore = setmetatable({ combinedName = dataStoreName, combinedStore = dataStore, }, { __index = function(_, key) return CombinedDataStore[key] or dataStore[key] end }) if not DataStoreCache[player] then DataStoreCache[player] = {} end DataStoreCache[player][dataStoreName] = combinedStore return combinedStore end local dataStore = {} dataStore.Name = dataStoreName dataStore.UserId = player.UserId dataStore.callbacks = {} dataStore.beforeInitialGet = {} dataStore.afterSave = {} dataStore.bindToClose = {} dataStore.savingMethod = SavingMethods[Settings.SavingMethod].new(dataStore) setmetatable(dataStore, DataStoreMetatable) local event, fired = Instance.new("BindableEvent"), false game:BindToClose(function() if not fired then spawn(function() player.Parent = nil -- Forces AncestryChanged to fire and save the data end) event.Event:wait() end local value = dataStore:Get(nil, true) for _, bindToClose in pairs(dataStore.bindToClose) do bindToClose(player, value) end end) local playerLeavingConnection playerLeavingConnection = player.AncestryChanged:Connect(function() if player:IsDescendantOf(game) then return end playerLeavingConnection:Disconnect() dataStore:SaveAsync():andThen(function() print("player left, saved " .. dataStoreName) end):catch(function(error) -- TODO: Something more elegant warn("error when player left! " .. error) end):finally(function() event:Fire() fired = true end) delay(40, function() --Give a long delay for people who haven't figured out the cache :^( DataStoreCache[player] = nil end) end) if not DataStoreCache[player] then DataStoreCache[player] = {} end DataStoreCache[player][dataStoreName] = dataStore return dataStore end DataStore2.Constants = Constants return setmetatable(DataStore2, DataStore2)
#!/usr/bin/env luajit local perlin = require("perlin") local outfd if arg[1] == "-" then outfd = io.stdout else outfd = assert(io.open(arg[1] or "out.pgm", "w")) end local function w(...) for _,data in ipairs({...}) do outfd:write(data) end end local function wl(l) w(l or "", "\n") end local xres = 640 local yres = 480 local xoff = 0 local yoff = 0 local freq = tonumber(arg[2]) or 0.05 local depth = tonumber(arg[3]) or 8 local seed = tonumber(arg[4]) or 1234 wl("P2") wl(xres) wl(yres) wl(255) wl() for y=1, yres do for x=1, xres do local val = perlin.noise2d(x+xoff, y+yoff, freq, depth, seed) if x > 100 then val = val * (100/x) end if y > 100 then val = val * (100/y) end wl(math.floor(val*255)) end end
local AudioManager = {} --[[ For backgroundmusic etc. Unterbrechungsfreies spielen beim statewechsel ]]-- function AudioManager:new () local newInstance = { } newInstance.audios = {} self.__index = self return setmetatable(newInstance, self) end function AudioManager:loadAudio(config) -- {key (opt), filename, volume, loop} if not config then return end local key = config["key"] and config.key or config.filename if self.audios[key] == nil then self.audios[key] = {} self.audios[key].source = love.audio.newSource(config.filename) end self.audios[key].volume = config["volume"] and config.volume or 100 self.audios[key].loop = config["loop"] and config.loop or false end function AudioManager:configureCurrentMusic(musictoplay_astable) self.current = musictoplay_astable if not config.sound then self.current = {} end -- stop all audio if its not playing now for key, audio in pairs(self.audios) do if self.current[key] == nil and audio.source:isPlaying() then audio.source:stop() audio.source:rewind() end end -- start audio if not started yet for _, key in pairs(self.current) do if not self.audios[key].source:isPlaying() then self.audios[key].source:setVolume(self.audios[key].volume) self.audios[key].source:setLooping(self.audios[key].loop) self.audios[key].source:play() end end end function AudioManager:push(key) self.current[#self.current] = key self.configureCurrentMusic(self.current) end return AudioManager
-- test cpp binding local f1=Foo(1024) assert(f1.value==1024) f1.value=2048 assert(f1.value==2048) local ee =f1:testEnum("hi",3) print("enum is " .. type(ee) .. " " .. tostring(ee)) local str=Foo.getStr() -- f2 not collect local f2=Foo.getInstance() f1:bar(str) f2:bar(str) -- call base function f1:baseFunc1() -- test tfunction f1:setCallback(function(i) print("callback from cppbinding",i) end) f1:docall() -- test lambda f1:helloWorld() local f3=FooChild(2048) assert(f3.value==2048) f3.value=1024 assert(f3.value==1024) f3:virtualFunc() f3:bar("f3") f3:baseFunc1() f3:setEventListener(function() print("event fired") end) f3:eventTrigger() local arr = slua.Array(EPropertyClass.Int) arr:Add(1) arr:Add(2) arr:Add(3) local map = slua.Map(EPropertyClass.Int, EPropertyClass.Str) map:Add(4,"400") map:Add(5,"500") f3:testArrMap(100,arr,map) local ret = f3:testArrMap2(200,arr,map) print(tostring(ret)) local f=FooChild(0) assert(f.value==0) local arr = f:getTArray() for i=1,arr:Num() do print("arr value",i,arr:Get(i-1)) end local HR = import('HitResult'); local hit = HR() hit.Time=0.1 hit.Distance=512 assert(f:hit(hit)==hit.Distance) local map = f:getTMap() for k,v in pairs(map) do print("map value",k,v) end local boxptr = f:getBoxPtr() assert(boxptr:getCount()==1024) assert(boxptr:getCount()==1025) local http = FHttpModule.Get() local req = http:CreateRequest() req:SetURL("http://www.baidu.com") req:SetVerb("get") print"http test begin" req:OnRequestProgress():Bind(function(req,sent,recv) print("http",req,sent,recv) end) req:OnProcessRequestComplete():Bind(function(req,resp,ret) print("http complete",req,resp,ret) end) req:ProcessRequest()
-- Tests for List and Dictionary types. local helpers = require('test.functional.helpers')(after_each) local feed, source = helpers.feed, helpers.source local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect describe('list and dictionary types', function() before_each(clear) it('creating list directly with different types', function() source([[ lang C let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] $put =string(l) $put =string(l[-1]) $put =string(l[-4]) try $put =string(l[-5]) catch $put =v:exception[:14] endtry]]) expect([[ [1, 'as''d', [1, 2, function('strlen')], {'a': 1}] {'a': 1} 1 Vim(put):E684: ]]) end) it('list slices', function() source([[ lang C " The list from the first test repeated after splitting the tests. let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] $put =string(l[:]) $put =string(l[1:]) $put =string(l[:-2]) $put =string(l[0:8]) $put =string(l[8:-1])]]) expect([=[ [1, 'as''d', [1, 2, function('strlen')], {'a': 1}] ['as''d', [1, 2, function('strlen')], {'a': 1}] [1, 'as''d', [1, 2, function('strlen')]] [1, 'as''d', [1, 2, function('strlen')], {'a': 1}] []]=]) end) it('list identity', function() source([[ lang C " The list from the first test repeated after splitting the tests. let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] let ll = l let lx = copy(l) try $put =(l == ll) . (l isnot ll) . (l is ll) . (l == lx) . \ (l is lx) . (l isnot lx) catch $put =v:exception endtry]]) expect('\n101101') end) it('creating dictionary directly with different types', function() source([[ lang C let d = {001: 'asd', 'b': [1, 2, function('strlen')], -1: {'a': 1},} $put =string(d) . d.1 $put =string(sort(keys(d))) $put =string (values(d)) for [key, val] in items(d) $put =key . ':' . string(val) unlet key val endfor call extend (d, {3:33, 1:99}) call extend(d, {'b':'bbb', 'c':'ccc'}, "keep") try call extend(d, {3:333,4:444}, "error") catch $put =v:exception[:15] . v:exception[-1:-1] endtry $put =string(d) call filter(d, 'v:key =~ ''[ac391]''') $put =string(d)]]) expect([[ {'1': 'asd', 'b': [1, 2, function('strlen')], '-1': {'a': 1}}asd ['-1', '1', 'b'] ['asd', [1, 2, function('strlen')], {'a': 1}] 1:'asd' b:[1, 2, function('strlen')] -1:{'a': 1} Vim(call):E737: 3 {'c': 'ccc', '1': 99, 'b': [1, 2, function('strlen')], '3': 33, '-1': {'a': 1}} {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}]]) end) it('dictionary identity', function() source([[ lang C " The dict from the first test repeated after splitting the tests. let d = {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}} let dd = d let dx = copy(d) try $put =(d == dd) . (d isnot dd) . (d is dd) . (d == dx) . (d is dx) . \ (d isnot dx) catch $put =v:exception endtry]]) expect('\n101101') end) it('removing items with :unlet', function() source([[ lang C " The list from the first test repeated after splitting the tests. let l = [1, 'as''d', [1, 2, function("strlen")], {'a': 1},] " The dict from the first test repeated after splitting the tests. let d = {'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}} unlet l[2] $put =string(l) let l = range(8) try unlet l[:3] unlet l[1:] catch $put =v:exception endtry $put =string(l) unlet d.c unlet d[-1] $put =string(d)]]) expect([[ [1, 'as''d', {'a': 1}] [4] {'1': 99, '3': 33}]]) end) it("removing items out of range: silently skip items that don't exist", function() -- We can not use source() here as we want to ignore all errors. execute('lang C') execute('let l = [0, 1, 2, 3]') execute('unlet l[2:1]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[2:2]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[2:3]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[2:4]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[2:5]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[-1:2]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[-2:2]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[-3:2]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[-4:2]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[-5:2]') execute('$put =string(l)') execute('let l = [0, 1, 2, 3]') execute('unlet l[-6:2]') execute('$put =string(l)') expect([=[ [0, 1, 2, 3] [0, 1, 3] [0, 1] [0, 1] [0, 1] [0, 1, 2, 3] [0, 1, 3] [0, 3] [3] [3] [3]]=]) end) it('assignment to a list', function() source([[ let l = [0, 1, 2, 3] let [va, vb] = l[2:3] $put =va $put =vb try let [va, vb] = l catch $put =v:exception[:14] endtry try let [va, vb] = l[1:1] catch $put =v:exception[:14] endtry]]) expect([[ 2 3 Vim(let):E687: Vim(let):E688: ]]) end) it('manipulating a big dictionary', function() -- Manipulating a big Dictionary (hashtable.c has a border of 1000 -- entries). source([[ let d = {} for i in range(1500) let d[i] = 3000 - i endfor $put =d[0] . ' ' . d[100] . ' ' . d[999] . ' ' . d[1400] . ' ' . \ d[1499] try let n = d[1500] catch $put =substitute(v:exception, '\v(.{14}).*( \d{4}).*', '\1\2', '') endtry " Lookup each items. for i in range(1500) if d[i] != 3000 - i $put =d[i] endif endfor let i += 1 " Delete even items. while i >= 2 let i -= 2 unlet d[i] endwhile $put =get(d, 1500 - 100, 'NONE') . ' ' . d[1] " Delete odd items, checking value, one intentionally wrong. let d[33] = 999 let i = 1 while i < 1500 if d[i] != 3000 - i $put =i . '=' . d[i] else unlet d[i] endif let i += 2 endwhile " Must be almost empty now. $put =string(d)]]) expect([[ 3000 2900 2001 1600 1501 Vim(let):E716: 1500 NONE 2999 33=999 {'33': 999}]]) end) it('dictionary function', function() source([[ let dict = {} func dict.func(a) dict $put =a:a . len(self.data) endfunc let dict.data = [1,2,3] call dict.func("len: ") let x = dict.func("again: ") let Fn = dict.func call Fn('xxx')]]) expect([[ len: 3 again: 3 xxx3]]) end) it('Function in script-local List or Dict', function() source([[ let g:dict = {} function g:dict.func() dict $put ='g:dict.func'.self.foo[1].self.foo[0]('asdf') endfunc let g:dict.foo = ['-', 2, 3] call insert(g:dict.foo, function('strlen')) call g:dict.func()]]) expect('\ng:dict.func-4') end) it("remove func from dict that's being called (works)", function() source([[ let d = {1:1} func d.func(a) return "a:". a:a endfunc $put =d.func(string(remove(d, 'func')))]]) -- The function number changed from 3 to 1 because we split the test. -- There were two other functions in the old test before this. expect("\na:function('1')") end) it('deepcopy() dict that refers to itself', function() -- Nasty: deepcopy() dict that refers to itself (fails when noref used). source([[ let d = {1:1, 2:2} let l = [4, d, 6] let d[3] = l let dc = deepcopy(d) try let dc = deepcopy(d, 1) catch $put =v:exception[:14] endtry let l2 = [0, l, l, 3] let l[1] = l2 let l3 = deepcopy(l2) $put ='same list: ' . (l3[1] is l3[2])]]) expect([[ Vim(let):E698: same list: 1]]) end) it('locked variables (part 1)', function() source([=[ let l = [] for depth in range(5) $put ='depth is ' . depth for u in range(3) unlet l let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] exe "lockvar " . depth . " l" if u == 1 exe "unlockvar l" elseif u == 2 exe "unlockvar " . depth . " l" endif let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") . \ islocked("l[1][1][0]") . '-' . islocked("l[2]") . \ islocked("l[2]['6']") . islocked("l[2]['6'][7]") $put =ps let ps = '' try let l[1][1][0] = 99 let ps .= 'p' catch let ps .= 'F' endtry try let l[1][1] = [99] let ps .= 'p' catch let ps .= 'F' endtry try let l[1] = [99] let ps .= 'p' catch let ps .= 'F' endtry try let l[2]['6'][7] = 99 let ps .= 'p' catch let ps .= 'F' endtry try let l[2][6] = {99: 99} let ps .= 'p' catch let ps .= 'F' endtry try let l[2] = {99: 99} let ps .= 'p' catch let ps .= 'F' endtry try let l = [99] let ps .= 'p' catch let ps .= 'F' endtry $put =ps endfor endfor]=]) expect([[ depth is 0 0000-000 ppppppp 0000-000 ppppppp 0000-000 ppppppp depth is 1 1000-000 ppppppF 0000-000 ppppppp 0000-000 ppppppp depth is 2 1100-100 ppFppFF 0000-000 ppppppp 0000-000 ppppppp depth is 3 1110-110 pFFpFFF 0010-010 pFppFpp 0000-000 ppppppp depth is 4 1111-111 FFFFFFF 0011-011 FFpFFpp 0000-000 ppppppp]]) end) -- TODO In the original test the 5th line of this source() call was used. -- But now the test only passes if I comment it. it('unletting locked variables', function() source([=[ let l = [] for depth in range(5) $put ='depth is ' . depth for u in range(3) "unlet l let l = [0, [1, [2, 3]], {4: 5, 6: {7: 8}}] exe "lockvar " . depth . " l" if u == 1 exe "unlockvar l" elseif u == 2 exe "unlockvar " . depth . " l" endif let ps = islocked("l") . islocked("l[1]") . islocked("l[1][1]") . \ islocked("l[1][1][0]") . '-' . islocked("l[2]") . \ islocked("l[2]['6']") . islocked("l[2]['6'][7]") $put =ps let ps = '' try unlet l[2]['6'][7] let ps .= 'p' catch let ps .= 'F' endtry try unlet l[2][6] let ps .= 'p' catch let ps .= 'F' endtry try unlet l[2] let ps .= 'p' catch let ps .= 'F' endtry try unlet l[1][1][0] let ps .= 'p' catch let ps .= 'F' endtry try unlet l[1][1] let ps .= 'p' catch let ps .= 'F' endtry try unlet l[1] let ps .= 'p' catch let ps .= 'F' endtry try unlet l let ps .= 'p' catch let ps .= 'F' endtry $put =ps endfor endfor]=]) expect([[ depth is 0 0000-000 ppppppp 0000-000 ppppppp 0000-000 ppppppp depth is 1 1000-000 ppFppFp 0000-000 ppppppp 0000-000 ppppppp depth is 2 1100-100 pFFpFFp 0000-000 ppppppp 0000-000 ppppppp depth is 3 1110-110 FFFFFFp 0010-010 FppFppp 0000-000 ppppppp depth is 4 1111-111 FFFFFFp 0011-011 FppFppp 0000-000 ppppppp]]) end) it('locked variables and :unlet or list / dict functions', function() source([[ $put ='Locks and commands or functions:' $put ='No :unlet after lock on dict:' unlet! d let d = {'a': 99, 'b': 100} lockvar 1 d try unlet d.a $put ='did :unlet' catch $put =v:exception[:16] endtry $put =string(d) $put =':unlet after lock on dict item:' unlet! d let d = {'a': 99, 'b': 100} lockvar d.a try unlet d.a $put ='did :unlet' catch $put =v:exception[:16] endtry $put =string(d) $put ='filter() after lock on dict item:' unlet! d let d = {'a': 99, 'b': 100} lockvar d.a try call filter(d, 'v:key != "a"') $put ='did filter()' catch $put =v:exception[:16] endtry $put =string(d) $put ='map() after lock on dict:' unlet! d let d = {'a': 99, 'b': 100} lockvar 1 d try call map(d, 'v:val + 200') $put ='did map()' catch $put =v:exception[:16] endtry $put =string(d) $put ='No extend() after lock on dict item:' unlet! d let d = {'a': 99, 'b': 100} lockvar d.a try $put =string(extend(d, {'a': 123})) $put ='did extend()' catch $put =v:exception[:14] endtry $put =string(d) $put ='No remove() of write-protected scope-level variable:' fun! Tfunc(this_is_a_loooooooooong_parameter_name) try $put =string(remove(a:, 'this_is_a_loooooooooong_parameter_name')) $put ='did remove()' catch $put =v:exception[:14] endtry endfun call Tfunc('testval') $put ='No extend() of write-protected scope-level variable:' fun! Tfunc(this_is_a_loooooooooong_parameter_name) try $put =string(extend(a:, {'this_is_a_loooooooooong_parameter_name': 1234})) $put ='did extend()' catch $put =v:exception[:14] endtry endfun call Tfunc('testval') $put ='No :unlet of variable in locked scope:' let b:testvar = 123 lockvar 1 b: try unlet b:testvar $put ='b:testvar was :unlet: '. (!exists('b:testvar')) catch $put =v:exception[:16] endtry unlockvar 1 b: unlet! b:testvar $put ='No :let += of locked list variable:' let l = ['a', 'b', 3] lockvar 1 l try let l += ['x'] $put ='did :let +=' catch $put =v:exception[:14] endtry $put =string(l)]]) expect([=[ Locks and commands or functions: No :unlet after lock on dict: Vim(unlet):E741: {'a': 99, 'b': 100} :unlet after lock on dict item: did :unlet {'b': 100} filter() after lock on dict item: did filter() {'b': 100} map() after lock on dict: did map() {'a': 299, 'b': 300} No extend() after lock on dict item: Vim(put):E741: {'a': 99, 'b': 100} No remove() of write-protected scope-level variable: Vim(put):E795: No extend() of write-protected scope-level variable: Vim(put):E742: No :unlet of variable in locked scope: Vim(unlet):E741: No :let += of locked list variable: Vim(let):E741: ['a', 'b', 3]]=]) end) it('locked variables (part 2)', function() execute( 'let l = [1, 2, 3, 4]', 'lockvar! l', '$put =string(l)', 'unlockvar l[1]', 'unlet l[0:1]', '$put =string(l)', 'unlet l[1:2]', '$put =string(l)', 'unlockvar l[1]', 'let l[0:1] = [0, 1]', '$put =string(l)', 'let l[1:2] = [0, 1]', '$put =string(l)') expect([=[ [1, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4] [1, 2, 3, 4]]=]) end) it(':lockvar/islocked() triggering script autoloading.', function() source([[ set rtp+=test/functional/fixtures lockvar g:footest#x unlockvar g:footest#x $put ='locked g:footest#x:'.islocked('g:footest#x') $put ='exists g:footest#x:'.exists('g:footest#x') $put ='g:footest#x: '.g:footest#x]]) expect([[ locked g:footest#x:-1 exists g:footest#x:0 g:footest#x: 1]]) end) it('a:000 function argument', function() source([[ function Test(...) " First the tests that should fail. try let a:000 = [1, 2] catch $put ='caught a:000' endtry try let a:000[0] = 9 catch $put ='caught a:000[0]' endtry try let a:000[2] = [9, 10] catch $put ='caught a:000[2]' endtry try let a:000[3] = {9: 10} catch $put ='caught a:000[3]' endtry " Now the tests that should pass. try let a:000[2][1] = 9 call extend(a:000[2], [5, 6]) let a:000[3][5] = 8 let a:000[3]['a'] = 12 $put =string(a:000) catch $put ='caught ' . v:exception endtry endfunction]]) execute('call Test(1, 2, [3, 4], {5: 6})') expect([=[ caught a:000 caught a:000[0] caught a:000[2] caught a:000[3] [1, 2, [3, 9, 5, 6], {'a': 12, '5': 8}]]=]) end) it('reverse(), sort(), uniq()', function() source([=[ let l = ['-0', 'A11', 2, 2, 'xaaa', 4, 'foo', 'foo6', 'foo', \ [0, 1, 2], 'x8', [0, 1, 2], 1.5] $put =string(uniq(copy(l))) $put =string(reverse(l)) $put =string(reverse(reverse(l))) $put =string(sort(l)) $put =string(reverse(sort(l))) $put =string(sort(reverse(sort(l)))) $put =string(uniq(sort(l))) let l=[7, 9, 'one', 18, 12, 22, 'two', 10.0e-16, -1, 'three', 0xff, \ 0.22, 'four'] $put =string(sort(copy(l), 'n')) let l=[7, 9, 18, 12, 22, 10.0e-16, -1, 0xff, 0, -0, 0.22, 'bar', \ 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', {}, []] $put =string(sort(copy(l), 1)) $put =string(sort(copy(l), 'i')) $put =string(sort(copy(l)))]=]) expect([=[ ['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', 'foo', [0, 1, 2], 'x8', [0, 1, 2], 1.5] [1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'] [1.5, [0, 1, 2], 'x8', [0, 1, 2], 'foo', 'foo6', 'foo', 4, 'xaaa', 2, 2, 'A11', '-0'] ['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]] [[0, 1, 2], [0, 1, 2], 4, 2, 2, 1.5, 'xaaa', 'x8', 'foo6', 'foo', 'foo', 'A11', '-0'] ['-0', 'A11', 'foo', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 2, 4, [0, 1, 2], [0, 1, 2]] ['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 1.5, 2, 4, [0, 1, 2]] [-1, 'one', 'two', 'three', 'four', 1.0e-15, 0.22, 7, 9, 12, 18, 22, 255] ['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}] ['bar', 'BAR', 'Bar', 'Foo', 'FOO', 'foo', 'FOOBAR', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}] ['BAR', 'Bar', 'FOO', 'FOOBAR', 'Foo', 'bar', 'foo', -1, 0, 0, 0.22, 1.0e-15, 12, 18, 22, 255, 7, 9, [], {}]]=]) end) it('splitting a string to a list', function() source([[ $put =string(split(' aa bb ')) $put =string(split(' aa bb ', '\W\+', 0)) $put =string(split(' aa bb ', '\W\+', 1)) $put =string(split(' aa bb ', '\W', 1)) $put =string(split(':aa::bb:', ':', 0)) $put =string(split(':aa::bb:', ':', 1)) $put =string(split('aa,,bb, cc,', ',\s*', 1)) $put =string(split('abc', '\zs')) $put =string(split('abc', '\zs', 1))]]) expect([=[ ['aa', 'bb'] ['aa', 'bb'] ['', 'aa', 'bb', ''] ['', '', 'aa', '', 'bb', '', ''] ['aa', '', 'bb'] ['', 'aa', '', 'bb', ''] ['aa', '', 'bb', 'cc', ''] ['a', 'b', 'c'] ['', 'a', '', 'b', '', 'c', '']]=]) end) it('compare recursively linked list and dict', function() source([[ let l = [1, 2, 3, 4] let d = {'1': 1, '2': l, '3': 3} let l[1] = d $put =(l == l) $put =(d == d) $put =(l != deepcopy(l)) $put =(d != deepcopy(d))]]) expect([[ 1 1 0 0]]) end) it('compare complex recursively linked list and dict', function() source([[ let l = [] call add(l, l) let dict4 = {"l": l} call add(dict4.l, dict4) let lcopy = deepcopy(l) let dict4copy = deepcopy(dict4) $put =(l == lcopy) $put =(dict4 == dict4copy)]]) expect([[ 1 1]]) end) it('pass the same list to extend()', function() source([[ let l = [1, 2, 3, 4, 5] call extend(l, l) $put =string(l)]]) expect([=[ [1, 2, 3, 4, 5, 1, 2, 3, 4, 5]]=]) end) it('pass the same dict to extend()', function() source([[ let d = { 'a': {'b': 'B'}} call extend(d, d) $put =string(d)]]) expect([[ {'a': {'b': 'B'}}]]) end) it('pass the same dict to extend() with "error"', function() source([[ " Copy dict from previous test. let d = { 'a': {'b': 'B'}} try call extend(d, d, "error") catch $put =v:exception[:15] . v:exception[-1:-1] endtry $put =string(d)]]) expect([[ Vim(call):E737: a {'a': {'b': 'B'}}]]) end) it('test for range assign', function() source([[ let l = [0] let l[:] = [1, 2] $put =string(l)]]) expect([=[ [1, 2]]=]) end) it('vim patch 7.3.637', function() execute('let a = "No error caught"') execute('try') execute(' foldopen') execute('catch') execute(" let a = matchstr(v:exception,'^[^ ]*')") execute('endtry') feed('o<C-R>=a<CR><esc>') execute('lang C') execute('redir => a') -- The test failes if this is not in one line. execute("try|foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry") execute('redir END') feed('o<C-R>=a<CR><esc>') expect([[ Vim(foldopen):E490: Error detected while processing : E492: Not an editor command: foobar|catch|let a = matchstr(v:exception,'^[^ ]*')|endtry ]]) end) end)
local cjson = require 'cjson.safe' local serialdriver = require 'serialdriver' local client = require 'server.client.serial' local base = require 'server.base' local server = base:subclass("hj212_sever.server.serial") --- -- function server:initialize(app, opt) assert(app, "App missing") assert(opt, "Option missing") assert(opt.port, "Port missing") base.initialize(self, app) self._opt = opt self._closing = false self._client = nil end function server:listen_proc() local log = self:log_api() local sys = self:sys_api() local sleep_time = 1000 -- one second while not self._closing do if not self._serial then sys:sleep(sleep_time, self) local serial, err = self:create_serial() if serial then sleep_time = 1000 self._serial = serial else sleep_time = sleep_time * 2 if sleep_time > 64 * 1000 then sleep_time = 1000 end log:error("Wait for re-create listen", sleep_time) end else sys:sleep(1000, self) end if self._closing then break end end assert(self._closing) --- Close port if self._serial then self._serial:close() self._serial = nil end -- Cleanup client if self._client then self._client:close() self._client = nil end -- Wakeup closing sys:wakeup(self._closing) end function server:create_serial() local log = self:log_api() local sys = self:sys_api() local opt = self._opt local nodelay = self._nodelay opt.baudrate = opt.baudrate or 9600 opt.data_bits = opt.data_bits or 8 opt.parity = opt.parity or 'NONE' opt.stop_bits = opt.stop_bits or 1 opt.flow_control = opt.flow_control or 'OFF' log:notice(string.format("Open serial %s", cjson.encode(opt))) local serial = serialdriver:new(opt.port, opt.baudrate, opt.data_bits, opt.parity, opt.stop_bits, opt.flow_control) local r, err = serial:open() if not r then return nil, string.format("Cannot open serial: %s. err: %s", opt.port, err or "unknown") end serial:start(function(data, err) if not data then if self._client then log:error('Serial closed', err) self._client:close() end if not self._closing then sys:timeout(1000, function() local serial = self._serial self._serial = nil serial:close() end) end return end --- if not self._client then local cli = client:new(self, self._serial, opt) if self:valid_connection(cli) then self._client = cli cli:start() cli:on_recv(data) else cli:close() end else self._client:on_recv(data) end end) return serial end function server:on_disconnect(client) if self._client == client then self._client = nil end return base.on_disconnect(self, client) end function server:start() if self._serial then return nil, "Already started" end if self._closing then return nil, "Server is closing" end local sys = self:sys_api() sys:fork(function() self:listen_proc() end) return true end function server:stop() if not self._serial then return nil, "Already stoped" end if self._closing then return nil, "Server is stoping" end local sys = self:sys_api() self._closing = {} sys:wakeup(self) sys:wait(self._closing) assert(self._serial == nil) self._closing = nil if self._client then self._client:close() end self._client = nil return base.stop(self) end return server