content
stringlengths
5
1.05M
function __TS__Spread(iterable) local arr = {} if type(iterable) == "string" then do local i = 0 while i < #iterable do arr[#arr + 1] = __TS__StringAccess(iterable, i) i = i + 1 end end else for ____, item in __TS__Iterator(iterable) do arr[#arr + 1] = item end end return __TS__Unpack(arr) end
-- two library -- stb 3rdparty module function stb_module(name) local m = dep('stb', name, true) kind "StaticLib" includedirs { path.join(TWO_SRC_DIR), path.join(TWO_3RDPARTY_DIR, "stb"), } files { path.join(TWO_3RDPARTY_DIR, "stb", "stb_" .. name .. ".h"), path.join(TWO_SRC_DIR, "3rdparty", "stb_" .. name .. ".cpp"), path.join(TWO_SRC_DIR, "3rdparty", "stb." .. name .. ".mxx"), } mxx({ path.join(TWO_SRC_DIR, "3rdparty", "stb_" .. name .. ".cpp") }, m) configuration { "*-gcc*" } buildoptions { "-Wno-unused-but-set-variable", "-Wno-type-limits", } return m end stb = {} stb.image = stb_module("image") stb.rect_pack = stb_module("rect_pack")
function init() reset() end function step() log("wheelvelocities:".. string.format("%.2f", robot.joints.base_wheel_bl.encoder) ..",".. string.format("%.2f", robot.joints.base_wheel_fl.encoder) ..",".. string.format("%.2f", robot.joints.base_wheel_br.encoder) ..",".. string.format("%.2f", robot.joints.base_wheel_fr.encoder)) end function reset() robot.joints.base_wheel_bl.set_target(-1) robot.joints.base_wheel_fl.set_target(1) robot.joints.base_wheel_br.set_target(-1) robot.joints.base_wheel_fr.set_target(1) end function destroy() end
------------------------------------------------------------------------------------------------------------------------------------------------------------- -- initialize all the scripts ------------------------------------------------------------------------------------------------------------------------------------------------------------- veaf.logInfo("init - veafRadio") veafRadio.initialize(true) veaf.logInfo("init - veafSpawn") veafSpawn.initialize() veaf.logInfo("init - veafGrass") veafGrass.initialize() veaf.logInfo("init - veafCasMission") veafCasMission.initialize() --veafTransportMission.initialize() ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- change some default parameters ------------------------------------------------------------------------------------------------------------------------------------------------------------- veaf.DEFAULT_GROUND_SPEED_KPH = 25 ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- initialize SHORTCUTS ------------------------------------------------------------------------------------------------------------------------------------------------------------- veaf.logInfo("init - veafShortcuts") veafShortcuts.initialize() -- you can add all the shortcuts you want here. Shortcuts can be any VEAF command, as entered in a map marker. -- here are some examples : -- veafShortcuts.AddAlias( -- VeafAlias.new() -- :setName("-sa11") -- :setDescription("SA-11 Gadfly (9K37 Buk) battery") -- :setVeafCommand("_spawn group, name sa11") -- :setBypassSecurity(true) -- ) -- veafShortcuts.AddAlias( -- VeafAlias.new() -- :setName("-login") -- :setDescription("Unlock the system") -- :setHidden(true) -- :setVeafCommand("_auth") -- :setBypassSecurity(true) -- ) -- veafShortcuts.AddAlias( -- VeafAlias.new() -- :setName("-logout") -- :setDescription("Lock the system") -- :setHidden(true) -- :setVeafCommand("_auth logout") -- :setBypassSecurity(true) -- ) -- veafShortcuts.AddAlias( -- VeafAlias.new() -- :setName("-mortar") -- :setDescription("Mortar team") -- :setVeafCommand("_spawn group, name mortar, country USA") -- :setBypassSecurity(true) -- ) ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- No MOOSE settings menu. Comment out this line if required. _SETTINGS:SetPlayerMenuOff() ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- PSEUDOATC --pseudoATC=PSEUDOATC:New() --pseudoATC:Start() ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- SCORING -- local Scoring = SCORING:New( "Scoring File" ) -- Scoring:SetScaleDestroyScore( 10 ) -- Scoring:SetScaleDestroyPenalty( 40 ) -- Scoring:SetMessagesToCoalition() ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- configure ASSETS ------------------------------------------------------------------------------------------------------------------------------------------------------------- veafAssets.logInfo("Loading configuration") veafAssets.Assets = { -- list the assets common to all missions below {sort=1, name="CSG-01 Tarawa", description="Tarawa (LHA)", information="Tacan 11X TAA\nU226 (11)"}, {sort=2, name="CSG-74 Stennis", description="Stennis (CVN)", information="Tacan 10X STS\nICLS 10\nU225 (10)"}, {sort=2, name="CSG-71 Roosevelt", description="Roosevelt (CVN)", information="Tacan 12X RHR\nICLS 11\nU227 (12)"}, {sort=3, name="T1-Arco-1", description="Arco-1 (KC-135)", information="Tacan 64X\nU290.50 (20)\nZone OUEST", linked="T1-Arco-1 escort"}, {sort=4, name="T2-Shell-1", description="Shell-1 (KC-135 MPRS)", information="Tacan 62X\nU290.30 (18)\nZone EST", linked="T2-Shell-1 escort"}, {sort=5, name="T3-Texaco-1", description="Texaco-1 (KC-135 MPRS)", information="Tacan 60X\nU290.10 (17)\nZone OUEST", linked="T3-Texaco-1 escort"}, {sort=6, name="T4-Shell-2", description="Shell-2 (KC-135)", information="Tacan 63X\nU290.40 (19)\nZone EST", linked="T4-Shell-2 escort"}, {sort=6, name="T5-Petrolsky", description="900 (IL-78M, RED)", information="U267", linked="T5-Petrolsky escort"}, {sort=7, name="CVN-74 Stennis S3B-Tanker", description="Texaco-7 (S3-B)", information="Tacan 75X\nU290.90\nZone PA"}, {sort=7, name="CVN-71 Roosevelt S3B-Tanker", description="Texaco-8 (S3-B)", information="Tacan 76X\nU290.80\nZone PA"}, {sort=8, name="D1-Bizmuth", description="Colt-1 AFAC Bizmuth (MQ-9)", information="V118.80 (18)", jtac=1688}, {sort=9, name="D2-Agate", description="Dodge-1 AFAC Agate (MQ-9)", information="V118.90 (19)", jtac=1687}, {sort=10, name="A1-Magic", description="Magic (E-2D)", information="Datalink 315.3 Mhz\nU282.20 (13)", linked="A1-Magic escort"}, {sort=11, name="A2-Overlordsky", description="Overlordsky (A-50, RED)", information="V112.12"}, } veaf.logInfo("init - veafAssets") veafAssets.initialize() ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- configure MOVE ------------------------------------------------------------------------------------------------------------------------------------------------------------- veafMove.logInfo("Setting move tanker radio menus") table.insert(veafMove.Tankers, "T1-Arco-1") table.insert(veafMove.Tankers, "T2-Shell-1") table.insert(veafMove.Tankers, "T3-Texaco-1") table.insert(veafMove.Tankers, "T4-Shell-2") --table.insert(veafMove.Tankers, "T5-Petrolsky") veaf.logInfo("init - veafMove") veafMove.initialize() ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- configure COMBAT MISSION ------------------------------------------------------------------------------------------------------------------------------------------------------------- if veafCombatMission then veafCombatMission.logInfo("Loading configuration") veafCombatMission.addCapMission("CAP-Krasnodar-1", "CAP on Krasnodar", "A Russian CAP patrol has been spotted over Krasnodar.", true, false) veafCombatMission.addCapMission("CAP-Maykop-1", "CAP on Maykop", "A Russian CAP patrol has been spotted over Maykop.", true, false) veafCombatMission.addCapMission("CAP-GL-1", "CAP on grid GL", "A Russian CAP patrol has been spotted over grid GL.", true, false) veafCombatMission.addCapMission("CAP-Minvody-1", "CAP on Minvody", "A Russian CAP patrol has been spotted over Minvody.", true, false) veafCombatMission.addCapMission("CAP-Mozdok-1", "CAP on Mozdok", "A Russian CAP patrol has been spotted over Mozdok.", true, false) veafCombatMission.addCapMission("CAP-RaidBeslan-1", "Raid on Beslan", "A Russian CAP patrol is going to Beslan.", true, false) veafCombatMission.addCapMission("CAP-RaidSochi-1", "Raid on Sochi", "A Russian CAP patrol is going to Sochi.", true, false) veafCombatMission.addCapMission("training-radar-tu22-FL300", "Radar Training - Tu22 at FL300", "Russian TU-22 patrols at FL300 west of the Crimea peninsula", false, true) veafCombatMission.addCapMission("training-radar-bear-FL200", "Radar Training - Bear at FL200", "Russian TU-95 patrols at FL200 west of the Crimea peninsula ; ECM on", false, true) veafCombatMission.addCapMission("training-radar-mig23-FL300", "Radar Training - Mig23 at FL300", "Mig-23MLD on CAP (R-24R = Fox1 MR) at FL300 west of the Crimea peninsula", false, true) veafCombatMission.addCapMission("training-radar-mig29-FL300", "Radar Training - Mig29 at FL300", "Mig-29S on CAP (R-77 = Fox 3 MR) at FL300 west of the Crimea peninsula", false, true) veafCombatMission.addCapMission("training-radar-mig31-FL300", "Radar Training - Mig31 at FL300", "Mig-31 on CAP (R-33 = Fox 3 LR) at FL300 west of the Crimea peninsula", false, true) veafCombatMission.addCapMission("training-radar-mig23-FL300-notch", "Radar Training - Mig23 notching", "Mig-23MLD on CAP (R-24R = Fox1 MR) notching W-E at FL300 west of the Crimea peninsula", false, true) veafCombatMission.AddMissionsWithSkillAndScale( VeafCombatMission.new() :setSecured(false) :setRadioMenuEnabled(true) :setName("Intercept-Kraznodar-1") :setFriendlyName("Intercept a transport / KRAZNODAR - MINVODY") :setBriefing([[ A Russian transport plane is taking off from Kraznodar and will transport a VIP to Mineralnye Vody. It is escorted by a fighter patrol. ]] ) :addElement( VeafCombatMissionElement.new() :setName("OnDemand-Intercept-Transport-Krasnodar-Mineral-Transport") :setGroups({"OnDemand-Intercept-Transport-Krasnodar-Mineral-Transport"}) :setScalable(false) ) :addElement( VeafCombatMissionElement.new() :setName("OnDemand-Intercept-Transport-Krasnodar-Mineral-Escort") :setGroups({"OnDemand-Intercept-Transport-Krasnodar-Mineral-Escort"}) :setSkill("Random") ) :addObjective( VeafCombatMissionObjective.new() :setName("Destroy the transport") :setDescription("you must destroy the transport and kill the VIP") :setMessage("%d transport planes destroyed !") :configureAsKillEnemiesObjective() -- TODO ) :initialize() ) veafCombatMission.AddMission( VeafCombatMission.new() :setSecured(true) :setRadioMenuEnabled(true) :setName("Red-attack-Gudauta") :setFriendlyName("Red attack On Gudauta") :setBriefing([[ Alert ! This is not a drill ! Tactical and strategic bombers have been detected at the russian border, to the north of Gudauta. Their course will lead them to the Gudauta airbase, which is probably their mission. Destroy all the bombers before they hit the base ! ]] ) :addElement( VeafCombatMissionElement.new() :setName("SEAD") :setGroups({ "Red Attack On Gudauta - Wave 1-1", "Red Attack On Gudauta - Wave 1-2", "Red Attack On Gudauta - Wave 1-3", "Red Attack On Gudauta - Wave 1-4" }) :setSkill("Random") ) :addElement( VeafCombatMissionElement.new() :setName("Bombers") :setGroups({ "Red Attack On Gudauta - Wave 2-1", "Red Attack On Gudauta - Wave 2-2", "Red Attack On Gudauta - Wave 2-3" }) :setSkill("Random") ) :addObjective( VeafCombatMissionObjective.new() :setName("HVT Gudauta") :setDescription("the mission will be failed if any of the HVT on Gudauta are destroyed") :setMessage("HVT target(s) destroyed : %s !") :configureAsPreventDestructionOfSceneryObjectsInZone( { "Gudauta - Tower", "Gudauta - Kerosen", "Gudauta - Mess"}, { [156696667] = "Gudauta Tower", [156735615] = "Gudauta Kerosen tankers", [156729386] = "Gudauta mess" } ) ) :addObjective( VeafCombatMissionObjective.new() :setName("Kill all the bombers") :setDescription("you must kill all of the bombers") :setMessage("%d bombers destroyed !") :configureAsKillEnemiesObjective() ) :initialize() ) veafCombatMission.AddMission( VeafCombatMission.new() :setName("Training-Bomber-1-slow") :setFriendlyName("Training - Bomber Scenario 1 - slow Tu-160") :setBriefing([[ You're head-on at 25nm with 11 Tu-160, FL200, Mach 0.8. Destroy them all in less than 10 minutes !]]) :addElement( VeafCombatMissionElement.new() :setName("Bombers") :setGroups({ "Red Tu-160 Bomber Wave1-1", "Red Tu-160 Bomber Wave1-2", "Red Tu-160 Bomber Wave1-3", "Red Tu-160 Bomber Wave1-4", "Red Tu-160 Bomber Wave1-5", "Red Tu-160 Bomber Wave1-6", "Red Tu-160 Bomber Wave1-7", "Red Tu-160 Bomber Wave1-8", "Red Tu-160 Bomber Wave1-9", "Red Tu-160 Bomber Wave1-10", "Red Tu-160 Bomber Wave1-11", }) :setSkill("Good") ) :addObjective( VeafCombatMissionObjective.new() :setName("< 15 minutes") :setDescription("the mission will be over after 15 minutes") :setMessage("the 15 minutes have passed !") :configureAsTimedObjective(900) ) :addObjective( VeafCombatMissionObjective.new() :setName("Kill all the bombers") :setDescription("you must kill or route all bombers") :setMessage("%d bombers destroyed or routed !") :configureAsKillEnemiesObjective(-1, 50) ) :initialize() ) veaf.logInfo("init - veafCombatMission") veafCombatMission.initialize() veaf.logInfo("dumping missions list") veafCombatMission.dumpMissionsList() end ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- configure COMBAT ZONE ------------------------------------------------------------------------------------------------------------------------------------------------------------- if veafCombatZone then veafCombatZone.logInfo("Loading configuration") veafCombatZone.AddZone( VeafCombatZone.new() :setMissionEditorZoneName("combatZone_Psebay_Factory") :setFriendlyName("Psebay chemical weapons factory") :setBriefing("This factory manufactures chemical weapons for a terrorits group\n" .. "You must destroy both factory buildings, and the bunker where the scientists work\n" .. "The other enemy units are secondary targets\n") ) veafCombatZone.AddZone( VeafCombatZone.new() :setMissionEditorZoneName("combatZone_BattleOfBeslan") :setFriendlyName("Battle of Beslan") :setBriefing("This zone is the place of a battle between red and blue armies.\n" .. "You must do what you can to help your side win\n" .. "Please note that there is an enemy convoy coming from the west and going to Sheripova, that can be ambushed by the blue forces at Malgobek in 15-30 minutes. Be wary of the SAM that can hide anywhere in the cities or the forests !\n" .. "Warning : there are air defenses lurking about, you should be cautious !") ) veafCombatZone.AddZone( VeafCombatZone.new() :setMissionEditorZoneName("combatZone_EasyPickingsTerek") :setFriendlyName("Terek logistics parking") :setBriefing("The enemy has parked a lot of logistics at Terek\n" .. "You must destroy all the trucks to impend the advance of their army on Beslan\n" .. "The other enemy units are secondary targets\n".. "This is a more easy zone, with few air defenses. But beware that there is a chance of manpad in the area !") ) veafCombatZone.AddZone( VeafCombatZone.new() :setMissionEditorZoneName("combatZone_rangeKobuletiEasy") :setFriendlyName("Training at Kobuleti RANGE") :setBriefing("The Kobuleti RANGE (located 6 nm south-west of Kobuleti airbase) is set-up for training") ) veafCombatZone.AddZone( VeafCombatZone.new() :setMissionEditorZoneName("combatZone_SaveTheHostages") :setFriendlyName("Hostages at Prohladniy") :setBriefing("Hostages are being held in a fortified hotel in the city of Prohladniy.\n" .. "Warning : there are air defenses lurking about, you should be cautious !") ) veaf.logInfo("init - veafCombatZone") veafCombatZone.initialize() end ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- configure NAMEDPOINTS ------------------------------------------------------------------------------------------------------------------------------------------------------------- veafNamedPoints.Points = { -- airbases in Georgia {name="AIRBASE Batumi", point={x=-356437,y=0,z=618211, atc=true, tower="V131, U260", tacan="16X BTM", runways={{name="13", hdg=125, ils="110.30"}, {name="31", hdg=305}}}}, {name="AIRBASE Gudauta", point={x=-196850,y=0,z=516496, atc=true, tower="V130, U259", runways={ {name="15", hdg=150}, {name="33", hdg=330}}}}, {name="AIRBASE Kobuleti",point={x=-318000,y=0,z=636620, atc=true, tower="V133, U262", tacan="67X KBL", runways={ {name="07", hdg=69, ils="111.50"}}}}, {name="AIRBASE Kutaisi", point={x=-284860,y=0,z=683839, atc=true, tower="V134, U264", tacan="44X KTS", runways={ {name="08", hdg=74, ils="109.75"}, {name="26", hdg=254}}}}, {name="AIRBASE Senaki", point={x=-281903,y=0,z=648379, atc=true, tower="V132, U261", tacan="31X TSK", runways={ {name="09", hdg=94, ils="108.90"}, {name="27", hdg=274}}}}, {name="AIRBASE Sukhumi", point={x=-221382,y=0,z=565909, atc=true, tower="V129, U258", runways={{name="12", hdg=116}, {name="30", hdg=296}}}}, {name="AIRBASE Tbilisi", point={x=-314926,y=0,z=895724, atc=true, tower="V138, U267", tacan="25X GTB", runways={{name="13", hdg=127, ils="110.30"},{name="31", hdg=307, ils="108.90"}}}}, {name="AIRBASE Vaziani", point={x=-319000,y=0,z=903271, atc=true, tower="V140, U269", tacan="22X VAS", runways={ {name="13", hdg=135, ils="108.75"}, {name="31", hdg=315, ils="108.75"}}}}, -- airbases in Russia {name="AIRBASE Anapa - Vityazevo", point={x=-004448,y=0,z=244022, atc=true, tower="V121, U250" , runways={ {name="22", hdg=220}, {name="04", hdg=40}}}}, {name="AIRBASE Beslan", point={x=-148472,y=0,z=842252, atc=true, tower="V141, U270", runways={ {name="10", hdg=93, ils="110.50"}, {name="28", hdg=273}}}}, {name="AIRBASE Krymsk", point={x=-007349,y=0,z=293712, atc=true, tower="V124, U253", runways={ {name="04", hdg=39}, {name="22", hdg=219}}}}, {name="AIRBASE Krasnodar-Pashkovsky",point={x=-008707,y=0,z=388986, atc=true, tower="V128, U257", runways={ {name="23", hdg=227}, {name="05", hdg=47}}}}, {name="AIRBASE Krasnodar-Center", point={x=-011653,y=0,z=366766, atc=true, tower="V122, U251", runways={ {name="09", hdg=86}, {name="27", hdg=266}}}}, {name="AIRBASE Gelendzhik", point={x=-050996,y=0,z=297849, atc=true, tower="V126, U255", runways={ {hdg=40}, {hdg=220}}}}, {name="AIRBASE Maykop", point={x=-027626,y=0,z=457048, atc=true, tower="V125, U254", runways={ {name="04", hdg=40}, {name="22", hdg=220}}}}, {name="AIRBASE Mineralnye Vody", point={x=-052090,y=0,z=707418, atc=true, tower="V135, U264", runways={ {name="12", hdg=115, ils="111.70"}, {name="30", hdg=295, ils="109.30"}}}}, {name="AIRBASE Mozdok", point={x=-083330,y=0,z=835635, atc=true, tower="V137, U266", runways={ {name="08", hdg=82}, {name="26", hdg=262}}}}, {name="AIRBASE Nalchik", point={x=-125500,y=0,z=759543, atc=true, tower="V136, U265", runways={ {name="06", hdg=55}, {name="24", hdg=235, ils="110.50"}}}}, {name="AIRBASE Novorossiysk", point={x=-040299,y=0,z=279854, atc=true, tower="V123, U252", runways={ {name="04", hdg=40}, {name="22", hdg=220}}}}, {name="AIRBASE Sochi", point={x=-165163,y=0,z=460902, atc=true, tower="V127, U256", runways={ {name="06", hdg=62, ils="111.10"}, {name="24", hdg=242}}}}, -- points of interest {name="RANGE Kobuleti",point={x=-328289,y=0,z=631228}}, } veafNamedPoints.logInfo("Loading configuration") veaf.logInfo("init - veafNamedPoints") veafNamedPoints.initialize() veafNamedPoints.addAllCaucasusCities() ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- configure SECURITY ------------------------------------------------------------------------------------------------------------------------------------------------------------- veafSecurity.password_L9["6ade6629f9219d87a011e7b8fbf8ef9584f2786d"] = true veafSecurity.logInfo("Loading configuration") veaf.logInfo("init - veafSecurity") veafSecurity.initialize() -- force security in order to test it when dynamic loading is in place --veaf.SecurityDisabled = false --veafSecurity.authenticated = false ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- configure CARRIER OPERATIONS ------------------------------------------------------------------------------------------------------------------------------------------------------------- local useMooseAirboss = false if useMooseAirboss then veafCarrierOperations2.setCarrierInfo("CVN-74 Stennis", 119.700, 305) veafCarrierOperations2.setTankerInfo("CVN-74 Stennis S3B-Tanker", 290.90, 75, "S3B", 511) veafCarrierOperations2.setPedroInfo("CVN-74 Stennis Pedro", "Lake Erie", 42) veafCarrierOperations2.setRepeaterInfo("Stennis Radio Repeater LSO", "Stennis Radio Repeater MARSHAL") --veafCarrierOperations2.setTraining() veaf.logInfo("init - veafCarrierOperations2") veafCarrierOperations2.initialize() --veafCarrierOperations2.addRecoveryWindows() else veaf.logInfo("init - veafCarrierOperations") veafCarrierOperations.initialize(true) end ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- configure CTLD ------------------------------------------------------------------------------------------------------------------------------------------------------------- ctld.staticBugWorkaround = false -- DCS had a bug where destroying statics would cause a crash. If this happens again, set this to TRUE ctld.disableAllSmoke = false -- if true, all smoke is diabled at pickup and drop off zones regardless of settings below. Leave false to respect settings below ctld.hoverPickup = true -- if set to false you can load crates with the F10 menu instead of hovering... Only if not using real crates! ctld.enableCrates = true -- if false, Helis will not be able to spawn or unpack crates so will be normal CTTS ctld.slingLoad = false -- if false, crates can be used WITHOUT slingloading, by hovering above the crate, simulating slingloading but not the weight... -- There are some bug with Sling-loading that can cause crashes, if these occur set slingLoad to false -- to use the other method. -- Set staticBugFix to FALSE if use set ctld.slingLoad to TRUE ctld.enableSmokeDrop = true -- if false, helis and c-130 will not be able to drop smoke ctld.maxExtractDistance = 125 -- max distance from vehicle to troops to allow a group extraction ctld.maximumDistanceLogistic = 500 -- max distance from vehicle to logistics to allow a loading or spawning operation ctld.maximumSearchDistance = 8000 -- max distance for troops to search for enemy ctld.maximumMoveDistance = 2000 -- max distance for troops to move from drop point if no enemy is nearby ctld.minimumDeployDistance = 1000 -- minimum distance from a friendly pickup zone where you can deploy a crate ctld.numberOfTroops = 10 -- default number of troops to load on a transport heli or C-130 -- also works as maximum size of group that'll fit into a helicopter unless overridden ctld.enableFastRopeInsertion = true -- allows you to drop troops by fast rope ctld.fastRopeMaximumHeight = 18.28 -- in meters which is 60 ft max fast rope (not rappell) safe height ctld.vehiclesForTransportRED = { "BRDM-2", "BTR_D" } -- vehicles to load onto Il-76 - Alternatives {"Strela-1 9P31","BMP-1"} ctld.vehiclesForTransportBLUE = { "M1045 HMMWV TOW", "M1043 HMMWV Armament" } -- vehicles to load onto c130 - Alternatives {"M1128 Stryker MGS","M1097 Avenger"} ctld.aaLaunchers = 3 -- controls how many launchers to add to the kub/buk when its spawned. ctld.hawkLaunchers = 5 -- controls how many launchers to add to the hawk when its spawned. ctld.spawnRPGWithCoalition = true --spawns a friendly RPG unit with Coalition forces ctld.spawnStinger = false -- spawns a stinger / igla soldier with a group of 6 or more soldiers! ctld.enabledFOBBuilding = true -- if true, you can load a crate INTO a C-130 than when unpacked creates a Forward Operating Base (FOB) which is a new place to spawn (crates) and carry crates from -- In future i'd like it to be a FARP but so far that seems impossible... -- You can also enable troop Pickup at FOBS ctld.cratesRequiredForFOB = 3 -- The amount of crates required to build a FOB. Once built, helis can spawn crates at this outpost to be carried and deployed in another area. -- The large crates can only be loaded and dropped by large aircraft, like the C-130 and listed in ctld.vehicleTransportEnabled -- Small FOB crates can be moved by helicopter. The FOB will require ctld.cratesRequiredForFOB larges crates and small crates are 1/3 of a large fob crate -- To build the FOB entirely out of small crates you will need ctld.cratesRequiredForFOB * 3 ctld.troopPickupAtFOB = true -- if true, troops can also be picked up at a created FOB ctld.buildTimeFOB = 120 --time in seconds for the FOB to be built ctld.crateWaitTime = 120 -- time in seconds to wait before you can spawn another crate ctld.forceCrateToBeMoved = true -- a crate must be picked up at least once and moved before it can be unpacked. Helps to reduce crate spam ctld.radioSound = "beacon.ogg" -- the name of the sound file to use for the FOB radio beacons. If this isnt added to the mission BEACONS WONT WORK! ctld.radioSoundFC3 = "beaconsilent.ogg" -- name of the second silent radio file, used so FC3 aircraft dont hear ALL the beacon noises... :) ctld.deployedBeaconBattery = 30 -- the battery on deployed beacons will last for this number minutes before needing to be re-deployed ctld.enabledRadioBeaconDrop = true -- if its set to false then beacons cannot be dropped by units ctld.allowRandomAiTeamPickups = false -- Allows the AI to randomize the loading of infantry teams (specified below) at pickup zones ctld.allowAiTeamPickups = false -- Allows the AI to automatically load infantry teams (specified below) at pickup zones -- Simulated Sling load configuration ctld.minimumHoverHeight = 7.5 -- Lowest allowable height for crate hover ctld.maximumHoverHeight = 12.0 -- Highest allowable height for crate hover ctld.maxDistanceFromCrate = 5.5 -- Maximum distance from from crate for hover ctld.hoverTime = 10 -- Time to hold hover above a crate for loading in seconds -- end of Simulated Sling load configuration -- AA SYSTEM CONFIG -- -- Sets a limit on the number of active AA systems that can be built for RED. -- A system is counted as Active if its fully functional and has all parts -- If a system is partially destroyed, it no longer counts towards the total -- When this limit is hit, a player will still be able to get crates for an AA system, just unable -- to unpack them ctld.AASystemLimitRED = 20 -- Red side limit ctld.AASystemLimitBLUE = 20 -- Blue side limit --END AA SYSTEM CONFIG -- -- ***************** JTAC CONFIGURATION ***************** ctld.JTAC_LIMIT_RED = 10 -- max number of JTAC Crates for the RED Side ctld.JTAC_LIMIT_BLUE = 10 -- max number of JTAC Crates for the BLUE Side ctld.JTAC_dropEnabled = true -- allow JTAC Crate spawn from F10 menu ctld.JTAC_maxDistance = 10000 -- How far a JTAC can "see" in meters (with Line of Sight) ctld.JTAC_smokeOn_RED = true -- enables marking of target with smoke for RED forces ctld.JTAC_smokeOn_BLUE = true -- enables marking of target with smoke for BLUE forces ctld.JTAC_smokeColour_RED = 4 -- RED side smoke colour -- Green = 0 , Red = 1, White = 2, Orange = 3, Blue = 4 ctld.JTAC_smokeColour_BLUE = 1 -- BLUE side smoke colour -- Green = 0 , Red = 1, White = 2, Orange = 3, Blue = 4 ctld.JTAC_jtacStatusF10 = true -- enables F10 JTAC Status menu ctld.JTAC_location = true -- shows location of target in JTAC message ctld.JTAC_lock = "all" -- "vehicle" OR "troop" OR "all" forces JTAC to only lock vehicles or troops or all ground units -- ***************** Pickup, dropoff and waypoint zones ***************** -- Available colors (anything else like "none" disables smoke): "green", "red", "white", "orange", "blue", "none", -- Use any of the predefined names or set your own ones -- You can add number as a third option to limit the number of soldier or vehicle groups that can be loaded from a zone. -- Dropping back a group at a limited zone will add one more to the limit -- If a zone isn't ACTIVE then you can't pickup from that zone until the zone is activated by ctld.activatePickupZone -- using the Mission editor -- You can pickup from a SHIP by adding the SHIP UNIT NAME instead of a zone name -- Side - Controls which side can load/unload troops at the zone -- Flag Number - Optional last field. If set the current number of groups remaining can be obtained from the flag value --pickupZones = { "Zone name or Ship Unit Name", "smoke color", "limit (-1 unlimited)", "ACTIVE (yes/no)", "side (0 = Both sides / 1 = Red / 2 = Blue )", flag number (optional) } ctld.pickupZones = { { "pickzone1", "none", -1, "yes", 0 }, { "pickzone2", "none", -1, "yes", 0 }, { "pickzone3", "none", -1, "yes", 0 }, { "pickzone4", "none", -1, "yes", 0 }, { "pickzone5", "none", -1, "yes", 0 }, { "pickzone6", "none", -1, "yes", 0 }, { "pickzone7", "none", -1, "yes", 0 }, { "pickzone8", "none", -1, "yes", 0 }, { "pickzone9", "none", -1, "yes", 0 }, { "pickzone10", "none", -1, "yes", 0 }, { "pickzone11", "none", -1, "yes", 0 }, { "pickzone12", "none", -1, "yes", 0 }, { "pickzone13", "none", -1, "yes", 0 }, { "pickzone14", "none", -1, "yes", 0 }, { "pickzone15", "none", -1, "yes", 0 }, { "pickzone16", "none", -1, "yes", 0 }, { "pickzone17", "none", -1, "yes", 0 }, { "pickzone18", "none", -1, "yes", 0 }, { "pickzone19", "none", 5, "yes", 0 }, { "pickzone20", "none", 10, "yes", 0, 1000 }, -- optional extra flag number to store the current number of groups available in { "CVN-74 Stennis", "none", 10, "yes", 0, 1001 }, -- instead of a Zone Name you can also use the UNIT NAME of a ship { "LHA-1 Tarawa", "none", 10, "yes", 0, 1002 }, -- instead of a Zone Name you can also use the UNIT NAME of a ship } -- dropOffZones = {"name","smoke colour",0,side 1 = Red or 2 = Blue or 0 = Both sides} ctld.dropOffZones = { { "dropzone1", "green", 2 }, { "dropzone2", "blue", 2 }, { "dropzone3", "orange", 2 }, { "dropzone4", "none", 2 }, { "dropzone5", "none", 1 }, { "dropzone6", "none", 1 }, { "dropzone7", "none", 1 }, { "dropzone8", "none", 1 }, { "dropzone9", "none", 1 }, { "dropzone10", "none", 1 }, } --wpZones = { "Zone name", "smoke color", "ACTIVE (yes/no)", "side (0 = Both sides / 1 = Red / 2 = Blue )", } ctld.wpZones = { { "wpzone1", "green","yes", 2 }, { "wpzone2", "blue","yes", 2 }, { "wpzone3", "orange","yes", 2 }, { "wpzone4", "none","yes", 2 }, { "wpzone5", "none","yes", 2 }, { "wpzone6", "none","yes", 1 }, { "wpzone7", "none","yes", 1 }, { "wpzone8", "none","yes", 1 }, { "wpzone9", "none","yes", 1 }, { "wpzone10", "none","no", 0 }, -- Both sides as its set to 0 } -- ******************** Transports names ********************** -- Use any of the predefined names or set your own ones ctld.transportPilotNames = { "helicargo1", "helicargo1", "helicargo2", "helicargo3", "helicargo4", "helicargo5", "helicargo6", "helicargo7", "helicargo8", "helicargo9", "helicargo10", "helicargo11", "helicargo12", "helicargo13", "helicargo14", "helicargo15", "helicargo16", "helicargo17", "helicargo18", "helicargo19", "helicargo20", "helicargo21", "helicargo22", "helicargo23", "helicargo24", "helicargo25", "helicargo26", "helicargo27", "helicargo28", "helicargo29", "helicargo30", "helicargo31", "helicargo32", "helicargo33", "helicargo34", "helicargo35", "helicargo36", "helicargo37", "helicargo38", "helicargo39", "helicargo40", "helicargo41", "helicargo42", "helicargo43", "helicargo44", "helicargo45", "helicargo46", "helicargo47", "helicargo48", "helicargo49", "helicargo51", "helicargo52", "helicargo53", "helicargo54", "helicargo61", "helicargo62", "helicargo63", "helicargo64", "yak1", "yak2", "yak3", "yak4", "yak5", "yak6", "yak7", "yak8", "yak9", "yak10", "yak11", "yak12", "yak13", "yak14", "yak15", "yak16", "yak17", "yak18", "yak19", "yak20", "yak21", "yak22", "yak23", "yak24", "yak25", } -- *************** Optional Extractable GROUPS ***************** -- Use any of the predefined names or set your own ones ctld.extractableGroups = { "extract1", "extract2", "extract3", "extract4", "extract5", "extract6", "extract7", "extract8", "extract9", "extract10", "extract11", "extract12", "extract13", "extract14", "extract15", "extract16", "extract17", "extract18", "extract19", "extract20", "extract21", "extract22", "extract23", "extract24", "extract25", } -- ************** Logistics UNITS FOR CRATE SPAWNING ****************** -- Use any of the predefined names or set your own ones -- When a logistic unit is destroyed, you will no longer be able to spawn crates ctld.logisticUnits = { "logistic1", "logistic2", "logistic3", "logistic4", "logistic5", "logistic6", "logistic7", "logistic8", "logistic9", "logistic10", "logistic11", "logistic12", "logistic13", "logistic14", "logistic15", "logistic16", "logistic17", "logistic18", "logistic19", "logistic20", } -- ************** UNITS ABLE TO TRANSPORT VEHICLES ****************** -- Add the model name of the unit that you want to be able to transport and deploy vehicles -- units db has all the names or you can extract a mission.miz file by making it a zip and looking -- in the contained mission file ctld.vehicleTransportEnabled = { "76MD", -- the il-76 mod doesnt use a normal - sign so il-76md wont match... !!!! GRR "C-130", } -- ************** Maximum Units SETUP for UNITS ****************** -- Put the name of the Unit you want to limit group sizes too -- i.e -- ["UH-1H"] = 10, -- -- Will limit UH1 to only transport groups with a size 10 or less -- Make sure the unit name is exactly right or it wont work ctld.unitLoadLimits = { ["Mi-8MT"] = 24 -- Remove the -- below to turn on options -- ["SA342Mistral"] = 4, -- ["SA342L"] = 4, -- ["SA342M"] = 4, } -- ************** Allowable actions for UNIT TYPES ****************** -- Put the name of the Unit you want to limit actions for -- NOTE - the unit must've been listed in the transportPilotNames list above -- This can be used in conjunction with the options above for group sizes -- By default you can load both crates and troops unless overriden below -- i.e -- ["UH-1H"] = {crates=true, troops=false}, -- -- Will limit UH1 to only transport CRATES but NOT TROOPS -- -- ["SA342Mistral"] = {crates=fales, troops=true}, -- Will allow Mistral Gazelle to only transport crates, not troops ctld.unitActions = { ["Yak-52"] = {crates=false, troops=true} -- Remove the -- below to turn on options -- ["SA342Mistral"] = {crates=true, troops=true}, -- ["SA342L"] = {crates=false, troops=true}, -- ["SA342M"] = {crates=false, troops=true}, } -- ************** INFANTRY GROUPS FOR PICKUP ****************** -- Unit Types -- inf is normal infantry -- mg is M249 -- at is RPG-16 -- aa is Stinger or Igla -- mortar is a 2B11 mortar unit -- You must add a name to the group for it to work -- You can also add an optional coalition side to limit the group to one side -- for the side - 2 is BLUE and 1 is RED ctld.loadableGroups = { {name = "Standard Group", inf = 6, mg = 2, at = 2 }, -- will make a loadable group with 5 infantry, 2 MGs and 2 anti-tank for both coalitions {name = "Anti Air", inf = 2, aa = 3 }, {name = "Anti Tank", inf = 2, at = 6 }, {name = "Mortar Squad", mortar = 6 }, {name = "Mortar Squad x 4", mortar = 24}, -- {name = "Mortar Squad Red", inf = 2, mortar = 5, side =1 }, --would make a group loadable by RED only } -- ************** SPAWNABLE CRATES ****************** -- Weights must be unique as we use the weight to change the cargo to the correct unit -- when we unpack -- ctld.spawnableCrates = { -- name of the sub menu on F10 for spawning crates ["Ground Forces"] = { --crates you can spawn -- weight in KG -- Desc is the description on the F10 MENU -- unit is the model name of the unit to spawn -- cratesRequired - if set requires that many crates of the same type within 100m of each other in order build the unit -- side is optional but 2 is BLUE and 1 is RED -- dont use that option with the HAWK Crates { weight = 500, desc = "HMMWV - TOW", unit = "M1045 HMMWV TOW", side = 2 }, { weight = 505, desc = "HMMWV - MG", unit = "M1043 HMMWV Armament", side = 2 }, { weight = 510, desc = "BTR-D", unit = "BTR_D", side = 1 }, { weight = 515, desc = "BRDM-2", unit = "BRDM-2", side = 1 }, { weight = 520, desc = "HMMWV - JTAC", unit = "Hummer", side = 2, }, -- used as jtac and unarmed, not on the crate list if JTAC is disabled { weight = 525, desc = "SKP-11 - JTAC", unit = "SKP-11", side = 1, }, -- used as jtac and unarmed, not on the crate list if JTAC is disabled { weight = 100, desc = "2B11 Mortar", unit = "2B11 mortar" }, { weight = 250, desc = "SPH 2S19 Msta", unit = "SAU Msta", side = 1, cratesRequired = 3 }, { weight = 255, desc = "M-109", unit = "M-109", side = 2, cratesRequired = 3 }, { weight = 252, desc = "Ural-375 Ammo Truck", unit = "Ural-375", side = 1, cratesRequired = 2 }, { weight = 253, desc = "M-818 Ammo Truck", unit = "M 818", side = 2, cratesRequired = 2 }, { weight = 800, desc = "FOB Crate - Small", unit = "FOB-SMALL" }, -- Builds a FOB! - requires 3 * ctld.cratesRequiredForFOB }, ["AA Crates"] = { { weight = 50, desc = "Stinger", unit = "Stinger manpad", side = 2 }, { weight = 55, desc = "Igla", unit = "SA-18 Igla manpad", side = 1 }, -- HAWK System { weight = 540, desc = "HAWK Launcher", unit = "Hawk ln", side = 2}, { weight = 545, desc = "HAWK Search Radar", unit = "Hawk sr", side = 2 }, { weight = 550, desc = "HAWK Track Radar", unit = "Hawk tr", side = 2 }, { weight = 551, desc = "HAWK PCP", unit = "Hawk pcp" , side = 2 }, -- Remove this if on 1.2 { weight = 552, desc = "HAWK Repair", unit = "HAWK Repair" , side = 2 }, -- End of HAWK -- KUB SYSTEM { weight = 560, desc = "KUB Launcher", unit = "Kub 2P25 ln", side = 1}, { weight = 565, desc = "KUB Radar", unit = "Kub 1S91 str", side = 1 }, { weight = 570, desc = "KUB Repair", unit = "KUB Repair", side = 1}, -- End of KUB -- BUK System -- { weight = 575, desc = "BUK Launcher", unit = "SA-11 Buk LN 9A310M1"}, -- { weight = 580, desc = "BUK Search Radar", unit = "SA-11 Buk SR 9S18M1"}, -- { weight = 585, desc = "BUK CC Radar", unit = "SA-11 Buk CC 9S470M1"}, -- { weight = 590, desc = "BUK Repair", unit = "BUK Repair"}, -- END of BUK { weight = 595, desc = "Early Warning Radar", unit = "1L13 EWR", side = 1 }, -- cant be used by BLUE coalition { weight = 405, desc = "Strela-1 9P31", unit = "Strela-1 9P31", side = 1, cratesRequired = 3 }, { weight = 400, desc = "M1097 Avenger", unit = "M1097 Avenger", side = 2, cratesRequired = 3 }, }, } -- if the unit is on this list, it will be made into a JTAC when deployed ctld.jtacUnitTypes = { "SKP", "Hummer" -- there are some wierd encoding issues so if you write SKP-11 it wont match as the - sign is encoded differently... } veaf.logInfo("init - ctld") ctld.initialize() veaf.logInfo("init - veafInterpreter") veafInterpreter.initialize() ------------------------------------------------------------------------------------------------------------------------------------------------------------- -- initialize the remote interface ------------------------------------------------------------------------------------------------------------------------------------------------------------- veaf.logInfo("init - veafRemote") veafRemote.initialize() -- combat zones veafRemote.monitorWithSlMod("-veaf start-zone-1" , [[ veafCombatZone.ActivateZoneNumber(1, true) ]]) veafRemote.monitorWithSlMod("-veaf start-zone-2" , [[ veafCombatZone.ActivateZoneNumber(2, true) ]]) veafRemote.monitorWithSlMod("-veaf start-zone-3" , [[ veafCombatZone.ActivateZoneNumber(3, true) ]]) veafRemote.monitorWithSlMod("-veaf start-zone-4" , [[ veafCombatZone.ActivateZoneNumber(4, true) ]]) veafRemote.monitorWithSlMod("-veaf start-zone-5" , [[ veafCombatZone.ActivateZoneNumber(5, true) ]]) veafRemote.monitorWithSlMod("-veaf start-zone-6" , [[ veafCombatZone.ActivateZoneNumber(6, true) ]]) veafRemote.monitorWithSlMod("-veaf start-zone-7" , [[ veafCombatZone.ActivateZoneNumber(7, true) ]]) veafRemote.monitorWithSlMod("-veaf start-zone-8" , [[ veafCombatZone.ActivateZoneNumber(8, true) ]]) veafRemote.monitorWithSlMod("-veaf start-zone-9" , [[ veafCombatZone.ActivateZoneNumber(9, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-1" , [[ veafCombatZone.DesactivateZoneNumber(1, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-2" , [[ veafCombatZone.DesactivateZoneNumber(2, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-3" , [[ veafCombatZone.DesactivateZoneNumber(3, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-4" , [[ veafCombatZone.DesactivateZoneNumber(4, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-5" , [[ veafCombatZone.DesactivateZoneNumber(5, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-6" , [[ veafCombatZone.DesactivateZoneNumber(6, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-7" , [[ veafCombatZone.DesactivateZoneNumber(7, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-8" , [[ veafCombatZone.DesactivateZoneNumber(8, true) ]]) veafRemote.monitorWithSlMod("-veaf stop-zone-9" , [[ veafCombatZone.DesactivateZoneNumber(9, true) ]])
local sub = string.sub local concat = table.concat local str_meta = { __index = function(s, i) return sub(s.str, i, i) end, __newindex = function(s, i, v) s.str = concat({sub(s.str, 0, i-1), v, sub(s.str, i+1)}, "") end, __tostring = function() return s.str end, __len = function(s) return #s.str end, } function str(s) return setmetatable({str = s}, str_meta) end
object_tangible_quest_naboo_theed_borvo_antenna = object_tangible_quest_shared_naboo_theed_borvo_antenna:new { } ObjectTemplates:addTemplate(object_tangible_quest_naboo_theed_borvo_antenna, "object/tangible/quest/naboo_theed_borvo_antenna.iff")
--[[------------------------------------------------------------------------------------------------------------------------- Works as relay between discord and gmod server -------------------------------------------------------------------------------------------------------------------------]] -- local PLUGIN = {} PLUGIN.Title = "DiscordRelay" PLUGIN.Description = "Sends and receives messages from discord" PLUGIN.Author = "MechWipf" PLUGIN.ChatCommand = "discord" PLUGIN.Usage = "<enable=0|1>" PLUGIN.Privileges = {"Discord (enable/disable)"} ---- Config for external stuff, enter your settings here ---- local config = { messagesUrl = "", apiKey = "", enabled = true } ------------------------------------------------------------- function PLUGIN:Call( ply, args ) if ply:EV_HasPrivilege( "Discord (enable/disable)" ) then if args[1] == "1" then config.enabled = true evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " enabled Discord." ) elseif args[1] == "0" then config.enabled = false evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " disabled Discord." ) else if config.enabled then evolve:Notify( ply, evolve.colors.white, "Discord is currently enabled." ) else evolve:Notify( ply, evolve.colors.white, "Discord is currently disabled." ) end end end end function PLUGIN:Initialize () hook.Add( "PlayerSay", "ev_discord", function( ply, strText, private ) if private or not config.enabled then return end http.Post( config.messagesUrl .. "?key=" .. config.apiKey, { userSteamId = ply:SteamID(), userName = "test", content = strText }, function (result) end, function ( failed ) config.enabled = false end ) end) timer.Create( "ev_discord_fetch", 3, 0, function () local function success ( body, _, _, code ) if code == 200 then local jsonData = util.JSONToTable( body ) for k, v in pairs( jsonData ) do pcall(function () local uid = evolve:UniqueIDByProperty( "SteamID", v.steamId ) local pl = player.GetByUniqueID( uid ) umsg.Start( "EV_Discord" ) umsg.String( evolve:GetProperty( uid, "Nick" ) ) umsg.String( evolve:GetProperty( uid, "Rank" ) ) umsg.String( v.content ) umsg.End() end) end end end if config.enabled then http.Fetch( config.messagesUrl .. "?key=" .. config.apiKey, success, function () config.enabled = false end) end end ) end PLUGIN:Initialize() evolve:RegisterPlugin( PLUGIN )
----------------------------------- -- Blade Ei -- Katana weapon skill -- Skill Level: 175 -- Delivers a dark elemental attack. Damage varies with TP. -- Aligned with the Shadow Gorget. -- Aligned with the Shadow Belt. -- Element: Dark -- Modifiers: STR:30% INT:30% -- 100%TP 200%TP 300%TP -- 1.00 1.50 2.00 ----------------------------------- require("scripts/globals/magic") require("scripts/globals/status") require("scripts/globals/settings") require("scripts/globals/weaponskills") ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {} params.ftp100 = 1 params.ftp200 = 1.5 params.ftp300 = 2 params.str_wsc = 0.3 params.dex_wsc = 0.0 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.3 params.mnd_wsc = 0.0 params.chr_wsc = 0.0 params.ele = tpz.magic.ele.DARK params.skill = tpz.skill.KATANA params.includemab = true if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.4 params.int_wsc = 0.4 end local damage, tpHits, extraHits = doMagicWeaponskill(player, target, wsID, params, tp, action, primary) return tpHits, extraHits, criticalHit, damage end
local AddonName, AddonTable = ... AddonTable.herbalism = { 52983, -- Cinderbloom 52984, -- Stormvine 52985, -- Azshara's Veil 52986, -- Heartblossom 52987, -- Twilight Jasmine 52988, -- Whiptail }
return {'equalizer','equatie','equator','equatoriaal','equidistant','equidistante','equilibrist','equilibriste','equinoctiaal','equinox','equipage','equipagemeester','equipe','equipement','equiperen','equivalent','equivalentie','equaties','equatoriale','equilibristen','equinoctiale','equinoxen','equipagemeesters','equipages','equipeer','equipeerde','equipeerden','equipeert','equipementen','equipes','equivalente','equivalenten','equivalenties','equalizers'}
return {'xxx'}
-- items: 28056, 28052 function event_say(e) if(e.message:findi("hail")) then e.self:Say("Beware these woods! The sarnak claim this land as their own and wicked creatures walk beneath the burning foliage."); end end function event_trade(e) local item_lib = require("items"); if(item_lib.check_turn_in(e.trade, {item1 = 28056})) then -- Ornate Sea Shell e.self:Say("Praise the Triumvirate! Natasha sent you just in time! Those twisted sarnak summoners are summoning Ixiblat Fer as we speak! We must stop Ixiblat Fer while he is still weak or all of Norrath may be set aflame! Please do me one more favor, should I perish to this beast of fire. Give this note to Natasha when you next see her, and if you should perish and I survive, I will make sure the waters never forget your reflections of your deeds this day."); e.other:SummonItem(28052); -- 28052 Message to Natasha e.other:Ding(); eq.unique_spawn(87151,0,0,1500,-2000,-375); -- Ixiblat Fer, kill him, loot scepter of I.F. eq.depop_with_timer(); end item_lib.return_items(e.self, e.other, e.trade) end ------------------------------------------------------------------------------------------------- -- Converted to .lua using MATLAB converter written by Stryd -- Find/replace data for .pl --> .lua conversions provided by Speedz, Stryd, Sorvani and Robregen -------------------------------------------------------------------------------------------------
local profile = {}; gcdisplay = gFunc.LoadFile('common\\gcdisplay.lua'); gcinclude = gFunc.LoadFile('common\\gcinclude.lua'); sets = T{ Idle = { Main = 'Bolelabunga', Sub = 'Genmei Shield', Head = 'Nyame Helm', Neck = 'Loricate Torque +1', Ear1 = 'Eabani Earring', Ear2 = 'Etiolation Earring', Body = 'Agwu\'s Robe', Hands = 'Nyame Gauntlets', Ring1 = 'Stikini Ring +1', Ring2 = { Name = 'Metamor. Ring +1', AugPath='A' }, Back = 'Solemnity Cape', Waist = 'Gishdubar Sash', Legs = 'Agwu\'s Slops', Feet = 'Volte Gaiters', }, Idle_Pet = { Main = 'Solstice', Sub = 'Genmei Shield', Range = 'Dunna', Head = 'Azimuth Hood +1', Neck = 'Bagua Charm', Ear1 = 'Handler\'s Earring +1', Ear2 = 'Rimeice Earring', Body = 'Telchine Chas.', Hands = 'Geo. Mitaines +1', Back = { Name = 'Nantosuelta\'s Cape', Augment = { [1] = 'Eva.+20', [2] = 'Pet: "Regen"+15', [3] = 'Mag. Eva.+20' } }, Legs = 'Telchine Braconi', Feet = 'Telchine Pigaches', }, Resting = {}, Idle_Regen = { Neck = 'Bathy Choker +1', Ring2 = 'Chirich Ring +1', }, Idle_Refresh = { Head = 'Befouled Crown', Waist = 'Fucho-no-Obi', Legs = 'Assid. Pants +1', }, Town = { Main = 'Bunzi\'s Rod', Sub = 'Culminus', Range = 'Dunna', Head = 'Bagua Galero +1', Neck = 'Bathy Choker +1', Body = 'Agwu\'s Robe', Hands = 'Geo. Mitaines +1', Back = 'Solemnity Cape', Legs = 'Agwu\'s Slops', Feet = 'Herald\'s Gaiters', }, Dt = { Head = 'Nyame Helm', Neck = 'Loricate Torque +1', Ear1 = 'Odnowa Earring +1', Ear2 = 'Etiolation Earring', Body = 'Agwu\'s Robe', Hands = 'Nyame Gauntlets', Ring1 = 'Defending Ring', Ring2 = 'Gelatinous Ring +1', Back = 'Solemnity Cape', Waist = 'Gishdubar Sash', Legs = 'Nyame Flanchard', Feet = 'Nyame Sollerets', }, Tp_Default = { Main = 'Malevolence', Sub = 'Genmei Shield', --Head = 'Jhakri Coronal +2', Head = 'Blistering Sallet +1', Neck = 'Sanctity Necklace', Ear1 = 'Cessance Earring', Ear2 = 'Telos Earring', Body = 'Jhakri Robe +2', Hands = 'Jhakri Cuffs +2', Ring1 = 'Petrov Ring', Ring2 = 'Chirich Ring +1', Back = { Name = 'Nantosuelta\'s Cape', Augment = { [1] = 'Eva.+20', [2] = 'Pet: "Regen"+15', [3] = 'Mag. Eva.+20' } }, Waist = 'Eschan Stone', Legs = 'Jhakri Slops +2', Feet = 'Jhakri Pigaches +2', }, Tp_Hybrid = { }, Tp_Acc = { Head = 'Blistering Sallet +1', Ear1 = 'Mache Earring +1', Ring1 = 'Cacoethic Ring +1', Ring2 = 'Chirich Ring +1', Back = 'Aurist\'s Cape +1', }, Precast = { Main = 'Solstice', Range = 'Dunna', Head = 'Haruspex Hat', Neck = 'Baetyl Pendant', Ear1 = 'Etiolation Earring', Ear2 = 'Malignance Earring', Body = 'Agwu\'s Robe', Hands = 'Mallquis Cuffs +2', Ring1 = 'Kishar Ring', Ring2 = 'Prolix Ring', Back = 'Swith Cape +1', Waist = 'Embla Sash', Legs = 'Agwu\'s Slops', Feet = 'Volte Gaiters', }, Cure_Precast = { Feet = 'Vanya Clogs', }, Enhancing_Precast = { Waist = 'Siegel Sash', }, Stoneskin_Precast = { Head = 'Umuthi Hat', Hands = 'Carapacho Cuffs', Waist = 'Siegel Sash', }, Cure = { Main = 'Bunzi\'s Rod', Sub = 'Ammurapi Shield', Ammo = 'Pemphredo Tathlum', Head = { Name = 'Vanya Hood', AugPath='C' }, Neck = 'Nodens Gorget', Ear1 = 'Mendi. Earring', Ear2 = 'Regal Earring', Hands = 'Weath. Cuffs +1', Ring1 = 'Rufescent Ring', Ring2 = { Name = 'Metamor. Ring +1', AugPath='A' }, Back = 'Solemnity Cape', Waist = 'Rumination Sash', Legs = 'Vanya Slops', Feet = 'Vanya Clogs', }, Self_Cure = { Waist = 'Gishdubar Sash', }, Regen = { Main = 'Bolelabunga', Sub = 'Ammurapi Shield', Body = 'Telchine Chas.', }, Cursna = { Ring1 = 'Purity Ring', Waist = 'Gishdubar Sash', }, Enhancing = { Main = 'Bunzi\'s Rod', Sub = 'Ammurapi Shield', Ammo = 'Pemphredo Tathlum', Head = 'Befouled Crown', Neck = 'Incanter\'s Torque', Ear1 = 'Mendi. Earring', Ear2 = 'Andoaa Earring', Body = 'Telchine Chas.', Hands = 'Nyame Gauntlets', Ring1 = 'Defending Ring', Ring2 = { Name = 'Metamor. Ring +1', AugPath='A' }, Back = 'Solemnity Cape', Waist = 'Embla Sash', Legs = { Name = 'Telchine Braconi', Augment = { [1] = 'Enh. Mag. eff. dur. +8', [2] = '"Conserve MP"+4' } }, Feet = 'Telchine Pigaches', }, Stoneskin = { Neck = 'Nodens Gorget', Waist = 'Siegel Sash', }, Phalanx = {}, Refresh = { Waist = 'Gishdubar Sash', }, Geomancy = { --900 skill, then indi duration, then CMP Main = 'Solstice', Range = 'Dunna', Head = 'Agwu\'s Cap',--sir Neck = 'Bagua Charm', Ear1 = 'Mendi. Earring', Body = 'Telchine Chas.', Hands = 'Geo. Mitaines +1',--15 Ring1 = 'Stikini Ring +1',--8 Ring2 = { Name = 'Metamor. Ring +1', AugPath='A' }, Waist = 'Hachirin-no-Obi', Legs = 'Vanya Slops', Feet = 'Medium\'s Sabots',--5 }, Indi = { Back = 'Nantosuelta\'s Cape', Legs = 'Bagua Pants +1', Feet = 'Azimuth Gaiters +1', }, Enfeebling = { Main = 'Bunzi\'s Rod', Sub = 'Ammurapi Shield', Ammo = 'Staunch Tathlum', Head = 'Befouled Crown', Neck = 'Erra Pendant', Ear1 = 'Regal Earring', Ear2 = 'Malignance Earring', Body = 'Agwu\'s Robe', Hands = 'Nyame Gauntlets', Ring1 = 'Kishar Ring', Ring2 = { Name = 'Metamor. Ring +1', AugPath='A' }, Back = { Name = 'Aurist\'s Cape +1', AugPath='A' }, Waist = { Name = 'Acuity Belt +1', AugPath='A' }, Legs = 'Agwu\'s Slops', Feet = { Name = 'Medium\'s Sabots', Augment = { [1] = 'MND+6', [2] = '"Conserve MP"+5', [3] = 'MP+40', [4] = '"Cure" potency +3%' } }, }, Macc = { Main = 'Bunzi\'s Rod', Sub = 'Ammurapi Shield', Ammo = 'Pemphredo Tathlum', Head = 'Nyame Helm', Neck = 'Erra Pendant', Ear1 = 'Regal Earring', Ear2 = 'Malignance Earring', Body = 'Agwu\'s Robe', Hands = 'Nyame Gauntlets', Ring1 = 'Kishar Ring', Ring2 = { Name = 'Metamor. Ring +1', AugPath='A' }, Back = { Name = 'Aurist\'s Cape +1', AugPath='A' }, Waist = { Name = 'Acuity Belt +1', AugPath='A' }, Legs = 'Agwu\'s Slops', Feet = { Name = 'Medium\'s Sabots', Augment = { [1] = 'MND+6', [2] = '"Conserve MP"+5', [3] = 'MP+40', [4] = '"Cure" potency +3%' } }, }, Drain = { Main = 'Bunzi\'s Rod', Sub = 'Ammurapi Shield', Ammo = 'Pemphredo Tathlum', Head = 'Bagua Galero +1', Neck = 'Erra Pendant', Ear1 = 'Regal Earring', Ear2 = 'Malignance Earring', Body = 'Agwu\'s Robe', Ring1 = 'Kishar Ring', Ring2 = 'Metamor. Ring +1', Back = 'Aurist\'s Cape +1', Waist = 'Fucho-no-Obi', Legs = 'Agwu\'s Slops', Feet = 'Agwu\'s Pigaches', }, Nuke = { Main = 'Marin Staff +1', Sub = 'Enki Strap', Ammo = 'Pemphredo Tathlum', Head = 'Jhakri Coronal +2', Neck = 'Baetyl Pendant', Ear1 = 'Regal Earring', Ear2 = 'Malignance Earring', Body = 'Agwu\'s Robe', Hands = 'Amalric Gages +1', Ring1 = 'Shiva Ring +1', Ring2 = { Name = 'Metamor. Ring +1', AugPath='A' }, Back = { Name = 'Nantosuelta\'s Cape', Augment = { [1] = '"Mag. Atk. Bns."+10', [2] = 'Mag. Acc+20', [3] = 'Magic Damage +20', [4] = 'INT+20' } }, Waist = 'Sacro Cord', Legs = 'Amalric Slops +1', Feet = 'Amalric Nails +1', }, NukeACC = { Waist = { Name = 'Acuity Belt +1', AugPath='A' }, }, Burst = { Main = 'Bunzi\'s Rod', --10 and 0 Sub = 'Ammurapi Shield', Head = 'Ea Hat', -- 6 and 6 --Body = 'Agwu\'s Robe', -- 10 and 0 Body = 'Ea Houppelande', -- 8 and 8 Hands = 'Amalric Gages +1', -- 0 and 6 Ring1 = 'Mujin Band', -- 0 and 5 Waist = { Name = 'Acuity Belt +1', AugPath='A' }, Legs = 'Agwu\'s Slops', -- 9 and 0 Feet = 'Ea Pigaches', -- 4 and 4 }, Mp_Body = {Body = 'Seidr Cotehardie',}, Preshot = { }, Midshot = { }, Ws_Default = { Ammo = 'Voluspa Tathlum', Head = 'Nyame Helm', Neck = 'Fotia Gorget', Ear1 = 'Telos Earring', Ear2 = 'Moonshade Earring', Body = 'Nyame Mail', Hands = 'Nyame Gauntlets', Ring1 = 'Rufescent Ring', Ring2 = 'Karieyh Ring +1', Back = 'Solemnity Cape', Waist = 'Fotia Belt', Legs = 'Nyame Flanchard', Feet = 'Nyame Sollerets', }, Ws_Hybrid = { }, Ws_Acc = { }, Aedge_Default = { Ammo = 'Pemphredo Tathlum', Head = 'Jhakri Coronal +2', Neck = 'Baetyl Pendant', Ear1 = 'Regal Earring', Ear2 = 'Malignance Earring', Body = 'Agwu\'s Robe', Hands = 'Jhakri Cuffs +2', Ring1 = 'Shiva Ring +1', Ring2 = 'Karieyh Ring +1', Back = { Name = 'Nantosuelta\'s Cape', Augment = { [1] = '"Mag. Atk. Bns."+10', [2] = 'Mag. Acc+20', [3] = 'Magic Damage +20', [4] = 'INT+20' } }, Waist = 'Sacro Cord', Legs = 'Nyame Flanchard', Feet = 'Nyame Sollerets', }, Aedge_Hybrid = { }, Aedge_Acc = { }, TH = {--/th will force this set to equip for 10 seconds Waist = 'Chaac Belt', }, Movement = { Feet = 'Herald\'s Gaiters', }, }; sets = sets:merge(gcinclude.sets, false);profile.Sets = sets; profile.OnLoad = function() gSettings.AllowAddSet = false; gcinclude.Initialize:once(3); AshitaCore:GetChatManager():QueueCommand(1, '/macro book 14'); AshitaCore:GetChatManager():QueueCommand(1, '/macro set 1'); end profile.OnUnload = function() gcinclude.Unload(); end profile.HandleCommand = function(args) gcinclude.SetCommands(args); end profile.HandleDefault = function() local player = gData.GetPlayer(); local pet = gData.GetPet(); gFunc.EquipSet(sets.Idle); if (player.Status == 'Engaged') then gFunc.EquipSet(sets.Tp_Default) if (gcdisplay.GetCycle('MeleeSet') ~= 'Default') then gFunc.EquipSet('Tp_' .. gcdisplay.GetCycle('MeleeSet')); end if (gcdisplay.GetToggle('Fight') == false) then AshitaCore:GetChatManager():QueueCommand(1, '/fight'); end elseif (player.Status == 'Resting') then gFunc.EquipSet(sets.Resting); elseif (player.IsMoving == true) then gFunc.EquipSet(sets.Movement); end if (gcdisplay.GetToggle('DTset') == true) then gFunc.EquipSet(sets.Dt); end if (gcdisplay.GetToggle('Kite') == true) then gFunc.EquipSet(sets.Movement); end gcinclude.CheckDefault (); if (pet ~= nil) and (player.Status ~= 'Engaged') then gFunc.EquipSet(sets.Idle_Pet); end end profile.HandleAbility = function() local ability = gData.GetAction(); if string.match(ability.Name, 'Full Circle') then gFunc.EquipSet(sets.Geomancy) end --lazy way to ensure the empy head piece is in on use gcinclude.CheckCancels(); end profile.HandleItem = function() local item = gData.GetAction(); if string.match(item.Name, 'Holy Water') then gFunc.EquipSet(gcinclude.sets.Holy_Water) end end profile.HandlePrecast = function() local spell = gData.GetAction(); gFunc.EquipSet(sets.Precast) if (spell.Skill == 'Enhancing Magic') then gFunc.EquipSet(sets.Enhancing_Precast); if string.contains(spell.Name, 'Stoneskin') then gFunc.EquipSet(sets.Stoneskin_Precast); end elseif (spell.Skill == 'Healing Magic') then gFunc.EquipSet(sets.Cure_Precast); end gcinclude.CheckCancels(); end profile.HandleMidcast = function() local player = gData.GetPlayer(); local weather = gData.GetEnvironment(); local spell = gData.GetAction(); local target = gData.GetActionTarget(); local me = AshitaCore:GetMemoryManager():GetParty():GetMemberName(0); if (spell.Skill == 'Enhancing Magic') then gFunc.EquipSet(sets.Enhancing); if string.match(spell.Name, 'Phalanx') then gFunc.EquipSet(sets.Phalanx); elseif string.match(spell.Name, 'Stoneskin') then gFunc.EquipSet(sets.Stoneskin); elseif string.contains(spell.Name, 'Refresh') then gFunc.EquipSet(sets.Refresh); end elseif (spell.Skill == 'Healing Magic') then gFunc.EquipSet(sets.Cure); if (target.Name == me) then gFunc.EquipSet(sets.Self_Cure); end if string.contains(spell.Name, 'Regen') then gFunc.EquipSet(sets.Regen); end if string.match(spell.Name, 'Cursna') then gFunc.EquipSet(sets.Cursna); end elseif (spell.Skill == 'Elemental Magic') then gFunc.EquipSet(sets.Nuke); if (gcdisplay.GetCycle('NukeSet') == 'Macc') then gFunc.EquipSet(sets.NukeACC); end if (gcdisplay.GetToggle('Burst') == true) then gFunc.EquipSet(sets.Burst); end if (spell.Element == weather.WeatherElement) or (spell.Element == weather.DayElement) then gFunc.Equip('Waist', 'Hachirin-no-Obi'); end if (player.MPP <= 40) then gFunc.EquipSet(sets.Mp_Body); end elseif (spell.Skill == 'Enfeebling Magic') then gFunc.EquipSet(sets.Enfeebling); if (gcdisplay.GetCycle('NukeSet') == 'Macc') then gFunc.EquipSet(sets.Macc); end elseif (spell.Skill == 'Dark Magic') then gFunc.EquipSet(sets.Macc); if (string.contains(spell.Name, 'Aspir') or string.contains(spell.Name, 'Drain')) then gFunc.EquipSet(sets.Drain); end elseif (spell.Skill == 'Geomancy') then gFunc.EquipSet(sets.Geomancy); if (string.contains(spell.Name, 'Indi')) then gFunc.EquipSet(sets.Indi); end end end profile.HandlePreshot = function() gFunc.EquipSet(sets.Preshot); end profile.HandleMidshot = function() gFunc.EquipSet(sets.Midshot); end profile.HandleWeaponskill = function() local canWS = gcinclude.CheckWsBailout(); if (canWS == false) then gFunc.CancelAction() return; else local ws = gData.GetAction(); gFunc.EquipSet(sets.Ws_Default) if (gcdisplay.GetCycle('MeleeSet') ~= 'Default') then gFunc.EquipSet('Ws_' .. gcdisplay.GetCycle('MeleeSet')) end if string.match(ws.Name, 'Aeolian Edge') then gFunc.EquipSet(sets.Aedge_Default) if (gcdisplay.GetCycle('MeleeSet') ~= 'Default') then gFunc.EquipSet('Aedge_' .. gcdisplay.GetCycle('MeleeSet')); end end end end return profile;
object_intangible_vehicle_light_bending_barc = object_intangible_vehicle_shared_light_bending_barc:new { } ObjectTemplates:addTemplate(object_intangible_vehicle_light_bending_barc, "object/intangible/vehicle/light_bending_barc.iff")
local skynet = require "skynet" local sharedata = require "skynet.sharedata" local log = require "skynet.log" local mysql = require "skynet.db.mysql" local utils = require "utils" local crypt = require "skynet.crypt" local mysql_list = {} local MYSQL_INDEX = 1 local command = {} local function do_query(sql) if MYSQL_INDEX > #mysql_list or MYSQL_INDEX <= 0 then log.error("!!!INDEX OUT OF SIDE!!!") end local db = mysql_list[MYSQL_INDEX] local ret = db:query(sql) or {} if ret.badresult then log.errorf("SQL HAS ERROR: SQL IS FLOW:\n\n%s\n\n MESSAGE IS FLOW\n\n%s\n\n",sql,ret.err) end return ret end --------------------------- --将table转化成插入sql语句 --------------------------- local function convertInsertSql(tb_name,data,quote) local query = string.format("insert into `%s` ",tb_name) local fileds = {} local values = {} local updates = {} for field,value in pairs(data) do if type(field) ~= "string" then return "filed must be string" end table.insert(fileds,field) local temp_value = value if type(value) == 'string' then if value ~= "now()" and value ~= "NOW()" then if quote then temp_value = mysql.quote_sql_str(temp_value) else temp_value = string.format("'%s'",temp_value) end end elseif type(value) == "boolean" then temp_value = temp_value and 1 or 0 end table.insert(updates,string.format("`%s`=VALUES(`%s`)",field,field)) table.insert(values,temp_value) end local query = query .."("..table.concat(fileds,",")..") values("..table.concat(values,",")..") ON DUPLICATE KEY UPDATE "..table.concat(updates,",")..";" return query end function command:updateIndex() MYSQL_INDEX = MYSQL_INDEX + 1 if MYSQL_INDEX > #mysql_list then MYSQL_INDEX = 1 end end function command:init() local function on_connect(db) db:query("set charset utf8"); end local mysql_conf = sharedata.query("mysql_conf") local host,port,database = mysql_conf.host,mysql_conf.port,mysql_conf.database assert(host,"host is nil") assert(port,"port is nil") assert(database,"database is nil") for i=1,10 do local db = mysql.connect({ host=host, port=port, user="root", max_packet_size = 1024 * 1024, database = database, on_connect = on_connect }) table.insert(mysql_list,db) end end function command:insertTable(tb_name,data,is_quote) local sql = convertInsertSql(tb_name,data,is_quote) return do_query(sql) end function command:selectTable(tb_name,...) end function command:selectTableAll(tb_name,filter) local sql if filter then sql = 'select * from '..tb_name..' where '..filter..';' else sql = 'select * from '..tb_name..';' end return do_query(sql) end local function convert(k) return (string.gsub(k, ".", function (c) return string.format("%02x", string.byte(c)) end)) end function command:checkLoginToken(user_id,token) local sql = string.format("select (time) from login where `user_id` = %d order by time desc limit 1;",user_id) local data = do_query(sql) local info = data[1] if info then local origin_token = convert(crypt.hmac_sha1("FHQYDIDXIL1ZQL",user_id .. info.time)) if origin_token == token then return true end end return false end function command:checkIsInGame(user_id) -- 因为删除房间是每个小时删除一次,所以这里应该 排除那些待删除的记录 local time = math.ceil(skynet.time()); local sql = string.format("select * from room_list where (expire_time > %d and player_list like '%%%d%%') and state <> 4",time,user_id) local data = do_query(sql) return data[1] end --查询所有没有被销毁的房间 function command:selectRoomListByServerId(server_id) local now = math.floor(tonumber(skynet.time())) local sql = string.format("select * from room_list where server_id = %d and expire_time > %d",server_id,now) return do_query(sql) end -- 查询指定服务器上的销毁超过12个小时的房间并删除(这就意味着 房间号必须通过mysql来生成) function command:distroyCord(server_id) local time = math.ceil(tonumber(skynet.time() - 12 * 60 * 60)) local sql = string.format("delete from room_list where server_id = %d and expire_time < %d",server_id,time) return do_query(sql) end function command:updateGoldNum(num,user_id) local sql = "update user_info set gold_num = gold_num + %d where user_id = '%s'" sql = string.format(sql,num,user_id) return do_query(sql) end -- 一次查找4个 如果4个都被用了 则继续筛选 --select round(rand()*(max-min)+min); 生成指定范围内的随机数 function command:getRandomRoomId() local sql = [[SELECT room_id FROM ( SELECT FLOOR(RAND() * 899999 + 100000) AS room_id UNION SELECT FLOOR(RAND() * 899999 + 100000) AS room_id UNION SELECT FLOOR(RAND() * 899999 + 100000) AS room_id UNION SELECT FLOOR(RAND() * 899999 + 100000) AS room_id ) AS temp WHERE `room_id` NOT IN (SELECT room_id FROM room_list) LIMIT 1]]; for i = 1,10 do local ret = do_query(sql) local info = ret[1] if info then return info.room_id end end end return command
--[[ Jet -> Boot Entry (Shared) by Tassilo (@TASSIA710) This is the boot entry for Jet. --]] AddCSLuaFile("jet/shared.lua") include("jet/shared.lua")
gemai.register_action("aurum_mobs:alert_herd", function(self) for _,object in ipairs(minetest.get_objects_inside_radius(self.entity.object:get_pos(), aurum.mobs.SEARCH_RADIUS)) do if object ~= self.entity.object and aurum.mobs.helper_same_herd(self, object) then local mob = aurum.mobs.get_mob(object) local target = aurum.mobs.helper_target_entity(self, self.data.params.target) if mob and (not target or not aurum.mobs.helper_same_herd(mob, target)) then mob:fire_event("herd_alerted", self.data.params) end end end end) minetest.register_on_punchplayer(function(player, puncher) local ref_table = aurum.get_blame(puncher) or b.ref_to_table(puncher) if ref_table then for _,object in ipairs(minetest.get_objects_inside_radius(player:get_pos(), aurum.mobs.SEARCH_RADIUS)) do local mob = aurum.mobs.get_mob(object) if mob and mob.data.herd == "player:" .. player:get_player_name() then mob:fire_event("herd_alerted", { other = ref_table, target = { type = "ref_table", ref_table = ref_table, }, }) end end end end)
---------------------------------------------------------- -- Load RayUI Environment ---------------------------------------------------------- RayUI:LoadEnv("Skins") local S = _Skins local function LoadSkin() local IconBackdrop = CreateFrame("Frame", nil, LossOfControlFrame) IconBackdrop:SetFrameLevel(1) IconBackdrop:CreateShadow("Background") IconBackdrop:SetAllPoints(LossOfControlFrame.Icon) LossOfControlFrame.Icon:SetTexCoord(.08, .92, .08, .92) hooksecurefunc("LossOfControlFrame_SetUpDisplay", function(self, ...) self.AbilityName:SetFont(R["media"].font, 20, "OUTLINE") self.TimeLeft.NumberText:SetFont(R["media"].font, 20, "OUTLINE") self.TimeLeft.SecondsText:SetFont(R["media"].font, 20, "OUTLINE") end) --Test --LossOfControlFrame_SetUpDisplay(LossOfControlFrame, true, 1, 408, "HeHe", select(3,GetSpellInfo(408)), time(), 6, 6, lockoutSchool, 1, 1) end S:AddCallback("LossControl", LoadSkin)
return "a"
local _servers = { {1, " 154.32.107.18", " 154.32.105.18", "Telstra Global - (GB)"}, {1, " 31.3.112.165", " ", "Escuelas De Estudios Superiores Esic Sacerdotes Del Corazon De Jesus Padres Reparadores - Majadahonda (ES)"}, {1, " 195.97.240.237", " ", "ONYX Onyx Group - Carluke (GB)"}, {1, " 212.19.96.2", " ", "Leonet4cloud srl - Empoli (IT)"}, {1, " 80.80.81.81", " 80.80.80.80", "Freedom Registry BV - (NL)"}, {1, " 212.91.32.6", " ", "RSAdvSys - (IT)"}, {1, " 84.8.2.11", " ", "alwaysON Limited - (GB)"}, {1, " 84.200.70.40", " ", "Accelerated IT Services & Consulting GmbH - (DE)"}, {1, " 89.150.195.195", " ", "Media Network i Halmstad AB - Holm (SE)"}, {1, "212.230.255.129", " 212.230.255.1", "Xtra Telecom S.A. - (ES)"}, {1, " 195.27.1.1", " ", "CW Vodafone Group PLC - (GB)"}, {1, " 193.178.35.130", " 193.15.1.54", "TELE2 - Simrishamn (SE)"}, {1, " 62.149.128.4", " 62.149.128.2", "Aruba S.p.A. - Arezzo (IT)"}, {1, " 94.126.23.10", " ", "METANET AG - (CH)"}, {1, " 92.43.224.1", " ", "OmniAccess S.L. - (ES)"}, {1, " 89.107.129.15", " ", "ASTELNET s.r.o. - (DE)"}, {1, " 62.91.19.67", " ", "Bisping & Bisping GmbH & Co KG - Happurg (DE)"}, {1, "193.111.200.191", " ", "Gradwell Communications Limited - (GB)"}, {1, " 78.7.251.131", " ", "BT Italia S.p.A. - (IT)"}, {1, " 46.16.216.25", " ", "Wireless Logic mdex GmbH - (DE)"}, {1, " 81.3.27.54", " ", "Hostway Deutschland GmbH - Hagenburg (DE)"}, {1, " 109.69.8.51", " ", "Fundacio Privada per a la Xarxa Lliure guifi.net - Amposta (ES)"}, {1, " 37.99.224.30", " ", "Irpinia Net-Com SRL - Montoro Inferiore (IT)"}, {1, " 81.27.162.100", " ", "R-KOM Telekommunikationsgesellschaft mbH & Co. KG - Regensburg (DE)"}, {1, " 217.18.206.22", " 217.18.206.12", "Evry Norge As - Oslo (NO)"}, {1, " 193.58.204.59", " ", "ML Consultancy - (NL)"}, {1, " 93.187.83.200", " 93.187.83.201", "Braathe Gruppen AS - Skien (NO)"}, {1, " 217.170.128.27", "217.170.133.134", "Nexthop AS - Oslo (NO)"}, {1, " 5.254.96.195", " ", "Voxility LLP - (GB)"}, {1, " 162.13.11.127", " ", "Rackspace Ltd. - Slough (GB)"}, {1, " 212.118.241.1", " 212.118.241.33", "InterNAP Network Services U.K. Limited - (GB)"}, {1, " 212.51.16.1", " ", "ADDIX Internet Services GmbH - Kiel (DE)"}, {1, " 82.96.65.2", " 82.96.64.2", "Probe Networks - (DE)"}, {1, " 81.17.66.13", " ", "South West Communications Group Ltd - Exeter (GB)"}, {1, " 212.94.32.32", " 212.94.34.34", "acdalis ag - Suhr (CH)"}, {1, " 185.30.211.154", " ", "Entreprise Decima Sarl - Thelus (FR)"}, {1, "178.210.102.225", "178.210.102.193", "MK Netzdienste GmbH & Co. KG - Toenisvorst (DE)"}, {1, " 212.28.34.65", " ", "Transkom GmbH - (DE)"}, {1, " 91.214.72.34", " ", "Positivo Srl - Salerno (IT)"}, {1, " 188.130.81.50", " ", "CTS Computers and Telecommunications Systems SAS - Fontenay-sous-Bois (FR)"}, } return _servers
local folderName = ... local math_max = _G.math.max local math_min = _G.math.min local math_floor = _G.math.floor local ButtonFrameTemplate_HidePortrait = _G.ButtonFrameTemplate_HidePortrait local function Round(num, numDecimalPlaces) local mult = 10^(numDecimalPlaces or 0) return math_floor(num * mult + 0.5) / mult end --------------------- -- Constants -------- --------------------- local PIXEL_FILE_PATH = "Interface/BUTTONS/WHITE8X8" local CONFIG_FRAME_WIDTH = 400 local CONFIG_FRAME_HEIGHT = 550 local GRAPH_WIDTH_MIN = 50 local GRAPH_WIDTH_MAX = 1000 local GRAPH_HEIGHT_MIN = 50 local GRAPH_HEIGHT_MAX = 600 local GRAPH_BAR_THICKNESS_MIN = 1 local GRAPH_BAR_THICKNESS_MAX = 10 local FRAMES_PER_GRAPH_BAR_MIN = 1 local FRAMES_PER_GRAPH_BAR_MAX = 30 local Y_AXIS_TOP_MIN = 1 local Y_AXIS_TOP_MAX = 300 local Y_AXIS_BOTTOM_MIN = 0 local Y_AXIS_BOTTOM_MAX = 299 local GRAPH_LINE_THICKNESS_MIN = 1 local GRAPH_LINE_THICKNESS_MAX = 10 local CONFIG_DEFAULTS = { graphAnchor = "CENTER", graphX = 0, graphY = 0, graphWidth = 300, graphHeight = 100, graphBarThickness = 1, framesPerGraphBar = 1, show = { max = true, avg = true, min = true, }, color = { max = {1.0, 1.0, 1.0}, avg = {0.8, 0.8, 0.8}, min = {0.6, 0.6, 0.6}, }, yAxisTop = 120, yAxisTopDynamic = false, yAxisBottom = 0, yAxisBottomDynamic = false, graphLineThickness = 1, } --------------------- -- Locals ----------- --------------------- -- Forward declaration. local UpdateGraphBarsColor local RefreshGraph local OneFrameMode -- The graph frame. local gf = nil local numberOfVisibleBars = 0 local numberOfCreatedBars = 0 -- To calculate the per bar values. local frameCounter = 0 local minFPS = 99999 local maxFPS = 0 local sumFPS = 0 local graphBars = { max = {}, avg = {}, min = {}, } local graphBarValues = { max = {}, avg = {}, min = {}, } local graphBarValuesFirstIndex = 0 local graphLines = {} local horizontalGridLines = {} local verticalGridLines = {} -- local function DrawFilledBox(f, bottomLeftX, bottomLeftY, topRightX, topRightY, r, g, b, a) -- local box = f:CreateTexture() -- box:SetTexture(PIXEL_FILE_PATH) -- box:SetColorTexture(r, g, b, a) -- box:SetPoint("BOTTOMLEFT", bottomLeftX, bottomLeftY) -- box:SetSize(topRightX-bottomLeftX, topRightY-bottomLeftY) -- end -- local function DrawEmptyBox(f, bottomLeftX, bottomLeftY, topRightX, topRightY, linewidth, r, g, b, a) -- -- LTTTTTTT -- -- L R -- -- L R -- -- L R -- -- BBBBBBBR -- -- Bottom line -- DrawFilledBox(f, bottomLeftX, bottomLeftY, bottomLeftX+topRightX-linewidth, bottomLeftY+linewidth, r, g, b, a) -- -- Top line -- DrawFilledBox(f, bottomLeftX+linewidth, topRightY-linewidth, bottomLeftX+topRightX, bottomLeftY+topRightY, r, g, b, a) -- -- Left line -- DrawFilledBox(f, bottomLeftX, bottomLeftY+linewidth, bottomLeftX+linewidth, bottomLeftY+topRightY, r, g, b, a) -- -- Right line -- DrawFilledBox(f, bottomLeftX+topRightX-linewidth, bottomLeftY, topRightX, bottomLeftY+topRightY-linewidth, r, g, b, a) -- end local function ColorPickerCallback(restore) local variableSuffix = ColorPickerFrame.variableSuffix local oldR, oldG, oldB, oldA = unpack(config.color[variableSuffix]) local newR, newG, newB, newA if restore then -- The user bailed, we extract the old color from the table created by ShowColorPicker. newR, newG, newB, newA = unpack(restore) else -- Something changed newA, newR, newG, newB = 1-OpacitySliderFrame:GetValue(), ColorPickerFrame:GetColorRGB() end if oldR ~= newR or oldG ~= newG or oldB ~= newB or oldA ~= newA then config.color[variableSuffix] = {newR, newG, newB, newA} UpdateGraphBarsColor(graphBars[variableSuffix], config.color[variableSuffix]) _G["fpsGraph_"..variableSuffix.."ColorButton"].foreground:SetColorTexture(newR, newG, newB, 1) end end -- https://wow.gamepedia.com/Using_the_ColorPickerFrame function ShowColorPicker(variableSuffix) ColorPickerFrame.variableSuffix = variableSuffix local color = config.color[variableSuffix] local r, g, b, a = unpack(color) if a ~= nil then ColorPickerFrame.hasOpacity = true ColorPickerFrame.opacity = 1 - a else ColorPickerFrame.hasOpacity = false end ColorPickerFrame.previousValues = color ColorPickerFrame.func = ColorPickerCallback ColorPickerFrame.opacityFunc = ColorPickerCallback ColorPickerFrame.cancelFunc = ColorPickerCallback ColorPickerFrame:SetColorRGB(r,g,b) -- Need to run the OnShow handler. ColorPickerFrame:Hide() ColorPickerFrame:Show() end local function DrawLine(f, startRelativeAnchor, startOffsetX, startOffsetY, endRelativeAnchor, endOffsetX, endOffsetY, thickness, r, g, b, a) local line = f:CreateLine() line:SetThickness(thickness) line:SetColorTexture(r, g, b, a) line:SetStartPoint(startRelativeAnchor, f, startOffsetX, startOffsetY) line:SetEndPoint(endRelativeAnchor, f, endOffsetX, endOffsetY) end local function SetFrameBorder(f, thickness, r, g, b, a) -- Bottom line. DrawLine(f, "BOTTOMLEFT", 0, 0, "BOTTOMRIGHT", 0, 0, thickness, r, g, b, a) -- Top line. DrawLine(f, "TOPLEFT", 0, 0, "TOPRIGHT", 0, 0, thickness, r, g, b, a) -- Left line. DrawLine(f, "BOTTOMLEFT", 0, 0, "TOPLEFT", 0, 0, thickness, r, g, b, a) -- Right line. DrawLine(f, "BOTTOMRIGHT", 0, 0, "TOPRIGHT", 0, 0, thickness, r, g, b, a) end local function DrawGraphBars(graphBars, graphBarValues) for i in pairs(graphBars) do if i > numberOfVisibleBars then break end local barTopY = graphBarValues[(graphBarValuesFirstIndex - i + 1) % numberOfVisibleBars] if barTopY then local smoothProgress = frameCounter / config.framesPerGraphBar local barStartX local barEndX if i == 1 then barStartX = 0 barEndX = config.graphBarThickness * smoothProgress else barStartX = config.graphBarThickness * (smoothProgress + i - 2) barEndX = math_min(barStartX + config.graphBarThickness, gf.grid:GetWidth()) end if barStartX > gf.grid:GetWidth() then graphBars[i]:Hide() else graphBars[i]:Show() -- Modify bar height according to yAxisBottom and yAxisTop. barTopY = math_max(barTopY - config.yAxisBottom, 0) barTopY = gf.grid:GetHeight() * math_min(barTopY / (config.yAxisTop - config.yAxisBottom), 1) graphBars[i]:SetPoint("BOTTOMRIGHT", gf.grid, "BOTTOMRIGHT", -barStartX, 0) graphBars[i]:SetPoint("TOPLEFT", gf.grid, "BOTTOMRIGHT", -barEndX, barTopY) end end end end local updateFrame = CreateFrame("Frame") updateFrame:SetScript("onUpdate", function(self, elapsed) -- Calculate the framerate between this and the last frame. local currentFramerate = 1/elapsed if config.framesPerGraphBar == 1 then -- Increase the index. graphBarValuesFirstIndex = (graphBarValuesFirstIndex + 1) % numberOfVisibleBars -- Fill in the most recent value. graphBarValues.avg[graphBarValuesFirstIndex] = currentFramerate else frameCounter = frameCounter + 1 if config.show.max then maxFPS = math_max(maxFPS, currentFramerate) end if config.show.avg then sumFPS = sumFPS + currentFramerate end if config.show.min then minFPS = math_min(minFPS, currentFramerate) end -- If one graph is complete, fill in the value. if frameCounter == config.framesPerGraphBar then -- Increase the index. graphBarValuesFirstIndex = (graphBarValuesFirstIndex + 1) % numberOfVisibleBars -- Fill in the current values and reset the counters. if config.show.max then graphBarValues.max[graphBarValuesFirstIndex] = maxFPS maxFPS = 0 end if config.show.avg then graphBarValues.avg[graphBarValuesFirstIndex] = sumFPS/frameCounter sumFPS = 0 end if config.show.min then graphBarValues.min[graphBarValuesFirstIndex] = minFPS minFPS = 99999 end frameCounter = 0 end end -- Draw the graph. if config.framesPerGraphBar == 1 then DrawGraphBars(graphBars.avg, graphBarValues.avg) else if config.show.max then DrawGraphBars(graphBars.max, graphBarValues.max) end if config.show.avg then DrawGraphBars(graphBars.avg, graphBarValues.avg) end if config.show.min then DrawGraphBars(graphBars.min, graphBarValues.min) end end end) local function InsertGraphBar(graphBars, drawLayerSubLevel) local newBar = gf.grid:CreateTexture() newBar:SetDrawLayer("ARTWORK", drawLayerSubLevel) newBar:SetTexture(PIXEL_FILE_PATH) tinsert(graphBars, newBar) end local function ShowGraphBars(graphBars, color, numberOfRequiredBars) for i, bar in pairs(graphBars) do if i <= numberOfRequiredBars then bar:ClearAllPoints() bar:Show() bar:SetColorTexture(unpack(color)) else bar:Hide() end end end -- Forward declaration above... UpdateGraphBarsColor = function(graphBars, color) for i, bar in pairs(graphBars) do bar:SetColorTexture(unpack(color)) end end local function HideGraph(graphBars, graphBarValues) for _, bar in pairs(graphBars) do bar:Hide() end for i in pairs(graphBarValues) do graphBarValues[i] = 0 end end local function UpdateLines() for k, v in pairs (graphLines) do v:SetThickness(config.graphLineThickness) end end -- Called when the graph size is changed. -- Forward declaration above... RefreshGraph = function() if config.framesPerGraphBar == 1 then OneFrameMode(true) HideGraph(graphBars.max, graphBarValues.max) HideGraph(graphBars.min, graphBarValues.min) else OneFrameMode(false) if not config.show.max then HideGraph(graphBars.max, graphBarValues.max) end if not config.show.avg then HideGraph(graphBars.avg, graphBarValues.avg) end if not config.show.min then HideGraph(graphBars.min, graphBarValues.min) end end UpdateLines() gf:SetWidth(config.graphWidth) gf:SetHeight(config.graphHeight) gf:ClearAllPoints() gf:SetPoint(config.graphAnchor, config.graphX, config.graphY) -- Determine how many bars we need. -- We need two more bars because the worst case is -- that the first bar is just started to be shifted in -- and the grid width is almost one bar width wider than the rounded number of bars. local numberOfRequiredBars = math_floor(gf.grid:GetWidth() / config.graphBarThickness) + 2 -- If necessary create all we need. if numberOfRequiredBars > numberOfCreatedBars then -- The easiest way to make sure that all graphs have the same amount -- of bars is to insert them all, regardless of whether they are -- needed or not... for i = numberOfCreatedBars+1, numberOfRequiredBars, 1 do InsertGraphBar(graphBars.max, -1) InsertGraphBar(graphBars.avg, 0) InsertGraphBar(graphBars.min, 1) end numberOfCreatedBars = numberOfRequiredBars end -- Make visible as many bars as we need and hide the others. if config.framesPerGraphBar == 1 then ShowGraphBars(graphBars.avg, config.color.avg, numberOfRequiredBars) else if config.show.max then ShowGraphBars(graphBars.max, config.color.max, numberOfRequiredBars) end if config.show.avg then ShowGraphBars(graphBars.avg, config.color.avg, numberOfRequiredBars) end if config.show.min then ShowGraphBars(graphBars.min, config.color.min, numberOfRequiredBars) end end numberOfVisibleBars = numberOfRequiredBars -- Reset the counters. frameCounter = 0 minFPS = 99999 maxFPS = 0 sumFPS = 0 end local function CreateGraph() if gf then return end gf = CreateFrame("Frame", "fpsGraph_graphFrame", UIParent) gf:SetFrameStrata("BACKGROUND") gf:SetMovable(true) gf:EnableMouse(true) gf:RegisterForDrag("LeftButton") gf:SetScript("OnDragStart", gf.StartMoving) gf:SetScript("OnDragStop", function(self) self:StopMovingOrSizing(self) config.graphAnchor, _, _, config.graphX, config.graphY = self:GetPoint(1) end) gf:SetClampedToScreen(true) gf:Show() gf.grid = CreateFrame("Frame", nil, gf) gf.grid:SetPoint("BOTTOMLEFT", 10, 10) gf.grid:SetPoint("TOPRIGHT", -50, -10) SetFrameBorder(gf.grid, 1, 1, 0, 0, 1) SetFrameBorder(gf, 1, 0, 0, 1, 1) RefreshGraph() end local function AddSlider(parentFrame, anchor, offsetX, offsetY, sliderTitle, variableName, minValue, maxValue, valueStep, valueChangedFunction) local slider = CreateFrame("Slider", "fpsGraph_"..variableName.."Slider", parentFrame, "OptionsSliderTemplate") slider:SetPoint(anchor, offsetX, offsetY) slider:SetWidth(CONFIG_FRAME_WIDTH - 85) slider:SetHeight(17) slider:SetMinMaxValues(minValue, maxValue) slider:SetValueStep(valueStep) slider:SetObeyStepOnDrag(true) slider:SetValue(config[variableName]) _G[slider:GetName() .. 'Low']:SetText(minValue) _G[slider:GetName() .. 'High']:SetText(maxValue) _G[slider:GetName() .. 'Text']:SetText(sliderTitle) slider.valueLabel = parentFrame:CreateFontString("fpsGraph_"..variableName.."SliderValueLabel", "HIGH") slider.valueLabel:SetFont("Fonts\\FRIZQT__.TTF", 11) slider.valueLabel:SetTextColor(1, 1, 1) slider.valueLabel:SetPoint("LEFT", slider, "RIGHT", 15, 0) slider.valueLabel:SetWidth(25) slider.valueLabel:SetJustifyH("CENTER") slider.valueLabel:SetText(config[variableName]) slider:SetScript("OnValueChanged", function(self, value) config[variableName] = value self.valueLabel:SetText(value) if valueChangedFunction then valueChangedFunction(self, value) end RefreshGraph() end ) end local function AddSeriesSelector(parentFrame, anchor, offsetX, offsetY, labelText, variableSuffix) local checkbox = CreateFrame("CheckButton", "fpsGraph_"..variableSuffix.."Checkbox", parentFrame, "UICheckButtonTemplate") checkbox:SetSize(22, 22) checkbox:SetPoint(anchor, offsetX, offsetY) if config.show[variableSuffix] == true then checkbox:SetChecked(true) else checkbox:SetChecked(false) end checkbox:SetScript("OnClick", function(self) if self:GetChecked() then config.show[variableSuffix] = true else config.show[variableSuffix] = false end RefreshGraph() end ) local label = parentFrame:CreateFontString("fpsGraph_"..variableSuffix.."SeriesSelector", "HIGH") label:SetPoint("LEFT", checkbox, "RIGHT", 10, 0) label:SetWidth(180) label:SetFont("Fonts\\FRIZQT__.TTF", 12) label:SetTextColor(1, 1, 1) label:SetJustifyH("LEFT") label:SetText(labelText) local colorButton = CreateFrame("Button", "fpsGraph_"..variableSuffix.."ColorButton", parentFrame) colorButton:SetSize(15, 15) colorButton:SetPoint("LEFT", label, "RIGHT", 10, 0) colorButton.background = colorButton:CreateTexture() colorButton.background:SetAllPoints() colorButton.background:SetDrawLayer("BACKGROUND", 0) colorButton.background:SetTexture(PIXEL_FILE_PATH) colorButton.background:SetColorTexture(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) local layer, subLevel = colorButton.background:GetDrawLayer() colorButton.foreground = colorButton:CreateTexture() colorButton.foreground:SetDrawLayer(layer, subLevel+1) colorButton.foreground:SetTexture(PIXEL_FILE_PATH) colorButton.foreground:SetColorTexture(unpack(config.color[variableSuffix])) colorButton.foreground:SetPoint("TOPLEFT", 1, -1) colorButton.foreground:SetPoint("BOTTOMRIGHT", -1, 1) colorButton:SetScript("OnEnter", function(self) self.background:SetColorTexture(NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b) end ) colorButton:SetScript("OnLeave", function(self) self.background:SetColorTexture(HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b) end ) colorButton:SetScript("OnClick", function() ShowColorPicker(variableSuffix) end ) end -- When only one frame per graph bar is selected, max, avg and min are all the same. -- So we only show avg. -- Forward declaration above... OneFrameMode = function(set) if set then _G["fpsGraph_maxCheckbox"]:SetChecked(false) _G["fpsGraph_avgCheckbox"]:SetChecked(true) _G["fpsGraph_minCheckbox"]:SetChecked(false) _G["fpsGraph_maxCheckbox"]:Disable() _G["fpsGraph_avgCheckbox"]:Disable() _G["fpsGraph_minCheckbox"]:Disable() else _G["fpsGraph_maxCheckbox"]:Enable() _G["fpsGraph_avgCheckbox"]:Enable() _G["fpsGraph_minCheckbox"]:Enable() _G["fpsGraph_maxCheckbox"]:SetChecked(config.show.max) _G["fpsGraph_avgCheckbox"]:SetChecked(config.show.avg) _G["fpsGraph_minCheckbox"]:SetChecked(config.show.min) end end local cf = nil local function DrawConfigFrame() if cf then return end cf = CreateFrame("Frame", "fpsGraph_configFrame", UIParent, "ButtonFrameTemplate") cf:SetPoint("TOPLEFT") ButtonFrameTemplate_HidePortrait(cf) -- SetPortraitToTexture(...) -- ButtonFrameTemplate_HideAttic(cf) -- ButtonFrameTemplate_HideButtonBar(cf) cf:SetFrameStrata("HIGH") cf:SetWidth(CONFIG_FRAME_WIDTH) cf:SetHeight(CONFIG_FRAME_HEIGHT) cf:SetMovable(true) cf:EnableMouse(true) cf:RegisterForDrag("LeftButton") cf:SetScript("OnDragStart", cf.StartMoving) cf:SetScript("OnDragStop", cf.StopMovingOrSizing) cf:SetClampedToScreen(true) _G[cf:GetName().."TitleText"]:SetText("Framerate Graph - Config") _G[cf:GetName().."TitleText"]:ClearAllPoints() _G[cf:GetName().."TitleText"]:SetPoint("TOPLEFT", 10, -6) AddSlider(cf.Inset, "TOPLEFT", 20, -20, "Graph width", "graphWidth", GRAPH_WIDTH_MIN, GRAPH_WIDTH_MAX, 1) AddSlider(cf.Inset, "TOPLEFT", 20, -60, "Graph height", "graphHeight", GRAPH_HEIGHT_MIN, GRAPH_HEIGHT_MAX, 1) AddSlider(cf.Inset, "TOPLEFT", 20, -100, "Graph bar thickness", "graphBarThickness", GRAPH_BAR_THICKNESS_MIN, GRAPH_BAR_THICKNESS_MAX, 1) AddSlider(cf.Inset, "TOPLEFT", 20, -140, "Frames per graph bar", "framesPerGraphBar", FRAMES_PER_GRAPH_BAR_MIN, FRAMES_PER_GRAPH_BAR_MAX, 1) AddSeriesSelector(cf.Inset, "TOPLEFT", 20, -180, "Maximum FPS per graph bar", "max") AddSeriesSelector(cf.Inset, "TOPLEFT", 20, -200, "Average FPS per graph bar", "avg") AddSeriesSelector(cf.Inset, "TOPLEFT", 20, -220, "Minimum FPS per graph bar", "min") AddSlider(cf.Inset, "TOPLEFT", 20, -280, "Y-axis top", "yAxisTop", Y_AXIS_TOP_MIN, Y_AXIS_TOP_MAX, 1, function(self, value) if value < config.yAxisBottom + 1 then _G["fpsGraph_yAxisBottomSlider"]:SetValue(value-1) end end ) AddSlider(cf.Inset, "TOPLEFT", 20, -320, "Y-axis bottom", "yAxisBottom", Y_AXIS_BOTTOM_MIN, Y_AXIS_BOTTOM_MAX, 1, function(self, value) if value > config.yAxisTop - 1 then _G["fpsGraph_yAxisTopSlider"]:SetValue(value+1) end end ) AddSlider(cf.Inset, "TOPLEFT", 20, -380, "Graph line thickness", "graphLineThickness", GRAPH_LINE_THICKNESS_MIN, GRAPH_LINE_THICKNESS_MAX, 1) -- tinsert(UISpecialFrames, "fpsGraph_configFrame") cf:Show() end local addonLoadedFrame = CreateFrame("Frame") addonLoadedFrame:RegisterEvent("ADDON_LOADED") addonLoadedFrame:SetScript("OnEvent", function(self, event, arg1, ...) if arg1 == folderName then if not config then config = CONFIG_DEFAULTS else -- Remove obsolete values from saved variables. for k in pairs (config) do if not CONFIG_DEFAULTS[k] then config[k] = nil end end -- Fill missing values. for k, v in pairs (CONFIG_DEFAULTS) do if not config[k] then config[k] = v end end end DrawConfigFrame() CreateGraph() end end) -- FPS (frames per second) -- FI (frame-to-frame interval) in msec (milliseconds) -- Texture:SetGradientAlpha(orientation, minR, minG, minB, minA, maxR, maxG, maxB, maxA)
local K, C, L, _ = select(2, ...):unpack() if C.Tooltip.Enable ~= true or C.Tooltip.ItemCount ~= true then return end local GetItemCount = GetItemCount local CreateFrame = CreateFrame -- Item count in tooltip(by Tukz) GameTooltip:HookScript("OnTooltipCleared", function(self) self.UIItemTooltip = nil end) GameTooltip:HookScript("OnTooltipSetItem", function(self) if UIItemTooltip and not self.UIItemTooltip and UIItemTooltip.count then local item, link = self:GetItem() local num = GetItemCount(link, true) local item_count = "" if UIItemTooltip.count and num > 1 then item_count = "|cffffffff"..L_TOOLTIP_ITEM_COUNT.." "..num end self:AddLine(item_count) self.UIItemTooltip = 1 end end) local f = CreateFrame("Frame") f:RegisterEvent("ADDON_LOADED") f:SetScript("OnEvent", function(_, _, name) if name ~= "KkthnxUI" then return end f:UnregisterEvent("ADDON_LOADED") f:SetScript("OnEvent", nil) UIItemTooltip = UIItemTooltip or {count = true} end)
function onPathAction() if getPokemonHealthPercent(1) ~= 100 then return talkToNpcOnCell(59,13) else return moveToNormalGround() end end function onBattleAction() run() end
fx_version 'bodacious' game 'gta5' description 'Fumigate Job by gonibix23' version '1.0.0' server_scripts { 'config.lua', 'server/main.lua' } client_scripts { 'config.lua', 'client/main.lua' }
object_tangible_item_beast_converted_lava_flea_decoration = object_tangible_item_beast_shared_converted_lava_flea_decoration:new { } ObjectTemplates:addTemplate(object_tangible_item_beast_converted_lava_flea_decoration, "object/tangible/item/beast/converted_lava_flea_decoration.iff")
local Name, Addon = ... function Addon.IsNPC(guid) return guid and guid:sub(1, 8) == "Creature" end function Addon.GetNPCId(guid) return tonumber(select(6, ("-"):split(guid)), 10) end function Addon.GetInstanceDungeonId(instance) if instance then for id,enemies in pairs(MDT.dungeonEnemies) do for _,enemy in pairs(enemies) do if enemy.instanceID == instance then return id end end end end end function Addon.GetCurrentDungeonId() return MDT:GetDB().currentDungeonIdx end function Addon.IsCurrentInstance() return Addon.currentDungeon == Addon.GetCurrentDungeonId() end function Addon.GetDungeonScale(dungeon) return MDT.scaleMultiplier[dungeon or Addon.GetCurrentDungeonId()] or 1 end function Addon.GetCurrentEnemies() return MDT.dungeonEnemies[Addon.GetCurrentDungeonId()] end function Addon.GetCurrentPulls() return MDT:GetCurrentPreset().value.pulls end function Addon.IteratePull(pull, fn, ...) local enemies = Addon.GetCurrentEnemies() if type(pull) == "number" then pull = Addon.GetCurrentPulls()[pull] end for enemyId,clones in pairs(pull) do local enemy = enemies[enemyId] if enemy then for _,cloneId in pairs(clones) do if MDT:IsCloneIncluded(enemyId, cloneId) then local a, b = fn(enemy.clones[cloneId], enemy, cloneId, enemyId, pull, ...) if a then return a, b end end end end end end function Addon.IteratePulls(fn, ...) for i,pull in ipairs(Addon.GetCurrentPulls()) do local a, b = Addon.IteratePull(pull, fn, i, ...) if a then return a, b end end end function Addon.GetPullRect(pull, level) local minX, minY, maxX, maxY Addon.IteratePull(pull, function (clone) local sub, x, y = clone.sublevel, clone.x, clone.y if sub == level then minX, minY = min(minX or x, x), min(minY or y, y) maxX, maxY = max(maxX or x, x), max(maxY or y, y) end end) return minX, minY, maxX, maxY end function Addon.ExtendRect(minX, minY, maxX, maxY, left, top, right, bottom) if minX and left then top = top or left right = right or left bottom = bottom or top return max(0, minX - left), min(0, minY - top), maxX + right, maxY + bottom end end function Addon.CombineRects(minX, minY, maxX, maxY, minX2, minY2, maxX2, maxY2) if minX and minX2 then local diffX, diffY = max(0, minX - minX2, maxX2 - maxX), max(0, minY - minY2, maxY2 - maxY) return Addon.ExtendRect(minX, minY, maxX, maxY, diffX, diffY) end end function Addon.GetBestSubLevel(pull) local currSub, minDiff = MDT:GetCurrentSubLevel() Addon.IteratePull(pull, function (clone) local diff = clone.sublevel - currSub if not minDiff or abs(diff) < abs(minDiff) or abs(diff) == abs(minDiff) and diff < minDiff then minDiff = diff end return minDiff == 0 end) return minDiff and currSub + minDiff end function Addon.GetLastSubLevel(pull) local sublevel Addon.IteratePull(pull, function (clone) sublevel = clone.sublevel or sublevel end) return sublevel end function Addon.FindWhere(tbl, key1, val1, key2, val2) for i,v in pairs(tbl) do if v[key1] == val1 and (not key2 or v[key2] == val2) then return v, i end end end Addon.Debug = function (...) if Addon.DEBUG then print(...) end end Addon.Echo = function (title, line, ...) print("|cff00bbbb[MDTGuide]|r " .. (title and title ..": " or "") .. (line or ""), ...) end Addon.Chat = function (msg) if IsInGroup() then SendChatMessage(msg, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or "PARTY") else Addon.Echo(nil, msg) end end
local function wct2txt(self, file_name_in, file_name_out) local content = io.load(file_name_in) if not content then message('文件无效:' .. file_name_in:string()) return end local index = 1 local max = #content local chunk = {} --文件版本 chunk.file_ver, index = ('l'):unpack(content, index) chunk.triggers = {} --自定义代码区的注释 chunk.comment, index = ('z'):unpack(content, index) --自定义代码区的文本 local trigger = {} table.insert(chunk.triggers, trigger) trigger.size, index = ('l'):unpack(content, index) if trigger.size ~= '0' then trigger.content, index = ('z'):unpack(content, index) end --触发器数量 chunk.trigger_count, index = ('l'):unpack(content, index) for i = 1, chunk.trigger_count do local trigger = {} table.insert(chunk.triggers, trigger) --文本长度 trigger.size, index = ('l'):unpack(content, index) --如果文本长度为0,无文本 if trigger.size == 0 then trigger.content = '' else trigger.content, index = ('z'):unpack(content, index) end end --转换文本 local lines = {} --文件版本 table.insert(lines, ('VERSION=%s'):format(chunk.file_ver)) table.insert(lines, ('########\r\n%s\r\n########'):format(chunk.comment)) --文本 for _, trigger in ipairs(chunk.triggers) do table.insert(lines, ('########\r\n%s\r\n########'):format(trigger.content)) end io.save(file_name_out, table.concat(lines, '\r\n'):convert_wts() .. '\r\n') end return wct2txt
-- See LICENSE for terms return { PlaceObj("ModItemOptionNumber", { "name", "LargeRocksCost", "DisplayName", T(302535920011435, "Cost of large rocks"), "DefaultValue", 10, "MinValue", 1, "MaxValue", 250, }), }
local mg = require "moongen" local memory = require "memory" local device = require "device" local stats = require "stats" local log = require "log" local ip4 = require "proto.ip4" local libmoon = require "libmoon" function configure(parser) -- do nothing, just check parse errors function convertMac_fake(str) mac = parseMacAddress(str, true) if not mac then parser:error("failed to parse MAC "..str) end return str end function convertTime(str) local pattern = "^(%d+)([mu]?s)$" local _, _, n, unit = string.find(str, pattern) if not (n and unit) then parser:error("failed to parse time '"..str.."', it should match '"..pattern.."' pattern") end return {n=tonumber(n), unit=unit} end parser:description("Generates TCP SYN flood from varying source IPs, supports both IPv4 and IPv6") parser:argument("dev", "Devices to transmit from."):args("*"):convert(tonumber) parser:option("-r --rate", "Transmit rate in Mbit/s."):default(10000):convert(tonumber) parser:option("-i --ip", "Source IP (IPv4 or IPv6)."):default("10.0.0.1") parser:option("-d --destination", "Destination IP (IPv4 or IPv6).") parser:option("-f --flows", "Number of different IPs to use."):default(100):convert(tonumber) parser:option("-s --synq", "Number of SYN queues."):default(0):convert(tonumber) parser:option("-x --synackq", "Number of SYN-ACK queues."):default(0):convert(tonumber) parser:option("-a --ackq", "Number of ACK queues."):default(0):convert(tonumber) parser:flag("-c", "Add RX counter.") parser:option("-m --ethDst", "Destination MAC, this option may be repeated."):count("*"):convert(convertMac_fake) parser:option("--ipg", "Inter-packet gap, time units (s, ms, us) must be specified."):convert(convertTime) end function master(args) if args.synq == 0 and args.ackq == 0 and args.synackq == 0 and not args.c then log:fatal("Use at least one queue") end local txQueues = args.synq + args.ackq + args.synackq local rxQueues = args.ackq + args.synackq if args.c then rxQueues = rxQueues + 1 end for i, dev in ipairs(args.dev) do if rxQueues == 0 then rxQueues = 1 end if txQueues == 0 then txQueues = 1 end local dev = device.config{port = dev, txQueues = txQueues, rxQueues = rxQueues, rssQueues = rxQueues} dev:wait() for i = 0, args.ackq-1 do local txQ = dev:getTxQueue(i) local rxQ = dev:getRxQueue(i) txQ:setRate(args.rate) mg.startTask("replySlave", false, txQ, rxQ) end for i = args.ackq, args.ackq+args.synackq-1 do local txQ = dev:getTxQueue(i) local rxQ = dev:getRxQueue(i) txQ:setRate(args.rate) mg.startTask("replySlave", true, txQ, rxQ) end for i = args.ackq+args.synackq, args.ackq+args.synackq+args.synq-1 do local txQ = dev:getTxQueue(i) txQ:setRate(args.rate) mg.startTask("synSlave", txQ, args.ip, args.flows, args.destination, args.ethDst, args.ipg) end if args.c then mg.startTask("rxCount", dev:getRxQueue(rxQueues-1)) end end mg.waitForTasks() end local zero16 = hton16(0) function replySlave(synack, txQ, rxQ) if synack then print("replySlave synack") else print("replySlave -") end local txBufs = memory.bufArray(128) local rxBufs = memory.bufArray(128) local txStats = stats:newDevTxCounter(txQ, "plain") local rxStats = stats:newDevRxCounter(rxQ, "plain") while mg.running() do local tx = 0 local rx = rxQ:recv(rxBufs) for i = 1, rx do local buf = rxBufs[i] -- alter buf local pkt = buf:getTcpPacket(ipv4) if pkt.ip4:getProtocol() == ip4.PROTO_TCP and pkt.tcp:getSyn() and (pkt.tcp:getAck() or synack) then -- print(string.format("RECV %d %d\n", rx, tx)) local seq = pkt.tcp:getSeqNumber() local ack = pkt.tcp:getAckNumber() if synack then pkt.tcp:setAck() pkt.tcp:setAckNumber(seq+1) pkt.tcp:setSeqNumber(ack) else pkt.tcp:unsetSyn() pkt.tcp:setAckNumber(seq+1) pkt.tcp:setSeqNumber(ack) end local tmp = pkt.ip4.src:get() pkt.ip4.src:set(pkt.ip4.dst:get()) pkt.ip4.dst:set(tmp) local tmp1 = pkt.eth.dst:get() pkt.eth.dst:set(pkt.eth.src:get()) pkt.eth.src:set(tmp1) local tmp2 = pkt.tcp:getDstPort() pkt.tcp:setDstPort(pkt.tcp:getSrcPort()) pkt.tcp:setSrcPort(tmp2) --pkt.ip4:setChecksum(0) pkt.ip4.cs = zero16 -- FIXME: setChecksum() is extremely slow tx = tx + 1 txBufs[tx] = buf end end if tx > 0 then txBufs:resize(tx) --offload checksums to NIC txBufs:offloadTcpChecksums(ipv4) txQ:send(txBufs) rxStats:update() txStats:update() end end rxStats:finalize() txStats:finalize() end function synSlave(queue, minA, numIPs, dest, ethDst_str, ipg) ethDst = {} for i,x in ipairs(ethDst_str) do ethDst[i] = parseMacAddress(x, true) end local ipgSleepFunc = function() end if ipg and ipg.n ~= 0 then if ipg.unit == "us" then ipgSleepFunc = function() libmoon.sleepMicrosIdle(ipg.n) end elseif ipg.unit == "ms" then ipgSleepFunc = function() libmoon.sleepMillisIdle(ipg.n) end elseif ipg.unit == "s" then ipgSleepFunc = function() libmoon.sleepMillisIdle(ipg.n * 1000) end end end --- parse and check ip addresses local minIP, ipv4 = parseIPAddress(minA) if minIP then log:info("Detected an %s address.", minIP and "IPv4" or "IPv6") else log:fatal("Invalid minIP: %s", minA) end -- min TCP packet size for IPv6 is 74 bytes (+ CRC) local packetLen = ipv4 and 60 or 74 local mem = memory.createMemPool(function(buf) buf:getTcpPacket(ipv4):fill{ ethSrc = queue, ethDst = "90:e2:ba:7d:85:6c", ip4Dst = dest, ip6Dst = dest, tcpSyn = 1, tcpSeqNumber = 1, tcpWindow = 10, pktLength = packetLen} -- FIXME: workaround if ethDst[1] then buf:getTcpPacket(ipv4).eth:setDst(ethDst[1]) end end) local updateEthDst = function(pkt) end if #ethDst > 1 then local idx = nil local dst updateEthDst = function(pkt) idx, dst = next(ethDst, idx) if not idx then idx = nil idx, dst = next(ethDst, idx) end pkt.eth:setDst(dst) end end local bufs = mem:bufArray(128) local counter = 0 local portCounter = 0 local c = 0 local txStats = stats:newDevTxCounter(queue, "plain") while mg.running() do -- fill packets and set their size bufs:alloc(packetLen) for i, buf in ipairs(bufs) do local pkt = buf:getTcpPacket(ipv4) pkt.tcp:setDstPort(80) pkt.ip4.src:set(minIP) updateEthDst(pkt) --increment IP if ipv4 then pkt.ip4.src:set(minIP) pkt.ip4.src:add(counter) else pkt.ip6.src:set(minIP) pkt.ip6.src:add(counter) end counter = incAndWrap(counter, numIPs) pkt.tcp:setSrcPort(1000+portCounter) portCounter = incAndWrap(portCounter, 100) -- dump first 3 packets if c < 3 then buf:dump() c = c + 1 end end --offload checksums to NIC bufs:offloadTcpChecksums(ipv4) queue:send(bufs) txStats:update() ipgSleepFunc() end txStats:finalize() end function rxCount(rxQ) print("rxCount") local rxCtr = stats:newDevRxCounter(rxQ) local rxBufs = memory.bufArray(128) while mg.running() do local rx = rxQ:recv(rxBufs) rxBufs:free(rx) rxCtr:update() end rxCtr:finalize() end defaults = {rx_queues = 0, tx_queues = 1} function task(taskNum, txInfo, rxInfo, args) local txQ = txInfo[1].queue synSlave(txQ, args.ip, args.flows, args.destination, args.ethDst, args.ipg) end
-- Controls transitions into every screen unless overridden by another 'ScreenName in' -- This just creates a black box that covers the screen and then fades it to invisible after 0.1 seconds return Def.Quad { InitCommand = function(self) self:xy(SCREEN_CENTER_X, SCREEN_CENTER_Y):zoomto(SCREEN_WIDTH, SCREEN_HEIGHT) end, OnCommand = function(self) self:diffuse(color("0,0,0,1")):sleep(0.1):linear(0.1):diffusealpha(0) end }
--[[ ExportScoreForIRC is something that AJ made for fun. It requires an understanding of how StepMania views your filesystem, as well as knowledge on how to make your IRC client play from a script file. Since this was made for a limited purpose, it assumes you play as a single player in non-course modes. It spits out a string like this: $PLAYERNUMBER last played: $SONG by $ARTIST ($SONGGROUP) [$MODE $DIFFICULTY] $PERCENT | $W1 / $W2 / $W3 / $W4 / $W5 / $MISS | Holds: ($HELD/DROPPED) Max Combo: $MAXCOMBO If there are two players, there will be a line for each player. Usage: 1. Place this file in Graphics/save_score.lua 1.5. Learn how to add an actor to the frame that a screen returns. 2. Add this line to whatever screen you want to write the current song: LoadActor(THEME:GetPathG("", "save_score.lua")), This is Version 0.3. The latest version can be found at http://kki.ajworld.net/misc/ExportScoreForIRC.lua Changelog: v0.3 * File writing code updated to StepMania 5 recent, should work in anything after beta 2? v0.2 * added song group v0.1 * initial "release" setting up IRC this is going to be different for each client. I only have mIRC on hand to test this with. [mIRC] Open the Scripts Editor, go to the Aliases tab and paste this on its own line: /smlastplayed /me $read("%APPDATA%\StepMania 5.0\Save\_freezone\LastPlayed.txt") $$1- where "%APPDATA%\StepMania 5.0\Save\_freezone\LastPlayed.txt" is the path to the LastPlayed.txt file. Please also edit local path below if changing the folder from "_freezone". SM5 note: Stepmania 5 stores user data in a special user folder, inside APPDATA on windows. See http://www.stepmania.com/wiki/ for paths on other systems. [General] Since StepMania/sm-ssc can only read and write files from within its ecosystem, it's important that you make the location of LastPlayed.txt as simple as possible (and not likely to get removed by the uninstaller when upgrading). --]] -- path is where the file lives relative to StepMania's root. local path = "Save/_freezone/LastPlayed.txt" local function player_last_played_stats(pn) local outStr = pn .. " last played: " local song = GAMESTATE:GetCurrentSong(); if song then -- attach song title/artist local mainTitle = song:GetDisplayFullTitle() local artist = song:GetDisplayArtist() outStr = outStr .. mainTitle .." by "..artist -- attach song group local songGroup = song:GetGroupName() outStr = outStr .. " ("..songGroup..")" -- attach stepstype and difficulty local steps = GAMESTATE:GetCurrentSteps(pn) if steps then local st = string.gsub(ToEnumShortString(steps:GetStepsType()),"_","-") local diff = ToEnumShortString(steps:GetDifficulty()) outStr = outStr .." [".. st .." ".. diff .."] " end; local sStats = STATSMAN:GetCurStageStats() local pStats = sStats:GetPlayerStageStats(pn) -- attach percent score local pScore = pStats:GetPercentDancePoints()*100 outStr = outStr ..string.format("%.02f%%",pScore) -- attach judge counts local w1 = pStats:GetTapNoteScores('TapNoteScore_W1') local w2 = pStats:GetTapNoteScores('TapNoteScore_W2') local w3 = pStats:GetTapNoteScores('TapNoteScore_W3') local w4 = pStats:GetTapNoteScores('TapNoteScore_W4') local w5 = pStats:GetTapNoteScores('TapNoteScore_W5') local miss = pStats:GetTapNoteScores('TapNoteScore_Miss') outStr = outStr .." | "..w1.." / "..w2.." / "..w3.." / "..w4.." / "..w5.." / "..miss -- attach OK/NG counts local held = pStats:GetHoldNoteScores('HoldNoteScore_Held') local dropped = pStats:GetHoldNoteScores('HoldNoteScore_LetGo') outStr = outStr .." / Holds: ("..held .." / ".. dropped ..")" -- attach max combo local maxCombo = pStats:MaxCombo(); local comboThreshold = THEME:GetMetric("Gameplay","MinScoreToContinueCombo") local gotFullCombo = pStats:FullComboOfScore(comboThreshold); local comboLabel = gotFullCombo and "Full" or "Max" outStr = outStr .." ".. comboLabel .." Combo: ".. maxCombo return outStr end end function write_last_played_stats() if GAMESTATE:IsCourseMode() then return end local str= "" for pn in ivalues(GAMESTATE:GetHumanPlayers()) do str= str .. player_last_played_stats(pn) end -- write string local file= RageFileUtil.CreateRageFile() if not file:Open(path, 2) then Warn("Could not open '" .. path .. "' to write current playing info.") else file:Write(str) file:Close() end file:destroy() end -- this code is in the public domain because I don't really care about -- copyrighting something like this.
local vector = require "vector" local platform = {} platform.position = vector( 300, 500 ) platform.speed = vector( 800, 0 ) platform.image = love.graphics.newImage( "img/800x600/platform.png" ) platform.small_tile_width = 75 platform.small_tile_height = 16 platform.small_tile_x_pos = 0 platform.small_tile_y_pos = 0 platform.norm_tile_width = 108 platform.norm_tile_height = 16 platform.norm_tile_x_pos = 0 platform.norm_tile_y_pos = 32 platform.large_tile_width = 141 platform.large_tile_height = 16 platform.large_tile_x_pos = 0 platform.large_tile_y_pos = 64 platform.glued_x_pos_shift = 192 platform.tileset_width = 333 platform.tileset_height = 80 platform.quad = love.graphics.newQuad( platform.norm_tile_x_pos, platform.norm_tile_y_pos, platform.norm_tile_width, platform.norm_tile_height, platform.tileset_width, platform.tileset_height ) platform.width = platform.norm_tile_width platform.height = platform.norm_tile_height platform.size = "norm" platform.glued = false function platform.update( dt ) platform.follow_mouse( dt ) end function platform.draw() love.graphics.draw( platform.image, platform.quad, platform.position.x, platform.position.y ) end function platform.follow_mouse( dt ) local x, y = love.mouse.getPosition() local left_wall_plus_half_platform = 34 + platform.width / 2 local right_wall_minus_half_platform = 576 - platform.width / 2 if ( x > left_wall_plus_half_platform and x < right_wall_minus_half_platform ) then platform.position.x = x - platform.width / 2 elseif x < left_wall_plus_half_platform then platform.position.x = left_wall_plus_half_platform - platform.width / 2 elseif x > right_wall_minus_half_platform then platform.position.x = right_wall_minus_half_platform - platform.width / 2 end end function platform.bounce_from_wall( shift_platform ) platform.position.x = platform.position.x + shift_platform.x end function platform.react_on_decrease_bonus() if platform.size == "norm" then platform.width = platform.small_tile_width platform.height = platform.small_tile_height platform.quad = love.graphics.newQuad( platform.small_tile_x_pos, platform.small_tile_y_pos, platform.small_tile_width, platform.small_tile_height, platform.tileset_width, platform.tileset_height ) platform.size = "small" elseif platform.size == "large" then platform.width = platform.norm_tile_width platform.height = platform.norm_tile_height platform.quad = love.graphics.newQuad( platform.norm_tile_x_pos, platform.norm_tile_y_pos, platform.norm_tile_width, platform.norm_tile_height, platform.tileset_width, platform.tileset_height ) platform.size = "norm" end end function platform.react_on_increase_bonus() if platform.size == "small" then platform.width = platform.norm_tile_width platform.height = platform.norm_tile_height platform.quad = love.graphics.newQuad( platform.norm_tile_x_pos, platform.norm_tile_y_pos, platform.norm_tile_width, platform.norm_tile_height, platform.tileset_width, platform.tileset_height ) platform.size = "norm" elseif platform.size == "norm" then platform.width = platform.large_tile_width platform.height = platform.large_tile_height platform.quad = love.graphics.newQuad( platform.large_tile_x_pos, platform.large_tile_y_pos, platform.large_tile_width, platform.large_tile_height, platform.tileset_width, platform.tileset_height ) platform.size = "large" end end function platform.reset_size_to_norm() platform.width = platform.norm_tile_width platform.height = platform.norm_tile_height platform.quad = love.graphics.newQuad( platform.norm_tile_x_pos, platform.norm_tile_y_pos, platform.norm_tile_width, platform.norm_tile_height, platform.tileset_width, platform.tileset_height ) platform.size = "norm" end function platform.react_on_glue_bonus() platform.glued = true if platform.size == "small" then platform.quad = love.graphics.newQuad( platform.small_tile_x_pos + platform.glued_x_pos_shift, platform.small_tile_y_pos, platform.small_tile_width, platform.small_tile_height, platform.tileset_width, platform.tileset_height ) elseif platform.size == "norm" then platform.quad = love.graphics.newQuad( platform.norm_tile_x_pos + platform.glued_x_pos_shift, platform.norm_tile_y_pos, platform.norm_tile_width, platform.norm_tile_height, platform.tileset_width, platform.tileset_height ) elseif platform.size == "large" then platform.quad = love.graphics.newQuad( platform.large_tile_x_pos + platform.glued_x_pos_shift, platform.large_tile_y_pos, platform.large_tile_width, platform.large_tile_height, platform.tileset_width, platform.tileset_height ) end end function platform.remove_glued_effect() if platform.glued then platform.glued = false if platform.size == "small" then platform.quad = love.graphics.newQuad( platform.small_tile_x_pos, platform.small_tile_y_pos, platform.small_tile_width, platform.small_tile_height, platform.tileset_width, platform.tileset_height ) elseif platform.size == "norm" then platform.quad = love.graphics.newQuad( platform.norm_tile_x_pos, platform.norm_tile_y_pos, platform.norm_tile_width, platform.norm_tile_height, platform.tileset_width, platform.tileset_height ) elseif platform.size == "large" then platform.quad = love.graphics.newQuad( platform.large_tile_x_pos, platform.large_tile_y_pos, platform.large_tile_width, platform.large_tile_height, platform.tileset_width, platform.tileset_height ) end end end function platform.remove_bonuses_effects() platform.remove_glued_effect() platform.reset_size_to_norm() end return platform
-------------------------------------------------------------------------------------------------------------------------- -- Decoder of GIF-files -------------------------------------------------------------------------------------------------------------------------- -- This module extracts images from GIF-files. -- Written in pure Lua. -- Compatible with Lua 5.1, 5.2, 5.3, LuaJIT. -- Version 1 (2017-05-15) -- require('gif')(filename) opens .gif-file for read-only and returns "GifObject" having the following functions: -- read_matrix(x, y, width, height) -- returns current image (one animated frame) as 2D-matrix of colors (as nested Lua tables) -- by default whole non-clipped picture is returned -- pixels are numbers: (-1) for transparent color, 0..0xFFFFFF for 0xRRGGBB color -- get_width_height() -- returns two integers (width and height are the properties of the whole file) -- get_file_parameters() -- returns table with the following fields (these are the properties of the whole file) -- comment -- text coment inside gif-file -- looped -- boolean -- number_of_images -- == 1 for non-animated gifs, > 1 for animated gifs -- get_image_parameters() -- returns table with fields image_no and delay_in_ms (these are properties of the current animation frame) -- next_image(looping_mode) -- switches to next frame, returns false if failed to switch -- looping_mode = 'never' (default) - never wrap from the last frame to the first -- 'always' - always wrap from the last frame to the first -- 'play' - depends on whether or not .gif-file is marked as looped gif -- close() -------------------------------------------------------------------------------------------------------------------------- local unpack, floor = table.unpack or unpack, math.floor local is_windows = (os.getenv'oS' or ""):match'^Windows' -------------------------------------------------------------------------------------------------------------------------- local function open_file_buffer(filename) -- open file for read-only, returns InputBufferObject local input_buffer_object = {} local intel_byte_order = true local file = assert(io.open(filename, is_windows and 'rb' or 'r')) local file_size = assert(file:seek'end') assert(file:seek'set') input_buffer_object.file_size = file_size local user_offset = 0 function input_buffer_object.jump(offset) user_offset = offset return input_buffer_object end function input_buffer_object.skip(delta_offset) user_offset = user_offset + delta_offset return input_buffer_object end function input_buffer_object.get_offset() return user_offset end local file_blocks = {} -- [block_index] = {index=block_index, data=string, more_fresh=obj_ptr, more_old=obj_ptr} local cached_blocks = 0 -- number if block indices in use in the array file_blocks local chain_terminator = {} chain_terminator.more_fresh = chain_terminator chain_terminator.more_old = chain_terminator local function remove_from_chain(object_to_remove) local more_fresh_object = object_to_remove.more_fresh local more_old_object = object_to_remove.more_old more_old_object.more_fresh = more_fresh_object more_fresh_object.more_old = more_old_object end local function insert_into_chain(object_to_insert) local old_freshest_object = chain_terminator.more_old object_to_insert.more_fresh = chain_terminator object_to_insert.more_old = old_freshest_object old_freshest_object.more_fresh = object_to_insert chain_terminator.more_old = object_to_insert end local function get_file_block(block_index) -- blocks are aligned to 32K boundary, indexed from 0 local object = file_blocks[block_index] if not object then if cached_blocks < 3 then cached_blocks = cached_blocks + 1 else local object_to_remove = chain_terminator.more_fresh remove_from_chain(object_to_remove) file_blocks[object_to_remove.index] = nil end local block_offset = block_index * 32*1024 local block_length = math.min(32*1024, file_size - block_offset) assert(file:seek('set', block_offset)) local content = file:read(block_length) assert(#content == block_length) object = {index = block_index, data = content} insert_into_chain(object) file_blocks[block_index] = object elseif object.more_fresh ~= chain_terminator then remove_from_chain(object) insert_into_chain(object) end return object.data end function input_buffer_object.close() file_blocks = nil chain_terminator = nil file:close() end function input_buffer_object.read_string(length) assert(length >= 0, 'negative string length') assert(user_offset >= 0 and user_offset + length <= file_size, 'attempt to read beyond the file boundary') local str, arr = '' while length > 0 do local offset_inside_block = user_offset % (32*1024) local part_size = math.min(32*1024 - offset_inside_block, length) local part = get_file_block(floor(user_offset / (32*1024))):sub(1 + offset_inside_block, part_size + offset_inside_block) user_offset = user_offset + part_size length = length - part_size if arr then table.insert(arr, part) elseif str ~= '' then str = str..part elseif length > 32*1024 then arr = {part} else str = part end end return arr and table.concat(arr) or str end function input_buffer_object.read_byte() return input_buffer_object.read_bytes(1) end function input_buffer_object.read_word() return input_buffer_object.read_words(1) end function input_buffer_object.read_bytes(quantity) return input_buffer_object.read_string(quantity):byte(1, -1) end function input_buffer_object.read_words(quantity) return unpack(input_buffer_object.read_array_of_words(quantity)) end local function read_array_of_numbers_of_k_bytes_each(elems_in_array, k) if k == 1 and elems_in_array <= 100 then return {input_buffer_object.read_string(elems_in_array):byte(1, -1)} else local array_of_numbers = {} local max_numbers_in_string = floor(100 / k) for number_index = 1, elems_in_array, max_numbers_in_string do local numbers_in_this_part = math.min(elems_in_array - number_index + 1, max_numbers_in_string) local part = input_buffer_object.read_string(numbers_in_this_part * k) if k == 1 then for delta_index = 1, numbers_in_this_part do array_of_numbers[number_index + delta_index - 1] = part:byte(delta_index) end else for delta_index = 0, numbers_in_this_part - 1 do local number = 0 for byte_index = 1, k do local pos = delta_index * k + (intel_byte_order and k + 1 - byte_index or byte_index) number = number * 256 + part:byte(pos) end array_of_numbers[number_index + delta_index] = number end end end return array_of_numbers end end function input_buffer_object.read_array_of_words(elems_in_array) return read_array_of_numbers_of_k_bytes_each(elems_in_array, 2) end return input_buffer_object end -------------------------------------------------------------------------------------------------------------------------- local function open_gif(filename) -- open picture for read-only, returns InputGifObject local gif = {} local input = open_file_buffer(filename) assert(({GIF87a=0,GIF89a=0})[input.read_string(6)], 'wrong file format') local gif_width, gif_height = input.read_words(2) assert(gif_width ~= 0 and gif_height ~= 0, 'wrong file format') function gif.get_width_height() return gif_width, gif_height end local global_flags = input.read_byte() input.skip(2) local global_palette -- 0-based global palette array (or nil) if global_flags >= 0x80 then global_palette = {} for color_index = 0, 2^(global_flags % 8 + 1) - 1 do local R, G, B = input.read_bytes(3) global_palette[color_index] = R * 2^16 + G * 2^8 + B end end local first_frame_offset = input.get_offset() local file_parameters -- initially nil, filled after finishing first pass local fp_comment, fp_looped_animation -- for storing parameters before first pass completed local fp_number_of_frames = 0 local fp_last_processed_offset = 0 local function fp_first_pass() if not file_parameters then local current_offset = input.get_offset() if current_offset > fp_last_processed_offset then fp_last_processed_offset = current_offset return true end end end local function skip_to_end_of_block() repeat local size = input.read_byte() input.skip(size) until size == 0 end local function skip_2C() input.skip(8) local local_flags = input.read_byte() if local_flags >= 0x80 then input.skip(3 * 2^(local_flags % 8 + 1)) end input.skip(1) skip_to_end_of_block() end local function process_blocks(callback_2C, callback_21_F9) -- processing blocks of GIF-file local exit_reason repeat local starter = input.read_byte() if starter == 0x3B then -- EOF marker if fp_first_pass() then file_parameters = {comment = fp_comment, looped = fp_looped_animation, number_of_images = fp_number_of_frames} end exit_reason = 'EOF' elseif starter == 0x2C then -- image marker if fp_first_pass() then fp_number_of_frames = fp_number_of_frames + 1 end exit_reason = (callback_2C or skip_2C)() elseif starter == 0x21 then local fn_no = input.read_byte() if fn_no == 0xF9 then (callback_21_F9 or skip_to_end_of_block)() elseif fn_no == 0xFE and not fp_comment then fp_comment = {} repeat local size = input.read_byte() table.insert(fp_comment, input.read_string(size)) until size == 0 fp_comment = table.concat(fp_comment) elseif fn_no == 0xFF and input.read_string(input.read_byte()) == 'NETSCAPE2.0' then fp_looped_animation = true skip_to_end_of_block() else skip_to_end_of_block() end else error'wrong file format' end until exit_reason return exit_reason end function gif.get_file_parameters() if not file_parameters then local saved_offset = input.get_offset() process_blocks() input.jump(saved_offset) end return file_parameters end local loaded_frame_no = 0 --\ frame parameters (frame_no = 1, 2, 3,...) local loaded_frame_delay --/ local loaded_frame_action_on_background local loaded_frame_transparent_color_index local loaded_frame_matrix -- picture of the frame \ may be two pointers to the same matrix local background_matrix_after_loaded_frame -- background for next picture / local background_rectangle_to_erase -- nil or {left, top, width, height} function gif.read_matrix(x, y, width, height) -- by default whole picture rectangle x, y = x or 0, y or 0 width, height = width or gif_width - x, height or gif_height - y assert(x >= 0 and y >= 0 and width >= 1 and height >= 1 and x + width <= gif_width and y + height <= gif_height, 'attempt to read pixels out of the picture boundary') local matrix = {} for row_no = 1, height do matrix[row_no] = {unpack(loaded_frame_matrix[row_no + y], x + 1, x + width)} end return matrix end function gif.close() loaded_frame_matrix = nil background_matrix_after_loaded_frame = nil input.close() end function gif.get_image_parameters() return {image_no = loaded_frame_no, delay_in_ms = loaded_frame_delay} end local function callback_2C() if background_rectangle_to_erase then local left, top, width, height = unpack(background_rectangle_to_erase) background_rectangle_to_erase = nil for row = top + 1, top + height do local line = background_matrix_after_loaded_frame[row] for col = left + 1, left + width do line[col] = -1 end end end loaded_frame_action_on_background = loaded_frame_action_on_background or 'combine' local left, top, width, height = input.read_words(4) assert(width ~= 0 and height ~= 0 and left + width <= gif_width and top + height <= gif_height, 'wrong file format') local local_flags = input.read_byte() local interlaced = local_flags % 0x80 >= 0x40 local palette = global_palette -- 0-based palette array if local_flags >= 0x80 then palette = {} for color_index = 0, 2^(local_flags % 8 + 1) - 1 do local R, G, B = input.read_bytes(3) palette[color_index] = R * 2^16 + G * 2^8 + B end end assert(palette, 'wrong file format') local bits_in_color = input.read_byte() -- number of colors in LZW voc local bytes_in_current_part_of_stream = 0 local function read_byte_from_stream() -- returns next byte or false if bytes_in_current_part_of_stream > 0 then bytes_in_current_part_of_stream = bytes_in_current_part_of_stream - 1 return input.read_byte() else bytes_in_current_part_of_stream = input.read_byte() - 1 return bytes_in_current_part_of_stream >= 0 and input.read_byte() end end local CLEAR_VOC = 2^bits_in_color local END_OF_STREAM = CLEAR_VOC + 1 local LZW_voc -- [code] = {prefix_code, color_index} local bits_in_code = bits_in_color + 1 local next_power_of_two = 2^bits_in_code local first_undefined_code, need_completion local stream_bit_buffer = 0 local bits_in_buffer = 0 local function read_code_from_stream() while bits_in_buffer < bits_in_code do stream_bit_buffer = stream_bit_buffer + assert(read_byte_from_stream(), 'wrong file format') * 2^bits_in_buffer bits_in_buffer = bits_in_buffer + 8 end local code = stream_bit_buffer % next_power_of_two stream_bit_buffer = (stream_bit_buffer - code) / next_power_of_two bits_in_buffer = bits_in_buffer - bits_in_code return code end assert(read_code_from_stream() == CLEAR_VOC, 'wrong file format') local function clear_LZW_voc() LZW_voc = {} bits_in_code = bits_in_color + 1 next_power_of_two = 2^bits_in_code first_undefined_code = CLEAR_VOC + 2 need_completion = nil end clear_LZW_voc() -- Copy matrix background_matrix_after_loaded_frame to loaded_frame_matrix if loaded_frame_action_on_background == 'combine' or loaded_frame_action_on_background == 'erase' then loaded_frame_matrix = background_matrix_after_loaded_frame else -- 'undo' loaded_frame_matrix = {} for row = 1, gif_height do loaded_frame_matrix[row] = {unpack(background_matrix_after_loaded_frame[row])} end end -- Decode and apply image delta (window: left, top, width, height) on the matrix loaded_frame_matrix local pixels_remained = width * height local x_inside_window, y_inside_window -- coordinates inside window local function pixel_from_stream(color_index) pixels_remained = pixels_remained - 1 assert(pixels_remained >= 0, 'wrong file format') if x_inside_window then x_inside_window = x_inside_window + 1 if x_inside_window == width then x_inside_window = 0 if interlaced then repeat if y_inside_window % 8 == 0 then y_inside_window = y_inside_window < height and y_inside_window + 8 or 4 elseif y_inside_window % 4 == 0 then y_inside_window = y_inside_window < height and y_inside_window + 8 or 2 elseif y_inside_window % 2 == 0 then y_inside_window = y_inside_window < height and y_inside_window + 4 or 1 else y_inside_window = y_inside_window + 2 end until y_inside_window < height else y_inside_window = y_inside_window + 1 end end else x_inside_window, y_inside_window = 0, 0 end if color_index ~= loaded_frame_transparent_color_index then loaded_frame_matrix[top + y_inside_window + 1][left + x_inside_window + 1] = assert(palette[color_index], 'wrong file format') end end repeat -- LZW_voc: [code] = {prefix_code, color_index} -- all the codes (CLEAR_VOC+2)...(first_undefined_code-2) are defined completely -- the code (first_undefined_code-1) has defined only its first component local code = read_code_from_stream() if code == CLEAR_VOC then clear_LZW_voc() elseif code ~= END_OF_STREAM then assert(code < first_undefined_code, 'wrong file format') local stack_of_pixels = {} local pos = 1 local first_pixel = code while first_pixel >= CLEAR_VOC do first_pixel, stack_of_pixels[pos] = unpack(LZW_voc[first_pixel]) pos = pos + 1 end stack_of_pixels[pos] = first_pixel if need_completion then need_completion = nil LZW_voc[first_undefined_code - 1][2] = first_pixel if code == first_undefined_code - 1 then stack_of_pixels[1] = first_pixel end end -- send pixels for phrase "code" to result matrix for pos = pos, 1, -1 do pixel_from_stream(stack_of_pixels[pos]) end if first_undefined_code < 0x1000 then -- create new code LZW_voc[first_undefined_code] = {code} need_completion = true if first_undefined_code == next_power_of_two then bits_in_code = bits_in_code + 1 next_power_of_two = 2^bits_in_code end first_undefined_code = first_undefined_code + 1 end end until code == END_OF_STREAM assert(pixels_remained == 0 and stream_bit_buffer == 0, 'wrong file format') local extra_byte = read_byte_from_stream() assert(not extra_byte or extra_byte == 0 and not read_byte_from_stream(), 'wrong file format') -- Modify the matrix background_matrix_after_loaded_frame if loaded_frame_action_on_background == 'combine' then background_matrix_after_loaded_frame = loaded_frame_matrix elseif loaded_frame_action_on_background == 'erase' then background_matrix_after_loaded_frame = loaded_frame_matrix background_rectangle_to_erase = {left, top, width, height} end loaded_frame_no = loaded_frame_no + 1 return 'OK' end local function callback_21_F9() local len, flags = input.read_bytes(2) local delay = input.read_word() local transparent, terminator = input.read_bytes(2) assert(len == 4 and terminator == 0, 'wrong file format') loaded_frame_delay = delay * 10 if flags % 2 == 1 then loaded_frame_transparent_color_index = transparent end local method = floor(flags / 4) % 8 if method == 2 then loaded_frame_action_on_background = 'erase' elseif method == 3 then loaded_frame_action_on_background = 'undo' end end local function load_next_frame() -- returns true if next frame was loaded (of false if there is no next frame) if loaded_frame_no == 0 then background_matrix_after_loaded_frame = {} for y = 1, gif_height do background_matrix_after_loaded_frame[y] = {} end background_rectangle_to_erase = {0, 0, gif_width, gif_height} input.jump(first_frame_offset) end loaded_frame_delay = nil loaded_frame_action_on_background = nil loaded_frame_transparent_color_index = nil return process_blocks(callback_2C, callback_21_F9) ~= 'EOF' end assert(load_next_frame(), 'wrong file format') local looping_modes = {never=0, always=1, play=2} function gif.next_image(looping_mode) -- switches to next image, returns true/false, false means failed to switch -- looping_mode = 'never'/'always'/'play' local looping_mode_no = looping_modes[looping_mode or 'never'] assert(looping_mode_no, 'wrong looping mode') if load_next_frame() then return true else if ({0, fp_looped_animation})[looping_mode_no] then -- looping now loaded_frame_no = 0 return load_next_frame() else return false end end end return gif end -------------------------------------------------------------------------------------------------------------------------- return open_gif
require "/scripts/util.lua" require "/scripts/vec2.lua" require "/scripts/versioningutils.lua" require "/items/buildscripts/abilities.lua" function build(directory, config, parameters, level, seed) local configParameter = function(keyName, defaultValue) if parameters[keyName] ~= nil then return parameters[keyName] elseif config[keyName] ~= nil then return config[keyName] else return defaultValue end end if level and not configParameter("fixedLevel", true) then parameters.level = level end setupAbility(config, parameters, "primary") setupAbility(config, parameters, "alt") -- elemental type and config (for alt ability) local elementalType = configParameter("elementalType", "physical") replacePatternInData(config, nil, "<elementalType>", elementalType) if config.altAbility and config.altAbility.elementalConfig then util.mergeTable(config.altAbility, config.altAbility.elementalConfig[elementalType]) end -- calculate damage level multiplier config.damageLevelMultiplier = root.evalFunction("weaponDamageLevelMultiplier", configParameter("level", 1)) -- palette swaps config.paletteSwaps = "" if config.palette then local palette = root.assetJson(util.absolutePath(directory, config.palette)) local selectedSwaps = palette.swaps[configParameter("colorIndex", 1)] for k, v in pairs(selectedSwaps) do config.paletteSwaps = string.format("%s?replace=%s=%s", config.paletteSwaps, k, v) end end if type(config.inventoryIcon) == "string" then config.inventoryIcon = config.inventoryIcon .. config.paletteSwaps else for i, drawable in ipairs(config.inventoryIcon) do if drawable.image then drawable.image = drawable.image .. config.paletteSwaps end end end -- gun offsets if config.baseOffset then construct(config, "animationCustom", "animatedParts", "parts", "middle", "properties") config.animationCustom.animatedParts.parts.middle.properties.offset = config.baseOffset if config.muzzleOffset then config.muzzleOffset = vec2.add(config.muzzleOffset, config.baseOffset) end end -- populate tooltip fields if config.tooltipKind ~= "base" then config.tooltipFields = {} config.tooltipFields.levelLabel = util.round(configParameter("level", 1), 1) config.tooltipFields.dpsLabel = util.round((config.primaryAbility.baseDps or 0) * config.damageLevelMultiplier, 1) config.tooltipFields.speedLabel = util.round(1 / (config.primaryAbility.fireTime or 1.0), 1) config.tooltipFields.damagePerShotLabel = util.round((config.primaryAbility.baseDps or 0) * (config.primaryAbility.fireTime or 1.0) * config.damageLevelMultiplier, 1) config.tooltipFields.energyPerShotLabel = util.round((config.primaryAbility.energyUsage or 0) * (config.primaryAbility.fireTime or 1.0), 1) if elementalType ~= "physical" then config.tooltipFields.damageKindImage = "/interface/elements/"..elementalType..".png" end if config.primaryAbility then config.tooltipFields.primaryAbilityTitleLabel = "Осн. атака:" config.tooltipFields.primaryAbilityLabel = config.primaryAbility.name or "unknown" end if config.altAbility then config.tooltipFields.altAbilityTitleLabel = "Умение:" config.tooltipFields.altAbilityLabel = config.altAbility.name or "unknown" end end -- set price -- TODO: should this be handled elsewhere? config.price = (config.price or 0) * root.evalFunction("itemLevelPriceMultiplier", configParameter("level", 1)) return config, parameters end
construct = { version = "1.0-dev" } -- Currently construct only supports Minetest Game and MineClone (2, 5, and MineClonia) if minetest.get_modpath("default") ~= nil then construct.gamemode = "MTG" elseif minetest.get_modpath("mcl_core") ~= nil then construct.gamemode = "MCL" else construct.gamemode = "???" end construct.log = function (msg) if type(msg) == "table" then msg = minetest.serialize(msg) end minetest.log("action", "[construct] "..tostring(msg)) end construct.dofile = function (dir, file) local mod = minetest.get_modpath("construct") if file == nil then dofile(mod .. DIR_DELIM .. dir .. ".lua") else dofile(mod .. DIR_DELIM .. dir .. DIR_DELIM .. file .. ".lua") end end construct.dofile("settings")
-- This defines all the callbacks needed by server and client. -- Callbacks are called when certain events happen. VERSION = "0.6" -- These are all possible commands clients of the server can send: CMD = { CHAT = 128, MAP = 129, START_GAME = 130, GAMESTATE = 131, NEW_CAR = 132, MOVE_CAR = 133, PLAYER_WINS = 134, BACK_TO_LOBBY = 135, LAPS = 136, SERVERCHAT = 138, STAT = 139, } function setServerCallbacks( server ) server.callbacks.received = serverReceived server.callbacks.synchronize = synchronize server.callbacks.authorize = function( user, msg ) return lobby:authorize( user, msg ) end server.callbacks.userFullyConnected = newUser server.callbacks.disconnectedUser = disconnectedUser -- Called when there's an error advertising (only on NON-DEDICATED server!): network.advertise.callbacks.advertiseWarnings = advertisementMsg end function setClientCallbacks( client ) -- set client callbacks: client.callbacks.received = clientReceived client.callbacks.connected = connected client.callbacks.disconnected = disconnected client.callbacks.otherUserConnected = otherUserConnected client.callbacks.otherUserDisconnected = otherUserDisconnected -- Called when user is authorized or not (in the second case, a reason is given): client.callbacks.authorized = function( auth, reason ) menu:authorized( auth, reason ) end end -- Called when client is connected to the server function connected() lobby:show() menu:closeConnectPanel() end -- Called on server when client is connected to server: function newUser( user ) lobby:setUserColor( user ) server:setUserValue( user, "moved", true ) server:setUserValue( user, "roundsWon", 0 ) server:send( CMD.SERVERCHAT, WELCOME_MSG, user ) if DEDICATED then utility.log( "[" .. os.time() .. "] New user: " .. user.playerName .. " (" .. server:getNumUsers() .. ")" ) end -- update advertisement: updateAdvertisementInfo() end -- Called when client is disconnected from the server function disconnected( msg ) menu:show() if msg and #msg > 0 then menu:errorMsg( "You have been kicked:", msg ) end client = nil server = nil end -- Called on server when user disconnects: function disconnectedUser( user ) if DEDICATED then utility.log( "[" .. os.time() .. "] User left: " .. user.playerName .. " (" .. server:getNumUsers() .. ")" ) end -- update advertisement: updateAdvertisementInfo() end -- Called on server when new client is in the process of -- connecting. function synchronize( user ) -- If the server has a map chosen, let the new client know -- about it: lobby:sendMap( user ) if STATE == "Game" then server:send( CMD.START_GAME, "", user ) game:synchronizeCars( user ) end end function otherUserConnected( user ) print("TEST!") if client and client.authorized then Sounds:play( "beep" ) end end function otherUserDisconnected( user ) stats:removeUser( user.id ) end function serverReceived( command, msg, user ) if command == CMD.CHAT then -- broadcast chat messages on to all players server:send( command, user.playerName .. ": " .. msg ) elseif command == CMD.MOVE_CAR then local x, y = msg:match( "(.*)|(.*)" ) print( "move car:", user.id, x, y, msg) game:validateCarMovement( user.id, x, y ) end end function clientReceived( command, msg ) if command == CMD.CHAT then chat:newLineSpeech( msg ) elseif command == CMD.SERVERCHAT then chat:newLineServer( msg ) elseif command == CMD.MAP then lobby:receiveMap( msg ) elseif command == CMD.START_GAME then game:show() elseif command == CMD.GAMESTATE then game:setState( msg ) elseif command == CMD.NEW_CAR then game:newCar( msg ) elseif command == CMD.MOVE_CAR then game:moveCar( msg ) elseif command == CMD.PLAYER_WINS then game:playerWins( msg ) elseif command == CMD.BACK_TO_LOBBY then lobby:show() elseif command == CMD.LAPS then lobby:receiveLaps( msg ) elseif command == CMD.STAT then stats:add( msg ) stats:show() -- in case it's not displaying yet, show the stats window end end function updateAdvertisementInfo() if server then local players, num = network:getUsers() if num then serverInfo.numPlayers = num end if STATE == "Game" then serverInfo.state = "Game" else serverInfo.state = "Lobby" end serverInfo.map = map:getName() network.advertise:setInfo( utility.createServerInfo() ) end end function advertisementMsg( msg ) if STATE == "Lobby" then lobby:newWarning( "Could not advertise your game online:\n" .. msg ) end end
local M = {} M.__index = M function M.new() local self = setmetatable({ }, M) return self end function M:fireOn() end return M
local socket = require("cqueues.socket") local LogLevel = require("web-driver/log-level") local IPCProtocol = require("web-driver/ipc-protocol") local pp = require("web-driver/pp") local RemoteLogger = {} local methods = {} local metatable = {} function metatable.__index(geckodriver, key) return methods[key] end function methods:need_log(level) level = LogLevel.resolve(level) return level <= self.level end function methods:log(level, message) if not self:need_log(level) then return end local log_receiver = socket.connect(self.host, self.port) IPCProtocol.log(log_receiver, level, message) end function methods:traceback(level) if not self:need_log(level) then return end self:log(level, "web-driver: Traceback:") local offset = 2 local deep_level = offset while true do local info = debug.getinfo(deep_level, "Sl") if not info then break end self:log(level, string.format("web-driver: %d: %s:%d", deep_level - offset + 1, info.short_src, info.currentline)) deep_level = deep_level + 1 end end function methods:emergency(...) self:log("emergency", ...) end function methods:alert(...) self:log("alert", ...) end function methods:fatal(...) self:log("fatal", ...) end function methods:error(...) self:log("error", ...) end function methods:warning(...) self:log("warning", ...) end function methods:notice(...) self:log("notice", ...) end function methods:info(...) self:log("info", ...) end function methods:debug(...) self:log("debug", ...) end function methods:trace(...) self:log("trace", ...) end function RemoteLogger.new(host, port, level) local remote_logger = { host = host, port = port, level = level, } setmetatable(remote_logger, metatable) return remote_logger end function RemoteLogger.is_a(logger) return getmetatable(logger) == metatable end return RemoteLogger
-- File browsers, fuzzy finders, explorers, searching. -- All the fun stuff to find something to operate on. local function has_words_before() local line, col = unpack(vim.api.nvim_win_get_cursor(0)) return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil end local function feedkey(key, mode) local x = vim.api.nvim_replace_termcodes(key, true, true, true) vim.api.nvim_feedkeys(x, mode, true) end local function setup() vim.cmd([[ packadd nvim-cmp packadd cmp-nvim-lsp packadd vim-vsnip packadd cmp-vsnip packadd telescope.nvim packadd nvim-tree.lua ]]) -- Telescope for fuzzy finding all the things local telescope = require('telescope') local actions = require('telescope.actions') telescope.setup { defaults = { prompt_prefix = " ", selection_caret = " ", winblend = 10, mappings = { i = { ['<C-j>'] = actions.move_selection_next, ['<C-k>'] = actions.move_selection_previous, ['<esc>'] = actions.close, ['jj'] = actions.close, ['jk'] = actions.close, ['kj'] = actions.close, }, }, }, } telescope.load_extension('projects') local map = require('utils').map map('n', '<leader>fr', '<cmd>Telescope oldfiles<cr>') map('n', '<leader>fs', '<cmd>Telescope projects<cr>') -- nvim-tree, because sometimes you just want a file explorer local tree = require('nvim-tree'); tree.setup { auto_close = true, view = { side = 'right', width = 40, }, update_focused_file = { enable = true, update_cwd = true, }, } vim.g.nvim_tree_gitignore = 1 vim.g.nvim_tree_respect_buf_cwd = 1 -- Autocompletion local cmp = require('cmp') -- Something about this makes the lua lsp pretty upset ---@diagnostic disable-next-line: redundant-parameter cmp.setup { sources = cmp.config.sources { { name = 'nvim_lsp' }, { name = 'vsnip' }, }, snippet = { expand = function(args) vim.fn["vsnip#anonymous"](args.body) end, }, mapping = { ['<cr>'] = cmp.mapping({ i = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = true, }), c = cmp.mapping.confirm({ behavior = cmp.ConfirmBehavior.Replace, select = false }), }), ['<C-n>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }), ['<C-p>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }), ['<C-d>'] = cmp.mapping.scroll_docs(-4), ['<C-f>'] = cmp.mapping.scroll_docs(4), ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), ["<Tab>"] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() elseif vim.fn["vsnip#available"](1) == 1 then feedkey("<Plug>(vsnip-expand-or-jump)", "") elseif has_words_before() then cmp.complete() else fallback() end end, { "i", "s" }), ["<S-Tab>"] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_prev_item() elseif vim.fn["vsnip#jumpable"](-1) == 1 then feedkey("<Plug>(vsnip-jump-prev)", "") else fallback() end end, { "i", "s" }), } } end return { setup = setup }
local is_table_empty = assert(foundation.com.is_table_empty) local table_keys = assert(foundation.com.table_keys) local table_length = assert(foundation.com.table_length) local DeviceCluster = yatm_clusters.SimpleCluster:extends("DeviceCluster") local ic = DeviceCluster.instance_class function ic:initialize(cluster_group) ic._super.initialize(self, { cluster_group = cluster_group, log_group = 'yatm.cluster.device', node_group = 'yatm_cluster_device' }) end function ic:get_node_infotext(pos) local node_id = minetest.hash_node_position(pos) local cluster = self:get_node_cluster(pos) if cluster then local state_string = cluster.assigns.state or 'unknown' if cluster.assigns.controller_id then if cluster.assigns.controller_id == node_id then state_string = state_string .. " - is host" end else state_string = state_string .. " - no available controller" end return "Device Cluster: " .. cluster.id .. " (" .. state_string .. ")" end return '' end function ic:get_node_groups(node) local nodedef = minetest.registered_nodes[node.name] if nodedef and nodedef.yatm_network then return nodedef.yatm_network.groups or {} else return {} end end function ic:handle_node_event(cls, generation_id, event, node_clusters, trace) if event.event_name == 'refresh_controller' then self:_handle_refresh_controller(cls, generation_id, event, node_clusters) elseif event.event_name == 'transition_state' then self:_handle_transition_state(cls, generation_id, event, node_clusters) else ic._super.handle_node_event(self, cls, generation_id, event, node_clusters, trace) end end function ic:_handle_load_node(cls, generation_id, event, node_clusters) local cluster = ic._super._handle_load_node(self, cls, generation_id, event, node_clusters) if cluster then local node = minetest.get_node(event.pos) local nodedef = minetest.registered_nodes[node.name] if nodedef then if nodedef.yatm_network and nodedef.yatm_network.on_load then nodedef.yatm_network.on_load(event.pos, node) end end end return cluster end function ic:_handle_add_node(cls, generation_id, event, node_clusters) local cluster = ic._super._handle_add_node(self, cls, generation_id, event, node_clusters) cls:schedule_node_event(self.m_cluster_group, 'refresh_controller', event.pos, event.node, { cluster_id = cluster.id, generation_id = generation_id }) return cluster end function ic:on_cluster_branch_changed(cls, generation_id, event, cluster) cls:schedule_node_event(self.m_cluster_group, 'refresh_controller', event.pos, event.node, { cluster_id = cluster.id, generation_id = generation_id }) end function ic:transition_cluster_state(cls, cluster, generation_id, event, state) cls:schedule_node_event(self.m_cluster_group, 'transition_state', event.pos, event.node, { state = state, cluster_id = cluster.id, generation_id = generation_id }) end function ic:_handle_refresh_controller(cls, generation_id, event, node_clusters) -- normally called when the nodes have settled in local cluster = cls:get_cluster(event.params.cluster_id) if cluster then if cluster.assigns.generation_id == generation_id then -- we've already refreshed for this generation, skip this event return else -- it seems our generation is stale, refresh for real cluster.assigns.generation_id = generation_id local tiered_nodes = {} cluster:reduce_nodes_of_groups({'device_controller'}, tiered_nodes, function (node_entry, acc) local tier = node_entry.groups['device_controller'] if not acc[tier] then acc[tier] = {} end acc[tier][node_entry.id] = node_entry return true, acc end) if is_table_empty(tiered_nodes) then -- just choose the first one, it's the leader for now. cluster.assigns.controller_id = nil self:transition_cluster_state(cls, cluster, generation_id, event, 'down') else local tier1_nodes = tiered_nodes[1] if tier1_nodes then -- only 1 host should exist if table_length(tier1_nodes) > 1 then -- ho boi, we have a problem cluster.assigns.controller_id = nil self:transition_cluster_state(cls, cluster, generation_id, event, 'conflict') else local node_id, _node_entry = next(tier1_nodes) cluster.assigns.controller_id = node_id self:transition_cluster_state(cls, cluster, generation_id, event, 'up') end else local tiers = table_keys(tiered_nodes) local highest_tier = 100 for tier, _nodes in pairs(tiered_nodes) do if tier < highest_tier then highest_tier = tier end end local nodes = tiered_nodes[highest_tier] local node_id, _node_entry = next(nodes) cluster.assigns.controller_id = node_id self:transition_cluster_state(cls, cluster, generation_id, event, 'up') end end end else self:log("cluster requested a refresh_controller but it no longer exists cluster_id=" .. event.params.cluster_id) end end function ic:_handle_transition_state(cls, generation_id, event, node_clusters) self:log("transition_state", generation_id, 'cluster_id=' .. event.params.cluster_id, 'state=' .. event.params.state) local cluster = cls:get_cluster(event.params.cluster_id) if cluster then cluster.assigns.state = assert(event.params.state) cluster:reduce_nodes(0, function (node_entry, acc) local nodedef = minetest.registered_nodes[node_entry.node.name] nodedef.transition_device_state(node_entry.pos, node_entry.node, cluster.assigns.state) return true, acc + 1 end) else self:log("cluster requested a transition_state but it no longer exists cluster_id=" .. event.params.cluster_id) end end local CLUSTER_GROUP = 'yatm_device' -- -- Called before a block is expired and removed from the clusters function ic:on_pre_block_expired(block) yatm.clusters:reduce_clusters_of_group(CLUSTER_GROUP, 0, function (cluster, acc) cluster:reduce_nodes_in_block(block.id, 0, function (node_entry, acc2) local pos = node_entry.pos local node = node_entry.node -- this is the only time the old node entry has to be used local nodedef = minetest.registered_nodes[node.name] if nodedef and nodedef.yatm_network then if nodedef.yatm_network.on_unload then nodedef.yatm_network.on_unload(pos, node) end end end) return true, acc + 1 end) end do yatm.cluster.DeviceCluster = DeviceCluster yatm.cluster.devices = DeviceCluster:new(CLUSTER_GROUP) yatm.clusters:register_node_event_handler( CLUSTER_GROUP, "yatm_cluster_devices:handle_node_event", yatm.cluster.devices:method('handle_node_event') ) yatm.clusters:observe('pre_block_expired', 'yatm_cluster_devices:pre_block_expired', yatm.cluster.devices:method('on_pre_block_expired')) yatm.clusters:observe('terminate', 'yatm_cluster_devices:terminate', yatm.cluster.devices:method('terminate')) yatm.cluster_tool.register_cluster_tool_render(CLUSTER_GROUP, yatm.cluster.devices:method("cluster_tool_render")) minetest.register_lbm({ name = "yatm_cluster_devices:cluster_device_lbm", nodenames = { "group:yatm_cluster_device", }, run_at_every_load = true, action = function (pos, node) yatm.cluster.devices:schedule_load_node(pos, node) end, }) end
-- -- tests/actions/vstudio/vc2010/test_extension_settings.lua -- Check the import extension settings block of a VS 2010 project. -- Copyright (c) 2014 Jason Perkins and the Premake project -- local suite = test.declare("vs2010_extension_settings") local vc2010 = premake.vstudio.vc2010 local project = premake.project -- -- Setup -- local wks function suite.setup() premake.action.set("vs2010") rule "MyRules" rule "MyOtherRules" wks = test.createWorkspace() end local function prepare() local prj = test.getproject(wks) vc2010.importExtensionSettings(prj) end -- -- Writes an empty element when no custom rules are specified. -- function suite.structureIsCorrect_onDefaultValues() prepare() test.capture [[ <ImportGroup Label="ExtensionSettings"> </ImportGroup> ]] end -- -- Writes entries for each project scoped custom rules path. -- function suite.addsImport_onEachRulesFile() rules { "MyRules", "MyOtherRules" } prepare() test.capture [[ <ImportGroup Label="ExtensionSettings"> <Import Project="MyRules.props" /> <Import Project="MyOtherRules.props" /> </ImportGroup> ]] end -- -- Rule files use a project relative path. -- function suite.usesProjectRelativePaths() rules "MyRules" location "build" prepare() test.capture [[ <ImportGroup Label="ExtensionSettings"> <Import Project="..\MyRules.props" /> </ImportGroup> ]] end -- -- the asm 'file category' should add the right settings. -- function suite.hasAssemblyFiles() files { "test.asm" } location "build" prepare() test.capture [[ <ImportGroup Label="ExtensionSettings"> <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" /> </ImportGroup> ]] end
AddJob({"output1", "output2"}, "testing 1", "echo hello > output1")
slot0 = class("PrincetonPtPage", import(".TemplatePage.PtTemplatePage")) slot0.OnInit = function (slot0) slot0.super.OnInit(slot0) slot0.buildBtn = slot0:findTF("build", slot0.bg) end slot0.OnFirstFlush = function (slot0) slot0.super.OnFirstFlush(slot0) onButton(slot0, slot0.buildBtn, function () slot0:emit(ActivityMediator.EVENT_GO_SCENE, SCENE.GETBOAT, { projectName = BuildShipScene.PROJECTS.SPECIAL }) end, SFX_PANEL) end slot0.OnUpdateFlush = function (slot0) slot0.super.OnUpdateFlush(slot0) slot10, slot11, slot3 = slot0.ptData:GetLevelProgress() slot10, slot11, slot6 = slot0.ptData:GetResProgress() setText(slot0.step, setColorStr(slot1, "#4180FFFF") .. "/" .. slot2) setText(slot0.progress, setColorStr(slot4, "#4180FFFF") .. "/" .. slot5) end return slot0
-- server side demo if triggerServerEvent == nil then addEventHandler("onResourceStart", resourceRoot, async(function(...) outputDebugString("async start") local connection = dbConnect("sqlite", "testdb.sqlite") local task0 = asyncDbQuery(connection, "SELECT 1") local task1 = asyncSleep(10000) local task2 = asyncSleep(10000) local task3 = asyncWaitEvent("onResourceStop", resourceRoot) local task4 = asyncWaitEvent("onPlayerJoin", root, nil, true) local task5 = asyncSleep(10000, true) local task6 = asyncHttpRequest("http://www.google.com") outputDebugString("query result "..tostring(asyncResult(task0)[1]["1"])) asyncResult(task1) outputDebugString("sleep 1 end ") asyncResult(task2) outputDebugString("sleep 2 end ") if task6 then local response,errorno = asyncResult(task6) if response then outputDebugString(response:sub(1,80)) end end asyncSwitch({task4, task5, task3}, function(client, source) outputChatBox( "hello "..tostring(source), source ) end, function(client, source) outputDebugString("tick") end) asyncDisposeAll() outputDebugString("async end") end)) else -- client side demo addCommandHandler( "t", (asyncSingleton(function() showCursor( true ) local window = guiCreateWindow( 0.75, 0.75, 0.25, 0.25, "test", true ) local buttons = { { 0, 0.1, 0.25, 0.25, "1" }, { 0.75, 0.1, 0.25, 0.25, "2" }, { 0, 0.75, 0.25, 0.25, "3" }, { 0.75, 0.75, 0.25, 0.25, "4" } } -- create four buttons and watcher tasks local controls = {} local events = {} for i,button in ipairs(buttons) do local x,y,w,h,text = unpack(button) controls[i] = guiCreateButton( x, y, w, h, text, true, window ) events[i] = asyncWaitEvent( "onClientGUIClick", controls[i], false, true ) end local function buttonClick(client, source, this, button, state, absoluteX, absoluteY) outputChatBox( "pressed "..button.." button on "..guiGetText( source ) ) end asyncSwitch(events, buttonClick, buttonClick, buttonClick, function(...) buttonClick(...) return true end) -- release watcher tasks asyncDisposeAll() destroyElement(window) showCursor( false ) end))) end
return { { "kevinhwang91/nvim-bqf" }, { "mhinz/vim-grepper", config = function() vim.cmd([[ augroup Grepper autocmd! autocmd User Grepper call setqflist([], 'r', {'context': {'bqf': {'pattern_hl': histget('/')}}}) | botright copen augroup END ]]) vim.g.grepper = { open = 0, quickfix = 1, searchreg = 1, highlight = 1 } end, }, { "folke/trouble.nvim", requires = "kyazdani42/nvim-web-devicons", config = function() require("trouble").setup({}) end, }, }
// Generated by github.com/davyxu/tabtoy // Version: 2.8.10 module table { export var Event : table.IEventDefine[] = [ { Id : 1, Event : 1001 } ] // Id export var EventById : game.Dictionary<table.IEventDefine> = {} function readEventById(){ for(let rec of Event) { EventById[rec.Id] = rec; } } readEventById(); }
---@class CS.UnityEngine.RenderTargetSetup : CS.System.ValueType ---@field public color RenderBuffer[] ---@field public depth CS.UnityEngine.RenderBuffer ---@field public mipLevel number ---@field public cubemapFace number ---@field public depthSlice number ---@field public colorLoad RenderBufferLoadAction[] ---@field public colorStore RenderBufferStoreAction[] ---@field public depthLoad number ---@field public depthStore number ---@type CS.UnityEngine.RenderTargetSetup CS.UnityEngine.RenderTargetSetup = { } ---@overload fun(color:CS.UnityEngine.RenderBuffer, depth:CS.UnityEngine.RenderBuffer): CS.UnityEngine.RenderTargetSetup ---@overload fun(color:RenderBuffer[], depth:CS.UnityEngine.RenderBuffer): CS.UnityEngine.RenderTargetSetup ---@overload fun(color:CS.UnityEngine.RenderBuffer, depth:CS.UnityEngine.RenderBuffer, mipLevel:number): CS.UnityEngine.RenderTargetSetup ---@overload fun(color:RenderBuffer[], depth:CS.UnityEngine.RenderBuffer, mipLevel:number): CS.UnityEngine.RenderTargetSetup ---@overload fun(color:CS.UnityEngine.RenderBuffer, depth:CS.UnityEngine.RenderBuffer, mipLevel:number, face:number): CS.UnityEngine.RenderTargetSetup ---@overload fun(color:RenderBuffer[], depth:CS.UnityEngine.RenderBuffer, mip:number, face:number): CS.UnityEngine.RenderTargetSetup ---@overload fun(color:CS.UnityEngine.RenderBuffer, depth:CS.UnityEngine.RenderBuffer, mipLevel:number, face:number, depthSlice:number): CS.UnityEngine.RenderTargetSetup ---@return CS.UnityEngine.RenderTargetSetup ---@param color RenderBuffer[] ---@param depth CS.UnityEngine.RenderBuffer ---@param optional mip number ---@param optional face number ---@param optional colorLoad RenderBufferLoadAction[] ---@param optional colorStore RenderBufferStoreAction[] ---@param optional depthLoad number ---@param optional depthStore number function CS.UnityEngine.RenderTargetSetup.New(color, depth, mip, face, colorLoad, colorStore, depthLoad, depthStore) end return CS.UnityEngine.RenderTargetSetup
-- invoke as Pandoc filter -- set the metadata value 'title' based on the first level 2 header local title function Header(elem) if elem.level == 2 then -- save first heading to use as the page title if not title then title = pandoc.utils.stringify(elem) end end end function Meta(meta) if title then meta.title = title end return meta end
local S, G, R = precore.helpers() precore.import(G"${DEP_PATH}/duct") precore.make_config_scoped("cacophony.env", { once = true, }, { {global = function() precore.define_group("CACOPHONY", os.getcwd()) end}}) precore.make_config("cacophony.strict", nil, { {project = function() configuration {"clang"} flags { "FatalWarnings" } configuration {"linux"} buildoptions { "-pedantic-errors", "-Wextra", "-Wuninitialized", "-Winit-self", "-Wmissing-field-initializers", "-Wredundant-decls", "-Wfloat-equal", "-Wold-style-cast", "-Wnon-virtual-dtor", "-Woverloaded-virtual", "-Wunused", "-Wundef", } end}}) precore.make_config("cacophony.dep", nil, { "duct.dep", {project = function() configuration {} includedirs { G"${CACOPHONY_ROOT}/", } end}}) precore.apply_global({ "precore.env-common", "cacophony.env", })
--濒死时,献祭队友回血 function onStart(target, buff) add_buff_parameter(target, buff, 1) end function onPostTick(target, buff) if buff.not_go_round > 0 then return end buff.remaining_round = buff.remaining_round - 1; if buff.remaining_round <= 0 then UnitRemoveBuff(buff); end end function onEnd(target, buff) add_buff_parameter(target, buff, -1) end local function have_fit_partner(target, buff) local fit_list = {} local partners = FindAllPartner() local id_1 = buff.cfg_property[1] and buff.cfg_property[1] local id_2 = buff.cfg_property[2] and buff.cfg_property[2] local id_3 = buff.cfg_property[3] and buff.cfg_property[3] for _, v in ipairs(partners) do if id_1 and v.id == id_1 then table.insert(fit_list, {role = v, order = 1}) elseif id_2 and v.id == id_2 then table.insert(fit_list, {role = v, order = 2}) elseif id_3 and v.id == id_3 then table.insert(fit_list, {role = v, order = 3}) end end table.sort(fit_list, function (a, b) if a.order ~= b.order then return a.order < b.order end return a.role.uuid < b.role.uuid end) return fit_list end function targetWillHit(target, buff, bullet) if bullet.hurt_final_value > target.hp and target.hp > 1 and #have_fit_partner(target, buff) > 0 then bullet.hurt_final_value = math.ceil(target.hp - 1) elseif bullet.hurt_final_value > target.hp and target.hp <= 1 and #have_fit_partner(target, buff) > 0 then bullet.hurt_final_value = -1 else return end Run(function () target[7012] = target[7012] + 1000 PlayEffectsInBuff(buff) if #have_fit_partner(target, buff) == 0 then target.hp = 0 return end local kill_partner = have_fit_partner(target, buff)[1].role UnitPlay(target, "attack1", {speed = 1}); Common_Sleep(target, 0.4) Common_FireBullet(buff.id, target, {kill_partner}, nil, {TrueHurt = kill_partner.hpp * 10, Duration = 0, Interval = 0, parameter = { critPer = -10000, } }) kill_partner.hp = 0 Common_Sleep(target, 0.4) Common_Heal(target, {target}, 0, target.hpp, {name_id = buff.id, Type = 24}) target[7012] = target[7012] - 1000 end) end
local Model = require("lapis.db.model").Model local schema = require("lapis.db.schema") local types = schema.types local lapis = require("lapis") local db = require("lapis.db") local uuid = require("uuid") -- Localize local cwd = (...):gsub('%.[^%.]+$', '') .. "." local oss_options = require(cwd .. "GameDbUrls").getOptions() local _M = { } -- MailData_MAIL_TYPE_MAIL_TYPE_UNKNOWN = 0, -- MailData_MAIL_TYPE_MAIL_TYPE_COMPENSATE = 1, -- MailData_MAIL_TYPE_MAIL_TYPE_FIRST_CHARGE = 2, -- MailData_MAIL_TYPE_MAIL_TYPE_MONTH_CARD = 3, -- MailData_MAIL_TYPE_MAIL_TYPE_RANKING_REWARD = 4, -- MailData_MAIL_TYPE_MAIL_TYPE_GUILD = 5, -- MailData_MAIL_TYPE_MAIL_TYPE_LV_SHOPPING = 6 function _M.create(mailtype, subject, content, attachment, createtime, burntime, mailto_level, ignore_rule) local data = {} local res, d1, d2 = db.query(oss_options, "CALL __oss_create_game_mail(?,?,?,?,?,?,?,?,?)", subid, mailtype, subject, content, attachment, createtime, burntime, mailto_level, ignore_rule) if res then local n = #res if n >= 2 then for i, row in ipairs(res[1]) do table.insert(data, row) end end end return data end function _M.createPrivate(mailtype, userid, subject, content, attachment) local subid = _M._subid + 1 local data = {} local res, d1, d2 = db.query(oss_options, "CALL __oss_create_game_mail_private(?,?,?,?,?,?)", subid, mailtype, userid, subject, content, attachment) if res then local n = #res if n >= 2 then for i, row in ipairs(res[1]) do table.insert(data, row) end end -- _M._subid = subid end return data end return _M
--[[ --=====================================================================================================-- Script Name: Shotty-Snipes, for SAPP (PC & CE) Description: Players spawn with a shotgun & sniper. Other weapons & vehicles do not spawn. You can use equipment (i.e, grenades & powerups). This script is plug-and-play. No configuration! Copyright (c) 2022, Jericho Crosby <jericho.crosby227@gmail.com> * Notice: You can use this document subject to the following conditions: https://github.com/Chalwk77/HALO-SCRIPT-PROJECTS/blob/master/LICENSE --=====================================================================================================-- ]]-- api_version = '1.12.0.0' local objects = { --{'weap', 'weapons\\shotgun\\shotgun'}, --{'weap', 'weapons\\sniper rifle\\sniper rifle'}, { 'weap', 'weapons\\pistol\\pistol' }, { 'weap', 'weapons\\needler\\mp_needler' }, { 'weap', 'weapons\\flamethrower\\flamethrower' }, { 'weap', 'weapons\\plasma rifle\\plasma rifle' }, { 'weap', 'weapons\\plasma_cannon\\plasma_cannon' }, { 'weap', 'weapons\\assault rifle\\assault rifle' }, { 'weap', 'weapons\\plasma pistol\\plasma pistol' }, { 'weap', 'weapons\\rocket launcher\\rocket launcher' }, --{ 'eqip', 'powerups\\health pack' }, --{ 'eqip', 'powerups\\over shield' }, --{ 'eqip', 'powerups\\active camouflage' }, --{ 'eqip', 'weapons\\frag grenade\\frag grenade' }, --{ 'eqip', 'weapons\\plasma grenade\\plasma grenade' }, { 'vehi', 'vehicles\\ghost\\ghost_mp' }, { 'vehi', 'vehicles\\rwarthog\\rwarthog' }, { 'vehi', 'vehicles\\banshee\\banshee_mp' }, { 'vehi', 'vehicles\\warthog\\mp_warthog' }, { 'vehi', 'vehicles\\scorpion\\scorpion_mp' }, { 'vehi', 'vehicles\\c gun turret\\c gun turret_mp' } } local players = {} local shotgun, sniper function OnScriptLoad() register_callback(cb['EVENT_JOIN'], 'OnJoin') register_callback(cb['EVENT_TICK'], 'OnTick') register_callback(cb['EVENT_LEAVE'], 'OnQuit') register_callback(cb['EVENT_SPAWN'], 'OnSpawn') register_callback(cb['EVENT_ALIVE'], 'UpdateAmmo') register_callback(cb['EVENT_GAME_START'], 'OnStart') register_callback(cb['EVENT_OBJECT_SPAWN'], 'OnObjectSpawn') OnStart() end local function GetTag(Class, Name) local Tag = lookup_tag(Class, Name) return Tag ~= 0 and read_dword(Tag + 0xC) or nil end function OnStart() shotgun, sniper = nil, nil if (get_var(0, '$gt') ~= 'n/a') then shotgun = GetTag('weap', 'weapons\\shotgun\\shotgun') sniper = GetTag('weap', 'weapons\\sniper rifle\\sniper rifle') end end function OnTick() for i, v in pairs(players) do if (player_alive(i) and v.assign and shotgun and sniper) then v.assign = false execute_command('wdel ' .. i) assign_weapon(spawn_object('', '', 0, 0, 0, 0, sniper), i) assign_weapon(spawn_object('', '', 0, 0, 0, 0, shotgun), i) UpdateAmmo(i) end end end function OnJoin(p) players[p] = { assign = false } end function OnQuit(p) players[p] = nil end function OnSpawn(p) if (players[p]) then players[p].assign = true end end function UpdateAmmo(p) execute_command_sequence('ammo ' .. p .. ' 999 5; mag ' .. p .. ' 999 5') end function OnObjectSpawn(Ply, MID) if (Ply == 0) then for _, v in pairs(objects) do if (MID == GetTag(v[1], v[2])) then return false end end end end function OnScriptUnload() -- N/A end
local U = require "togo.utility" local T = require "Quanta.Time" local O = require "Quanta.Object" local Unit = require "Quanta.Unit" local Entity = require "Quanta.Entity" local Tracker = require "Quanta.Tracker" local Vessel = require "Quanta.Vessel" local Tool = require "Quanta.Tool" local Stat = require "Bio.Stat" require "Dialect.Bio.Nutrition" require "Tool.common" local action_filter = { [Dialect.Bio.Nutrition.Eat] = true, [Dialect.Bio.Nutrition.Drugtake] = true, } local function collect_actions(t) t.groups = {} for _, entry in ipairs(t.tracker.entries) do for _, action in ipairs(entry.actions) do if action_filter[U.type_class(action.data)] and not action.data.prep then local name = Dialect.Bio.Nutrition.group(action) local g = t.groups[name] if not g then g = { name = name, actions = {}, } t.groups[name] = g table.insert(t.groups, g) end table.insert(g.actions, action) end end end end local function print_stat(stat, obj, left) Tool.log( "%s%s", string.rep(' ', left), O.write_text_string(stat:to_object(obj), true) ) for _, s in ipairs(stat.children) do print_stat(s, obj, left + 2) end end local NotFoundModifier = U.class(NotFoundModifier) function NotFoundModifier:__init() end function NotFoundModifier:from_object(context, ref, modifier, obj) end function NotFoundModifier:to_object(modifier, obj) end function NotFoundModifier:make_copy() return NotFoundModifier() end function NotFoundModifier:compare_equal(other) return true end local debug_thing_type_name = { [Entity] = "Entity", [Unit] = "Unit", [Unit.Element] = "Unit.Element", } local function debug_searcher_wrapper(name, searcher) return function(resolver, parent, unit) local thing, variant, terminate = searcher(resolver, parent, unit) U.print( "%12s %s %s $%d$%d => %s %s", name, unit.scope and time_to_string(unit.scope) or "____-__-__", unit.id, unit.source, unit.sub_source, thing ~= nil and "found" or "...", thing ~= nil and (debug_thing_type_name[U.type_class(thing)] or "<unknown type>") or "" ) return thing, variant, terminate end end local function searcher_wrapper(name, searcher) return searcher end local function select_searcher(part) if part.type ~= Unit.Type.reference then return searcher_wrapper("child", Unit.Resolver.searcher_unit_child(part)) else return searcher_wrapper("selector", Unit.Resolver.searcher_unit_selector(part)) end end local command = Tool("diet", {}, {}, [=[ diet [ <date-or-range> [...] ] calculate nutrient intake stats -d: debug mode -s: summary -c: clean mode; don't add `__nf__` modifiers to not-found entity references ]=], function(self, parent, options, params) local function read_modifier(p) if p.name == "-d" then self.data.debug = true searcher_wrapper = debug_searcher_wrapper elseif p.name == "-s" then self.data.summary = true elseif p.name == "-c" then self.data.clean = true else return false end return true end local dates = {} if not parse_dates(dates, options, params, read_modifier) then return false end if #dates == 0 then Tool.log("note: no dates") return true end Bio.debug = self.data.debug local universe, msg = Entity.read_universe(Vessel.data_path("entity/u_nutrition.q")) if not universe then return Tool.log_error("%s", msg) end local tracker_cache = {} local function cache_tracker(t) U.assert(not t.tracker) t.date_str = time_to_string(t.date) t.tracker = Tracker() tracker_cache[T.value(t.date)] = t if not t.requested and self.data.debug then Tool.log("caching %s", t.date_str) end local success, msg, source_line = load_tracker(t.tracker, t.path, t.date_str) if not success then Tool.log_error("%s", msg) open_tracker_file_in_editor(t.path, source_line) return nil end t.local_units = t.tracker.attachments.units return t end local function scoped_unit_searcher(resolver, _, unit) local t = tracker_cache[T.value(unit.scope)] if not t then t = cache_tracker({ date = T(unit.scope), path = Vessel.tracker_path(unit.scope) }) U.assert(t ~= nil) end if t.local_units then return Unit.Resolver.searcher_unit_child_func(resolver, t.local_units.composition, unit) end return nil, nil, false end local not_found_modifier = Unit.Modifier("__nf__", nil, NotFoundModifier()) local function resolve_and_mark(resolver, unit) local result = resolver:do_tree(unit) if not self.data.clean then for _, p in ipairs(result.not_found) do local already_marked = false for _, m in ipairs(p.unit.modifiers) do if U.is_instance(m.data, NotFoundModifier) then already_marked = true break end end if not already_marked then table.insert(p.unit.modifiers, not_found_modifier) end end end return result end local search_branches = { Entity.make_search_branch(universe:search(nil, "food"), 0), Entity.make_search_branch(universe:search(nil, "drug"), 0), Entity.make_search_branch(universe, 0), } local resolver = Unit.Resolver( select_searcher, searcher_wrapper("scoped_unit", scoped_unit_searcher), nil ) U.assert(resolver.scope_searcher ~= nil) resolver:push_searcher(searcher_wrapper("universe", Unit.Resolver.searcher_universe(universe, search_branches, nil))) Bio.resolve_func = function(unit) return resolve_and_mark(resolver, unit) end local obj = O.create() for _, t in ipairs(dates) do t.requested = true if not cache_tracker(t) then return false end Tool.log("------------ %s ------------", t.date_str) if t.local_units then resolver:push_searcher(searcher_wrapper("local", Unit.Resolver.searcher_unit_child(t.local_units.composition))) Tool.log("local:") for _, unit in ipairs(t.local_units.composition.items) do resolve_and_mark(resolver, unit) Bio.normalize(unit) local text = O.write_text_string(unit:to_object(obj), true) text = string.gsub(text, "\t", " ") text = string.gsub(text, "\n", "\n") Tool.log("%s\n", text) end end collect_actions(t) for _, g in ipairs(t.groups) do if self.data.summary then Tool.log("group %s:", g.name) end for _, action in ipairs(g.actions) do resolve_and_mark(resolver, action.data.composition) if self.data.summary then local text = O.write_text_string(action.data.composition:to_object(obj), false) text = string.gsub(text, "\t", " ") text = string.gsub(text, "\n", "\n ") Tool.log(" %s", text) end end if self.data.summary then Tool.log("") end end if t.local_units then resolver:pop() end if not self.data.summary then Tool.log("\nstats:") t.stat = Stat() for _, g in ipairs(t.groups) do g.stat = Stat("group " .. g.name) for _, action in ipairs(g.actions) do for _, item in ipairs(action.data.composition.items) do g.stat:add(item) end end t.stat:add(g.stat) print_stat(g.stat, obj, 0) end end end end) command.auto_read_options = false command.default_data = { debug = false, summary = false, clean = false, } return command
local fs = require('fs') local pathjoin = require('pathjoin') local splitPath = pathjoin.splitPath local pathJoin = pathjoin.pathJoin local readFileSync = fs.readFileSync local scandirSync = fs.scandirSync local remove = table.remove local env = setmetatable({ require = require, -- luvit custom require }, {__index = _G}) local modules = {} local function loadModule(path) local name = remove(splitPath(path)):match('(.*).lua') local success, err = pcall(function() local code = assert(readFileSync(path)) local fn = assert(loadstring(code, name, 't', env)) modules[name] = fn() end) if success then print('module loaded: ' .. name) else print(err) end end local function unloadModule(name) if modules[name] then modules[name] = nil print('module unloaded: ' .. name) else print('module not found: ' .. name) end end local function scan(path, name) for k, v in scandirSync(path) do local joined = pathJoin(path, name) if v == 'file' then if k:lower() == name then return joined end else scan(joined) end end end local function loadModules(path) for k, v in scandirSync(path) do local joined = pathJoin(path, k) if v == 'file' then if k:find('.lua', -4, true) then loadModule(joined) end else loadModules(joined) end end end loadModules('./modules') process.stdin:on('data', function(data) data = data:split('%s+') if not data[2] then return end if data[1] == 'reload' then local path = scan('./modules', data[2] .. '.lua') if path then return loadModule(path) end elseif data[1] == 'unload' then return unloadModule(data[2]) end end) return modules
local TimeBeforeHealing = script:GetCustomProperty("TimeBeforeHealing") local HealingPerSecond = script:GetCustomProperty("HealinigPerSecond") function Regen( ) while true do for _,player in pairs(Game.GetPlayers( )) do local hp = player.hitPoints local maxHP = player.maxHitPoints if(hp < maxHP and player.serverUserData["Regen"] and not player.isDead) then if(player.serverUserData["Regen"]["LastDamage"]) then if(os.time() - player.serverUserData["Regen"]["LastDamage"] > TimeBeforeHealing) then hp = hp + HealingPerSecond * 0.1 if hp > maxHP then hp = maxHP end player.hitPoints = hp end end end end Task.Wait(.1) end end function DMG(player, damage) if(damage.amount > 0) then player.serverUserData["Regen"]["LastDamage"] = os.time() end end Game.playerJoinedEvent:Connect(function(player) player.serverUserData["Regen"] = {} player.serverUserData["Regen"]["DamageEvent"] = player.damagedEvent:Connect(DMG) end) Game.playerLeftEvent:Connect(function(player) player.serverUserData["Regen"]["DamageEvent"]:Disconnect() player.serverUserData["Regen"] = nil end) Task.Spawn(function() Regen() end) Events.Connect("ActivateRegen", function(player) if not Object.IsValid(player) then return end player.serverUserData["Regen"]["LastDamage"] = 0 end)
--[[ Copyright (c) 2019, Vsevolod Stakhov <vsevolod@highsecure.ru> 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. ]]-- --[[[ -- @module lua_magic/patterns -- This module contains types definitions --]] -- This table is indexed by msdos extension for convenience local types = { -- exe exe = { ct = 'application/x-ms-application', type = 'executable', }, elf = { ct = 'application/x-elf-executable', type = 'executable', }, lnk = { ct = 'application/x-ms-application', type = 'executable', }, class = { ct = 'application/x-java-applet', type = 'executable', }, jar = { ct = 'application/java-archive', type = 'archive', }, apk = { ct = 'application/vnd.android.package-archive', type = 'archive', }, bat = { ct = 'application/x-bat', type = 'executable', }, -- text rtf = { ct = "application/rtf", type = 'binary', }, pdf = { ct = 'application/pdf', type = 'binary', }, ps = { ct = 'application/postscript', type = 'binary', }, chm = { ct = 'application/x-chm', type = 'binary', }, djvu = { ct = 'application/x-djvu', type = 'binary', }, -- archives arj = { ct = 'application/x-arj', type = 'archive', }, cab = { ct = 'application/x-cab', type = 'archive', }, ace = { ct = 'application/x-ace', type = 'archive', }, tar = { ct = 'application/x-tar', type = 'archive', }, bz2 = { ct = 'application/x-bzip', type = 'archive', }, xz = { ct = 'application/x-xz', type = 'archive', }, lz4 = { ct = 'application/x-lz4', type = 'archive', }, zst = { ct = 'application/x-zstandard', type = 'archive', }, dmg = { ct = 'application/x-dmg', type = 'archive', }, iso = { ct = 'application/x-iso', type = 'archive', }, zoo = { ct = 'application/x-zoo', type = 'archive', }, egg = { ct = 'application/x-egg', type = 'archive', }, alz = { ct = 'application/x-alz', type = 'archive', }, xar = { ct = 'application/x-xar', type = 'archive', }, epub = { ct = 'application/x-epub', type = 'archive' }, szdd = { -- in fact, their MSDOS extension is like FOO.TX_ or FOO.TX$ ct = 'application/x-compressed', type = 'archive', }, -- images psd = { ct = 'image/psd', type = 'image', av_check = false, }, pcx = { ct = 'image/pcx', type = 'image', av_check = false, }, pic = { ct = 'image/pic', type = 'image', av_check = false, }, tiff = { ct = 'image/tiff', type = 'image', av_check = false, }, ico = { ct = 'image/ico', type = 'image', av_check = false, }, swf = { ct = 'application/x-shockwave-flash', type = 'image', }, -- Ole files ole = { ct = 'application/octet-stream', type = 'office' }, doc = { ct = 'application/msword', type = 'office' }, xls = { ct = 'application/vnd.ms-excel', type = 'office' }, ppt = { ct = 'application/vnd.ms-powerpoint', type = 'office' }, vsd = { ct = 'application/vnd.visio', type = 'office' }, msi = { ct = 'application/x-msi', type = 'executable' }, msg = { ct = 'application/vnd.ms-outlook', type = 'office' }, -- newer office (2007+) docx = { ct = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', type = 'office' }, xlsx = { ct = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', type = 'office' }, pptx = { ct = 'application/vnd.openxmlformats-officedocument.presentationml.presentation', type = 'office' }, -- OpenOffice formats odt = { ct = 'application/vnd.oasis.opendocument.text', type = 'office' }, ods = { ct = 'application/vnd.oasis.opendocument.spreadsheet', type = 'office' }, odp = { ct = 'application/vnd.oasis.opendocument.presentation', type = 'office' }, -- https://en.wikipedia.org/wiki/Associated_Signature_Containers asice = { ct = 'application/vnd.etsi.asic-e+zip', type = 'office' }, asics = { ct = 'application/vnd.etsi.asic-s+zip', type = 'office' }, -- other pgp = { ct = 'application/encrypted', type = 'encrypted' }, uue = { ct = 'application/x-uuencoded', type = 'binary', }, -- Types that are detected by Rspamd itself -- Archives zip = { ct = 'application/zip', type = 'archive', }, rar = { ct = 'application/x-rar', type = 'archive', }, ['7z'] = { ct = 'x-7z-compressed', type = 'archive', }, gz = { ct = 'application/gzip', type = 'archive', }, -- Images png = { ct = 'image/png', type = 'image', av_check = false, }, gif = { ct = 'image/gif', type = 'image', av_check = false, }, jpg = { ct = 'image/jpeg', type = 'image', av_check = false, }, bmp = { type = 'image', ct = 'image/bmp', av_check = false, }, dwg = { type = 'image', ct = 'image/vnd.dwg', }, -- Text xml = { ct = 'application/xml', type = 'text', no_text = true, }, txt = { type = 'text', ct = 'text/plain', av_check = false, }, html = { type = 'text', ct = 'text/html', av_check = false, }, csv = { type = 'text', ct = 'text/csv', av_check = false, no_text = true, }, ics = { type = 'text', ct = 'text/calendar', av_check = false, no_text = true, }, vcf = { type = 'text', ct = 'text/vcard', av_check = false, no_text = true, }, eml = { type = 'message', ct = 'message/rfc822', av_check = false, }, } return types
-- -- init script content -- -- This file will be run once after deployment to configure the Application Solution. -- print("Begin initialization.") -- default_dashboard_config = '{ -- "allow_edit": true, -- "columns": 3, -- "datasources": [ -- { -- "name": "00:11:22:33:44:55 Timeseries", -- "settings": { -- "method": "GET", -- "name": "00:11:22:33:44:55 Timeseries", -- "refresh": 3, -- "url": "/v1/data/00:11:22:33:44:55", -- "use_thingproxy": false -- }, -- "type": "JSON" -- } -- ], -- "panes": [ -- { -- "col": { -- "3": 3, -- "4": -7, -- "5": 4 -- }, -- "col_width": "1", -- "row": { -- "3": 1, -- "4": 1, -- "5": 1 -- }, -- "title": "Temperature Metrics", -- "widgets": [ -- { -- "settings": { -- "max_value": 100, -- "min_value": "-100", -- "title": "temp", -- "units": "Fahrenheit", -- "value": "datasources[\"00:11:22:33:44:55 Timeseries\"][\"values\"][0][5]" -- }, -- "type": "gauge" -- } -- ], -- "width": 1 -- }, -- { -- "col": { -- "3": 2, -- "4": 3, -- "5": 1 -- }, -- "col_width": 1, -- "row": { -- "3": 1, -- "4": 1, -- "5": 5 -- }, -- "title": "On time", -- "widgets": [ -- { -- "settings": { -- "animate": true, -- "size": "regular", -- "title": "ontime", -- "units": "", -- "value": "datasources[\"00:11:22:33:44:55 Timeseries\"][\"values\"][0][4]" -- }, -- "type": "text_widget" -- } -- ], -- "width": 1 -- }, -- { -- "col": { -- "3": 1, -- "4": 4, -- "5": 4 -- }, -- "col_width": "1", -- "row": { -- "3": 1, -- "4": 1, -- "5": 13 -- }, -- "title": "SWITCH 1", -- "widgets": [ -- { -- "settings": { -- "animate": true, -- "size": "regular", -- "title": "usrsw1", -- "value": "datasources[\"00:11:22:33:44:55 Timeseries\"][\"values\"][0][6]" -- }, -- "type": "text_widget" -- } -- ], -- "width": 1 -- }, -- { -- "col": { -- "3": 2, -- "4": 3, -- "5": 1 -- }, -- "col_width": 1, -- "row": { -- "3": 5, -- "4": 5, -- "5": 9 -- }, -- "title": "LED D1", -- "widgets": [ -- { -- "settings": { -- "title": "led", -- "value": "datasources[\"00:11:22:33:44:55 Timeseries\"][\"values\"][0][3]" -- }, -- "type": "indicator" -- } -- ], -- "width": 1 -- }, -- { -- "col": { -- "3": 1 -- }, -- "col_width": 1, -- "row": { -- "3": 5 -- }, -- "title": "SWITCH 2", -- "widgets": [ -- { -- "settings": { -- "animate": true, -- "size": "regular", -- "title": "usrsw2", -- "value": "datasources[\"00:11:22:33:44:55 Timeseries\"][\"values\"][0][5]" -- }, -- "type": "text_widget" -- } -- ], -- "width": 1 -- } -- ], -- "plugins": [], -- "version": 1 -- }' -- local ex, err = to_json(default_dashboard_config) -- if ex ~= nil then -- print(ex) -- local got = Keystore.set{key='dashboard.0', value=ex} -- if got.code ~= nil then -- print("End initialization. Init was successful!") -- end -- else -- print("Initialization ERROR!") -- end
-- ULX < -- -- > ulx.LSAddXP -- > args: caller, target, xp function ulx.LSAddXP( ply, trg, xp ) if not xp then return ULib.tsayError( "XP amount is not specified!" ) end trg:LSAddXP( xp ) ulx.fancyLogAdmin( ply, "#A add #i XP to #T !", xp, trg ) end local LSAddXP = ulx.command( "guthlevelsystem", "ulx lsaddxp", ulx.LSAddXP, "!lsaddxp" ) LSAddXP:addParam( { type = ULib.cmds.PlayerArg } ) LSAddXP:addParam( { type = ULib.cmds.NumArg, hint = "xp" } ) LSAddXP:defaultAccess( ULib.ACCESS_SUPERADMIN ) LSAddXP:help( "Add XP to a specified player." ) -- > ulx.LSSetXP -- > args: caller, target, xp function ulx.LSSetXP( ply, trg, xp ) if not xp then return ULib.tsayError( "XP amount is not specified!" ) end trg:LSSetXP( xp ) ulx.fancyLogAdmin( ply, "#A set XP to #i to #T !", xp, trg ) end local LSAddXP = ulx.command( "guthlevelsystem", "ulx lsaddxp", ulx.LSAddXP, "!lsaddxp" ) LSAddXP:addParam( { type = ULib.cmds.PlayerArg } ) LSAddXP:addParam( { type = ULib.cmds.NumArg, hint = "xp" } ) LSAddXP:defaultAccess( ULib.ACCESS_SUPERADMIN ) LSAddXP:help( "Add XP to a specified player." ) -- > ulx.LSSetLVL -- > args: caller, target, level function ulx.LSSetLVL( ply, trg, lvl ) if not lvl then return ULib.tsayError( "Level amount is not specified!" ) end trg:LSSetLVL( lvl ) ulx.fancyLogAdmin( ply, "#A set LVL #i to #T !", lvl, trg ) end local LSSetLVL = ulx.command( "guthlevelsystem", "ulx lssetlvl", ulx.LSSetLVL, "!lssetlvl" ) LSSetLVL:addParam( { type=ULib.cmds.PlayerArg } ) LSSetLVL:addParam( { type=ULib.cmds.NumArg, hint="lvl" } ) LSSetLVL:defaultAccess( ULib.ACCESS_SUPERADMIN ) LSSetLVL:help( "Set LVL to a specified player." ) -- > ulx.LSAddLVL -- > args: caller, target, level function ulx.LSAddLVL( ply, trg, lvl ) if not lvl then return ULib.tsayError( "Level amount is not specified!" ) end trg:LSAddLVL( lvl ) ulx.fancyLogAdmin( ply, "#A add #i LVL to #T !", lvl, trg ) end local LSAddLVL = ulx.command( "guthlevelsystem", "ulx lsaddlvl", ulx.LSAddLVL, "!lsaddlvl" ) LSAddLVL:addParam( { type = ULib.cmds.PlayerArg } ) LSAddLVL:addParam( { type = ULib.cmds.NumArg, hint = "lvl" } ) LSAddLVL:defaultAccess( ULib.ACCESS_SUPERADMIN ) LSAddLVL:help( "Add LVL to a specified player." ) print( "[guthlevelsystem] - ULX Module loaded succesfully" )
registerNpc(112, { walk_speed = 200, run_speed = 460, scale = 105, r_weapon = 0, l_weapon = 0, level = 38, hp = 32, attack = 154, hit = 119, def = 145, res = 81, avoid = 30, attack_spd = 90, is_magic_damage = 0, ai_type = 107, give_exp = 45, drop_type = 151, drop_money = 25, drop_item = 60, union_number = 60, need_summon_count = 0, sell_tab0 = 0, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 230, npc_type = 2, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); registerNpc(179, { walk_speed = 200, run_speed = 700, scale = 120, r_weapon = 0, l_weapon = 0, level = 42, hp = 49, attack = 170, hit = 133, def = 159, res = 89, avoid = 33, attack_spd = 105, is_magic_damage = 0, ai_type = 267, give_exp = 45, drop_type = 152, drop_money = 25, drop_item = 32, union_number = 32, need_summon_count = 0, sell_tab0 = 0, sell_tab1 = 0, sell_tab2 = 0, sell_tab3 = 0, can_target = 0, attack_range = 250, npc_type = 2, hit_material_type = 1, face_icon = 0, summon_mob_type = 0, quest_type = 0, height = 0 }); function OnInit(entity) return true end function OnCreate(entity) return true end function OnDelete(entity) return true end function OnDead(entity) end function OnDamaged(entity) end
local fficlass = require("fficlass") local vec3, meta = fficlass.new("typedef struct {float x, y, z;} vec3;") local new = vec3.new local sqrt = math.sqrt local null = new(0, 0, 0) vec3.null = null function vec3.dot(a, b) return a.x*b.x + a.y*b.y + a.z*b.z end function vec3.cross(a, b) return new( a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x ) end function vec3.square(a) return a.x*a.x + a.y*a.y + a.z*a.z end --magnitude of vector function vec3.norm(a) return sqrt(a.x*a.x + a.y*a.y + a.z*a.z) end --unitize assuming norm > 0 function vec3.posUnit(a) local l = sqrt(a.x*a.x + a.y*a.y + a.z*a.z) return new(a.x/l, a.y/l, a.z/l) end --unitize no assumptions function vec3.unit(a) local l = sqrt(a.x*a.x + a.y*a.y + a.z*a.z) if l > 0 then return new(a.x/l, a.y/l, a.z/l) end return null end function vec3.dump(a) return a.x, a.y, a.z end function vec3.quat(q) local i, j, k = self:dump() local w, x, y, z = q:dumpH() return new( i*(1 - y*y - z*z) + j*(x*y - w*z) + k*(x*z + w*y), i*(x*y + w*z) + j*(1 - x*x - z*z) + k*(y*z - w*x), i*(x*z - w*y) + j*(y*z + w*x) + k*(1 - x*x - y*y) ) end function vec3.invQuat(q) local i, j, k = self:dump() local w, x, y, z = q:dumpH() return new( i*(1 - y*y - z*z) + j*(x*y + w*z) + k*(x*z - w*y), i*(x*y - w*z) + j*(1 - x*x - z*z) + k*(y*z + w*x), i*(x*z + w*y) + j*(y*z - w*x) + k*(1 - x*x - y*y) ) end function meta.__add(a, b) return new( a.x + b.x, a.y + b.y, a.z + b.z ) end function meta.__sub(a, b) return new( a.x - b.x, a.y - b.y, a.z - b.z ) end function meta.__mul(a, b) local atype = type(a) if atype == "number" then return new(a*b.x, a*b.y, a*b.z) else return new( a.xx*b.x + a.yx*b.y + a.zx*b.z, a.xy*b.x + a.yy*b.y + a.zy*b.z, a.xz*b.x + a.yz*b.y + a.zz*b.z ) end end function meta.__div(a, b) return new(a.x/b, a.y/b, a.z/b) end function meta.__unm(a) return new(-a.x, -a.y, -a.z) end function meta.__tostring(a) return "vec3("..a.x..", "..a.y..", "..a.z..")" end return vec3
require 'setup/setup' local dummy = { dummy = "dummy" } -- we fulfill or reject with this when we don't intend to test against it describe("2.3.4: If `x` is not an object or function, fulfill `promise` with `x`", function() local function testValue(expectedValue, stringRepresentation, beforeEachHook, afterEachHook) describe("The value is " .. stringRepresentation, function() if (type(beforeEachHook) == "function") then before_each(beforeEachHook) end if (type(afterEachHook) == "function") then after_each(afterEachHook) end testFulfilled(dummy, function(promise1, done) local promise2 = promise1:Then(function() return expectedValue end) promise2:Then(function(actualValue) assert.equal(actualValue, expectedValue) done() end) end) testRejected(dummy, function(promise1, done) local promise2 = promise1:Then(nil, function() return expectedValue end) promise2:Then(function(actualValue) assert.equal(actualValue, expectedValue) done() end) end) end) end testValue(nil, "`nil`") testValue(false, "`false`") testValue(true, "`true`") testValue(0, "`0`") testValue("test", "'test'") end)
BigWigs:AddColors("Commander Sarannis", { [-5411] = {"cyan","yellow"}, [34794] = {"blue","red"}, [35096] = "orange", }) BigWigs:AddColors("High Botanist Freywinn", { [34550] = {"green","red"}, [34752] = {"blue","orange"}, }) BigWigs:AddColors("Thorngrin the Tender", { [34659] = {"blue","red"}, [34661] = {"blue","yellow"}, [34670] = {"blue","orange"}, }) BigWigs:AddColors("Laj", { [34697] = {"blue","red"}, }) BigWigs:AddColors("Warp Splinter", { [-5478] = {"green","red"}, [34716] = {"blue","orange"}, })
target("ResignTool") add_rules("xcode.application") add_files("**.m") add_files("ResignTool/*.xcassets") add_files("ResignTool/**.storyboard") add_files("ResignTool/Info.plist") add_includedirs("ResignTool/Entity", "ResignTool/Factory", "ResignTool/Util") add_frameworks("Security")
local F, C, L = unpack(select(2, ...)) -- Actionbar L['ACTIONBAR_LEAVE_VEHICLE'] = 'Leave vehicle button' -- Quest L['QUEST_ACCEPT_QUEST'] = 'Accept quest: ' L['QUEST_QUICK_QUEST'] = 'Auto quest' -- misc L['MISC_STRANGER'] = 'Stranger' L['MISC_GET_NAKED'] = 'Double click to remove gears' L['NAKE_BUTTON'] = 'Undress' L['ACCOUNT_KEYSTONES'] = 'Account keystones' L['MISC_REPUTATION'] = 'Reputation' L['MISC_PARAGON'] = 'Paragon' L['MISC_PARAGON_REPUTATION'] = 'Paragon reputation' L['MISC_PARAGON_NOTIFY'] = '巅峰声望已满注意兑换' L['MISSING_BUFF'] = 'Missing' L['Pull'] = 'Pull in 10s!' L['AutoQuest'] = 'Auto quest' L['InviteInfo'] = 'Accepted invite from' L['InviteEnable'] = 'Autoinvite ON' L['InviteDisable'] = 'Autoinvite OFF' L['MISC_STACK_BUYING_CHECK'] = 'Are you sure to buy |cffff0000a stack|r of these?' L['MISC_ARCHAEOLOGY_COUNT'] = 'Statistics of Archaeology' L['MISC_DISBAND_GROUP'] = 'Disbanding group' L['MISC_DISBAND_GROUP_CHECK'] = 'Are you sure you want to disband the group?' L['MISC_NUMBER_CAP_1'] = '' L['MISC_NUMBER_CAP_2'] = '' L['MISC_NUMBER_CAP_3'] = '' L['MISC_SHOW_HELM'] = 'Show helm' L['MISC_SHOW_CLOAK'] = 'Show cloak' -- notification L['NOTIFICATION_RARE'] = 'Rare nearby! ' L['NOTIFICATION_INTERRUPTED'] = 'Interrupted: ' L['NOTIFICATION_DISPELED'] = 'Dispeled: ' L['NOTIFICATION_STOLEN'] = 'Stolen: ' L['NOTIFICATION_RESNOTARGET'] = '<Attention>: %s casted %s!' L['NOTIFICATION_RESTARGET'] = '<Attention>: %s casted %s on %s!' L['NOTIFICATION_BOTTOY'] = '<Attention>: %s puts %s!' L['NOTIFICATION_FEAST'] = '<Attention>: %s puts %s!' L['NOTIFICATION_PORTAL'] = '<Attention>: %s opened %s!' L['NOTIFICATION_REFRESHMENTTABLE'] = '<Attention>: %s casted %s!' L['NOTIFICATION_RITUALOFSUMMONING'] = '<Attention>: %s is casting %s!' L['NOTIFICATION_SOULWELL'] = '<Attention>: %s casted %s!' L['NOTIFICATION_ACCEPT_QUEST'] = 'Accept quest: ' L['NOTIFICATION_NEW_MAIL'] = 'You have new mail.' L['NOTIFICATION_BAG_FULL'] = 'Your bags are full.' L['NOTIFICATION_MAIL'] = 'MAIL' L['NOTIFICATION_BAG'] = 'BAG' L['NOTIFICATION_REPAIR'] = 'REPAIR' L['NOTIFICATION_SELL'] = 'SELL' -- infobar L['INFOBAR_WOW'] = '<World of Warcraft>' L['INFOBAR_BN'] = '<Battle.NET>' L['INFOBAR_NO_ONLINE'] = 'No friends online at the moment.' L['INFOBAR_HOLD_SHIFT'] = 'Hold <Shift>' L['INFOBAR_OPEN_FRIENDS_PANEL'] = 'Open friends panel' L['INFOBAR_ADD_FRIEND'] = 'Add friend' L['INFOBAR_EARNED'] = 'Earned' L['INFOBAR_SPENT'] = 'Spent' L['INFOBAR_DEFICIT'] = 'Deficit' L['INFOBAR_PROFIT'] = 'Profit' L['INFOBAR_SESSION'] = 'Session' L['INFOBAR_TOKEN_PRICE'] = 'Token price' L['INFOBAR_CHARACTER'] = 'Characters in realm' L['INFOBAR_OPEN_CURRENCY_PANEL'] = 'Open currency panel' L['INFOBAR_RESET_GOLD_COUNT'] = 'Are you sure to reset the gold count?' L['INFOBAR_OPEN_SPEC_PANEL'] = 'Open talent panel' L['INFOBAR_CHANGE_SPEC'] = 'Change specialization' L['INFOBAR_CHANGE_LOOT_SPEC'] = 'Change loot specialization' L['INFOBAR_SPEC'] = 'Spec' L['INFOBAR_LOOT'] = 'Loot' L['INFOBAR_DAILY_WEEKLY_INFO'] = 'Daily/weekly information' L['INFOBAR_INVASION_LEG'] = 'Legion Invasion' L['INFOBAR_INVASION_BFA'] = 'Faction Invasion' L['INFOBAR_INVASION_CURRENT'] = 'Current' L['INFOBAR_INVASION_NEXT'] = 'Next' L['INFOBAR_OPEN_GARRION_REPORT'] = 'Open mission report' L['INFOBAR_BLINGTRON'] = 'Blingtron Daily Gift' L['INFOBAR_MEAN_ONE'] = 'Feast of Winter Veil' L['INFOBAR_TIMEWARPED'] = '500 Timewarped Badges' L['INFOBAR_ISLAND'] = 'progress' L['INFOBAR_LOCAL_TIME'] = 'Local Time' L['INFOBAR_REALM_TIME'] = 'Realm Time' L['INFOBAR_OPEN_ADDON_PANEL'] = 'Open addon list panel' L['INFOBAR_OPEN_TIMER_TRACKER'] = 'Open timer panel' L['INFOBAR_HANDS'] = 'Hands' L['INFOBAR_FEET'] = 'Feet' L['INFOBAR_OPEN_CHARACTER_PANEL'] = 'Open character panel' L['INFOBAR_INFO'] = 'Information' L['INFOBAR_AUTO_SELL_JUNK'] = 'Auto sell junk' L['INFOBAR_AUTO_REPAIR'] = 'Auto repair' L['INFOBAR_GUILD_REPAIR_COST'] = 'Guild repair' L['INFOBAR_REPAIR_COST'] = 'Repair cost' L['INFOBAR_REPAIR_FAILED'] = 'You have insufficient funds to repair your equipment!' -- inventory L['INVENTORY_SORT'] = 'Sort items' L['INVENTORY_RESET'] = 'Reset position' L['INVENTORY_BAGS'] = 'Open bags bar' L['INVENTORY_EQUIPEMENTSET'] = 'EquipmentSet Items' L['INVENTORY_DELETE_MODE_ENABLED'] = 'Item quickly delete mode enabled! You can destroy container item by holding CTRL+ALT. The item quality must be lower then rare (blue).' L['INVENTORY_DELETE_MODE_DISABLED'] = 'Item quickly delete mode disabled.' L['INVENTORY_DELETE_MODE'] = 'Enable quickly delete mode' L['INVENTORY_MECHAGON_STUFF'] = 'Mechagon stuff' -- mover L['MOVER_PANEL'] = 'Mover console' L['MOVER_GRID'] = 'Grids' L['MOVER_TOOLTIP'] = 'tooltip' L['MOVER_MINIMAP'] = 'minimap' L['MOVER_RESET_CONFIRM'] = 'Are you sure to reset frames position?' L['MOVER_CANCEL_CONFIRM'] = 'Are you sure to reverse your positioning?' L['MOVER_UNITFRAME_PLAYER'] = 'player' L['MOVER_UNITFRAME_PET'] = 'pet' L['MOVER_UNITFRAME_TARGET'] = 'target' L['MOVER_UNITFRAME_TARGETTARGET'] = 'targettarget' L['MOVER_UNITFRAME_FOCUS'] = 'focus' L['MOVER_UNITFRAME_FOCUSTARGET'] = 'focustarget' L['MOVER_UNITFRAME_BOSS'] = 'boss' L['MOVER_UNITFRAME_ARENA'] = 'arena' L['MOVER_UNITFRAME_PARTY'] = 'party' L['MOVER_UNITFRAME_RAID'] = 'raid' L['MOVER_UNITFRAME_PLAYER_CASTBAR'] = 'palyer castbar' L['MOVER_UNITFRAME_TARGET_CASTBAR'] = 'target castbar' L['MOVER_COMBATTEXT_INFORMATION'] = 'combat text (information)' L['MOVER_COMBATTEXT_OUTGOING'] = 'combat text (outgoing)' L['MOVER_COMBATTEXT_INCOMING'] = 'combat text (incoming)' L['MOVER_BUFFS'] = 'buffs' L['MOVER_DEBUFFS'] = 'debuffs' L['MOVER_QUAKE_TIMER'] = 'quake timer' L['MOVER_OBJECTIVE_TRACKER'] = 'objective tracker' L['MOVER_VEHICLE_INDICATOR'] = 'vehicle indicator' L['MOVER_DURABILITY_INDICATOR'] = 'durability indicator' L['MOVER_ALERT_FRAMES'] = 'alert frames' -- Chat L['CHAT_HIDE'] = 'Hide chat frame' L['CHAT_SHOW'] = 'Show chat frame' L['CHAT_JOIN_WC'] = 'Join world channel (only for Chinese player)' L['CHAT_LEAVE_WC'] = 'Leave world channel' L['CHAT_COPY'] = 'Chat copy' -- Tooltip L['TOOLTIP_AURA_FROM'] = 'Castby' L['TOOLTIP_RARE'] = 'Rare' L['TOOLTIP_SELL_PRICE'] = 'Sell price' L['TOOLTIP_STACK_CAP'] = 'Stack caps' L['TOOLTIP_AZERITE_TRAIT'] = 'Azerite trait' L['TOOLTIP_SECTION'] = 'Section' L['TOOLTIP_TARGETED'] = 'Targeted' -- Map L['MAP_PLAYER'] = 'Player' L['MAP_CURSOR'] = 'Cursor' L['MAP_REVEAL'] = 'Map reveal' -- Install L['INSTALL_HEADER_HELLO'] = 'Hello' L['INSTALL_HEADER_1'] = '1. CVars' L['INSTALL_HEADER_2'] = '2. UI Scale' L['INSTALL_HEADER_3'] = '3. Chat' L['INSTALL_HEADER_4'] = '4. AddOns' L['INSTALL_HEADER_5'] = 'Success!' L['INSTALL_BODY_WELCOME'] = "Thank you for choosing FreeUI!\n\nIn just a moment, you can get started. All that's needed is for the correct settings to be applied. Don't worry, none of your personal preferences will be changed.\n\nYou can also take a brief tutorial on some of the features of FreeUI, which is recommended if you're a new user.\n\nPress the 'Tutorial' button to do so now, or press 'Install' to go straight to the setup." L['INSTALL_BODY_1'] = "These steps will apply the correct setup for FreeUI.\n\nThe first step applies the essential settings.\n\nThis is recommended for any user, unless you want to apply only a specific part of the settings.\n\nClick 'Continue' to apply the settings, or click 'Skip' if you wish to skip this step." L['INSTALL_BODY_2'] = 'The second step applies the correct UI scale.' L['INSTALL_BODY_3'] = 'The third step applies the chat settings.' L['INSTALL_BODY_4'] = "The fouth and final step applies proper settings for addons Bigwigs and Skada." L['INSTALL_BODY_5'] = "Installation is complete.\n\nPlease click the 'Finish' button to reload the UI.\n\nEnjoy!" L['INSTALL_BUTTON_TUTORIAL'] = 'Tutorial' L['INSTALL_BUTTON_INSTALL'] = 'Install' L['INSTALL_BUTTON_SKIP'] = 'Skip' L['INSTALL_BUTTON_CONTINUE'] = 'Continue' L['INSTALL_BUTTON_FINISH'] = 'Finish' -- Slash commands L['RELOAD_CHECK'] = '|cffff2735|cffff2735You need to reload the UI to apply your changes.\n\nWould you like to do so now?|r|r' L['UIHELP'] = 'Type in /freeui for more help.' L['SLASHCMD_HELP'] = { 'Slash commands:', '/rl - Reload UI', '/rc - Ready check', '/rp - Roll poll', '/gm - Open help panel', '/gc - Party/raid convert', '/lg - Leave group', '/rs - Reset instance', '/ss - Screenshot', '/clear - Clear chat', '/tt - Whisper to target', '/spec - Switch specialization', '/freeui install - Open FreeUI install panel', '/freeui config - Open FreeUI config panel', '/freeui unlock - Unlock UI elements to move them', '/freeui reset - Reset all saved options data', '/freeui clickcast - Open click cast panel', }
-- ========== THIS IS AN AUTOMATICALLY GENERATED FILE! ========== PlaceObj('StoryBit', { ActivationEffects = {}, Category = "RocketLandingAttempt", Effects = {}, EnableChance = 30, Enabled = true, Image = "UI/Messages/Events/21_meteors.tga", NotificationText = "", Prerequisites = { PlaceObj('CheckObjectCount', { 'Label', "AllRockets", 'Filters', {}, 'Condition', ">=", 'Amount', 2, }), PlaceObj('IsSolInRange', { 'Min', 10, 'Max', 200, }), PlaceObj('IsRocketType', { 'Type', "Cargo", }), PlaceObj('IsSupplyPod', { 'Negate', true, }), PlaceObj('IsMapEnvironment', nil), }, ScriptDone = true, Text = T(975948320076, --[[StoryBit BadRocketLanding Text]] "Our <DisplayName> Rocket seems to have suffered a malfunction in her fuel tank. There are worries that the Rocket won’t survive the landing sequence.\n\nIf the Rocket lands successfully we can fix the malfunction with some polymers."), TextReadyForValidation = true, TextsDone = true, Title = T(566155432260, --[[StoryBit BadRocketLanding Title]] "Rocket Malfunction"), Trigger = "RocketLandAttempt", VoicedText = T(334816819426, --[[voice:narrator]] "The satellite camera shows the rocket you are trying to land in standard Mars orbit. A small jet of liquid is gushing out from the side."), group = "Rocket", id = "BadRocketLanding", qa_info = PlaceObj('PresetQAInfo', { data = {}, }), PlaceObj('StoryBitReply', { 'Text', T(277165707548, --[[StoryBit BadRocketLanding Text]] "Attempt the landing with full payload."), 'OutcomeText', "custom", 'CustomOutcomeText', T(410458673918, --[[StoryBit BadRocketLanding CustomOutcomeText]] "chance that the rocket will explode"), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Weight', 70, 'Effects', {}, }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Weight', 30, 'Text', T(107166396798, --[[StoryBit BadRocketLanding Text]] "Unfortunately the malfunction affected our rocket’s landing trajectory and threw her off course resulting in a crash landing. We have lost both the rocket and her cargo."), 'Effects', { PlaceObj('EraseObject', nil), }, }), PlaceObj('StoryBitReply', { 'Text', T(453335601416, --[[StoryBit BadRocketLanding Text]] "Jettison the payload, then land."), 'OutcomeText', "custom", 'CustomOutcomeText', T(293832717522, --[[StoryBit BadRocketLanding CustomOutcomeText]] "safe landing but cargo is lost"), }), PlaceObj('StoryBitOutcome', { 'Prerequisites', {}, 'Effects', { PlaceObj('DeleteCargo', nil), }, }), PlaceObj('StoryBitReply', { 'Text', T(891532965126, --[[StoryBit BadRocketLanding Text]] "Activate manual control, I can land this one safely."), 'OutcomeText', "custom", 'CustomOutcomeText', T(896111041996, --[[StoryBit BadRocketLanding CustomOutcomeText]] "rocket will land safely with cargo"), 'Prerequisite', PlaceObj('IsCommander', { 'CommanderProfile', "rocketscientist", }), }), })
require('themer').setup({ colorscheme = "gruvbox-material-dark-soft", styles = { comment = { style = 'italic' }, ["function"] = { style = 'italic' }, functionbuiltin = { style = 'italic' }, variable = { style = 'italic' }, variableBuiltIn = { style = 'italic' }, parameter = { style = 'italic' }, }, plugins = { telescope = false, } })
return { name = "Stone", desc = "Rough and tough", sprite = 'stone', usage = 'wall' }
local Context = require 'stuart.Context' local stuart = require 'stuart' local RedisContext = stuart.class(Context) return RedisContext
local function build(id, instance_id, name, address) local now = os.time() local retval = { obsess_over_host = true, no_more_notifications = false, check_attempt = 1, icon_image_alt = "", enabled = true, host_id = id, state = 0, last_update = now, address = address, last_check = now - 10, notify_on_recovery = false, freshness_threshold = 0, default_active_checks = true, notification_period = "24x7", action_url = "", check_type = 0, retain_nonstatus_information = true, default_event_handler_enabled = true, last_time_up = now, instance_id = instance_id, check_period = "24x7", first_notification_delay = 0, last_hard_state = 0, event_handler = "", element = 12, stalk_on_down = false, latency = 0.134, low_flap_threshold = 0, last_state_change = now - 300, timezone = ":Europe/Paris", next_check = now + 300, should_be_scheduled = true, flap_detection = true, notify_on_down = true, notification_interval = 0, icon_image = "Brands/vmware.png", scheduled_downtime_depth = 0, notify_on_downtime = false, perfdata = "rta=2.326ms", output = "OK - vcenter-paris: rta 2.326ms, lost 0%\n", name = name, check_command = "check-bench-alive", acknowledgement_type = 0, statusmap_image = "Brands/vmware.png", execution_time = 0.018, acknowledged = false, stalk_on_up = false, active_checks = true, default_notify = false, stalk_on_unreachable = false, max_check_attempts = 5, retry_interval = 1, default_flap_detection = true, default_passive_checks = false, last_hard_state_change = now, notification_number = 0, display_name = "vcenter-paris", category = 1, high_flap_threshold = 0, check_interval = 3, alias = "vcenter-paris", passive_checks = false, checked = true, _type = 65548, notify_on_unreachable = false, state_type = 1, notify_on_flapping = false, notes_url = "", notify = false, percent_state_change = 0, notes = "", flap_detection_on_unreachable = true, flap_detection_on_up = true, flapping = false, check_freshness = false, flap_detection_on_down = true, retain_status_information = true, event_handler_enabled = true } return retval end local hosts = { name = "Hosts", -- id: instance id -- name: instance name -- engine: Monitoring engine name in this instance -- pid: Monitoring engine pid -- -- return: a neb::instance event build = function (stack, count, conn) print("BUILD HOST") local host_count = count.host local poller_count = count.instance broker_log:info(0, "BUILD HOSTS ; host_count = " .. host_count .. " ; poller_count = " .. poller_count) for j = 1,poller_count do for i = 1,host_count do table.insert( stack, build(i + (j - 1) * host_count, j, "host_" .. i .. j, "1.2.i." .. j)) end end broker_log:info(0, "BUILD HOSTS => FINISHED") end, check = function (conn, count) local host_count = count.host local poller_count = count.instance local now = os.time() broker_log:info(0, "CHECK HOSTS") local retval = true local cursor, error_str = conn["storage"]:execute([[SELECT host_id, instance_id from hosts ORDER BY host_id]]) local row = cursor:fetch({}, "a") local id = 1 local instance_id = 1 while row do broker_log:info(1, "Check for host " .. id) if tonumber(row.host_id) ~= id or tonumber(row.instance_id) ~= instance_id then broker_log:error(0, "Row found host_id = " .. row.host_id .. " instance_id = " .. row.instance_id .. " instead of host_id = " .. id .. " and instance_id = " .. instance_id) retval = false break end if id % host_count == 0 then instance_id = instance_id + 1 end id = id + 1 row = cursor:fetch({}, "a") end if id <= host_count * poller_count then broker_log:info(0, "NOT FINISHED") retval = false end if not retval then broker_log:info(0, "CHECK_HOSTS => NOT DONE") else broker_log:info(0, "CHECK_HOSTS => DONE") end return retval end } return hosts
Grenade.kModelName = nil -- was PrecacheAsset("models/marine/rifle/rifle_grenade.model") Grenade.kProjectileCinematic = PrecacheAsset("cinematics/marine/grenade.cinematic")
-- JMS Dark theme -- 2019-01-26 local property = require('lexer').property property['colour.black'] = '#222222' property['colour.grey'] = '#777777' property['colour.white'] = '#DDDDDD' property['colour.red'] = '#FF0000' property['colour.yellow'] = '#E6DC65' property['colour.green'] = '#77C32F' property['colour.blue'] = '#67A2F0' property['colour.purple'] = '#AF82FF' -- Default style. property['style.default'] = 'fore:$(colour.white),back:$(colour.black)' -- Token styles. property['style.nothing'] = '' property['style.whitespace'] = '$(style.nothing)' property['style.identifier'] = 'fore:$(colour.white)' property['style.comment'] = 'fore:$(colour.grey)' property['style.error'] = 'fore:$(colour.red)' property['style.constant'] = 'fore:$(colour.yellow)' property['style.label'] = 'fore:$(colour.yellow)' property['style.regex'] = 'fore:$(colour.yellow)' property['style.variable'] = 'fore:$(colour.yellow)' property['style.number'] = 'fore:$(colour.green)' property['style.class'] = 'fore:$(colour.blue)' property['style.definition'] = 'fore:$(colour.blue)' property['style.embedded'] = 'fore:$(colour.blue)' property['style.function'] = 'fore:$(colour.blue)' property['style.keyword'] = 'fore:$(colour.blue)' property['style.operator'] = 'fore:$(colour.blue)' property['style.preprocessor'] = 'fore:$(colour.blue)' property['style.tag'] = 'fore:$(colour.blue)' property['style.type'] = 'fore:$(colour.blue)' property['style.string'] = 'fore:$(colour.purple)' -- Predefined styles. property['style.indentguide'] = 'fore:$(colour.grey)'
require "sloongnet_mysql" local Sql_Req = {}; local db = sloongnet_mysql.new(); local res,msg = db:Connect('127.0.0.1',3389,'root','pwe','db'); Sloongnet_ShowLog(msg); local log_ptr = Sloongnet_GetLogObject(); sloongnet_mysql.SetLog(log_ptr,true,true) Sql_Req.SqlTest = function( u, req, res ) local cmd = req['cmd'] or ''; local code,res = db:Query(cmd); return code,res end g_sql_function = { ['RunSql'] = Sql_Req.SqlTest, } AddModule(g_sql_function);
vim.api.nvim_set_keymap('n', '<Leader>t', ':TagbarToggle<CR>', {noremap = true})
if ACF.Version then --fallback to old acf, its not set in acf3 function ACF_DefineEngineold(id,data) ACF_DefineEngine(id,data) end else local class = "zACFE R" local typeoverwrite = nil -- Flat 2 engines ACF.RegisterEngineClass(class, { Name = "ACFE Radial Engines", }) do function ACF_DefineEngineold(id,data) local Fueltype = {} if data.fuel == "Petrol" then Fueltype = { Petrol = true } end if data.fuel == "Diesel" then Fueltype = { Diesel = true } end if data.fuel == "Multifuel" then Fueltype = { Petrol = true, Diesel = true } end if data.fuel == "Electric" then Fueltype = { Electric = true } end ACF.RegisterEngine(id, class, { Name = data.name, Description = data.desc, Model = data.model, Sound = data.sound, Fuel = Fueltype, Type = typeoverwrite or data.enginetype, Mass = data.weight, Torque = data.torque, FlywheelMass = data.flywheelmass, RPM = { Idle = data.idlerpm, PeakMin = data.peakminrpm, PeakMax = data.peakmaxrpm, Limit = data.limitrpm, }, }) end end end -- Radial engines ACF_DefineEngineold( "R3-1.2", { name = "R3 1.2L Petrol", desc = "[ACFE] A tiny, old worn-out radial.", model = "models/engines/radial3s.mdl", sound = "acf_engines/r7_petrolsmall.wav", category = "Radial", fuel = "Petrol", enginetype = "Radial", weight = 70, torque = 120, flywheelmass = 0.10, idlerpm = 710, peakminrpm = 2800, peakmaxrpm = 4600, limitrpm = 5000 } ) ACF_DefineEngineold( "R3-5.0", { name = "R3 5.0 Petrol", desc = "[ACFE] Mid range radial, thirsty and smooth", model = "models/engines/radial3m.mdl", sound = "acf_engines/r7_petrolmedium.wav", category = "Radial", fuel = "Petrol", enginetype = "Radial", weight = 240, torque = 340, flywheelmass = 0.35, idlerpm = 700, peakminrpm = 2300, peakmaxrpm = 3800, limitrpm = 4000 } ) ACF_DefineEngineold( "R3-11.0", { name = "R3 11.0L Petrol", desc = "[ACFE] Massive American radial monster, destined for aircraft and heavy things.", model = "models/engines/radial3b.mdl", sound = "acf_engines/r7_petrollarge.wav", category = "Radial", fuel = "Petrol", enginetype = "Radial", weight = 600, torque = 1025, flywheelmass = 3, idlerpm = 760, peakminrpm = 2200, peakmaxrpm = 3400, limitrpm = 3800 } )
local _, ns = ... local oUF = ns.oUF or oUF assert(oUF, 'oUF Experience was unable to locate oUF install') for tag, func in next, { ['experience:cur'] = function(unit) return (IsWatchingHonorAsXP() and UnitHonor or UnitXP) ('player') end, ['experience:max'] = function(unit) return (IsWatchingHonorAsXP() and UnitHonorMax or UnitXPMax) ('player') end, ['experience:per'] = function(unit) return math.floor(_TAGS['experience:cur'](unit) / _TAGS['experience:max'](unit) * 100 + 0.5) end, ['experience:currested'] = function() return (IsWatchingHonorAsXP() and GetHonorExhaustion or GetXPExhaustion) () end, ['experience:perrested'] = function(unit) local rested = _TAGS['experience:currested']() if(rested and rested > 0) then return math.floor(rested / _TAGS['experience:max'](unit) * 100 + 0.5) end end, } do oUF.Tags.Methods[tag] = func oUF.Tags.Events[tag] = 'PLAYER_XP_UPDATE PLAYER_LEVEL_UP UPDATE_EXHAUSTION HONOR_XP_UPDATE HONOR_LEVEL_UPDATE HONOR_PRESTIGE_UPDATE' end oUF.Tags.SharedEvents.PLAYER_LEVEL_UP = true local function UpdateTooltip(element) local isHonor = IsWatchingHonorAsXP() local cur = (isHonor and UnitHonor or UnitXP)('player') local max = (isHonor and UnitHonorMax or UnitXPMax)('player') local per = math.floor(cur / max * 100 + 0.5) local bars = cur / max * (isHonor and 5 or 20) local rested = (isHonor and GetHonorExhaustion or GetXPExhaustion)() or 0 rested = math.floor(rested / max * 100 + 0.5) GameTooltip:SetText(format('%s / %s (%d%%)', BreakUpLargeNumbers(cur), BreakUpLargeNumbers(max), per), 1, 1, 1) GameTooltip:AddLine(format('%.1f bars, %d rested', bars, rested)) GameTooltip:Show() end local function OnEnter(element) element:SetAlpha(element.inAlpha) GameTooltip:SetOwner(element, element.tooltipAnchor) element:UpdateTooltip() end local function OnLeave(element) GameTooltip:Hide() element:SetAlpha(element.outAlpha) end local function UpdateColor(element, showHonor) if(showHonor) then element:SetStatusBarColor(1, 1/4, 0) if(element.SetAnimatedTextureColors) then element:SetAnimatedTextureColors(1, 1/4, 0) end if(element.Rested) then element.Rested:SetStatusBarColor(1, 3/4, 0) end else element:SetStatusBarColor(1/6, 2/3, 1/5) if(element.SetAnimatedTextureColors) then element:SetAnimatedTextureColors(1/6, 2/3, 1/5) end if(element.Rested) then element.Rested:SetStatusBarColor(0, 2/5, 1) end end end local function Update(self, event, unit) if(self.unit ~= unit or unit ~= 'player') then return end local element = self.Experience if(element.PreUpdate) then element:PreUpdate(unit) end local showHonor = IsWatchingHonorAsXP() local level = (showHonor and UnitHonorLevel or UnitLevel)(unit) local cur = (showHonor and UnitHonor or UnitXP)(unit) local max = (showHonor and UnitHonorMax or UnitXPMax)(unit) if(showHonor and level == GetMaxPlayerHonorLevel()) then cur, max = 1, 1 end if(element.SetAnimatedValues) then element:SetAnimatedValues(cur, 0, max, level) else element:SetMinMaxValues(0, max) element:SetValue(cur) end local exhaustion if(element.Rested) then exhaustion = (showHonor and GetHonorExhaustion or GetXPExhaustion)() or 0 element.Rested:SetMinMaxValues(0, max) element.Rested:SetValue(math.min(cur + exhaustion, max)) end (element.OverrideUpdateColor or UpdateColor)(element, showHonor) if(element.PostUpdate) then return element:PostUpdate(unit, cur, max, exhaustion, level, showHonor) end end local function Path(self, ...) return (self.Experience.Override or Update) (self, ...) end local function ElementEnable(self) local element = self.Experience self:RegisterEvent('PLAYER_XP_UPDATE', Path) self:RegisterEvent('HONOR_LEVEL_UPDATE', Path) self:RegisterEvent('HONOR_PRESTIGE_UPDATE', Path) if(element.Rested) then self:RegisterEvent('UPDATE_EXHAUSTION', Path) end element:Show() element:SetAlpha(element.outAlpha or 1) Path(self, 'ElementEnable', 'player') end local function ElementDisable(self) self:UnregisterEvent('PLAYER_XP_UPDATE', Path) self:UnregisterEvent('HONOR_LEVEL_UPDATE', Path) self:UnregisterEvent('HONOR_PRESTIGE_UPDATE', Path) if(self.Experience.Rested) then self:UnregisterEvent('UPDATE_EXHAUSTION', Path) end self.Experience:Hide() Path(self, 'ElementDisable', 'player') end local function Visibility(self, event, unit) local element = self.Experience local shouldEnable if(not UnitHasVehicleUI('player') and not IsXPUserDisabled()) then if(UnitLevel('player') ~= element.__accountMaxLevel) then shouldEnable = true elseif(IsWatchingHonorAsXP() and element.__accountMaxLevel == MAX_PLAYER_LEVEL) then shouldEnable = true end end if(shouldEnable) then ElementEnable(self) else ElementDisable(self) end end local function VisibilityPath(self, ...) return (self.Experience.OverrideVisibility or Visibility)(self, ...) end local function ForceUpdate(element) return VisibilityPath(element.__owner, 'ForceUpdate', element.__owner.unit) end local function Enable(self, unit) local element = self.Experience if(element and unit == 'player') then element.__owner = self local levelRestriction = GetRestrictedAccountData() if(levelRestriction > 0) then element.__accountMaxLevel = levelRestriction else element.__accountMaxLevel = MAX_PLAYER_LEVEL end element.ForceUpdate = ForceUpdate self:RegisterEvent('PLAYER_LEVEL_UP', VisibilityPath, true) self:RegisterEvent('HONOR_LEVEL_UPDATE', VisibilityPath) self:RegisterEvent('DISABLE_XP_GAIN', VisibilityPath, true) self:RegisterEvent('ENABLE_XP_GAIN', VisibilityPath, true) hooksecurefunc('SetWatchingHonorAsXP', function() if(self:IsElementEnabled('Experience')) then VisibilityPath(self, 'SetWatchingHonorAsXP', 'player') end end) local child = element.Rested if(child) then child:SetFrameLevel(element:GetFrameLevel() - 1) if(not child:GetStatusBarTexture()) then child:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]]) end end if(not element:GetStatusBarTexture()) then element:SetStatusBarTexture([[Interface\TargetingFrame\UI-StatusBar]]) end if(element:IsMouseEnabled()) then element.UpdateTooltip = element.UpdateTooltip or UpdateTooltip element.tooltipAnchor = element.tooltipAnchor or 'ANCHOR_BOTTOMRIGHT' element.inAlpha = element.inAlpha or 1 element.outAlpha = element.outAlpha or 1 if(not element:GetScript('OnEnter')) then element:SetScript('OnEnter', OnEnter) end if(not element:GetScript('OnLeave')) then element:SetScript('OnLeave', OnLeave) end end return true end end local function Disable(self) local element = self.Experience if(element) then self:UnregisterEvent('PLAYER_LEVEL_UP', VisibilityPath) self:UnregisterEvent('HONOR_LEVEL_UPDATE', VisibilityPath) self:UnregisterEvent('DISABLE_XP_GAIN', VisibilityPath) self:UnregisterEvent('ENABLE_XP_GAIN', VisibilityPath) ElementDisable(self) end end oUF:AddElement('Experience', VisibilityPath, Enable, Disable)
local _M={} local default_language="en" local path='init.international.' local language_list={ zh_cn="zh_cn", en="en", } for k,v in pairs(language_list) do _M[k] = require (path..v); end return _M;
local L = pace.LanguageString local acsfnc = function(key, def) pace["View" .. key] = def pace["SetView" .. key] = function(val) pace["View" .. key] = val end pace["GetView" .. key] = function() return pace["View" .. key] or def end end acsfnc("Entity", NULL) acsfnc("Pos", Vector(5,5,5)) acsfnc("Angles", Angle(0,0,0)) acsfnc("FOV", 75) function pace.GetViewEntity() return pace.ViewEntity:IsValid() and pace.ViewEntity or LocalPlayer() end function pace.ResetView() if pace.Focused then local ent = pace.GetViewEntity() if not ent:IsValid() then local _, part = next(pac.GetLocalParts()) if part then ent = part:GetOwner() end end if ent:IsValid() then local fwd = ent.EyeAngles and ent:EyeAngles() or ent:GetAngles() -- Source Engine local angles fix if ent == pac.LocalPlayer and ent:GetVehicle():IsValid() then local ang = ent:GetVehicle():GetAngles() fwd = fwd + ang end fwd = fwd:Forward() fwd.z = 0 pace.ViewPos = ent:EyePos() + fwd * 128 pace.ViewAngles = (ent:EyePos() - pace.ViewPos):Angle() pace.ViewAngles:Normalize() end end end function pace.SetZoom(fov, smooth) if smooth then pace.ViewFOV = Lerp(FrameTime()*10, pace.ViewFOV, math.Clamp(fov,1,100)) else pace.ViewFOV = math.Clamp(fov,1,100) end end local worldPanel = vgui.GetWorldPanel(); function worldPanel.OnMouseWheeled( self, scrollDelta ) if IsValid(pace.Editor) then local zoom_usewheel = GetConVar( "pac_zoom_mousewheel" ) if zoom_usewheel:GetInt() == 1 then local speed = 10 if input.IsKeyDown(KEY_LSHIFT) then speed = 50 end if input.IsKeyDown(KEY_LCONTROL) then speed = 1 end if vgui.GetHoveredPanel() == worldPanel then pace.Editor.zoomslider:SetValue(pace.ViewFOV - (scrollDelta * speed)) end end end end local held_ang = Angle(0,0,0) local held_mpos = Vector(0,0,0) local mcode, hoveredPanelCursor, isHoldingMovement function pace.GUIMousePressed(mc) if pace.mctrl.GUIMousePressed(mc) then return end if mc == MOUSE_LEFT and not pace.editing_viewmodel then held_ang = pace.ViewAngles * 1 held_mpos = Vector(gui.MousePos()) end if mc == MOUSE_RIGHT then pace.Call("OpenMenu") end hoveredPanelCursor = vgui.GetHoveredPanel() if IsValid(hoveredPanelCursor) then hoveredPanelCursor:SetCursor('sizeall') end mcode = mc isHoldingMovement = true end function pace.GUIMouseReleased(mc) isHoldingMovement = false if IsValid(hoveredPanelCursor) then hoveredPanelCursor:SetCursor('none') hoveredPanelCursor = nil end if pace.mctrl.GUIMouseReleased(mc) then return end if pace.editing_viewmodel or pace.editing_hands then return end mcode = nil end local function set_mouse_pos(x, y) gui.SetMousePos(x, y) held_ang = pace.ViewAngles * 1 held_mpos = Vector(x, y) return held_mpos * 1 end local WORLD_ORIGIN = Vector(0, 0, 0) local function CalcDrag() if pace.BusyWithProperties:IsValid() or pace.ActiveSpecialPanel:IsValid() or pace.editing_viewmodel or pace.editing_hands or pace.properties.search:HasFocus() then return end local focus = vgui.GetKeyboardFocus() if focus and focus:IsValid() and focus:GetName():lower():find('textentry') then return end if not system.HasFocus() then held_mpos = Vector(gui.MousePos()) end local ftime = FrameTime() * 50 local mult = 5 if input.IsKeyDown(KEY_LCONTROL) or input.IsKeyDown(KEY_RCONTROL) then mult = 0.1 end if IsValid(pace.current_part) then local origin local owner = pace.current_part:GetOwner(true) if owner == pac.WorldEntity and owner:IsValid() then if pace.current_part:HasChildren() then for key, child in ipairs(pace.current_part:GetChildren()) do if not child.NonPhysical then origin = child:GetDrawPosition() if origin == WORLD_ORIGIN then origin = LocalPlayer():GetPos() end break end end else origin = LocalPlayer():GetPos() end if not origin then origin = LocalPlayer():GetPos() end else if not owner:IsValid() then owner = pac.LocalPlayer end if pace.current_part.NonPhysical then origin = owner:GetPos() else origin = pace.current_part:GetDrawPosition() end end mult = mult * math.min(origin:Distance(pace.ViewPos) / 200, 3) else mult = mult * math.min(LocalPlayer():GetPos():Distance(pace.ViewPos) / 200, 3) end if input.IsKeyDown(KEY_LSHIFT) then mult = mult + 5 end if not pace.IsSelecting then if mcode == MOUSE_LEFT then local mpos = Vector(gui.MousePos()) if mpos.x >= ScrW() - 1 then mpos = set_mouse_pos(1, gui.MouseY()) elseif mpos.x < 1 then mpos = set_mouse_pos(ScrW() - 2, gui.MouseY()) end if mpos.y >= ScrH() - 1 then mpos = set_mouse_pos(gui.MouseX(), 1) elseif mpos.y < 1 then mpos = set_mouse_pos(gui.MouseX(), ScrH() - 2) end local delta = (held_mpos - mpos) / 5 * math.rad(pace.ViewFOV) pace.ViewAngles.p = math.Clamp(held_ang.p - delta.y, -90, 90) pace.ViewAngles.y = held_ang.y + delta.x end end if input.IsKeyDown(KEY_W) then pace.ViewPos = pace.ViewPos + pace.ViewAngles:Forward() * mult * ftime elseif input.IsKeyDown(KEY_S) then pace.ViewPos = pace.ViewPos - pace.ViewAngles:Forward() * mult * ftime end if input.IsKeyDown(KEY_D) then pace.ViewPos = pace.ViewPos + pace.ViewAngles:Right() * mult * ftime elseif input.IsKeyDown(KEY_A) then pace.ViewPos = pace.ViewPos - pace.ViewAngles:Right() * mult * ftime end if input.IsKeyDown(KEY_SPACE) then if not IsValid(pace.timeline.frame) then pace.ViewPos = pace.ViewPos + pace.ViewAngles:Up() * mult * ftime end end --[[if input.IsKeyDown(KEY_LALT) then pace.ViewPos = pace.ViewPos + pace.ViewAngles:Up() * -mult * ftime end]] end local follow_entity = CreateClientConVar("pac_camera_follow_entity", "0", true) local lastEntityPos function pace.CalcView(ply, pos, ang, fov) if pace.editing_viewmodel or pace.editing_hands then pace.ViewPos = pos pace.ViewAngles = ang pace.ViewFOV = fov return end if follow_entity:GetBool() then local ent = pace.GetViewEntity() local pos = ent:GetPos() lastEntityPos = lastEntityPos or pos pace.ViewPos = pace.ViewPos + pos - lastEntityPos lastEntityPos = pos else lastEntityPos = nil end local pos, ang, fov = pac.CallHook("EditorCalcView", pace.ViewPos, pace.ViewAngles, pace.ViewFOV) if pos then pace.ViewPos = pos end if ang then pace.ViewAngles = ang end if fov then pace.ViewFOV = fov end return { origin = pace.ViewPos, angles = pace.ViewAngles, fov = pace.ViewFOV, } end function pace.ShouldDrawLocalPlayer() if not pace.editing_viewmodel and not pace.editing_hands then return true end end local notifText local notifDisplayTime, notifDisplayTimeFade = 0, 0 function pace.FlashNotification(text, timeToDisplay) timeToDisplay = timeToDisplay or math.Clamp(#text / 6, 1, 8) notifDisplayTime = RealTime() + timeToDisplay notifDisplayTimeFade = RealTime() + timeToDisplay * 1.1 notifText = text end function pace.PostRenderVGUI() if not pace.mctrl then return end local time = RealTime() if notifDisplayTimeFade > time then if notifDisplayTime > time then surface.SetTextColor(color_white) else surface.SetTextColor(255, 255, 255, 255 * (notifDisplayTimeFade - RealTime()) / (notifDisplayTimeFade - notifDisplayTime)) end surface.SetFont('Trebuchet18') local w = surface.GetTextSize(notifText) surface.SetTextPos(ScrW() / 2 - w / 2, 30) surface.DrawText(notifText) end if not isHoldingMovement then return end if pace.mctrl.LastThinkCall ~= FrameNumber() then surface.SetFont('Trebuchet18') surface.SetTextColor(color_white) local text = L'You are currently holding the camera, movement is disabled' local w = surface.GetTextSize(text) surface.SetTextPos(ScrW() / 2 - w / 2, 10) surface.DrawText(text) end end function pace.EnableView(b) if b then pac.AddHook("GUIMousePressed", "editor", pace.GUIMousePressed) pac.AddHook("GUIMouseReleased", "editor", pace.GUIMouseReleased) pac.AddHook("ShouldDrawLocalPlayer", "editor", pace.ShouldDrawLocalPlayer, DLib and -4 or ULib and -1 or nil) pac.AddHook("CalcView", "editor", pace.CalcView, DLib and -4 or ULib and -1 or nil) pac.AddHook("HUDPaint", "editor", pace.HUDPaint) pac.AddHook("HUDShouldDraw", "editor", pace.HUDShouldDraw) pac.AddHook("PostRenderVGUI", "editor", pace.PostRenderVGUI) pace.Focused = true pace.ResetView() else lastEntityPos = nil pac.RemoveHook("GUIMousePressed", "editor") pac.RemoveHook("GUIMouseReleased", "editor") pac.RemoveHook("ShouldDrawLocalPlayer", "editor") pac.RemoveHook("CalcView", "editor") pac.RemoveHook("HUDPaint", "editor") pac.RemoveHook("HUDShouldDraw", "editor") pac.RemoveHook("PostRenderVGUI", "editor") pace.SetTPose(false) pace.SetBreathing(false) end end local function CalcAnimationFix(ent) if ent.SetEyeAngles then ent:SetEyeAngles(Angle(0,0,0)) end end local reset_pose_params = { "body_rot_z", "spine_rot_z", "head_rot_z", "head_rot_y", "head_rot_x", "walking", "running", "swimming", "rhand", "lhand", "rfoot", "lfoot", "move_yaw", "aim_yaw", "aim_pitch", "breathing", "vertical_velocity", "vehicle_steer", "body_yaw", "spine_yaw", "head_yaw", "head_pitch", "head_roll", } function pace.GetTPose() return pace.tposed end function pace.SetViewPart(part, reset_campos) pace.SetViewEntity(part:GetOwner(true)) if reset_campos then pace.ResetView() end end function pace.HUDPaint() if mcode and not input.IsMouseDown(mcode) then mcode = nil end local ent = pace.GetViewEntity() if pace.IsFocused() then CalcDrag() if ent:IsValid() then pace.Call("Draw", ScrW(), ScrH()) end end end function pace.HUDShouldDraw(typ) if typ == "CHudEPOE" or (typ == "CHudCrosshair" and (pace.editing_viewmodel or pace.editing_hands)) then return false end end
object_tangible_furniture_lifeday_lifeday_incense_burner = object_tangible_furniture_lifeday_shared_lifeday_incense_burner:new { } ObjectTemplates:addTemplate(object_tangible_furniture_lifeday_lifeday_incense_burner, "object/tangible/furniture/lifeday/lifeday_incense_burner.iff")
function love.conf(t) t.title = ":Fast :Food - Ludum Dare #27 Jam" t.author = "Cassassin-LPGhatguy" t.url = "https://lpghatguy.com/" t.identity = "ld-ff" t.version = "0.8.0" t.console = false t.release = true t.screen.width = 100 t.screen.height = 100 t.screen.fullscreen = false t.screen.vsync = true t.screen.fsaa = 0 t.modules.joystick = true t.modules.audio = true t.modules.keyboard = true t.modules.event = true t.modules.image = true t.modules.graphics = true t.modules.timer = true t.modules.mouse = true t.modules.sound = true t.modules.physics = true end
class "SharedUnlocks" local g_Logger = require "__shared/Logger" function SharedUnlocks:__init() g_Logger:Write("Shared Unlocks Init.") self.m_ModifiedKitId = Guid("28ec16e7-0bbf-4cb0-9321-473c6ec54125", "D") self.m_ModifiedKit = nil self.m_NoSpecializationInstance = nil self.m_SprintBoostL2Instance = nil end function SharedUnlocks:OnReadInstance(p_Instance, p_Guid) if p_Instance == nil then return end self:SetUnlocks(p_Instance, p_Guid) end function SharedUnlocks:LockHumans(p_Instance) local s_Instance = CustomizationUnlockParts(p_Instance) --g_Logger:Write("LockHumans CategoryID: " .. s_Instance.uICategorySid) if s_Instance.uICategorySid == "ID_M_SOLDIER_GADGET2" or s_Instance.uICategorySid == "GADGET1" or s_Instance.uICategorySid == "ID_M_SOLDIER_GADGET1" then -- Remove all current unlocks s_Instance:ClearSelectableUnlocks() g_Logger:Write("Cleared unlocks for " .. s_Instance.uICategorySid) end -- Check to see if this instance we just cleared out local s_Count = s_Instance:GetSelectableUnlocksCount() if s_Count == 0 then return end -- Remove grenades and the medic bag s_Count = s_Count - 1 for i=s_Count,0,-1 do local s_UnlockInstance = s_Instance:GetSelectableUnlocksAt(i) if s_UnlockInstance.typeName == "SoldierWeaponUnlockAsset" then local s_Unlock = SoldierWeaponUnlockAsset(s_UnlockInstance) local s_Name = s_Unlock.name:lower() if string.find(s_Name, "m67") ~= nil or string.find(s_Name, "medicbag") ~= nil then s_Instance:RemoveSelectableUnlocksAt(i) end end end if self:IsSpecializationUnlocks(s_Instance) then print("Found Specializations") local s_NoSpecializationName = "Weapons/Common/NoSpecialization" self.s_NoSpecializationInstance = self:GetUnlockByName(s_Instance, s_NoSpecializationName:lower()) if self.s_NoSpecializationInstance == nil then g_Logger:Write("NoSpecialization Instance is nil.") return end s_Instance:ClearSelectableUnlocks() s_Instance:AddSelectableUnlocks(self.s_NoSpecializationInstance) g_Logger:Write("Modified specializations.") end end function SharedUnlocks:LockZombies(p_Instance) local s_Instance = CustomizationUnlockParts(p_Instance) g_Logger:Write("LockZombies CategoryID: " .. s_Instance.uICategorySid) if s_Instance.uICategorySid == "ID_M_SOLDIER_PRIMARY" or s_Instance.uICategorySid == "ID_M_SOLDIER_SECONDARY" or s_Instance.uICategorySid == "ID_M_SOLDIER_GADGET2" or s_Instance.uICategorySid == "GADGET1" or s_Instance.uICategorySid == "ID_M_SOLDIER_GADGET1" then -- Remove all current unlocks s_Instance:ClearSelectableUnlocks() g_Logger:Write("Cleared unlocks for " .. s_Instance.uICategorySid) end local s_Count = s_Instance:GetSelectableUnlocksCount() if s_Count == 0 then return end s_Count = s_Count - 1 for i=s_Count,0,-1 do local s_UnlockInstance = s_Instance:GetSelectableUnlocksAt(i) if s_UnlockInstance.typeName == "SoldierWeaponUnlockAsset" then local s_Unlock = SoldierWeaponUnlockAsset(s_UnlockInstance) local s_Name = s_Unlock.name:lower() if string.find(s_Name, "m67") ~= nil or string.find(s_Name, "medicbag") ~= nil then s_Instance:RemoveSelectableUnlocksAt(i) end end end if self:IsSpecializationUnlocks(s_Instance) then print("Found Specializations") local s_NoSpecializationName = "Weapons/Common/NoSpecialization" local s_SprintBoostL2Name = "Persistence/Unlocks/Soldiers/Specializations/SprintBoostL2" self.s_NoSpecializationInstance = self:GetUnlockByName(s_Instance, s_NoSpecializationName:lower()) self.s_SprintBoostL2Instance = self:GetUnlockByName(s_Instance, s_SprintBoostL2Name:lower()) if self.s_NoSpecializationInstance == nil then g_Logger:Write("NoSpecialization Instance is nil.") return end if self.s_SprintBoostL2Instance == nil then g_Logger:Write("SprintBoostL2 Instance is nil.") return end s_Instance:ClearSelectableUnlocks() --s_Instance:AddSelectableUnlocks(self.s_NoSpecializationInstance) s_Instance:AddSelectableUnlocks(self.s_SprintBoostL2Instance) g_Logger:Write("Modified specializations.") end end function SharedUnlocks:IsSpecializationUnlocks(p_Instance) local s_Instance = CustomizationUnlockParts(p_Instance) local s_Count = s_Instance:GetSelectableUnlocksCount() if s_Count == 0 then return false end local s_UnlockInstance = s_Instance:GetSelectableUnlocksAt(0) --g_Logger:Write("UnlockInstance: " .. s_UnlockInstance.typeName) if s_UnlockInstance.typeName == "ValueUnlockAsset" then local s_Unlock = ValueUnlockAsset(s_UnlockInstance) local s_Name = s_Unlock.name:lower() --g_Logger:Write("Unlock: " .. s_Name) if string.find(s_Name, "persistence/unlocks/soldiers/specializations") ~= nil then return true end end return false end function SharedUnlocks:GetUnlockByName(p_Instance, p_Name) local s_Instance = CustomizationUnlockParts(p_Instance) --g_Logger:Write("1") local s_Count = s_Instance:GetSelectableUnlocksCount() if s_Count == 0 then return nil end s_Count = s_Count - 1 --g_Logger:Write("2") for i=s_Count,0,-1 do local s_UnlockInstance = s_Instance:GetSelectableUnlocksAt(i) --g_Logger:Write("UnlockInstance: " .. s_UnlockInstance.typeName) if s_UnlockInstance.typeName == "ValueUnlockAsset" then --g_Logger:Write("3") local s_Unlock = ValueUnlockAsset(s_UnlockInstance) local s_Name = s_Unlock.name:lower() --g_Logger:Write("Unlock: " .. s_Name) if string.find(s_Name, p_Name) ~= nil then --g_Logger:Write("4") return s_UnlockInstance end end if s_UnlockInstance.typeName == "UnlockAsset" then --g_Logger:Write("3") local s_Unlock = UnlockAsset(s_UnlockInstance) local s_Name = s_Unlock.name:lower() --g_Logger:Write("Unlock: " .. s_Name) if string.find(s_Name, p_Name) ~= nil then --g_Logger:Write("4") return s_UnlockInstance end end end return nil end function SharedUnlocks:RunUnlocks(p_Name, p_Table) local s_UnlockCount = p_Table:GetUnlockPartsCount() - 1 for i=s_UnlockCount,0,-1 do local s_UnlockPart = p_Table:GetUnlockPartsAt(i) if string.find(p_Name, "gameplay/kits/ru") ~= nil then g_Logger:Write("Locking Zombies Team " .. p_Name) self:LockZombies(s_UnlockPart) end if string.find(p_Name, "gameplay/kits/us") ~= nil then g_Logger:Write("Locking Humans Team " .. p_Name) self:LockHumans(s_UnlockPart) end p_Table:SetUnlockPartsAt(i, s_UnlockPart) end end function SharedUnlocks:SetUnlocks(p_Instance, p_Guid) if p_Instance.typeName == "VeniceSoldierCustomizationAsset" then local s_Instance = VeniceSoldierCustomizationAsset(p_Instance) local s_Name = s_Instance.name:lower() local s_WeaponTable = s_Instance.weaponTable local s_SpecializationTable = s_Instance.specializationTable self:RunUnlocks(s_Name, s_WeaponTable) self:RunUnlocks(s_Name, s_SpecializationTable) end end return SharedUnlocks
slot0 = class("SkillInfoMediator", import("..base.ContextMediator")) slot0.WARP_TO_TACTIC = "SkillInfoMediator:WARP_TO_TACTIC" slot0.WARP_TO_META_TACTICS = "SkillInfoMediator:WARP_TO_METATASK" slot1 = 10 slot0.register = function (slot0) slot0:bind(slot0.WARP_TO_TACTIC, function (slot0) slot1 = getProxy(NavalAcademyProxy) slot2 = slot1:getStudents() slot3 = 0 slot4 = 0 for slot9 = 1, slot1.MAX_SKILL_CLASS_NUM, 1 do if slot2[slot9] then slot3 = slot3 + 1 else slot4 = slot9 break end end if slot1:getSkillClassNum() <= slot3 then pg.TipsMgr.GetInstance():ShowTips(i18n("tactics_lesson_full")) slot0.viewComponent:close() return end if table.getCount(getProxy(BagProxy).getItemsByType(slot7, slot1) or {}) <= 0 then pg.TipsMgr.GetInstance():ShowTips(i18n("tactics_no_lesson")) slot0.viewComponent:close() return end for slot12, slot13 in pairs(slot2) do if slot13.shipId == slot0.contextData.shipId then pg.TipsMgr.GetInstance():ShowTips(i18n("tactics_lesson_repeated")) slot0.viewComponent:close() return end end getProxy(BayProxy):setSelectShipId(nil) slot0.viewComponent:close() slot0:sendNotification(GAME.GO_SCENE, SCENE.NAVALACADEMYSCENE, { warp = NavalAcademyScene.WARP_TO_TACTIC, shipToLesson = { shipId = slot0.contextData.shipId, skillIndex = slot0.contextData.index, index = slot4 } }) end) slot0.bind(slot0, slot0.WARP_TO_META_TACTICS, function (slot0, slot1) slot0.viewComponent:close() slot0:sendNotification(GAME.GO_SCENE, SCENE.METACHARACTER, { autoOpenTactics = true, autoOpenShipConfigID = slot1 }) end) end slot0.listNotificationInterests = function (slot0) return {} end slot0.handleNotification = function (slot0, slot1) slot2 = slot1:getName() slot3 = slot1:getBody() end return slot0
local M = {} function M.setup() require('gitsigns').setup { signs = { add = {hl = 'GitGutterAdd', text = '▋'}, change = {hl = 'GitGutterChange',text= '▋'}, delete = {hl= 'GitGutterDelete', text = '▁'}, topdelete = {hl ='GitGutterDeleteChange',text = '▔'}, changedelete = {hl = 'GitGutterChange', text = '▎'}, }, -- keymaps = { -- -- Default keymap options -- noremap = true, -- buffer = true, -- ['n ]g'] = { expr = true, "&diff ? ']g' : '<cmd>lua require\"gitsigns\".next_hunk()<CR>'"}, -- ['n [g'] = { expr = true, "&diff ? '[g' : '<cmd>lua require\"gitsigns\".prev_hunk()<CR>'"}, -- ['n <leader>hs'] = '<cmd>lua require"gitsigns".stage_hunk()<CR>', -- ['n <leader>hu'] = '<cmd>lua require"gitsigns".undo_stage_hunk()<CR>', -- ['n <leader>hr'] = '<cmd>lua require"gitsigns".reset_hunk()<CR>', -- ['n <leader>hp'] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', -- ['n <leader>hb'] = '<cmd>lua require"gitsigns".blame_line()<CR>', -- -- Text objects -- ['o ih'] = ':<C-U>lua require"gitsigns".text_object()<CR>', -- ['x ih'] = ':<C-U>lua require"gitsigns".text_object()<CR>' -- }, } end return M
measure = {} -- Definitions measure.screen_width = 960 measure.screen_height = 600 measure.board_width = 600 measure.board_height = 468 measure.piece_size = 64 measure.piece_amount = 16 measure.square_width = 9 measure.square_height = 7 -- Calculated values measure.board_x = (measure.screen_width - measure.board_width) / 2 measure.board_y = (measure.screen_height - measure.board_height) / 2
function fib(n, a, b) if n == 0 then return a elseif n == 1 then return b end return fib(n-1, b, a+b) end fib(35, 0, 1)
MaulerStrongholdScreenPlay = ScreenPlay:new { numberOfActs = 1, screenplayName = "MaulerStrongholdScreenPlay", lootContainers = { 625317, 625318, 8825382 }, lootLevel = 300, lootGroups = { { groups = { {group = "vehicledeedsnormal", chance = 1000000}, {group = "non_jedi_rings_ranged", chance = 2000000}, {group = "tierthree", chance = 2000000}, {group = "clothing_attachments", chance = 2500000}, {group = "armor_attachments", chance = 200000} }, lootChance = 8000000 } }, lootContainerRespawn = 1800 -- 30 minutes } registerScreenPlay("MaulerStrongholdScreenPlay", true) function MaulerStrongholdScreenPlay:start() if (isZoneEnabled("naboo")) then self:spawnMobiles() self:initializeLootContainers() end end function MaulerStrongholdScreenPlay:spawnMobiles() spawnMobile("naboo", "mauler",1800,2887.8,77.7,1190.7,-11,0) spawnMobile("naboo", "mauler",1800,2939.1,73.2,1195.3,7,0) spawnMobile("naboo", "mauler",1800,3020.6,76.3,1121,-8,0) spawnMobile("naboo", "mauler",1800,3022.7,75.8,1120.5,44,0) spawnMobile("naboo", "mauler",1800,2960.2,94.1,1082.1,15,0) spawnMobile("naboo", "mauler_master",1800,2903.8,117.8,1036.7,-6,0) spawnMobile("naboo", "mauler",1800,2901.6,118,1035.9,-9,0) spawnMobile("naboo", "mauler",1800,2846.6,97.3,1068.2,6,0) spawnMobile("naboo", "mauler",1800,2845.3,97.5,1068,-3,0) spawnMobile("naboo", "mauler",1800,2778.1,77.6,1143.3,-11,0) spawnMobile("naboo", "mauler",1800,2780.1,77.4,1143.3,-94,0) spawnMobile("naboo", "mauler",1800,2891.5,94,1117.2,7,0) spawnMobile("naboo", "mauler_master",1800,2890.7,94,1105.2,2,0) spawnMobile("naboo", "mauler",1800,2891.5,94,1104.5,28,0) spawnMobile("naboo", "mauler",1800,2901.8,94,1119.7,-146,0) spawnMobile("naboo", "mauler_acolyte",1800,2941.1,72.8,1195.2,-4,0) spawnMobile("naboo", "mauler_acolyte",1800,2910.5,94,1130.1,47,0) spawnMobile("naboo", "mauler_apprentice",1800,2928,94,1110.5,-90,0) spawnMobile("naboo", "mauler_apprentice",1800,2889.7,77.8,1190,0,0) spawnMobile("naboo", "mauler_lord",10800,2900.4,94,1128.9,108,0) spawnMobile("naboo", "mauler_master",1800,2918.2,95.5,1117.8,-1,0) spawnMobile("naboo", "mauler_master",1800,2958.5,94.1,1081,0,0) spawnMobile("naboo", "mauler_veermok",300,2924.5,94,1110.4,5,0) spawnMobile("naboo", "mauler",1800,5.4,0.7,-6.2,100,1696446) spawnMobile("naboo", "mauler_master",1800,5.1,0.7,-3.6,25,1696446) spawnMobile("naboo", "mauler",1800,-5.5,0.7,-1.7,-96,1696447) spawnMobile("naboo", "mauler",1800,-2,0.7,2.1,-5,1696447) end
local _ = require("lib.underscore") local stooge = { name = "moe" } print(_.property("name")(stooge) == "moe")
-- import local candy = require "candy" local GizmoManagerModule = require "candy_edit.EditorCanvas.GizmoManager" local Gizmo = GizmoManagerModule.Gizmo -------------------------------------------------------------------- ---@class DrawScriptGizmo : Gizmo local DrawScriptGizmo = CLASS: DrawScriptGizmo ( Gizmo ) function DrawScriptGizmo:__init () self.drawProp = MOAIGraphicsProp.new () self.drawDeck = MOAIDrawDeck.new () self.drawProp:setDeck ( self.drawDeck ) self.pickingTarget = false end function DrawScriptGizmo:setTransform ( transform ) inheritLoc ( self:getProp (), transform ) end function DrawScriptGizmo:setTarget ( object ) local drawOwner, onDrawGizmo = nil if self.onDrawGizmo then onDrawGizmo = self.onDrawGizmo drawOwner = self elseif object.onDrawGizmo then onDrawGizmo = object.onDrawGizmo drawOwner = object end if onDrawGizmo then self.drawDeck:setDrawCallback ( function ( ... ) local parent = self:getParent () ---@type GizmoManager return onDrawGizmo ( drawOwner, parent:isGizmoSelected ( self ), ... ) end ) end end function DrawScriptGizmo:setPickingTarget ( target ) self.pickingTarget = target end local ATTR_LOCAL_VISIBLE = MOAIProp. ATTR_LOCAL_VISIBLE local ATTR_VISIBLE = MOAIProp. ATTR_VISIBLE function DrawScriptGizmo:setParentEntity ( entity, propRole ) self:setPickingTarget ( entity ) local prop = entity:getProp ( propRole or 'render' ) -- inheritVisible ( self:getProp (), prop ) inheritLoc ( self:getProp (), prop ) end function DrawScriptGizmo:getPickingTarget () return self.pickingTarget end function DrawScriptGizmo:onLoad () self:_attachProp ( self.drawProp ) end function DrawScriptGizmo:onDestroy () Gizmo.onDestroy ( self ) self:_detachProp ( self.drawProp ) end function DrawScriptGizmo:isPickable () return self.pickingTarget and true or false end function DrawScriptGizmo:getPickingProp () return self.drawProp end return DrawScriptGizmo
---@class ItemType : zombie.inventory.ItemType ---@field public None ItemType ---@field public Weapon ItemType ---@field public Food ItemType ---@field public Literature ItemType ---@field public Drainable ItemType ---@field public Clothing ItemType ---@field public Key ItemType ---@field public KeyRing ItemType ---@field public Moveable ItemType ---@field public AlarmClock ItemType ---@field public AlarmClockClothing ItemType ---@field private index int ItemType = {} ---Returns an array containing the constants of this enum type, in --- ---the order they are declared. This method may be used to iterate --- ---over the constants as follows: --- --- --- ---for (ItemType c : ItemType.values()) --- ---  System.out.println(c); --- --- ---@public ---@return ItemType[] @an array containing the constants of this enum type, in the order they are declared function ItemType:values() end ---@public ---@return int function ItemType:index() end ---@public ---@param arg0 int ---@return ItemType function ItemType:fromIndex(arg0) end ---Returns the enum constant of this type with the specified name. --- ---The string must match exactly an identifier used to declare an --- ---enum constant in this type. (Extraneous whitespace characters are --- ---not permitted.) ---@public ---@param name String @the name of the enum constant to be returned. ---@return ItemType @the enum constant with the specified name function ItemType:valueOf(name) end
---@type mx.ndarray.ndarray|mx.ndarray.op local M = {} local _internal, contrib, linalg, op, random, sparse, utils, image, ndarray = require('mx.ndarray._internal'), require('mx.ndarray.contrib'), require('mx.ndarray.linalg'), require('mx.ndarray.op'), require('mx.ndarray.random'), require('mx.ndarray.sparse'), require('mx.ndarray.utils'), require('mx.ndarray.image'), require('mx.ndarray.ndarray') M._internal, M.contrib, M.linalg, M.op, M.random, M.sparse, M.utils, M.image, M.ndarray = _internal, contrib, linalg, op, random, sparse, utils, image, ndarray M.register = require('mx.ndarray.register') for k, v in pairs(require('mx.ndarray.op')) do M[k] = v end for k, v in pairs(require('mx.ndarray.ndarray')) do M[k] = v end M.NDArray = require('mx.ndarray.ndarray').NDArray M.load, M.load_frombuffer, M.save, M.zeros, M.empty, M.array = utils.load, utils.load_frombuffer, utils.save, utils.zeros, utils.empty, utils.array M._ndarray_cls = sparse._ndarray_cls M._GRAD_REQ_MAP, M._DTYPE_MX_TO_NP, M._DTYPE_NP_TO_MX, M._new_empty_handle = ndarray._GRAD_REQ_MAP, ndarray._DTYPE_MX_TO_NP, ndarray._DTYPE_NP_TO_MX, ndarray._new_empty_handle return M
local scrutinizer = scrutinizer local ipairs = ipairs local TEXT = TEXT local tostring = tostring local type = type local pairs = pairs local tonumber = tonumber local math_floor = math.floor local string_find = string.find local table_insert = table.insert local string_sub = string.sub local UnitName = UnitName local InPartyByName = InPartyByName local GetNumPartyMembers = GetNumPartyMembers scrutinizer.playerID = "player" scrutinizer.playerPetID = "pet" scrutinizer.partyID = {} for i = 1, 5 do scrutinizer.partyID[i] = "party"..i end function scrutinizer:IsBossByName(name) if scrutinizer.bossids then for _, id in ipairs(scrutinizer.bossids) do if name == TEXT("Sys"..id.."_name") then return true end end end return false end function scrutinizer:Print(txt, r, g, b) DEFAULT_CHAT_FRAME:AddMessage(tostring(txt), r or 1, g or 1, b or 1) end function scrutinizer:IsPartyMemberByName(name) if (name == UnitName(scrutinizer.playerID)) or InPartyByName(name) or (name == UnitName(scrutinizer.playerPetID)) then return true end return false end function scrutinizer:IsPlayerPet(name) if name == UnitName(scrutinizer.playerPetID) then return true end return false end function scrutinizer:GetUID(name) if name == UnitName(scrutinizer.playerID) then return scrutinizer.playerID elseif name == UnitName(scrutinizer.playerPetID) then return scrutinizer.playerPetID else for i = 1, GetNumPartyMembers() do if name == UnitName(scrutinizer.partyID[i]) then return scrutinizer.partyID[i] end end end return false end function scrutinizer:Toggle(f) if _G[f] then if _G[f]:IsVisible() then _G[f]:Hide() return false else _G[f]:Show() return true end end end function scrutinizer:GetNumTable(t) local c = 0 if type(t) == "table" then for k, v in pairs(t) do c = c + 1 end return c end return c end function scrutinizer:FormatValue(v) if not v then return end if not tonumber(v) then return v end v = tonumber(v) if v >= 1000000 then if v >= 10000000 then v = scrutinizer:Round(v/10000)/(100) else v = scrutinizer:Round(v/1000)/(1000) end return v.."m" elseif v >= 1000 then if v >= 100000 then v = scrutinizer:Round(v/100)/(10) else v = scrutinizer:Round(v/10)/(100) end return v.."k" else return scrutinizer:Round(v) end end function scrutinizer:Round(v) local p = math_floor(v) local s = v - p if s >= 0.5 then v = p + 1 else v = p end return v end
num_enemies = 1 boss_fight = true experience=1000 gold=1000 function start() addEnemy("Tode", 45, 105) end speech = { "Tode: I may be a vegetarian...\n", "Tode: But I will enjoy eating you!\n", } speechCount = 1 function get_speech() speechCount = speechCount + 1 return speech[speechCount-1] end function get_item() return -1 end
require "ninja" solution "ninjatestsln" location "build" configurations {"debug", "release"} project "ninjatestprj_app" kind "ConsoleApp" location "build" language "C++" targetdir "build/bin_%{cfg.buildcfg}" files {"main.cpp"} includedirs {"test1", "test2"} links {"ninjatestprj_lib_test1", "ninjatestprj_lib_test2"} filter "configurations:debug" defines {"DEBUG"} flags {"Symbols"} filter "configurations:release" defines {"NDEBUG"} optimize "On" project "ninjatestprj_lib_test1" kind "SharedLib" location "build" language "C++" targetdir "build/bin_%{cfg.buildcfg}" files {"test1/**.cpp", "test1/**.c", "test1/**.h"} includedirs {"test1"} defines {"DLL_EXPORT"} filter "configurations:debug" defines {"DEBUG"} flags {"Symbols"} filter "configurations:release" defines {"NDEBUG"} optimize "On" project "ninjatestprj_lib_test2" kind "SharedLib" location "build" language "C++" targetdir "build/bin_%{cfg.buildcfg}" files {"test2/**.cpp", "test2/**.c", "test2/**.h"} includedirs {"test2"} defines {"DLL_EXPORT2"} filter "configurations:debug" defines {"DEBUG"} flags {"Symbols"} filter "configurations:release" defines {"NDEBUG"} optimize "On"
-- Lua script to generate the implementations of RawSerialize and RawDeserialize for -- statically sized arrays. tys = "u8 i8 u16 i16 u32 i32 f32 u64 i64 f64 i128 u128" lens = "1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32" size = {1, 1, 2, 2, 4, 4, 4, 8, 8, 8, 8, 16, 16} i = 1 for ty in tys:gmatch("%w+") do for len in lens:gmatch("%d+") do print( "\nimpl RawSerialize for [" .. ty .. "; " .. len .. "] ".. "{\n " .. " fn raw_serialize(&self, to: &mut Write) -> Result<u64, Error> {\n" .. " let y = unsafe { slice::from_raw_parts(mem::transmute::<*const [ " .. ty .. "; " .. len .. "], *const u8>(&(*self) as *const [" .. ty .. "; " .. len .. "]), ".. len .." * " .. size[i] .. ")};\n" .. " check!(to.write_all(y));\n" .. " Ok(" .. tonumber(len) * size[i] .. ")" .. " }\n" .. "}\nimpl RawDeserialize for [" .. ty .. "; " .. len .. "] {\n" .. " fn raw_deserialize(from: &mut Read) -> Result<[" .. ty .. "; " .. len .. "], Error> {\n" .. " unsafe { let mut buffer: [" .. ty .. "; " .. len .. "] = [0" .. ty .. "; " .. len .. "];\n" .. " {\n check!(from.read_exact(slice::from_raw_parts_mut( mem::transmute::<*mut [ " .. ty .. "; " .. len .. "], *mut u8>((&mut buffer) as *mut [" .. ty .. "; " .. len .. "]), " .. tonumber(len) * size[i] .. ")));\n }\n" .. " Ok(buffer)\n" .. " }\n }\n" .. "\n}") end i = i + 1 end
array_decname = {"прве", "друге", "треће", "четврте", "пете", "шесте", "седме", "осме", "девете", "десете"} neparne_msg = "непарне" parne_msg = "парне"
local parquet_util = require 'parquet.util' describe('util', function() it('splice removes 1 element from index 4', function() -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice local myFish = {'angel', 'clown', 'drum', 'mandarin', 'sturgeon'} local removed = parquet_util.splice(myFish, 4, 1) assert.same({'mandarin'}, removed) assert.same({'angel', 'clown', 'drum', 'sturgeon'}, myFish) end) it('splice removes 2 elements from index 3', function() local myFish = {'parrot', 'anemone', 'blue', 'trumpet', 'sturgeon'} local removed = parquet_util.splice(myFish, 3, 2) assert.same({'parrot', 'anemone', 'sturgeon'}, myFish) assert.same({'blue', 'trumpet'}, removed) end) it('splice removes all elements after index 3 (inclusive)', function() local myFish = {'angel', 'clown', 'mandarin', 'sturgeon'} local removed = parquet_util.splice(myFish, 3) assert.same({'angel', 'clown'}, myFish) assert.same({'mandarin', 'sturgeon'}, removed) end) it('slice', function() -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice local animals = {'ant', 'bison', 'camel', 'duck', 'elephant'} assert.same({'camel', 'duck', 'elephant'}, parquet_util.slice(animals, 3)) assert.same({'camel', 'duck'}, parquet_util.slice(animals, 3, 5)) assert.same({'bison', 'camel', 'duck', 'elephant'}, parquet_util.slice(animals, 2, 6)) end) it('slice returns a portion of an existing array', function() -- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice local fruits = {'Banana', 'Orange', 'Lemon', 'Apple', 'Mango'} local citrus = parquet_util.slice(fruits, 2, 4) assert.same({'Orange', 'Lemon'}, citrus) end) it('more slice', function() local a = {'1:id', '2:point', '3:type', '4:size', '5:indices', '6:list', '7:element', '8:values', '9:list', '10:element'} local b = parquet_util.slice(a, 3, 8) assert.same({'3:type', '4:size', '5:indices', '6:list', '7:element'}, b) local c = parquet_util.slice(b, 4, 6) assert.same({'6:list', '7:element'}, c) local d = parquet_util.slice(c, 2,4) assert.same({'7:element'}, d) end) end)
-------------------------------------------------------------------------------- -- To catch the operation of the screen, and sends the event. <br> -------------------------------------------------------------------------------- local table = require("hp/lang/table") local Event = require("hp/event/Event") local EventDispatcher = require("hp/event/EventDispatcher") local M = EventDispatcher() local pointer = {x = 0, y = 0, down = false} local keyboard = {key = 0, down = false} local touchEventStack = {} local TOUCH_EVENTS = {} TOUCH_EVENTS[MOAITouchSensor.TOUCH_DOWN] = Event.TOUCH_DOWN TOUCH_EVENTS[MOAITouchSensor.TOUCH_UP] = Event.TOUCH_UP TOUCH_EVENTS[MOAITouchSensor.TOUCH_MOVE] = Event.TOUCH_MOVE TOUCH_EVENTS[MOAITouchSensor.TOUCH_CANCEL] = Event.TOUCH_CANCEL local function onTouch(eventType, idx, x, y, tapCount) -- event local event = touchEventStack[idx] or Event(TOUCH_EVENTS[eventType], M) local oldX, oldY = event.x, event.y event.type = TOUCH_EVENTS[eventType] event.idx = idx event.x = x event.y = y event.tapCount = tapCount if eventType == MOAITouchSensor.TOUCH_DOWN then touchEventStack[idx] = event elseif eventType == MOAITouchSensor.TOUCH_UP then touchEventStack[idx] = nil elseif eventType == MOAITouchSensor.TOUCH_MOVE then if oldX == nil or oldY == nil then return end event.moveX = event.x - oldX event.moveY = event.y - oldY touchEventStack[idx] = event elseif eventType == MOAITouchSensor.TOUCH_CANCEL then touchEventStack[idx] = nil end M:dispatchEvent(event) end local function onPointer(x, y) pointer.x = x pointer.y = y if pointer.down then onTouch(MOAITouchSensor.TOUCH_MOVE, 1, x, y, 1) end end local function onClick(down) pointer.down = down local eventType = nil if down then eventType = MOAITouchSensor.TOUCH_DOWN else eventType = MOAITouchSensor.TOUCH_UP end onTouch(eventType, 1, pointer.x, pointer.y, 1) end local function onKeyboard(key, down) keyboard.key = key keyboard.down = down local etype = down and Event.KEY_DOWN or Event.KEY_UP local event = Event:new(etype, M) event.key = key M:dispatchEvent(event) end -------------------------------------------------------------------------------- -- Initialize InputManager. <br> -- Register a callback function for input operations. -------------------------------------------------------------------------------- function M:initialize() -- コールバック関数の登録 if MOAIInputMgr.device.pointer then -- mouse input MOAIInputMgr.device.pointer:setCallback(onPointer) MOAIInputMgr.device.mouseLeft:setCallback(onClick) else -- touch input MOAIInputMgr.device.touch:setCallback(onTouch) end -- keyboard input if MOAIInputMgr.device.keyboard then MOAIInputMgr.device.keyboard:setCallback(onKeyboard) end end function M:isKeyDown(key) if MOAIInputMgr.device.keyboard then return MOAIInputMgr.device.keyboard:keyIsDown(key) end end return M
local typedefs = require "kong.db.schema.typedefs" local plugin_name = ({...})[1]:match("^kong%.plugins%.([^%.]+)") string.startswith = function(self, str) return self:find('^' .. str) ~= nil end local function validate_variable(value) local _, err = load("local var = "..value) if err then return false, "error parsing " .. plugin_name .. ": " .. err end return true end local schema = { name = plugin_name, fields = { { consumer = typedefs.no_consumer }, -- This plugin cannot be configured as a 'consumer'. { protocols = typedefs.protocols_http }, { config = { type = "record", fields = { { service = { type = "record", fields = { { endpoint = { type = "string", required = true } }, { operation = { type = "string", required = true, } }, } }, }, { mapping = { type = "record", fields = { { request = { type = "string", required = true }, }, { response = { type = "string", required = true, custom_validator = validate_variable } } } } } }, } }, }, } return schema
local struct = setmetatable(require('struct'), { __call = function(t, ...) return t.struct(...) end, }) local array = struct.array local tag = struct.tag local string = struct.string local data = struct.data local packed_string = struct.packed_string local int8 = struct.int8 local int16 = struct.int16 local int32 = struct.int32 local int64 = struct.int64 local uint8 = struct.uint8 local uint16 = struct.uint16 local uint32 = struct.uint32 local uint64 = struct.uint64 local float = struct.float local double = struct.double local bool = struct.bool local bit = struct.bit local boolbit = struct.boolbit local ptr = struct.ptr local entity_id = tag(uint32, 'entity') local entity_index = tag(uint16, 'entity_index') local percent = tag(uint8, 'percent') local ip = tag(uint32, 'ip') local rgba = tag(uint8[4], 'rgba') local zone = tag(uint16, 'zone') local pc_name = string(0x10) local npc_name = string(0x18) local fourcc = string(0x04) local chat_input_buffer = string(0x97) local vector_3f = struct({ x = {0x0, float}, z = {0x4, float}, y = {0x8, float}, }) local vector_4f = struct({ x = {0x0, float}, z = {0x4, float}, y = {0x8, float}, w = {0xC, float}, }) local world_coord = tag(vector_4f, 'world_coord') local matrix = float[4][4] local screen_coord = struct({ x = {0x0, float}, z = {0x4, float}, }) local render = struct({ framerate_divisor = {0x030, uint32}, aspect_ratio = {0x2F0, float}, zoom = {0x2F8, float}, }) local gamma = struct({ red = {0x7F8, float}, green = {0x7FC, float}, blue = {0x800, float}, _dupe_red = {0x804, float}, _dupe_green = {0x808, float}, _dupe_blue = {0x80C, float}, }) local linkshell_color = struct({ red = {0x0, uint8}, green = {0x1, uint8}, blue = {0x2, uint8}, }) local model = struct({ head_model_id = {0x0, uint16}, body_model_id = {0x2, uint16}, hands_model_id = {0x4, uint16}, legs_model_id = {0x6, uint16}, feet_model_id = {0x8, uint16}, main_model_id = {0xA, uint16}, sub_model_id = {0xC, uint16}, range_model_id = {0xE, uint16}, }) struct.declare('entity') local display = struct({ position = {0x34, world_coord}, heading = {0x48, float}, entity = {0x70, ptr('entity')}, name_color = {0x78, rgba}, linkshell_color = {0x7C, rgba}, _pos2 = {0xC4, world_coord}, _pos3 = {0xD4, world_coord}, _heading2 = {0xE8, float}, _speed = {0xF4, float}, -- Does not seem to be actual movement speed, but related to it. Animation speed? moving = {0xF8, bool}, walking = {0xFA, bool}, frozen = {0xFC, bool}, }) local entity = struct({ position_display = {0x004, world_coord}, rotation = {0x014, vector_4f}, -- y: E=0 N=+pi/2 W=+/-pi S=-pi/2 position = {0x024, world_coord}, _dupe_rotation = {0x034, vector_3f}, _unknown_1 = {0x040, data(0x04)}, -- Sometimes a single world coordinate, sometimes a pointer... _dupe_position = {0x044, vector_3f}, -- Seems unused! w-coordinate is occasionally overwritten by pointer value... _unknown_variable = {0x050, data(0x24)}, -- Data in here varies! Sometimes the same field is a pointer, sometimes coordinates. Seems to depend on the entity -- Observed constellations: -- Ding Bats -- ptr1 coord coord coord -- small coordinates, ~0.01 range -- ptr2 ptr3 ptr4 0 -- ptr2 == _unknonw_1 - 0x35C, ptr3 == ptr1 + 0xCA0, ptr4 == ptr1 + 28A6 -- 1(float) -- Wild Rabbit -- 0 0 0 0 -- 0 1 0 0 -- 1(int) index = {0x074, entity_index}, id = {0x078, entity_id}, name = {0x07C, npc_name}, _unknown_ptr_1 = {0x094, ptr()}, movement_speed = {0x098, float}, movement_speed_base = {0x09C, float}, display = {0x0A0, ptr(display)}, distance = {0x0D8, float}, _dupe_heading2 = {0x0E4, float}, owner = {0x0E8, entity_id}, hp_percent = {0x0EC, percent}, target_type = {0x0EE, uint8}, -- 0 = PC, 1 = NPC, 2 = NPC with fixed model (including various types of books), 3 = Doors and similar objects race_id = {0x0EF, uint8}, face_model_id = {0x0FC, uint16}, model = {0x0FE, model}, freeze = {0x11C, bool}, -- flags = {0x120, uint32[0x06]}, flags = {0x120, struct({size = 0x18}, { enemy = {0x01, boolbit(uint8), offset=5}, })}, _unkonwn_ptr_2 = {0x150, ptr()}, -- Sometimes same as _unknown_1 _unknown_float_1 = {0x158, float}, -- Always 4? _unknown_short_1 = {0x15C, uint16}, -- Flags? _unknown_short_2 = {0x15E, uint16}, -- Duplicate of _unknown_short_1 status = {0x168, uint32}, -- Is this type correct? claim_id = {0x184, entity_id}, animation = {0x18C, fourcc[0x0A]}, animation_time = {0x1B4, uint16}, animation_step = {0x1B6, uint16}, emote_id = {0x1BC, uint16}, emote_name = {0x1C0, fourcc}, spawn_type = {0x1CC, uint8}, -- 1 = PC, 2 = NPC, 13 = Player, 16 = Mob linkshell_color = {0x1D0, linkshell_color}, campaign_mode = {0x1D6, bool}, fishing_timer = {0x1D8, uint32}, -- counts down during fishing, goes 0xFFFFFFFF after 0, time until the fish bites target_index = {0x1F4, entity_index}, pet_index = {0x1F6, entity_index}, model_scale = {0x200, float}, model_size = {0x204, float}, fellow_index = {0x29C, entity_index}, owner_index = {0x29E, entity_index}, heading = { get = function(data) return data.rotation.z end, set = function(data, value) data.rotation.z = value end, }, -- TODO: Verify -- npc_talking = {0x0AC, uint32}, -- pos_move = {0x054, world_coord} -- status_server = {0x16C, uint32}, -- pets_owners_index = {0x2A0, entity_index}, -- npc_speech_loop = {0x13E, uint16}, -- npc_speech_frame = {0x140, uint16}, -- npc_walk_pos_1 = {0x15C, uint16}, -- npc_walk_pos_2 = {0x15E, uint16}, -- npc_walk_mode = {0x160, uint16}, }) local target_array_entry = struct({size = 0x28}, { index = {0x00, entity_index}, id = {0x04, entity_id}, entity = {0x08, ptr(entity)}, display = {0x0C, ptr(display)}, arrow_pos = {0x10, world_coord}, active = {0x20, bool}, arrow_active = {0x22, bool}, checksum = {0x24, uint16}, }) local alliance_info = struct({ alliance_leader_id = {0x00, entity_id}, party_1_leader_id = {0x04, entity_id}, party_2_leader_id = {0x08, entity_id}, party_3_leader_id = {0x0C, entity_id}, party_1_index = {0x10, uint8}, party_2_index = {0x11, uint8}, party_3_index = {0x12, uint8}, party_1_count = {0x13, uint8}, party_2_count = {0x14, uint8}, party_3_count = {0x15, uint8}, st_selection = {0x50, uint8}, st_selection_max = {0x63, uint8}, -- 6 for <stpt>, 18 for <stal> _unknown_5F = {0x64, uint8}, -- Seems to be FF when in <stpt> or <stal>, otherwise 00 }) local party_member = struct({size = 0x7C}, { alliance_info = {0x00, ptr(alliance_info)}, name = {0x06, pc_name}, id = {0x18, entity_id}, index = {0x1C, entity_index}, hp = {0x24, uint32}, mp = {0x28, uint32}, tp = {0x2C, uint32}, hp_percent = {0x30, percent}, mp_percent = {0x31, percent}, zone_id = {0x32, zone}, _zone_id2 = {0x34, zone}, flags = {0x38, uint32}, _id2 = {0x74, entity_id}, _hp_percent2 = {0x78, percent}, _mp_percent2 = {0x79, percent}, active = {0x7A, bool}, }) local chat_menu_entry = struct({ _ptr_chat_input_this = {0x00, ptr()}, -- This pointer to the parent struct of the chat input struct display = {0x04, ptr()}, -- Pointer to a null-terminated string for display in the menu length_display = {0x08, uint16}, -- Length (in bytes) of the display buffer associated with this entry internal = {0x0C, ptr()}, -- Pointer to a null-terminated string which will be copied to the internal buffer length_internal = {0x10, uint16}, -- Length (in bytes) of the internal buffer associated with this entry auto_translate = {0x14, string(0x04)}, -- Auto-translate code, 0 if the phrase is a regular string }) local entity_string = struct({ name = {0x00, string(0x18)}, id = {0x1C, uint32}, }) local map_entry = struct({ zone_id = {0x00, int16}, map_id = {0x02, uint8}, count = {0x03, uint8}, scale = {0x05, uint8}, offset_x = {0x0A, int16}, offset_y = {0x0C, int16}, }) local types = {} types.graphics = struct({signature = '83EC205355568BF18B0D'}, { gamma = {0x000, ptr(gamma)}, render = {0x28C, ptr(render)}, footstep_effects = {0x400, bool}, clipping_plane_entity = {0x438, float}, clipping_plane_map = {0x448, float}, aspect_ratio_option = {0x578, uint32}, animation_framerate = {0x590, uint32}, view_matrix = {0xBB8, matrix}, projection_matrix = {0xDF8, matrix}, }) types.volumes = struct({signature = '33DBF3AB6A10881D????????C705'}, { menu = {0x1C, float}, footsteps = {0x20, float}, }) types.auto_disconnect = struct({signature = '6A00E8????????8B44240883C40485C07505A3'}, { enabled = {0x00, bool}, last_active_time = {0x04, uint32}, -- in ms, unknown offset timeout_time = {0x08, uint32}, -- in ms active = {0x10, bool}, }) types.entities = array({signature = '8B560C8B042A8B0485'}, ptr(entity), 0x900) types.account_info = struct({signature = '538B5C240856578BFB83C9FF33C053F2AEA1'}, { version = {0x248, string(0x10)}, ip = {0x260, ip}, port = {0x26C, uint16}, id = {0x314, entity_id}, name = {0x318, pc_name}, server_id = {0x390, int16}, }) types.target = struct({signature = '53568BF18B480433DB3BCB75065E33C05B59C38B0D&', static_offsets = {0x18, 0x00}}, { window = {0x08, ptr()}, name = {0x14, npc_name}, entity = {0x48, ptr(entity)}, id = {0x60, entity_id}, hp_percent = {0x64, uint8}, }) types.target_array = struct({signature = '53568BF18B480433DB3BCB75065E33C05B59C38B0D&', static_offsets = {0x18, 0x2F0}}, { targets = {0x00, target_array_entry[2]}, auto_target = {0x51, bool}, both_targets_active = {0x52, bool}, movement_input = {0x57, bool}, -- True whenever character moves (or tries to move) via user input alliance_target_active = {0x59, bool}, -- This includes party targeting target_locked = {0x5C, boolbit(uint32), offset=0}, sub_target_mask = {0x60, uint32}, -- Bit mask indicating valid sub target selection -- 0: PCs/Pets/Trusts -- 1: Green NPCs/Pets/Trusts -- 2: Party members (incl. Trusts) -- 3: Alliance members (incl. Trusts) -- 4: Enemies -- Unsure about the significance of the second byte in this int -- 0: <stnpc> -- 2: <stpc> -- 3: <st> -- Changing the second byte does not seem to have an effect -- The entire int is -1 if no sub target is active action_target_active = {0x6C, bool}, action_range = {0x6D, uint8}, -- One less than the distance in yalms (including 0xFF for self-targeting spells) menu_open = {0x74, bool}, action_category = {0x76, uint8}, -- 1 for JA/WS, 2 for spells action_aoe_range = {0x77, uint8}, -- Base range for AoE modifiers, this is not directly related to the distance drawn on the screen -- For example increased range by different instruments will not change this value for AoE songs action_id = {0x78, uint16}, -- The ID of the JA, WS or spell action_target_id = {0x7C, entity_id}, focus_index = {0x84, entity_index}, -- Only set when the target exists in the entity array focus_id = {0x88, entity_id}, -- Always set, even if target not in zone mouse_pos = {0x8C, screen_coord}, last_st_name = {0x9C, npc_name}, last_st_index = {0xB8, entity_index}, last_st_id = {0xB8, entity_id}, _unknown_ptr1 = {0xC0, ptr()}, -- Something related to LastST, address seems to differ for PC and NPC _unknown_ptr2 = {0xC4, ptr()}, -- Something related to action target, seems there's one address for spells and one for JA/WS _unknown_ptr3 = {0xC8, ptr()}, -- Something related to action target, seems there's one address for spells and one for JA/WS _unknown_ptr4 = {0xD0, ptr()}, -- Something related to action target, seems there's one address for spells and one for JA/WS }) types.party = struct({signature = '6A0E8BCE89442414E8????????8B0D'}, { members = {0x2C, party_member[18]}, }) types.tell_history = struct({signature = '8B0D????????85C9740F8B15'}, { recipient_count = {0x004, uint16}, recipients = {0x008, pc_name[8]}, -- last 8 /tell recipients _dupe_recipient_count = {0x088, uint16}, _dupe_recipients = {0x08C, pc_name[8]}, chatlog_open = {0x10D, bool}, chatmode_tell_target = {0x10E, pc_name}, -- Only set when /chatmode tell senders = {0x11E, pc_name[8]}, }) types.chat_input = struct({signature = '3BCB74148B01FF502084C0740B8B0D', static_offsets = {0x00}}, { temporary_buffer = {0x7EDC, chat_input_buffer}, history = {0x7F73, chat_input_buffer[9]}, temporary_length = {0x84C4, uint8}, history_lengths = {0x84C8, uint8[9]}, history_length = {0x84EC, uint8}, history_index = {0x84F0, uint8}, internal = {0x84F4, chat_input_buffer}, length_internal = {0x86B8, uint8}, stripped = {0x86BC, chat_input_buffer}, length_stripped = {0x8880, uint8}, length_internal_max = {0x8884, uint8}, position_internal = {0x8888, uint8}, update_history = {0x8AA8, bool}, tab_menu_open = {0x8C81, bool}, menu_selection = {0x8C84, uint8}, menu_entries = {0x8C88, chat_menu_entry[0x3FC]}, menu_length = {0xEC28, uint8}, move_counter = {0xEC30, uint8}, display = {0xEC34, chat_input_buffer}, open = {0xEF22, bool}, }) types.follow = struct({signature = '8BCFE8????FFFF8B0D????????E8????????8BE885ED750CB9'}, { target_index = {0x04, entity_index}, target_id = {0x08, entity_id}, postion = {0x0C, world_coord}, follow_index = {0x20, entity_index}, follow_id = {0x24, entity_id}, -- Once set will overwrite pos with directional values first_person_view = {0x28, bool}, auto_run = {0x29, bool}, }) types.string_tables = struct({signature = '8B81????0000F6C402750532C0C20400A0'}, { skills = {0x10, ptr()}, elements = {0x14, ptr()}, entities = {0x18, ptr(entity_string)}, emotes = {0x1C, ptr()}, actions = {0x20, ptr()}, status_effects = {0x24, ptr()}, gameplay = {0x28, ptr()}, abilities = {0x34, ptr()}, unity = {0x38, ptr()}, zone = {0x3C, ptr()}, }) types.action_strings = struct({signature = '7406B8????????C38B4424046A006A0050B9'}, { abilities = {0x014, ptr()}, mounts = {0x094, ptr()}, spells = {0x9B4, ptr()}, }) types.status_effect_strings = struct({signature = '8A46055E3C0273188B0D', static_offsets = {0x00}}, { d_msg = {0x04, ptr()}, }) types.weather_strings = struct({signature = 'C333C9668B08518B0D', static_offsets = {0x148}}, { d_msg = {0x00, ptr()}, }) types.d_msg_table = struct({signature = '85C0752B5F5EC38B0CF5'}, { str0 = {0x00, ptr(ptr())}, -- [1] = Failed to read data. [2] = Checking the size of the files to download and str1 = {0x08, ptr(ptr())}, -- [1] = Error code: FFXI-%04d [2] = Could not connect to lobby server. str2 = {0x10, ptr(ptr())}, -- nullptr str3 = {0x18, ptr(ptr())}, -- [1] = You are currently not in a party. [2] = This region is not under any country's control. str4 = {0x20, ptr(ptr())}, -- nullptr str5 = {0x28, ptr(ptr())}, -- [1] = Race [2] = Job str6 = {0x30, ptr(ptr())}, -- [1] = Shout [2] = Tell str7 = {0x38, ptr(ptr())}, -- [1] = Activate Linkshell item and participate in its chat channel. [2] = Deactivate Linkshell item and quit its chat channel. str8 = {0x40, ptr(ptr())}, -- [1] = Region Info [2] = Items str9 = {0x48, ptr(ptr())}, -- [1] = All [2] All regions = {0x50, ptr(ptr())}, zones = {0x58, ptr(ptr())}, zone_autotranslates = {0x60, ptr(ptr())}, servers = {0x68, ptr(ptr())}, jobs = {0x70, ptr(ptr())}, days = {0x78, ptr(ptr())}, directions = {0x80, ptr(ptr())}, moon_phases = {0x88, ptr(ptr())}, _dupe_jobs = {0x90, ptr(ptr())}, job_abbreviations = {0x98, ptr(ptr())}, _dupe_zones = {0xA0, ptr(ptr())}, zone_search_names = {0xA8, ptr(ptr())}, races = {0xB0, ptr(ptr())}, str23 = {0xB8, ptr(ptr())}, -- nullptr equipment_slots = {0xC0, ptr(ptr())}, _dupe_equipment_slots = {0xC8, ptr(ptr())}, einherjar_chambers = {0xD0, ptr(ptr())}, str27 = {0xD8, ptr(ptr())}, -- [1] = Objectives [2] = Get grinding! }) types.music = struct.struct({signature = '668B490625FFFF000066C705????????FFFF66890C45'}, { day = {0x0, uint16}, night = {0x2, uint16}, solo_combat = {0x4, uint16}, party_combat = {0x6, uint16}, mount = {0x8, uint16}, knockout = {0xA, uint16}, mog_house = {0xC, uint16}, fishing = {0xE, uint16}, }) types.map_table = struct.struct({signature = '8A5424188B7424148B7C2410B9&'}, { ptr = {0x00, ptr(map_entry)}, }) return types --[[ Copyright © 2018, Windower Dev Team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the Windower Dev Team nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE WINDOWER DEV TEAM BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ]]
SetupProject("Tut16GammaRamp", "GammaRamp.cpp", "data/screenCoords.vert", "data/textureGamma.frag", "data/textureNoGamma.frag") SetupProject("Tut16GammaCheckers", "GammaCheckers.cpp", "data/PT.vert", "data/textureGamma.frag", "data/textureNoGamma.frag") SetupProject("Tut16GammaLandscape", "GammaLandscape.cpp", "LightEnv.h", "LightEnv.cpp", "data/PNT.vert", "data/litGamma.frag", "data/litNoGamma.frag")
local record = require('record') local default = { x = 1, y = 2, z = { a = { b = 3, z = 4 }}} local function equal( a, b ) if a == b then return true elseif type( a ) == type( b ) then for k, v in pairs( a ) do if not equal( v, b[k] ) then return false end end for k, v in pairs( b ) do if not equal( v, a[k] ) then return false end end return true else return false end end local x = record.make( default ) assert( equal( x, default )) assert( x ~= default ) local ok, _ = pcall( record.set, x, 'a', 5 ) assert( not ok ) assert( equal( record.set( x, 'z', 'a', 'b', 4 ), { x = 1, y = 2, z = { a = { b = 4, z = 4 }}} )) assert( equal( record.set( x, 'x', 2 ), { x = 2, y = 2, z = { a = { b = 3, z = 4 }}} )) assert( equal( record.set( x, 'z', 'a', {1,2,3}), { x = 1, y = 2, z = { a = {1,2,3}}})) assert( equal( record.set( x, 'z', 'a', 'b', x.y), { x = 1, y = 2, z = { a = { b = 2, z = 4 }}} )) assert( equal( record.copy( x ), x )) assert( record.copy( x ) ~= x ) assert( equal( record.update( x, 'z', 'a', 'b', tostring ), { x = 1, y = 2, z = {a = { b = '3', z = 4 }}})) assert( equal( record.update( x, 'z', function( v ) return v.a.b + 3 end ), { x = 1, y = 2, z = 6 })) assert( equal( record.update( x, 'z', 'a', function( v ) return v.b end ), { x = 1, y = 2, z = { a = 3 }} )) assert( equal( record.update( x, 'z', 'a', 'b', function( _ ) return 'zxy' end ), { x = 1, y = 2, z = { a = { b = 'zxy', z = 4 }}}))