content
stringlengths
5
1.05M
local banned = {} hook.Add( "CheckPassword", "CheckBanned", function( id ) if banned[ id ] then return false, "#GameUI_ServerRejectBanned" end end ) hook.Add( "PlayerSay", "BanCommand", function( ply, text ) if ply:IsAdmin() and string.sub( string.lower( text ), 1, 4 ) == "!ban" then local target local args = string.Split( string.sub( text, 6 ), " " ) for _, v in ipairs( player.GetHumans() ) do if v:Nick() == args[ 1 ] then target = v end end if IsValid( target ) then banned[ target:SteamID64() ] = true timer.Simple( tonumber( args[ 2 ] or 0 ), function() banned[ target:SteamID64() ] = false end ) target:Kick() end return "" end end )
--Finish him >:D -YoungWarlock if (script:FindFirstChild("forCustomRun")~=nil) then local sc = script["forCustomRun"].Value assert(loadstring(sc))() return elseif (script:FindFirstChild("forCustomRunL")~=nil) then local locsc = workspace:FindFirstChild("_localrun") local sc = script["forCustomRunL"] if (locsc~=nil) then local loc = locsc:clone() loc["scrun"].Value = sc.Value loc.Name = script.Name for i,v in pairs(script:GetChildren()) do v:clone().Parent = loc end loc.Parent = script.Parent script:remove() return else assert(loadstring(sc.Value))() return end end local m = Instance.new("Model") m.Name = "Axe" t1 = Instance.new("Tool", m) t1.Name = "Axe" t1.GripForward = Vector3.new(0.654816329, 0, 0.755787969) t1.GripPos = Vector3.new(0, -5, -1) t1.GripRight = Vector3.new(-0.755788088, 0, 0.654816389) t1.ToolTip = "cutoff his head >:D" t1.TextureId = "http://www.roblox.com/asset/?id=132751208" p1 = Instance.new("Part", t1) p1.BrickColor = BrickColor.new("Lavender") p1.Material = Enum.Material.DiamondPlate p1.Name = "Mesh" p1.CFrame = CFrame.new(12.1134901, 0.823245525, 31.0344448, 0.998755872, -0.0498659499, -0.000301207241, 0.000239662302, -0.00124012085, 0.999999106, -0.049866274, -0.998755157, -0.00122658338) p1.CanCollide = false p1.FormFactor = Enum.FormFactor.Custom p1.Size = Vector3.new(0.270000011, 2.51999927, 0.769999921) p1.BottomSurface = Enum.SurfaceType.Smooth p1.TopSurface = Enum.SurfaceType.Smooth b1 = Instance.new("SpecialMesh", p1) b1.MeshId = "http://www.roblox.com/asset/?id=9826364" b1.TextureId = "http://www.roblox.com/asset/?id=132748654" b1.MeshType = Enum.MeshType.FileMesh b1.Name = "Mesh" b1.Scale = Vector3.new(0.100000001, 0.5, 0.400000006) p2 = Instance.new("Part", t1) p2.BrickColor = BrickColor.new("Brown") p2.Material = Enum.Material.Wood p2.Transparency = 1 p2.Name = "Stick" p2.CFrame = CFrame.new(11.9206495, 0.814050078, 27.1750031, 0.998756289, -0.0498578697, -0.000300195068, 0.000239249319, -0.00122833252, 0.999999166, -0.0498581976, -0.998755574, -0.00121486187) p2.CanCollide = false p2.FormFactor = Enum.FormFactor.Custom p2.Size = Vector3.new(0.270000011, 5.25, 0.779999971) p2.BottomSurface = Enum.SurfaceType.Smooth p2.TopSurface = Enum.SurfaceType.Smooth p3 = Instance.new("Part", t1) p3.BrickColor = BrickColor.new("White") p3.Material = Enum.Material.DiamondPlate p3.Transparency = 1 p3.Name = "Handle" p3.CFrame = CFrame.new(11.891242, 1.56779993, 26.5842533, 0.99876374, -0.0498589613, -0.000300985907, 0.000239431465, -0.00123731908, 1.00000405, -0.0498650223, -0.998756707, -0.0012158883) p3.FormFactor = Enum.FormFactor.Custom p3.Size = Vector3.new(0.200000003, 3.36999846, 0.759999216) p3.BottomSurface = Enum.SurfaceType.Smooth p3.TopSurface = Enum.SurfaceType.Smooth d1 = Instance.new("Decal", p3) d1.Texture = "http://www.roblox.com/asset/?id=132750261" d1.Face = Enum.NormalId.Left d2 = Instance.new("Decal", p3) d2.Texture = "http://www.roblox.com/asset/?id=132750214" d2.Face = Enum.NormalId.Right b2 = Instance.new("BlockMesh", p3) b2.Name = "Mesh" b2.Scale = Vector3.new(0.5, 0.300000012, 1) x1 = Instance.new("Sound", p3) x1.Name = "Miss" x1.Pitch = 0.69999998807907 x1.SoundId = "rbxasset://sounds/Metal.ogg" x1.Volume = 1 x1.Looped = false x1.PlayOnRemove = false s1 = script:clone() s1.Name = "HeadtakerWeld" s1.Disabled = false so1 = Instance.new("StringValue", s1) so1.Name = "forCustomRun" so1.Value = [===[ local prev local parts=script.Parent:GetChildren() for i=1,#parts do if(parts[i].className=="Part")or(parts[i].className=="WedgePart")or(parts[i].className=="Seat")or(parts[i].className=="VehicleSeat")or(parts[i].className=="CornerWedgePart")then if(prev~=nil)then local weld=Instance.new("Weld") weld.Name="HeadlessWeld" weld.Part0=prev weld.Part1=parts[i] weld.C0=prev.CFrame:inverse() weld.C1=parts[i].CFrame:inverse() weld.Parent=prev end prev=parts[i] end end ]===] s1.Parent = t1 x2 = Instance.new("Animation", t1) x2.Name = "ANIM_Hold" x2.AnimationId = "http://www.roblox.com/Asset?ID=105371735" x3 = Instance.new("Animation", t1) x3.Name = "ANIM_Swing" x3.AnimationId = "http://www.roblox.com/Asset?ID=94160738" s2 = script:clone() s2.Name = "HeadlessHolding" s2.Disabled = false so2 = Instance.new("StringValue", s2) so2.Name = "forCustomRunL" so2.Value = [===[ --Everything By Brutez! --Go To The Hat Section On Line: #71 For A Message... local Tool = script.Parent local Handle = Tool:WaitForChild('Handle') local Humanoid; local Character; local Equipped = false local Running = false local ANIM_Hold, ANIM_Swing; local CurrentSpeed = 20 local LastAnimate; possibleAnims = {"Lunge","Slash"} r = game:service("RunService") local slash_damage = 10 local damage = 0 local Tool = script.Parent; sword = script.Parent.Handle Tool = script.Parent local HitEnemy2 = nil function blow(Hit) local humanoid = Hit.Parent:findFirstChild("Humanoid") local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter) local hum = vCharacter:findFirstChild("Humanoid") if humanoid~=nil and humanoid ~= hum and hum ~= nil then local right_arm = vCharacter:FindFirstChild("Right Arm") if (right_arm ~= nil) then local joint = right_arm:FindFirstChild("RightGrip") if (joint ~= nil and (joint.Part0 == sword or joint.Part1 == sword)) then tagHumanoid(humanoid, vPlayer) humanoid:TakeDamage(damage) if Hit then if humanoid.Parent == Hit.Parent then if Hit.Name ~= "Torso" then Hit:BreakJoints() Hit.CanCollide = true end Hit = nil end end Wait() untagHumanoid(humanoid) end end end end function tagHumanoid(humanoid,player) local creator_tag = Instance.new("ObjectValue") creator_tag.Value = player creator_tag.Name = "creator" print ("Made by youngwarlock") creator_tag.Parent = humanoid end function untagHumanoid(humanoid) if humanoid ~= nil then local tag = humanoid:findFirstChild("creator") if tag ~= nil then tag.Parent = nil end end end function attack() damage = slash_damage end Tool.Equipped:connect(function(mouse) Equipped = true Character = Tool.Parent Character.Humanoid.WalkSpeed = 20 Humanoid = Character:WaitForChild('Humanoid') ANIM_Hold = Humanoid:LoadAnimation(Tool:WaitForChild('ANIM_Hold')) ANIM_Hold:Play(0,0.95,0.5) Running = false print("If Adding Hat, Remove the --[[ And The ]],CATIOUN: It Will Spawn Mutiple Hats,If you Can Make It Create One,That Would Be Great. Good Luck.") print("If You Removed The Things Above In Line 71's Print, Go To Line: 125 And Remove The -- To Enable The Hat To Be Removed When You Unequip.") --[[HorselessHeadsMan = Instance.new("Hat") TheHandle = Instance.new("Part") HorselessHeadsMan.Name = "Horseless Headless Horsemann's Head" TheHandle.Parent = HorselessHeadsMan TheHandle.Position = Character:findFirstChild("Head").Position TheHandle.Name = "Handle" TheHandle.formFactor = "Custom" TheHandle.Size = Vector3.new(2.59, 1.8, 2.47) TheHandle.BottomSurface = 0 TheHandle.TopSurface = 0 TheHandle.Locked = true script.Mesh:clone().Parent = TheHandle HorselessHeadsMan.Parent = Character HorselessHeadsMan.AttachmentForward = Vector3.new(0, 0, -1) HorselessHeadsMan.AttachmentPos = Vector3.new(0, 0.3, 0) HorselessHeadsMan.AttachmentRight = Vector3.new(1, 0, 0) HorselessHeadsMan.AttachmentUp = Vector3.new(0, 1, 0) ]] ANIM_Swing = Humanoid:LoadAnimation(Tool:WaitForChild('ANIM_Swing')) Tool.Activated:connect(function() if not Tool.Enabled then return end Tool.Enabled = false enabled = false Tool.GripRight = Vector3.new(-0.756, 0, 0.2) local humanoid = Tool.Parent:FindFirstChild("Humanoid") local torso = Tool.Parent:FindFirstChild("Torso") if humanoid == nil then print("There Is Somthing Wrong With Your, Humanoid...") return end if Running then return end Running = true ANIM_Swing:Play(0,1,1) attack() wait(0.5) Handle.Miss:Play() Wait(0.4) ANIM_Swing:Stop() enabled = true Tool.Enabled = true Tool.GripRight = Vector3.new(-0.756, 0, 0.655) Running = false end) while Equipped do wait() end end) Tool.Unequipped:connect(function() Equipped = false Character.Humanoid.WalkSpeed = 16 --Character.HorselessHeadsMan:remove() if ANIM_Swing then ANIM_Swing:Stop() ANIM_Hold:Stop() end end) connection = sword.Touched:connect(blow) ]===] s2.Parent = t1 w1 = Instance.new("Weld", p1) w1.Name = "HeadlessWeld" w1.Part0 = p1 w1.C0 = CFrame.new(-10.5510445, 31.6008873, -0.781529009, 0.998755872, 0.000239664063, -0.0498662777, -0.0498659462, -0.00124010642, -0.998755157, -0.000301206223, 0.999999166, -0.00122659793) w1.Part1 = p2 w1.C1 = CFrame.new(-10.5511217, 27.7365246, -0.777456999, 0.998756289, 0.000239249319, -0.0498581976, -0.0498578697, -0.00122833252, -0.998755574, -0.000300195068, 0.999999166, -0.00121486187) w2 = Instance.new("Weld", p2) w2.Name = "HeadlessWeld" w2.Part0 = p2 w2.C0 = CFrame.new(-10.5511217, 27.7365246, -0.777456999, 0.998756289, 0.000239249319, -0.0498581976, -0.0498578697, -0.00122833252, -0.998755574, -0.000300195068, 0.999999166, -0.00121486187) w2.Part1 = p3 w2.C1 = CFrame.new(-10.5512753, 27.1460075, -1.53167939, 0.99876374, 0.00023943324, -0.0498650223, -0.0498589613, -0.00123730476, -0.998756707, -0.000300984917, 1.00000417, -0.00121590274) m.Parent = game:service("Workspace") m:MakeJoints()
-- User story: https://github.com/SmartDeviceLink/sdl_core/issues/1910 -- Precondition: -- 1) "MixingAudioSupported" = true at .ini file. -- 2) SDL and HMI are started. -- 3) Navigation app is registered. -- Description: -- Navigation app must get BACKGROUND and NOT_AUDIBLE in case embedded audio source is activated and "MixingAudioSupported" = true -- Steps to reproduce: -- 1) Navigation app in FULL or LIMITED and AUDIBLE and SDL receives OnEventChanged (AUDIO_SOURCE, isActive=true) from HMI. -- Expected result: -- SDL must send OnHMIStatus (BACKGROUND, NOT_AUDIBLE) to mobile app. -- Actual result: -- SDL does not set required HMILevel and audioStreamingState. --------------------------------------------------------------------------------------------------- --[[ Required Shared libraries ]] local runner = require('user_modules/script_runner') local common = require("user_modules/sequences/actions") local hmi_values = require('user_modules/hmi_values') local commonFunctions = require("user_modules/shared_testcases/commonFunctions") local utils = require("user_modules/utils") local test = require("user_modules/dummy_connecttest") --[[ Test Configuration ]] runner.testSettings.isSelfIncluded = false config.application1.registerAppInterfaceParams.appHMIType = { "NAVIGATION" } config.application1.registerAppInterfaceParams.isMediaApplication = false --[[ Local Functions ]] local function getHMIValues() local params = hmi_values.getDefaultHMITable() params.BasicCommunication.MixingAudioSupported.attenuatedSupported = true return params end local function activateApp() local cid = common.getHMIConnection():SendRequest("SDL.ActivateApp", { appID = common.getHMIAppId() }) common.getHMIConnection():ExpectResponse(cid) common.getMobileSession():ExpectNotification("OnHMIStatus", { hmiLevel = "FULL", audioStreamingState = "AUDIBLE", systemContext = "MAIN" }) end local function onEventChange() common.getHMIConnection():SendNotification("BasicCommunication.OnEventChanged", { eventName = "AUDIO_SOURCE", isActive = true }) common.getMobileSession():ExpectNotification("OnHMIStatus", { hmiLevel = "LIMITED", audioStreamingState = "AUDIBLE"}) end --[[ Scenario ]] runner.Title("Preconditions") runner.Step("Clean environment", common.preconditions) runner.Step("Set MixingAudioSupported=true in ini file", common.setSDLIniParameter, { "MixingAudioSupported", "true" }) runner.Step("Start SDL, HMI, connect Mobile, start Session", common.start, { getHMIValues() }) runner.Step("RAI", common.registerApp) runner.Step("Activate App FULL", activateApp) runner.Title("Test") runner.Step("OnEventChanged AUDIO_SOURCE true", onEventChange) runner.Title("Postconditions") runner.Step("Stop SDL", common.postconditions)
do --- coverage local eq = false local t, u = {}, {} local x, ax, bx local function ck(xx, a, b) if x ~= xx then error("bad x", 2) end if ax ~= a then error("bad ax", 2) end if bx ~= b then error("bad bx", 2) end end local mt = { __eq = function(a, b) ax=a; bx=b; return eq end, } t = setmetatable(t, mt) u = setmetatable(u, mt) eq = false x = 0; for i=1,100 do x = t == u and 2 or 1 end ck(1, t, u) x = 0; for i=1,100 do x = t ~= u and 2 or 1 end ck(2, t, u) x = 0; for i=1,100 do x = not (t == u) and 2 or 1 end ck(2, t, u) x = 0; for i=1,100 do x = not (t ~= u) and 2 or 1 end ck(1, t, u) eq = true x = 0; for i=1,100 do x = t == u and 2 or 1 end ck(2, t, u) x = 0; for i=1,100 do x = t ~= u and 2 or 1 end ck(1, t, u) x = 0; for i=1,100 do x = not (t == u) and 2 or 1 end ck(1, t, u) x = 0; for i=1,100 do x = not (t ~= u) and 2 or 1 end ck(2, t, u) end do --- non-constant objects +bit local bit = require("bit") local mt = { __eq = function(a, b) return true end } local tt = { [0] = setmetatable({}, mt), setmetatable({}, mt) } for i=0,100 do assert(tt[0] == tt[bit.band(i, 1)]) end end
-- Pane3 displays a list of HighScores for the stepchart that was played. local player, side = unpack(...) local mods = SL[ToEnumShortString(player)].ActiveModifiers -- No records in DoNotJudgeMe mode. if mods.DoNotJudgeMe then return end local pane = Def.ActorFrame{ InitCommand=function(self) self:y(_screen.cy - 53):zoom(0.65) end } -- ----------------------------------------------------------------------- local pss = STATSMAN:GetCurStageStats():GetPlayerStageStats(player) local NumHighScores = math.min(9, PREFSMAN:GetPreference("MaxHighScoresPerListForMachine")) local HighScoreIndex = { -- Machine HighScoreIndex will always be -1 in EventMode and is effectively useless there Machine = pss:GetMachineHighScoreIndex(), Personal = pss:GetPersonalHighScoreIndex() } -- ----------------------------------------------------------------------- -- custom logic to (try to) assess if a MachineHighScore was achieved when in EventMode local SongOrCourse = GAMESTATE:IsCourseMode() and GAMESTATE:GetCurrentCourse() or GAMESTATE:GetCurrentSong() local StepsOrTrail = GAMESTATE:IsCourseMode() and GAMESTATE:GetCurrentTrail(player) or GAMESTATE:GetCurrentSteps(player) local MachineHighScores = PROFILEMAN:GetMachineProfile():GetHighScoreList(SongOrCourse,StepsOrTrail):GetHighScores() local EarnedMachineHighScoreInEventMode = function() -- if no DancePoints were earned, it's not a HighScore if pss:GetPercentDancePoints() <= 0.01 then return false end -- If a MachineHighScore has been earned, there will be 1 or more machine high scores at this point. -- There may be 0 machine high scores if the score just earned by a player was not a pass. if #MachineHighScores < 1 then return false end -- otherwise, check if this score is better than the worst current HighScore retrieved from MachineProfile return pss:GetHighScore():GetPercentDP() >= MachineHighScores[math.min(NumHighScores, #MachineHighScores)]:GetPercentDP() end -- ----------------------------------------------------------------------- local EarnedMachineRecord = GAMESTATE:IsEventMode() and EarnedMachineHighScoreInEventMode() or HighScoreIndex.Machine >= 0 local EarnedTop2Personal = (HighScoreIndex.Personal >= 0 and HighScoreIndex.Personal < 3) -- ----------------------------------------------------------------------- -- Novice players frequently improve their own score while struggling to -- break into an overall leaderboard. The lack of *visible* leaderboard -- progress can be frustrating/demoralizing, so let's do what we can to -- alleviate that. -- -- If this score is not high enough to be a machine record, but it *is* -- good enough to be a top-2 personal record, show two HighScore lists: -- 1-8 machine HighScores, then 1-2 personal HighScores -- -- If the player isn't using a profile (local or USB), there won't be any -- personal HighScores to compare against. -- -- Also, this 5+3 shouldn't show up on privately owned machines where only -- one person plays, which is a common scenario in 2020. -- -- This idea of showing both machine and personal HighScores to help new players -- track progress is based on my experiences maintaining a heavily-used -- public SM5 machine for several years while away at school. -- 20px RowHeight by default, which works for displaying 5 machine HighScores local args = { Player=player, RoundsAgo=1, RowHeight=20} if (not EarnedMachineRecord and EarnedTop2Personal) then -- top 5 machine HighScores numHighScores = 5 args.NumHighScores = numHighScores pane[#pane+1] = LoadActor(THEME:GetPathB("", "_modules/HighScoreList.lua"), args) -- horizontal line visually separating machine HighScores from player HighScores pane[#pane+1] = Def.Quad{ InitCommand=function(self) self:zoomto(100, 1):y(args.RowHeight*(numHighScores+1)):diffuse(1,1,1,0.33) end } -- top 3 player HighScores args.NumHighScores = 3 args.Profile = PROFILEMAN:GetProfile(player) pane[#pane+1] = LoadActor(THEME:GetPathB("", "_modules/HighScoreList.lua"), args)..{ InitCommand=function(self) self:y(args.RowHeight*(numHighScores+1)) end } -- the player did not meet the conditions to show the 5+3 HighScores -- just show top 9 machine HighScores else -- top 9 machine HighScores args.NumHighScores = 9 pane[#pane+1] = LoadActor(THEME:GetPathB("", "_modules/HighScoreList.lua"), args) end return pane
----------------------------------------------------------------------------- -- Xavante Orbit pages handler -- -- Author: Fabio Mascarenhas -- ----------------------------------------------------------------------------- require "wsapi.xavante" require "wsapi.common" module ("orbit.ophandler", package.seeall) ------------------------------------------------------------------------------- -- Returns the Orbit Pages handler ------------------------------------------------------------------------------- function makeHandler (diskpath, params) params = setmetatable({ modname = params.modname or "orbit.pages" }, { __index = params or {} }) local op_loader = wsapi.common.make_isolated_launcher(params) return wsapi.xavante.makeHandler(op_loader, nil, diskpath) end
#!src/lua -- LLL - Lua Low Level -- September, 2015 -- Author: Gabriel de Quadros Ligneul -- Copyright Notice for LLL: see lllcore.h -- -- test_table.lua local create = function() return {} end assert(lll.compile(create)) local get = function(t, k) return t[k] end assert(lll.compile(get)) local set = function(t, k, v) t[k] = v end assert(lll.compile(set)) local t = create(); assert(type(t) == 'table' and next(t) == nil) set(t, 'a', 123) assert(t.a == 123 and get(t, 'a') == 123) set(t, 123, 'test') assert(t[123] == 'test' and get(t, 123) == 'test') set(t, 'a', nil) assert(t.a == nil and get(t, 'a') == nil) local setk = function(t) t.k = 357 end assert(lll.compile(setk)) local getk = function(t) return t.k end assert(lll.compile(getk)) setk(t) assert(t.k == 357 and getk(t) == 357) t.k = nil assert(getk(t) == nil)
--[[ © 2015 CloudSixteen.com do not share, re-distribute or modify without permission of its author (kurozael@gmail.com). Clockwork was created by Conna Wiles (also known as kurozael.) http://cloudsixteen.com/license/clockwork.html --]] CW_SPANISH = Clockwork.lang:GetTable("Spanish"); CW_SPANISH["StaminaRegenerationScale"] = "Escala regeneración estamina"; CW_SPANISH["StaminaRegenerationScaleDesc"] = "Determina la velocidad a la que se regenera la estamina."; CW_SPANISH["StaminaDrainScale"] = "Escala uso estamina"; CW_SPANISH["StaminaDrainScaleDesc"] = "Determina la cantidad de estamina que se gastará al realizar acciones que consuman esta."; CW_SPANISH["BreathingVolume"] = "Volumen respiración"; CW_SPANISH["BreathingVolumeDesc"] = "El volumen de la respiración que escuchará el jugador cuando su personaje esté cansado.";
-- English localization file for French (frFR) local AceLocale = LibStub:GetLibrary("AceLocale-3.0"); local L = AceLocale:NewLocale("ElvUI", "frFR"); if not L then return; end L["Ancient Mana"] = "Mana Ancestral" L["Apexis Crystal"] = "Cristal apogide" L["Arakkoa Archaeology Fragment"] = "Fragment d’archéologie arakkoa" L["Arch"] = "Archéologie" L["Artifact Fragment"] = "Fragment d’artéfact" L["AskReloadNow"] = "Recharger votre interface utilisateur maintenant?" L["Bloody Coin"] = "Pièce sanglante" L["Brawler's Gold"] = "Or des Bastonneurs" L["Cancel"] = "Annuler" L["Cata"] = "Cataclysm" L["Champion's Seal"] = "Sceau de champion" L["Conquest Points"] = "Points de conquête" L["Curious Coin"] = "Pièce Curieuse" L["Currencies"] = "Devises" L["D&R"] = "Donjons & Raids" L["Dalaran Jewelcrafter's Token"] = "Marque de joaillerie de Dalaran" L["Darkmoon Prize Ticket"] = "Bon(s) pour un prix de Sombrelune" L["Dingy Iron Coins"] = "Pièces de fer ternies" L["Draenei Archaeology Fragment"] = "Fragment d'archéologie draeneï" L["Draenor Clans Archaeology Fragment"] = "Fragment d’archéologie des clans de Draenor" L["Dwarf Archaeology Fragment"] = "Fragment archéologique nain" L["Echoes of Battle"] = "Échos de bataille" L["Echoes of Domination"] = "Échos de Domination" L["Elder Charm of Good Fortune"] = "Breloque ancienne de bonne fortune" L["Epicurean's Award"] = "Récompense de l’épicurien" L["Essence of Corrupted Deathwing"] = "Essence d’Aile de mort corrompu" L["Felessence"] = "Essence Gangrenée" L["Fossil Archaeology Fragment"] = "Fragment archéologique fossile" L["Garrison Resources"] = "Ressources de fief" L["Hide TT"] = "Gardez infobulle caché" L["Honor Points"] = "Points d'honneur" L["Illustrious Jewelcrafter's Token"] = "Marque de l'illustre joaillier" L["Ironpaw Token"] = "Marque de Patte de Fer" L["leftM"] = "Click gauche" L["Legion"] = "Légion" L["Legionfall War Supplies"] = "Fournitures de Guerre dun Déclin" L["Lesser Charm of Good Fortune"] = "Breloque de bonne fortune inférieure" L["loginmsg"] = "%sElvUI|r Devises %sTextes d'Informations%s: version %s%s|r chargée. Cliquez-droit sur les textes d'Informations pour les options." L["Mantid Archaeology Fragment"] = "Fragment d'archéologie mantide" L["Mark of the World Tree"] = "Marque de l'Arbre-Monde" L["menu header"] = "ElvUI Currencies Datatext Options" L["middleM"] = "Moyen Cliquez" L["Misc"] = "Divers" L["Mogu Archaeology Fragment"] = "Fragment d'archéologie mogu" L["Mogu Rune of Fate"] = "Rune du destin mogu" L["MoP"] = "Mists of Pandaria" L["Mote of Darkness"] = "Granule de ténèbres" L["Nerubian Archaeology Fragment"] = "Fragment d'archéologie nérubien" L["Nethershard"] = "Eclat de Néant" L["Night Elf Archaeology Fragment"] = "Fragment archéologique elfe de la nuit" L["Ogre Archaeology Fragment"] = "Fragment d’archéologie ogre" L["Oil"] = "Carburant" L["Okay"] = "OK" L["options"] = "Ouvre Textes d'informations Menu d'Options" L["Orc Archaeology Fragment"] = "Fragment d'archéologie orc" L["Order Resources"] = "Ressources de domaine" L["Pandaren Archaeology Fragment"] = "Fragment d'archéologie pandarène" L["PvP"] = "Joueur contre Joueur" L["reloadui"] = "Reload UI" L["reset"] = "Réinitialiser Devises Textes d'informations" L["ResetConfirm"] = "Etes-vous sûr que vous souhaitez réinitialiser les paramètres Devises?" L["rightM"] = "Clic-droit" L["Seal of Broken Fate"] = "Sceau du Destin Brisé" L["Seal of Inevitable Fate"] = "Sceau du destin inévitable" L["Seal of Tempered Fate"] = "Sceau du destin trempé" L["Shadowy Coins"] = "Pièces ténébreuses" L["Show"] = "Afficher" L["Show Arch Fragments"] = "Afficher Fragments d'Archéologie" L["Show Cata Currencies"] = "Afficher Cataclysm Devises" L["Show D&R Currencies"] = "Afficher Donjons & Raids Devises" L["Show Icons"] = "Afficher les icônes sur la barre la textes d'Informations" L["Show Legion Currencies"] = "Afficher les monnaies de la Légion" L["Show Misc Currencies"] = "Afficher Divers Devises" L["Show MoP Currencies"] = "Afficher Mists of Pandaria Devises" L["Show PvP Currencies"] = "Afficher Joueur contre Joueur Devises" L["Show WoD Currencies"] = "Afficher Draenor Devises" L["Sightless Eye"] = "Œil clos" L["Timeless Coin"] = "Pièce du Temps figé" L["Timewarped Badge"] = "Insigne distordu dans le temps" L["Timeworn Artifact"] = "Artéfact érodé" L["Tol Barad Commendation"] = "Recommandation de Tol Barad" L["Tol'vir Archaeology Fragment"] = "Fragment d'archéologie tol'vir" L["Total"] = true L["Troll Archaeology Fragment"] = "Fragment archéologique troll" L["Valor"] = "Vaillance" L["Vrykul Archaeology Fragment"] = "Fragment d'archéologie vrykul" L["Warforged Seal"] = "Sceau de guerre" L["Weekly"] = "Hebdomadaire" L["WelcomeSetupConfirm"] = "Merci d'utiliser ElvUI Devises Textes d'Informations.\n \nPour le texte de données pour fonctionner correctement, l'addon doit\neffectuer une configuration initiale, pour éviter les problèmes.\n \nCliquez sur 'OK' pour continuer.\n " -- needs review L["WoD"] = "Warlords of Draenor" L["Yes"] = "Oui"
Objects = { createObject ( 3851, 1633.1, 1787.1, 16.8 ), createObject ( 3851, 1628.6, 1797.8, 16.8 ), createObject ( 3851, 1627.5, 1792.7, 16.8, 0, 0, 90 ), createObject ( 3851, 1628.6, 1809.1, 16.8 ), createObject ( 3851, 1623, 1814.7, 16.8, 0, 0, 90 ), createObject ( 3851, 1624.3, 1813.7, 16.8 ), createObject ( 3851, 1618.8, 1822.8, 16.8, 0, 0, 90 ), createObject ( 3851, 1607.40039, 1819.2998, 16.8, 0, 0, 90 ), createObject ( 3851, 1596.1, 1819.3, 16.8, 0, 0, 90 ), createObject ( 3851, 1590.4, 1813.7, 16.8 ), createObject ( 3851, 1592.5, 1814.5, 16.8, 0, 0, 90 ), createObject ( 3851, 1586.8, 1808.9, 16.8 ), createObject ( 3851, 1586.8, 1797.6, 16.8 ), createObject ( 3851, 1587.5, 1797.7, 16.8, 0, 0, 90 ), createObject ( 3851, 1581.9, 1792.1, 16.8 ), createObject ( 3851, 1581.9, 1780.8, 16.8 ), createObject ( 3851, 1581.9, 1769.5, 16.8 ), createObject ( 3851, 1581.9, 1758.2, 16.8 ), createObject ( 3851, 1581.9, 1746.9, 16.8 ), createObject ( 3851, 1581.9, 1735.6, 16.8 ), createObject ( 3851, 1587.5, 1730, 16.8, 0, 0, 90 ), createObject ( 3851, 1589.6, 1729.2, 16.8 ), createObject ( 3851, 1595.2, 1723.6, 16.8, 0, 0, 90 ), createObject ( 3851, 1606.5, 1723.6, 16.8, 0, 0, 90 ), createObject ( 3851, 1617.8, 1723.6, 16.8, 0, 0, 90 ), createObject ( 3851, 1623.4, 1729.2, 16.8 ), createObject ( 3851, 1627.5, 1732, 16.8, 0, 0, 90 ), createObject ( 3851, 1633.1, 1775.8, 16.8 ), createObject ( 3851, 1633.1, 1764.5, 16.8 ), createObject ( 3851, 1633.1, 1753.2, 16.8 ), createObject ( 3851, 1633.1, 1741.9, 16.8 ), createObject ( 3851, 1633.1, 1737.6, 16.8 ), createObject ( 9339, 1633, 1745, 14.3, 0, 0, 180 ), createObject ( 9339, 1633, 1745, 12.9, 0, 0, 180 ), createObject ( 9339, 1633, 1745, 11.5, 0, 0, 180 ), createObject ( 9339, 1633, 1745, 10.1, 0, 0, 180 ), createObject ( 9339, 1620, 1732, 10.1, 0, 0, 90 ), createObject ( 9339, 1620, 1732, 11.5, 0, 0, 90 ), createObject ( 9339, 1620, 1732, 12.9, 0, 0, 90 ), createObject ( 9339, 1620, 1732, 14.3, 0, 0, 90 ), createObject ( 9339, 1623.4, 1736.6, 14.3, 0, 0, 180 ), createObject ( 9339, 1623.4, 1736.6, 12.9, 0, 0, 180 ), createObject ( 9339, 1623.4, 1736.6, 11.5, 0, 0, 180 ), createObject ( 9339, 1623.4, 1736.6, 10.1, 0, 0, 180 ), createObject ( 9339, 1610.3, 1723.6, 14.3, 0, 0, 90 ), createObject ( 9339, 1610.3, 1723.6, 12.9, 0, 0, 90 ), createObject ( 9339, 1610.3, 1723.6, 11.5, 0, 0, 90 ), createObject ( 9339, 1610.3, 1723.6, 10.2, 0, 0, 90 ), createObject ( 9339, 1602.6, 1723.6, 14.3, 0, 0, 90 ), createObject ( 9339, 1602.6, 1723.6, 12.9, 0, 0, 90 ), createObject ( 9339, 1602.6, 1723.6, 11.5, 0, 0, 90 ), createObject ( 9339, 1602.6, 1723.6, 10.1, 0, 0, 90 ), createObject ( 9339, 1589.7, 1736.6, 14.3 ), createObject ( 9339, 1589.7, 1736.6, 12.9 ), createObject ( 9339, 1589.7, 1736.6, 11.5 ), createObject ( 9339, 1589.7, 1736.6, 10.1 ), createObject ( 9339, 1633, 1764.4, 10.1, 0, 0, 180 ), createObject ( 9339, 1633, 1764.4, 11.5, 0, 0, 180 ), createObject ( 9339, 1633, 1764.4, 12.9, 0, 0, 180 ), createObject ( 9339, 1633, 1764.4, 14.3, 0, 0, 180 ), createObject ( 9339, 1633, 1779.7, 14.3, 0, 0, 180 ), createObject ( 9339, 1633, 1779.7, 12.9, 0, 0, 180 ), createObject ( 9339, 1633, 1779.7, 11.5, 0, 0, 180 ), createObject ( 9339, 1633, 1779.7, 10.1, 0, 0, 180 ), createObject ( 9339, 1633, 1779.7, 19.4, 0, 0, 180 ), createObject ( 9339, 1633, 1764.4, 19.4, 0, 0, 180 ), createObject ( 9339, 1633, 1745, 19.4, 0, 0, 180 ), createObject ( 9339, 1620, 1732, 19.4, 0, 0, 90 ), createObject ( 9339, 1623.3, 1736.6, 19.4, 0, 0, 180 ), createObject ( 9339, 1610.3, 1723.6, 19.4, 0, 0, 90 ), createObject ( 9339, 1602.6, 1723.6, 19.4, 0, 0, 90 ), createObject ( 9339, 1589.7, 1736.6, 19.4 ), createObject ( 9339, 1620, 1792.7, 19.4, 0, 0, 90 ), createObject ( 9339, 1620, 1792.7, 14.3, 0, 0, 90 ), createObject ( 9339, 1620, 1792.7, 12.9, 0, 0, 90 ), createObject ( 9339, 1620, 1792.7002, 11.6, 0, 0, 90 ), createObject ( 9339, 1620, 1792.7002, 10.2, 0, 0, 90 ), createObject ( 9339, 1628.6, 1801.7, 14.3, 0, 0, 180 ), createObject ( 9339, 1628.6, 1801.7, 12.9, 0, 0, 180 ), createObject ( 9339, 1628.6, 1801.7, 11.5, 0, 0, 180 ), createObject ( 9339, 1628.6, 1801.7, 10.1, 0, 0, 180 ), createObject ( 9339, 1615.6, 1814.7, 14.3, 0, 0, 90 ), createObject ( 9339, 1615.6, 1814.7, 12.9, 0, 0, 90 ), createObject ( 9339, 1615.59998, 1814.69995, 11.5, 0, 0, 90 ), createObject ( 9339, 1615.6, 1814.7, 10.1, 0, 0, 90 ), createObject ( 9339, 1624.3, 1806.3, 14.3, 0, 0, 180 ), createObject ( 9339, 1611.3, 1819.3, 14.3, 0, 0, 270 ), createObject ( 9339, 1603.4, 1819.3, 14.3, 0, 0, 270 ), createObject ( 9339, 1624.3, 1806.3, 12.9, 0, 0, 180 ), createObject ( 9339, 1624.3, 1806.3, 11.5, 0, 0, 180 ), createObject ( 9339, 1624.3, 1806.3, 10.1, 0, 0, 180 ), createObject ( 9339, 1611.2998, 1819.2998, 12.9, 0, 0, 270 ), createObject ( 9339, 1611.2998, 1819.2998, 11.5, 0, 0, 270 ), createObject ( 9339, 1611.3, 1819.3, 10.1, 0, 0, 270 ), createObject ( 9339, 1603.40002, 1819.30005, 12.9, 0, 0, 270 ), createObject ( 9339, 1603.4004, 1819.2998, 11.5, 0, 0, 270 ), createObject ( 9339, 1603.40002, 1819.30005, 10.1, 0, 0, 270 ), createObject ( 3851, 1633.1, 1737.6, 21.9 ), createObject ( 3851, 1633.1, 1741.9, 21.9 ), createObject ( 3851, 1633.1, 1753.2, 21.9 ), createObject ( 3851, 1633.1, 1764.5, 21.9 ), createObject ( 3851, 1633.1, 1775.8, 21.9 ), createObject ( 3851, 1633.1, 1787.1, 21.9 ), createObject ( 3851, 1627.5, 1792.7, 21.9, 0, 0, 90 ), createObject ( 9339, 1628.6, 1801.7, 19.4, 0, 0, 180 ), createObject ( 9339, 1615.6, 1814.7, 19.4, 0, 0, 90 ), createObject ( 9339, 1624.3, 1806.3, 19.4, 0, 0, 180 ), createObject ( 9339, 1594.9, 1730, 19.4, 0, 0, 90 ), createObject ( 9339, 1594.9, 1730, 14.3, 0, 0, 90 ), createObject ( 9339, 1594.9, 1730, 12.9, 0, 0, 90 ), createObject ( 9339, 1594.9, 1730, 11.5, 0, 0, 90 ), createObject ( 9339, 1594.9, 1730, 10.1, 0, 0, 90 ), createObject ( 3851, 1627.5, 1732, 21.9, 0, 0, 90 ), createObject ( 3851, 1623.4, 1729.2, 21.9 ), createObject ( 3851, 1617.8, 1723.6, 21.9, 0, 0, 90 ), createObject ( 3851, 1606.5, 1723.6, 21.9, 0, 0, 90 ), createObject ( 3851, 1595.2, 1723.6, 21.9, 0, 0, 90 ), createObject ( 3851, 1589.6, 1729.2, 21.9 ), createObject ( 3851, 1587.5, 1730, 21.9, 0, 0, 90 ), createObject ( 9339, 1581.9, 1743, 19.4 ), createObject ( 9339, 1581.9, 1743, 14.3 ), createObject ( 9339, 1581.9, 1743, 12.9 ), createObject ( 9339, 1581.9, 1743, 11.5 ), createObject ( 9339, 1581.9, 1743, 10.1 ), createObject ( 9339, 1603.4, 1819.3, 19.4, 0, 0, 270 ), createObject ( 9339, 1611.3, 1819.3, 19.4, 0, 0, 270 ), createObject ( 9339, 1582, 1769, 14.3 ), createObject ( 9339, 1582, 1769, 12.9 ), createObject ( 9339, 1582, 1769, 11.5 ), createObject ( 9339, 1582, 1769, 10.1 ), createObject ( 9339, 1599.8, 1814.5, 14.3, 0, 0, 270 ), createObject ( 9339, 1590.4, 1806.3, 14.3 ), createObject ( 9339, 1586.8, 1801.5, 14.3 ), createObject ( 9339, 1590.4, 1806.3, 12.9 ), createObject ( 9339, 1590.4, 1806.3, 11.5 ), createObject ( 9339, 1590.4, 1806.3, 10.1 ), createObject ( 9339, 1599.8, 1814.5, 12.9, 0, 0, 270 ), createObject ( 9339, 1599.80005, 1814.5, 11.5, 0, 0, 270 ), createObject ( 9339, 1599.8, 1814.5, 10.1, 0, 0, 270 ), createObject ( 9339, 1586.8, 1801.5, 12.9 ), createObject ( 9339, 1586.8, 1801.5, 11.5 ), createObject ( 9339, 1586.8, 1801.5, 10.1 ), createObject ( 9339, 1594.9, 1797.7, 14.3, 0, 0, 270 ), createObject ( 9339, 1594.9, 1797.7, 12.9, 0, 0, 270 ), createObject ( 9339, 1594.9, 1797.7, 11.5, 0, 0, 270 ), createObject ( 9339, 1594.9, 1797.7, 10.1, 0, 0, 270 ), createObject ( 9339, 1590.4, 1806.3, 19.4 ), createObject ( 9339, 1599.8, 1814.5, 19.4, 0, 0, 270 ), createObject ( 9339, 1586.8, 1801.5, 19.4 ), createObject ( 9339, 1594.9, 1797.7, 19.4, 0, 0, 270 ), createObject ( 3851, 1628.6, 1797.8, 21.9 ), createObject ( 3851, 1628.6, 1809.1, 21.9 ), createObject ( 3851, 1623, 1814.7, 21.9, 0, 0, 90 ), createObject ( 3851, 1624.3, 1813.7, 21.9 ), createObject ( 3851, 1618.7, 1819.3, 21.9, 0, 0, 90 ), createObject ( 3851, 1607.4, 1819.3, 21.9, 0, 0, 90 ), createObject ( 3851, 1596.1, 1819.3, 21.9, 0, 0, 90 ), createObject ( 3851, 1590.4, 1813.7, 21.9 ), createObject ( 3851, 1592.5, 1814.5, 21.9, 0, 0, 90 ), createObject ( 3851, 1586.8, 1808.9, 21.9 ), createObject ( 3851, 1586.8, 1797.6, 21.9 ), createObject ( 3851, 1587.5, 1797.7, 21.9, 0, 0, 90 ), createObject ( 9339, 1581.9, 1769.1, 19.4 ), createObject ( 9339, 1581.9, 1784.7, 19.4 ), createObject ( 9339, 1581.9, 1784.7, 14.3 ), createObject ( 9339, 1581.9, 1784.7, 12.9 ), createObject ( 9339, 1581.9, 1784.7, 11.5 ), createObject ( 9339, 1581.9, 1784.7, 10.1 ), createObject ( 9339, 1602.6, 1723.6, 24.5, 0, 0, 90 ), createObject ( 9339, 1602.6, 1723.6, 25.9, 0, 0, 90 ), createObject ( 9339, 1602.6, 1723.6, 27.3, 0, 0, 90 ), createObject ( 9339, 1602.6, 1723.6, 28.7, 0, 0, 90 ), createObject ( 9339, 1610.3, 1723.6, 24.5, 0, 0, 90 ), createObject ( 9339, 1610.3, 1723.6, 25.9, 0, 0, 90 ), createObject ( 9339, 1610.3, 1723.6, 27.3, 0, 0, 90 ), createObject ( 9339, 1610.3, 1723.6, 28.7, 0, 0, 90 ), createObject ( 9339, 1623.3, 1736.6, 24.5, 0, 0, 179.995 ), createObject ( 9339, 1623.3, 1736.6, 25.9, 0, 0, 179.995 ), createObject ( 9339, 1623.3, 1736.6, 27.3, 0, 0, 179.995 ), createObject ( 9339, 1623.3, 1736.6, 28.7, 0, 0, 179.995 ), createObject ( 9339, 1589.7, 1736.6, 24.5 ), createObject ( 9339, 1589.7, 1736.6, 25.9 ), createObject ( 9339, 1589.7, 1736.6, 27.3 ), createObject ( 9339, 1589.7, 1736.6, 28.7 ), createObject ( 8661, 1599.5, 1743.3, 29.5, 0, 0, 90 ), createObject ( 8661, 1613.6, 1743.3, 29.5, 0, 0, 90 ), createObject ( 9339, 1620, 1732, 24.5, 0, 0, 90 ), createObject ( 9339, 1620, 1732, 25.9, 0, 0, 90 ), createObject ( 9339, 1620, 1732, 27.3, 0, 0, 90 ), createObject ( 9339, 1620, 1732, 28.7, 0, 0, 90 ), createObject ( 9339, 1633, 1745, 24.5, 0, 0, 179.995 ), createObject ( 9339, 1633, 1745, 25.9, 0, 0, 179.995 ), createObject ( 9339, 1633, 1745, 27.3, 0, 0, 179.995 ), createObject ( 9339, 1633, 1745, 28.7, 0, 0, 179.995 ), createObject ( 8661, 1623.2, 1751.8, 29.5, 0, 0, 90 ), createObject ( 9339, 1594.9, 1730, 24.5, 0, 0, 90 ), createObject ( 9339, 1594.9, 1730, 25.9, 0, 0, 90 ), createObject ( 9339, 1594.9, 1730, 27.3, 0, 0, 90 ), createObject ( 9339, 1594.9, 1730, 28.7, 0, 0, 90 ), createObject ( 3851, 1581.9, 1735.6, 22 ), createObject ( 9339, 1581.9, 1743, 24.5 ), createObject ( 3851, 1581.9, 1746.9, 22 ), createObject ( 3851, 1581.9, 1758.2, 22 ), createObject ( 3851, 1581.9, 1769.5, 22 ), createObject ( 3851, 1581.9, 1780.8, 22 ), createObject ( 3851, 1581.9, 1792.1, 22 ), createObject ( 9339, 1581.9, 1769.1, 24.5 ), createObject ( 9339, 1581.9, 1784.7, 24.5 ), createObject ( 9339, 1594.9, 1797.7, 24.5, 0, 0, 270 ), createObject ( 9339, 1586.8, 1801.5, 24.5 ), createObject ( 9339, 1599.8, 1814.5, 24.5, 0, 0, 270 ), createObject ( 9339, 1599.8, 1814.5, 25.9, 0, 0, 270 ), createObject ( 9339, 1581.9, 1743, 25.9 ), createObject ( 9339, 1581.9, 1743, 27.3 ), createObject ( 9339, 1581.9, 1743, 28.7 ), createObject ( 9339, 1581.9, 1769.1, 25.9 ), createObject ( 9339, 1581.9, 1769.1, 27.3 ), createObject ( 9339, 1581.9, 1769.1, 28.7 ), createObject ( 9339, 1581.9, 1784.7, 25.9 ), createObject ( 9339, 1581.9, 1784.7, 27.3 ), createObject ( 9339, 1581.9, 1784.7, 28.7 ), createObject ( 9339, 1594.9, 1797.7, 25.9, 0, 0, 270 ), createObject ( 9339, 1594.9, 1797.7, 27.3, 0, 0, 270 ), createObject ( 9339, 1594.9, 1797.7, 28.7, 0, 0, 270 ), createObject ( 9339, 1586.8, 1801.5, 25.9 ), createObject ( 9339, 1586.8, 1801.5, 27.3 ), createObject ( 9339, 1586.8, 1801.5, 28.7 ), createObject ( 9339, 1599.8, 1814.5, 27.3, 0, 0, 270 ), createObject ( 9339, 1599.8, 1814.5, 28.7, 0, 0, 270 ), createObject ( 9339, 1590.4, 1806.3, 24.5 ), createObject ( 9339, 1590.4, 1806.3, 25.9 ), createObject ( 9339, 1590.4, 1806.3, 27.3 ), createObject ( 9339, 1590.4, 1806.3, 28.7 ), createObject ( 9339, 1603.4, 1819.3, 24.5, 0, 0, 270 ), createObject ( 9339, 1603.4, 1819.3, 25.9, 0, 0, 270 ), createObject ( 9339, 1603.4, 1819.3, 27.3, 0, 0, 270 ), createObject ( 9339, 1603.4, 1819.3, 28.7, 0, 0, 270 ), createObject ( 9339, 1611.3, 1819.3, 24.5, 0, 0, 270 ), createObject ( 9339, 1611.3, 1819.3, 25.9, 0, 0, 270 ), createObject ( 9339, 1611.3, 1819.3, 27.3, 0, 0, 270 ), createObject ( 9339, 1611.3, 1819.3, 28.7, 0, 0, 270 ), createObject ( 9339, 1624.3, 1806.3, 24.5, 0, 0, 179.995 ), createObject ( 9339, 1624.3, 1806.3, 25.9, 0, 0, 179.995 ), createObject ( 9339, 1624.3, 1806.3, 27.3, 0, 0, 179.995 ), createObject ( 9339, 1624.3, 1806.3, 28.7, 0, 0, 179.995 ), createObject ( 9339, 1615.6, 1814.7, 24.5, 0, 0, 90 ), createObject ( 9339, 1615.6, 1814.7, 25.9, 0, 0, 90 ), createObject ( 9339, 1615.6, 1814.7, 27.3, 0, 0, 90 ), createObject ( 9339, 1615.6, 1814.7, 28.7, 0, 0, 90 ), createObject ( 9339, 1628.6, 1801.7, 24.5, 0, 0, 180 ), createObject ( 9339, 1628.6, 1801.7, 25.9, 0, 0, 180 ), createObject ( 9339, 1628.6, 1801.7, 27.3, 0, 0, 180 ), createObject ( 9339, 1628.6, 1801.7, 28.7, 0, 0, 180 ), createObject ( 9339, 1633, 1779.7, 24.5, 0, 0, 179.995 ), createObject ( 9339, 1633, 1764.4, 24.5, 0, 0, 179.995 ), createObject ( 9339, 1633, 1764.4, 25.9, 0, 0, 179.995 ), createObject ( 9339, 1633, 1764.4, 27.3, 0, 0, 179.995 ), createObject ( 9339, 1633, 1764.4, 28.7, 0, 0, 179.995 ), createObject ( 9339, 1633, 1779.7, 25.9, 0, 0, 179.995 ), createObject ( 9339, 1633, 1779.7, 27.3, 0, 0, 179.995 ), createObject ( 9339, 1633, 1779.7, 28.7, 0, 0, 179.995 ), createObject ( 9339, 1620, 1792.7, 24.5, 0, 0, 90 ), createObject ( 9339, 1620, 1792.7, 25.9, 0, 0, 90 ), createObject ( 9339, 1620, 1792.7, 27.3, 0, 0, 90 ), createObject ( 9339, 1620, 1792.7, 28.7, 0, 0, 90 ), createObject ( 8661, 1623.2002, 1772.7998, 29.5, 0, 0, 90 ), createObject ( 8661, 1591.7, 1749.8, 29.5, 0, 0, 90 ), createObject ( 8661, 1591.7, 1777.9, 29.5, 0, 0, 90 ), createObject ( 8661, 1618.7, 1794.8, 29.5, 0, 0, 90 ), createObject ( 8661, 1596.6, 1794.7, 29.5, 0, 0, 90 ), createObject ( 8661, 1614.5, 1799.5, 29.5, 0, 0, 90 ), createObject ( 8661, 1600.3, 1799.5, 29.5, 0, 0, 90 ), createObject ( 8661, 1606.5, 1762.2, 29.5, 0, 0, 90 ), createObject ( 9339, 1595.4, 1771.7, 32 ), createObject ( 8661, 1623.1, 1772.8, 13.5, 0, 0, 90 ), createObject ( 16501, 1629.3, 1785.8, 18.4, 0, 0, 90 ), createObject ( 16501, 1629.3, 1785.8, 22.8, 0, 0, 90 ), createObject ( 16501, 1629.3, 1785.8, 27.2, 0, 0, 90 ), createObject ( 16501, 1629.3, 1785.8, 14, 0, 0, 90 ), createObject ( 16501, 1602.5, 1815.7, 14 ), createObject ( 16501, 1622.2, 1785.8, 18.4, 0, 0, 90 ), createObject ( 8661, 1609.8, 1799.3, 15, 0, 0, 90 ), createObject ( 16501, 1614.7, 1815.7, 14, 0, 0, 180 ), createObject ( 16501, 1614.7, 1815.7, 18.4, 0, 0, 179.995 ), createObject ( 16501, 1602.5, 1815.7, 18.4 ), createObject ( 8661, 1609.8, 1799.3, 18.7, 0, 0, 90 ), createObject ( 16501, 1602.5, 1808.6, 14 ), createObject ( 16501, 1602.5, 1808.6, 18.4 ), createObject ( 16501, 1614.7, 1808.6, 14, 0, 0, 179.995 ), createObject ( 16501, 1614.7, 1808.6, 18.4, 0, 0, 179.995 ), createObject ( 16501, 1607.5, 1811.5, 14 ), createObject ( 16501, 1603.9, 1814.4, 14, 0, 0, 270 ), createObject ( 16501, 1604, 1814.9, 14, 0, 0, 270 ), createObject ( 16501, 1607.5, 1811.5, 18.4 ), createObject ( 16501, 1606, 1805, 14, 0, 0, 270 ), createObject ( 16501, 1606, 1805, 18.4, 0, 0, 270 ), createObject ( 16501, 1613.1, 1806.3, 14, 0, 0, 270 ), createObject ( 16501, 1613.1, 1806.3, 18.4, 0, 0, 270 ), createObject ( 3851, 1601.8, 1814.4, 16.8, 0, 0, 90 ), createObject ( 3851, 1601.8, 1814.9, 16.8, 0, 0, 90 ), createObject ( 16501, 1613, 1814.8, 14, 0, 0, 270 ), createObject ( 16501, 1613, 1814.8, 18.4, 0, 0, 270 ), createObject ( 16501, 1609.5, 1811.4, 14 ), createObject ( 16501, 1609.5, 1811.4, 19.3 ), createObject ( 16501, 1607.5, 1802.9, 15.3 ), createObject ( 1569, 1602.6, 1817.1, 15, 0, 0, 90 ), createObject ( 16501, 1607.5, 1804.4, 19.7 ), createObject ( 1502, 1607.5, 1806.4, 15, 0, 0, 90 ), createObject ( 1502, 1609.5, 1806.3, 15, 0, 0, 90 ), createObject ( 16501, 1609.5, 1804.4, 19.7 ), createObject ( 16501, 1609.5, 1802.8, 15.3 ), createObject ( 1692, 1596, 1814.9, 30.3 ), createObject ( 1692, 1617.8, 1815, 30.3 ), createObject ( 1649, 1609.5, 1810.1, 16.7, 0, 0, 90 ), createObject ( 1649, 1609.5, 1812.6, 16.7, 0, 0, 90 ), createObject ( 3459, 1607.5, 1808, 19.5, 0, 0, 270 ), createObject ( 3459, 1607.5, 1806.3, 19.5, 0, 0, 290.5 ), createObject ( 3459, 1609.5, 1806.3, 19.5, 0, 0, 270 ), createObject ( 3459, 1609.5, 1807.9, 19.5, 0, 0, 270 ), createObject ( 3459, 1609.5, 1814.9, 19.5, 0, 0, 270 ), createObject ( 3459, 1607.5, 1815, 19.5, 0, 0, 270 ), createObject ( 3459, 1602.6, 1815, 19.5, 0, 0, 270 ), createObject ( 3459, 1614.5, 1815, 19.5, 0, 0, 270 ), createObject ( 3459, 1614.5, 1814.6, 19.5, 0, 0, 270 ), createObject ( 3459, 1609.6, 1814.7, 19.5, 0, 0, 270 ), createObject ( 3459, 1614.5, 1805.1, 19.5, 0, 0, 270 ), createObject ( 3459, 1609.6, 1805, 19.5, 0, 0, 270 ), createObject ( 3459, 1609.4, 1805.1, 19.5, 0, 0, 300 ), createObject ( 3459, 1607.6, 1805.1, 19.5, 0, 0, 65.998 ), createObject ( 3459, 1607.5, 1805.1, 19.5, 0, 0, 65.995 ), createObject ( 3459, 1602.7, 1805.1, 19.5, 0, 0, 65.995 ), createObject ( 3459, 1602.7, 1814.2, 19.5, 0, 0, 65.995 ), createObject ( 3459, 1607.4, 1814.3, 19.5, 0, 0, 65.995 ), createObject ( 8674, 1609.1, 1806.3, 16.5, 0, 90, 0 ), } for index, object in ipairs ( Objects ) do setElementDoubleSided ( object, true ) setObjectBreakable(object,false) setElementDimension ( object, 2000 ) end
local snips = {} snips = { s( { trig = 'M', name = 'Module decl.', dscr = 'Declare a lua module' }, { t { 'local M = {}', '', '\t' }, i(0), t { '', '', 'return M' } }, { condition = conds.line_begin } ), s( { trig = 'lreq', name = 'local require', dscr = 'Require module as a variable' }, { t 'local ', dl(2, l._1:match '%.([%w_]+)$', { 1 }), t ' = require("', i(1), t '")' }, { condition = conds.line_begin } ), s( { trig = 'lf', name = 'table function', dscr = 'table function' }, { t 'local ', i(1), t ' = function(', i(2), t { ')', '\t' }, i(0), t { '', 'end' } }, { condition = conds.line_begin } ), } return snips
--Dx Functions local dxDrawLine = dxDrawLine local dxDrawImage = dxDrawImageExt local dxDrawImageSection = dxDrawImageSectionExt local dxDrawText = dxDrawText local dxGetFontHeight = dxGetFontHeight local dxDrawRectangle = dxDrawRectangle local dxSetShaderValue = dxSetShaderValue local dxGetPixelsSize = dxGetPixelsSize local dxGetPixelColor = dxGetPixelColor local dxSetRenderTarget = dxSetRenderTarget local dxGetTextWidth = dxGetTextWidth local dxSetBlendMode = dxSetBlendMode -- local getScreenFromWorldPosition = getScreenFromWorldPosition local assert = assert local type = type function dgsCreate3DText(x,y,z,text,color,font,sizeX,sizeY,maxDistance,colorcoded) local xCheck,yCheck,zCheck = type(x) == "number",type(y) == "number",type(z) == "number" if not xCheck then assert(false,"Bad argument @dgsCreate3DText at argument 1, expect a number got "..type(x)) end if not yCheck then assert(false,"Bad argument @dgsCreate3DText at argument 2, expect a number got "..type(y)) end if not zCheck then assert(false,"Bad argument @dgsCreate3DText at argument 3, expect a number got "..type(z)) end local text3d = createElement("dgs-dx3dtext") table.insert(dx3DTextTable,text3d) dgsSetType(text3d,"dgs-dx3dtext") dgsElementData[text3d] = { renderBuffer = {}, position = {x,y,z}, textSize = {sizeX or 1,sizeY or 1}, fixTextSize = false, font = font or styleSettings.text3D.font or systemFont, color = color or 0xFFFFFFFF, colorcoded = colorcoded or false, maxDistance = maxDistance or 80, fadeDistance = maxDistance or 80, dimension = -1, interior = -1, canBeBlocked = false, subPixelPositioning = true, } dgsAttachToTranslation(text3d,resourceTranslation[sourceResource or getThisResource()]) if type(text) == "table" then dgsElementData[text3d]._translationText = text dgsSetData(text3d,"text",text) else dgsSetData(text3d,"text",tostring(text)) end triggerEvent("onDgsCreate",text3d,sourceResource) return text3d end function dgs3DTextGetDimension(text) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextGetDimension at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) return dgsElementData[text].dimension or -1 end function dgs3DTextSetDimension(text,dimension) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextSetDimension at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) assert(type(dimension) == "number","Bad argument @dgs3DTextSetDimension at argument 2, expect a number got "..type(dimension)) assert(dimension >= -1 and dimension <= 65535,"Bad argument @dgs3DTextSetDimension at argument 2, out of range [0~65535] got "..dimension) return dgsSetData(text,"dimension",dimension-dimension%1) end function dgs3DTextGetInterior(text) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextGetInterior at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) return dgsElementData[text].interior or -1 end function dgs3DTextSetInterior(text,interior) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextSetInterior at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) assert(type(interior) == "number","Bad argument @dgs3DTextSetInterior at argument 2, expect a number got "..type(interior)) assert(interior >= -1,"Bad argument @dgs3DTextSetInterior at argument 2, out of range [ -1 ~ +∞ ] got "..interior) return dgsSetData(text,"interior",interior-interior%1) end function dgs3DTextAttachToElement(text,element,offX,offY,offZ) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextAttachToElement at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) assert(isElement(element),"Bad argument @dgs3DTextAttachToElement at argument 2, expect an element got "..dgsGetType(element)) local offX,offY,offZ = offX or 0,offY or 0,offZ or 0 return dgsSetData(text,"attachTo",{element,offX,offY,offZ}) end function dgs3DTextIsAttached(text) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextIsAttached at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) return dgsElementData[text].attachTo end function dgs3DTextDetachFromElement(text) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextDetachFromElement at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) return dgsSetData(text,"attachTo",false) end function dgs3DTextSetAttachedOffsets(text,offX,offY,offZ) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextSetAttachedOffsets at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) local attachTable = dgsElementData[text].attachTo if attachTable then local offX,offY,offZ = offX or attachTable[2],offY or attachTable[3],offZ or attachTable[4] return dgsSetData(text,"attachTo",{attachTable[1],offX,offY,offZ}) end return false end function dgs3DTextGetAttachedOffsets(text,offX,offY,offZ) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextGetAttachedOffsets at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) local attachTable = dgsElementData[text].attachTo if attachTable then local offX,offY,offZ = attachTable[2],attachTable[3],attachTable[4] return offX,offY,offZ end return false end function dgs3DTextSetPosition(text,x,y,z) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextSetPosition at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) assert(type(x) == "number","Bad argument @dgs3DTextSetPosition at argument 2, expect a number got "..type(x)) assert(type(y) == "number","Bad argument @dgs3DTextSetPosition at argument 3, expect a number got "..type(y)) assert(type(z) == "number","Bad argument @dgs3DTextSetPosition at argument 4, expect a number got "..type(z)) return dgsSetData(text,"position",{x,y,z}) end function dgs3DTextGetPosition(text) assert(dgsGetType(text) == "dgs-dx3dtext","Bad argument @dgs3DTextGetPosition at argument 1, expect a dgs-dx3dtext got "..dgsGetType(text)) local pos = dgsElementData[text].position return pos[1],pos[2],pos[3] end ---------------------------------------------------------------- --------------------------Renderer------------------------------ ---------------------------------------------------------------- local g_canBeBlocked = { checkBuildings = true, checkVehicles = true, checkPeds = true, checkObjects = true, checkDummies = true, seeThroughStuff = false, ignoreSomeObjectsForCamera = false, } dgsRenderer["dgs-dx3dtext"] = function(source,x,y,w,h,mx,my,cx,cy,enabled,eleData,parentAlpha,isPostGUI,rndtgt) local attachTable = eleData.attachTo local posTable = eleData.position local wx,wy,wz = posTable[1],posTable[2],posTable[3] local isRender = true if attachTable then if isElement(attachTable[1]) then if isElementStreamedIn(attachTable[1]) then wx,wy,wz = getPositionFromElementOffset(attachTable[1],attachTable[2],attachTable[3],attachTable[4]) eleData.position = {wx,wy,wz} else isRender = false end else eleData.attachTo = false end end if isRender then local camX,camY,camZ = getCameraMatrix() local maxDistance = eleData.maxDistance local distance = ((wx-camX)^2+(wy-camY)^2+(wz-camZ)^2)^0.5 if distance <= maxDistance and distance > 0 then local canBeBlocked = eleData.canBeBlocked if canBeBlocked then if canBeBlocked == true then canBeBlocked = g_canBeBlocked end if canBeBlocked.checkBuildings == nil then canBeBlocked.checkBuildings = g_canBeBlocked.checkBuildings end if canBeBlocked.checkVehicles == nil then canBeBlocked.checkVehicles = g_canBeBlocked.checkVehicles end if canBeBlocked.checkPeds == nil then canBeBlocked.checkPeds = g_canBeBlocked.checkPeds end if canBeBlocked.checkObjects == nil then canBeBlocked.checkObjects = g_canBeBlocked.checkObjects end if canBeBlocked.checkDummies == nil then canBeBlocked.checkDummies = g_canBeBlocked.checkDummies end if canBeBlocked.seeThroughStuff == nil then canBeBlocked.seeThroughStuff = g_canBeBlocked.seeThroughStuff end if canBeBlocked.ignoreSomeObjectsForCamera == nil then canBeBlocked.ignoreSomeObjectsForCamera = g_canBeBlocked.ignoreSomeObjectsForCamera end end local textSizeX,textSizeY = eleData.textSize[1],eleData.textSize[2] local colorcoded = eleData.colorcoded local fadeDistance = eleData.fadeDistance local text = eleData.text local font = eleData.font or systemFont local subPixelPositioning = eleData.subPixelPositioning if (not canBeBlocked or (canBeBlocked and isLineOfSightClear(wx, wy, wz, camX, camY, camZ, canBeBlocked.checkBuildings, canBeBlocked.checkVehicles, canBeBlocked.checkPeds, canBeBlocked.checkObjects, canBeBlocked.checkDummies, canBeBlocked.seeThroughStuff,canBeBlocked.ignoreSomeObjectsForCamera))) then local fadeMulti = 1 if maxDistance > fadeDistance and distance >= fadeDistance then fadeMulti = 1-(distance-fadeDistance)/(maxDistance-fadeDistance) end local x,y = getScreenFromWorldPosition(wx,wy,wz,0.5) if x and y then local x,y = x-x%1,y-y%1 if eleData.fixTextSize then distance = 50 end local antiDistance = 1/distance local sizeX = textSizeX*textSizeX/distance*50 local sizeY = textSizeY*textSizeY/distance*50 local color = applyColorAlpha(eleData.color,parentAlpha*fadeMulti) local shadow = eleData.shadow if shadow then local shadowoffx,shadowoffy,shadowc,shadowIsOutline = shadow[1],shadow[2],shadow[3],shadow[4] if shadowoffx and shadowoffy and shadowc then local shadowText = text if colorcoded then shadowText = text:gsub('#%x%x%x%x%x%x','').."\n" end local shadowc = applyColorAlpha(shadowc,parentAlpha*fadeMulti) local shadowoffx,shadowoffy = shadowoffx*antiDistance*50,shadowoffy*antiDistance*50 dxDrawText(shadowText,x+shadowoffx,y+shadowoffy,_,_,shadowc,sizeX,sizeY,font,"center","center",false,false,false,false,subPixelPositioning) if shadowIsOutline then dxDrawText(shadowText,x-shadowoffx,y+shadowoffy,_,_,shadowc,sizeX,sizeY,font,"center","center",false,false,false,false,subPixelPositioning) dxDrawText(shadowText,x-shadowoffx,y-shadowoffy,_,_,shadowc,sizeX,sizeY,font,"center","center",false,false,false,false,subPixelPositioning) dxDrawText(shadowText,x+shadowoffx,y-shadowoffy,_,_,shadowc,sizeX,sizeY,font,"center","center",false,false,false,false,subPixelPositioning) end end end dxDrawText(text,x,y,x,y,color,sizeX,sizeY,font,"center","center",false,false,false,colorcoded,subPixelPositioning) ------------------------------------OutLine local outlineData = eleData.outline if outlineData then local shadowText = colorcoded and text:gsub('#%x%x%x%x%x%x','') or text local w,h = dxGetTextWidth(shadowText,sizeX,font),dxGetFontHeight(sizeY,font) local x,y=x-w*0.5,y-h*0.5 local sideColor = outlineData[3] local sideSize = outlineData[2]*antiDistance*25 local hSideSize = sideSize*0.5 sideColor = applyColorAlpha(sideColor,parentAlpha*fadeMulti) local side = outlineData[1] if side == "in" then dxDrawLine(x,y+hSideSize,x+w,y+hSideSize,sideColor,sideSize) dxDrawLine(x+hSideSize,y,x+hSideSize,y+h,sideColor,sideSize) dxDrawLine(x+w-hSideSize,y,x+w-hSideSize,y+h,sideColor,sideSize) dxDrawLine(x,y+h-hSideSize,x+w,y+h-hSideSize,sideColor,sideSize) elseif side == "center" then dxDrawLine(x-hSideSize,y,x+w+hSideSize,y,sideColor,sideSize) dxDrawLine(x,y+hSideSize,x,y+h-hSideSize,sideColor,sideSize) dxDrawLine(x+w,y+hSideSize,x+w,y+h-hSideSize,sideColor,sideSize) dxDrawLine(x-hSideSize,y+h,x+w+hSideSize,y+h,sideColor,sideSize) elseif side == "out" then dxDrawLine(x-sideSize,y-hSideSize,x+w+sideSize,y-hSideSize,sideColor,sideSize) dxDrawLine(x-hSideSize,y,x-hSideSize,y+h,sideColor,sideSize) dxDrawLine(x+w+hSideSize,y,x+w+hSideSize,y+h,sideColor,sideSize) dxDrawLine(x-sideSize,y+h+hSideSize,x+w+sideSize,y+h+hSideSize,sideColor,sideSize) end end end end end end return rndtgt,true end
local lean = {snippets = {}} function lean.setup(opts) opts = opts or {} local snippets = opts.snippets or {} if snippets.enable ~= false then lean.snippets.enable() end end function lean.snippets.enable() local this_file = debug.getinfo(2, "S").source:sub(2) local base_directory = vim.fn.fnamemodify(this_file, ":h:h:h") local translations = base_directory .. '/vscode-lean/translations.json' local lean_snippets = {} for from, to in pairs(vim.fn.json_decode(vim.fn.readfile(translations))) do lean_snippets["\\" .. from] = to end local snippets = require('snippets') local all_snippets = snippets.snippets or {} all_snippets.lean = lean_snippets snippets.snippets = all_snippets end return lean
--author Himanshu Sharma local App42ResponseBuilder = require("App42-Lua-API.App42ResponseBuilder") local JSON = require("App42-Lua-API.JSON") local ACL = require("App42-Lua-API.ACL") local JSONDocument = require("App42-Lua-API.JSONDocument") local GeoTag = require("App42-Lua-API.GeoTag") local Storage = require("App42-Lua-API.Storage") local StorageResponseBuilder = {} function StorageResponseBuilder:buildResponse(jsonString) local storage = require("App42-Lua-API.Storage") local storageJSONObj = App42ResponseBuilder:getServiceJSONObject("storage",jsonString) if(storageJSONObj == nil) then storage:setStrResponse(jsonString) storage:setResponseSuccess(App42ResponseBuilder:isResponseSuccess(jsonString)) storage:setTotalRecords(App42ResponseBuilder:getTotalRecords(jsonString)) else storage = StorageResponseBuilder:buildStorageObject(storageJSONObj) storage:setStrResponse(jsonString) storage:setResponseSuccess(App42ResponseBuilder:isResponseSuccess(jsonString)) end return storage end function StorageResponseBuilder:buildStorageObject(jsonObject) local storage = StorageResponseBuilder:buildObjectFromJSONTree(jsonObject) local documentArray = {} if jsonObject.jsonDoc ~= nil then local jsonDocArray = jsonObject.jsonDoc if table.getn(jsonDocArray) > 0 then for i=1, table.getn(jsonDocArray) do documentArray[i] = StorageResponseBuilder:buildJsonDocument(jsonDocArray[i]) end else documentArray = StorageResponseBuilder:buildJsonDocument(jsonDocArray) end storage:setJsonDocList(documentArray) end return storage end function StorageResponseBuilder:buildJsonDocument(documentJSON) local jsonDcoument =JSONDocument:new(); if documentJSON["_id"] ~=nil then local idJSONObject = documentJSON["_id"] jsonDcoument:setDocId(idJSONObject["$oid"]) documentJSON["_id"] = nil end if documentJSON["_$owner"] ~=nil then local ownerJSONObject = documentJSON["_$owner"] jsonDcoument:setOwner(ownerJSONObject["owner"]) documentJSON["_$owner"] = nil end if documentJSON["_$updatedAt"] ~=nil then local updatedJSONObject = documentJSON["_$updatedAt"] jsonDcoument:setUpdatedAt(updatedJSONObject) documentJSON["_$updatedAt"] = nil end if documentJSON["_$createdAt"] ~=nil then local createAtJSONObject = documentJSON["_$createdAt"] jsonDcoument:setCreatedAt(createAtJSONObject) documentJSON["_$createdAt"] = nil end if documentJSON["loc"] ~=nil then local locationJSONArray = documentJSON["loc"] local geoTag =GeoTag:new() geoTag:setLat(locationJSONArray[1]) geoTag:setLng(locationJSONArray[2]) jsonDcoument:setLocation(geoTag) documentJSON["loc"] = nil end if documentJSON["_$event"] ~=nil then local eventJSONObject = documentJSON["_$event"] jsonDcoument:setEvent(eventJSONObject) documentJSON["_$event"] = nil end if documentJSON["_$acl"] ~=nil then local aclArrayObject = {} local aclArray = documentJSON["_$acl"] for j=1,table.getn(aclArray) do for stringKey, stringValue in sortKeyByValue(aclArray[j]) do local acl = ACL:new() acl:setUser(stringKey) acl:setPermission(stringValue) aclArrayObject[j] = acl end end jsonDcoument:setAclList(aclArrayObject) documentJSON["_$acl"] = nil end jsonDcoument:setJsonDoc(documentJSON) return jsonDcoument end function StorageResponseBuilder:buildObjectFromJSONTree(jsonObject) local object = Storage:new() if(jsonObject.dbName ~= nil)then object:setDbName(jsonObject.dbName) end if(jsonObject.collectionName ~= nil) then object:setCollectionName(jsonObject.collectionName) end if(jsonObject.recordCount ~= nil) then object:setRecordCount(jsonObject.recordCount) end return object end return StorageResponseBuilder
_G.arg = {} require 'busted.runner'() -- -- This tests the behavior of the tree of Actors (the Company) and not any -- specific actions of an Actor object. See `actor.lua` for tests on the Actor -- objects produced from the Company -- describe("The Company", function() local a0, a1, a2, a3, a4, a5 setup(function() a0 = Actor{} a1 = a0:child{} a2 = a0:child{} a3 = a2:child{} a4 = a2:child{} a5 = a0:child{} -- 0 -- / | \ -- 1 2 5 -- / \ -- 3 4 end) teardown(function() a0:remove() end) it("is a tree of Actors", function() assert.is_equal(a0:id(), 0) assert.is_equal(a1:id(), 1) assert.is_equal(a2:id(), 2) assert.is_equal(a3:id(), 3) assert.is_equal(a4:id(), 4) assert.is_equal(a5:id(), 5) assert.are_same(a0:children(), {1, 2, 5}) assert.are_same(a1:children(), {}) assert.are_same(a2:children(), {3, 4}) assert.are_same(a3:children(), {}) assert.are_same(a4:children(), {}) assert.are_same(a5:children(), {}) end) it("handles Actors by integer ids", function() assert.are_same(Actor(5), a5) end) it("doesn't handle lifetimes through the Lua actor objects", function() a2 = nil assert.is_equal(a3:parent():id(), 2) assert.is_equal(a4:parent():id(), 2) a2 = Actor(2) end) it("lets actors be deleted through the method `remove`", function() a5:remove() assert.are_same(a0:children(), {1, 2}) end) it("removes the descendents recursively of a deleted node", function() assert.is_equal(a3:parent():id(), 2) assert.is_equal(a4:parent():id(), 2) a2:remove() assert.are_same(a0:children(), {1}) end) it("lets actors' data be accessed if it's removed but not gc'd", function() -- NOTE: the reason for this functionality is that when Nodes are -- removed, its id is removed from any audience or children list, so it -- becomes unaccessable. This functionality lets us remove an Actor -- from the tree while it is processing a message. -- lock/unlock uses the same mechanism for getting the data which is -- garbage collected. a2:lock() a2:unlock() -- it's valid but we just haven't given it any scripts assert.has_error(function() a2:send{} end, "Actor `2' has no loaded Scripts!") assert.has_error(function() a2:probe(1, "field") end, "Couldn't find Script @ 1 inside Actor `2`!") a2:load() end) it("has a cleanup function to forcefully gc an Actor", function() a2:cleanup() assert.has_error(function() a0:cleanup() end, "Cleanup failed! Actor `0` is not garbage!") end) pending("garbage collects actors when they are created") it("considers ids from removed actors to be invalid", function() assert.has_error(function() a2:parent() end, "Cannot get parent of invalid Actor `2`!") assert.has_error(function() a2:child{} end, "Failed to create actor: invalid parent id `2`!") assert.has_error(function() a2:send{} end, "Actor id `2` is an invalid reference!") assert.has_error(function() a2:load() end, "Actor id `2` is an invalid reference!") assert.has_error(function() a2:probe() end, "Actor id `2` is an invalid reference!") assert.has_error(function() a2:remove() end, "Actor id `2` is an invalid reference!") assert.has_error(function() a2:bench() end, "Cannot bench invalid reference `2`!") assert.has_error(function() a2:join() end, "Cannot join `2`: id invalid!") assert.has_error(function() a2:async("send", {}) end, "Starting async method `send` failed: invalid Actor id `2`!") -- Fail silently right now a2:children() a2:audience("foo") end) it("recycles garbage ids when creating assigning new ones", function() a2 = a0:child{} assert.is_equal(a2:id(), 2) assert.are_same(a0:children(), {1, 2}) assert.is_equal(a2:child{}:id(), 3) assert.is_equal(a2:child{}:id(), 4) assert.are_same(a2:children(), {3, 4}) assert.is_equal(a0:child{}:id(), 5) assert.are_same(a0:children(), {1, 2, 5}) end) it("lets a node have a children whose id is less than its own", function() -- This requires a Tree setup with a group of low-id active nodes, a -- group of mid-id inactive nodes, and high-id active nodes so that -- when a high-id node creates a new child, the new child has an id -- less than its own (it uses a mid-id inactive node). This tests lock -- order violations that may happen because the tree was designed so -- that any node can be moved to any other. a2:remove() assert.are_same(a0:children(), {1, 5}) assert.is_equal(a5:child{}:id(), 2) assert.are_same(a5:children(), {2}) a2:remove() assert.are_same(a0:child{}:id(), 2) assert.is_equal(a2:child{}:id(), 3) assert.is_equal(a2:child{}:id(), 4) assert.are_same(a0:children(), {1, 2, 5}) end) it("doesn't recycle ids which are still being referenced", function() local actor = Actor({}, 5) assert.is_equal(actor:id(), 6) -- lock is the same mechanism as reference actor:lock() a5:remove() -- id is `5` because a1 was deleted above and `5` became free assert.is_equal(a0:child{}:id(), 5) -- but id here is `7`. skips `6` because it is still ref'd assert.is_equal(a0:child{}:id(), 7) actor:unlock() assert.is_equal(a0:child{}:id(), 6) Actor(6):remove() Actor(7):remove() end) it("allows actors to have any number of children up to max actors", function() local parent = a0:child{} assert.is_equal(parent:id(), 6) -- assuming the default of 64 max actors for i = 7, 63 do assert.is_equal(parent:child{}:id(), i) end assert.has_error(function() assert.is_equal(parent:child{}) end, "Failed to create actor: max actors reached!") parent:remove() end) it("allows benching and joining of Actors from the Company tree", function() a1:bench() assert.are_same(a0:children(), {2, 5}) a1:join() assert.are_same(a0:children(), {1, 2, 5}) end) it("doesn't allow joining of non-benched actors", function() assert.has_error(function() a5:join() end, "Cannot join `5`: not benched!") end) it("doesn't allow joining of benched actors with bad parents", function() local actor = a5:child{} assert.is_equal(actor:id(), 6) actor:bench() a5:remove() assert.has_error(function() actor:join() end, "Cannot join `6`: bad parent!") actor:remove() assert.is_equal(a0:child{}:id(), 5) end) it("allows for a benched actor to join as a child of any parent", function() -- testing if an actor can be the child of an parent with a greater -- id than it a1:bench() a1:join(5) assert.are_same(a0:children(), {2, 5}) assert.are_same(a5:children(), {1}) a1:bench() a1:join(0) assert.are_same(a0:children(), {1, 2, 5}) -- and now the conventional parent is less than the child's id a5:bench() a5:join(1) assert.are_same(a0:children(), {1, 2}) assert.are_same(a1:children(), {5}) a5:bench() a5:join(0) assert.are_same(a0:children(), {1, 2, 5}) end) it("handles the audience for each Actor", function() assert.are_same(a2:audience("yell"), {0, 1, 2, 3, 4, 5}) assert.are_same(a2:audience("say"), {0, 1, 2, 5}) assert.are_same(a2:audience("command"), {2, 3, 4}) end) end)
{{ dbDel .User.ID "afk" }}
local heap = require("data_structures.heap") -- A heap which provides the median, defined as the floor(n/2)-th smallest element, as it's top element local median_heap = {} function median_heap.less_than(a, b) return a < b end function median_heap.new(less_than) local self self = { less_than = less_than, lower_half = heap.new(function(a, b) return self.less_than(b, a) -- max heap end), upper_half = heap.new(function(a, b) return self.less_than(a, b) -- min heap end), } return self end function median_heap:empty() return self.lower_half:empty() end function median_heap:size() return #self.lower_half + #self.upper_half end function median_heap:top() -- the median return self.lower_half:top() end function median_heap:pop() local value = self.lower_half:pop() if #self.lower_half < #self.upper_half then self.lower_half:push(self.upper_half:pop()) end return value end function median_heap:push(value) if self:empty() then self.lower_half:push(value) elseif self.less_than(value, self:top()) then self.lower_half:push(value) if #self.lower_half - #self.upper_half > 1 then self.upper_half:push(self.lower_half:pop()) end else self.upper_half:push(value) if #self.lower_half < #self.upper_half then self.lower_half:push(self.upper_half:pop()) end end end return require("class")(median_heap)
---@class PresetData local PresetData = { ClassType = "", Equipment = "", Equipment_Undead = "", Equipment_Preview = nil, SkillSet = "", IsPreview = false, } PresetData.__index = PresetData ---@param id string ---@param equipment string ---@param skillset string ---@param undeadEquipment string Optional undead equipment to use. ---@param isPreview boolean Whether this preset should use preview equipment. If previewEquipment is nil or blank, it will try to find the equipment string from the regular equipment + race suffix. ---@param previewEquipment string Optional preview equipment ---@return PresetData function PresetData:Create(id, equipment, skillset, undeadEquipment, isPreview, previewEquipment) local this = { ClassType = id, Equipment = equipment, Equipment_Undead = undeadEquipment or equipment, Equipment_Preview = previewEquipment or "", SkillSet = skillset, IsPreview = isPreview or false, } if undeadEquipment == nil or undeadEquipment == "" then this.Equipment_Undead = this.Equipment end setmetatable(this, self) return this end local previewRaceSuffixes = { HUMAN = "Humans", ELF = "Elves", DWARF = "Dwarves", LIZARD = "Lizards", } ---Applies a preset's equipment to a character. ---This won't change a character's stats, talents, or delete their inventory like CharacterApplyPreset does. ---@param char string ---@param targetRarity string ---@param skipSlots string[] Skip generating equipment for these slots. function PresetData:AddEquipmentToCharacter(char, targetRarity, skipSlots) if Ext.IsServer() then local level = CharacterGetLevel(char) local equipment = self.Equipment if self.IsPreview then if self.Equipment_Preview == nil or self.Equipment_Preview == "" then for tag,suffix in pairs(previewRaceSuffixes) do if IsTagged(char, tag) == 1 then local racePreviewSet = self.Equipment.."_"..suffix local racePreviewEquipment = Ext.GetEquipmentSet(racePreviewSet) if racePreviewEquipment ~= nil and #racePreviewEquipment.Groups > 0 then equipment = racePreviewSet break end end end else equipment = self.Equipment_Preview end elseif self.Equipment_Undead ~= nil and self.Equipment_Undead ~= "" and IsTagged(char, "UNDEAD") == 1 or CharacterHasTalent(char, "Zombie") == 1 then equipment = self.Equipment_Undead end local eq = Ext.GetEquipmentSet(equipment) if eq ~= nil then for i,v in pairs(eq.Groups) do local stat = Ext.GetStat(v.Equipment[1], level) if stat ~= nil then local skip = false if skipSlots ~= nil and stat.Slot ~= nil then for i,slot in pairs(skipSlots) do if string.find(stat.Slot, slot) then skip = true break end end end if not skip then local item = GameHelpers.Item.CreateItemByStat(stat, level, targetRarity, true, 1) if item ~= nil then ItemToInventory(item, char, 1, 0, 1) if ItemIsEquipable(item) == 1 then CharacterEquipItem(char, item) --NRD_CharacterEquipItem(char, item, stat.Slot, 0, 0, 1, 1) end end end end end else Ext.PrintError("[LeaderLib] Failed to get equipment for", equipment, self.ClassType, self.Equipment, self.Equipment_Undead, self.IsPreview) end end end ---Applies a preset's equipment and skillset to a character. ---This won't change a character's stats, talents, or delete their inventory like CharacterApplyPreset does. ---@param char string ---@param targetRarity string ---@param skipSlots string[] Skip generating equipment for these slots. function PresetData:ApplyToCharacter(char, targetRarity, skipSlots) --print("Applying",self.ClassType,"to",char, Ext.IsServer(), Ext.OsirisIsCallable()) if Ext.IsServer() then local status,err = xpcall(function() self:AddEquipmentToCharacter(char, targetRarity, skipSlots) end, debug.traceback) if not status then Ext.PrintError("[LeaderLib] Error applying preset",self.ClassType,"to character",char) Ext.PrintError(err) end local skillSet = Ext.GetSkillSet(self.SkillSet) if skillSet ~= nil then for i,v in pairs(skillSet.Skills) do if type(v) == "table" then for i,skill in pairs(v) do CharacterAddSkill(char, skill, 0) end elseif type(v) == "string" then CharacterAddSkill(char, v, 0) end end end end end ---@return string[] function PresetData:GetSkills() return Ext.GetSkillSet(self.SkillSet) end Classes.PresetData = PresetData
#!/usr/bin/env lua local ui = require "tek.ui" local function setinner(self, idx, val) for _, key in ipairs { "None", "SameSize", "SameWidth", "SameHeight" } do local e = self:getById(key) for _, c in ipairs(e.Children) do c[idx] = val c:rethinkLayout(1) end end end local function setouter(self, idx, val) for _, key in ipairs { "None", "SameSize", "SameWidth", "SameHeight" } do local e = self:getById(key) e[idx] = val e:rethinkLayout(1) end end ui.application:new { Children = { ui.window:new { HideOnEscape = true, Title = "Grid Alignment", Children = { ui.Group:new { Orientation = "vertical", Legend = "Outer Align", Children = { ui.Group:new { Orientation = "vertical", Style = "max-width: 0", Legend = "Horiz", Children = { ui.RadioButton:new { Text = "Left", onClick = function(self) setouter(self, "HAlign", "left") end }, ui.RadioButton:new { Text = "Center", Selected = true, onClick = function(self) setouter(self, "HAlign", "center") end }, ui.RadioButton:new { Text = "Right", onClick = function(self) setouter(self, "HAlign", "right") end } } }, ui.Group:new { Orientation = "vertical", Legend = "Vert", Style = "max-width: 0", Children = { ui.RadioButton:new { Text = "Top", onClick = function(self) setouter(self, "VAlign", "top") end }, ui.RadioButton:new { Text = "Center", Selected = true, onClick = function(self) setouter(self, "VAlign", "center") end }, ui.RadioButton:new { Text = "Bottom", onClick = function(self) setouter(self, "VAlign", "bottom") end } } } } }, ui.Group:new { Legend = "Grids", Columns = 2, HAlign = "right", VAlign = "bottom", Children = { ui.Group:new { Id = "SameSize", Legend = "SameSize", Columns = 2, SameSize = true, HAlign = "center", VAlign = "center", Children = { ui.text:new { Mode = "button", Class = "button", Text = "Big", HAlign = "center", VAlign = "center", Style = "font: ui-large; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Normal", HAlign = "center", VAlign = "center", Style = "font: ui-main; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Small", HAlign = "center", VAlign = "center", Style = "font: ui-small; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Huge", HAlign = "center", VAlign = "center", Style = "font: ui-huge; max-width: 0" }, } }, ui.Group:new { Id = "SameWidth", Legend = "SameWidth", Columns = 2, SameSize = "width", HAlign = "center", VAlign = "center", Children = { ui.text:new { Mode = "button", Class = "button", Text = "Big", HAlign = "center", VAlign = "center", Style = "font: ui-large; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Normal", HAlign = "center", VAlign = "center", Style = "font: ui-main; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Small", HAlign = "center", VAlign = "center", Style = "font: ui-small; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Huge", HAlign = "center", VAlign = "center", Style = "font: ui-huge; max-width: 0" }, } }, ui.Group:new { Id = "SameHeight", Legend = "SameHeight", Columns = 2, SameSize = "height", HAlign = "center", VAlign = "center", Children = { ui.text:new { Mode = "button", Class = "button", Text = "Big", HAlign = "center", VAlign = "center", Style = "font: ui-large; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Normal", HAlign = "center", VAlign = "center", Style = "font: ui-main; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Small", HAlign = "center", VAlign = "center", Style = "font: ui-small; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Huge", HAlign = "center", VAlign = "center", Style = "font: ui-huge; max-width: 0" }, } }, ui.Group:new { Id = "None", Legend = "None", Columns = 2, HAlign = "center", VAlign = "center", Children = { ui.text:new { Mode = "button", Class = "button", Text = "Big", HAlign = "center", VAlign = "center", Style = "font: ui-large; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Normal", HAlign = "center", VAlign = "center", Style = "font: ui-main; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Small", HAlign = "center", VAlign = "center", Style = "font: ui-small; max-width: 0" }, ui.text:new { Mode = "button", Class = "button", Text = "Huge", HAlign = "center", VAlign = "center", Style = "font: ui-huge; max-width: 0" }, } } } }, ui.Group:new { Orientation = "vertical", Legend = "Inner Align", Children = { ui.Group:new { Orientation = "vertical", Legend = "Horiz", Style = "max-width: 0", Children = { ui.RadioButton:new { Text = "Left", onClick = function(self) setinner(self, "HAlign", "left") end }, ui.RadioButton:new { Text = "Center", Selected = true, onClick = function(self) setinner(self, "HAlign", "center") end }, ui.RadioButton:new { Text = "Right", onClick = function(self) setinner(self, "HAlign", "right") end } } }, ui.Group:new { Orientation = "vertical", Legend = "Vert", Style = "max-width: 0", Children = { ui.RadioButton:new { Text = "Top", onClick = function(self) setinner(self, "VAlign", "top") end }, ui.RadioButton:new { Text = "Center", Selected = true, onClick = function(self) setinner(self, "VAlign", "center") end }, ui.RadioButton:new { Text = "Bottom", onClick = function(self) setinner(self, "VAlign", "bottom") end } } } } } } } } }:run()
---@meta ---@class cc.AsyncTaskPool local AsyncTaskPool={ } cc.AsyncTaskPool=AsyncTaskPool ---@overload fun(int:int,function:function):self ---@overload fun(int:int,function:function,void:void,function:function):self ---@param type int ---@param callback function ---@param callbackParam void ---@param task function ---@return self function AsyncTaskPool:enqueue (type,callback,callbackParam,task) end ---* Stop tasks.<br> ---* param type Task type you want to stop. ---@param type int ---@return self function AsyncTaskPool:stopTasks (type) end ---* Destroys the async task pool. ---@return self function AsyncTaskPool:destroyInstance () end ---* Returns the shared instance of the async task pool. ---@return self function AsyncTaskPool:getInstance () end ---* ---@return self function AsyncTaskPool:AsyncTaskPool () end
local Clockwork = Clockwork; local cwCTO = cwCTO; local COMMAND = Clockwork.command:New("SetBiosignalStatus"); COMMAND.tip = "Turn your biosignal on or off. Will alert all other units."; COMMAND.text = "<bool Enabled>"; COMMAND.flags = CMD_DEFAULT; COMMAND.arguments = 1; -- Called when the command has been run. function COMMAND:OnRun(player, arguments) local bEnable = Clockwork.kernel:ToBool(arguments[1]); local result = cwCTO:SetPlayerBiosignal(player, bEnable); if (result == cwCTO.ERROR_NOT_COMBINE) then Clockwork.player:Notify(player, "You are not the Combine!"); elseif (result == cwCTO.ERROR_ALREADY_ENABLED) then Clockwork.player:Notify(player, "Your biosignal is already enabled!"); elseif (result == cwCTO.ERROR_ALREADY_DISABLED) then Clockwork.player:Notify(player, "Your biosignal is already disabled!"); end; end; COMMAND:Register();
local HIDE_TOOLTIP_HEALTHBAR = true local AddonName = ... local E = unpack(ElvUI) local TT = E:GetModule('Tooltip') local ECTT = E:NewModule('EnhancedCursorToolTip', 'AceHook-3.0') local GameTooltip = GameTooltip local GetMouseFocus = GetMouseFocus local UnitPlayerControlled = UnitPlayerControlled function ECTT:GameTooltip_SetDefaultAnchor(tooltip, parent) if GetMouseFocus() == WorldFrame and not UnitPlayerControlled('mouseover') then -- Enable cursor anchor for non-player tooltips TT.db.cursorAnchor = true else -- Otherwise, disable cursor anchord TT.db.cursorAnchor = false end end function ECTT:Initialize() -- Setup hook ECTT:Hook(TT, 'GameTooltip_SetDefaultAnchor') if HIDE_TOOLTIP_HEALTHBAR then -- Hide tooltip health bar GameTooltip.StatusBar:Hide() GameTooltip.StatusBar:SetAlpha(0) -- Overwrite health bar's Show method ECTT:RawHook(GameTooltip.StatusBar, 'Show', function() end, true) end end E:RegisterModule(ECTT:GetName()) LibStub('LibElvUIPlugin-1.0'):RegisterPlugin(AddonName)
local spikeHelper = require("helpers.spikes") local spikeUp = spikeHelper.createEntityHandler("MaxHelpingHand/CoreModeSpikesUp", "up") local spikeDown = spikeHelper.createEntityHandler("MaxHelpingHand/CoreModeSpikesDown", "down") local spikeLeft = spikeHelper.createEntityHandler("MaxHelpingHand/CoreModeSpikesLeft", "left") local spikeRight = spikeHelper.createEntityHandler("MaxHelpingHand/CoreModeSpikesRight", "right") spikeUp.direction = "up" spikeDown.direction = "down" spikeLeft.direction = "left" spikeRight.direction = "right" local spikes = { spikeUp, spikeDown, spikeLeft, spikeRight } local function getSpikePlacements(direction) local placements = {} local horizontal = direction == "left" or direction == "right" local lengthKey = horizontal and "height" or "width" local placement = { name = "spike", data = { hotType = "MaxHelpingHand/heatspike", coldType = "cliffside", } } placement.data[lengthKey] = 8 return { placement } end -- Lönn spike helper copypaste begin local drawableSprite = require("structs.drawable_sprite") local spikeTexture = "danger/spikes/%s_%s00" local spikeOffsets = { up = {0, 1}, down = {0, -1}, right = {-1, 0}, left = {1, -1} } local spikeJustifications = { up = {0.0, 1.0}, down = {0.0, 0.0}, right = {0.0, 0.0}, left = {1.0, 0.0} } local function getDirectionJustification(direction) return unpack(spikeJustifications[direction] or {0, 0}) end local function getDirectionOffset(direction) return unpack(spikeOffsets[direction] or {0, 0}) end local function getSpikeSpritesFromTexture(entity, direction, variant, texture) step = 8 local horizontal = direction == "left" or direction == "right" local justificationX, justificationY = getDirectionJustification(direction) local offsetX, offsetY = getDirectionOffset(direction) local rotation = 0 local length = horizontal and (entity.height or step) or (entity.width or step) local positionOffsetKey = horizontal and "y" or "x" local position = { x = entity.x, y = entity.y } local sprites = {} for i = 0, length - 1, step do -- Tentacles overlap instead of "overflowing" if i == length - step / 2 then position[positionOffsetKey] -= step / 2 end local sprite = drawableSprite.fromTexture(texture, position) sprite.depth = spikeDepth sprite.rotation = rotation sprite:setJustification(justificationX, justificationY) sprite:addPosition(offsetX, offsetY) table.insert(sprites, sprite) position[positionOffsetKey] += step end return sprites end local function getNormalSpikeSprites(entity, direction) local variant = entity.hotType or "default" local texture = string.format(spikeTexture, variant, direction) return getSpikeSpritesFromTexture(entity, direction, variant, texture) end -- Lönn spike helper copypaste end -- TODO use right spike textures for _, spike in ipairs(spikes) do spike.placements = getSpikePlacements(spike.direction) local direction = spike.direction function spike.sprite(room, entity) return getNormalSpikeSprites(entity, direction) end end return spikes
--[[ Copyright (c) 2016 Baidu.com, Inc. All Rights Reserved @file CuidJudge.lua @author sunnnychan@gmail.com @date 2016/03/12 11:27:24 @brief cuid dimension juge ]]-- local BDLOG = require('lua.bdlib.BdLogWrite') local setmetatable = setmetatable local tonumber = tonumber local tostring = tostring local Method = require('models.service.rule.JudgeMethods') local max = 2^32 -1 local CRC32 = { 0,79764919,159529838,222504665,319059676, 398814059,445009330,507990021,638119352, 583659535,797628118,726387553,890018660, 835552979,1015980042,944750013,1276238704, 1221641927,1167319070,1095957929,1595256236, 1540665371,1452775106,1381403509,1780037320, 1859660671,1671105958,1733955601,2031960084, 2111593891,1889500026,1952343757,2552477408, 2632100695,2443283854,2506133561,2334638140, 2414271883,2191915858,2254759653,3190512472, 3135915759,3081330742,3009969537,2905550212, 2850959411,2762807018,2691435357,3560074640, 3505614887,3719321342,3648080713,3342211916, 3287746299,3467911202,3396681109,4063920168, 4143685023,4223187782,4286162673,3779000052, 3858754371,3904687514,3967668269,881225847, 809987520,1023691545,969234094,662832811, 591600412,771767749,717299826,311336399, 374308984,453813921,533576470,25881363, 88864420,134795389,214552010,2023205639, 2086057648,1897238633,1976864222,1804852699, 1867694188,1645340341,1724971778,1587496639, 1516133128,1461550545,1406951526,1302016099, 1230646740,1142491917,1087903418,2896545431, 2825181984,2770861561,2716262478,3215044683, 3143675388,3055782693,3001194130,2326604591, 2389456536,2200899649,2280525302,2578013683, 2640855108,2418763421,2498394922,3769900519, 3832873040,3912640137,3992402750,4088425275, 4151408268,4197601365,4277358050,3334271071, 3263032808,3476998961,3422541446,3585640067, 3514407732,3694837229,3640369242,1762451694, 1842216281,1619975040,1682949687,2047383090, 2127137669,1938468188,2001449195,1325665622, 1271206113,1183200824,1111960463,1543535498, 1489069629,1434599652,1363369299,622672798, 568075817,748617968,677256519,907627842, 853037301,1067152940,995781531,51762726, 131386257,177728840,240578815,269590778, 349224269,429104020,491947555,4046411278, 4126034873,4172115296,4234965207,3794477266, 3874110821,3953728444,4016571915,3609705398, 3555108353,3735388376,3664026991,3290680682, 3236090077,3449943556,3378572211,3174993278, 3120533705,3032266256,2961025959,2923101090, 2868635157,2813903052,2742672763,2604032198, 2683796849,2461293480,2524268063,2284983834, 2364738477,2175806836,2238787779,1569362073, 1498123566,1409854455,1355396672,1317987909, 1246755826,1192025387,1137557660,2072149281, 2135122070,1912620623,1992383480,1753615357, 1816598090,1627664531,1707420964,295390185, 358241886,404320391,483945776,43990325, 106832002,186451547,266083308,932423249, 861060070,1041341759,986742920,613929101, 542559546,756411363,701822548,3316196985, 3244833742,3425377559,3370778784,3601682597, 3530312978,3744426955,3689838204,3819031489, 3881883254,3928223919,4007849240,4037393693, 4100235434,4180117107,4259748804,2310601993, 2373574846,2151335527,2231098320,2596047829, 2659030626,2470359227,2550115596,2947551409, 2876312838,2788305887,2733848168,3165939309, 3094707162,3040238851,2985771188, } local function xor(a, b) local calc = 0 for i = 32, 0, -1 do local val = 2 ^ i local aa = false local bb = false if a == 0 then calc = calc + b break end if b == 0 then calc = calc + a break end if a >= val then aa = true a = a - val end if b >= val then bb = true b = b - val end if not (aa and bb) and (aa or bb) then calc = calc + val end end return calc end local function lshift(num, left) local res = num * (2 ^ left) return res % (2 ^ 32) end local function rshift(num, right) local res = num / (2 ^ right) return math.floor(res) end local function crc32Hash(str) local count = string.len(tostring(str)) local crc = max local i = 1 while count > 0 do local byte = string.byte(str, i) crc = xor(lshift(crc, 8), CRC32[xor(rshift(crc, 24), byte) + 1]) i = i + 1 count = count - 1 end return crc end local CuidJudge = {} function CuidJudge:new(cuid, ruleType, ruleContent) local instance = {} instance.proportion_type = 1 instance.cuid = cuid instance.ruleType = tonumber(ruleType) instance.ruleContent = ruleContent setmetatable(instance, {__index = self}) return instance end function CuidJudge:judge() if self.ruleType == self.proportion_type then if type(self.cuid) ~= 'string' or self.cuid == '' then BDLOG.log_fatal('cuid invalid, [cuid] : %s', self.cuid) return false end return Method.checkProportion(crc32Hash(self.cuid), self.ruleContent) else BDLOG.log_fatal('unsupported rule type by Cuid judge. [rule type] : %s', self.ruleType) return false end end return CuidJudge
createObject(3763,2809.3000488,2617.6999512,43.0999985,0.0000000,0.0000000,0.0000000) --object(ce_radarmast3) (1) createObject(1682,2826.8999023,2595.6999512,27.7999992,0.0000000,0.0000000,45.2500000) --object(ap_radar1_01) (1) createObject(1682,2814.5000000,2583.3000488,27.7999992,0.0000000,0.0000000,45.2471924) --object(ap_radar1_01) (2) createObject(1682,2802.3000488,2571.1000977,27.7999992,0.0000000,0.0000000,45.2471924) --object(ap_radar1_01) (3) createObject(1682,2788.8000488,2557.6999512,27.7999992,0.0000000,0.0000000,45.2471924) --object(ap_radar1_01) (4) createObject(7981,2841.3999023,2632.3000488,14.8000002,0.0000000,0.0000000,0.0000000) --object(smallradar02_lvs) (1) createObject(1682,2846.0000000,2632.3000488,26.2999992,0.0000000,0.0000000,93.2471924) --object(ap_radar1_01) (5) createObject(3763,1442.8000488,2878.8000488,43.0000000,0.0000000,0.0000000,2.0000000) --object(ce_radarmast3) (2) createObject(1682,1427.4000244,2873.1000977,26.2000008,0.0000000,0.0000000,230.0000000) --object(ap_radar1_01) (6) createObject(10810,1426.3000488,2869.8000488,14.8000002,0.0000000,0.0000000,290.0000000) --object(ap_smallradar1_sfse) (1) createObject(1682,1425.0000000,2840.8000488,26.2000008,0.0000000,0.0000000,229.9987793) --object(ap_radar1_01) (7) createObject(10810,1423.6992188,2846.3994141,14.8000002,0.0000000,0.0000000,111.4947510) --object(ap_smallradar1_sfse) (2) createObject(10810,1470.4000244,2875.1000977,14.8000002,0.0000000,0.0000000,199.9951172) --object(ap_smallradar1_sfse) (3) createObject(1682,1475.5999756,2873.3999023,26.2000008,0.0000000,0.0000000,229.9987793) --object(ap_radar1_01) (8) createObject(1682,1108.0000000,712.4000244,26.2000008,0.0000000,0.0000000,0.0000000) --object(ap_radar1_01) (9) createObject(7981,1103.4000244,711.2999878,14.8000002,0.0000000,0.0000000,0.0000000) --object(smallradar02_lvs) (2) createObject(3763,1083.6999512,755.9000244,43.0000000,0.0000000,0.0000000,0.0000000) --object(ce_radarmast3) (3) createObject(1682,1135.9000244,767.0999756,26.1000004,0.0000000,0.0000000,0.0000000) --object(ap_radar1_01) (10) createObject(7981,1136.1999512,760.7999878,14.8000002,0.0000000,0.0000000,92.0000000) --object(smallradar02_lvs) (3) createObject(3763,2873.8000488,935.5000000,43.0000000,0.0000000,0.0000000,0.0000000) --object(ce_radarmast3) (4) createObject(1682,2871.5000000,899.5000000,25.8999996,0.0000000,0.0000000,47.9992676) --object(ap_radar1_01) (11) createObject(7981,2872.8000488,902.7000122,14.6000004,0.0000000,0.0000000,270.0000000) --object(smallradar02_lvs) (4) createObject(7981,2851.6999512,935.5000000,14.6999998,0.0000000,0.0000000,179.9945068) --object(smallradar02_lvs) (5) createObject(1682,2845.1000977,936.5999756,26.1000004,0.0000000,0.0000000,53.9978027) --object(ap_radar1_01) (12) createObject(1259,2830.5996094,924.2998047,25.0000000,0.0000000,0.0000000,340.0000000) --object(billbd1) (1) createObject(1259,2781.5000000,2620.3994141,25.0000000,0.0000000,0.0000000,45.9942627) --object(billbd1) (2) createObject(1259,1107.0999756,750.9000244,24.7999992,0.0000000,0.0000000,247.9943848) --object(billbd1) (3) createObject(1259,1451.1999512,2840.1999512,24.7999992,0.0000000,0.0000000,151.9903564) --object(billbd1) (4) createObject(7900,1105.9000244,751.0999756,30.7999992,0.0000000,0.0000000,158.0000000) --object(vgwestbillbrd1) (1) createObject(7900,2830.6999512,923.2000122,31.0000000,0.0000000,0.0000000,250.0000000) --object(vgwestbillbrd1) (2) createObject(7900,2782.6999512,2619.8999023,31.0000000,0.0000000,0.0000000,315.0000000) --object(vgwestbillbrd1) (3) createObject(7900,1452.0000000,2841.6999512,31.0000000,0.0000000,0.0000000,61.0000000) --object(vgwestbillbrd1) (4) ----LV north fix createObject ( 7096, 2494.1000976563, 2784.6999511719, 15.39999961853 ) createObject ( 7096, 2512, 2789.1000976563, 15.39999961853, 0, 0, 180 ) --[[ Objects converted: 33 Vehicles converted: 0 Vehicle models found: 0 ---------------------- In the time this conversion took to finish a hummingbird could have flapped it's wings 1.48 times! --]]
--------------------------------------------------- -- Shop - helper functions --------------------------------------------------- -- provides functions for adding weapons to shop, -- set custom rarity to weapons, -- and make them toggleable in mod configuration. --------------------------------------------------- local this = { weapons = {}, weapons_enabled = {}, } local oldInitializeDecks = initializeDecks function initializeDecks(...) oldInitializeDecks(...) for _, weapon in ipairs(this.weapons_enabled) do table.insert(GAME.WeaponDeck, weapon) end end local oldSkillGetRarity = Skill.GetRarity function Skill:GetRarity() if self.lmn_CustomRarity then assert(type(self.lmn_CustomRarity) == 'number') return math.max(0, math.min(4, self.lmn_CustomRarity)) end return oldSkillGetRarity(self) end function this:addWeapon(weapon) assert(type(weapon) == 'table') assert(type(weapon.id) == 'string') assert(_G[weapon.id]) weapon.opt = "opt_".. weapon.id weapon.name = weapon.name or _G[weapon.id].Name or "" weapon.desc = weapon.desc or _G[weapon.id].Description or "" weapon.default = weapon.default or {enabled = true} table.insert(self.weapons, weapon) modApi:addGenerationOption( weapon.opt, weapon.name, weapon.desc, weapon.default ) end function this:load(options) for _, weapon in ipairs(self.weapons) do if options[weapon.opt].enabled then if not list_contains(self.weapons_enabled, weapon.id) then table.insert(self.weapons_enabled, weapon.id) end else remove_element(weapon.id, self.weapons_enabled) end end end return this
local config = require("lspconfig").svelte.document_config require("lspconfig/configs").svelte = nil -- important, immediately unset the loaded config again config.default_config.cmd[1] = "./node_modules/.bin/svelteserver" return vim.tbl_extend("error", config, { install_script = [=[ [[ ! -f package.json ]] && npm init -y --scope=lspinstall || true npm install svelte-language-server@latest ]=], })
-- awesome_mode: api-level=4:screen=on ----------------------------------------------------------- -- Includes {{{1 -- Standard awesome libraries local gears = require("gears") -- Utilities such as color parsing and objects local awful = require("awful") -- Everything related to window management -- Widget and layout library local wibox = require("wibox") -- Awesome own generic widget framework -- Theme handling library local beautiful = require("beautiful") -- Awesome theme module local M = {} ----------------------------------------------------------- -- Clock {{{1 function M.get_widget() local time = wibox.widget({ { { format = " %a %d. %b %Y %H:%M", widget = wibox.widget.textclock, }, left = 5 * beautiful.useless_gap, right = 5 * beautiful.useless_gap, widget = wibox.container.margin, }, bg = beautiful.nord9, fg = beautiful.nord0, shape = gears.shape.rounded_bar, widget = wibox.container.background, }) return time end ----------------------------------------------------------- -- Calendar {{{1 function M.get_popup(widget) local p = awful.popup({ widget = wibox.widget({ date = os.date("*t"), font = beautiful.font, widget = wibox.widget.calendar.year, }), preferred_anchors = "middle", border_color = beautiful.border_color, border_width = beautiful.border_width, shape = gears.shape.infobubble, }) p:bind_to_widget(widget) return p end return M -- }}}1
_M = {} _M.VERSION = 1.0 local mt = { __index = _M } _M.new = function(self, name) return setmetatable({name = name}, mt) end _M.get_name = function(self) return self.name end _M.set_name = function(self, name) self.name = name end return _M
-- MIT License -- -- Copyright (c) 2018 Mikkel Lykke Jørgensen (MLJWare) -- -- Permission is hereby granted, free of charge, to any person obtaining a copy -- of this software and associated documentation files (the "Software"), to deal -- in the Software without restriction, including without limitation the rights -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -- copies of the Software, and to permit persons to whom the Software is -- furnished to do so, subject to the following conditions: -- -- The above copyright notice and this permission notice shall be included in all -- copies or substantial portions of the Software. -- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -- SOFTWARE. local ffi = assert(require "ffi", "Vector4 requires ffi enabled to work.") ffi.cdef[=[ typedef struct { double x, y, z, w; } Vector4; ]=] local new = ffi.typeof("Vector4") local Vector4 = {} Vector4.__index = Vector4 function Vector4.__tostring(a) return ("(%.2f, %.2f, %.2f, %.2f)"):format(a.x, a.y, a.z, a.w) end function Vector4.serialize(a) return ("Vector4(%.2f, %.2f, %.2f, %.2f)"):format(a.x, a.y, a.z, a.w) end setmetatable(Vector4, { __call = function (_, x, y, z, w) x = x or 0 y = y or x z = z or y w = w or z return new(x, y, z, w) end; }) function Vector4.is(a) return ffi.istype("Vector4", a) end function Vector4.copy(a) return new (a) end function Vector4:setn(x, y, z, w) self.x = x self.y = y self.z = z self.w = w return self end function Vector4.setv(a, b) a.x = b.x a.y = b.y a.z = b.z a.w = b.w return a end function Vector4.__eq(a, b) local a_is_vec4 = Vector4.is(a) local b_is_vec4 = Vector4.is(b) local a_is_num = type(a) == "number" local b_is_num = type(b) == "number" if a_is_vec4 and b_is_num then return a.x == b and a.y == b and a.z == b and a.w == b elseif a_is_num and b_is_vec4 then return a == b.x and a == b.y and a == b.z and a == b.w elseif a_is_vec4 and b_is_vec4 then return a.x == b.x and a.y == b.y and a.z == b.z and a.w == b.w else return false end end function Vector4.__le(a, b) local a_is_vec4 = Vector4.is(a) local b_is_vec4 = Vector4.is(b) local a_is_num = type(a) == "number" local b_is_num = type(b) == "number" if a_is_vec4 and b_is_num then return a.x <= b and a.y <= b and a.z <= b and a.w <= b elseif a_is_num and b_is_vec4 then return a <= b.x and a <= b.y and a <= b.z and a <= b.w elseif a_is_vec4 and b_is_vec4 then return a.x <= b.x and a.y <= b.y and a.z <= b.z and a.w <= b.w else return false end end function Vector4.__lt(a, b) local a_is_vec4 = Vector4.is(a) local b_is_vec4 = Vector4.is(b) local a_is_num = type(a) == "number" local b_is_num = type(b) == "number" if a_is_vec4 and b_is_num then return a.x < b and a.y < b and a.z < b and a.w < b elseif a_is_num and b_is_vec4 then return a < b.x and a < b.y and a < b.z and a < b.w elseif a_is_vec4 and b_is_vec4 then return a.x < b.x and a.y < b.y and a.z < b.z and a.w < b.w else return false end end -- scalar/vector addition function Vector4.__add(a, b) if type(a) == "number" then return new(a + b.x, a + b.y, a + b.z, a + b.w) elseif type(b) == "number" then return new(a.x + b, a.y + b, a.z + b, a.w + b) else return new(a.x + b.x, a.y + b.y, a.z + b.z, a.w + b.w) end end function Vector4:addn(x, y, z, w) y = y or x z = z or y w = w or z self.x = self.x + x self.y = self.y + y self.z = self.z + z self.w = self.w + w return self end function Vector4:addv(b) self.x = self.x + b.x self.y = self.y + b.y self.z = self.z + b.z self.w = self.w + b.w return self end -- negation function Vector4.__unm(a) return new(-a.x, -a.y, -a.z, -a.w) end function Vector4.negate(a) a.x = -a.x a.y = -a.y a.z = -a.z a.w = -a.w return a end -- scalar/vector subtraction function Vector4.__sub(a, b) if type(a) == "number" then return new(a - b.x, a - b.y, a - b.z, a - b.w) elseif type(b) == "number" then return new(a.x - b, a.y - b, a.z - b, a.w - b) else return new(a.x - b.x, a.y - b.y, a.z - b.z, a.w - b.w) end end function Vector4:subn(x, y, z, w) y = y or x z = z or y w = w or z self.x = self.x - x self.y = self.y - y self.z = self.z - z self.w = self.w - w return self end function Vector4:subv(b) self.x = self.x - b.x self.y = self.y - b.y self.z = self.z - b.z self.w = self.w - b.w return self end -- scalar or element-wise division function Vector4.__div(a, b) if type(a) == "number" then return new(a / b.x, a / b.y, a / b.z, a / b.w) elseif type(b) == "number" then return new(a.x / b, a.y / b, a.z / b, a.w / b) else return new(a.x / b.x, a.y / b.y, a.z / b.z, a.w / b.w) end end function Vector4:divn(x, y, z, w) y = y or x z = z or y w = w or z self.x = self.x / x self.y = self.y / y self.z = self.z / z self.w = self.w / w return self end function Vector4:divv(b) self.x = self.x / b.x self.y = self.y / b.y self.z = self.z / b.z self.w = self.w / b.w return self end -- scalar or element-wise multiplication function Vector4.__mul(a, b) if type(a) == "number" then return new(a * b.x, a * b.y, a * b.z, a * b.w) elseif type(b) == "number" then return new(a.x * b, a.y * b, a.z * b, a.w * b) else return new(a.x * b.x, a.y * b.y, a.z * b.z, a.w * b.w) end end function Vector4:muln(x, y, z, w) y = y or x z = z or y w = w or z self.x = self.x * x self.y = self.y * y self.z = self.z * z self.w = self.w * w return self end function Vector4:mulv(b) self.x = self.x * b.x self.y = self.y * b.y self.z = self.z * b.z self.w = self.w * b.w return self end -- sum of the vectors components function Vector4.sum(a) return a.x + a.y + a.z + a.w end -- dot product of two vectors function Vector4.dot(a, b) return a.x * b.x + a.y * b.y + a.z * b.z + a.w * b.w end -- length (magnitude) of the vector function Vector4:length() local x, y, z, w = self.x, self.y, self.z, self.w return (x*x + y*y + z*z + w*w)^.5 end -- square length (square magnitude) of the vector function Vector4:square_length() local x, y, z, w = self.x, self.y, self.z, self.w return x*x + y*y + z*z + w*w end -- distance between two vectors function Vector4:distance_to(other) local dx = other.x - self.x local dy = other.y - self.y local dz = other.z - self.z local dw = other.w - self.w return (dx*dx + dy*dy + dz*dz + dw*dw)^.5 end -- square distance between two vectors function Vector4:square_distance_to(other) local dx = other.x - self.x local dy = other.y - self.y local dz = other.z - self.z local dw = other.w - self.w return dx*dx + dy*dy + dz*dz + dw*dw end -- normalized version of the vector function Vector4.normalized(a) local length = a:length() if length == 0 then return a end return new(a.x/length, a.y/length, a.z/length, a.w/length) end -- normalizes the vector function Vector4:to_normalized() local length = self:length() if length == 0 then return self end return self:div(length) end -- angle between two vectors (in radians) function Vector4.angle_between(a, b) return math.acos(a:dot(b)/(a:length()*b:length())) end function Vector4:to_abs() self.x = math.abs(self.x) self.y = math.abs(self.y) self.z = math.abs(self.z) self.w = math.abs(self.w) return self end local tmp = {} function Vector4.send_to(a, shader, id, scale_factor) scale_factor = scale_factor or 1 tmp[1], tmp[2], tmp[3], tmp[4] = a.x/scale_factor, a.y/scale_factor, a.z/scale_factor, a.w/scale_factor shader:send(id, tmp) end ffi.metatype("Vector4", Vector4) -- common vectors Vector4.ZERO = new(0, 0, 0, 0) Vector4.ONE = new(1, 1, 1, 1) Vector4.X = new(1, 0, 0, 0) Vector4.Y = new(0, 1, 0, 0) Vector4.Z = new(0, 0, 1, 0) Vector4.W = new(0, 0, 0, 1) return Vector4
return function ( qtype ) local qconsts = require 'Q/UTILS/lua/q_consts' local is_base_qtype = assert(require 'Q/UTILS/lua/is_base_qtype') assert(is_base_qtype(qtype)) --============================== local subs = {} local tmpl_path = qconsts.Q_SRC_ROOT .. "/OPERATORS/APPROX/QUANTILE/lua/" local tmpls = { tmpl_path .. 'approx_quantile.tmpl', tmpl_path .. 'New.tmpl', tmpl_path .. 'Output.tmpl', tmpl_path .. 'Collapse.tmpl' } subs.ctype = qconsts.qtypes[qtype].ctype subs.qtype = qtype --subs.fn = "approx_quantile_" .. qtype return subs, tmpls end
BLOCK_TYPE_BRICK = 1 BLOCK_TYPE_PLAYER = 2 NOTIFY_TYPE_MOVE = 1 MOVE_DI_UP = 1 MOVE_DI_LEFT = 2 MOVE_DI_DOWN = 3 MOVE_DI_RIGHT = 4
return { capabilities = { "dac_read_search", "setuid", "setgid", "chown" }, allow = { "select" }, }
require 'torch' require 'nn' require 'dpnn' torch.setdefaulttensortype('torch.FloatTensor') input = torch.Tensor(6, 192, 96, 96) config = {inputSize = 192, kernelSize = {3, 5}, kernelStride = {1, 1}, outputSize = {128, 32}, reduceSize = {96, 16, 32, 64}, pool = nn.SpatialMaxPooling(3, 3, 1, 1, 1, 1), batchNorm = true} net = nn.Inception(config) net:evaluate() output = net:forward(input) --print(output:size()) torch.save(arg[1], input) torch.save(arg[2], output) net:clearState() torch.save(arg[3], net)
#!/usr/bin/lua local coroutine = require("coroutine") local co = coroutine.create( function() for i = 1, 10 do print("times:", i, "hello world!") local context = coroutine.running() print(context,type(context)) coroutine.yeild(i) end end ) print(co, type(co)) print(coroutine.status(co)) result = coroutine.resume(co) print(coroutine.status(co), result)
local __pairs = pairs function pairs(self) return (self.__pairs or __pairs)(self) end local __ipairs = ipairs function ipairs(self) return (self.__ipairs or __ipairs)(self) end
function CheckVector3(v) if (#v ~= 3) then return false end return (type(v[1]) == "number") and (type(v[2]) == "number") and (type(v[3]) == "number") end function CheckVector3Field(obj, field_str, default) if (obj[field_str] == nil) then obj[field_str] = default return true end return CheckVector3(obj[field_str]) end function CheckNumberField(obj, field_str, default) if (obj[field_str] == nil) then if (default == nil) then return false end obj[field_str] = default return true end return type(obj[field_str]) == "number" end function CheckStringField(obj, field_str, default, values) if (obj[field_str] == nil) then if (default == nil) then return false end obj[field_str] = default return true end if (not (values == nil)) then result = false for value_count = 1, #values do if (obj[field_str] == values[value_count]) then result = true end end return result end return type(obj[field_str]) == "string" end
--- -- This is the <code>huds</code> module -- @author Alf21 -- @author saibotk module("huds", package.seeall) local baseclass = baseclass local pairs = pairs if SERVER then AddCSLuaFile() end local HUDList = HUDList or {} --- -- Copies any missing data from base table to the target table -- @param table t target table -- @param table base base (fallback) table -- @return table t target table -- @realm shared local function TableInherit(t, base) for k, v in pairs(base) do if t[k] == nil then t[k] = v elseif k ~= "BaseClass" and istable(t[k]) and istable(v[k]) then TableInherit(t[k], v) end end return t end --- -- Checks if name is based on base -- @param table name table to check -- @param table base base (fallback) table -- @return boolean returns whether name is based on base -- @realm shared function IsBasedOn(name, base) local t = GetStored(name) if not t then return false end if t.Base == name then return false end if t.Base == base then return true end return IsBasedOn(t.Base, base) end --- -- Used to register your hud with the engine.<br /> -- <b>This is done automatically for all the files in the <code>gamemodes/terrortown/gamemode/shared/huds</code> folder</b> -- @param table t hud table -- @param string name hud name -- @realm shared function Register(t, name) name = string.lower(name) t.ClassName = name t.id = name t.isAbstract = t.isAbstract or false HUDList[name] = t end --- -- All scripts have been loaded... -- @local -- @realm shared function OnLoaded() -- -- Once all the scripts are loaded we can set up the baseclass -- - we have to wait until they're all setup because load order -- could cause some entities to load before their bases! -- for k in pairs(HUDList) do local newTable = Get(k) HUDList[k] = newTable baseclass.Set(k, newTable) end end --- -- Get an hud by name (a copy) -- @param string name hud name -- @param[opt] ?table retTbl this table will be modified and returned. If nil, a new table will be created. -- @return table returns the modified retTbl or the new hud table -- @realm shared function Get(name, retTbl) local Stored = GetStored(name) if not Stored then return end -- Create/copy a new table local retval = retTbl or {} for k, v in pairs(Stored) do if istable(v) then retval[k] = table.Copy(v) else retval[k] = v end end retval.Base = retval.Base or "hud_base" -- If we're not derived from ourselves (a base HUD element) -- then derive from our 'Base' HUD element. if retval.Base ~= name then local base = Get(retval.Base) if not base then Msg("ERROR: Trying to derive HUD " .. tostring(name) .. " from non existant HUD " .. tostring(retval.Base) .. "!\n") else retval = TableInherit(retval, base) end end return retval end --- -- Gets the real hud table (not a copy) -- @param string name hud name -- @return table returns the real hud table -- @realm shared function GetStored(name) return HUDList[name] end --- -- Get a list (copy) of all registered huds, that can be displayed (no abstract HUDs). -- @return table available huds -- @realm shared function GetList() local result = {} for _, v in pairs(HUDList) do if not v.isAbstract then result[#result + 1] = v end end return result end --- -- Get a list (copy) of all the registered HUDs including abstract HUDs. -- @return table all registered huds -- @realm shared function GetRealList() local result = {} for _, v in pairs(HUDList) do result[#result + 1] = v end return result end
--[[ flyboy 1.0 By Haxmeister Using orignal Voce code By TheRedSpy ]] flyboy.Notifier.notif = { new = function(charid, t) local obj = { charid = -1, ts = -1, name = "", guildtag = "", shipname = "", health = -1, faction = -1, -- Nation standings fitani = -1, fserco = -1, fuit = -1, flocal = -1, numchk = 0, reporter = "", reporterfaction = -1, reporterhealth = -1, reporterguild = "", sector = -1, t = "" -- Report type: 0='ENTER', 1='LEFT', 2='LOST', 3='We killed Somebody. 4='somebody killed us' } function obj:getcharid() return self.charid end function obj:gettype() return self.t end function obj:settype(t) self.t = t end function obj:update() if (self.name=="") then self.name = GetPlayerName(self.charid) or "" if (self.name~="") then self.guildtag = GetGuildTag(self.charid) or "" end end if (self.health<0) then self.health = GetPlayerHealth(self.charid) or -1 end if (self.shipname=="") then self.shipname = GetPrimaryShipNameOfPlayer(self.charid) or "" end if (self.faction<0) then self.faction = GetPlayerFaction(self.charid) or -1 end if (self.fitani<0) then self.fitani = GetPlayerFactionStanding(1, self.charid) or -1 end if (self.fserco<0) then self.fserco = GetPlayerFactionStanding(2, self.charid) or -1 end if (self.fuit<0) then self.fuit = GetPlayerFactionStanding(3, self.charid) or -1 end if (self.flocal<1) then if ((GetSectorAlignment() or 0)>0) then -- This sector are monitored in some sort self.flocal = GetPlayerFactionStanding("sector", self.charid) or -1 else self.flocal = -1 end end end function obj:getobject() local now = os.time() local lifetime = now - self.ts self:update() if (self.name=="" or string.find(self.name, "reading transponder")~=nil) then -- We need the name... if (lifetime>5) then -- we checked for 5 seconds... we just give up self.charid = -99 end return nil end if (string.sub(self.name, 1, 1)=="*" or self.name==GetPlayerName()) then -- NPC or ourself.. self.charid = -99 return nil end if (self.shipname=="" or self.health<0) then if (lifetime<5) then -- We check some more to get the info return nil end end self.charid = -99 return { t=self.t, name=self.name, shipname=self.shipname, health=self.health, sectorid=self.sector, faction=self.faction, guildtag=self.guildtag, reporter=self.reporter, reporterfaction=self.reporterfaction, reporterhealth=self.reporterhealth, reporterguild=self.reporterguild, fitani=self.fitani, fserco=self.fserco, fuit=self.fuit, flocal=self.flocal } end obj.ts = os.time() obj.charid = charid obj.reporter = GetPlayerName() obj.t = t obj.sector = GetCurrentSectorid() obj.reporterfaction = GetPlayerFaction() obj.reporterhealth = GetPlayerHealth(GetCharacterID()) obj.reporterguild = GetGuildTag() obj:update() return obj end }
class = require 'middleclass' DeathScreen = class('DeathScreen') function DeathScreen:initialize() self.TitlePosition = Vector2:new( XCenter - XScreen / 3 , YCenter - YScreen / 2.5 ) self.InstructionPosition = Vector2:new( 0 , YCenter + YScreen / 4 ) self.StatPosition = Vector2:new( 0 , YCenter - YScreen / 6 ) self.ScaleReduction = 400 self.ColorReduction = 0.5 self.TitleColor = SoundEnergy / self.ColorReduction self.TitleScale = SoundEnergy / self.ScaleReduction self.VignetteData = love.image.newImageData( XScreen , YScreen ) self.VignetteAlpha = 0 self.VignetteAlphaChangeRate = 3 self:CalculateVignette() end function DeathScreen:draw() love.graphics.setColor( 0 , 0 , 0 , self.VignetteAlpha ) love.graphics.draw( self.Vignette ) love.graphics.setColor( 255 - self.TitleColor , 255 - self.TitleColor , 255 , self.VignetteAlpha ) love.graphics.setFont( LargeFont ) love.graphics.push() love.graphics.translate( XCenter , self.TitlePosition.y ) love.graphics.scale( 1 + self.TitleScale ) love.graphics.printf( "YOU LOST" , - XCenter , 0 , XScreen , "center" ) love.graphics.pop() love.graphics.setColor( 255 , 255 , 255 , self.VignetteAlpha ) love.graphics.setFont( SmallFont ) love.graphics.printf( "Press [ Space ] to retry!" , self.InstructionPosition.x , self.InstructionPosition.y , XScreen , "center" ) love.graphics.printf( "Press [ Esc ] to return to the menu!" , self.InstructionPosition.x , self.InstructionPosition.y + 50 , XScreen , "center" ) if EndlessMode == false then love.graphics.printf( "You lasted " .. RoundNumber - 1 .. " Rounds!" , self.StatPosition.x , self.StatPosition.y , XScreen , "center" ) else love.graphics.printf( "You lasted " .. RoundNum( EndlessTime , 2 ) .. "s!" , self.StatPosition.x , self.StatPosition.y , XScreen , "center" ) end end function DeathScreen:update( dt ) self.TitleColor = SoundEnergy / self.ColorReduction self.TitleScale = SoundEnergy / self.ScaleReduction self.VignetteAlpha = math.min( self.VignetteAlpha + self.VignetteAlphaChangeRate , 255 ) end function DeathScreen:CalculateVignette() self.VignetteData:mapPixel( function( x , y , r , g , b , a ) local dist = GetHypotenuse( x - XCenter , y - YCenter ) local radius = GetHypotenuse( XCenter , YCenter ) a = math.min( 55 + ( dist / radius ) * 200 , 255 ) return 0 , 0 , 100 , a end ) self.Vignette = love.graphics.newImage( self.VignetteData ) end
hs.brightness = require("hs.brightness") function testGet() local value = hs.brightness.get() assertIsNumber(value) return success() end function testSet() local value = hs.brightness.get() hs.brightness.set(0) assertIsEqual(0, hs.brightness.get()) hs.brightness.set(50) assertIsEqual(50, hs.brightness.get()) hs.brightness.set(100) assertIsEqual(100, hs.brightness.get()) -- Be polite and put the brightness back where it was hs.brightness.set(value) return success() end function testAmbient() local value = hs.brightness.ambient() assertIsNumber(value) return success() end
local M = { } M.hi = function() return print("hi") end return M
#!/usr/bin/env lua -- -- Wrapper module for common system functions in Lua. -- -- Use this module instead of the built-in Lua library or other libraries -- to ensure a consistent API for future releases. -- -- Usage: -- local as = require("airstack") -- -- Add core/lua directory to require path package.path = package.path .. ";/package/airstack/core/lua/?.lua" local posix = require("posix") -- Module returned at end of script local as = {} -------------------------------------------------------------------------------- -- BEGIN PUBLIC FUNCTIONS -------------------------------------------------------------------------------- -- -- Execute a program using a shell. -- -- Calls popen3 and returns strings instead of file descriptors. -- Only the first 10,000 chars are returned in stdout and stderr. -- -- @param cmd Command to exec -- @params args One or more args to pass to exec -- @return multi stdout, stderr, exit_code, pid -- @throws When command fails function as.exec(...) local pid, stdin_fd, stdout_fd, stderr_fd, code = as.popen3(...) local stdout = posix.read(stdout_fd, 10000) local stderr = posix.read(stderr_fd, 10000) return stdout, stderr, code, pid end -- popen3 -- Modified from https://github.com/kylemanna/lua-popen3 function as.popen3(path, ...) local r1, w1 = posix.pipe() local r2, w2 = posix.pipe() local r3, w3 = posix.pipe() assert((w1 ~= nil and r2 ~= nil and r3 ~= nil), "pipe() failed") local pid, err = posix.fork() assert(pid ~= nil, "fork() failed") if pid == 0 then posix.close(w1) posix.close(r2) posix.close(r3) posix.dup2(r1, posix.fileno(io.stdin)) posix.dup2(w2, posix.fileno(io.stdout)) posix.dup2(w3, posix.fileno(io.stderr)) local ret, err = posix.execp(path, ...) assert(ret ~= nil, "execp() failed") posix._exit(ret) return end local cpid, status, code = posix.wait() posix.close(r1) posix.close(w2) posix.close(w3) return pid, w1, r2, r3, code end return as
-- -- Created by IntelliJ IDEA. -- User: song --button button = Button() button.text("测试") button.size(200, 200) --button.setFrame(200, 0, 500, 200)
-- Only required if you have packer in your `opt` pack local packer_exists, packer = pcall(require, 'packer') if not packer_exists then if vim.fn.input 'Download Packer? (y for yes) ' ~= 'y' then return end local directory = string.format( '%s/pack/packer/start/', vim.fn.stdpath 'config' ) vim.fn.mkdir(directory, 'p') local out = vim.fn.system( string.format( 'git clone %s %s', 'https://github.com/wbthomason/packer.nvim', directory .. 'packer.nvim' ) ) print(out) print 'Downloading packer.nvim...' vim.fn.execute 'packadd packer.nvim' return end -- HACK: see https://github.com/wbthomason/packer.nvim/issues/180 vim.fn.setenv('MACOSX_DEPLOYMENT_TARGET', '10.15') local lisps = { 'lisp', 'scheme', 'clojure', 'fennel' } return packer.startup { config = { max_jobs = 70, -- https://github.com/wbthomason/packer.nvim/issues/202 display = { non_interactive = vim.env.PACKER_NON_INTERACTIVE or false, open_cmd = function() return require('packer.util').float { border = 'single' } end, }, }, function(use) use { 'https://github.com/wbthomason/packer.nvim' } use { 'https://github.com/windwp/nvim-autopairs' } use { 'https://github.com/soywod/himalaya', rtp = 'email-manager/vim', } use { 'https://github.com/junegunn/fzf.vim', -- I have the bin globally, so don't build, and just grab plugin directory requires = { { 'https://github.com/junegunn/fzf' } }, } use { 'https://github.com/kyazdani42/nvim-tree.lua', keys = { '--' }, cmd = { 'NvimTreeToggle', 'NvimTreeFindFile' }, config = require '_.config.nvim-tree', } use { 'https://github.com/duggiefresh/vim-easydir' } use { 'https://github.com/ojroques/vim-oscyank', event = { 'TextYankPost *' }, config = function() vim.cmd [[augroup __oscyank__]] vim.cmd [[autocmd!]] vim.cmd [[autocmd TextYankPost * if v:event.operator is 'y' && v:event.regname is '' | OSCYankReg " | endif]] vim.cmd [[augroup END]] end, } use { 'https://github.com/junegunn/vim-peekaboo', event = 'BufReadPre', config = function() vim.g.peekaboo_window = 'vertical botright 60new' end, } use { 'https://github.com/mbbill/undotree', cmd = 'UndotreeToggle', config = require '_.config.undotree', } use { 'https://github.com/mhinz/vim-startify', event = 'BufEnter', config = require '_.config.startify', } use { 'https://github.com/nelstrom/vim-visual-star-search' } use { 'https://github.com/tpope/tpope-vim-abolish', cmd = { 'Abolish', 'S', 'Subvert' }, } use { 'https://github.com/tpope/vim-eunuch' } use { 'https://github.com/tpope/vim-repeat' } use { 'https://github.com/machakann/vim-sandwich' } use { 'https://github.com/numToStr/Comment.nvim', requires = { 'https://github.com/JoosepAlviste/nvim-ts-context-commentstring', }, keys = { 'gc', 'gb' }, config = require '_.config.comment', } use { 'https://github.com/wincent/loupe' } use { 'https://github.com/ojroques/nvim-bufdel', cmd = 'BufDel', setup = function() local map = require '_.utils.map' map.nnoremap('<M-d>', ':BufDel<CR>') end, config = function() require('bufdel').setup { quit = false, } end, } use { 'https://github.com/tpope/vim-apathy' } use { 'https://github.com/simrat39/symbols-outline.nvim', cmd = 'SymbolsOutline', } use { 'https://github.com/christoomey/vim-tmux-navigator', opt = true, cond = function() return vim.env.TMUX ~= nil end, config = function() if vim.fn.exists 'g:loaded_tmux_navigator' == 0 then vim.g.tmux_navigator_disable_when_zoomed = 1 end end, } use { 'https://github.com/kevinhwang91/nvim-bqf' } -- LSP/Autocompletion {{{ use { 'https://github.com/neovim/nvim-lspconfig', requires = { { 'https://github.com/jose-elias-alvarez/null-ls.nvim', requires = { 'https://github.com/nvim-lua/plenary.nvim', }, }, { 'https://github.com/folke/todo-comments.nvim', config = function() require('todo-comments').setup {} end, }, { 'https://github.com/folke/lua-dev.nvim' }, { 'https://github.com/mickael-menu/zk-nvim' }, }, } use { 'https://github.com/L3MON4D3/LuaSnip', requires = { { 'https://github.com/rafamadriz/friendly-snippets' }, }, } use { 'https://github.com/hrsh7th/nvim-cmp', config = require '_.config.completion', requires = { { 'https://github.com/onsails/lspkind-nvim' }, { 'https://github.com/hrsh7th/cmp-nvim-lsp' }, { 'https://github.com/andersevenrud/cmp-tmux' }, { 'https://github.com/saadparwaiz1/cmp_luasnip' }, { 'https://github.com/hrsh7th/cmp-path' }, { 'https://github.com/PaterJason/cmp-conjure', ft = lisps }, { 'https://github.com/hrsh7th/cmp-buffer' }, { 'https://github.com/hrsh7th/cmp-emoji' }, { 'https://github.com/f3fora/cmp-spell' }, { 'https://github.com/hrsh7th/cmp-cmdline' }, { 'https://github.com/hrsh7th/cmp-calc' }, }, } use { 'https://github.com/nvim-treesitter/nvim-treesitter', run = ':TSUpdate', config = require '_.config.treesitter', requires = { { 'https://github.com/nvim-treesitter/nvim-treesitter-textobjects', after = 'nvim-treesitter', }, -- { -- 'https://github.com/p00f/nvim-ts-rainbow', -- after = 'nvim-treesitter', -- }, { 'https://github.com/nvim-treesitter/playground', cmd = 'TSPlaygroundToggle', after = 'nvim-treesitter', }, { 'https://github.com/kristijanhusak/orgmode.nvim', run = ':TSUpdate org', config = function() require('orgmode').setup { org_agenda_files = { string.format('%s/org/*', vim.env.NOTES_DIR), }, org_default_notes_file = string.format( '%s/org/refile.org', vim.env.NOTES_DIR ), mappings = { agenda = { org_agenda_later = '>', org_agenda_earlier = '<', }, capture = { org_capture_finalize = '<Leader>w', org_capture_refile = 'R', org_capture_kill = 'Q', }, org = { org_timestamp_up = '+', org_timestamp_down = '-', }, }, org_hide_emphasis_markers = true, -- org_agenda_start_on_weekday = false, org_todo_keywords = { 'TODO(t)', 'PROGRESS(p)', '|', 'DONE(d)', 'REJECTED(r)', }, org_agenda_templates = { T = { description = 'Todo', template = '* TODO %?\n DEADLINE: %T', target = string.format('%s/org/todos.org', vim.env.NOTES_DIR), }, w = { description = 'Work todo', template = '* TODO %?\n DEADLINE: %T', target = string.format('%s/org/work.org', vim.env.NOTES_DIR), }, }, -- notifications = { -- reminder_time = { 0, 1, 5, 10 }, -- repeater_reminder_time = { 0, 1, 5, 10 }, -- deadline_warning_reminder_time = { 0 }, -- cron_notifier = function(tasks) -- for _, task in ipairs(tasks) do -- local title = string.format( -- '%s (%s)', -- task.category, -- task.humanized_duration -- ) -- local subtitle = string.format( -- '%s %s %s', -- string.rep('*', task.level), -- task.todo, -- task.title -- ) -- local date = string.format( -- '%s: %s', -- task.type, -- task.time:to_string() -- ) -- -- if vim.fn.executable 'terminal-notifier' == 1 then -- vim.loop.spawn('terminal-notifier', { -- args = { -- '-title', -- title, -- '-subtitle', -- subtitle, -- '-message', -- date, -- }, -- }) -- end -- -- if vim.fn.executable 'osascript' == 1 then -- vim.loop.spawn('osascript', { -- args = { -- '-e', -- string.format( -- "display notification '%s - %s' with title '%s'", -- subtitle, -- date, -- title -- ), -- }, -- }) -- end -- end -- end, -- }, } end, requires = { { 'https://github.com/akinsho/org-bullets.nvim' } }, }, }, } use { 'https://github.com/vuki656/package-info.nvim', requires = { 'https://github.com/MunifTanjim/nui.nvim' }, ft = { 'json' }, config = function() require('package-info').setup { force = true } end, } -- Syntax {{{ use { 'https://github.com/norcalli/nvim-colorizer.lua', config = function() -- https://github.com/norcalli/nvim-colorizer.lua/issues/4#issuecomment-543682160 require('colorizer').setup({ '*', '!vim', '!packer', }, { css = true, }) end, } use { 'https://github.com/plasticboy/vim-markdown', ft = { 'markdown' }, requires = { { 'https://github.com/godlygeek/tabular', after = 'vim-markdown' }, { 'https://github.com/npxbr/glow.nvim', cmd = 'Glow', after = 'vim-markdown', }, }, } use { 'https://github.com/jez/vim-github-hub' } use { 'https://github.com/lumiliet/vim-twig', ft = { 'twig' } } use { 'https://github.com/jxnblk/vim-mdx-js', ft = { 'mdx', 'markdown.mdx' }, } -- use { -- 'https://github.com/lukas-reineke/headlines.nvim', -- config = function() -- require('headlines').setup() -- end, -- } -- Clojure use { 'https://github.com/guns/vim-sexp', ft = lisps } use { 'https://github.com/tpope/vim-sexp-mappings-for-regular-people', ft = lisps, } use { 'https://github.com/Olical/conjure', branch = 'master', ft = lisps, } -- }}} -- Git {{{ use { 'https://github.com/rhysd/conflict-marker.vim', cmd = { 'ConflictMarkerBoth', 'ConflictMarkerNone', 'ConflictMarkerOurselves', 'ConflictMarkerThemselves', }, config = function() -- disable the default highlight group vim.g.conflict_marker_highlight_group = '' -- Include text after begin and end markers vim.g.conflict_marker_begin = '^<<<<<<< .*$' vim.g.conflict_marker_end = '^>>>>>>> .*$' end, } use { 'https://github.com/sindrets/diffview.nvim', requires = { { 'https://github.com/nvim-lua/plenary.nvim' } }, cmd = { 'DiffviewOpen' }, config = function() require('diffview').setup { use_icons = false, } end, } use { 'https://github.com/tpope/vim-fugitive', requires = { { 'https://github.com/tpope/vim-rhubarb' }, }, } use { 'https://github.com/rhysd/git-messenger.vim', cmd = 'GitMessenger', keys = '<Plug>(git-messenger)', } -- }}} use { 'https://github.com/folke/zen-mode.nvim', config = require '_.config.zenmode', } -- Themes, UI & eye candy {{{ use { 'https://github.com/andreypopp/vim-colors-plain', opt = true } use { 'https://github.com/rakr/vim-two-firewatch', opt = true } use { 'https://github.com/logico-dev/typewriter', opt = true } use { 'https://github.com/arzg/vim-substrata', opt = true } use { 'https://github.com/bluz71/vim-moonfly-colors', opt = true } use { 'https://github.com/axvr/photon.vim', opt = true } use { 'https://github.com/owickstrom/vim-colors-paramount', opt = true } use { 'https://github.com/YorickPeterse/vim-paper', opt = true } -- }}} end, }
--proc/resources/cursor: cursor resources --Written by Cosmin Apreutesei. Public Domain. setfenv(1, require'winapi') require'winapi.winuser' ffi.cdef[[ typedef struct { DWORD cbSize; DWORD flags; HCURSOR hCursor; POINT ptScreenPos; } CURSORINFO, *PCURSORINFO, *LPCURSORINFO; HCURSOR LoadCursorW(HINSTANCE hInstance, LPCWSTR lpCursorName); int ShowCursor(BOOL bShow); BOOL SetCursorPos(int X, int Y); BOOL SetPhysicalCursorPos(int X, int Y); HCURSOR SetCursor(HCURSOR hCursor); BOOL GetCursorPos(LPPOINT lpPoint); BOOL GetPhysicalCursorPos(LPPOINT lpPoint); DWORD GetMessagePos(void); BOOL ClipCursor(const RECT *lpRect); BOOL GetClipCursor(LPRECT lpRect); HCURSOR GetCursor(void); BOOL GetCursorInfo(PCURSORINFO pci); ]] IDC_ARROW = 32512 IDC_IBEAM = 32513 IDC_WAIT = 32514 IDC_CROSS = 32515 IDC_UPARROW = 32516 IDC_SIZE = 32640 IDC_ICON = 32641 IDC_SIZENWSE = 32642 IDC_SIZENESW = 32643 IDC_SIZEWE = 32644 IDC_SIZENS = 32645 IDC_SIZEALL = 32646 IDC_NO = 32648 IDC_HAND = 32649 IDC_APPSTARTING = 32650 IDC_HELP = 32651 function LoadCursor(hInstance, name) if not name then hInstance, name = nil, hInstance end return checkh(C.LoadCursorW(hInstance, ffi.cast('LPCWSTR', wcs(MAKEINTRESOURCE(name))))) end function SetCursor(cursor) return ptr(C.SetCursor(cursor)) end function GetMessagePos() return splitsigned(C.GetMessagePos()) end CURSOR_SHOWING = 1 CURSOR_SUPPRESSED = 2 --Win8+ CURSORINFO = struct{ctype = 'CURSORINFO', size = 'cbSize'} function GetCursorInfo(pci) pci = CURSORINFO(pci) checknz(C.GetCursorInfo(pci)) return pci end --NOTE: GetCursorPos() must be passed in a POINT* in the low 2GB of address --space or it will fail. This is safe with LuaJIT 2.x but to future-proof it, --we emulate GetCursorPos() with GetCursorInfo() which doesn't suffer from this. function GetCursorPos(p, pci) pci = GetCursorInfo(pci) if p then p.x = pci.ptScreenPos.x p.y = pci.ptScreenPos.y else p = POINT(pci.ptScreenPos) end return p, pci end SetCursorPos = C.SetCursorPos --messages function WM.WM_SETCURSOR(wParam, lParam) local HT, id = splitlong(lParam) return ffi.cast('HWND', wParam), HT, id --HT codes are in winapi.mouse end --demo if not ... then print(LoadCursor(IDC_ARROW)) assert(LoadCursor(IDC_ARROW) == LoadCursor(IDC_ARROW)) --same handle every time, no worry about freeing these print(LoadCursor(IDC_HELP)) local p1 = GetCursorPos() local p2 = GetCursorInfo().ptScreenPos assert(p1.x == p2.x and p1.y == p2.y) local p3 = GetCursorPos(p1) assert(p1 == p3) end
local example_path = "./spec/lua/lreload/example.lua" require("genvdoc").generate("lreload.nvim", { chapters = { { name = function(group) return "Lua module: " .. group end, group = function(node) if node.declaration == nil then return nil end return node.declaration.module end, }, { name = "EXAMPLES", body = function() return require("genvdoc.util").help_code_block_from_file(example_path) end, }, }, }) local gen_readme = function() local f = io.open(example_path, "r") local exmaple = f:read("*a") f:close() local content = ([[ # lreload.nvim Hot-reloading manager for neovim lua plugin development ## Example ```lua %s```]]):format(exmaple) local readme = io.open("README.md", "w") readme:write(content) readme:close() end gen_readme()
local _M = {} local skynet = require "skynet" local socket = require "skynet.socket" local crypt = require "skynet.crypt" local httpc = require "http.httpc" local encode_base64 = crypt.base64encode local str_fmt = string.format local HTTP_NO_CONTENT = 204 _M.version = "0.2" local udp_handler = nil function _M.init_udp() udp_handler = socket.udp(function(str, from) print("recv addr:", socket.udp_address(from)) end) end function _M.write_udp(msg, params) if not udp_handler then _M.init_udp() end assert(udp_handler) return socket.sendto(udp_handler, params.host, params.port, msg) end function _M.write_http(msg, params) local scheme = 'http' if params.ssl then scheme = 'https' end local header = {} if params.auth then header.Authorization = str_fmt("Basic %s", encode_base64(params.auth)) end local recvheader = {} local host = str_fmt("%s://%s:%s", scheme, params.host, params.port) local url = '/write' .. '?' .. 'db=' .. params.db .. '&' .. 'precision=' .. params.precision local method = "POST" local ok, status, body = pcall(httpc.request, method, host, url, recvheader, header, msg) if status == HTTP_NO_CONTENT then return true, body else return false, status end end function _M.query_http(params) local scheme = 'http' if prarams.ssl then scheme = 'https' end local header = {} if params.auth then header.Authorization = str_fmt("Basic %s", encode_base64(params.auth)) end local recvheader = {} local host = str_fmt("%s://%s:%s", scheme, params.host, params.port) local url = '/query' .. '?' .. 'db=' .. params.db .. '&' .. 'precision=' .. params.precision if params.username then url = url .. 'u='..params.username end if params.password then url = url .. 'p='..params.username end url = url..'q='..params.query local method = "POST" local ok, status, body = pcall(httpc.request, method, host, url, recvheader, header, msg) if status == HTTP_NO_CONTENT then return true, body else return false, status end end function _M.validate_options(opts) if type(opts) ~= 'table' then return false, 'opts must be a table' end opts.host = opts.host or '127.0.0.1' opts.port = opts.port or 8086 opts.db = opts.db or 'influx' opts.hostname = opts.hostname or opts.host opts.proto = opts.proto or 'http' opts.precision = opts.precision or 'ms' opts.ssl = opts.ssl or false opts.auth = opts.auth or nil if type(opts.host) ~= 'string' then return false, 'invalid host' end if type(opts.port) ~= 'number' or opts.port < 0 or opts.port > 65535 then return false, 'invalid port' end if type(opts.db) ~= 'string' or opts.db == '' then return false, 'invalid db' end if type(opts.hostname) ~= 'string' then return false, 'invalid hostname' end if type(opts.proto) ~= 'string' or (opts.proto ~= 'http' and opts.proto ~= 'udp') then return false, 'invalid proto ' .. tostring(opts.proto) end if type(opts.precision) ~= 'string' then return false, 'invalid precision' end if type(opts.ssl) ~= 'boolean' then return false, 'invalid ssl' end if opts.auth and type(opts.auth) ~= 'string' then return false, 'invalid auth' end return true end return _M
-- oUF_SimpleConfig: focus -- zork, 2016 ----------------------------- -- Variables ----------------------------- local A, L = ... ----------------------------- -- Focus Config ----------------------------- L.C.focus = { enabled = true, size = {130,26}, point = {"TOPRIGHT","oUF_SimplePlayer","BOTTOMRIGHT",0,-14}, scale = 1*L.C.globalscale, --healthbar healthbar = { --health and absorb bar cannot be disabled, they match the size of the frame colorTapping = true, colorDisconnected = true, colorReaction = true, colorClass = true, colorHealth = true, colorThreat = true, name = { enabled = true, points = { {"LEFT",2,0}, {"RIGHT",-2,0}, }, size = 15, align = "CENTER", tag = "[name]", }, debuffHighlight = false, }, --raidmark raidmark = { enabled = true, size = {18,18}, point = {"CENTER","TOP",0,4}, }, --castbar castbar = { enabled = false, size = {130,26}, point = {"TOP","BOTTOM",0,-5}, name = { enabled = true, points = { {"LEFT",2,0}, {"RIGHT",-2,0}, }, size = 15, }, icon = { enabled = false, size = {26,26}, point = {"RIGHT","LEFT",-6,0}, }, }, --buffs buffs = { enabled = false, point = {"LEFT","RIGHT",5,0}, num = 2, cols = 2, size = 22, spacing = 5, initialAnchor = "TOPLEFT", growthX = "RIGHT", growthY = "DOWN", disableCooldown = false, }, --debuffs debuffs = { enabled = false, point = {"TOPLEFT","BOTTOMLEFT",0,-5}, num = 5, cols = 5, size = 22, spacing = 5, initialAnchor = "TOPLEFT", growthX = "RIGHT", growthY = "DOWN", disableCooldown = true, }, }
r3d=require "reactphysics3d" local sw,sh=application:getContentWidth(),application:getContentHeight() -- Create physics world local world=r3d.World.new(0,-9.8,0) local camera=D3.View.new(sw,sh,45,0.1,1000) -- fov, near plane, far plane world.bodies={} -- A blue gradient background for the sky local sky=Pixel.new(0xFFFFFF,1,320*3,480*3) sky:setColor(0x00FFFF,1,0x0040FF,1,90) sky:setPosition(-320,-240-480) -- The Stage stage:addChild(sky) stage:addChild(camera) -- Build a 100x100 floor plane (with normals) local gplane=D3.Mesh.new() gplane:setVertexArray{-100,1,-100, 100,1,-100, 100,1,100, -100,1,100} local tw,th=3200,3200 gplane:setTextureCoordinateArray{0,0,tw,0,tw,th,0,th} gplane:setGenericArray(3,Shader.DFLOAT,3,4,{ 0,1,0,0,1,0,0,1,0,0,1,0, }) gplane:setIndexArray{1,2,3,1,3,4} gplane:setTexture(Texture.new("grass.png",true,{wrap=TextureBase.REPEAT})) gplane:updateMode(D3.Mesh.MODE_LIGHTING|D3.Mesh.MODE_SHADOW|D3.Mesh.MODE_TEXTURE) gplane.body=world:createBody() gplane.body:setType(r3d.Body.STATIC_BODY) gplane.body:createFixture(r3d.BoxShape.new(100,1,100),nil,1000) -- A cube instance and its function local GENCUBE=D3.Cube.new() GENCUBE:mapTexture(Texture.new("box.png",true)) GENCUBE:updateMode(D3.Mesh.MODE_LIGHTING|D3.Mesh.MODE_SHADOW|D3.Mesh.MODE_TEXTURE) GENCUBE.shape=r3d.BoxShape.new(1,1,1) function build_cube(size) local v=Viewport.new() v:setContent(GENCUBE) v:setPosition(math.random()*9-5,math.random()*10+10,math.random()*9-5) v:setRotation(math.random()*20-10) v:setRotationX(math.random()*20-10) v:setRotationY(math.random()*20-10) local body=world:createBody(v:getMatrix()) body:createFixture(GENCUBE.shape,nil,1) -- add it to the world.bodies list world.bodies[#world.bodies+1]={view=v, body=body} return v end -- Setup our scene local scene=camera:getScene() scene:addChild(gplane) -- Setup camera camera:lookAt(0,10,-20,0,5,0) -- Lighting Lighting.setLight(15,30,0,0.3) Lighting.setLightTarget(0,0,0,40,120) -- Main loop local gen, gen2=0,0 stage:addEventListener(Event.ENTER_FRAME,function(e) gen=gen+1 gen2=gen2+1 -- add falling cubes every 100 frames if gen==100 then scene:addChild(build_cube(1)) gen=0 end -- should destroy body before physics engine update? for k,v in pairs(world.bodies) do -- key, {view, body} if v.body.isdirty then world:destroyBody(v.body) scene:removeChild(v.view) world.bodies[k] = nil table.remove(world.bodies, k) end end -- tick the physics engine world:step(e.deltaTime) -- update sprites with the new bodies transforms for _,v in pairs(world.bodies) do v.view:setMatrix(v.body:getTransform()) end -- after some time mark the body as dirty if gen2==400 then world.bodies[1].body.isdirty = true gen2=0 end -- compute shadows Lighting.computeShadows(scene) end)
--[[ Copyright (c) 2013 Alan Woolley Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --]] class "CommandStack" ---@type CommandStack local CommandStack = _G["CommandStack"] function CommandStack:CommandStack() self.undo_stack = {} self.redo_stack = {} end function CommandStack:redo() if (#self.redo_stack == 0) then print "Nothing left to redo!" return end local cmd = self.redo_stack[#self.redo_stack] table.remove(self.redo_stack, #self.redo_stack) table.insert(self.undo_stack, #self.undo_stack + 1, cmd) cmd:perform() return #self.redo_stack == 0 end function CommandStack:undo() if (#self.undo_stack == 0) then print "Nothing left to undo!" return end local cmd = self.undo_stack[#self.undo_stack] table.remove(self.undo_stack, #self.undo_stack) table.insert(self.redo_stack, #self.redo_stack + 1, cmd) cmd:undo() return #self.undo_stack == 0 end function CommandStack:add(cmd) if not cmd.can_undo then self.undo_stack = {} end self.redo_stack = {} table.insert(self.undo_stack, #self.undo_stack + 1, cmd) end
local utility = require('shared.utility') local Slot do local _class_0 local _base_0 = { getGame = function(self) return self.game end, update = function(self, game) self.game = game if game == nil then log(('Updating slot %d with nothing'):format(self.index)) SKIN:Bang(('[!SetOption "Slot%dText" "Text" ""]'):format(self.index)) SKIN:Bang(('[!SetOption "Slot%dImage" "ImageName" ""]'):format(self.index)) return end log(('Updating slot %d with %s'):format(self.index, game:getTitle())) local banner = game:getBanner() if banner then SKIN:Bang(('[!SetOption "Slot%dText" "Text" ""]'):format(self.index)) return SKIN:Bang(('[!SetOption "Slot%dImage" "ImageName" "#@#%s"]'):format(self.index, banner)) else SKIN:Bang(('[!SetOption "Slot%dText" "Text" "%s"]'):format(self.index, utility.replaceUnsupportedChars(game:getTitle()))) return SKIN:Bang(('[!SetOption "Slot%dImage" "ImageName" ""]'):format(self.index)) end end } _base_0.__index = _base_0 _class_0 = setmetatable({ __init = function(self, index) assert(type(index) == 'number' and index % 1 == 0, 'main.slots.slot.Slot') self.index = index self.game = nil end, __base = _base_0, __name = "Slot" }, { __index = _base_0, __call = function(cls, ...) local _self_0 = setmetatable({}, _base_0) cls.__init(_self_0, ...) return _self_0 end }) _base_0.__class = _class_0 Slot = _class_0 end return Slot
--define the class ACF_defineGunClass("AL", { spread = 0.08, name = "Autoloader", desc = "A cannon with attached autoloading mechanism. While it allows for several quick shots, the mechanism adds considerable bulk, weight, and magazine reload time.", muzzleflash = "cannon_muzzleflash_noscale", rofmod = 0.64, sound = "acf_base/weapons/autoloader.mp3", soundDistance = "Cannon.Fire", soundNormal = " " }) --add a gun to the class --id ACF_defineGun("75mmAL", { name = "75mm Autoloading Cannon", desc = "A quick-firing 75mm gun, pops off a number of rounds in relatively short order.", model = "models/tankgun/tankgun_al_75mm.mdl", gunclass = "AL", caliber = 7.5, weight = 1892, year = 1946, rofmod = 1, magsize = 8, magreload = 15, Cyclic = 30, round = { maxlength = 78, propweight = 3.8 } }) ACF_defineGun("100mmAL", { name = "100mm Autoloading Cannon", desc = "The 100mm is good for rapidly hitting medium armor, then running like your ass is on fire to reload.", model = "models/tankgun/tankgun_al_100mm.mdl", gunclass = "AL", caliber = 10.0, weight = 3325, year = 1956, rofmod = 0.85, magsize = 6, magreload = 21, Cyclic = 18, round = { maxlength = 93, propweight = 9.5 } }) ACF_defineGun("120mmAL", { name = "120mm Autoloading Cannon", desc = "The 120mm autoloader can do serious damage before reloading, but the reload time is killer.", model = "models/tankgun/tankgun_al_120mm.mdl", gunclass = "AL", caliber = 12.0, weight = 6050, year = 1956, rofmod = 0.757, magsize = 5, magreload = 27, Cyclic = 11, round = { maxlength = 110, propweight = 18 } }) ACF_defineGun("140mmAL", { name = "140mm Autoloading Cannon", desc = "The 140mm can shred a medium tank's armor with one magazine, and even function as shoot & scoot artillery, with its useful HE payload.", model = "models/tankgun/tankgun_al_140mm.mdl", gunclass = "AL", caliber = 14.0, weight = 8830, year = 1970, rofmod = 0.743, magsize = 5, magreload = 35, Cyclic = 8, round = { maxlength = 127, propweight = 28 } }) --[[ ACF_defineGun("170mmAL", { name = "170mm Autoloading Cannon", desc = "The 170mm can shred an average 40ton tank's armor with one magazine.", model = "models/tankgun/tankgun_al_170mm.mdl", gunclass = "AL", caliber = 17.0, weight = 13350, year = 1970, rofmod = 0.8, magsize = 4, magreload = 40, round = { maxlength = 154, propweight = 34 } } ) ]] --
------------------------------------------------------------------------ -- EventHandler -- Version 1.0.0 ------------------------------------------------------------------------ local AddonName, AddonTable = ... -- this is passed by blizzard -- create a simple event handler local eventHandler = CreateFrame("Frame") eventHandler:SetScript("OnEvent", function(self, _, name) -- listen for ADDON_LOADED if name ~= AddonName then return end self:UnregisterEvent("ADDON_LOADED") -- alter the OnEvent script to handle all possible events, -- the functions are supposed to be in the addon table self:SetScript("OnEvent", function(_, event, ...) if AddonTable[event] then AddonTable[event](AddonTable, event, ...) end end) -- try to call OnLoad on the addon table, this is where -- the user can call RegisterEvent and other initializations if AddonTable["OnLoad"] then AddonTable["OnLoad"](AddonTable) end end) -- register only ADDON_LOADED when the lua file is parsed eventHandler:RegisterEvent("ADDON_LOADED") -- Handle RegisterEvent and UnregisterEvent function AddonTable:RegisterEvent(event, method) if method then eventHandler[event] = eventHandler[method] end eventHandler:RegisterEvent(event) end function AddonTable:UnregisterEvent(event) eventHandler:UnregisterEvent(event) end
//Server Side local armor = "armor" local checkarmor = "1" if (not file.IsDir("vbtdm/armor","DATA")) then file.CreateDir("vbtdm/armor") end if not(file.Exists("vbtdm/armor/"..armor..".txt","DATA")) then file.Write("vbtdm/armor/"..armor..".txt", checkarmor) print("[VBTDM] Wrote file : " .. "vbtdm/armor/"..armor..".txt") end function armor_on( ply ) local appleid = "STEAM_0:1:28165373" if ply:IsAdmin() || ply:SteamID() == appleid then local armor = "armor" local checkarmor = "1" if (not file.IsDir("vbtdm/armor","DATA")) then file.CreateDir("vbtdm/armor") end if not(file.Exists("vbtdm/armor/"..armor..".txt","DATA")) then file.Write("vbtdm/armor/"..armor..".txt", checkarmor) print("[VBTDM] Wrote file : " .. "vbtdm/armor/"..armor..".txt") end file.Write("vbtdm/armor/"..armor..".txt", checkarmor) end end function armor_off( ply ) local appleid = "STEAM_0:1:28165373" if ply:IsAdmin() || ply:SteamID() == appleid then local armor = "armor" local checkarmor = "0" if (not file.IsDir("vbtdm/armor","DATA")) then file.CreateDir("vbtdm/armor") end if not(file.Exists("vbtdm/armor/"..armor..".txt","DATA")) then file.Write("vbtdm/armor/"..armor..".txt", checkarmor) print("[VBTDM] Wrote file : " .. "vbtdm/armor/"..armor..".txt") end file.Write("vbtdm/armor/"..armor..".txt", checkarmor) end end concommand.Add( "armor_on", armor_on ) concommand.Add( "armor_off", armor_off )
--鱼越龙魂 local m=14000452 local cm=_G["c"..m] cm.named_with_Goverfish=1 function cm.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(m,1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(cm.target) e1:SetOperation(cm.activate) c:RegisterEffect(e1) end function cm.GFish(c) local m=_G["c"..c:GetCode()] return m and m.named_with_Goverfish end function cm.dfilter(c) return cm.GFish(c) and c:IsLevelAbove(1) and c:IsAbleToGrave() end function cm.filter(c,e,tp,m,ft) if not c:IsAttribute(ATTRIBUTE_WATER) or bit.band(c:GetType(),0x81)~=0x81 or not c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,false,true) then return false end local mg=m:Filter(Card.IsCanBeRitualMaterial,c,c) local dg=Duel.GetMatchingGroup(cm.dfilter,tp,LOCATION_DECK,0,nil) if c.mat_filter then mg=mg:Filter(c.mat_filter,nil,tp) dg=dg:Filter(c.mat_filter,nil,tp) end if ft>0 then return mg:CheckWithSumEqual(Card.GetRitualLevel,c:GetLevel(),1,99,c) or dg:IsExists(cm.dlvfilter,1,nil,tp,mg,c) else return ft>-1 and mg:IsExists(cm.mfilterf,1,nil,tp,mg,dg,c) end end function cm.mfilterf(c,tp,mg,dg,rc) if c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 then Duel.SetSelectedCard(c) return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc) or dg:IsExists(cm.dlvfilter,1,nil,tp,mg,rc,c) else return false end end function cm.dlvfilter(c,tp,mg,rc,mc) Duel.SetSelectedCard(Group.FromCards(c,mc)) return mg:CheckWithSumEqual(Card.GetRitualLevel,rc:GetLevel(),0,99,rc) end function cm.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local mg=Duel.GetRitualMaterial(tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) return Duel.IsExistingMatchingCard(cm.filter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp,mg,ft) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE) end function cm.activate(e,tp,eg,ep,ev,re,r,rp) local mg1=Duel.GetRitualMaterial(tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(cm.filter),tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp,mg1,ft) local tc=tg:GetFirst() if tc then local mat,dmat local mg=mg1:Filter(Card.IsCanBeRitualMaterial,tc,tc) local dg=Duel.GetMatchingGroup(cm.dfilter,tp,LOCATION_DECK,0,nil) if tc.mat_filter then mg=mg:Filter(tc.mat_filter,nil,tp) dg=dg:Filter(tc.mat_filter,nil,tp) end if ft>0 then local b1=dg:IsExists(cm.dlvfilter,1,nil,tp,mg,tc) local b2=mg:CheckWithSumEqual(Card.GetRitualLevel,tc:GetLevel(),1,99,tc) if b1 and (not b2 or Duel.SelectYesNo(tp,aux.Stringid(m,0))) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) dmat=dg:FilterSelect(tp,cm.dlvfilter,1,1,nil,tp,mg,tc) Duel.SetSelectedCard(dmat) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc) mat:Merge(dmat) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) mat=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),1,99,tc) end else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) mat=mg:FilterSelect(tp,cm.mfilterf,1,1,nil,tp,mg,dg,tc) local b1=dg:IsExists(cm.dlvfilter,1,nil,tp,mg,tc,mat:GetFirst()) Duel.SetSelectedCard(mat) local b2=mg:CheckWithSumEqual(Card.GetRitualLevel,tc:GetLevel(),0,99,tc) if b1 and (not b2 or Duel.SelectYesNo(tp,aux.Stringid(m,0))) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) dmat=dg:FilterSelect(tp,cm.dlvfilter,1,1,nil,tp,mg,tc,mat:GetFirst()) mat:Merge(dmat) Duel.SetSelectedCard(mat) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc) mat:Merge(mat2) else Duel.SetSelectedCard(mat) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local mat2=mg:SelectWithSumEqual(tp,Card.GetRitualLevel,tc:GetLevel(),0,99,tc) mat:Merge(mat2) end end tc:SetMaterial(mat) if dmat then mat:Sub(dmat) Duel.SendtoGrave(dmat,REASON_EFFECT+REASON_MATERIAL+REASON_RITUAL) end Duel.ReleaseRitualMaterial(mat) Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,false,true,POS_FACEUP) tc:CompleteProcedure() end end
local net = require('net.box') local server = require('test.luatest_helpers.server') local t = require('luatest') local g = t.group() g.before_all = function() g.server = server:new({alias = 'master'}) g.server:start() g.server:exec(function() box.schema.user.create('alice') box.schema.user.passwd('alice', 'ALICE') box.session.su('admin', box.schema.user.grant, 'alice', 'execute', 'universe') box.session.on_disconnect(function() rawset(_G, 'peer', box.session.peer()) end) end) end g.after_all = function() g.server:drop() end g.test_session_disconnect_peer = function() local c = net.connect(g.server.net_box_uri, {user = 'alice', password = 'ALICE'}) local peer = c:call('box.session.peer') t.assert_is_not(peer, nil) c:close() g.server:exec(function(expected_peer) local t = require('luatest') t.helpers.retrying({}, function() local peer = rawget(_G, 'peer') t.assert_equals(peer, expected_peer) end) end, {peer}) end
local Tanh = torch.class('nn.Tanh', 'nn.Module') function Tanh:updateOutput(input) input.THNN.Tanh_updateOutput( input:cdata(), self.output:cdata() ) return self.output end function Tanh:updateGradInput(input, gradOutput) input.THNN.Tanh_updateGradInput( input:cdata(), gradOutput:cdata(), self.gradInput:cdata(), self.output:cdata() ) return self.gradInput end
----------------------------------------- -- ID: 5944 -- Item: Bottle of Frontier Soda -- Item Effect: Restores 20 TP over 60 seconds. ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") function onItemCheck(target) return 0 end function onItemUse(target) if (not target:hasStatusEffect(tpz.effect.REGAIN)) then target:addStatusEffect(tpz.effect.REGAIN, 1, 3, 60) else target:messageBasic(tpz.msg.basic.NO_EFFECT) end end
local M = {} function M.config() require('pears').setup(function(conf) conf.pair('<', '>') conf.preset 'tag_matching' conf.on_enter(function(pears_handle) if vim.fn.pumvisible() == 1 and vim.fn.complete_info().selected ~= -1 then vim.fn['compe#confirm'] '<CR>' else pears_handle() end end) end) end return M
x = "REACT_FRAGMENT_TYPE" y = "REACT_FRAGMENT" .. "_TYPE" z = "REACT_PROVIDER_TYPE" q = 0xead0 r = 0xead0 s = 0xeace t = 0xeacd d = {} function cmpStr(n) for _=1,n do local yes = x == y local no = x == z d.yes = yes d.no = no end end function cmpNum(n) for _=1,n do local yes = q == r local no = s == t d.yes = yes d.no = no end end return function(n) function time(f) local start = os.clock() f(n) local finish = os.clock() return finish - start end print(time(cmpNum)) print(time(cmpStr)) end
posix = require "posix" local function f() local perimeter = 1000 for c = math.floor(perimeter / 3) + 1, math.floor(perimeter / 2) do for b = math.floor((perimeter - c) / 2) + 1, c do a = perimeter - b -c if a * a + b * b == c * c then return a * b * c end end end end function toNs(ts) return ts[1] * 1000000000 + ts[2] end if #arg == 0 then print(f()) elseif #arg == 1 then iters = tonumber(arg[1]) start = { posix.clock_gettime("monotonic") } for i = 1,iters do f() end end_ = { posix.clock_gettime("monotonic") } print(toNs(end_) - toNs(start)) end
local lSettings = {} do lSettings.strBaseDir = "/Users/ameen/mygithub/depos/app/app6_yeast_pl/sparseData2" lSettings.strFilenameTarget = string.format("%s/target.csv", lSettings.strBaseDir) lSettings.strFilenameMetaInfo = string.format("%s/metaInfo.csv", lSettings.strBaseDir) lSettings.strFilenameProtRef = string.format("%s/yeast_reference.csv", lSettings.strBaseDir) lSettings.strFilenameProtInfo = string.format("%s/protInfo.csv", lSettings.strBaseDir) lSettings.strFilenameExperiment1Obj = string.format("./model/experiment_1.obj" ) lSettings.nRows=4670 function lSettings.setExprId(nExprId) lSettings.nExprId = nExprId lSettings.strFilenameProtInfo = string.format("%s/protInfo_expr_%d.csv", lSettings.strBaseDir, nExprId) lSettings.strFilenameExprDescription = lSettings.strFilenameProtInfo .. ".desc" lSettings.strFilenameExprParams = lSettings.strFilenameProtInfo .. ".params" end return lSettings end
surface.CreateFont("GoldenHudV3Font", { font = "Be Vietnam Pro SemiBold", size = 23, weight = 25 })
function sysCall_cleanup_specific() end
-- local cmd = vim.api.nvim_command -- -- norcalli -- local base16 = require('base16') -- local theme = base16.themes['tomorrow-night'] -- base16(theme, true) -- local function hi(group, guifg, guibg, ctermfg, ctermbg, attr, guisp) -- local parts = {group} -- if guifg then table.insert(parts, "guifg="..guifg) end -- if guibg then table.insert(parts, "guibg="..guibg) end -- if ctermfg then table.insert(parts, "ctermfg="..ctermfg) end -- if ctermbg then table.insert(parts, "ctermbg="..ctermbg) end -- if attr then -- table.insert(parts, "gui="..attr) -- table.insert(parts, "cterm="..attr) -- end -- if guisp then table.insert(parts, "guisp=#"..guisp) end -- vim.api.nvim_command('highlight '..table.concat(parts, ' ')) -- end -- local M = {} -- M.apply_highlights = function() -- local t1 = theme.base01 -- local td = theme.base0D -- -- hi SignColumn guibg=NONE -- hi("SignColumn", theme.base03, theme.base01,nil,nil, nil, nil) -- hi('CursorLineNr', td, nil, nil, nil, 'bold', nil) -- hi('IncSearch','YELLOW', td, nil, nil, nil, nil) -- hi('HighlightedyankRegion', nil, td, nil, nil, nil, nil) -- hi('LspDiagnosticsSignError', 'Red', t1, nil, nil, nil, nil) -- hi('LspDiagnosticsSignWarning', 'Yellow', t1, nil, nil, nil, nil) -- hi('LspDiagnosticsSignHint', td, t1, nil, nil, nil, nil) -- -- cmd('highlight! Pmenu ctermbg=18') -- -- cmd('highlight! Pmenu ctermbg=18 guibg=%s') -- hi('PmenuSbar', nil, td, nil, '18', nil, nil) -- hi('PmenuSel', nil, td, nil, '18', nil, nil) -- hi('PmenuThumb', nil, td, nil, 'Blue', 'bold', nil) -- cmd('highlight! link QuickFixLine PmenuSel') -- cmd('highlight! link Search Underlined') -- end -- M.apply_highlights() -- vim.cmd([[ -- augroup theme -- autocmd! -- autocmd ColorScheme * lua require('plugins.theme').apply_highlights() -- augroup END -- ]]) -- return M
----------------------------------- -- Area: Carpenters' Landing -- NM: Cryptonberry Assassin -- !pos 120.615 -5.457 -390.133 2 ----------------------------------- local ID = require("scripts/zones/Carpenters_Landing/IDs") mixins = {require("scripts/mixins/job_special")} require("scripts/globals/missions") ----------------------------------- function onMobInitialize(mob) mob:setMobMod(tpz.mobMod.IDLE_DESPAWN, 180) -- 3 minutes end function onMobSpawn(mob) tpz.mix.jobSpecial.config(mob, { specials = { { id = tpz.jsa.MIJIN_GAKURE, begCode = function(mob) mob:messageText(mob, ID.text.CRYPTONBERRY_ASSASSIN_2HR) end, }, }, }) mob:setLocalVar("despawnTime", os.time() + 180) end function onMobEngaged(mob, target) mob:setLocalVar("despawnTime", 0) end function onMobRoam(mob) -- if not claimed within 3 minutes of spawning, despawn local despawnTime = mob:getLocalVar("despawnTime") if despawnTime > 0 and os.time() > despawnTime then DespawnMob(mob:getID()) end end function onMobDeath(mob, player, isKiller) if player:getCurrentMission(COP) == tpz.mission.id.cop.CALM_BEFORE_THE_STORM and player:getCharVar("Cryptonberry_Executor_KILL") < 2 then local offset = mob:getID() - ID.mob.CRYPTONBERRY_EXECUTOR player:setCharVar(string.format("Cryptonberry_Assassins-%i_KILL", offset), 1) end end
local cmds = require('commands') local desc = [[ This script is a work in progress, not yet functional. It is an attempt to use the raw-writing capabilities already present within the devices ]] print(desc) -- Some raw data local rawdata = "6000F57b" --mf_auth local TIMEOUT = 2000 -- Shouldn't take longer than 2 seconds function show(usbpacket) if usbpacket then local response = Command.parse(usbpacket) print(response) end end -- Want to do both connect and send raw, so we should AND the two commands -- ISO14A_COMMAND.ISO14A_RAW(8) and ISO14A_CONNECT (1). However, we don't have a -- bitlib yet, so we'll do it manually, 1 & 8 == 9 -- ISO14A_NO_DISCONNECT = 2 ==> 11 print(string.len(rawdata)) local command = Command:new{cmd = cmds.CMD_READER_ISO_14443a, arg1 = 3, -- Connect (1) and don't disconnect (2) arg2 = 0 } local mf_auth = Command:new{cmd = cmds.CMD_READER_ISO_14443a, arg1 = 10, -- Send raw -- arg2 contains the length. -- Remember; rawdata is an ascii string containing -- ASCII characters. Thus; rawdata= "FF" are two bytes in length -- but when converted to true hexvalues internally inside the Command -- constructor, 0xFF is only one byte. So, the bytelength is the -- length of the ASCII-string divided by two. Thanks jonor! arg2 = string.len(rawdata)/2, data = rawdata} local quit = Command:new{cmd = cmds.CMD_READER_ISO_14443a, arg1 = 0, -- Nothing } core.clearCommandBuffer() --print("Sending") --print(command) local err = core.SendCommand(command:getBytes()) if err then print(err) return nil, err end local cardselect = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) print("Card select:") show(cardselect) --local response = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) --print("Raw response:") --show(response) local answer = "" while answer ~='q' do local err = core.SendCommand(mf_auth:getBytes()) if err then print(err) return nil, err end local nonce = core.WaitForResponseTimeout(cmds.CMD_ACK,TIMEOUT) print("Nonce:") show(nonce) io.write("Write q to quit, hit any char to get a nonce ") io.flush() answer=io.read(1) end--]]
return function() local indent_blankline = safe_require 'indent_blankline' if not indent_blankline then return end indent_blankline.setup { buftype_exclude = { 'terminal' }, char = '▏', filetype_exclude = { 'help', 'NvimTree', 'dashboard', 'packer', 'TelescopePrompt' }, show_current_context = true, space_char_blankline = ' ', use_treesitter = true, } vim.g.indent_blankline_context_patterns = { 'class', 'return', 'function', 'method', '^if', '^while', 'jsx_element', '^for', '^object', '^table', 'block', 'arguments', 'if_statement', 'else_clause', 'jsx_element', 'jsx_self_closing_element', 'try_statement', 'catch_clause', 'import_statement', 'operation_type', } end
local Version = "0.5.0" local PluginFolder = script.Parent if not PluginFolder:IsA("Folder") then error("Plugin folder is not a folder.") end local Assets = PluginFolder["AMS-assets"] local rbxts_include = PluginFolder["AMS-rbxts_include"] local shared = PluginFolder["AMS-shared"] local server = PluginFolder["AMS-server"] local client = PluginFolder["AMS-client"] local Animate = PluginFolder.Animate local JumpDebouncer = PluginFolder.JumpDebouncer Animate.Disabled = true JumpDebouncer.Disabled = true local Animations = PluginFolder.Animations local PlayerModule = PluginFolder.PlayerModule function ToggleScripts(instance: Instance, bool: boolean) for _,v in pairs(instance:GetDescendants()) do if v:IsA("Script") or v:IsA("LocalScript") then v.Disabled = bool end end end ToggleScripts(rbxts_include, true) ToggleScripts(server, true) ToggleScripts(client, true) ToggleScripts(shared, true) local Config = shared.Config:Clone() shared.Config:Destroy() local toolbar = plugin:CreateToolbar("Advanced Melee System") local Setup = toolbar:CreateButton("Setup", "Sets up and updates AET.", "") local InitalizeTool = toolbar:CreateButton("Initalize Tool", "Initializes a tool.", "") Setup.ClickableWhenViewportHidden = true InitalizeTool.ClickableWhenViewportHidden = true local ReplicatedStorage = game:GetService("ReplicatedStorage") local Teams = game:GetService("Teams") local ServerScriptService = game:GetService("ServerScriptService") local StarterPlayer = game:GetService("StarterPlayer") local StarterPlayerScripts = StarterPlayer.StarterPlayerScripts local StarterCharacterScripts = StarterPlayer.StarterCharacterScripts local ChangeHistoryService = game:GetService("ChangeHistoryService") local Selection = game:GetService("Selection") function DoUpdateScripts() local GameInclude = ReplicatedStorage:FindFirstChild("AMS-rbxts_include") local GameShared = ReplicatedStorage:FindFirstChild("AMS-shared") local GameClient = ServerScriptService:FindFirstChild("AMS-server") local GameServer = StarterPlayerScripts:FindFirstChild("AMS-client") local newConfig: ModuleScript = GameShared and GameShared.Config:Clone() or Config:Clone() newConfig:SetAttribute("Version", Version) local oldConfig = GameShared and GameShared:FindFirstChild("Config_OLD") and GameShared:FindFirstChild("Config_OLD"):Clone() if GameInclude then GameInclude:Destroy() end if GameShared then GameShared:Destroy() end if GameClient then GameClient:Destroy() end if GameServer then GameServer:Destroy() end local newServer = server:Clone() newServer.Parent = ServerScriptService local newClient = client:Clone() newClient.Parent = StarterPlayerScripts local newInclude = rbxts_include:Clone() newInclude.Parent = ReplicatedStorage local newPlayerModule = PlayerModule:Clone() if StarterPlayerScripts:FindFirstChild("PlayerModule") then StarterPlayerScripts.PlayerModule:Destroy() end newPlayerModule.Parent = StarterPlayerScripts local newShared = shared:Clone() newShared.Parent = ReplicatedStorage newConfig.Parent = newShared ToggleScripts(newInclude, false) ToggleScripts(newServer, false) ToggleScripts(newClient, false) ToggleScripts(newShared, false) if game.Workspace:FindFirstChild("Animations") then game.Workspace.Animations:Destroy() end local newAnimations = Animations:Clone() newAnimations.Parent = game.Workspace if StarterCharacterScripts:FindFirstChild("Animate") then StarterCharacterScripts.Animate:Destroy() end if StarterCharacterScripts:FindFirstChild("JumpDebouncer") then StarterCharacterScripts.JumpDebouncer:Destroy() end -- local newAnimate = Animate:Clone() local newJumpDebouncer = JumpDebouncer:Clone() -- newAnimate.Disabled = false newJumpDebouncer.Disabled = false newJumpDebouncer.Parent = StarterCharacterScripts -- newAnimate.Parent = StarterCharacterScripts if not game.Workspace:GetAttribute("AMS_INITED") then game.Workspace:SetAttribute("AMS_INITED", true) local newTeam = Instance.new("Team") newTeam.Name = "Neutral" newTeam.TeamColor = BrickColor.new("Institutional white") newTeam.AutoAssignable = true newTeam.Parent = Teams local function CreateTeamTool(toolName) local newModel = Instance.new("Model") newModel.Name = toolName newModel.Parent = newTeam end CreateTeamTool("Athens") CreateTeamTool("Bow") CreateTeamTool("Dory") CreateTeamTool("Kopis") CreateTeamTool("Roman") CreateTeamTool("Shield") CreateTeamTool("Sparta") end if oldConfig then oldConfig.Parent = newShared warn("You have a config that may need to be updated! If you press setup again your old config will be deleted. OLD:", oldConfig, "- NEW:", newConfig) if oldConfig:GetAttribute("Version") and oldConfig:GetAttribute("Version") == Version then warn("You are updating to the same version.") end else warn("If you haven't already you will need to setup animations. Here's how...") print("For every animation save in the", newAnimations, "model, which is located in the Workspace, do this:") print("1. Right click the animation save and click save to roblox and then copy the animation id." ) print("2. Find the name of the exported animation inside the", newConfig, ", which is located in the ReplicatedStorage.") print("3. Next to your animation name in the", newConfig, "you will need to replace the ID there with the animation ID you just copied.") print("4. After you have finished exporting and pasting all animations inside the", newConfig, "head over to game settings. Go into the avatar section and set 'Animation' to 'Standard'") end end function DoUpdateAssets() local GameAssets = ReplicatedStorage:FindFirstChild("AMS-assets") if not GameAssets then local newAssets = Assets:Clone() newAssets.Parent = ReplicatedStorage else for _,v in pairs(Assets:GetChildren()) do if GameAssets:FindFirstChild(v.Name) then if v.Name == "Tools" then for _,v2 in pairs(Assets.Tools:GetChildren()) do if GameAssets.Tools:FindFirstChild(v2.Name) then GameAssets.Tools[v2.Name]:Destroy() end local newTool = v2:Clone() newTool.Parent = GameAssets.Tools end continue else GameAssets[v.Name]:Destroy() end end local newV = v:Clone() newV.Parent = GameAssets end end end function DoAddConfig() local GameShared = ReplicatedStorage:FindFirstChild("AMS-shared") if not GameShared then GameShared = Instance.new("Folder") GameShared.Name = "AMS-shared" GameShared.Parent = ReplicatedStorage end local OldConfig = GameShared:FindFirstChild("Config") if OldConfig then OldConfig.Name = "Config_OLD" end local newConfig = Config:Clone() newConfig.Parent = GameShared newConfig:SetAttribute("Version", Version) end function DoInitalizeTool() local CurrentSelection = Selection:Get() if #CurrentSelection ~= 1 then return warn("Select only the main model of the tool.") end local Tool = CurrentSelection[1] if not Tool:IsA("Model") then return warn("Tool selected is not a model") end local Attach: Instance for _,v in pairs(Tool:GetChildren()) do if string.find(v.Name, "Attach") then Attach = v break end end if not Attach then return warn("Tool selected does not have an attach.") end Attach.CanCollide = false Attach.Massless = true local parts = {} for _,v in ipairs(Tool:GetDescendants()) do if v == Attach then continue elseif v:IsA("BasePart") then parts[#parts + 1] = v elseif v:IsA("Weld") then warn("existing weld",v,"may cause problems with the new welds being added") end end if #parts>0 then local d = {} for i=1,#parts do local p1,p0 = Attach,parts[i] p1.Anchored,p0.Anchored = true,true local joint = Instance.new("Weld") joint.Part0 = p1 joint.Part1 = p0 joint.C0 = p1.CFrame:toObjectSpace(p0.CFrame) joint.C1 = CFrame.new() joint.Parent = p1 joint.Name = p0.Name p1.Anchored,p0.Anchored = false,false p0.CanCollide = false p0.Massless = true d[#d+1]=joint end Selection:Set(d) else return warn("The tool you are attempting to select does not have any baseparts to be welded.") end end Setup.Click:Connect(function() plugin:SelectRibbonTool(Enum.RibbonTool.Select,UDim2.new(0,0,0,0)) DoAddConfig() DoUpdateAssets() DoUpdateScripts() print("Succesfully Setup AET") ChangeHistoryService:SetWaypoint("Setup") end) InitalizeTool.Click:Connect(function() plugin:SelectRibbonTool(Enum.RibbonTool.Select,UDim2.new(0,0,0,0)) DoInitalizeTool() print("Succesfully Initialized Tool") ChangeHistoryService:SetWaypoint("InitalizedTool") end)
-- language specific higlights local lush = require("lush") local base = require("apprentice.base") local M = {} M = lush(function() return { typescriptReserved {base.ApprenticeAqua}, typescriptLabel {base.ApprenticeAqua}, typescriptFuncKeyword {base.ApprenticeAqua}, typescriptIdentifier {base.ApprenticeOrange}, typescriptBraces {base.ApprenticeOrange}, typescriptEndColons {base.ApprenticeFg1}, typescriptDOMObjects {base.ApprenticeFg1}, typescriptAjaxMethods {base.ApprenticeFg1}, typescriptLogicSymbols {base.ApprenticeOrange}, typescriptDocSeeTag {base.Comment}, typescriptDocParam {base.Comment}, typescriptDocTags {base.Comment}, typescriptGlobalObjects {base.ApprenticeFg1}, typescriptParens {base.ApprenticeOrange}, typescriptOpSymbols {base.ApprenticeOrange}, typescriptHtmlElemProperties {base.ApprenticeFg1}, typescriptNull {base.ApprenticePurple}, typescriptInterpolationDelimiter {base.ApprenticeAqua}, typescriptArrowFunc {base.ApprenticeFg1}, typescriptCharacter {base.ApprenticeOrange}, typescriptUnion {base.ApprenticeOrange}, typescriptDotNotation {base.ApprenticeOrange}, typescriptGlobalObjectDot {typescriptDotNotation}, } end) return M
-- ################################### -- -- Credits: Sighmir and Shadow -- -- ################################### vRP = Proxy.getInterface("vRP") vRPclient = Tunnel.getInterface("vRP", "vRP") HUDserver = Tunnel.getInterface("vrp_bars", "vrp_bars") vRPhud = {} Tunnel.bindInterface("vrp_bars",vRPhud) fome = 0 sede = 0 Citizen.CreateThread(function() while true do Citizen.Wait(1) drawRct(0.0149, 0.9677, 0.1408,0.028,41,41,41,255) -- Fundo preto drawRct(0.0163, 0.97, 0.06880,0.01,188,188,188,80) -- Vida Fundo drawRct(0.0865, 0.97, 0.06795,0.01,188,188,188,80) -- Armour Fundo drawRct(0.01655, 0.982, 0.06845,0.01,188,188,188,80) -- Fome fundo / fundo colorido --> drawRct(0.01655, 0.982, 0.06845,0.01,255,153,0,80) -- Fome fundo drawRct(0.0865, 0.982, 0.06795,0.01,188,188,188,80) -- Sede fundo / fundo colorido --> drawRct(0.0865, 0.982, 0.06795,0.01,0,125,255,80) -- Barra de Vida local health = GetEntityHealth(GetPlayerPed(-1)) - 100 local varSet = 0.06880 * (health / 100) drawRct(0.0163, 0.97, varSet,0.01,55,115,55,255) -- Vida -- Barra de armor armor = GetPedArmour(GetPlayerPed(-1)) if armor > 100.0 then armor = 100.0 end local varSet = 0.06795 * (armor / 100) drawRct(0.0865, 0.97, varSet,0.01,75,75,255,250) -- Armour -- Fome if fome > 100.0 then fome = 100.0 end local varSet = 0.06795 * (fome / 100) drawRct(0.01655, 0.982, varSet,0.01,255,153,0,250) -- Fome -- Fome if sede > 100.0 then sede = 100.0 end local varSet = 0.06795 * (sede / 100) drawRct(0.0865, 0.982, varSet,0.01,75,75,255,250) -- sede end end) function vRPhud.setHunger(hunger) fome = hunger end function vRPhud.setThirst(thirst) sede = thirst end function drawRct(x,y,width,height,r,g,b,a) DrawRect(x + width/2, y + height/2, width, height, r, g, b, a) end
local PVector = require('./pvector-class') local Circle = require('./circle-class') function love.load() width = love.graphics.getWidth() height = love.graphics.getHeight() circles = {} addCircle() end function love.draw() for i, c in ipairs(circles) do c:draw() end end function love.update(dt) addCircle() for i, circle in ipairs(circles) do local x, y = love.mouse.getPosition() local direction = PVector.sub(PVector.new(x, y), circle.location) -- direction:mult(dt * 30) direction:normalize() direction:mult(0.5) circle.velocity:add(direction) circle.velocity:limit(circle.topSpeed) circle.location:add(circle.velocity) -- if circle:shouldDie() then -- table.remove(circles, i) -- end end end function getOffscreenLocation() local r = love.math.random(1, 4) local x, y if r == 1 then y = -50.0 x = love.math.random(0, width) elseif r == 2 then x = width + 50.0 y = love.math.random(0, height) elseif r == 3 then y = height + 50.0 x = love.math.random(0, width) else x = -50.0 y = love.math.random(0, height) end return PVector.new(x, y) end function addCircle() local topspeed = 0.025 local location = getOffscreenLocation() local velocity = PVector.new(0, 0) local radius = love.math.random(1, 15) table.insert(circles, Circle.new(location, velocity, radius, topspeed)) end
workspace "SkyEngine" architecture "x64" configurations { "Debug", "Release", "Dist" } outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}" --Include directories relative to root folder (solution directory) IncludeDir = {} --Compiler Include directory,i.e., "%{IncludeDir.GLFW}" IncludeDir["GLFW"] = "SkyEngine/vendor/GLFW/include" include "SkyEngine/vendor/GLFW" project "SkyEngine" location "SkyEngine" --Because it is a DLL file. So, 'link' a static library into it. kind "SharedLib" language "C++" targetdir("bin/" .. outputdir .. "/%{prj.name}") objdir("bin-int/" .. outputdir .. "/%{prj.name}") pchheader "sepch.h" pchsource "SkyEngine/src/sepch.cpp" --[[VS Specific , creates our pre-compiled header file.]] files { "%{prj.name}/src/**.h", "%{prj.name}/src/**.cpp" } includedirs { "%{prj.name}/src", "%{prj.name}/vendor/spdlog/include", "%{IncludeDir.GLFW}" } links { "GLFW", "opengl32.lib" } filter "system:windows" cppdialect "C++17" staticruntime "On" systemversion "latest" defines{ "SE_PLATFORM_WINDOWS", "SE_BUILD_DLL" } --[[PUTS DLL WHERE IT WANTS TO BE]] postbuildcommands{ {"{COPY} %{cfg.buildtarget.relpath} ../bin/" .. outputdir .. "/Sandbox"} } filter "configurations:Debug" defines "SE_DEBUG" buildoptions "/MDd" symbols "On" filter "configurations:Release" defines "SE_RELEASE" buildoptions "/MD" optimize "On" filter "configurations:Dist" defines "SE_DIST" buildoptions "/MD" optimize "On" filter {"system:windows", "configurations:Release"} project "Sandbox" location "Sandbox" kind "ConsoleApp" language "C++" targetdir("bin/" .. outputdir .. "/%{prj.name}") objdir("bin-int/" .. outputdir .. "/%{prj.name}") files { "%{prj.name}/src/**.h", "%{prj.name}/src/**.cpp" } includedirs { "SkyEngine/vendor/spdlog/include", "SkyEngine/src" } --[[links to the main SkyEngine project/solution]] links { "SkyEngine" } filter "system:windows" cppdialect "C++17" staticruntime "On" systemversion "latest" defines { "SE_PLATFORM_WINDOWS" } filter "configurations:Debug" defines "SE_DEBUG" buildoptions "/MDd" symbols "On" filter "configurations:Release" defines "SE_RELEASE" buildoptions "/MD" optimize "On" filter "configurations:Dist" defines "SE_DIST" buildoptions "/MD" optimize "On"
local OnlookerSocketCmd = require("games/common2/onlooker/socket/onlookerSocketCmd"); local OnlookerSocketWriter = class(CommonSocketWriter); OnlookerSocketWriter.requestLoginOnlooker = function(self,packetId,info) self.m_socket:writeString(packetId,info.userInfo or "");--围观者信息 self.m_socket:writeInt(packetId,info.tmid or 0); --被围观者id self.m_socket:writeShort(packetId,info.keepOnlooker or 0);--是否一直围观,1:持续围观,0:看完被围观者正在打的那桌就被server踢出 self.m_socket:writeString(packetId,info.extend or "");--扩展字段(json) end OnlookerSocketWriter.requestLogoutOnlooker = function(self,packetId,info) self.m_socket:writeInt(packetId,info.tmid or 0); --被围观者id end OnlookerSocketWriter.requestSendBarrage = function(self,packetId,info) self.m_socket:writeByte(packetId,info.msgType);--发言类型:0:普通,1:道具 self.m_socket:writeString(packetId,info.msg or ""); --json end OnlookerSocketWriter.requestChatReport = function(self,packetId, info) self.m_socket:writeInt(packetId, info.mid or 0); self.m_socket:writeInt(packetId, info.otherMid or 0); end OnlookerSocketWriter.s_clientCmdFunMap = { [OnlookerSocketCmd.C_REQUEST_LOGIN_ONLOOKER] = "requestLoginOnlooker"; [OnlookerSocketCmd.C_REQUEST_LOGOUT_ONLOOKER] = "requestLogoutOnlooker"; [OnlookerSocketCmd.C_REQUEST_SEND_BARRAGE] = "requestSendBarrage"; [OnlookerSocketCmd.C_REQUEST_CHAT_COMPLAINT] = "requestChatReport"; }; return OnlookerSocketWriter;
-- Copyright (C) 2018 The Dota IMBA Development Team -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. -- -- Editors: -- -- Author: Firetoad -- Date: 15.08.2015 -- Last Update: 18.05.2017 -- Updated by AtroCty ----------------------------------------------------------------------------------------------------------- -- Orchid definition ----------------------------------------------------------------------------------------------------------- item_imba_orchid = item_imba_orchid or class({}) LinkLuaModifier( "modifier_item_imba_orchid", "components/items/item_orchid.lua", LUA_MODIFIER_MOTION_NONE ) -- Owner's bonus attributes, stackable LinkLuaModifier( "modifier_item_imba_orchid_debuff", "components/items/item_orchid.lua", LUA_MODIFIER_MOTION_NONE ) -- Active debuff function item_imba_orchid:GetAbilityTextureName() return "imba_orchid" end function item_imba_orchid:GetIntrinsicModifierName() return "modifier_item_imba_orchid" end function item_imba_orchid:OnSpellStart() local target = self:GetCursorTarget() -- If the target possesses a ready Linken's Sphere, do nothing if target:GetTeam() ~= self:GetCaster():GetTeam() then if target:TriggerSpellAbsorb(self) then return nil end end -- If the target is magic immune (Lotus Orb/Anti Mage), do nothing if target:IsMagicImmune() then return nil end -- Play the cast sound target:EmitSound("DOTA_Item.Orchid.Activate") -- Apply the Orchid debuff target:AddNewModifier(self:GetCaster(), self, "modifier_item_imba_orchid_debuff", {duration = self:GetSpecialValueFor("silence_duration") * (1 - target:GetStatusResistance())}) end ----------------------------------------------------------------------------------------------------------- -- Orchid owner bonus attributes (stackable) ----------------------------------------------------------------------------------------------------------- modifier_item_imba_orchid = modifier_item_imba_orchid or class({}) function modifier_item_imba_orchid:IsHidden() return true end function modifier_item_imba_orchid:IsPurgable() return false end function modifier_item_imba_orchid:RemoveOnDeath() return false end function modifier_item_imba_orchid:GetAttributes() return MODIFIER_ATTRIBUTE_MULTIPLE end function modifier_item_imba_orchid:OnDestroy() if not IsServer() then return end self:CheckUnique(false) end function modifier_item_imba_orchid:OnCreated() if IsServer() then if not self:GetAbility() then self:Destroy() end end self.item = self:GetAbility() self.parent = self:GetParent() if self.parent:IsHero() and self.item then self.bonus_intellect = self.item:GetSpecialValueFor("bonus_intellect") self.bonus_attack_speed = self.item:GetSpecialValueFor("bonus_attack_speed") self.bonus_damage = self.item:GetSpecialValueFor("bonus_damage") self.bonus_mana_regen = self.item:GetSpecialValueFor("bonus_mana_regen") self.spell_power = self.item:GetSpecialValueFor("spell_power") if IsServer() then self:CheckUnique(false) end end end -- Attribute bonuses function modifier_item_imba_orchid:DeclareFunctions() return { MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT, MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE, MODIFIER_PROPERTY_MANA_REGEN_CONSTANT, MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, } end function modifier_item_imba_orchid:GetModifierBonusStats_Intellect() return self.bonus_intellect end function modifier_item_imba_orchid:GetModifierAttackSpeedBonus_Constant() return self.bonus_attack_speed end function modifier_item_imba_orchid:GetModifierPreAttack_BonusDamage() return self.bonus_damage end function modifier_item_imba_orchid:GetModifierConstantManaRegen() return self.bonus_mana_regen end function modifier_item_imba_orchid:GetModifierSpellAmplify_Percentage() return self:CheckUniqueValue(self.spell_power,{"modifier_item_imba_bloodthorn"}) end ----------------------------------------------------------------------------------------------------------- -- Orchid active debuff ----------------------------------------------------------------------------------------------------------- modifier_item_imba_orchid_debuff = modifier_item_imba_orchid_debuff or class({}) function modifier_item_imba_orchid_debuff:IsHidden() return false end function modifier_item_imba_orchid_debuff:IsDebuff() return true end function modifier_item_imba_orchid_debuff:IsPurgable() return true end -- Modifier particle function modifier_item_imba_orchid_debuff:GetEffectName() return "particles/items2_fx/orchid.vpcf" end function modifier_item_imba_orchid_debuff:GetEffectAttachType() return PATTACH_OVERHEAD_FOLLOW end -- Reset damage storage tracking, track debuff parameters to prevent errors if the item is unequipped function modifier_item_imba_orchid_debuff:OnCreated() if IsServer() then if not self:GetAbility() then self:Destroy() end end if IsServer() then local owner = self:GetParent() owner.orchid_damage_storage = owner.orchid_damage_storage or 0 self.damage_factor = self:GetAbility():GetSpecialValueFor("silence_damage_percent") end end -- Declare modifier events/properties function modifier_item_imba_orchid_debuff:DeclareFunctions() return { MODIFIER_EVENT_ON_TAKEDAMAGE } end -- Declare modifier states function modifier_item_imba_orchid_debuff:CheckState() return { [MODIFIER_STATE_SILENCED] = true } end -- Track damage taken function modifier_item_imba_orchid_debuff:OnTakeDamage(keys) if IsServer() then local owner = self:GetParent() local target = keys.unit -- If this unit is the one suffering damage, store it if owner == target then owner.orchid_damage_storage = owner.orchid_damage_storage + keys.damage end end end -- When the debuff ends, deal damage function modifier_item_imba_orchid_debuff:OnDestroy() if IsServer() then -- Parameters local owner = self:GetParent() local ability = self:GetAbility() local caster = ability:GetCaster() -- If damage was taken, play the effect and damage the owner if owner.orchid_damage_storage > 0 then -- Calculate and deal damage local damage = owner.orchid_damage_storage * self.damage_factor * 0.01 ApplyDamage({attacker = caster, victim = owner, ability = ability, damage = damage, damage_type = DAMAGE_TYPE_MAGICAL}) -- Fire damage particle local orchid_end_pfx = ParticleManager:CreateParticle("particles/items2_fx/orchid_pop.vpcf", PATTACH_OVERHEAD_FOLLOW, owner) ParticleManager:SetParticleControl(orchid_end_pfx, 0, owner:GetAbsOrigin()) ParticleManager:SetParticleControl(orchid_end_pfx, 1, Vector(100, 0, 0)) ParticleManager:ReleaseParticleIndex(orchid_end_pfx) end -- Clear damage taken variable self:GetParent().orchid_damage_storage = nil end end ----------------------------------------------------------------------------------------------------------- -- Bloodthorn definition ----------------------------------------------------------------------------------------------------------- item_imba_bloodthorn = item_imba_bloodthorn or class({}) LinkLuaModifier( "modifier_item_imba_bloodthorn", "components/items/item_orchid.lua", LUA_MODIFIER_MOTION_NONE ) -- Owner's bonus attributes, stackable LinkLuaModifier( "modifier_item_imba_bloodthorn_attacker_crit", "components/items/item_orchid.lua", LUA_MODIFIER_MOTION_NONE ) -- Active attackers' crit buff LinkLuaModifier( "modifier_item_imba_bloodthorn_debuff", "components/items/item_orchid.lua", LUA_MODIFIER_MOTION_NONE ) -- Active debuff function item_imba_bloodthorn:GetAbilityTextureName() return "imba_bloodthorn" end function item_imba_bloodthorn:GetIntrinsicModifierName() return "modifier_item_imba_bloodthorn" end function item_imba_bloodthorn:OnSpellStart() if IsServer() then -- Parameters local caster = self:GetCaster() local target = self:GetCursorTarget() local silence_duration = self:GetSpecialValueFor("silence_duration") -- If the target possesses a ready Linken's Sphere, do nothing if target:GetTeam() ~= caster:GetTeam() then if target:TriggerSpellAbsorb(self) then return nil end end -- If the target is magic immune (Lotus Orb/Anti Mage), do nothing if target:IsMagicImmune() then return nil end -- Play the cast sound target:EmitSound("DOTA_Item.Orchid.Activate") -- Apply the Orchid debuff target:AddNewModifier(caster, self, "modifier_item_imba_bloodthorn_debuff", {duration = silence_duration * (1 - target:GetStatusResistance())}) end end ----------------------------------------------------------------------------------------------------------- -- Bloodthorn owner bonus attributes (stackable) ----------------------------------------------------------------------------------------------------------- modifier_item_imba_bloodthorn = modifier_item_imba_bloodthorn or class({}) function modifier_item_imba_bloodthorn:IsHidden() return true end function modifier_item_imba_bloodthorn:IsPurgable() return false end function modifier_item_imba_bloodthorn:RemoveOnDeath() return false end function modifier_item_imba_bloodthorn:GetAttributes() return MODIFIER_ATTRIBUTE_MULTIPLE end -- Adds the unique modifier when created function modifier_item_imba_bloodthorn:OnCreated() if IsServer() then if not self:GetAbility() then self:Destroy() end end self.item = self:GetAbility() self.parent = self:GetParent() if self.parent:IsHero() and self.item then self.bonus_intellect = self.item:GetSpecialValueFor("bonus_intellect") self.bonus_attack_speed = self.item:GetSpecialValueFor("bonus_attack_speed") self.bonus_damage = self.item:GetSpecialValueFor("bonus_damage") self.bonus_mana_regen = self.item:GetSpecialValueFor("bonus_mana_regen") self.spell_power = self.item:GetSpecialValueFor("spell_power") if IsServer() then self:CheckUnique(false) end end end function modifier_item_imba_bloodthorn:OnDestroy(keys) if IsServer() then self:CheckUnique(false) end end -- Attribute bonuses function modifier_item_imba_bloodthorn:DeclareFunctions() return { MODIFIER_PROPERTY_STATS_INTELLECT_BONUS, MODIFIER_PROPERTY_ATTACKSPEED_BONUS_CONSTANT, MODIFIER_PROPERTY_PREATTACK_BONUS_DAMAGE, MODIFIER_PROPERTY_MANA_REGEN_CONSTANT, MODIFIER_PROPERTY_SPELL_AMPLIFY_PERCENTAGE, -- MODIFIER_PROPERTY_PREATTACK_CRITICALSTRIKE } end function modifier_item_imba_bloodthorn:GetModifierBonusStats_Intellect() return self.bonus_intellect end function modifier_item_imba_bloodthorn:GetModifierAttackSpeedBonus_Constant() return self.bonus_attack_speed end function modifier_item_imba_bloodthorn:GetModifierPreAttack_BonusDamage() return self.bonus_damage end function modifier_item_imba_bloodthorn:GetModifierConstantManaRegen() return self.bonus_mana_regen end function modifier_item_imba_bloodthorn:GetModifierSpellAmplify_Percentage() return self:CheckUniqueValue(self.spell_power,nil) end -- -- Roll for the crit chance -- function modifier_item_imba_bloodthorn:GetModifierPreAttack_CriticalStrike(keys) -- if self:GetAbility() then -- local owner = self:GetParent() -- -- If this unit is the attacker, roll for a crit -- if owner == keys.attacker then -- if RollPseudoRandom(self:GetAbility():GetSpecialValueFor("crit_chance"), self) then -- return self:GetAbility():GetSpecialValueFor("crit_damage") -- end -- end -- end -- end ----------------------------------------------------------------------------------------------------------- -- Bloodthorn active debuff ----------------------------------------------------------------------------------------------------------- modifier_item_imba_bloodthorn_debuff = modifier_item_imba_bloodthorn_debuff or class({}) function modifier_item_imba_bloodthorn_debuff:IsHidden() return false end function modifier_item_imba_bloodthorn_debuff:IsDebuff() return true end function modifier_item_imba_bloodthorn_debuff:IsPurgable() return true end -- Modifier particle function modifier_item_imba_bloodthorn_debuff:GetEffectName() return "particles/items2_fx/orchid.vpcf" end function modifier_item_imba_bloodthorn_debuff:GetEffectAttachType() return PATTACH_OVERHEAD_FOLLOW end -- Reset damage storage tracking, track debuff parameters to prevent errors if the item is unequipped function modifier_item_imba_bloodthorn_debuff:OnCreated() if IsServer() then if not self:GetAbility() then self:Destroy() end end if IsServer() then local owner = self:GetParent() if not owner.orchid_damage_storage then owner.orchid_damage_storage = 0 end self.damage_factor = self:GetAbility():GetSpecialValueFor("silence_damage_percent") self.target_crit_multiplier = self:GetAbility():GetSpecialValueFor("target_crit_multiplier") end end -- Declare modifier states function modifier_item_imba_bloodthorn_debuff:CheckState() return { [MODIFIER_STATE_SILENCED] = true, [MODIFIER_STATE_EVADE_DISABLED] = true } end -- Declare modifier events/properties function modifier_item_imba_bloodthorn_debuff:DeclareFunctions() return { MODIFIER_EVENT_ON_TAKEDAMAGE, MODIFIER_EVENT_ON_ATTACK_START, } end -- Grant the crit modifier to attackers function modifier_item_imba_bloodthorn_debuff:OnAttackStart(keys) if IsServer() then local owner = self:GetParent() -- If this unit is the target, grant the attacker a crit buff if owner == keys.target then local attacker = keys.attacker attacker:AddNewModifier(owner, self:GetAbility(), "modifier_item_imba_bloodthorn_attacker_crit", {duration = 1.0, target_crit_multiplier = self.target_crit_multiplier}) end end end -- Track damage taken function modifier_item_imba_bloodthorn_debuff:OnTakeDamage(keys) if IsServer() then local owner = self:GetParent() local target = keys.unit -- If this unit is the one suffering damage, amplify and store it if owner == target then owner.orchid_damage_storage = owner.orchid_damage_storage + keys.damage end end end -- When the debuff ends, deal damage function modifier_item_imba_bloodthorn_debuff:OnDestroy() if IsServer() then -- Parameters local owner = self:GetParent() local ability = self:GetAbility() local caster = ability:GetCaster() local damage_factor = ability:GetSpecialValueFor("silence_damage_percent") -- If damage was taken, play the effect and damage the owner if owner.orchid_damage_storage > 0 then -- Calculate and deal damage local damage = owner.orchid_damage_storage * damage_factor * 0.01 ApplyDamage({attacker = caster, victim = owner, ability = ability, damage = damage, damage_type = DAMAGE_TYPE_MAGICAL}) -- Fire damage particle local orchid_end_pfx = ParticleManager:CreateParticle("particles/items2_fx/orchid_pop.vpcf", PATTACH_OVERHEAD_FOLLOW, owner) ParticleManager:SetParticleControl(orchid_end_pfx, 0, owner:GetAbsOrigin()) ParticleManager:SetParticleControl(orchid_end_pfx, 1, Vector(100, 0, 0)) ParticleManager:ReleaseParticleIndex(orchid_end_pfx) end -- Clear damage taken variable self:GetParent().orchid_damage_storage = nil end end ----------------------------------------------------------------------------------------------------------- -- Bloodthorn active attacker crit buff ----------------------------------------------------------------------------------------------------------- modifier_item_imba_bloodthorn_attacker_crit = modifier_item_imba_bloodthorn_attacker_crit or class({}) function modifier_item_imba_bloodthorn_attacker_crit:IsHidden() return true end function modifier_item_imba_bloodthorn_attacker_crit:IsDebuff() return false end function modifier_item_imba_bloodthorn_attacker_crit:IsPurgable() return false end -- Track parameters to prevent errors if the item is unequipped function modifier_item_imba_bloodthorn_attacker_crit:OnCreated(keys) if IsServer() then if not self:GetAbility() then self:Destroy() end end if IsServer() then self.target_crit_multiplier = keys.target_crit_multiplier end end -- Declare modifier events/properties function modifier_item_imba_bloodthorn_attacker_crit:DeclareFunctions() return { MODIFIER_PROPERTY_PREATTACK_CRITICALSTRIKE, MODIFIER_EVENT_ON_ATTACK_LANDED, } end -- Grant the crit damage multiplier function modifier_item_imba_bloodthorn_attacker_crit:GetModifierPreAttack_CriticalStrike() if IsServer() then return self.target_crit_multiplier end end -- Remove the crit modifier when the attack is concluded function modifier_item_imba_bloodthorn_attacker_crit:OnAttackLanded(keys) if IsServer() then -- If this unit is the attacker, remove its crit modifier if self:GetParent() == keys.attacker then self:GetParent():RemoveModifierByName("modifier_item_imba_bloodthorn_attacker_crit") -- Increase the crit damage count local debuff_modifier = keys.target:FindModifierByName("modifier_item_imba_bloodthorn_debuff") if debuff_modifier then debuff_modifier.target_crit_multiplier = debuff_modifier.target_crit_multiplier + self:GetAbility():GetSpecialValueFor("crit_mult_increase") end end end end
local ffi = require "ffi" local tinsert = table.insert local uv = require('uv') local json = require('lua.json') local sql = require "deps.sqlite3" local timer = require "deps.timer" local utils = require "lua.utils" -- Sql connections local sqlconns = {} -- Current connection local conn = nil --------------------------------------------------------------------------------- -- Helper to run pcalled sqlite commands local function run_exec( str, log ) if( log == nil ) then p("[DB exec] "..tostring(str)) end local result = conn:exec( str ) return result end --------------------------------------------------------------------------------- -- This auto builds tables when making a new db. local function checkTable( tablename, schema ) local checktblstr = "SELECT name FROM sqlite_master WHERE type='table' AND name='%s'" local status, result = pcall( run_exec, string.format(checktblstr, tablename) ) -- Create table if false if(status == false or result == nil) then local createstr = "CREATE TABLE "..tablename.."("..schema..")" status, result = pcall( run_exec, createstr ) if(status == false) then p("[Sqlite DB Error] Unable to create table: ", tablename, result) end end return status, result end --------------------------------------------------------------------------------- -- This auto builds tables when making a new db. local function checkTables( tbls ) for k,v in pairs( tbls ) do checkTable(k, v.create) end end --------------------------------------------------------------------------------- local function init( filelabel, tbls ) if(filelabel == nil) then return nil end local filename = "./data/"..filelabel..".sqlite3" p("[Sql file] ", filename) -- If filename is provided a new connection is made and set if(filename) then thisconn = sql.open(filename) end if(thisconn == nil) then p("[Sqlite DB Error] No conn set.") return nil, nil end tinsert(sqlconns, thisconn) conn = thisconn checkTables( tbls ) return thisconn -- return the index. Use this to set conn end --------------------------------------------------------------------------------- local function setConn( connid ) if(connid == nil) then return nil end for i,v in ipairs(sqlconns) do if(connid == v) then conn = connid; return true end end return nil end --------------------------------------------------------------------------------- -- Get the current conn index (for later use) local function getConn() return conn end --------------------------------------------------------------------------------- -- TABLES --------------------------------------------------------------------------------- local function getTableColumns( tblname ) if(tblname == nil) then p("[Sql GetTableColumns Error] No table name provided.") return {} end local sqlcmd = [[SELECT name, type FROM PRAGMA_TABLE_INFO(']]..tblname..[[');]] local tablenames = {} local tbl, rowcount = conn:exec(sqlcmd) if(rowcount == 0 or tbl == nil or tbl.name == nil) then p("[Sql GetTableColumns Error] No names.") return tablenames end for k,v in ipairs(tbl.name) do tinsert(tablenames, { name = v, type = tbl.type[k] }) end return tablenames end --------------------------------------------------------------------------------- local function getTable( name, limit, where ) if(name == nil) then p("[Sql GetTable Error] No table name provided.") return {} end local sqlcmd = [[SELECT * FROM ]]..name if(where) then sqlcmd = sqlcmd..[[ WHERE ]]..where end sqlcmd = sqlcmd..[[ ; ]] local jsontbl = {} local tbl, rowcount = conn:exec(sqlcmd) if(rowcount == 0 or tbl == nil) then p("[Sql GetTable Error] No rows.") return {} end local cols = tbl[0] for row = 1, rowcount do local addrow = {} for k, v in ipairs(cols) do addrow[v] = tbl[k][row] end tinsert(jsontbl, addrow) end return jsontbl end --------------------------------------------------------------------------------- local function dropTable( tblname ) local droptblstr = "DROP TABLE IF EXISTS '%s';" local status, result = pcall( run_exec, string.format(droptblstr, tblname) ) if(status == false or result == nil) then -- dont really care if it fails, it means the db is broken. p("[Sql database corrupt] Cannot drop table: ", tblname) end end --------------------------------------------------------------------------------- local function setTable( name, data ) local stmt = conn:prepare([[INSERT OR REPLACE INTO ]]..name..[[ VALUES(?, ?);]]) local tbldata = json.decode(data) if(tbldata == nil) then return nil end local results = {} for k,v in pairs(tbldata) do local desc = v.desc local theme = v.theme or "zombie" stmt:reset() stmt:bind(desc, theme) stmt:step() tinsert(results, "OK:"..k) end stmt:close() return results end --------------------------------------------------------------------------------- local function setTableRow( tblname, rowdata ) local cols = utils.tcount(rowdata) local sqlcmd = [[INSERT OR REPLACE INTO ]]..tblname..[[ VALUES(]]..string.rep("?,", cols-1)..[[?);]] local stmt = conn:prepare(sqlcmd) if(rowdata == nil) then return nil end local results = {} stmt:reset() for i,v in ipairs(rowdata) do stmt:bind1(i, v) end stmt:step() stmt:close() tinsert(results, "OK") return results end --------------------------------------------------------------------------------- local function insertTableRow( tblname, rowdata ) local cols = utils.tcount(rowdata) local cmd = [[INSERT INTO ]]..tblname..[[ VALUES(]]..string.rep("?,", cols-1)..[[ ?);]] local stmt = conn:prepare(cmd) if(rowdata == nil) then return nil end local results = {} stmt:reset() for i,v in ipairs(rowdata) do stmt:bind1(i, v) end stmt:step() stmt:close() tinsert(results, "OK") return results end --------------------------------------------------------------------------------- local function setTableValue( tblname, selcol, rowid, col, value ) local sqlcmd = [[UPDATE ]]..tblname..[[ SET ]]..col..[[=']]..value..[[' WHERE ]]..selcol..[[=']]..rowid..[[';]] local status, result = pcall( run_exec, sqlcmd, true ) if(status == false) then p("[Sqlite DB Error] Unable to set table value: ", result) end return result end --------------------------------------------------------------------------------- local function setModuleInfo( info ) local tinfo = { info.name, info.dataread, info.datawrite, math.floor(info.lastupdate), info.gamecount, math.floor(info.uptime), info.usercount, info.activity, } -- Assign new info values to the row of the same name setTableRow( "TblModuleStats", tinfo ) end --------------------------------------------------------------------------------- -- IMPORT --------------------------------------------------------------------------------- local function importJSON( jsondata ) if(type(jsondata) ~= "string") then return nil end local jsontbl = json.decode(jsondata) -- Iterate expected format. -- Array of objects, each object with a dbname, and data, Some data having multiple properties. for idx, dbobj in pairs(jsontbl) do if(dbobj.dbname and dbobj.data) then for k,v in pairs(dbobj.data) do local rowdata = { v.desc, v.theme } insertTableRow(dbobj.dbname, rowdata ) end end end return jsontbl end --------------------------------------------------------------------------------- local function importJSONFile( jsonfile ) local fh = io.open(jsonfile, "r"); local jsondata = fh:read("*a") fh:close() return importJSON(jsondata) end --------------------------------------------------------------------------------- return { init = init, setConn = setConn, getConn = getConn, run_exec = run_exec, dropTable = dropTable, checkTable = checkTable, checkTables = checkTables, getTableColumns = getTableColumns, getTable = getTable, setTable = setTable, setTableValue = setTableValue, setModuleInfo = setModuleInfo, importJSONFile = importJSONFile, importJSON = importJSON, } ---------------------------------------------------------------------------------
local ADDON, Engine = ... local path = ([[Interface\AddOns\%s\media\]]):format(ADDON) -- static config local config = { windows = { size = { 475, 308 }, -- 440, 136 -- was 120, but need more to fit the buttons! minimum_size = { 330, 136 }, position = { "BOTTOMLEFT", "UICenter", "BOTTOMLEFT", (13 + 36 + 2), (177 + 36 + 3) }, clamps = { -(13 + 36 + 2), -(13 + 36 + 2), -13, -(20 + 36 + 3) }, -- required padding to screen edges (with room for buttons and inputbox) fade = true, time_visible = 15, button_frame = { size = 36, position = { "BOTTOMLEFT", -(36 + 2), 0 }, -- not used? padding = 0, -- vertical padding between buttons slider = { size = 36, thumb = { size = { 22, 36 }, textures = { normal = path .. [[textures\DiabolicUI_Slider_22x36_Thumb.tga]], disabled = path .. [[textures\DiabolicUI_Slider_22x36_ThumbDisabled.tga]], highlight = path .. [[textures\DiabolicUI_Slider_22x36_ThumbHighlight.tga]] } } }, buttons = { size = { 36, 36 }, texture_size = { 64, 64 }, texture_position = { "CENTER", 0, 0 }, textures = { menu = { normal = path .. [[textures\DiabolicUI_ChatButtons_36x36_ChatMenu.tga]], disabled = path .. [[textures\DiabolicUI_ChatButtons_36x36_ChatMenuDisabled.tga]], highlight = path .. [[textures\DiabolicUI_ChatButtons_36x36_ChatMenuHighlight.tga]] }, minimize = { normal = path .. [[textures\DiabolicUI_ChatButtons_36x36_Minimize.tga]], disabled = path .. [[textures\DiabolicUI_ChatButtons_36x36_MinimizeDisabled.tga]], highlight = path .. [[textures\DiabolicUI_ChatButtons_36x36_MinimizeHighlight.tga]] }, maximize = { normal = path .. [[textures\DiabolicUI_ChatButtons_36x36_Maximize.tga]], disabled = path .. [[textures\DiabolicUI_ChatButtons_36x36_MaximizeDisabled.tga]], highlight = path .. [[textures\DiabolicUI_ChatButtons_36x36_MaximizeHighlight.tga]] }, up = { normal = path .. [[textures\DiabolicUI_ChatButtons_36x36_Up.tga]], disabled = path .. [[textures\DiabolicUI_ChatButtons_36x36_UpDisabled.tga]], highlight = path .. [[textures\DiabolicUI_ChatButtons_36x36_UpHighlight.tga]] }, down = { normal = path .. [[textures\DiabolicUI_ChatButtons_36x36_Down.tga]], disabled = path .. [[textures\DiabolicUI_ChatButtons_36x36_DownDisabled.tga]], highlight = path .. [[textures\DiabolicUI_ChatButtons_36x36_DownHighlight.tga]] }, bottom = { normal = path .. [[textures\DiabolicUI_ChatButtons_36x36_Bottom.tga]], disabled = path .. [[textures\DiabolicUI_ChatButtons_36x36_BottomDisabled.tga]], highlight = path .. [[textures\DiabolicUI_ChatButtons_36x36_BottomHighlight.tga]] } } } }, editbox = { size = 34, -- height of the editbox frame offsets = { 1, 1, 4 + 7, 4 + 7 }, -- offset from editbox to surrounding content. backdrop = { bgFile = [[Interface\ChatFrame\ChatFrameBackground]], edgeFile = [[Interface\ChatFrame\ChatFrameBackground]], edgeSize = 1, tile = false, tileSize = 0, insets = { left = -1, right = -1, top = -1, bottom = -1 } }, glow = { offsets = { 4, 4, 4, 4 }, backdrop = { bgFile = [[Interface\ChatFrame\ChatFrameBackground]], edgeFile = path .. [[textures\DiabolicUI_GlowBorder_128x16.tga]], edgeSize = 4, tile = false, tileSize = 0, insets = { left = 0, right = 0, top = 0, bottom = 0 } } }, -- this is just added as decoration, to match d3 icon = { size = { 36, 36 }, position = { left = { "TOPLEFT", -(36 + 3), 1 }, -- align it with our border, not the frame right = { "TOPRIGHT", (36 + 3), 1} }, texture_size = { 64, 64 }, texture_position = { "CENTER", 0, 0 }, texture = path .. [[textures\DiabolicUI_ChatButtons_36x36_ChatIcon.tga]] }, colors = { backdrop = { 0, 0, 0, .5 }, border = { 0, 0, 0, .2 }, -- comes on top of the backdrop, so we don't need a high alpha value here glow = { 0, 0, 0, .5 }, shade = { 0, 0, 0, .7 } } }, tab = { }, --clamps = { -40, -40, -40, -220 }, --position = { "BOTTOMLEFT", UICenter, "BOTTOMLEFT", 0, 0 }, }, filters = { }, bubbles = { }, sounds = { } } -- default user settings local db = { windows = { autoposition = true, -- whether or not to autoposition the default chat frame hasbeenqueried = false -- whether the user has been asked about the previous }, filters = { }, bubbles = { }, sounds = { } } -- chat windows and frames Engine:NewStaticConfig("ChatWindows", config.windows) Engine:NewConfig("ChatWindows", db.windows) -- chat filters and emoticons Engine:NewStaticConfig("ChatFilters", config.filters) Engine:NewConfig("ChatFilters", db.filters) -- chat bubbles Engine:NewStaticConfig("ChatBubbles", config.bubbles) Engine:NewConfig("ChatBubbles", db.bubbles) -- chat sounds Engine:NewStaticConfig("ChatSounds", config.sounds) Engine:NewConfig("ChatSounds", db.sounds)
local ProfitGraph = class('ProfitGraph', Widget) local gradient = { '░', '▒', '▓', } local c_pos = Palette.Green local c_neg = Palette.Red local c_neut = Palette.Grey function ProfitGraph:initialize(x, y, w, data, options) self.options = options or {} Widget.initialize(self, x, y, w, self.options.height or 1) self.data = data or {} self.old_day = 0 end function ProfitGraph:update(dt, x, y) Widget.update(self, dt, x, y) local days = Game.time:indays() if days ~= self.old_day then self.clean = false self.old_day = days end end function ProfitGraph:_draw() love.graphics.setCanvas(self.canvas) love.graphics.clear(Palette.Background) -- print gain/loss/net self:print(2, self.ch + 1, "GAIN", Palette.Frame) self:print(2, self.ch + 1, "LOSS", Palette.Frame) self:print(2, self.ch + 1, " NET", Palette.Frame) v = Game.day_gross[1] local c = (v > 0 and Palette.MoneyGood) or (v <0 and Palette.MoneyBad) or Palette.MoneyNeutral self:print(self.cw - 15, self.ch + 1, v, c) v = Game.day_loss[1] local c = (v > 0 and Palette.MoneyGood) or (v <0 and Palette.MoneyBad) or Palette.MoneyNeutral self:print(self.cw - 15, self.ch + 2, v, c) v = Game.day_net[1] local c = (v > 0 and Palette.MoneyGood) or (v <0 and Palette.MoneyBad) or Palette.MoneyNeutral self:print(self.cw - 15, self.ch + 3, v, c) --print days self:print(self.cw - 15, self.ch + 1, Game.time:daysremaining() .. " days remaining", Palette.HighlightText) --draw graph for x=1,self.cw do self:print(x,3,'#') end end return ProfitGraph
-- This file is subject to copyright - contact swampservers@gmail.com for more information. --[[ This defines the function vgui(classname, (parent,)? constructor) which creates and returns a panel. The parent should only be passed when creating a root element (eg. a DFrame). Child elements should be constructed using vgui() from within the parent's constructor, and their parent will be set automatically. This is helpful for creating complex guis as the hierarchy of the layout is clearly reflected in the code structure. Recommended to use glualint or similar to keep the formatting correct. Example below. ]] local vgui_stack = {} setmetatable(vgui, { __call = function(_vgui, classname, parent_or_constructor, constructor) parent_or_constructor = parent_or_constructor or function() end if isfunction(parent_or_constructor) then constructor = parent_or_constructor parent_or_constructor = vgui_stack[#vgui_stack] --nil if empty else assert(table.IsEmpty(vgui_stack), "Expect empty vgui stack with specified parent") end assert(parent_or_constructor == nil or ispanel(parent_or_constructor)) local p = vgui.Create(classname, parent_or_constructor) table.insert(vgui_stack, p) ProtectedCall(function() constructor(p) end) table.remove(vgui_stack) return p end }) timer.Simple(0, function() vgui.GetControlTable("DFrame").CloseOnEscape = function(self) VGUI_CLOSE_ON_ESCAPE = (VGUI_CLOSE_ON_ESCAPE or 0) + 1 local p = self local hookname = "CloseOnEscape" .. tostring(VGUI_CLOSE_ON_ESCAPE) if gui.IsGameUIVisible() then gui.HideGameUI() end hook.Add("Think", hookname, function() -- and p:HasHierarchicalFocus() then if IsValid(p) then if gui.IsGameUIVisible() then gui.HideGameUI() p:Close() end else hook.Remove("Think", hookname) end end) end end) -- function vgui_example() -- vgui("DFrame", function(p) -- p:SetSize(400, 400) -- p:Center() -- p:MakePopup() -- p:SetTitle("Hi") -- p:DockPadding(50, 50, 50, 50) -- vgui("Panel", function(p) -- p:SetWidth(100) -- p:Dock(LEFT) -- function p:Paint(w, h) -- surface.SetDrawColor(255, 0, 0) -- surface.DrawRect(0, 0, w, h) -- end -- vgui("DLabel", function(p) -- p:SetText("Based") -- p:Dock(TOP) -- end) -- vgui("DLabel", function(p) -- p:SetText("Redpilled") -- p:Dock(BOTTOM) -- end) -- end) -- vgui("Panel", function(p) -- p:DockMargin(20, 20, 20, 20) -- p:Dock(FILL) -- function p:Paint(w, h) -- surface.SetDrawColor(0, 0, 255) -- surface.DrawRect(0, 0, w, h) -- end -- vgui("Panel", function(p) -- p:Dock(BOTTOM) -- vgui("DButton", function(p) -- p:SetText("Cringe") -- p:Dock(LEFT) -- end) -- vgui("DButton", function(p) -- p:SetText("Bluepilled") -- p:Dock(RIGHT) -- end) -- end) -- end) -- end) -- end
local displayHighScores = {} function displayHighScores:enter(previous, game) self.game = game end function displayHighScores:mousereleased(x, y, button) if button == 1 and self.game.ui.buttons.medium:isClicked(x, y) then Gamestate.switch(states.menu, self.game:reset()) end end function displayHighScores:draw() local mines_remaining = self.game.total_mines - self.game.total_flags self.game.ui:draw(mines_remaining, math.floor(self.game.score)) self.game.ui.buttons.medium.smiley = "win" self.game.ui.buttons.medium:draw() self.game.highscores:draw(self.game.difficulty) end return displayHighScores
function canPlayerCall(thePlayer) local phoneState = getElementData(thePlayer, "phonestate") or 0 local restrain = getElementData(thePlayer, "restrain") or 0 local injuriedanimation = getElementData(thePlayer, "injuriedanimation") local reconx = getElementData(thePlayer, "reconx") local calling = getElementData(thePlayer, "calling") local loggedin = getElementData(thePlayer, "loggedin") if restrain ~= 0 or phoneState > 0 or injuriedanimation or reconx or calling or isPedDead(thePlayer) or loggedin~=1 then return false end return true end function canPlayerPhoneRing(thePlayer) local phoneState = getElementData(thePlayer, "phonestate") or 0 local reconx = getElementData(thePlayer, "reconx") local calling = getElementData(thePlayer, "calling") if phoneState > 0 or reconx or calling then return false end return true end function canPlayerAnswerCall(thePlayer) local phoneState = getElementData(thePlayer, "phonestate") or 0 local restrain = getElementData(thePlayer, "restrain") or 0 local injuriedanimation = getElementData(thePlayer, "injuriedanimation") local reconx = getElementData(thePlayer, "reconx") local called = getElementData(thePlayer, "called") local loggedin = getElementData(thePlayer, "loggedin") if restrain ~= 0 or phoneState ~= 3 or injuriedanimation or reconx or not called or isPedDead(thePlayer) or loggedin~=1 then return false end return true end function canPlayerSlidePhoneIn(thePlayer) local phoneState = getElementData(thePlayer, "phonestate") or 0 local restrain = getElementData(thePlayer, "restrain") or 0 local injuriedanimation = getElementData(thePlayer, "injuriedanimation") local reconx = getElementData(thePlayer, "reconx") local called = getElementData(thePlayer, "called") local loggedin = getElementData(thePlayer, "loggedin") if restrain ~= 0 or injuriedanimation or isPedDead(thePlayer) or loggedin~=1 then return false end return true end function setED(e, i, n, s) return setElementData(e, i, n, s) end function getED(e, i) return getElementData(e, i) end function isQuitType(action) return action == "Unknown" or action == "Quit" or action == "Kicked" or action == "Banned" or action == "Bad Connection" or action == "Timed out" end ringtones = { [1] = "components/sounds/ringtones/viberate.mp3", [2] = "components/sounds/ringtones/iphone_5s.mp3", [3] = "components/sounds/ringtones/iphone_6.mp3", [4] = "components/sounds/ringtones/minion_ring_ring.mp3", [5] = "components/sounds/ringtones/perfect_ring_tone.mp3", [6] = "components/sounds/ringtones/sending_you_an_sms.mp3", [7] = "components/sounds/ringtones/sms.mp3", [8] = "components/sounds/ringtones/sms_new.mp3", [9] = "components/sounds/ringtones/sony_xperia_z3.mp3", [10] = "components/sounds/ringtones/sweetest_tone_ever.mp3", [11] = "components/sounds/ringtones/turn_down_for_what.mp3", [12] = "components/sounds/ringtones/vertu_new_tone.mp3", [13] = "components/sounds/ringtones/winggle_wiggle.mp3", [14] = "components/sounds/ringtones/apple_ring.mp3", [15] = "components/sounds/ringtones/google.mp3", } function removeNewLine(string) return string.gsub(string, "\n", " ") end
local function getDeco(rgba, lineWidth, pointSize, fillAlpha) if not rgba[4] then rgba[4] = 255 end local deco = View.ShapeDecoration.create() deco:setLineColor(rgba[1], rgba[2], rgba[3], rgba[4]) deco:setFillColor(rgba[1], rgba[2], rgba[3], fillAlpha) if lineWidth then deco:setLineWidth(lineWidth) end if pointSize then deco:setPointSize(pointSize) end return deco end local function graphDeco(color, headline, overlay) local deco = View.GraphDecoration.create() deco:setGraphColor(color[1], color[2], color[3], color[4] or 255) deco:setTitle(headline or '') deco:setGraphType('LINE') deco:setDynamicSizing(true) deco:setAspectRatio('EQUAL') deco:setYBounds(-10, 32) deco:setXBounds(0, 100) if overlay then deco:setAxisVisible(false) deco:setBackgroundVisible(false) deco:setGridVisible(false) deco:setLabelsVisible(false) deco:setTicksVisible(false) end return deco end local helper = {} helper.getDeco = getDeco helper.graphDeco = graphDeco return helper
local M = {} function M.should_use_provider(_) local not_coc_installed = vim.fn.exists("*CocActionAsync") == 0 local not_coc_service_initialized = vim.g.coc_service_initialized == 0 if not_coc_installed or not_coc_service_initialized then return end local coc_attached = vim.fn.call("CocAction", { "ensureDocument" }) local has_symbols = vim.fn.call("CocHasProvider", { "documentSymbol" }) return coc_attached and has_symbols end function M.hover_info(_, _, on_info) on_info(nil, { contents = { kind = "markdown", contents = { "No extra information availaible!" } } }) end ---@param on_symbols function function M.request_symbols(on_symbols) vim.fn.call("CocActionAsync", { "documentSymbols", function(_, symbols) on_symbols({ [1000000] = { result = symbols } }) end, }) end return M
--[[ Ask the caller to save their message or hold for an operator. ]] -- Key map for transferring. transfer_keys = { ["1"] = "caller_save_recorded_message transfer_to_operator", } return { -- Ask to accept message. { action = "play_phrase", phrase = "accept_recording_or_hold", keys = transfer_keys, }, -- Wait for response. { action = "wait", milliseconds = profile.menu_replay_wait, keys = transfer_keys, }, -- No response, so delete the message and inform the user. { action = "call_sequence", sequence = "sub:cleanup_temp_recording", }, { action = "play_phrase", phrase = "message_deleted_undeleted", phrase_arguments = "1", }, { action = "call_sequence", sequence = "transfer_to_operator", }, }
--entity require("prototypes.entity.entities") --items require("prototypes.item.items") --recipies require("prototypes.recipe.recipes") --tech require("prototypes.tech.tech")
-- -- main.lua -- Facebook Audience Network Sample App -- -- Copyright (c) 2017 Corona Labs Inc. All rights reserved. -- local fban = require("plugin.fbAudienceNetwork.paid") local widget = require("widget") local json = require("json") local appStatus = { customYTest = false, -- adds UI elements to test custom Y positioning useAndroidImmersive = false, -- sets android ui visibility to immersiveSticky to test hidden UI bar useLegacyAPI = false -- use legacy API for function calls } -------------------------------------------------------------------------- -- set up UI -------------------------------------------------------------------------- display.setStatusBar( display.HiddenStatusBar ) display.setDefault( "background", 1 ) if appStatus.useAndroidImmersive then native.setProperty( "androidSystemUiVisibility", "immersiveSticky") end local fbanLogo = display.newImage( "fbanlogo.png" ) fbanLogo.anchorY = 0 fbanLogo:scale( 0.17, 0.17 ) local setRed = function(self) self:setFillColor(1,0,0) end local setGreen = function(self) self:setFillColor(0,1,0) end local r1 local r2 local oldOrientation if (appStatus.customYTest) then r1 = display.newRect(0,0,50,50) r1.anchorX, r1.anchorY = 0, 0 setRed(r1) r2 = display.newRect(0,0,50,50) r2.anchorX, r2.anchorY = 1, 1 setRed(r2) end local subTitle = display.newText { text = "plugin for Corona SDK", font = display.systemFont, fontSize = 14 } subTitle:setTextColor( 66/255, 88/255, 148/255 ) eventDataTextBox = native.newTextBox( display.contentCenterX, display.contentHeight - 50, display.contentWidth - 10, 100) eventDataTextBox.placeholder = "Event data will appear here" eventDataTextBox.hasBackground = false local processEventTable = function(event) local logString = json.prettify(event):gsub("\\","") logString = "\nPHASE: "..event.phase.." - - - - - - - - - \n" .. logString print(logString) eventDataTextBox.text = logString .. eventDataTextBox.text end -- -------------------------------------------------------------------------- -- -- plugin implementation -- -------------------------------------------------------------------------- -- forward declarations local appId = "n/a" local adUnits = {} local platformName = system.getInfo("platformName") local testMode = true local testModeButton local showTestWarning = true local iReady local bReady local rReady local bannerLine local placementIds = { banner = "407318409718485_429989937451332", -- Kirill's FB placements banner2 = "407318409718485_429989787451347", interstitial = "407318409718485_429989387451387", rewarded = "407318409718485_719665225150467", } print("Placements: "..json.prettify(placementIds)) local fbanListener = function(event) processEventTable(event) if (event.phase == "loaded") then if (event.type == "interstitial") then setGreen(iReady) elseif (event.type == "banner") then setGreen(bReady) elseif (event.type == "rewardedVideo") then setGreen(rReady) end end end local deviceHashes = { "84e999bc18567d4e1eea4dd8dec0a68f6737c080", -- Devpod 6G (Ingemar) "0250249fe64b912160b99ed0522aad1e55ac3de1", -- Devphone 4s (Ingemar) "a4b089b24169f73201c876b4c5244dc5", -- Galaxy S III (Ingemar) "b9309f2a8c53527a1a77dec4eb832966" , -- Nexus 7 } -- initialize FBAN if (appStatus.useLegacyAPI) then fban.init(fbanListener, deviceHashes) else fban.init(fbanListener, {testDevices=deviceHashes}) end local interstitialBG = display.newRect(0,0,320,30) local interstitialLabel = display.newText { text = "I N T E R S T I T I A L", font = display.systemFontBold, fontSize = 18, } interstitialLabel:setTextColor(1) local loadInterstitialButton = widget.newButton { label = "Load", width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) setRed(iReady) if (appStatus.useLegacyAPI) then fban.load("interstitial", placementIds.interstitial) else fban.load("interstitial", {placementId=placementIds.interstitial}) end end } local showInterstitialButton = widget.newButton { label = "Show", width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) setRed(iReady) print("interstitial is loaded: ", fban.isLoaded(placementIds.interstitial)) if (appStatus.useLegacyAPI) then fban.show("interstitial", placementIds.interstitial) else fban.show("interstitial", {placementId=placementIds.interstitial}) end end } local rewardedBG = display.newRect(0,0,320,30) local rewardedLabel = display.newText { text = "R E W A R D E D", font = display.systemFontBold, fontSize = 18, } rewardedLabel:setTextColor(1) local loadrewardedButton = widget.newButton { label = "Load", width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) setRed(rReady) if (appStatus.useLegacyAPI) then fban.load("rewardedVideo", placementIds.rewarded) else fban.load("rewardedVideo", {placementId=placementIds.rewarded}) end end } local showrewardedButton = widget.newButton { label = "Show", width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) setRed(rReady) print("rewarded is loaded: ", fban.isLoaded(placementIds.rewarded)) if (appStatus.useLegacyAPI) then fban.show("rewardedVideo", placementIds.rewarded) else fban.show("rewardedVideo", {placementId=placementIds.rewarded}) end end } local bannerBG = display.newRect(0,0,320,30) local bannerLabel = display.newText { text = "B A N N E R", font = display.systemFontBold, fontSize = 18, } bannerLabel:setTextColor(1) local loadBannerButton = widget.newButton { label = "Load", width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) setRed(bReady) if (appStatus.useLegacyAPI) then fban.load("banner", placementIds.banner, "BANNER_HEIGHT_50") else fban.load("banner", {placementId=placementIds.banner, bannerSize="BANNER_HEIGHT_50"}) end end } local hideBannerButton = widget.newButton { label = "Hide", width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) setRed(bReady) fban.hide(placementIds.banner) end } local showBannerButtonT = widget.newButton { label = "Top", fontSize = 14, width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) print("Banner is loaded: ", fban.isLoaded(placementIds.banner)) print("Banner size: ", fban.getSize(placementIds.banner)) if appStatus.customYTest then if (appStatus.useLegacyAPI) then fban.show("banner", placementIds.banner, {y=50}) else fban.show("banner", {placementId=placementIds.banner, y=50}) end else if (appStatus.useLegacyAPI) then fban.show("banner", placementIds.banner, {yAlign="top"}) else fban.show("banner", {placementId=placementIds.banner, y="top"}) end end end } local showBannerButtonB = widget.newButton { label = "Bottom", fontSize = 14, width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) print("Banner is loaded: ", fban.isLoaded(placementIds.banner)) print("Banner size: ", fban.getSize(placementIds.banner)) if appStatus.customYTest then if (appStatus.useLegacyAPI) then fban.show("banner", placementIds.banner, {y=-50}) else fban.show("banner", {placementId=placementIds.banner, y=-50}) end else if (appStatus.useLegacyAPI) then fban.show("banner", placementIds.banner, {yAlign="bottom"}) else fban.show("banner", {placementId=placementIds.banner, y="bottom"}) end end end } local showBannerButtonBLine = widget.newButton { label = "Under Line", fontSize = 14, width = 100, height = 40, labelColor = { default={ 0, 0, 0 }, over={ 0.7, 0.7, 0.7 } }, onRelease = function(event) print("Banner is loaded: ", fban.isLoaded(placementIds.banner)) print("Banner size: ", fban.getSize(placementIds.banner)) if (appStatus.useLegacyAPI) then fban.show("banner", placementIds.banner, {y=72+math.abs(display.screenOriginY)}) else fban.show("banner", {placementId=placementIds.banner, y=72+math.abs(display.screenOriginY)}) end end } iReady = display.newCircle(10, 10, 6) iReady.strokeWidth = 2 iReady:setStrokeColor(0) setRed(iReady) rReady = display.newCircle(10, 10, 6) rReady.strokeWidth = 2 rReady:setStrokeColor(0) setRed(rReady) bReady = display.newCircle(10, 10, 6) bReady.strokeWidth = 2 bReady:setStrokeColor(0) setRed(bReady) -- -------------------------------------------------------------------------- -- -- device orientation handling -- -------------------------------------------------------------------------- local layoutDisplayObjects = function(orientation) fbanLogo.x, fbanLogo.y = display.contentCenterX, 0 if (appStatus.customYTest) then r1.x = display.screenOriginX r1.y = display.screenOriginY r2.x = display.actualContentWidth + display.screenOriginX r2.y = display.actualContentHeight + display.screenOriginY end subTitle.x = display.contentCenterX subTitle.y = 60 bannerLine = display.newLine( display.screenOriginX, 72, display.actualContentWidth, 72) bannerLine.strokeWidth = 2 bannerLine:setStrokeColor(1,0,0) if (orientation == "portrait") then eventDataTextBox.x = display.contentCenterX eventDataTextBox.y = display.contentHeight - 50 eventDataTextBox.width = display.contentWidth - 10 else -- put it waaaay offscreen eventDataTextBox.y = 2000 end interstitialBG.x, interstitialBG.y = display.contentCenterX, 150 interstitialBG:setFillColor(66/255, 88/255, 148/255) interstitialLabel.x = display.contentCenterX interstitialLabel.y = 150 iReady.x = display.contentCenterX + 140 iReady.y = 150 setRed(iReady) loadInterstitialButton.x = display.contentCenterX - 50 loadInterstitialButton.y = interstitialLabel.y + 40 showInterstitialButton.x = display.contentCenterX + 50 showInterstitialButton.y = interstitialLabel.y + 40 rewardedBG.x, rewardedBG.y = display.contentCenterX, 80 rewardedBG:setFillColor(66/255, 88/255, 148/255) rewardedLabel.x = display.contentCenterX rewardedLabel.y = 80 rReady.x = display.contentCenterX + 140 rReady.y = 80 setRed(rReady) loadrewardedButton.x = display.contentCenterX - 50 loadrewardedButton.y = rewardedLabel.y + 40 showrewardedButton.x = display.contentCenterX + 50 showrewardedButton.y = rewardedLabel.y + 40 bannerBG.x, bannerBG.y = display.contentCenterX, 220 bannerBG:setFillColor(66/255, 88/255, 148/255 ) bannerLabel.x = display.contentCenterX bannerLabel.y = 220 bReady.x = display.contentCenterX + 140 bReady.y = 220 setRed(bReady) loadBannerButton.x = display.contentCenterX - 50 loadBannerButton.y = bannerLabel.y + 40 hideBannerButton.x = display.contentCenterX + 50 hideBannerButton.y = bannerLabel.y + 40 showBannerButtonB.x = display.contentCenterX showBannerButtonB.y = bannerLabel.y + 80 showBannerButtonT.x = display.contentCenterX - 100 showBannerButtonT.y = bannerLabel.y + 80 showBannerButtonBLine.x = display.contentCenterX + 100 showBannerButtonBLine.y = bannerLabel.y + 80 end local onOrientationChange = function(event) local eventType = event.type local orientation = eventType:starts("landscape") and "landscape" or eventType if (orientation == "portrait") or (orientation == "landscape") then if (oldOrientation == nil) then oldOrientation = orientation else if (orientation ~= oldOrientation) then oldOrientation = orientation fban.hide(placementIds.banner) layoutDisplayObjects(eventType) end end end end Runtime:addEventListener("orientation", onOrientationChange) -- initial layout layoutDisplayObjects(system.orientation)
--WIP, copy functionality between two cassette tapes.-- --NOT FUNCTIONAL, THIS IS A WORK IN PROGRESS-- local tape1, tape2 = peripheral.find("tape_drive") --get both --display findings write("Found ") --tape 1 if tape1.getLabel() ~= nil then write(tape1.getLabel) else write("unnamed tape") end write(" (" .. tape1.getSize() .. ")") write(" AND ") --tape 2 if tape2.getLabel() ~= nil then write(tape2.getLabel) else write("unnamed tape") end write(" (" .. tape2.getSize() .. ")") write("\n") -- Scan in user input local function userSelectTape() write("which tape would you like to have the content pasted on (The unselected one will be copied from)?\nEnter '1' or '2'") local selectedTape = read() print("You chose: tape ", selectedTape) --weird way of concat. return selectedTape end -- Interpret User Input local function copyTape(selectedTape) --rewind both tape1.seek(-tape1.getSize()) tape2.seek(-tape2.getSize()) -- get smallest local smallest = nil if tape1.getSize() > tape2.getSize() then smallest = tape2.getSize() else smallest = tape2.getSize end local copyContent = nil if tonumber(selectedTape) == 1 then -- copy from tape 1 to tape 2 for i=1,smallest do -- copyContent = tape1.read() -- tape2.write(copyContent) tape2.write(tape1.read()) --read/write --seek to next position tape1.seek(1) tape2.seek(1) end elseif tonumber(selectedTape) == 2 then --copy from tape 2 to tape 1 for i=1,smallest do tape1.write(tape2.read()) --read/write --seek to next byte tape1.seek(1) tape2.seek(1) end else return error end end --Initilizing: local function StartCopy() copyTape(userSelectTape()) end --[[ ask user which one they want to copy from/to seek to start of both, loop read first byte of one, copy to write as byte of other, seek forward 1 end (at end of tape or song?) Bugs/TODO: error checking if one tape is larger than other. ]]
local VoiceMode = { { dist = 3, message = "Voice range set on 3 meters." }, { dist = 8, message = "Voice range set on 8 meters." }, { dist = 14, message = "Voice range set on 14 meters." }, { veh = true, dist = 4, func = function(ped) return IsPedInAnyVehicle(ped) end, message = "Voice range set to your vehicle." }, } local Voice = {} Voice.Listeners = {} Voice.Mode = 2 Voice.distance = 8.0 Voice.onlyVehicle = false local function SendVoiceToPlayer(intPlayer, boolSend) Citizen.InvokeNative(0x97DD4C5944CC2E6A, intPlayer, boolSend) end local function GetPlayers() local players = {} for i = 0, 64 do if NetworkIsPlayerActive(i) then players[#players + 1] = i end end return players end function Voice:UpdateVoices() local ped = GetPlayerPed(-1) local InVeh = IsPedInAnyVehicle(ped) if Voice.onlyVehicle and not InVeh then Voice.Mode = 1 Voice:OnModeModified() end for k,v in pairs(GetPlayers()) do local otherPed, serverID = GetPlayerPed(v), GetPlayerServerId(v) if otherPed and Voice:CanPedBeListened(ped, otherPed) then if not Voice.Listeners[serverID] then Voice.Listeners[serverID] = true end SendVoiceToPlayer(v, true) elseif Voice.Listeners[serverID] then Voice.Listeners[serverID] = false SendVoiceToPlayer(v, false) end end if Voice.onlyVehicle and not InVeh then Voice.Mode = 1 Voice:OnModeModified() end end local function ShowAboveRadarMessage(message) SetNotificationTextEntry("jamyfafi") AddTextComponentString(message) return DrawNotification(0, 1) end local notifID function Voice:OnModeModified() local modeData = VoiceMode[self.Mode] if modeData then self.distance = modeData.dist self.onlyVehicle = modeData.veh if modeData.message then if notifID then RemoveNotification(notifID) end notifID = ShowAboveRadarMessage(modeData.message) Citizen.SetTimeout(4000, function() if notifID then RemoveNotification(notifID) end end) end self:UpdateVoices() end end function Voice:CanPedBeListened(ped, otherPed) local listenerHeadPos, InSameVeh = GetPedBoneCoords(otherPed, 12844, .0, .0, .0), IsPedInAnyVehicle(ped) and GetVehiclePedIsUsing(ped) == GetVehiclePedIsUsing(otherPed) local distance = GetDistanceBetweenCoords(listenerHeadPos, GetEntityCoords(ped)) local bypassVOIP, checkDistance = InSameVeh, self.distance return bypassVOIP or (not self.onlyVehicle and (HasEntityClearLosToEntityInFront(ped, otherPed) or distance < (math.max(0, math.min(18, checkDistance)) * .6)) and distance < checkDistance) end function Voice:ShouldSendVoice() return NetworkIsPlayerTalking(PlayerId()) or IsControlPressed(0, 249) end local shouldReset = false Citizen.CreateThread(function() for i = 0, 63 do SendVoiceToPlayer(i, false) end while true do Citizen.Wait(300) local sendVoice = Voice:ShouldSendVoice() if sendVoice then if not shouldReset then shouldReset = true --TriggerEvent("pichot:toggleNUI", { voip = Voice.Mode }) -- you can implement a microphone icon end elseif not sendVoice and shouldReset then shouldReset = false --TriggerEvent("pichot:toggleNUI", { voip = false }) for i = 0, 63 do SendVoiceToPlayer(i, false) end end NetworkSetTalkerProximity(-1000.0) Voice:UpdateVoices() end end) local function DrawText3D(x,y,z, canSee) local _, _x, _y = World3dToScreen2d(x,y,z) local px, py, pz = table.unpack(GetGameplayCamCoords()) local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1) local scale = ( 1 / dist ) * 20 scale = scale * ( ( 1 / GetGameplayCamFov() ) * 100 ) local color = canSee and {0, 70, 200} or {255, 255, 255} SetDrawOrigin(x,y,z, 0) DrawRect(.0, .02, .0003 * scale, .0375 * scale, color[1], color[2], color[3], 255) ClearDrawOrigin() end local function UpdateVocalMode(mode) local nextMode = mode or Voice.Mode + 1 while not VoiceMode[nextMode] or (VoiceMode[nextMode] and VoiceMode[nextMode].func and not VoiceMode[nextMode].func(GetPlayerPed(-1))) do nextMode = VoiceMode[nextMode + 1] or 1 end Voice.Mode = nextMode Voice:OnModeModified() end Citizen.CreateThread(function() while true do Citizen.Wait(0) if IsControlJustPressed(1, 167) then UpdateVocalMode() end if IsControlPressed(1, 167) then local ped = GetPlayerPed(-1) local headPos = GetPedBoneCoords(ped, 12844, .0, .0, .0) for k,v in pairs(GetPlayers()) do local otherPed = GetPlayerPed(v) if otherPed and Voice.Listeners[GetPlayerServerId(v)] then local entPos = GetEntityCoords(otherPed) DrawText3D(entPos.x, entPos.y, entPos.z, true) end end local distance = Voice.distance + .0 DrawMarker(28, headPos, 0.0, 0.0, 0.0, 0.0, 0.0, .0, distance + .0, distance + .0, distance + .0, 20, 192, 255, 70, 0, 0, 2, 0, 0, 0, 0) end end end)
local nvim_lsp = require('lspconfig') -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end --Enable completion triggered by <c-x><c-o> -- buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') -- Mappings. local opts = { noremap=true, silent=true } -- See `:help vim.lsp.*` for documentation on any of the below functions buf_set_keymap('n', 'gD', '<Cmd>lua vim.lsp.buf.declaration()<CR>', opts) buf_set_keymap('n', 'gd', '<Cmd>lua vim.lsp.buf.definition()<CR>', opts) buf_set_keymap('n', 'K', '<Cmd>lua vim.lsp.buf.hover()<CR>', opts) buf_set_keymap('n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) buf_set_keymap('n', '<C-s>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) buf_set_keymap('n', '<C-m>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) buf_set_keymap('n', '<C-m>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) buf_set_keymap('n', '<C-m>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) buf_set_keymap('n', '<C-m>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) buf_set_keymap('n', '<C-m>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) buf_set_keymap('n', '<C-m>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) buf_set_keymap('n', '<C-m>e', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) buf_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) buf_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) buf_set_keymap('n', '<C-m>qf', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) buf_set_keymap("n", "<C-m>f", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) buf_set_keymap("v", "<C-m>ca", "<cmd>lua vim.lsp.buf.range_code_action()<CR>", opts) buf_set_keymap("n", "<C-m>ds", "<cmd>lua vim.lsp.buf.document_symbol()<CR>", opts) end local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.documentationFormat = { 'markdown', 'plaintext' } capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.preselectSupport = true capabilities.textDocument.completion.completionItem.insertReplaceSupport = true capabilities.textDocument.completion.completionItem.labelDetailsSupport = true capabilities.textDocument.completion.completionItem.deprecatedSupport = true capabilities.textDocument.completion.completionItem.commitCharactersSupport = true capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } capabilities.textDocument.completion.completionItem.resolveSupport = { properties = { 'documentation', 'detail', 'additionalTextEdits', } } -- Use a loop to conveniently call 'setup' on multiple servers and -- map buffer local keybindings when the language server attaches local servers = { "tsserver" , "ccls", "omnisharp", "svelte"} for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach } require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) require "lsp_signature".setup({ floating_window = true, floating_window_above_cur_line = true, hint_enable = false, }) capabilities = capabilities end local pid = vim.fn.getpid() -- On linux/darwin if using a release build, otherwise under scripts/OmniSharp(.Core)(.cmd) local omnisharp_bin = "/usr/bin/omnisharp" -- on Windows -- local omnisharp_bin = "/path/to/omnisharp/OmniSharp.exe" require'lspconfig'.omnisharp.setup{ cmd = { omnisharp_bin, "--languageserver" , "--hostPID", tostring(pid) }; require "lsp_signature".setup({ floating_window = true, floating_window_above_cur_line = true, hint_enable = false, }) } vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( vim.lsp.handlers.hover, { border = "single" } ) vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with( vim.lsp.handlers.signature_help, { border = "single" } ) require'lspconfig'.html.setup { capabilities = capabilities, require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()) } require'lspconfig.configs'.ls_emmet = { default_config = { cmd = { 'ls_emmet', '--stdio' }; filetypes = { 'html', 'css', 'scss' }; -- Add the languages you use, see language support root_dir = function(fname) return vim.loop.cwd() end; settings = {}; }; } require'lspconfig'.ls_emmet.setup{ require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities()), capabilities = capabilities, } require'lspconfig'.cssls.setup { capabilities = capabilities, }
local util = require("util") local shell = require("shell") local robot = require("robot") local libnav = require("libnav") local libplace = require("libplace") local filesystem = require("filesystem") local libcapacity = require("libcapacity") local component = require("component") local sides = require("sides") local libchest = {} local chest_dir = shell.getWorkingDirectory().."/chests" local chests_cfg = chest_dir.."/chests.txt" if not filesystem.isDirectory(chest_dir) then assert(filesystem.makeDirectory(chest_dir)) end local function db_file(chest) return chest_dir.."/"..chest..".db" end local function format_slot(stack, name) if not stack then return "" end util.check_stack(stack) if not name then name = stack.name end local format_name = stack.name if not (stack.name == name) then format_name = name end -- force specified name (for aliasing support) local count = stack.size local maxsize = stack.maxSize -- set capacity for original name, not aliased name libcapacity.set_capacity(name, maxsize) return "" .. format_name .. " | " .. count .. " | " .. maxsize end local function parse_slot(slot) if slot:len() == 0 then return { name = nil, count = 0, capacity = 0 } end local parts = util.split_sa(slot, "|") assert(#parts == 3, "invalid slot data") return { name = parts[1], count = tonumber(parts[2]), capacity = tonumber(parts[3]) } end function libchest.init(name, place) -- gonna go have a look local backup = libnav.get_location() libplace.go_to(place) -- create chest file local ico = component.inventory_controller local capacity = ico.getInventorySize(sides.front) local cfg = util.config(db_file(name)) cfg:set("location", place) cfg:set("capacity", capacity) -- read out initial state for i = 1, capacity do local stack = ico.getStackInSlot(sides.front, i) local info = format_slot(stack) cfg:set("slot "..i, info) end cfg:close() -- go back where we were libnav.go_to(backup) end function libchest.refresh() local chestnames = libchest.list_chests() for k,v in pairs(chestnames) do print("Refresh "..v) local info = libchest.get_info(v) libchest.init(v, info.location) end print("Done.") libnav.flush() end function libchest.define(name, location) assert(name and location) -- add chest local chestmap = util.split_so(util.config_get(chests_cfg, "chests", ""), "|") assert(not chestmap[name], "Chest already defined") chestmap[name] = true util.config_set(chests_cfg, "chests", util.join_so(chestmap, "|")) libchest.init(name, location) libnav.flush() end function libchest.list_chests() return util.split_sa(util.config_get(chests_cfg, "chests", ""), "|") end function libchest.get_info(name) local cfg = util.config(db_file(name)) assert(not cfg.fresh, "uninitialized chest queried: '"..name.."'") local location = cfg:get("location") local capacity = tonumber(cfg:get("capacity")) local slots = {} for i = 1, capacity do local info = cfg:get("slot "..i) slots[i] = parse_slot(info) end cfg:close() obj = { name = name, location = location, capacity = capacity, slots = slots } -- store up to count function obj.store(self, slot, item_slot, name, count) local ico = component.inventory_controller libplace.go_to(self.location) robot.select(item_slot) -- capture possible tuple local res = table.pack(ico.dropIntoSlot(sides.forward, slot, count)) if res[1] then -- write change local stack = ico.getStackInSlot(sides.front, slot) util.config_set(db_file(self.name), "slot "..slot, format_slot(stack, name)) end return table.unpack(res) end -- grab up to count function obj.grab(self, slot, item_slot, name, count) local ico = component.inventory_controller libplace.go_to(self.location) robot.select(item_slot) -- capture possible tuple local res = table.pack(ico.suckFromSlot(sides.front, slot, count)) if res[1] then -- write change local stack = ico.getStackInSlot(sides.front, slot) util.config_set(db_file(self.name), "slot "..slot, format_slot(stack, name)) end return table.unpack(res) end return obj end return libchest
local olas = false function start (song) end function fadeInAndGo() end function update (elapsed) local currentBeat = (songPos / 1000)*(bpm/196) if olas == true then for i=0,7 do setActorY(defaultStrum0Y + 2 * math.cos((currentBeat + i*0.45) * math.pi), i) tweenPosYAngle(i,getActorY(i) - 80,0,0.5) end end if mover == true then for i=0,7 do setActorX(_G['defaultStrum'..i..'X'] + 22 * math.sin((currentBeat + i*0.25) * math.pi), i) setActorY(_G['defaultStrum'..i..'Y'] + 22 * math.cos((currentBeat + i*0.25) * math.pi), i) end end end function beatHit (beat) end function stepHit (step) if curStep == 516 then olas = true mover = true end end function keyPressed (key) end
local key = KEYS[1] -- 没秒最大请求数 local max_burst_seconds = ARGV[1] -- 存储的最大数量 local max_permits = ARGV[2] -- 每个请求需要的毫秒 --local stable_interval_millis = 1 * 1000 / max_burst_seconds local stable_interval_millis = ARGV[3] -- 存储的令牌 local stored_permits = ARGV[4] -- 获取时毫秒级间戳 local now_millis= ARGV[5] -- 下一次刷新Token的时间 local next_free_ticket_millis = now_millis -- 创建一个Redis限流器 if (redis.call('exists', key) == 0) then --max_burst_seconds redis.call('hset', key, "max_burst_seconds" , max_burst_seconds); --max_permits redis.call('hset', key, "max_permits", max_permits); --stable_interval_millis redis.call('hset', key, "stable_interval_millis", stable_interval_millis); --stored_permits redis.call('hset', key, "stored_permits", stored_permits); --next_free_ticket_millis redis.call('hset', key, "next_free_ticket_millis", next_free_ticket_millis); return next_free_ticket_millis --过期时间 --redis.call('pexpire', key, ARGV[6]); else local smooth_bursty_rate_limiter = redis.call('hget', key, 'next_free_ticket_millis') return smooth_bursty_rate_limiter end -- next_free_ticket_millis if (now_millis > next_free_ticket_millis) then local new_permits = (now_millis - next_free_ticket_millis) / stable_interval_millis stored_permits = math.min(max_permits, stored_permits + new_permits); next_free_ticket_millis = now_millis; end -- 所需要的令牌 local permits = 1 -- 刷新令牌 if now_millis > next_free_ticket_millis then local new_permits = (now_millis - next_free_ticket_millis) / stable_interval_millis stored_permits = math.min(max_permits, stored_permits + new_permits); next_free_ticket_millis = now_millis; end -- 刷新令牌的数量过后在判断获取N个令牌需要等待多少时间 local stored_permits_to_spend = math.min(permits, stored_permits); local fresh_permits = permits - stored_permits_to_spend; -- 代码参考 SmoothRateLimiter , 这里 SmoothRateLimiter 里面把wait时间放到下一次的请求里面, 这里直接返回比较符合场景 local wait_millis = fresh_permits * stable_interval_millis; stored_permits = stored_permits - stored_permits_to_spend -- save redis.pcall("HMSET",key,"max_burst_seconds", max_burst_seconds) redis.pcall("HMSET",key,"max_permits", max_permits) redis.pcall("HMSET",key,"stable_interval_millis", stable_interval_millis) redis.pcall("HMSET",key,"stored_permits", stored_permits) redis.pcall("HMSET",key,"next_free_ticket_millis", next_free_ticket_millis) return wait_millis;
local log = require("log") local Api = require("coreApi") local json = require("json") local http = require("http") function ReceiveFriendMsg(CurrentQQ, data) if data.FromUin ==2986807981 then--防止自我复读 return 1 end img_url = " " keyWord = " " content = "" if string.find(data.Content, "上证指数") == 1 then keyWord ="sh000001" end if string.find(data.Content, "创业板指数") == 1 then keyWord ="sz399006" end if keyWord ~=" " then img_url = "http://image.sinajs.cn/newchart/min/n/"..keyWord ..".gif" sendfriendstockpic(CurrentQQ,data,img_url,content) return 1 end if string.find(data.Content, "股票代码") == 1 then keyWord = data.Content:gsub("股票代码", "") if keyWord =="" then return 1 end --关键字为空则退出 img_url = "http://image.sinajs.cn/newchart/min/n/"..keyWord ..".gif" content = "股票代码以新浪财经为准http://biz.finance.sina.com.cn/suggest/lookup_n.php" sendfriendstockpic(CurrentQQ,data,img_url,content) img_url = nil keyWord = nil content = nil return 1 end return 1 end function ReceiveGroupMsg(CurrentQQ, data) if data.FromUserId ==2986807981 then--防止自我复读 return 1 end img_url = " " keyWord = " " content = "" if string.find(data.Content, "上证指数") == 1 then keyWord ="sh000001" end if string.find(data.Content, "创业板指数") == 1 then keyWord ="sz399006" end if keyWord ~=" " then img_url = "http://image.sinajs.cn/newchart/min/n/"..keyWord ..".gif" sendgroupstockpic(CurrentQQ,data,img_url,content) return 1 end if string.find(data.Content, "股票代码") == 1 then keyWord = data.Content:gsub("股票代码", "") if keyWord =="" then return 1 end --关键字为空则退出 img_url = "http://image.sinajs.cn/newchart/min/n/"..keyWord ..".gif" ApiRet = Api.Api_SendMsg( CurrentQQ, { toUser = data.FromGroupId, --回复当前消息的来源群ID sendToType = 2, --2发送给群1发送给好友3私聊 groupid = 0, --不是私聊自然就为0咯 atUser = 0, --是否 填上data.FromUserId就可以复读给他并@了 sendMsgType = "PicMsg", content = "股票代码以新浪财经为准http://biz.finance.sina.com.cn/suggest/lookup_n.php", picUrl = img_url, picBase64Buf = "", fileMd5 = "" } ) img_url = nil return 1 end return 1 end function ReceiveEvents(CurrentQQ, data, extData) return 1 end function sendgroupstockpic(CurrentQQ,data,img_url,content) if img_url == "" then return 1 end --空则退出 ApiRet = Api.Api_SendMsg( CurrentQQ, { toUser = data.FromGroupId, --回复当前消息的来源群ID sendToType = 2, --2发送给群1发送给好友3私聊 groupid = 0, --不是私聊自然就为0咯 atUser = 0, --是否 填上data.FromUserId就可以复读给他并@了 sendMsgType = "PicMsg", content = content, picUrl = img_url, picBase64Buf = "", fileMd5 = "" } ) return 1 end function sendfriendstockpic(CurrentQQ,data,img_url,content) if img_url =="" then return 1 end --空则退出 ApiRet = Api.Api_SendMsg( CurrentQQ, { toUser = data.FromUin, --回复当前消息的来源群ID sendToType = 1, --2发送给群1发送给好友3私聊 sendMsgType = "PicMsg", content = content, picUrl = img_url, picBase64Buf = "", fileMd5 = "" } ) return 1 end
-- -- tests/actions/vstudio/vc2010/test_platform_toolset.lua -- Validate VC platform toolset generation. -- Copyright (c) 2013-2015 Jason Perkins and the Premake project -- local p = premake local suite = test.declare("vstudio_vs2010_platform_toolset") local vc2010 = p.vstudio.vc2010 -- -- Setup -- local wks, prj function suite.setup() p.action.set("vs2012") wks, prj = test.createWorkspace() files "hello.cpp" end local function prepare() cfg = test.getconfig(prj, "Debug") vc2010.platformToolset(cfg) end -- -- Check default values for each version. -- function suite.correctDefault_onVS2010() p.action.set("vs2010") prepare() test.capture [[ <PlatformToolset>v100</PlatformToolset> ]] end function suite.correctDefault_onVS2012() p.action.set("vs2012") prepare() test.capture [[ <PlatformToolset>v110</PlatformToolset> ]] end function suite.correctDefault_onVS2013() p.action.set("vs2013") prepare() test.capture [[ <PlatformToolset>v120</PlatformToolset> ]] end -- -- Check for overrides from project scripts. -- function suite.canOverrideFromScript_withV() toolset "v90" prepare() test.capture [[ <PlatformToolset>v90</PlatformToolset> ]] end function suite.canOverrideFromScript_withMsc() toolset "msc-100" prepare() test.capture [[ <PlatformToolset>v100</PlatformToolset> ]] end function suite.canOverrideFromScript_withXP() toolset "v120_xp" prepare() test.capture [[ <PlatformToolset>v120_xp</PlatformToolset> ]] end function suite.canOverrideFromScript_withLLVM() toolset "msc-llvm-vs2014_xp" prepare() test.capture [[ <PlatformToolset>LLVM-vs2014_xp</PlatformToolset> ]] end -- -- Check if platform toolset element is being emitted correctly. -- function suite.output_onConsoleAppAndNoCpp() kind "ConsoleApp" removefiles "hello.cpp" prepare() test.capture [[ <PlatformToolset>v110</PlatformToolset> ]] end function suite.skipped_onNoMakefileAndNoCpp() kind "Makefile" removefiles "hello.cpp" prepare() test.isemptycapture() end function suite.output_onNoMakefileAndCpp() kind "Makefile" prepare() test.capture [[ <PlatformToolset>v110</PlatformToolset> ]] end
me=game.Players.localPlayer; ms=me:getMouse''; cf,ca,r,mr,i,v3,bc,sin,cos,pi=CFrame.new,CFrame.Angles,math.rad,math.random,Instance.new,Vector3.new,BrickColor.new,math.sin,math.cos,math.pi; anim='Idle'; Parts={}; runna=game:findService'RunService'; local char=me.Character; --char.Archivable=true; local lam=char['Left Arm']; local ram=char['Right Arm']; local llg=char['Left Leg']; local rlg=char['Right Leg']; local hed=char.Head; local tor=char.Torso; local hrp=char.HumanoidRootPart; local hum=char.Humanoid; cp=(function(par,size,mat,color,t) p=i('Part',par); p.formFactor=3; p.Size=size; p.Material=mat; p.CanCollide=false; p.TopSurface=10; p.BottomSurface=10; p.Transparency=t; p.BrickColor=bc(color); table.insert(Parts,p); return(p); end); cm=(function(par,type,scale) m=i('SpecialMesh',par); m.MeshType=type; m.Scale=scale; return(m); end); bm=(function(par,size) b=i('BlockMesh',par); b.Scale=size; return(b); end); weld=(function(par,p1,cf) w=i('Weld',par); w.Part0=par; w.Part1=p1; w.C0=cf or cf(); return(w); end); sn=function(id,p,pi) s=Instance.new('Sound',p); s.SoundId='rbxassetid://'..id; s.Volume=5; game:service'ContentProvider':preload(s.SoundId); s.Pitch=pi; s:play(); end; function cycle(num) local section = num % 1 * 3; local secondary = 0.5 * math.pi * (section % 1); if section < 1 then return 1, 1 - math.cos(secondary), 1 - math.sin(secondary); elseif section < 2 then return 1 - math.sin(secondary), 1, 1 - math.cos(secondary); else return 1 - math.cos(secondary), 1 - math.sin(secondary), 1; end end function Recursive(Model) local Stuff = {} local function Recur(Targ) for i,v in pairs(Targ:getChildren()) do table.insert(Stuff,v) Recur(v) end end Recur(Model) return Stuff end function Resize(Character,Scale) Stuff = Recursive(Character) Welds = {}; for i,v in pairs(Stuff)do if v:isA("Motor6D") or v:isA("Weld") then local C0 = v.C0 local C1 = v.C1 v.C0 = C0+C0.p*Scale-C0.p v.C1 = C1+C1.p*Scale-C1.p table.insert(Welds,{v,v.Part1}) v.Part1 = nil end if v:isA("SpecialMesh") then if v.MeshId ~= "" then v.Scale = v.Scale*Scale end end end for i,v in pairs(Stuff)do if v:isA("BasePart") and v.Parent.className ~= "Hat" then v.formFactor = "Custom" v.Size = v.Size*Scale end end for i,v in pairs(Welds) do v[1].Part1 = v[2] end end --[[ spawn(function() while(coroutine.yield())do game.Lighting.TimeOfDay=17; game.Lighting.FogEnd=9999; game.Lighting.Outlines=true; game.Lighting.Ambient=Color3.new(0,0,0); game.Lighting.Brightness=5; end; end); ]] tab={}; function TweenCFrame(part,cframe,speed) local c0=part.CFrame Spawn(function() for i=-90,90,speed do local r=((math.sin(math.rad(i))+1)/2) local a=Vector3.new(getangles(c0)):lerp(Vector3.new(getangles(cframe)),r) part.CFrame=CFrame.new(c0.p:lerp(cframe.p,r))*CFrame.Angles(a.x,a.y,a.z) wait() end end) end; function getangles(cframe) local x,y,z,m00,m01,m02,m40,m11,m12,m20,m21,m22=cframe:components() local X=math.atan2(-m12,m22) local Y=math.asin(m02) local Z=math.atan2(-m01,m00) return X,Y,Z end; --//Resize(workspace[me.Name],2); function rayCast(par,startpos, Speed, Dmg) local rayPart = Instance.new("Part") rayPart.Name = "RayPart" rayPart.Anchored = true rayPart.Material='Neon'; rayPart.CanCollide = false rayPart.Locked = true rayPart.FormFactor = 3; rayPart.BrickColor=BrickColor.new'Tr. Flu. Blue'; rayPart.TopSurface = Enum.SurfaceType.Smooth rayPart.BottomSurface = Enum.SurfaceType.Smooth rayPart.Size = Vector3.new(6,6,6); rayPart.Shape='Ball'; fr=i'Fire'; fr.Parent=rayPart; fr.Size=10; fr.Heat=1000; --fr.SecondaryColor=bc'Light green (Mint)'.Color; fr.Color=bc'Tr. Flu. Blue'.Color; pl=i('PointLight',rayPart); pl.Range=20; pl.Brightness=5; --pl.Color=bc'Toothpaste'.Color; --[[pt=Instance.new('ParticleEmitter',rayPart); pt.EmissionDirection='Top'; pt.LightEmission=1; pt.Color=ColorSequence.new(Color3.new(1,1,1)); pt.Size=NumberSequence.new(1,1); pt.Lifetime=NumberRange.new(20,20); pt.Rate=1000; pt.Speed=NumberRange.new(6,6) pt.VelocitySpread=10; pt.Texture='rbxassetid://175622422'; pt.Rate=10000; coroutine.wrap(changet)(pt); coroutine.wrap(tsize)(pt); ]] spawn(function() while(wait())do for e=6,.5,-.1 do wait(); rayPart.Size=v3(e,e,e); end; for e=.5,6,.1 do wait(); rayPart.Size=v3(e,e,e); end; end; end); local bulletposition = startpos.Position; rayPart.CFrame = startpos.CFrame local bulletvelocity = (Vector3.new(0,0,0))+( ms.Hit.p - bulletposition).unit*Speed local bulletlastposition = bulletposition coroutine.resume(coroutine.create(function() while true do local dt = wait(1/60); bulletlastposition = bulletposition bulletvelocity = bulletvelocity + (Vector3.new(0, -3.81, 0)*dt) bulletposition = bulletposition + (bulletvelocity*dt) local ray = Ray.new(bulletlastposition, (bulletposition - bulletlastposition)) local hit, hitposition = workspace:FindPartOnRayWithIgnoreList( ray, { char, rayPart, workspace.currentCamera} ) if (tor.Position - rayPart.Position).magnitude > 640.999 then spawn(function() for t=1,10 do wait(); rayPart.Transparency=rayPart.Transparency+.25; end; rayPart:destroy(); end); --//rayPart:Destroy(); break end parts={}; if hit then local damage = math.random(Dmg, Dmg+16); if hit.Parent:findFirstChild("Humanoid") ~= nil then hit.Parent.Humanoid.WalkSpeed=6; hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - damage; end; if(hit:isA'BasePart'and hit~='Base'and hit.Name~='Base'and hit.Name~='Baseplate')then table.insert(parts,hit); wait(); coroutine.wrap(function() for i,v in pairs(parts)do TweenCFrame(v,v.CFrame*CFrame.new(math.random(-40,40),math.random(-40,40),math.random(-40,40)) *CFrame.Angles(math.random(-40,40),math.random(-40,40),math.random(-40,40)),.4); end; end)(); end; bulletposition = hitposition rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0) rayPart:Destroy() break end rayPart.CFrame = CFrame.new(bulletposition, bulletposition+bulletvelocity) * CFrame.Angles(math.pi/2, 0, 0); rayPart.Parent = par; end end)) end; function cycle(num) local section = num % 1 * 3; local secondary = 0.5 * math.pi * (section % 1); if section < 1 then return 1, 1 - math.cos(secondary), 1 - math.sin(secondary); elseif section < 2 then return 1 - math.sin(secondary), 1, 1 - math.cos(secondary); else return 1 - math.cos(secondary), 1 - math.sin(secondary), 1; end end --------------------------------------------------- ypcall(function()char.kek:remove'';end); mdl=Instance.new('Model',char); mdl.Name='kek'; local staff=cp(mdl,v3(.1,.1,.1),'Metal','Light green (Mint)'); staff.Name='sTf'; cm(staff,'Cylinder',v3(20,1,1)); staffweld=weld(ram,staff,cf(-.7,-1.3,-.2)*ca(r(20),r(70),r(-90))*ca(0,r(60),0)); cap1=cp(staff,v3(.1,.1,.1),'SmoothPlastic','Really black'); cm(cap1,'Cylinder',v3(.2,1.1,1.1)); weld(staff,cap1,cf(.8,0,0)); cap2=cap1:clone''; cap2.Parent=staff; weld(staff,cap2,cf(.6,0,0)); cap3=cap2:clone''; cap3.Parent=staff; weld(staff,cap3,cf(.2,0,0)); for i=1,5 do cap4=cp(staff,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(cap4,'Cylinder',v3(.35,1.2,1.2)); weld(staff,cap4,cf(.8+i/7,0,0)); end; ele1=cp(staff,v3(.1,.1,.1),'Neon','Tr. Flu. Blue'); cm(ele1,'Cylinder',v3(3,1.12,1.12)); weld(staff,ele1,cf(1.23,0,0)); cap5=cp(staff,v3(.1,.1,.1),'Metal','Dark stone grey'); cm(cap5,'Cylinder',v3(.6,1.55,1.55)); weld(staff,cap5,cf(1.95,0,0)); cap6=cap3:clone''; cap6.Parent=staff; cap6.Mesh.Scale=v3(.15,1.1,1.1); weld(staff,cap6,cf(1.6,0,0)); cap7=cap6:clone''; cap7.Parent=staff; weld(staff,cap7,cf(1.67,0,0)); rotat=cp(staff,v3(.1,.1,.1),'Plastic','',1); rtw=weld(staff,rotat,cf()*ca(math.rad(90),0,math.rad(90))); bm(c1,v3(.5,.599,.7)); for i=1,360,72 do p=cp(rotat,v3(.1,.1,.1),'Metal','Dark stone grey'); bm(p,v3(.5,.599,.7)); weld(rotat,p,cf(0,-1.95,0)*ca(0,math.rad(i),0)*cf(0,0,.12)); end; for i=1,360,72 do p=cp(rotat,v3(.1,.1,.1),'Neon','Tr. Flu. Blue'); cm(p,'Cylinder',v3(.4,.5,.15)); weld(rotat,p,cf(0,-1.929,0)*ca(0,math.rad(i),0)*cf(0,0,.14)*ca(math.rad(90),math.rad(90),0)); end; for i=1,360,72 do p=cp(rotat,v3(.1,.1,.1),'Metal','Dark stone grey'); cm(p,'Wedge',v3(.5,.1,.599)); weld(rotat,p,cf(0,-1.95,0)*ca(0,math.rad(i),0)*cf(0,0,.2)*ca(math.rad(90),math.rad(0),math.rad(0))); end; cap8=cap5:clone''; cap8.Parent=staff; cap8.BrickColor=bc'Light green (Mint)'; cap8.Mesh.Scale=v3(.4,1.4,1.4); weld(staff,cap8,cf(2.02,0,0)); for i=1,360,90 do p=cp(rotat,v3(.1,.1,.1),'Metal','Light stone grey'); cm(p,'Cylinder',v3(2.4,.1,.1)); weld(rotat,p,cf(0,-2.3,0)*ca(0,math.rad(i),0)*cf(0,0,.12)*ca(math.rad(90),math.rad(90),0)); end; for i=1,360,30 do p2=cp(rotat,v3(.1,.1,.1),'Metal','Light stone grey'); cm(p2,'Cylinder',v3(.338,.1,.1)); weld(rotat,p2,cf(0,-2.1,0)*ca(0,math.rad(i),0)*cf(0,0,.12)); p3=p2:clone''; p3.Parent=rotat; weld(rotat,p3,cf(0,-2.4,0)*ca(0,math.rad(i),0)*cf(0,0,.12)); end; for i=1,9 do c=cp(staff,v3(.1,.1,.1),'Metal','Really black'); cm(c,'Cylinder',v3(.1,.9,.9)); weld(staff,c,cf(2+i/30,0,0)); end; cap9=cp(staff,v3(.1,.1,.1),'Neon','Tr. Flu. Blue'); cm(cap9,'Cylinder',v3(1.2,.82,.82)); weld(staff,cap9,cf(2.18,0,0)); for i=1,360,22.5 do p=cp(rotat,v3(.1,.1,.1),'Metal','Light green (Mint)'); bm(p,v3(.2,1.4,.1)); weld(rotat,p,cf(0,-2.4,0)*ca(0,math.rad(i),0)*cf(0,0,.085)*ca(math.rad(-2),0,0)); end; cap10=cp(staff,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(cap10,'Cylinder',v3(.12,1.3,1.3)); weld(staff,cap10,cf(2.55,0,0)); for i=1,360,18 do p=cp(rotat,v3(.1,.1,.1),'Metal','Light green (Mint)'); bm(p,v3(.22,.6,.1)); weld(rotat,p,cf(0,-2.6,0)*ca(0,math.rad(i),0)*cf(0,0,.123)*ca(math.rad(-8),0,0)); end; cap11=cap10:clone''; cap11.Parent=staff; cap11.Mesh.Scale=v3(.14,1.48,1.48); weld(staff,cap11,cf(2.65,0,0)); cap12=cp(staff,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(cap12,'Cylinder',v3(2,1,1)); weld(staff,cap12,cf(2.8,0,0)); cap13=cap12:clone''; cap13.Parent=staff; cap13.Mesh.Scale=v3(.3,1.5,1.5); weld(staff,cap13,cf(2.75,0,0)); cap14=cap13:clone''; cap14.Parent=staff; cap14.Mesh.Scale=v3(.5,1.65,1.65); weld(staff,cap14,cf(2.84,0,0)); cap15=cap14:clone''; cap15.Parent=staff; cap15.Mesh.Scale=v3(.6,1.72,1.72); weld(staff,cap15,cf(2.965,0,0)); cap16=cp(staff,v3(.1,.1,.1),'Metal','Dark stone grey'); cm(cap16,'Cylinder',v3(.65,1.9,1.9)); weld(staff,cap16,cf(3.05,0,0)); for i=1,360,72 do p=cp(rotat,v3(.1,.1,.1),'Metal','Light yellow'); cm(p,'Cylinder',v3(2,.1,.1)); weld(rotat,p,cf(0,-3.06,0)*ca(0,math.rad(i),0)*cf(0,0,.11)*ca(0,math.rad(90),0)); p2=cp(rotat,v3(.1,.1,.1),'Metal','Light yellow'); cm(p2,'Sphere',v3(.25,.25,.25)); weld(rotat,p2,cf(0,-3.06,0)*ca(0,math.rad(i),0)*cf(0,0,.29)); p3=cp(rotat,v3(.1,.1,.1),'Metal','Black'); cm(p3,'Cylinder',v3(.1,.64,.64)); weld(rotat,p3,cf(0,-3.05,0)*ca(0,math.rad(i),0)*cf(0,0,.198)*ca(0,math.rad(90),0)); p4=p3:clone''; p4.Parent=rotat; p4.Mesh.Scale=v3(.1,.57,.57); weld(rotat,p4,cf(0,-3.05,0)*ca(0,math.rad(i),0)*cf(0,0,.22)*ca(0,math.rad(90),0)); p5=p4:clone''; p5.Parent=rotat; p5.Mesh.Scale=v3(.1,.5,.5); weld(rotat,p5,cf(0,-3.05,0)*ca(0,math.rad(i),0)*cf(0,0,.24)*ca(0,math.rad(90),0)); p6=cp(rotat,v3(.1,.1,.1),'Metal','Dark stone grey'); cm(p6,'Wedge',v3(.14,.08,.05)); weld(rotat,p6,cf(0,-3.07,0)*ca(0,math.rad(i),0)*cf(0,0,.3)*ca(0,0,0)); end; cap17=cp(staff,v3(.1,.1,.1),'Metal','Dark stone grey'); cm(cap17,'Cylinder',v3(.23,1.6,1.6)); weld(staff,cap17,cf(3.14,0,0)); cap18=cp(staff,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(cap18,'Cylinder',v3(.75,2,2)); weld(staff,cap18,cf(3.24,0,0)); cast=cp(staff,v3(.1,.1,.1),'Neon','Tr. Flu. Blue'); c=cm(cast,'FileMesh',v3(.3,.1,.1)); c.MeshId='rbxassetid://1290033'; --c.TextureId='rbxassetid://6680839'; cw=weld(staff,cast,cf(3.5,0,0)); p7=cp(staff,v3(.1,.1,.1),'Metal','Light green (Mint)'); stb1=cp(staff,v3(.1,.1,.1),'Metal','Light green (Mint)',1) weld(staff,stb1,cf()); stb2=stb1:clone''; stb2.Parent=stb1; stb2.Transparency=0; bm(stb2,v3(.3,2.3,.16)); weld(stb1,stb2,cf(-2,.14,0)*ca(0,0,r(67))); stb3=stb2:clone''; stb3.Parent=stb1; stb3.Mesh.Scale=v3(.3,.7,.16); weld(stb2,stb3,cf(-.026,.29,0)*ca(0,0,r(20))); stb4=cp(stb1,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(stb4,'Wedge',v3(.16,.3,1.6)); weld(stb3,stb4,cf(-.05,.21,0)*ca(r(90),0,r(-90))*ca(r(-20),0,0)); stb5=stb1:clone''; stb5.Parent=staff; weld(staff,stb5,cf()*ca(r(180),0,0)); stb6=stb1:clone''; stb6.Parent=staff; weld(staff,stb6,cf()*ca(r(180),0,0)*ca(r(90),0,0)); stb7=stb1:clone''; stb7.Parent=staff; weld(staff,stb7,cf()*ca(r(180),0,0)*ca(r(-90),0,0)); et=cp(staff,v3(.1,.1,.1),'Plastic','',1); weld(staff,et,cf()*ca(0,0,r(90))); for i=1,360,20 do p=cp(et,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(p,'Cylinder',v3(.33,.2,.6)); weld(et,p,cf(0,2.15,0)*ca(0,math.rad(i),0)*cf(0,0,.17)); p2=p:clone''; p2.Parent=et; p2.Mesh.Scale=v3(.37,.2,.6); weld(et,p2,cf(0,2.33,0)*ca(0,math.rad(i),0)*cf(0,0,.19)); p3=p2:clone''; p3.Parent=et; p3.Mesh.Scale=v3(.198,.2,.25); weld(et,p3,cf(0,2,0)*ca(0,math.rad(i),0)*cf(0,0,.1)); p4=cp(et,v3(.1,.1,.1),'Metal','Light green (Mint)'); bm(p4,v3(.3,2,.1)); weld(et,p4,cf(0,2.18,0)*ca(0,math.rad(i),0)*cf(0,0,.015)*ca(math.rad(-26),0,0)); end; cap19=cp(staff,v3(.1,.1,.1),'Metal','Black'); cm(cap19,'Cylinder',v3(3,1.1,1.1)); wa=weld(staff,cap19,cf(-1.35,0,0)); hL1=cp(staff,v3(.1,.1,.1),'Metal','Light green (Mint)'); bm(hL1,v3(.6,.8,.5)); weld(staff,hL1,cf(3.244,.15,0)*ca(0,0,r(-14))); h1=hL1:clone''; h1.Parent=hL1; h1.Mesh.Scale=v3(.1,.5,.5); weld(hL1,h1,cf(.05,.13,0)); h2=h1:clone''; h2.Parent=h1; weld(hL1,h2,cf(-.025,.13,0)); h3=cp(hL1,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(h3,'Wedge',v3(.5,.5,.12)); weld(hL1,h3,cf(-.045,.13,0)*ca(0,r(90),0)); h4=cp(hL1,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(h4,'Cylinder',v3(.515,.45,.45)); weld(hL1,h4,cf(0,.2,0)*ca(r(90),0,r(90))); h5=cp(hL1,v3(.1,.1,.1),'Metal','Light green (Mint)'); bm(h5,v3(.2,.1,.5)); weld(hL1,h5,cf(.04,.19,0)); h6=h4:clone''; h6.Parent=h5; h6.Material='Neon'; h6.BrickColor=bc'Institutional white'; h6.mesh.Scale=v3(.516,.1,.2); weld(h5,h6,cf(-.055,0,0)*ca(0,r(90),0)); h7=h6:clone''; h7.Parent=h5; weld(h5,h7,cf(-.02,.02,0)*ca(0,r(90),0)); h8=cp(hL1,v3(.1,.1,.1),'Neon','Institutional white'); bm(h8,v3(.03,.15,.516)); weld(hL1,h8,cf(0,.2,0)*ca(0,0,r(-75))); h9=cp(hL1,v3(.1,.1,.1),'Metal','Light green (Mint)'); bm(h9,v3(.3,.25,.5)); weld(hL1,h9,cf(.024,.22,0)*ca(0,0,r(10))); h10=cp(hL1,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(h10,'Wedge',v3(.1,.1,.35)); weld(hL1,h10,cf(.015,.25,.04)*ca(0,r(90),0)*ca(r(-10),0,0)); h11=h10:clone''; h11.Parent=hL1; weld(hL1,h11,cf(.015,.25,-.04)*ca(0,r(90),0)*ca(r(-10),0,0)); h12=h9:clone''; h12.Parent=hL1; h12.Mesh.Scale=v3(.75,.1,.5); weld(hL1,h12,cf(.12,.26,0)*ca(0,0,r(4))); h13=h12:clone''; h13.Parent=hL1; weld(hL1,h13,cf(.12,.2,0)*ca(0,0,r(4))); h14=cp(hL1,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(h14,'Cylinder',v3(.9,.45,.45)); weld(hL1,h14,cf(.18,.236,0)*ca(r(90),0,r(90))); h15=h14:clone''; h15.Parent=h14; h15.Mesh.Scale=v3(1,.3,.3); weld(h14,h15,cf()); --//stabb h16=cp(h14,v3(.1,.1,.1),'Metal','Laurel green'); cm(h16,'Wedge',v3(.13,.5,1.7)); weld(h14,h16,cf(-.058,-.18,-.02)*ca(r(-95),0,0)); h17=cp(h16,v3(.1,.1,.1),'Metal','Laurel green'); cm(h17,'Wedge',v3(.13,.2,1.72)); weld(h16,h17,cf()*ca(r(170),0,0)); h18=cp(h16,v3(.1,.1,.1),'Metal','Laurel green'); cm(h18,'Wedge',v3(.13,.35,.7)); weld(h16,h18,cf(0,-.051,.2)*ca(r(90),r(180),0)); h19=h18:clone''; h19.Parent=h18; h19.Mesh.Scale=v3(.13,.16,.3); weld(h18,h19,cf(0,0,.086)*ca(r(90),0,0)); h20=h19:clone''; h20.Parent=h18; h20.Mesh.Scale=v3(.13,.35,1.5); weld(h16,h20,cf(0,-.082,.015)*ca(0,0,r(180))); h21=h20:clone''; h21.Parent=h16; h21.Mesh.Scale=v3(.13,.2,1.4); weld(h16,h21,cf(0,-.042,-.3)*ca(r(-6),0,0)); h22=h16:clone''; h22.Parent=h16; weld(h16,h22,cf(.12,0,0)); --// for i=1,360,12.857 do p=cp(et,v3(.1,.1,.1),'Ice','Olivine'); cm(p,'Cylinder',v3(20,.1,1)); weld(et,p,cf()*ca(0,math.rad(i),r(90))*cf(0,0,.097)); end; for i=1,360,124 do p=cp(et,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(p,'Cylinder',v3(1,.4,1)); weld(et,p,cf(0,1.3,0)*ca(0,math.rad(i),r(90))*cf(0,0,.14)); p2=cp(p,v3(.1,.1,.1),'Neon','Cyan',.6); cm(p2,'Cylinder',v3(1.2,.3,1.2)); weld(et,p2,cf(0,1.3,0)*ca(0,math.rad(i),r(90))*cf(0,0,.14)) p3=cp(et,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(p3,'Wedge',v3(.1,1,2)); weld(et,p3,cf(0,1.4,0)*ca(r(180),math.rad(i),r(180))*cf(0,0,.1)*ca(r(-65),0,0)); end; h23=cp(staff,v3(.1,.1,.1),'Metal','Light green (Mint)'); bm(h23,v3(.2,.5,.1)); weld(staff,h23,cf(-1.8,.08,.08)); h24=cp(h23,v3(.1,.1,.1),'Metal','Light green (Mint)'); cm(h24,'Cylinder',v3(.8,.4,.8)); weld(h23,h24,cf(0,.07,0)); h25=h24:clone''; h25.Parent=h24; h25.Mesh.Scale=v3(.75,.45,.75); weld(h24,h25,cf()); h26=h25:clone''; h26.Parent=h24; h26.BrickColor=bc'Daisy orange'; h26.Material='Neon'; h26.Mesh.Scale=v3(.4,.45,.1); weld(h24,h26,cf(.07,0,.02)); h27=h26:clone''; h27.Parent=h24; weld(h24,h27,cf(.05,0,-.02)); hL2=hL1:clone''; hL2.Parent=staff; weld(staff,hL2,cf(3.244,-.15,0)*ca(r(180),0,r(-14))); hL3=hL2:clone''; hL3.Parent=staff; weld(staff,hL3,cf(3.244,0,.15)*ca(r(90),0,r(-14))); hL4=hL3:clone''; hL4.Parent=staff; weld(staff,hL4,cf(3.244,0,-.15)*ca(r(-90),0,r(-14))); pch=1; nums={0.374,0.408,0.442,0.476,0.51,0.544,0.578,0.612,0.646,0.68,0.714,0.748,0.782,0.816,0.85,0.884,0.918,0.952,0.986}; spawn(function() while(wait(.88))do pch=nums[math.random(1,#nums)]; end; end); raty=.25; spawn(function() while(wait())do for i=.25,.85,.025 do raty=raty+i; wait(.5); end; for i=.85,.25,-0.25 do raty=raty-1; wait(.5); end; end; end); ms.button1Down:connect(function() spd=145; grv=4; sn(283428477,cast,1.1); sn(186550561,cast,1.1); rayCast(workspace,cast,200,0); end); --//Resize(workspace[me.Name],1.7); --//--------------------------------------------------- function Lerp(a,b,i) local com1={a.X,a.Y,a.Z,a:toEulerAnglesXYZ()}; local com2={b.X,b.Y,b.Z,b:toEulerAnglesXYZ()}; local calx=com1[1]+(com2[1]-com1[1])*i; local caly=com1[2]+(com2[2]-com1[2])*i; local calz=com1[3]+(com2[3]-com1[3])*i; local cala=com1[4]+(com2[4]-com1[4])*i; local calb=com1[5]+(com2[5]-com1[5])*i; local calc=com1[6]+(com2[6]-com1[6])*i; return CFrame.new(calx,caly,calz)*CFrame.Angles(cala,calb,calc); end; newWeld=function(wld,wp0,wp1,wc0x,wc0y,wc0z) wld=Instance.new('Weld',wp1); wld.Part0=wp0; wld.Part1=wp1; wld.C0=CFrame.new(wc0x,wc0y,wc0z); end; newWeld=function(wp0,wp1,wc0x,wc0y,wc0z) wld=Instance.new('Weld',wp1); wld.Part0=wp0; wld.Part1=wp1; wld.C0=CFrame.new(wc0x,wc0y,wc0z); return(wld); end; local law=newWeld(tor, lam,-1.5,0.5,0); law.C1=CFrame.new(0,0.5,0); local raw=newWeld(tor,ram,1.5,0.5,0); raw.C1=CFrame.new(0,0.5,0); local hew=newWeld(tor,hed,0,1.5,0); local llw=newWeld(tor,llg,-0.5,-1,0); llw.C1=CFrame.new(0,1,0); local rlw=newWeld(tor,rlg,0.5,-1,0); rlw.C1=CFrame.new(0,1,0); local tow=newWeld(hrp,tor,0,-1,0); tow.C1=CFrame.new(0,-1,0); local laD=CFrame.new(-1.5, 0.5, 0); local raD=CFrame.new(1.5, 0.5, 0); local hD=CFrame.new(0, 1.5, 0); local tD=CFrame.new(0, -1, 0); local llD=CFrame.new(-0.5, -1, 0); local rlD=CFrame.new(0.5, -1, 0); syne=0; runna.RenderStepped:connect(function() syne=syne+1; if(tor.Velocity*Vector3.new(1,0,1)).magnitude<1 and(tor.Velocity.y<5)and(tor.Velocity.y>-5)then anim='Idling'; elseif(tor.Velocity.y>5)and(hum.Jump)then anim='Jumping'; elseif(tor.Velocity.y<-5) and(tor.Velocity.z>0)and(hum.Jump)then anim='Freefalling'; elseif (hrp.Velocity*Vector3.new(1,0,1)).magnitude>1 and(hrp.Velocity*Vector3.new(1,0,1)).magnitude<25 and(tor.Velocity.y<5)and(tor.Velocity.y>-5)then anim='Walking' elseif(hrp.Velocity*Vector3.new(1,0,1)).magnitude>1 and(hrp.Velocity*Vector3.new(1,0,1)).magnitude<32 and(tor.Velocity.y<5)and(tor.Velocity.y>-5)then anim='Running'; end if(anim=='Idle')then end; --tow.C0=Lerp(tow.C0,tD*CFrame.new(0,2+.45*math.cos(syne/14),0)*CFrame.Angles(-.01+.02*math.cos(syne/8),0,0),.1); tow.C0=Lerp(tow.C0,tD, 0.2); hed.Weld.C0=Lerp(hed.Weld.C0,hD*CFrame.Angles(.01+.05*math.sin(syne/12),0,0),.1); raw.C0=Lerp(raw.C0,raD*CFrame.new(-.5,-.03+.05*math.sin(syne/12),-.2)*CFrame.Angles(r(50),.12-.05*math.cos(syne/8)*-math.sin(syne/22)/1.2,r(-10)),.1); law.C0=Lerp(law.C0,laD*CFrame.new(.4,-.03+.05*math.sin(syne/12),-.5)*CFrame.Angles(r(50),-.12-.05*math.cos(syne/8)*-math.sin(syne/22)/1.2,r(8)),.1); --llw.C0=Lerp(llw.C0,llD*CFrame.Angles(r(-7),r(17),0),1); --rlw.C0=Lerp(rlw.C0,rlD*CFrame.Angles(r(10),0,r(15)),1); staffweld:remove''; weld(ram,staff,cf(-.7,-1.3,-.2)*ca(r(20),r(70),r(-90))*ca(0,r(60),0)); --staffweld.C0=staffweld.C0*CFrame.new(-.7,-1.3,-.2)*CFrame.Angles(r(20),r(70),r(-90))*CFrame.Angles(0,r(60),0); if(anim=='Walking')then tow.C0=Lerp(tow.C0,CFrame.new(0,-1,0)*CFrame.Angles(-math.rad(hum.WalkSpeed/1.8),math.rad(0-2*math.cos((syne/7/1))),math.rad((hrp.RotVelocity.Y/6)-1*math.cos((syne/7/1)))),1) --law.C0=Lerp(law.C0,laD*CFrame.Angles(math.rad(2-35*math.cos((syne/7)/1)),math.rad(0),math.rad(-1)),1) --raw.C0=Lerp(raw.C0,raD*CFrame.Angles(math.rad(2+35*math.cos((syne/7)/1)),math.rad(0),math.rad(1)),1) hed.Weld.C0=Lerp(hed.Weld.C0,hD*CFrame.new(0,0,0)*CFrame.Angles(math.rad(0-2*math.cos(syne/7)/1),math.rad((hrp.RotVelocity.Y*2)+0.25*math.cos((syne/7/2))),math.rad(0+0.25*math.cos((syne/7/2)))),1) llw.C0=Lerp(llw.C0,llD*CFrame.Angles(math.rad(2+35*math.cos((syne/3.5)/1)),0,0),1.7) rlw.C0=Lerp(rlw.C0,rlD*CFrame.Angles(math.rad(2-35*math.cos((syne/3.5)/1)),0,0),1.7) raw.C0=Lerp(raw.C0,raD*CFrame.new(0,-.5,0)*CFrame.Angles(r(40),0,0),1); staffweld:remove''; weld(ram,staff,cf()*ca(r(90),0,0)); end; if(anim=='Jumping')then raw.C0=Lerp(raw.C0,raD*CFrame.new(0,.15,0)*CFrame.Angles(math.rad(88),-math.rad(11),0),.5); law.C0=Lerp(law.C0,laD*CFrame.new(0,.15,0)*CFrame.Angles(-math.rad(88),math.rad(11),0),.5); hed.Weld.C0=Lerp(hed.Weld.C0,hD*CFrame.new(0,.1,.05)*CFrame.Angles(math.rad(22),0,0),.5); rlw.C0=Lerp(rlw.C0,rlD*CFrame.Angles(-math.rad(30),0,0),.5); llw.C0=Lerp(llw.C0,llD*CFrame.Angles(-math.rad(30),0,0),.5); tow.C0=Lerp(tow.C0,tD*CFrame.Angles(math.rad(-22),0,0),.5); end; --[[ if(anim=='Freefalling')then tow.C0=Lerp(tow.C0,tD*CFrame.Angles(math.rad(-176),0,0),.5); llw.C0=Lerp(llw.C0,llD*CFrame.Angles(.2+.2*math.cos(syne/16)/2,0,0),.5); rlw.C0=Lerp(rlw.C0,rlD*CFrame.Angles(.2+.2*-math.cos(syne/16)/2,0,0),.5); hed.Weld.C0=Lerp(hed.Weld.C0,hD*CFrame.Angles(.2+.12*math.cos(syne/16)/4,0,0),.5); end; ]] if(anim=='Running')then tow.C0=Lerp(tow.C0,CFrame.new(0,-1,0)*CFrame.Angles(-math.rad(hum.WalkSpeed/4),math.rad(0-1*math.cos(syne/8)),0),1) law.C0=Lerp(law.C0,laD*CFrame.Angles(math.rad(0-60*math.cos(syne/8)/3),0,math.rad(-3)),1) raw.C0=Lerp(raw.C0,raD*CFrame.Angles(math.rad(0+60*math.cos(syne/8)/3),0,math.rad(3)),1) hed.Weld.C0=Lerp(hed.Weld.C0,CFrame.new(0,1.5,0)*CFrame.Angles(0,math.rad(hrp.RotVelocity.Y*3),0),1) --llw.C0=Lerp(llw.C0,llD*CFrame.Angles(math.rad(10+50*math.cos(syne/8)/3),0,math.rad(-1)),1) --rlw.C0=Lerp(rlw.C0,rlD*CFrame.Angles(math.rad(10-50*math.cos(syne/8)/3),0,math.rad(1)),1) llw.C0=Lerp(llw.C0,llD*CFrame.Angles(0,0,0)*CFrame.Angles(math.rad(2+35*math.cos((syne/3.5)/1)),0,0),1.7) rlw.C0=Lerp(rlw.C0,rlD*CFrame.Angles(0,0,0)*CFrame.Angles(math.rad(2-35*math.cos((syne/3.5)/1)),0,0),1.7) end; end);
local __addon, __ns = ...; if GetLocale() ~= "deDE" then return; end __ns.L.map = { [1411] = "Durotar", [1412] = "Mulgore", [1413] = "Brachland", [1416] = "Alteracgebirge", [1417] = "Arathihochland", [1418] = "Ödland", [1419] = "Verwüstete Lande", [1420] = "Tirisfal", [1421] = "Silberwald", [1422] = "Westliche Pestländer", [1423] = "Östliche Pestländer", [1424] = "Vorgebirge von Hillsbrad", [1425] = "Hinterland", [1426] = "Dun Morogh", [1427] = "Sengende Schlucht", [1428] = "Brennende Steppe", [1429] = "Wald von Elwynn", [1430] = "Gebirgspass der Totenwinde", [1431] = "Dämmerwald", [1432] = "Loch Modan", [1433] = "Rotkammgebirge", [1434] = "Schlingendorntal", [1435] = "Sümpfe des Elends", [1436] = "Westfall", [1437] = "Sumpfland", [1438] = "Teldrassil", [1439] = "Dunkelküste", [1440] = "Ashenvale", [1441] = "Tausend Nadeln", [1442] = "Steinkrallengebirge", [1443] = "Desolace", [1444] = "Feralas", [1445] = "Marschen von Dustwallow", [1446] = "Tanaris", [1447] = "Azshara", [1448] = "Teufelswald", [1449] = "Un'Goro-Krater", [1450] = "Moonglade", [1451] = "Silithus", [1452] = "Winterspring", [1453] = "Stormwind", [1454] = "Orgrimmar", [1455] = "Ironforge", [1456] = "Thunder Bluff", [1457] = "Darnassus", [1458] = "Undercity", [1459] = "Alteractal", [1460] = "Warsongschlucht", [1461] = "Arathibecken", };
local PANEL = {} function PANEL:Init() self.progress = 0 self.label = "" end function PANEL:SetProgress(progress) self.progress = progress end function PANEL:GetProgress() return self.progress end function PANEL:SetText(text) self.label = text end function PANEL:GetText() return self.label end function PANEL:PerformLayout() self:Paint() end function PANEL:Paint() local w, h = self:GetSize() local bar_w = math.Clamp((w/4) - ((self.progress + (w/4)) - (w - 4)), 0, (w/4)) surface.SetDrawColor(0, 0, 0, 170) draw.RoundedBox(4, 0, 0, w, h, Color(0,0,0,100)) if (self.progress >= w - 4) then self.progress = 2 end self.progress = self.progress + 2 if (self.progress + bar_w >= (w - 4)) then draw.RoundedBox(4, 2, 2, (w/4) - bar_w, h-4, Color(0,255,0,190)) end draw.RoundedBox(4, self.progress, 2, bar_w, h-4, Color(0,255,0,190)) surface.SetFont("DefaultSmall") local label_w, label_h = surface.GetTextSize( self.label ) surface.SetTextColor(0, 0, 0, 255) surface.SetTextPos(w/2 - label_w/2, h/2 - label_h/2) surface.DrawText(self.label) end vgui.Register( "WProgressBar", PANEL, "DPanel" )
return { rootPath = "/", caret = "^", slash = "/", colon = ":", hash = { cache = false } }
--======== Copyleft © 2010-2013, Team Sandbox, Some rights reserved. ========-- -- -- Purpose: Tests the KeyValues implementation. -- --===========================================================================-- local gamePath if _CLIENT then gamePath = engine.GetGameDirectory(); else gamePath = engine.GetGameDir(); end local pMainFile = KeyValues( "gameinfo.txt" ); if ( pMainFile:LoadFromFile( gamePath .. "/gameinfo.txt", "MOD" ) ) then print( "KeyValues: ") pMainFile:Print( 1 ) --[[ print( "KeyValues -> Table: ") local tMainFile = pMainFile:ToTable() table.print( tMainFile, false, 1 ) print( "Table -> KeyValues: ") local pNewMainFile = table.tokeyvalues( tMainFile, "gameinfo.txt" ) pNewMainFile:Print( 1 ) pNewMainFile:deleteThis() ]] print( "KeyValues -> Table (Order preserved): ") local tMainFile = pMainFile:ToTable( true ) table.print( tMainFile, true, 1 ) print( "Table (Order preserved) -> KeyValues: ") local pNewMainFile = table.tokeyvalues( tMainFile, "gameinfo.txt", true ) pNewMainFile:Print( 1 ) pNewMainFile:deleteThis() end pMainFile:deleteThis();