content
stringlengths
5
1.05M
------------------- ABOUT ---------------------- -- -- In this adventure hero gets the lost part with -- the help of the green bananas hogs. HedgewarsScriptLoad("/Scripts/Locale.lua") HedgewarsScriptLoad("/Scripts/Animate.lua") HedgewarsScriptLoad("/Missions/Campaign/A_Space_Adventure/global_functions.lua") ----------------- VARIABLES -------------------- -- globals local missionName = loc("Getting to the device") local inBattle = false local tookPartInBattle = false local previousHog = -1 local permitCaptainLimeDeath = false local fixedWind = false -- dialogs local dialog01 = {} local dialog02 = {} local dialog03 = {} local dialog04 = {} local dialog05 = {} -- mission objectives local minesTimeText = loc("Mines time: 0 seconds") local goals -- crates local girderCrate = {name = amGirder, x = 1680, y = 1160} local eagleCrate = {name = amDEagle, x = 1680, y = 1650} local weaponCrate = { x = 1320, y = 1870} local deviceCrate = { gear = nil, x = 1360, y = 1870} local ropeCrate = {name = amRope, x = 1400, y = 1870} -- hogs local hero = {} local green1 = {} local green2 = {} local green3 = {} -- teams local teamA = {} local teamB = {} local teamC = {} -- hedgehogs values hero.name = loc("Hog Solo") hero.x = 1200 hero.y = 820 hero.dead = false green1.name = loc("Captain Lime") green1.hat = "war_desertofficer" green1.x = 1050 green1.y = 820 green1.dead = false green2.name = loc("Mister Pear") green2.hat = "war_britmedic" green2.x = 1350 green2.y = 820 green3.name = loc("Lady Mango") green3.hat = "hair_red" green3.x = 1450 green3.y = 820 local redHedgehogs = { { name = loc("Poisonous Apple") }, { name = loc("Dark Strawberry") }, { name = loc("Watermelon Heart") }, { name = loc("Deadly Grape") } } -- Hog Solo and Green Bananas teamA.name = loc("Hog Solo and GB") teamA.color = -6 -- Captain Lime can use one of 2 clan colors: -- One when being friendly (same as hero), and a different one when he turns evil. -- Captain Lime be in his own clan. teamB.name = loc("Captain Lime") teamB.colorNice = teamA.color teamB.colorEvil = -5 teamC.name = loc("Fruit Assassins") teamC.color = -1 function onGameInit() GameFlags = gfDisableWind Seed = 1 TurnTime = 20000 CaseFreq = 0 MinesNum = 0 MinesTime = 1 Explosives = 0 -- Disable Sudden Death HealthDecrease = 0 WaterRise = 0 Map = "fruit02_map" Theme = "Fruit" local health = 100 -- Fruit Assassins local assasinsHats = { "NinjaFull", "NinjaStraight", "NinjaTriangle" } teamC.name = AddTeam(teamC.name, teamC.color, "bp2", "Island", "Default_qau", "cm_scout") for i=1,table.getn(redHedgehogs) do redHedgehogs[i].gear = AddHog(redHedgehogs[i].name, 1, 100, assasinsHats[GetRandom(3)+1]) SetGearPosition(redHedgehogs[i].gear, 2010 + 50*i, 630) end local assassinsColor = div(GetClanColor(GetHogClan(redHedgehogs[1].gear)), 0x100) -- Hero and Green Bananas teamA.name = AddMissionTeam(teamA.color) hero.gear = AddMissionHog(health) hero.name = GetHogName(hero.gear) SetHogTeamName(hero.gear, string.format(loc("%s and GB"), teamA.name)) teamA.name = GetHogTeamName(hero.gear) SetGearPosition(hero.gear, hero.x, hero.y) HogTurnLeft(hero.gear, true) local heroColor = div(GetClanColor(GetHogClan(hero.gear)), 0x100) -- companions -- Change companion identity if they have same name as hero -- to avoid confusion. if green2.name == hero.name then green2.name = loc("Green Hog Grape") green2.hat = "war_desertsapper1" elseif green3.name == hero.name then green3.name = loc("Green Hog Grape") green3.hat = "war_desertsapper1" end green2.gear = AddHog(green2.name, 0, 100, green2.hat) SetGearPosition(green2.gear, green2.x, green2.y) HogTurnLeft(green2.gear, true) green3.gear = AddHog(green3.name, 0, 100, green3.hat) SetGearPosition(green3.gear, green3.x, green3.y) HogTurnLeft(green3.gear, true) -- Captain Lime -- Spawn with his "true" evil color so a new clan is created for Captain Lime ... teamB.name = AddTeam(teamB.name, teamB.colorEvil, "Cherry", "Island", "Default_qau", "congo-brazzaville") SetTeamPassive(teamB.name, true) green1.gear = AddHog(green1.name, 0, 100, green1.hat) -- ... however, we immediately change the color to "nice mode". -- Captain Lime starts as (seemingly) friendly in this mission. SetClanColor(GetHogClan(green1.gear), teamB.colorNice) SetGearPosition(green1.gear, green1.x, green1.y) -- Populate goals table goals = { [dialog01] = {missionName, loc("Exploring the tunnel"), loc("Search for the device with the help of the other hedgehogs.").."|"..string.format(loc("%s must collect the final crates."), hero.name) .. "|" .. minesTimeText, 1, 4000}, [dialog02] = {missionName, loc("Exploring the tunnel"), loc("Explore the tunnel with the other hedgehogs and search for the device.").."|"..string.format(loc("%s must collect the final crates."), hero.name) .. "|" .. minesTimeText, 1, 4000}, [dialog03] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack Captain Lime before he attacks back.").."|"..minesTimeText, 1, 4000}, [dialog04] = {missionName, loc("Return to the Surface"), loc("Go to the surface!").."|"..loc("Attack the assassins before they attack back.").."|"..minesTimeText, 1, 4000}, } AnimInit(true) AnimationSetup() end function onGameStart() AnimWait(hero.gear, 3000) FollowGear(hero.gear) if GetCampaignVar("Fruit01JoinedBattle") and GetCampaignVar("Fruit01JoinedBattle") == "true" then tookPartInBattle = true end AddEvent(onHeroDeath, {hero.gear}, heroDeath, {hero.gear}, 0) AddEvent(onDeviceCrates, {hero.gear}, deviceCrateEvent, {hero.gear}, 0) -- Hero and Green Bananas weapons AddAmmo(hero.gear, amSwitch, 100) -- Assassins weapons AddAmmo(redHedgehogs[1].gear, amBazooka, 6) AddAmmo(redHedgehogs[1].gear, amGrenade, 6) AddAmmo(redHedgehogs[1].bot, amDEagle, 6) for i=1,table.getn(redHedgehogs) do HideHog(redHedgehogs[i].gear) end -- explosives -- I wanted to use FindPlace but doesn't accept height values... local x1 = 950 local x2 = 1306 local y1 = 1210 local y2 = 1620 -- barrel mania in the large hole local barrels = { {1290, 1618}, {1285, 1587}, {1287, 1556}, {1286, 1525}, {1247, 1637}, {1250, 1606}, {1249, 1575}, {1251, 1544}, {1206, 1646}, {1211, 1615}, {1209, 1584}, {1166, 1646}, {1168, 1615}, {1170, 1584}, {1125, 1637}, {1120, 1606}, {1128, 1575}, {1089, 1622}, {1084, 1591}, {1093, 1560}, {1044, 1596}, {1044, 1565}, {1005, 1554}, {1005, 1523}, {973, 1492}, {1062, 1534}, {1128, 1544}, {1168, 1553}, {1210, 1553}, {1097, 1529}, {1040, 1505}, } for b=1, #barrels do local barrel = AddGear(barrels[b][1], barrels[b][2], gtExplosives, 0, 0, 0, 0) SetHealth(barrel, 21) end -- single barrel at the right corner AddGear(3128, 1680, gtExplosives, 0, 0, 0, 0) --mines AddGear(3135, 1680, gtMine, 0, 0, 0, 0) AddGear(3145, 1680, gtMine, 0, 0, 0, 0) AddGear(3155, 1680, gtMine, 0, 0, 0, 0) AddGear(3165, 1680, gtMine, 0, 0, 0, 0) AddGear(3175, 1680, gtMine, 0, 0, 0, 0) AddGear(3115, 1680, gtMine, 0, 0, 0, 0) AddGear(3105, 1680, gtMine, 0, 0, 0, 0) AddGear(3095, 1680, gtMine, 0, 0, 0, 0) AddGear(3085, 1680, gtMine, 0, 0, 0, 0) AddGear(3075, 1680, gtMine, 0, 0, 0, 0) AddAmmo(hero.gear, amFirePunch, 3) if tookPartInBattle then AddAnim(dialog01) else AddAnim(dialog02) end -- place crates SpawnSupplyCrate(girderCrate.x, girderCrate.y, girderCrate.name) SpawnSupplyCrate(eagleCrate.x, eagleCrate.y, eagleCrate.name) deviceCrate.gear = SpawnFakeUtilityCrate(deviceCrate.x, deviceCrate.y, false, false) -- anti-gravity device -- Rope crate is placed after device crate has been collected. -- This is done so it is impossible the player can rope before getting -- the device part. if tookPartInBattle then SpawnSupplyCrate(weaponCrate.x, weaponCrate.y, amWatermelon) else SpawnSupplyCrate(weaponCrate.x, weaponCrate.y, amSniperRifle) end SendHealthStatsOff() end function onNewTurn() if not inBattle and CurrentHedgehog == green1.gear then SkipTurn() elseif (not inBattle) and GetHogTeamName(CurrentHedgehog) == teamA.name then if CurrentHedgehog ~= hero.gear then -- FIXME: This screw up the selected weapon caption, as -- SwitchHog does not update the selected display caption AnimSwitchHog(hero.gear) end -- Workaround: Add a caption that overwrites the displayed weapon display AddCaption(loc("Let's go!"), capcolDefault, capgrpAmmoinfo) SetTurnTimeLeft(MAX_TURN_TIME) wind() elseif inBattle then if CurrentHedgehog == green1.gear and previousHog ~= hero.gear then SkipTurn() return end for i=1,table.getn(redHedgehogs) do if CurrentHedgehog == redHedgehogs[i].gear and previousHog ~= hero.gear then SkipTurn() return end end SetTurnTimeLeft(20000) wind() else EndTurn(true) end previousHog = CurrentHedgehog end function onGameTick() AnimUnWait() if ShowAnimation() == false then return end ExecuteAfterAnimations() CheckEvents() end function onGameTick20() if not permitCaptainLimeDeath and not GetHealth(green1.gear) then -- game ends with the according stat messages heroDeath() permitCaptainLimeDeath = true end if (not fixedWind) and CurrentHedgehog and GetY(CurrentHedgehog) > 1350 then fixedWind = true wind() end end function onGearAdd(gear) -- Turn sticky flames to normal flames, to reduce the waiting time after blowing up the barrels if GetGearType(gear) == gtFlame and band(GetState(gear), gsttmpFlag) ~= 0 then SetState(gear, band(GetState(gear), bnot(gsttmpFlag))) end end function onGearDelete(gear) if gear == hero.gear then hero.dead = true elseif gear == green1.gear then green1.dead = true elseif gear == deviceCrate.gear then if band(GetGearMessage(gear), gmDestroy) ~= 0 then PlaySound(sndShotgunReload) AddCaption(loc("Anti-Gravity Device Part (+1)"), GetClanColor(GetHogClan(CurrentHedgehog)), capgrpAmmostate) deviceCrate.collected = true deviceCrate.collector = CurrentHedgehog end end end function onGearDamage(gear, damage) if GetGearType(gear) == gtCase then -- in this mode every crate is essential in order to complete the mission -- destroying a crate ends the game heroDeath() end end function onAmmoStoreInit() SetAmmo(amDEagle, 0, 0, 0, 6) SetAmmo(amGirder, 0, 0, 0, 2) SetAmmo(amRope, 0, 0, 0, 1) SetAmmo(amSkip, 9, 0, 0, 1) if tonumber(getBonus(2)) == 1 then SetAmmo(amWatermelon, 0, 0, 0, 2) SetAmmo(amSniperRifle, 0, 0, 0, 2) else SetAmmo(amWatermelon, 0, 0, 0, 1) SetAmmo(amSniperRifle, 0, 0, 0, 1) end end function onPrecise() if GameTime > 3000 then SetAnimSkip(true) end end -------------- EVENTS ------------------ function onHeroDeath(gear) if hero.dead then return true end return false end function onDeviceCrates(gear) if not hero.dead and deviceCrate.collected and StoppedGear(hero.gear) then return true end return false end function onSurface(gear) if not hero.dead and GetY(hero.gear)<850 and StoppedGear(hero.gear) then return true end return false end function onCaptainLimeDeath(gear) if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return false end if green1.dead then return true end return false end function onRedTeamDeath(gear) if (not IsHogAlive(hero.gear)) or (not StoppedGear(hero.gear)) then return false end local redDead = true for i=1,table.getn(redHedgehogs) do if GetHealth(redHedgehogs[i].gear) then redDead = false break end end return redDead end -------------- ACTIONS ------------------ ended = false function heroDeath(gear) if not ended then SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name)) SendStat(siCustomAchievement, string.format(loc("To win the game, %s has to get the bottom crates and come back to the surface."), hero.name)) SendStat(siCustomAchievement, loc("You can use the other 2 hogs to assist you.")) SendStat(siCustomAchievement, loc("Do not destroy the crates!")) if tookPartInBattle then if permitCaptainLimeDeath then SendStat(siCustomAchievement, string.format(loc("You'll have to eliminate %s at the end."), teamC.name)) sendSimpleTeamRankings({teamC.name, teamA.name}) else sendSimpleTeamRankings({teamA.name}) end else if permitCaptainLimeDeath then SendStat(siCustomAchievement, loc("You'll have to eliminate Captain Lime at the end.")) sendSimpleTeamRankings({teamB.name, teamA.name}) else SendStat(siCustomAchievement, loc("Don't eliminate Captain Lime before collecting the last crate!")) sendSimpleTeamRankings({teamA.name}) end end EndGame() ended = true end end -- Device crate got taken function deviceCrateEvent(gear) -- Stop hedgehog SetGearMessage(deviceCrate.collector, 0) if deviceCrate.collector == hero.gear then -- Hero collected the device crate if not tookPartInBattle then -- Captain Lime turns evil AddAnim(dialog03) else -- Fruit Assassins attack for i=1,table.getn(redHedgehogs) do RestoreHog(redHedgehogs[i].gear) end AddAnim(dialog04) end -- needs to be set to true for both plots permitCaptainLimeDeath = true AddAmmo(hero.gear, amSwitch, 0) AddEvent(onSurface, {hero.gear}, surface, {hero.gear}, 0) else -- Player let the Green Bananas collect the crate. -- How dumb! -- Player will lose for this. AnimationSetup05(deviceCrate.collector) AddAnim(dialog05) end end function surface(gear) previousHog = -1 if tookPartInBattle then escapeHog(green1.gear) AddEvent(onRedTeamDeath, {green1.gear}, redTeamDeath, {green1.gear}, 0) else SetHogLevel(green1.gear, 1) -- Equip Captain Lime with weapons AddAmmo(green1.gear, amBazooka, 6) AddAmmo(green1.gear, amGrenade, 6) AddAmmo(green1.gear, amDEagle, 2) AddEvent(onCaptainLimeDeath, {green1.gear}, captainLimeDeath, {green1.gear}, 0) end EndTurn(true) escapeHog(green2.gear) escapeHog(green3.gear) inBattle = true end function captainLimeDeath(gear) -- hero win in scenario of escape in 1st part saveCompletedStatus(3) SendStat(siGameResult, loc("Congratulations, you won!")) SendStat(siCustomAchievement, loc("You retrieved the lost part.")) SendStat(siCustomAchievement, loc("You defended yourself against Captain Lime.")) sendSimpleTeamRankings({teamA.name, teamB.name}) EndGame() end function redTeamDeath(gear) -- hero win in battle scenario saveCompletedStatus(3) SendStat(siGameResult, loc("Congratulations, you won!")) SendStat(siCustomAchievement, loc("You retrieved the lost part.")) SendStat(siCustomAchievement, string.format(loc("You defended yourself against %s."), teamC.name)) sendSimpleTeamRankings({teamA.name, teamC.name}) EndGame() end -------------- ANIMATIONS ------------------ function Skipanim(anim) if goals[anim] ~= nil then ShowMission(unpack(goals[anim])) end if anim == dialog03 or anim == dialog04 then spawnRopeCrate() end if anim == dialog03 then makeCptLimeEvil() elseif anim == dialog05 then heroIsAStupidFool() else EndTurn(true) end end function AnimationSetup() -- DIALOG 01 - Start, Captain Lime helps the hero because he took part in the battle AddSkipFunction(dialog01, Skipanim, {dialog01}) table.insert(dialog01, {func = AnimWait, args = {hero.gear, 3000}}) table.insert(dialog01, {func = AnimCaption, args = {hero.gear, string.format(loc("Somewhere else on the planet of fruits, Captain Lime helps %s"), hero.name), 5000}}) table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("You fought bravely and you helped us win this battle!"), SAY_SAY, 5000}}) table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("So, as promised I have brought you where I think that the device you are looking for is hidden."), SAY_SAY, 7000}}) table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("I know that your resources are low due to the battle but I'll send two of my best hogs to assist you."), SAY_SAY, 7000}}) table.insert(dialog01, {func = AnimSay, args = {green1.gear, loc("Good luck!"), SAY_SAY, 2000}}) table.insert(dialog01, {func = AnimWait, args = {hero.gear, 500}}) table.insert(dialog01, {func = AnimSwitchHog, args = {hero.gear}}) table.insert(dialog01, {func = ShowMission, args = goals[dialog01]}) -- DIALOG02 - Start, hero escaped from the previous battle AddSkipFunction(dialog02, Skipanim, {dialog02}) table.insert(dialog02, {func = AnimWait, args = {hero.gear, 3000}}) table.insert(dialog02, {func = AnimCaption, args = {hero.gear, string.format(loc("Somewhere else on the planet of fruits, %s gets closer to the device"), hero.name), 5000}}) table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("You are the one who fled! So, you are alive."), SAY_SAY, 4000}}) table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("I'm still low on hogs. If you are not afraid I could use a set of extra hands."), SAY_SAY, 4000}}) table.insert(dialog02, {func = AnimWait, args = {hero.gear, 8000}}) table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("I am sorry but I was looking for a device that may be hidden somewhere around here."), SAY_SAY, 4500}}) table.insert(dialog02, {func = AnimWait, args = {green1.gear, 12500}}) table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("Many long forgotten things can be found in the same tunnels that we are about to explore!"), SAY_SAY, 7000}}) table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("If you help us you can keep the device if you find it but we'll keep everything else."), SAY_SAY, 7000}}) table.insert(dialog02, {func = AnimSay, args = {green1.gear, loc("What do you say? Are you in?"), SAY_SAY, 3000}}) table.insert(dialog02, {func = AnimWait, args = {hero.gear, 1800}}) table.insert(dialog02, {func = AnimSay, args = {hero.gear, loc("Okay then!"), SAY_SAY, 2000}}) table.insert(dialog02, {func = AnimSwitchHog, args = {hero.gear}}) table.insert(dialog02, {func = ShowMission, args = goals[dialog02]}) -- DIALOG03 - At crates, hero learns that Captain Lime is bad AddSkipFunction(dialog03, Skipanim, {dialog03}) table.insert(dialog03, {func = AnimWait, args = {hero.gear, 2000}}) table.insert(dialog03, {func = FollowGear, args = {hero.gear}}) table.insert(dialog03, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) table.insert(dialog03, {func = AnimWait, args = {green1.gear, 4000}}) table.insert(dialog03, {func = AnimSay, args = {green1.gear, string.format(loc("This %s is so naive! I'm going to shoot this fool so I can keep that device for myself!"), hero.name), SAY_THINK, 4000}}) table.insert(dialog03, {func = ShowMission, args = goals[dialog03]}) table.insert(dialog03, {func = spawnRopeCrate, args = {hero.gear}}) table.insert(dialog03, {func = makeCptLimeEvil, args = {hero.gear}}) -- DIALOG04 - At crates, hero learns about the Assassins ambush AddSkipFunction(dialog04, Skipanim, {dialog04}) table.insert(dialog04, {func = AnimWait, args = {hero.gear, 2000}}) table.insert(dialog04, {func = FollowGear, args = {hero.gear}}) table.insert(dialog04, {func = AnimSay, args = {hero.gear, loc("Hooray! I've found it, now I have to get back to Captain Lime!"), SAY_SAY, 4000}}) table.insert(dialog04, {func = AnimWait, args = {redHedgehogs[1].gear, 4000}}) table.insert(dialog04, {func = AnimSay, args = {redHedgehogs[1].gear, loc("We have spotted the enemy! We'll attack when the enemies start gathering!"), SAY_THINK, 4000}}) table.insert(dialog04, {func = ShowMission, args = goals[dialog04]}) table.insert(dialog04, {func = spawnRopeCrate, args = {hero.gear}}) table.insert(dialog04, {func = goToThesurface, args = {hero.gear}}) end function AnimationSetup05(collector) -- DIALOG05 - A member or the green bananas collected the target crate and steals it. Player loses AddSkipFunction(dialog05, Skipanim, {dialog05}) table.insert(dialog05, {func = AnimWait, args = {collector, 2000}}) table.insert(dialog05, {func = FollowGear, args = {collector}}) table.insert(dialog05, {func = AnimSay, args = {collector, loc("Oh yes! I got the device part! Now it belongs to me alone."), SAY_SAY, 4000}}) table.insert(dialog05, {func = AnimWait, args = {collector, 3000}}) table.insert(dialog05, {func = AnimSay, args = {hero.gear, loc("Hey! I was supposed to collect it!"), SAY_SHOUT, 3000}}) table.insert(dialog05, {func = AnimWait, args = {hero.gear, 3000}}) table.insert(dialog05, {func = AnimSay, args = {collector, loc("I don't care. It's worth a fortune! Good bye, you idiot!"), SAY_SAY, 5000}}) table.insert(dialog05, {func = heroIsAStupidFool, args = {collector}}) end ------------- OTHER FUNCTIONS --------------- -- Hide hog and create a simple escaping effect, if hog exists. -- No-op is hog does not exist function escapeHog(gear) if GetHealth(gear) then AddVisualGear(GetX(gear), GetY(gear), vgtSmokeWhite, 0, false) for i=1, 4 do AddVisualGear(GetX(gear)-16+math.random(32), GetY(gear)-16+math.random(32), vgtSmokeWhite, 0, false) end HideHog(gear) end end function makeCptLimeEvil() -- Turn Captain Lime evil SetHogLevel(green1.gear, 1) SetTeamPassive(teamB.name, false) -- ... and reveal his "true" evil color. Muhahaha! SetClanColor(GetHogClan(green1.gear), teamB.colorEvil) EndTurn(true) end function spawnRopeCrate() -- should be spawned after the device part was gotten and the cut scene finished. SpawnSupplyCrate(ropeCrate.x, ropeCrate.y, ropeCrate.name) end function goToThesurface() EndTurn(true) end -- Player let wrong hog collect crate function heroIsAStupidFool() if not ended then escapeHog(deviceCrate.collector) AddCaption(loc("The device part has been stolen!")) sendSimpleTeamRankings({teamA.name}) SendStat(siGameResult, string.format(loc("%s lost, try again!"), hero.name)) SendStat(siCustomAchievement, string.format(loc("Oh no, the companions have betrayed %s and stole the anti-gravity device part!"), hero.name)) SendStat(siCustomAchievement, string.format(loc("Only %s can be trusted with the crate."), hero.name)) EndGame() ended = true end end function wind() if fixedWind then SetWind(10) else SetWind(GetRandom(201)-100) end end
--[[ AuraWatch List A table of spellIDs to create icons for. To add spellIDs, look up a spell on www.wowhead.com and look at the URL: https://tbc.wowhead.com/spell=SPELLID https://cn.tbc.wowhead.com/spell=SPELLID --]] local C = unpack(select(2, ...)) local AuraWatchList = { ['ALL'] = { { 301089, 'TOPRIGHT', 0, 0, true, 1 }, -- Horde Flag -- 部落旗帜 { 301091, 'TOPRIGHT', 0, 0, true, 1 }, -- Alliance Flag -- 联盟旗帜 { 34976, 'TOPRIGHT', 0, 0, true, 1 }, -- Netherstorm Flag -- 虚空风暴旗帜 }, ['WARRIOR'] = { { 3411, 'TOPRIGHT' }, -- Intervene -- 援护 { 469, 'BOTTOMRIGHT' }, -- Battle Shout -- 命令怒吼 (Rank 1) { 2048, 'BOTTOMRIGHT' }, -- Battle Shout -- 战斗怒吼 (Rank 8) }, ['PRIEST'] = { { 33206, 'CENTER' }, -- Pain Suppression -- 痛苦压制 { 25218, 'CENTER' }, -- Power Word: Shield -- 真言术:盾 (Rank 12) { 10060, 'TOP' }, -- Power Infusion -- 能量灌注 { 41635, 'TOP' }, -- Prayer of Mending -- 愈合祷言 (Rank 1) { 25222, 'TOPRIGHT' }, -- Renew -- 恢复 (Rank 12) { 25433, 'TOPRIGHT', -12, 0 }, -- Shadow Protection -- 防护暗影 (Rank 4) { 39374, 'TOPRIGHT', -12, 0 }, -- Prayer of Shadow Protection -- 暗影防护祷言 (Rank 2) { 25389, 'BOTTOMRIGHT' }, -- Power Word: Fortitude -- 真言术:韧 (Rank 7) { 25392, 'BOTTOMRIGHT' }, -- Prayer of Fortitude -- 坚韧祷言 (Rank 3) { 25312, 'BOTTOMRIGHT', -12, 0 }, -- Divine Spirit -- 神圣之灵 (Rank 5) { 32999, 'BOTTOMRIGHT', -12, 0 }, -- Prayer of Spirit -- 精神祷言 (Rank 2) }, ['DRUID'] = { { 29166, 'CENTER' }, -- Innervate -- 激活 { 2893, 'TOP' }, -- Abolish Poison -- 驱毒术 { 33763, 'TOP' }, -- Lifebloom -- 生命绽放 { 774, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 1) { 1058, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 2) { 1430, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 3) { 2090, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 4) { 2091, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 5) { 3627, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 6) { 8910, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 7) { 9839, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 8) { 9840, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 9) { 9841, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 10) { 25299, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 11) { 26981, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 12) { 26982, 'TOPRIGHT' }, -- Rejuvenation -- 回春术 (Rank 13) { 8936, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 1) { 8938, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 2) { 8939, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 3) { 8940, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 4) { 8941, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 5) { 9750, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 6) { 9856, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 7) { 9857, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 8) { 9858, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 9) { 26980, 'TOPRIGHT', -12, 0 }, -- Regrowth -- 愈合 (Rank 10) { 26990, 'BOTTOMRIGHT' }, -- Mark of the Wild -- 野性印记 (Rank 8) { 26991, 'BOTTOMRIGHT' }, -- Gift of the Wild -- 野性赐福 (Rank 3) { 26992, 'BOTTOMRIGHT', -12, 0 }, -- Thorns -- 荆棘术 (Rank 7) }, ['PALADIN'] = { { 1044, 'CENTER' }, -- Blessing of Freedom -- 自由祝福 { 10278, 'CENTER' }, -- Blessing of Protection -- 保护祝福 (Rank 3) { 27148, 'CENTER' }, -- Blessing Sacrifice -- 牺牲祝福 (Rank 4) { 19752, 'TOP' }, -- Divine Intervention -- 神圣干涉 { 27144, 'TOP' }, -- Blessing of Light -- 光明祝福 (Rank 4) { 20217, 'TOPRIGHT' }, -- Blessing of Kings -- 王者祝福 { 25898, 'TOPRIGHT' }, -- Greater Blessing of Kings -- 强效王者祝福 { 27140, 'BOTTOMRIGHT' }, -- Blessing of Might -- 力量祝福 (Rank 8) { 27141, 'BOTTOMRIGHT' }, -- Greater Blessing of Might -- 强效力量祝福 (Rank 3) { 27142, 'BOTTOMRIGHT' }, -- Blessing of Wisdom -- 智慧祝福 (Rank 7) { 27143, 'BOTTOMRIGHT' }, -- Greater Blessing of Wisdom -- 强效智慧祝福 (Rank 3) { 1038, 'BOTTOMRIGHT', -12, 0 }, -- Blessing of Salvation -- 拯救祝福 { 25895, 'BOTTOMRIGHT', -12, 0 }, -- Greater Blessing of Salvation -- 强效拯救祝福 }, ['SHAMAN'] = { { 32594, 'CENTER' }, -- Earth Shield -- 大地之盾 (Rank 3) { 16237, 'TOPRIGHT' }, -- Ancestral Fortitude -- 先祖坚韧 (Rank 3) { 29203, 'TOPRIGHT', -12, 0 }, -- Healing Way -- 治疗之道 { 25507, 'BOTTOMRIGHT' }, -- Stoneskin Totem -- 石肤术 (Rank 8) { 25362, 'BOTTOMRIGHT' }, -- Strength of Earth -- 大地之力 (Rank 5) { 25566, 'BOTTOMRIGHT', -12, 0 }, -- Healing Stream -- 治疗之泉 (Rank 6) { 25569, 'BOTTOMRIGHT', -12, 0 }, -- Mana Spring -- 法力之泉 (Rank 5) { 25562, 'BOTTOMRIGHT', -12, 0 }, -- Fire Resistance Totem -- 火焰抗性 (Rank 4) { 8178, 'TOP' }, -- Grounding Totem Effect -- 根基图腾效果 { 25909, 'TOP' }, -- Tranquil Air -- 宁静之风 { 25360, 'TOP' }, -- Grace of Air -- 风之优雅 (Rank 3) { 25573, 'TOP' }, -- Nature Resistance Totem -- 自然抗性 (Rank 4) { 25576, 'TOP' }, -- Windwall -- 风墙 (Rank 4) { 30708, 'TOP' }, -- Totem of Wrath -- 天怒图腾 { 25559, 'BOTTOM' }, -- Frost Resistance Totem -- 冰霜抗性 (Rank 4) }, ['MAGE'] = { { 130, 'CENTER' }, -- Slow Fall -- 缓落术 { 33944, 'TOPRIGHT' }, -- Dampen Magic -- 魔法抑制 (Rank 6) { 33946, 'TOPRIGHT' }, -- Amplify Magic -- 魔法增效 (Rank 6) { 27126, 'BOTTOMRIGHT' }, -- Arcane Intellect -- 奥术智慧 (Rank 6) { 27127, 'BOTTOMRIGHT' }, -- Arcane Brilliance -- 奥术光辉 (Rank 2) }, ['WARLOCK'] = { { 20707, 'CENTER' }, -- Soulstone Resurrection -- 灵魂石复活 (Rank 1) { 20762, 'CENTER' }, -- Soulstone Resurrection -- 灵魂石复活 (Rank 2) { 20763, 'CENTER' }, -- Soulstone Resurrection -- 灵魂石复活 (Rank 3) { 20764, 'CENTER' }, -- Soulstone Resurrection -- 灵魂石复活 (Rank 4) { 20765, 'CENTER' }, -- Soulstone Resurrection -- 灵魂石复活 (Rank 5) { 27239, 'CENTER' }, -- Soulstone Resurrection -- 灵魂石复活 (Rank 6) { 132, 'TOPRIGHT' }, -- Detect Invisibility -- 侦测隐形 { 5697, 'TOPRIGHT', -12, 0 }, -- Unending Breath -- 水下呼吸 { 11767, 'BOTTOMRIGHT' }, -- Blood Pact -- 血之契印 (Rank 5) { 19480, 'BOTTOMRIGHT', -12, 0 }, -- Paranoia -- 多疑 }, ['HUNTER'] = { { 34477, 'CENTER' }, -- Misdirection -- 误导 { 13159, 'TOPRIGHT' }, -- Aspect of the Pack -- 豹群守护 { 27045, 'TOPRIGHT' }, -- Aspect of the Wild -- 野性守护 (Rank 3) { 27066, 'BOTTOMRIGHT' }, -- Trueshot Aura -- 强击光环 (Rank 4) }, ['ROGUE'] = {}, } C.AuraWatchList = AuraWatchList -- don't touch this ...
Flex = { rDrag = 10, horizontal = 1, vertical = 2, } require("flex/UIGroup") require("flex/UIList") require("flex/UITextBox") require("flex/UIView") require("flex/UIButton") --[[-- calculate the rects that views will take up given the parent rect (usually {0, 0, SCREEN_WIDTH, SCREEN_HEIGHT} and the view's layout cell. @param cell {axis=1|2, class=string, size={int, "dp"|"sp"|"w"}, children?={cell+}} @param rect {X, Y, W, H} @return rects of the cells ]] function Flex.calculateRects(cell, rect, nolimit) local direction = cell.axis local odirection = 1 if direction == 1 then odirection = 2 else direction = 2 end local size = rect[direction + 2] local osize = rect[odirection + 2] local x = rect[direction] local ox = rect[odirection] local flexible = size local weight = 0 local children = cell.children -- calculate how much room standard things take up -- sum weights for i, child in ipairs(children) do local amount = child.size if amount[2] == "dp" then -- density dependant pix flexible = flexible - amount[1] elseif amount[2] == "sp" then -- scalable pix flexible = flexible - amount[1] elseif amount[2] == "w" then --weight weight = weight + amount[1] end end local rects = {} --generate rects for i, child in ipairs(children) do local amount = child.size local mass = 0 if amount[2] == "dp" then -- density dependant pix mass = amount[1] elseif amount[2] == "sp" then -- scalable pix mass = amount[1] elseif amount[2] == "w" and flexible >= 0 then --weight mass = math.ceil(amount[1] / weight * flexible) if mass > flexible then mass = flexible end flexible = flexible - mass weight = weight - amount[1] end if not nolimit and mass > size then mass = size end size = size - mass rects[i] = Flex.makebox(direction, odirection, x, ox, mass, osize) x = x + mass end --generate children rects for i, child in ipairs(children) do if child.children then rects[i].children = Flex.calculateRects(child, rects[i]) end end return rects end --[[-- helper function to make a rect @param direction primary direction either 1|2 (horizontal|vertical) @param odirection secondary direction either 1|2 (horizontal|vertical) opposite of direction @param x position (x|y) of start of rect in the primary axis @param ox position (x|y) of start of rect in the secondary axis @param size size (width|height) of start of rect in the primary axis @param osize size (width|height) of start of rect in the secondary axis @return crafted rect ]] function Flex.makebox(direction, odirection, x, ox, size, osize) local rect = {0, 0, 0, 0} rect[direction] = x rect[odirection] = ox rect[direction + 2] = size rect[odirection + 2] = osize return rect end --[[-- Initialize the views given the layout (cell) and the rects these should occupy @param cell the layout @param rects generated by Flex.calculateRects @return newly created views ]] function Flex.new(cell, rects) local views = {} views.n = #rects for i, rect in ipairs(rects) do local child = cell.children[i] if (not child.class) and child.children then child.class = UIGroup end if child.class then local class = child.class views[i] = class.new(child, rect, i) end if child.children then views[i].children = Flex.new(child, rect.children) end end return views end --[[-- Set the rects of views @param views to have their rects set @param rects to set as the views' rects ]] function Flex.setRects(views, rects) for i = 1, views.n do local child = views[i] local rect = rects[i] if child then child:setRect(rect) if child.children then Flex.setRects(child.children, rect.children) end end end end --[[-- is `pt` in `rect` @param pt point to check @param rect to test if in @return whether `pt` in `rect` ]] function Flex.isInBound(pt, rect) return pt[1] >= rect[1] and pt[1] <= rect[1] + rect[3] and pt[2] >= rect[2] and pt[2] <= rect[2] + rect[4] end --[[ Function that makes objectAtPoint work to find draggable objects @return returns nil if not a draggable object, object otherwise ]] function Flex.doGetDraggable(object, pt) if object.draggable then return object end end --[[-- If there is a draggable object at point fetch it @return returns nil if no a draggable object at point, view otherwise ]] function Flex.getDraggable(pt, views, rects) return Flex.objectAtPoint(pt, views, rects, Flex.doGetDraggable) end --[[ Function that makes objectAtPoint work as a clicking function @return non nil/false if click was consumed, nil/false otherwise ]] function Flex.doClick(object, pt) if object.click then return object.click(object, pt) end end --[[-- Do click at point @return non nil/false if click was consumed, nil/false otherwise ]] function Flex.click(pt, views, rects) return Flex.objectAtPoint(pt, views, rects, Flex.doClick) end --[[-- Apply a function to a view at a point @return result of calling fn on view at point ]] function Flex.objectAtPoint(pt, views, rects, fn) for i = 1, views.n do local child = views[i] local rect = rects[i] if child and Flex.isInBound(pt, rect) then if child.children then local result = Flex.objectAtPoint(pt, child.children, rect.children, fn) if result then return result end end return fn(child, pt) end end end --[[-- Get all named members of views @return dict of {name=view...} ]] function Flex.getNamed(views) return Flex._getNamed(views, {}) end --[[ Helper. Get all named members of views @return dict of {name=view...} ]] function Flex._getNamed(views, named) local len = views.n or #views for i = 1, len do local child = views[i] if child then if child.name then named[child.name] = child end if child.children then Flex._getNamed(child.children, named) end end end return named end --[[-- Draw the views ]] function Flex.draw(views) for i = 1, views.n do local child = views[i] if child then views[i]:draw(0, 0) if child.children then Flex.draw(child.children) end end end end --[[-- destroy the views ]] function Flex.destroy(views) for i = 1, views.n do local child = views[i] if child then views[i]:destroy() if child.children then Flex.destroy(child.children) end end end end --[[-- Handles the common scenario of mouse wheel @param M module or object doing the clicking @param x coord @param y coord @param dx scroll dx @param dx scroll dy ]] function Flex.mouseWheel(M, x, y, dx, dy) local draggable = Flex.getDraggable({x, y}, M.views, M.rects) if draggable then if dx < 0 then dx = -10 elseif dx > 0 then dx = 10 end if dy < 0 then dy = -10 elseif dy > 0 then dy = 10 end draggable:moveBy(dx, dy) end return draggable end --[[-- Handles the common scenario of clicking / dragging mouse down @param M module or object doing the clicking @param x coord @param y coord ]] function Flex.mouseDown(M, x, y) M.draggable = Flex.getDraggable({x, y}, M.views, M.rects) M.last = {x, y} M.dragging = false end --[[-- Handles the common scenario of clicking / dragging mouse move @param M module or object doing the clicking @param x coord @param y coord ]] function Flex.mouseMove(M, x, y) local last = M.last if M.draggable then local dx = x - last[1] local dy = y - last[2] if M.dragging or math.abs(dx) > Flex.rDrag or math.abs(dy) > Flex.rDrag then M.draggable:moveBy(dx, dy) M.last = {x, y} M.dragging = true end end end --[[-- Handles the common scenario of clicking / dragging mouse up @param M module or object doing the clicking @param x coord @param y coord ]] function Flex.mouseUp(M, x, y) local result = true if not M.dragging then result = Flex.click({x, y}, M.views, M.rects) end M.draggable = nil M.dragging = false M.last = nil return result end --[[-- loads a file in the flex scope ]] function Flex.load(fname) return uloadfile(fname, "bt", Flex) end
--[[ ]]-- local addon = CharacterZoneTracker local COMPLETION_TYPES = addon:GetCompletionTypes() local ZONE_ACTIVITY_NAME_MAX_EDIT_DISTANCE = 5 local FIRST_ZONE_ID_WITH_DELVE_BOSS_UNIT_TAGS = 980 local WORLD_EVENT_MAX_DISTANCE = 0.02 local ZoneGuideTracker = ZO_Object:Subclass() local className = addon.name .. "ZoneGuideTracker" local debug = false local isPlayerNearObjective, matchObjectiveName, matchPoiIndex local _ --------------------------------------- -- -- Constructors -- --------------------------------------- function ZoneGuideTracker:New(...) local instance = ZO_Object.New(self) instance:Initialize(...) return instance end function ZoneGuideTracker:Initialize() self.name = className self.initializedZoneIndexes = {} self.objectives = {} self.dangerousMonsterNames = {} end --------------------------------------- -- -- Public Methods -- --------------------------------------- function ZoneGuideTracker:AnnounceCompletion(objective) local unitTag = "player" local level = GetUnitLevel(unitTag) local experience = GetUnitXP(unitTag) local championPoints = GetUnitChampionPoints(unitTag) local eventHandler = ZO_CenterScreenAnnounce_GetEventHandler(EVENT_OBJECTIVE_COMPLETED) if not eventHandler then return end local messageParams = eventHandler(objective.poiZoneIndex, objective.poiIndex, level, experience, experience, championPoints) if not messageParams then return end CENTER_SCREEN_ANNOUNCE:DisplayMessage(messageParams) end function ZoneGuideTracker:ClearActiveWorldEventInstance() if not self.activeWorldEvent then return end ZO_ClearTable(self.activeWorldEvent) self.activeWorldEvent = nil end function ZoneGuideTracker:DeactivateWorldEventInstance() if not self.activeWorldEvent then addon.Utility.Debug("No active world event instance being tracked. Cannot mark it complete.", debug) return end addon.Utility.Debug("Deactivating active world event poiIndex " .. tostring(self.activeWorldEvent.poiIndex), debug) local activePoiIndex = self.activeWorldEvent.poiIndex local worldEventObjective, _, objectiveDistance = self:GetObjectivePlayerIsNearest(ZONE_COMPLETION_TYPE_WORLD_EVENTS) if not worldEventObjective then addon.Utility.Debug("Not completing world event, because none are nearby.", debug) return elseif objectiveDistance > WORLD_EVENT_MAX_DISTANCE then addon.Utility.Debug("Not completing world event, the nearest, " .. tostring(worldEventObjective.name) .. ", is " .. tostring(objectiveDistance) .. " units away.", debug) return elseif worldEventObjective.poiIndex ~= activePoiIndex then addon.Utility.Debug("The nearest world event objective, " .. tostring(worldEventObjective.name) .. " has a poiIndex of " .. tostring(worldEventObjective.poiIndex) .. ". Exiting.", debug) return end -- Point of interest completed was the one the player is near. -- Save the progress ZO_ClearTable(self.activeWorldEvent) self.activeWorldEvent = nil local zoneId, completionZoneId = addon.Utility.GetZoneIdsAndIndexes(worldEventObjective.poiZoneIndex) if completionZoneId == 0 then return end local completedBefore = addon.Data:IsActivityCompletedOnAccount(completionZoneId, ZONE_COMPLETION_TYPE_WORLD_EVENTS, worldEventObjective.activityIndex) addon.Utility.Debug("Setting world event "..tostring(worldEventObjective.name) .. ", zone id: " .. tostring(zoneId) .. ", activityIndex: " .. tostring(worldEventObjective.activityIndex) .. ", completedBefore: " .. tostring(completedBefore) .. " as complete.", debug) if addon.Data:SetActivityComplete(completionZoneId, ZONE_COMPLETION_TYPE_WORLD_EVENTS, worldEventObjective.activityIndex, true) then -- Refresh UI, and announce if not the first time if completedBefore then self:UpdateUIAndAnnounce(worldEventObjective) else self:UpdateUI() end end end function ZoneGuideTracker:FindBestZoneCompletionActivityNameMatch(completionZoneId, name, ...) local completionTypes = {...} local halfSearchStringLength = math.ceil(ZoUTF8StringLength(name)/2) local maxEditDistance = math.min(ZONE_ACTIVITY_NAME_MAX_EDIT_DISTANCE, halfSearchStringLength) local lowestEditDistance = maxEditDistance + 1 local completionZoneIndex = GetZoneIndex(completionZoneId) local match, matchCompletionType for _, completionType in ipairs(completionTypes) do for activityIndex = 1, GetNumZoneActivitiesForZoneCompletionType(completionZoneId, completionType) do local objective = self.objectives[completionZoneIndex][completionType][activityIndex] if objective then local editDistance = addon.Utility.EditDistance(objective.name, name, lowestEditDistance) if editDistance < lowestEditDistance then match = objective matchCompletionType = completionType lowestEditDistance = editDistance end end end end return match, lowestEditDistance, matchCompletionType end function ZoneGuideTracker:FindAllObjectives(matchFunction, completionType, ...) local matches = {} local zoneId, completionZoneId, zoneIndex, completionZoneIndex = addon.Utility.GetZoneIdsAndIndexes(GetCurrentMapZoneIndex()) if completionZoneIndex == 0 then return matches end if not self.objectives[completionZoneIndex] then return matches end local objectivesList if completionType then objectivesList = { [completionType] = self.objectives[completionZoneIndex][completionType] } else objectivesList = self.objectives[completionZoneIndex] end for completionType, objectives in pairs(objectivesList) do for activityIndex, objective in ipairs(objectives) do if matchFunction(objective, ...) then table.insert(matches, { objective, completionType }) end end end return matches end function ZoneGuideTracker:FindObjective(matchFunction, completionZoneIndex, completionType, ...) self:InitializeZone(completionZoneIndex) if not self.objectives[completionZoneIndex] then return end local objectivesList if completionType then objectivesList = { [completionType] = self.objectives[completionZoneIndex][completionType] } else objectivesList = self.objectives[completionZoneIndex] end for completionType, objectives in pairs(objectivesList) do for activityIndex, objective in ipairs(objectives) do if matchFunction(objective, ...) then return objective, completionType end end end end function ZoneGuideTracker:GetMaxEditDistance() return ZONE_ACTIVITY_NAME_MAX_EDIT_DISTANCE end function ZoneGuideTracker:GetObjectivePlayerIsNearest(completionType) local matches = self:FindAllObjectives(isPlayerNearObjective, completionType) local normalizedX, normalizedZ = GetMapPlayerPosition("player") local nearestObjective local nearestCompletionType local nearestDistance for _, match in ipairs(matches) do local objective = match[1] local objectiveCompletionType = match[2] local objectiveX, objectiveZ = addon.Data:GetPOIMapInfoOnAccount(objective.poiZoneIndex, objective.poiIndex) local distance = addon.Utility.CartesianDistance2D(normalizedX, normalizedZ, objectiveX, objectiveZ) if not nearestDistance or distance < nearestDistance then nearestDistance = distance nearestObjective = objective nearestCompletionType = objectiveCompletionType end end return nearestObjective, nearestCompletionType, nearestDistance end function ZoneGuideTracker:GetPOIObjective(completionZoneIndex, completionType, poiZoneIndex, poiIndex) return self:FindObjective(matchPoiIndex, completionZoneIndex, completionType, poiZoneIndex, poiIndex) end function ZoneGuideTracker:GetObjective(completionZoneIndex, completionType, activityIndex) if not self.objectives[completionZoneIndex] then return end if not self.objectives[completionZoneIndex][completionType] then return end return self.objectives[completionZoneIndex][completionType][activityIndex] end function ZoneGuideTracker:GetObjectiveByName(completionZoneIndex, completionType, objectiveName) return self:FindObjective(matchObjectiveName, completionZoneIndex, completionType, objectiveName) end --[[ ]]-- function ZoneGuideTracker:InitializeZone(zoneIndex) if zoneIndex == 0 then return end -- Zone is already initialized if self.initializedZoneIndexes[zoneIndex] then return true end addon.Utility.Debug("InitializeZone(zoneIndex: " .. tostring(zoneIndex) .. ")", debug) self.initializedZoneIndexes[zoneIndex] = true local zoneId, completionZoneId, _, completionZoneIndex = addon.Utility.GetZoneIdsAndIndexes(zoneIndex) if completionZoneIndex == 0 then return end local totalActivityCount = 0 if not self.objectives[completionZoneIndex] then self.objectives[completionZoneIndex] = {} end for completionType in pairs(COMPLETION_TYPES) do local activityCount = GetNumZoneActivitiesForZoneCompletionType(completionZoneId, completionType) if activityCount > 0 then totalActivityCount = totalActivityCount + activityCount if not self.objectives[completionZoneIndex][completionType] then self.objectives[completionZoneIndex][completionType] = {} end for activityIndex = 1, GetNumZoneActivitiesForZoneCompletionType(completionZoneId, completionType) do local activityName = GetZoneStoryActivityNameByActivityIndex(completionZoneId, completionType, activityIndex) local poiId = GetZoneActivityIdForZoneCompletionType(completionZoneId, completionType, activityIndex) local poiZoneIndex, poiIndex = GetPOIIndices(poiId) local objective = { name = activityName, activityIndex = activityIndex, poiZoneIndex = poiZoneIndex, poiIndex = poiIndex, } if completionType == ZONE_COMPLETION_TYPE_WORLD_EVENTS then if objective.poiIndex then local worldEventInstanceId = GetPOIWorldEventInstanceId(zoneIndex, objective.poiIndex) if worldEventInstanceId and worldEventInstanceId > 0 then objective.worldEventInstanceId = worldEventInstanceId self:SetActiveWorldEventInstanceId(worldEventInstanceId) end end end self.objectives[completionZoneIndex][completionType][activityIndex] = objective end end end -- Trim empty if totalActivityCount == 0 then self.objectives[completionZoneIndex] = nil end return true end function ZoneGuideTracker:GetObjectives(zoneIndex, completionType) self:InitializeZone(zoneIndex) return self.objectives[zoneIndex][completionType] end function ZoneGuideTracker:LoadBaseGameCompletionForCurrentZone() local zoneId, completionZoneId = addon.Utility.GetZoneIdsAndIndexes(GetCurrentMapZoneIndex()) if completionZoneId == 0 then return end addon.Data:LoadBaseGameCompletionForZone(completionZoneId) self:UpdateUI() end function ZoneGuideTracker:RegisterDangerousMonsterName(name, difficulty) self.dangerousMonsterNames[name] = difficulty end function ZoneGuideTracker:ResetDangerousMonsterNames() ZO_ClearTable(self.dangerousMonsterNames) end function ZoneGuideTracker:ResetCurrentZone() local zoneId, completionZoneId = addon.Utility.GetZoneIdsAndIndexes(GetCurrentMapZoneIndex()) if completionZoneId == 0 then return end for completionType in pairs(COMPLETION_TYPES) do for activityIndex = 1, GetNumZoneActivitiesForZoneCompletionType(completionZoneId, completionType) do addon.Data:SetActivityComplete(completionZoneId, completionType, activityIndex, nil) end end self:UpdateUI() end function ZoneGuideTracker:SetActiveWorldEventInstanceId(worldEventInstanceId) if not worldEventInstanceId or worldEventInstanceId <= 0 then return end if self.activeWorldEvent then ZO_ClearTable(self.activeWorldEvent) end local zoneIndex, poiIndex = GetWorldEventPOIInfo(worldEventInstanceId) local objectiveName = GetPOIInfo(zoneIndex, poiIndex) self.activeWorldEvent = { instanceId = worldEventInstanceId, objectiveName = objectiveName, zoneIndex = zoneIndex, poiIndex = poiIndex, } end function ZoneGuideTracker:TryRegisterDelveBossKill(unitTag, targetName, targetUnitId) local zoneId, completionZoneId = addon.Utility.GetZoneIdsAndIndexes(GetUnitZoneIndex("player")) if zoneId == 0 or completionZoneId == 0 then return end local difficulty local unitReaction if unitTag and unitTag ~= "" then difficulty = GetUnitDifficulty(unitTag) unitReaction = GetUnitReaction(unitTag) else if not targetName or targetName == "" then targetName = addon.TargetTracker:GetTargetName(targetUnitId) if targetName then addon.Utility.Debug("Empty target name passed, but recovered using target unit id " .. tostring(targetUnitId) .. ". New target name is " .. tostring(targetName) .. ".", debug) else addon.Utility.Debug("Target has no name or unit tag. Ignoring kill.", debug) return end else targetName = zo_strformat("<<1>>", targetName) end difficulty = self.dangerousMonsterNames[targetName] if not difficulty then if addon.MultiBossDelves:IsZoneMultiBoss(zoneId, targetName) then addon.Utility.Debug("Target " .. tostring(targetName) .. " isn't a dangerous monster, but is still required for delve clear. Pretend that it's dangerous.", debug) difficulty = MONSTER_DIFFICULTY_NORMAL else addon.Utility.Debug("Target " .. tostring(targetName) .. " is not a known dangerous monster.", debug) return end end addon.Utility.Debug("Target " .. tostring(targetName) .. " is a known dangerous monster of difficulty " .. tostring(difficulty) .. ".", debug) unitReaction = UNIT_REACTION_HOSTILE unitTag = "reticleover" end -- Bosses are always at least "normal" (purple, winged unit frame) difficulty. if difficulty < MONSTER_DIFFICULTY_NORMAL then addon.Utility.Debug("Kill for target " .. tostring(unitTag) .. " ignored because monster difficulty is only " .. tostring(difficulty), debug) return end -- Non-hostile units are not delve bosses if unitReaction ~= UNIT_REACTION_HOSTILE then addon.Utility.Debug("Target is not hostile. Ignoring kill.", debug) return end -- If there's an active boss fight tracked with unit tags, -- then don't do anything if there isn't a boss unit tag on the target. if addon.BossFight:IsActive() and not addon.Utility.StartsWith(unitTag, "boss") then addon.Utility.Debug("There's an active boss fight, but no boss unit tag was passed.", debug) return end local zoneName = GetZoneNameById(zoneId) -- Try to find a map completion / zone guide activity that matches the current zone name local objective, editDistance, completionType = self:FindBestZoneCompletionActivityNameMatch(completionZoneId, zoneName, ZONE_COMPLETION_TYPE_DELVES, ZONE_COMPLETION_TYPE_GROUP_DELVES) -- No matches found. Probably not a delve or group delve. if not objective then -- For the hardest monster kills that have no "boss" unit tag, -- try a fallback to see if this was actually a world boss. -- This can sometimes be necessary if a world boss lacks a "boss" unit tag. -- E.g. Walks-Like-Thunder at Echoing Hollow in Murkmire if difficulty >= MONSTER_DIFFICULTY_DEADLY and not addon.Utility.StartsWith(unitTag, "boss") and not addon.BossFight:IsActive() and not IsUnitInDungeon("player") then objective = self:GetObjectivePlayerIsNearest(ZONE_COMPLETION_TYPE_GROUP_BOSSES) if not objective then addon.Utility.Debug("Not registering a world boss kill because none could be found near the player.", debug) return else completionType = ZONE_COMPLETION_TYPE_GROUP_BOSSES addon.Utility.Debug("World boss kill detected for target " .. tostring(targetName) .. ".", debug) end else addon.Utility.Debug("Could not find delve for zone name " .. tostring(zoneName), debug) return end end -- Check to see if the character already completed this delve if addon.Data:IsActivityComplete(completionZoneId, completionType, objective.activityIndex) then addon.Utility.Debug(tostring(zoneName) .. ", zone id: " .. tostring(zoneId) .. " is already complete. Not registering boss kill.", debug) return end -- Additional check to make sure the player location matches the zone completion type if IsUnitInDungeon("player") then if completionType == ZONE_COMPLETION_TYPE_GROUP_BOSSES then addon.Utility.Debug("Player is not in the overworld. Not registering world boss kill.", debug) return end else if completionType == ZONE_COMPLETION_TYPE_DELVES or completionType == ZONE_COMPLETION_TYPE_GROUP_DELVES then addon.Utility.Debug("Player is in the overworld. Not registering delve kill.", debug) return end end if not targetName or targetName == "" then targetName = zo_strformat("<<1>>", GetUnitName(unitTag)) end -- Exclude certain difficult monsters by name that are known to not be bosses. if addon.ExcludedMonsters:IsExcludedMonster(targetName) then addon.Utility.Debug(targetName .. " is specifically excluded. Not registering boss kill.", debug) return end -- Delves in zones newer than Clockwork City use BossFight to detect boss kills. if completionZoneId >= FIRST_ZONE_ID_WITH_DELVE_BOSS_UNIT_TAGS and completionType ~= ZONE_COMPLETION_TYPE_GROUP_BOSSES then -- Check to see if a boss fight is active. if not addon.BossFight:IsActive() then addon.Utility.Debug("Zone guide is for newer content (zone id " .. tostring(completionZoneId) .. "), and there is no boss fight active. Exiting.", debug) return end if not addon.BossFight:RegisterKill(unitTag) then addon.Utility.Debug("Boss " .. tostring(unitTag) .. " is not a known boss.", debug) return end if not addon.BossFight:AreAllBossesKilled() then addon.Utility.Debug("Kill for boss " .. tostring(unitTag) .. " registered, but there are more bosses waiting to be killed for this world boss fight.", debug) return end -- Certain delves, mostly in Craglorn and Cyrodiil, require killing several bosses to get credit. elseif addon.MultiBossDelves:IsZoneMultiBossDelve(zoneId) then addon.MultiBossDelves:RegisterBossKill(zoneId, targetName) if not addon.MultiBossDelves:AreAllBossesKilled(zoneId) then addon.Utility.Debug("Not all bosses in "..tostring(zoneName) .. ", zone id: " .. tostring(zoneId) .. " are killed yet.", debug) return end end addon.Utility.Debug("Setting activity "..tostring(objective.name) .. ", zone id: " .. tostring(zoneId) .. " as complete.", debug) local completedBefore = addon.Data:IsActivityCompletedOnAccount(completionZoneId, completionType, objective.activityIndex) if addon.Data:SetActivityComplete(completionZoneId, completionType, objective.activityIndex, true) then -- Refresh UI, and announce if not first time if completedBefore then self:UpdateUIAndAnnounce(objective) else self:UpdateUI() end end return true end function ZoneGuideTracker:TryRegisterWorldBossKill(unitTag) if IsUnitInDungeon("player") then addon.Utility.Debug("Not registering a world boss kill because the player is in a dungeon.", debug) return end local zoneIndex = GetUnitZoneIndex("player") if not zoneIndex or zoneIndex == 0 then return end local zoneId = GetZoneId(zoneIndex) if not zoneId or zoneId == 0 then return end local worldBossObjective = self:GetObjectivePlayerIsNearest(ZONE_COMPLETION_TYPE_GROUP_BOSSES) if not worldBossObjective then addon.Utility.Debug("Not registering a world boss kill because none could be found near the player.", debug) return end if not addon.BossFight:RegisterKill(unitTag) then addon.Utility.Debug("Boss " .. tostring(unitTag) .. " is not a known boss.", debug) return end if not addon.BossFight:AreAllBossesKilled() then addon.Utility.Debug("Kill for boss " .. tostring(unitTag) .. " registered, but there are more bosses waiting to be killed for this world boss fight.", debug) return end local completionZoneId = GetZoneStoryZoneIdForZoneId(zoneId) if completionZoneId == 0 then return end addon.Utility.Debug("Setting world boss "..tostring(worldBossObjective.name) .. ", zone id: " .. tostring(zoneId) .. " as complete.", debug) local completedBefore = addon.Data:IsActivityCompletedOnAccount(completionZoneId, ZONE_COMPLETION_TYPE_GROUP_BOSSES, worldBossObjective.activityIndex) if addon.Data:SetActivityComplete(completionZoneId, ZONE_COMPLETION_TYPE_GROUP_BOSSES, worldBossObjective.activityIndex, true) then -- Refresh UI, and announce if not the first time if completedBefore then self:UpdateUIAndAnnounce(worldBossObjective) else self:UpdateUI() end else addon.Utility.Debug("Not announcing "..tostring(worldBossObjective.name) .. " as complete. Already completed on this character.", debug) end -- Reset boss fight addon.BossFight:Reset() return true end function ZoneGuideTracker:UpdateUI() -- Refresh world map pins ZO_WorldMap_RefreshAllPOIs() -- Refresh compass pins COMPASS:OnUpdate() -- Refresh zone guide progress bars if IsInGamepadPreferredMode() then WORLD_MAP_ZONE_STORY_GAMEPAD:RefreshInfo() GAMEPAD_WORLD_MAP_INFO_ZONE_STORY:RefreshInfo() else WORLD_MAP_ZONE_STORY_KEYBOARD:RefreshInfo() end end function ZoneGuideTracker:UpdateUIAndAnnounce(objective) self:UpdateUI() addon.ZoneGuideTracker:AnnounceCompletion(objective) end --------------------------------------- -- -- Private Members -- --------------------------------------- function isPlayerNearObjective(objective) local isNearby = select(8, GetPOIMapInfo(objective.poiZoneIndex, objective.poiIndex)) if isNearby then return true end end function matchObjectiveName(objective, objectiveName) return objective.name == objectiveName end function matchPoiIndex(objective, zoneIndex, poiIndex) return objective.poiZoneIndex == zoneIndex and objective.poiIndex == poiIndex end -- Create singleton instance addon.ZoneGuideTracker = ZoneGuideTracker:New()
vim.opt.expandtab = false vim.opt.tabstop = 4 vim.opt.shiftwidth = 4 vim.opt.softtabstop = 4
print("[ENVSYNC] Loading") local M = {} -- https://stackoverflow.com/a/7615129/483349 local function splitString(inputstr, sep) if sep == nil then sep = "%s" end local t = {} for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do table.insert(t, str) end return t end local function setTimeOfDay(timeOfDayData) local p = splitString(timeOfDayData, "|") -- [1] = time -- [2] = dayLength -- [3] = dayScale -- [4] = nightScale -- [5] = play local play = false if p[5] == "1" then play = true end -- [6] = azimuthOverride print("[ENVSYNC] Sync: " .. timeOfDayData) core_environment.setTimeOfDay({time=p[1], dayLength=p[2], dayScale=p[3], nightScale=p[4], play=play, azimuthOverride=p[6]}) end AddEventHandler("BeamMPEnvSyncSetTimeOfDay", setTimeOfDay) print("[ENVSYNC] Ready") return M
-- SLT HammerSpoon Test Init File -- Spoon installer from www.zzamboni.org, to use the KSheet spoon hs.loadSpoon("SpoonInstall") spoon.SpoonInstall.repos.zzspoons = { url = "https://github.com/zzamboni/zzSpoons", desc = "zzamboni's spoon repository", } spoon.SpoonInstall.use_syncinstall = true Install=spoon.SpoonInstall -- KSheet Spoon: Press ctrl+alt+cmd+/ to displays list of hotkeys for active app Install:andUse("KSheet", { hotkeys = { toggle = { {"ctrl","alt","cmd"} , "/" } } }) -- Re-mapping keyboard shortcuts -- This is based on Elliot Waite's init.lua file from -- https://github.com/elliotwaite/hammerspoon-config -- ************************* START ***************************** -- These constants are used in the code below to allow hotkeys to be -- assigned using side-specific modifier keys. ORDERED_KEY_CODES = {58, 61, 55, 54, 59, 62, 56, 60} KEY_CODE_TO_KEY_STR = { [58] = 'leftAlt', [61] = 'rightAlt', [55] = 'leftCmd', [54] = 'rightCmd', [59] = 'leftCtrl', [62] = 'rightCtrl', [56] = 'leftShift', [60] = 'rightShift', } KEY_CODE_TO_MOD_TYPE = { [58] = 'alt', [61] = 'alt', [55] = 'cmd', [54] = 'cmd', [59] = 'ctrl', [62] = 'ctrl', [56] = 'shift', [60] = 'shift', } KEY_CODE_TO_SIBLING_KEY_CODE = { [58] = 61, [61] = 58, [55] = 54, [54] = 55, [59] = 62, [62] = 59, [56] = 60, [60] = 56, } -- SIDE_SPECIFIC_HOTKEYS: -- This table is used to setup my side-specific hotkeys, the format -- of each entry is: {fromMods, fromKey, toMods, toKey} -- -- Note: If you are trying to map from one key to that same key -- with a different modifier (e.g. rightCmd+a -> ctrl+a), this -- method won't work, but you can use the workaround mentioned -- here: https://github.com/elliotwaite/hammerspoon-config/issues/1 -- -- fromMods (string): -- Any of the following strings, joined by plus signs ('+'). If -- multiple are used, they must be listed in the same order as -- they appear in this list (alphabetical by modifier name, and -- then left before right): -- leftAlt -- rightAlt -- leftCmd -- rightCmd -- leftCtrl -- rightCtrl -- leftShift -- rightSfhit -- -- fromKey (string): -- Any single-character string, or the name of a keyboard key. -- The list keyboard key names can be found here: -- https://www.hammerspoon.org/docs/hs.keycodes.html#map -- -- toMods (string): -- Any of the following strings, joined by plus signs ('+'). -- Unlike `fromMods`, the order of these does not matter: -- alt -- cmd -- ctrl -- shift -- fn -- -- toKey (string): -- Same format as `fromKey`. -- SIDE_SPECIFIC_HOTKEYS = { -- Empty for now } hotkeyGroups = {} for _, hotkeyVals in ipairs(SIDE_SPECIFIC_HOTKEYS) do local fromMods, fromKey, toMods, toKey = table.unpack(hotkeyVals) local toKeyStroke = function() hs.eventtap.keyStroke(toMods, toKey, 0) end local hotkey = hs.hotkey.new(fromMods, fromKey, toKeyStroke, nil, toKeyStroke) if hotkeyGroups[fromMods] == nil then hotkeyGroups[fromMods] = {} end table.insert(hotkeyGroups[fromMods], hotkey) end function updateEnabledHotkeys() if curHotkeyGroup ~= nil then for _, hotkey in ipairs(curHotkeyGroup) do hotkey:disable() end end local curModKeysStr = '' for _, keyCode in ipairs(ORDERED_KEY_CODES) do if modStates[keyCode] then if curModKeysStr ~= '' then curModKeysStr = curModKeysStr .. '+' end curModKeysStr = curModKeysStr .. KEY_CODE_TO_KEY_STR[keyCode] end end curHotkeyGroup = hotkeyGroups[curModKeysStr] if curHotkeyGroup ~= nil then for _, hotkey in ipairs(curHotkeyGroup) do hotkey:enable() end end end modStates = {} for _, keyCode in ipairs(ORDERED_KEY_CODES) do modStates[keyCode] = false end modKeyWatcher = hs.eventtap.new({hs.eventtap.event.types.flagsChanged}, function(event) local keyCode = event:getKeyCode() if modStates[keyCode] ~= nil then if event:getFlags()[KEY_CODE_TO_MOD_TYPE[keyCode]] then -- If a mod key of this type is currently pressed, we can't -- determine if this event was a key-up or key-down event, so we -- just toggle the `modState` value corresponding to the event's -- key code. modStates[keyCode] = not modStates[keyCode] else -- If no mod keys of this type are pressed, we know that this was -- a key-up event, so we set the `modState` value corresponding to -- this key code to false. We also set the `modState` value -- corresponding to its sibling key code (e.g. the sibling of left -- shift is right shift) to false to ensure that the state for -- that key is correct as well. This code makes the `modState` -- self correcting. If it ever gets in an incorrect state, which -- could happend if some other code triggers multiple key-down -- events for a single modifier key, the state will self correct -- once all modifier keys of that type are released. modStates[keyCode] = false modStates[KEY_CODE_TO_SIBLING_KEY_CODE[keyCode]] = false end updateEnabledHotkeys() end end):start() -- ************ Remapping FIGMA keyboard shortcuts ************** -- The new command is shown on the left, and the mapped command is shown on the right figmaHotkeys = { -- Assign [cmd + `] to zoom to selection hs.hotkey.new('leftCmd', '`', function() hs.eventtap.keyStroke('shift', '2', 0) end), -- Assign [cmd + 1] to zoom to 100% hs.hotkey.new('leftCmd', '1', function() hs.eventtap.keyStroke('shift', '0', 0) end), -- Assign [cmd + 2] to zoom out hs.hotkey.new('leftCmd', '2', function() hs.eventtap.keyStroke(nil, '-', 0) end), -- Assign [cmd + 3] to zoom in hs.hotkey.new('leftCmd', '3', function() hs.eventtap.keyStroke(nil, '=', 0) end), -- Assign [shift+cmd + ]] to zoom to next frame hs.hotkey.new('leftCmd+leftShift', ']', function() hs.eventtap.keyStroke(nil, 'n', 0) end), -- Assign [shift+cmd + ]] to zoom to previous frame hs.hotkey.new('leftCmd+leftShift', '[', function() hs.eventtap.keyStroke('shift', 'n', 0) end), -- Assign [cmd + 4] to align v center hs.hotkey.new('leftCmd', '4', function() hs.eventtap.keyStroke('alt', 'v', 0) end), -- Assign [alt+cmd + l] to open library panel hs.hotkey.new('leftAlt+leftCmd', 'l', function() hs.eventtap.keyStroke('alt+cmd', 'o', 0) end), -- Assign [alt+cmd + d] to detach instance hs.hotkey.new('leftAlt+leftCmd', 'd', function() hs.eventtap.keyStroke('alt+cmd', 'b', 0) end), -- Assign [alt+cmd + f] to frame selection hs.hotkey.new('leftAlt+leftCmd', 'f', function() hs.eventtap.keyStroke('alt+cmd', 'g', 0) end), -- Assign [shift+cmd + f] to resize frame to fit its contents hs.hotkey.new('leftCmd+leftShift', 'f', function() hs.eventtap.keyStroke('alt+cmd+shift', 'r', 0) end), -- Assign [cmd + 5] to select parent hs.hotkey.new('leftCmd', '5', function() hs.eventtap.keyStroke('shift', 'return', 0) end), -- *** NOT WORKING *** -- Assign [capslock] to toggle locking hs.hotkey.new(nil, 'capslock', function() hs.eventtap.keyStroke('shift+cmd', 'l', 0) end), } function enableFigmaHotkeys() for _, hotkey in ipairs(figmaHotkeys) do hotkey:enable() end end function disableFigmaHotkeys() for _, hotkey in ipairs(figmaHotkeys) do hotkey:disable() end end figmaWindowFilter = hs.window.filter.new('Figma') figmaWindowFilter:subscribe(hs.window.filter.windowFocused, enableFigmaHotkeys) figmaWindowFilter:subscribe(hs.window.filter.windowUnfocused, disableFigmaHotkeys) if hs.window.focusedWindow() and hs.window.focusedWindow():application():name() == 'Figma' then -- If this script is initialized with a Figma window already in -- focus, enable the Figma hotkeys. enableFigmaHotkeys() end -- ************************* END ***************************** -- Note: The code below caused an error: unable to load spoon (relating to function 'xpcall') -- This code automatically realoads this hammer configutation file -- whenever a file in the ~/.hammerspoon directory is changed, and shows -- the alert, "Config reloaded," whenever it does. I enable this code -- while debugging. -- hs.loadSpoon('ReloadConfiguration') -- spoon.ReloadConfiguration:start() -- hs.alert.show('Config reloaded')
local composer = require("composer") local mainMenu = composer.newScene() local soundManager=require("soundManager") local printDebugStmt = require("helperScripts.printDebugStmt") local assetName = require("helperScripts.assetName") local menuMaker=require("menuHelper.menu") local app42=require("externalServices.app42") local preferenceHandler=require("helperScripts.preferenceHandler") local shop=require("shop") --------local Variables-------- local displayGroup local width=display.contentWidth local height=display.contentHeight --------Fwd References-------- local makeMainMenu local mainMenuDisplay local makeWaitMenu local waitMenu local makeNewsMenu local leaderboardMenu local makeLeaderboardMenu local update -- update Function of this script --------------------------- function mainMenu:create(event) composer.removeScene(event.params.callingScene) soundManager.playMainMenuBackgroundMusic() displayGroup = display.newGroup() local mainMenuGroup = self.view mainMenuGroup:insert(displayGroup) makeMainMenu() Runtime:addEventListener("enterFrame",update) end --------------------------- -- called when this scene is destroyed function mainMenu:destroy(event) soundManager.stopBackgroundMusic() Runtime:removeEventListener("enterFrame",update) end --------------------------- function update() if menuMaker.getMenuInFocus() ~= nil then if menuMaker.getMenuInFocus().name == "waitMenu" then --check if leaderboardIsFetched then make leaderboard menu if app42.leaderboardIsFetched==true then waitMenu:destroy() makeLeaderboardMenu() end -- body end end shop.update() end --------------------------- -- called from external script to make a pause menu function makeMainMenu() printDebugStmt.print("make Menu") mainMenuDisplay=menuMaker.newMenu("mainMenuDisplay", width*0.25, height*0.25, displayGroup,assetName.mainMenuBase,385,408) -- if we want to set alpha of base image ?? -- displayMenu.baseImage.alpha=0.2 mainMenuDisplay:addButton("newsButton",200,170,100,70) mainMenuDisplay:addButton("leaderboardButton",200, 250, 200, 70) mainMenuDisplay:addButton("shopButton",200,330,150,70) mainMenuDisplay:addButton("playButton",200, 430,126,88,nil,assetName.pauseButton) mainMenuDisplay:getItemByID("newsButton"):addTextDisplay({id="newsTextTitle",string="News",xRelative=0, yRelative=0, fontSize=30, colour={r=1,g=0,b=0}}) mainMenuDisplay:getItemByID("leaderboardButton"):addTextDisplay({id="highscoreText",string="Leaderboard",xRelative=0,yRelative=0,fontSize=30,colour={r=0,g=0,b=1}}) mainMenuDisplay:getItemByID("shopButton"):addTextDisplay({id="shopText",string="Shop",xRelative=0,yRelative=0,fontSize=30,colour={r=0,g=1,b=0}}) -- add an exclamation mark if new news is added if app42.currentNewsVersion~=nil then if app42.currentNewsVersion>preferenceHandler.get("currentNewsVersion")then local sheet=graphics.newImageSheet(assetName.exclamationSprite,{width = 13, height = 42, numFrames = 5, sheetContentWidth = 65, sheetContentHeight = 42}) mainMenuDisplay:getItemByID("newsButton"):addAnimation({xRelative = 30, yRelative=-10, sheet=sheet,sequence={name="usual", start=1, count=5,time=800,loopcount=0}}) preferenceHandler.set("currentNewsVersion",app42.currentNewsVersion) end end -- on play button callbackUp destroy the current menu and goto the gameWorld scene mainMenuDisplay:getItemByID("playButton").callbackUp=function( ) mainMenuDisplay:destroy() composer.gotoScene("gameWorld", {effect = "fade", time = 800, params = {callingScene="Screens.mainMenu"}}) end mainMenuDisplay:getItemByID("newsButton").callbackUp=function( ) mainMenuDisplay:destroy() makeNewsMenu() end mainMenuDisplay:getItemByID("leaderboardButton").callbackUp=function() mainMenuDisplay:destroy() makeWaitMenu() -- fetch n top rankers from server app42.fetchScores(5) end -- call make shop menu when shop button is clicked mainMenuDisplay:getItemByID("shopButton").callbackUp=function( ) mainMenuDisplay:destroy() shop.makeShopMenu(makeMainMenu) end end ------------------------ -- made while the news is being fetched function makeWaitMenu() waitMenu=menuMaker.newMenu("waitMenu", width*0.25, height*0.25,nil,nil,385,408) waitMenu:addTextDisplay({id="waitText", string="...Wait...",xRelative=200,yRelative=200, width=200, fontSize=50, colour={r=1,g=1,b=1}}) waitMenu:addButton("cancelButton",200,350,100,100) waitMenu:getItemByID("cancelButton"):addTextDisplay({id="cancelText",string="Cancel",xRelative=0,yRelative=0,fontSize=30,colour={r=1,g=0,b=0}}) waitMenu:getItemByID("cancelButton").callbackUp=function() waitMenu:destroy() makeMainMenu() end end ------------------------ -- make news menu after news is fetched function makeNewsMenu() newsMenu=menuMaker.newMenu("newsMenu", width*0.25, height*0.25,displayGroup,assetName.baseMenu,489,660) newsMenu:addButton("okButton",200,600,100,100) newsMenu:getItemByID("okButton"):addTextDisplay({id="okText",string="OK",xRelative=0,yRelative=0,fontSize=30,colour={r=1,g=0,b=0}}) for i=1,#app42.newsTable do -- printDebugStmt.print("news: "..i.. " ".. app42.newsTable[i]) local text=app42.newsTable[i] newsMenu:addTextDisplay({id="news"..i, string=text, xRelative=230, yRelative=i*130,fontSize=30,colour={r=1,g=1,b=1}}) end newsMenu:getItemByID("okButton").callbackUp=function() newsMenu:destroy() makeMainMenu() end end ------------------------ -- make leaderboard menu when leaderboard is fetched function makeLeaderboardMenu() leaderboardMenu=menuMaker.newMenu("leaderboardMenu",width*0.25, height*0.25, displayGroup,assetName.baseMenu,489,660) leaderboardMenu:addButton("okButton",200,600,100,100) leaderboardMenu:getItemByID("okButton"):addTextDisplay({id="okText",string="OK",xRelative=0,yRelative=0,fontSize=30,colour={r=1,g=0,b=0}}) -- add display text i.e. seperate column for names and scores leaderboardMenu:addTextDisplay({id="leaderboardNameTitle",string="Name",xRelative=100,yRelative=150,fontSize=30,colour={r=1,g=1,b=1}}) leaderboardMenu:addTextDisplay({id="leaderboardScoreTitle",string="Score",xRelative=350,yRelative=150,fontSize=30,colour={r=1,g=1,b=1}}) -- iterate through the leaderboardtable and list out names and scores for i=1,#app42.leaderboardTable do local name=app42.leaderboardTable[i].name local score=app42.leaderboardTable[i].score -- set y relative of first player's score and name manually and then if i==1 then leaderboardMenu:addTextDisplay({id="name"..i,string=name, xRelative=80, yRelative=200,fontSize=25,colour={r=1,g=1,b=1}}) leaderboardMenu:addTextDisplay({id="score"..i,string=score, xRelative=330, yRelative=200, fontSize=25,colour={r=1,g=1,b=1}}) else local yRelative= leaderboardMenu:getItemByID("name"..(i-1)).y + 50 yRelative=yRelative-leaderboardMenu.y leaderboardMenu:addTextDisplay({id="name"..i,string=name, xRelative=80, yRelative=yRelative,fontSize=25,colour={r=1,g=1,b=1}}) leaderboardMenu:addTextDisplay({id="score"..i,string=score, xRelative=330, yRelative=yRelative, fontSize=25,colour={r=1,g=1,b=1}}) end end leaderboardMenu:getItemByID("okButton").callbackUp=function() leaderboardMenu:destroy() makeMainMenu() end end ------------------------ mainMenu:addEventListener("create",mainMenu) -- called when we create screen mainMenu:addEventListener("destroy", mainMenu) -- called when we destroy screen ------------------------ return mainMenu
Citizen.CreateThread(function() while true do -- These natives has to be called every frame. SetVehicleDensityMultiplierThisFrame(TrafficAmount/100) SetPedDensityMultiplierThisFrame(PedestrianAmount/100) SetRandomVehicleDensityMultiplierThisFrame(TrafficAmount/100) SetParkedVehicleDensityMultiplierThisFrame(ParkedAmount/100) SetScenarioPedDensityMultiplierThisFrame(PedestrianAmount/100, PedestrianAmount/100) for i = 1, 13 do EnableDispatchService(i, EnableDispatch) end Citizen.Wait(1) end end)
local has_digilines = minetest.get_modpath("digilines") spacecannon.update_formspec_digilines = function(meta) local channel = meta:get_string("channel") or "" local formspec = "formspec_version[4]" .. "size[6,4;]" .. -- Digiline channel "field[0.5,0.5;3.5,1;digiline_channel;Digiline Channel;" .. channel .. "]" .. "button_exit[4.5,0.5;1,1;set_digiline_channel;Set]" .. -- Manual "fire" button "button_exit[0.5,2.5;5,1;fire;Fire]" meta:set_string("formspec", formspec) end spacecannon.update_formspec = function(meta) if has_digilines then spacecannon.update_formspec_digilines(meta) else meta:set_string("formspec", "size[8,2;]" .. "button_exit[0,1;8,1;fire;Fire]") end end spacecannon.can_shoot = function() -- arguments: pos, playername return true end spacecannon.can_destroy = function() -- arguments: pos return true end spacecannon.fire = function(pos, playername, color, speed, range) if not spacecannon.can_shoot(pos, playername) then return end -- check fuel/power local meta = minetest.get_meta(pos) if meta:get_int("powerstorage") < spacecannon.config.powerstorage * range then -- not enough power return else -- use power meta:set_int("powerstorage", 0) end minetest.sound_play("spacecannon_shoot", { pos = pos, gain = 1.0, max_hear_distance = 16 }) local node = minetest.get_node(pos) local dir = spacecannon.facedir_to_down_dir(node.param2) local obj = minetest.add_entity({x=pos.x+dir.x, y=pos.y+dir.y, z=pos.z+dir.z}, "spacecannon:energycube_" .. color) obj:setvelocity({x=dir.x*speed, y=dir.y*speed, z=dir.z*speed}) end -- destroy stuff in range -- TODO: resilient material list spacecannon.destroy = function(pos, range, intensity) if not spacecannon.can_destroy(pos) then return end local particle_texture = nil for x=-range,range do for y=-range,range do for z=-range,range do if x*x+y*y+z*z <= range * range + range then local np={x=pos.x+x,y=pos.y+y,z=pos.z+z} if minetest.is_protected(np, "") then return -- fail fast end local n = minetest.get_node_or_nil(np) if n and n.name ~= "air" then local node_def = minetest.registered_nodes[n.name] if node_def and node_def.tiles and node_def.tiles[1] then particle_texture = node_def.tiles[1] end if node_def.on_blast then -- custom on_blast node_def.on_blast(np, intensity) else -- default behavior local resilience = spacecannon.node_resilience[n.name] or 1 if resilience <= 1 or math.random(resilience) == resilience then minetest.set_node(np, {name="air"}) local itemstacks = minetest.get_node_drops(n.name) for _, itemname in ipairs(itemstacks) do if math.random(5) == 5 then -- chance drop minetest.add_item(np, itemname) end end end end end end end end end local radius = range -- https://github.com/minetest/minetest_game/blob/master/mods/tnt/init.lua minetest.add_particlespawner({ amount = 64, time = 0.5, minpos = vector.subtract(pos, radius / 2), maxpos = vector.add(pos, radius / 2), minvel = {x = -10, y = -10, z = -10}, maxvel = {x = 10, y = 10, z = 10}, minacc = vector.new(), maxacc = vector.new(), minexptime = 1, maxexptime = 2.5, minsize = radius * 3, maxsize = radius * 5, texture = "spacecannon_spark.png", glow = 5 }) if particle_texture then minetest.add_particlespawner({ amount = 64, time = 0.5, minpos = vector.subtract(pos, radius / 2), maxpos = vector.add(pos, radius / 2), minvel = {x = -10, y = -10, z = -10}, maxvel = {x = 10, y = 10, z = 10}, minacc = vector.new(), maxacc = vector.new(), minexptime = 1, maxexptime = 2.5, minsize = radius * 3, maxsize = radius * 5, texture = particle_texture, glow = 5 }) end minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = math.min(radius * 20, 128)}) end -- convert face dir to vector spacecannon.facedir_to_down_dir = function(facing) return ( {[0]={x=0, y=-1, z=0}, {x=0, y=0, z=-1}, {x=0, y=0, z=1}, {x=-1, y=0, z=0}, {x=1, y=0, z=0}, {x=0, y=1, z=0}})[math.floor(facing/4)] end
local Reshape, parent = torch.class('nn.Reshape', 'nn.Module') function Reshape:__init(...) parent.__init(self) local arg = {...} self.size = torch.LongStorage() self.batchsize = torch.LongStorage() if torch.type(arg[#arg]) == 'boolean' then self.batchMode = arg[#arg] table.remove(arg, #arg) end local n = #arg if n == 1 and torch.typename(arg[1]) == 'torch.LongStorage' then self.size:resize(#arg[1]):copy(arg[1]) else self.size:resize(n) for i=1,n do self.size[i] = arg[i] end end self.nelement = 1 self.batchsize:resize(#self.size+1) for i=1,#self.size do self.nelement = self.nelement * self.size[i] self.batchsize[i+1] = self.size[i] end end function Reshape:updateOutput(input) if not input:isContiguous() then self._input = self._input or input.new() self._input:resizeAs(input) self._input:copy(input) input = self._input end if (self.batchMode == false) or ( (self.batchMode == nil) and (input:nElement() == self.nelement and input:size(1) ~= 1) ) then self.output:view(input, self.size) else self.batchsize[1] = input:size(1) self.output:view(input, self.batchsize) end return self.output end function Reshape:updateGradInput(input, gradOutput) if not gradOutput:isContiguous() then self._gradOutput = self._gradOutput or gradOutput.new() self._gradOutput:resizeAs(gradOutput) self._gradOutput:copy(gradOutput) gradOutput = self._gradOutput end self.gradInput:viewAs(gradOutput, input) return self.gradInput end function Reshape:__tostring__() return torch.type(self) .. '(' .. table.concat(self.size:totable(), 'x') .. ')' end function Reshape:clearState() nn.utils.clear(self, '_input', '_gradOutput') return parent.clearState(self) end
ITEM.name = "Taurus Raging Bull" ITEM.description= "A double-action revolver chambered for .44 Magnum." ITEM.longdesc = "This Brazilian made revolver has somehow made in into the zone. The Raging Bull is a popular hunting weapon, as the great stopping power afforded by the large calibers it fires is handy when hunting bigger game. In the Zone, STALKERs pick up this revolver to have an edge against the dangerous wildlife.\n\nAmmo: .44 Magnum\nMagazine Capacity: 6" ITEM.model = ("models/weapons/w_raging_bull.mdl") ITEM.class = "cw_ragingbull" ITEM.weaponCategory = "secondary" ITEM.price = 13500 ITEM.width = 2 ITEM.height = 1 ITEM.canAttach = false ITEM.exRender = true --ITEM.img = ix.util.GetMaterial("vgui/hud/weapons/mateba.png") ITEM.bulletweight = 0.019 ITEM.unloadedweight = 2.05 ITEM.repair_PartsComplexity = 5 ITEM.repair_PartsRarity = 2 function ITEM:GetWeight() return self.unloadedweight + (self.bulletweight * self:GetData("ammo", 0)) end ITEM.iconCam = { pos = Vector(8, -205, 1.5), ang = Angle(0, 90, 0), fov = 4.2, } ITEM.pacData = { [1] = { ["children"] = { [1] = { ["children"] = { [1] = { ["children"] = { }, ["self"] = { ["Model"] = "models/weapons/w_taurus_327p.mdl", ["ClassName"] = "model", ["Position"] = Vector(-9.679, 9.712, 0.126), ["EditorExpand"] = true, ["UniqueID"] = "3589648235", ["Bone"] = "pelvis", ["Name"] = "mr96", ["Angles"] = Angle(0, 270, -30), }, }, }, ["self"] = { ["AffectChildrenOnly"] = true, ["ClassName"] = "event", ["UniqueID"] = "1486277682", ["Event"] = "weapon_class", ["EditorExpand"] = true, ["Name"] = "weapon class find simple\"@@1\"", ["Arguments"] = "cw_model29@@0", }, }, }, ["self"] = { ["ClassName"] = "group", ["UniqueID"] = "1977895467", ["EditorExpand"] = true, }, }, }
local hello = ... local fonts = require'fonts' function hello:init(lowrez) lowrez.depth_buffer = false local window = lowrez:window() local scene = am.group{ am.blend'alpha' ^ am.text(fonts['little-conquest8'], "Hello, LowRez!\n\nPress space\nto start", vec4(1,.75,.5,0.9)) } window.lock_pointer = false window.clear_color = vec4(0.3, 0.5, 0.7, 1) scene:action(function() if window:key_pressed'escape' then window:close() end if window:key_pressed'space' then lowrez:load'level' end end) return scene end
vim.g.dashboard_custom_header = { '⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣠⣤⣤⣴⣦⣤⣤⣄⣀', '⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⣿⠿⠿⠿⠿⣿⣿⣿⣿⣶⣤⡀', '⠀⠀⠀⣠⣾⣿⣿⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣿⣿⣶⡀', '⠀⠀⣴⣿⣿⠟⠁⠀⠀⠀⣶⣶⣶⣶⡆⠀⠀⠀⠀⠀⠀⠈⠻⣿⣿⣦', '⠀⣼⣿⣿⠋⠀⠀⠀⠀⠀⠛⠛⢻⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣿⣧', '⢸⣿⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⣷⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⡇', '⣿⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⣿⣿⣇⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿', '⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⡟⢹⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⣹⣿⣿', '⣿⣿⣷⠀⠀⠀⠀⠀⠀⣰⣿⣿⠏⠀⠀⢻⣿⣿⡄⠀⠀⠀⠀⠀⠀⣿⣿⡿', '⢸⣿⣿⡆⠀⠀⠀⠀⣴⣿⡿⠃⠀⠀⠀⠈⢿⣿⣷⣤⣤⡆⠀⠀⣰⣿⣿⠇', '⠀⢻⣿⣿⣄⠀⠀⠾⠿⠿⠁⠀⠀⠀⠀⠀⠘⣿⣿⡿⠿⠛⠀⣰⣿⣿⡟', '⠀⠀⠻⣿⣿⣧⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⠏', '⠀⠀⠀⠈⠻⣿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⠟⠁', '⠀⠀⠀⠀⠀⠈⠛⠿⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠋⠁', '⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠛⠛⠛⠛⠛⠉⠉', } vim.g.dashboard_default_executive = 'telescope' vim.g.dashboard_session_directory = vim.fn.stdpath('data') .. '/session' vim.cmd('autocmd FileType dashboard set showtabline=0 | autocmd WinLeave <buffer> set showtabline=2')
--[[ Name: audi.lua For: TalosLife By: TalosLife ]]-- local Car = {} Car.VIP = true Car.Make = "Audi" Car.Name = "2015 Audi RS7 Private" Car.UID = "audi_rs7" Car.Desc = "A drivable Audi RS4 by TheDanishMaster" Car.Model = "models/sentry/rs7.mdl" Car.Script = "scripts/vehicles/TDMCars/audir8plus.txt" Car.Price = 1000000 Car.FuellTank = 75 Car.FuelConsumption = 16 GM.Cars:Register( Car ) --[[ scripts/vehicles/sentry/rs7.txt --]] local Car = {} Car.VIP = true Car.Make = "Audi" Car.Name = "RS4 Avant" Car.UID = "audi_avant" Car.Desc = "A drivable Audi RS4 Avant by TheDanishMaster" Car.Model = "models/tdmcars/aud_rs4avant.mdl" Car.Script = "scripts/vehicles/TDMCars/rs4avant.txt" Car.Price = 100000 Car.FuellTank = 75 Car.FuelConsumption = 16 GM.Cars:Register( Car ) local Car = {} Car.VIP = true Car.Make = "Audi" Car.Name = "R8 Plus" Car.UID = "Audi_r8_plus" Car.Desc = "A drivable Audi R8Plus by TheDanishMaste" Car.Model = "models/tdmcars/audi_r8_plus.mdl" Car.Script = "scripts/vehicles/TDMCars/audir8plus.txt" Car.Price = 185000 Car.FuellTank = 133 Car.FuelConsumption = 11.125 GM.Cars:Register( Car ) local Car = {} Car.VIP = true Car.Make = "Audi" Car.Name = "Audi R8 GT Spyder" Car.UID = "audi_r8_gt_spyder" Car.Desc = "A drivable Audi R8 by TheDanishMaster" Car.Model = "models/tdmcars/audi_r8_spyder.mdl" Car.Script = "scripts/vehicles/TDMCars/audir8spyd.txt" Car.Price = 175000 Car.FuellTank = 75 Car.FuelConsumption = 16 GM.Cars:Register( Car ) local Car = {} Car.Make = "Audi" Car.Name = "TT 07" Car.UID = "audi_tt_07" Car.Desc = "A drivable Audi TT 07 by TheDanishMaster" Car.Model = "models/tdmcars/auditt.mdl" Car.Script = "scripts/vehicles/TDMCars/auditt.txt" Car.Price = 15000 Car.FuellTank = 60 Car.FuelConsumption = 22 GM.Cars:Register( Car ) local Car = {} Car.Make = "Audi" Car.Name = "S5" Car.UID = "audi_s5" Car.Desc = "A drivable Audi S5 by TheDanishMaster" Car.Model = "models/tdmcars/s5.mdl" Car.Script = "scripts/vehicles/TDMCars/s5.txt" Car.Price = 92000 Car.FuellTank = 61 Car.FuelConsumption = 15.625 GM.Cars:Register( Car ) local Car = {} Car.VIP = true Car.Make = "Audi" Car.Name = "Audi S4" Car.UID = "audi_s4" Car.Desc = "A drivable Audi S4 by TheDanishMaster" Car.Model = "models/tdmcars/aud_s4.mdl" Car.Script = "scripts/vehicles/TDMCars/aud_s6.txt" Car.Price = 82000 Car.FuellTank = 61 Car.FuelConsumption = 15.625 GM.Cars:Register( Car )
--thisThread = love.thread.getThread() local args = { ... } local channelIn = args[1] local channelOut = args[2] local PORT = args[3] local timeUntilNextMatch = args[4] local socket = require("socket") pcall(require, "TSerial") pcall(require, "Scripts/TSerial") pcall(require, "misc") pcall(require, "Scripts/misc") ok, sendPackets = pcall(require, "sendPackets") if not ok then ok, sendPackets = pcall(require, "Scripts/sendPackets") end local msgNumber = 0 local statusNumber = 0 local packetNumber = 0 local connection = {} local server, client clientList = {} print = function( ... ) str = "" local arg = { ... } for i=1,#arg do if arg[i] then str = str .. arg[i] .. "\t" else str = str .. "nil\t" end end channelOut:push({key="print", str}) end -- Sends a string fully. If a timeout is reached, it will try again until there's -- no more timeout. function sendReliable( client, msg ) local num, err, lastByte = client:send( msg ) while num == nil and err == 'timeout' do msg = msg:sub( lastByte + 1 ) num, err, lastByte = client:send( msg ) end end function connection.startServer() ok, server = pcall(socket.bind, "*", PORT) if not ok then error("Error establishing server: " .. server) return false else print("Started server at: " .. PORT) end ok, err = pcall(function() -- set a timeout for accepting client connections server:settimeout(.0001) sendPackets.init() end) if not ok then error("Failed to set up server. Maybe a connection is already running on this port?\n" .. err) end return true end function clientSynchronize(client) -- called on new clients. Will get them up to date if curMapStr then sendReliable( client, "MAP: " .. curMapStr .. "\n") for i = 1, #sendPacketsList do --print(client[1], "SENT:","U:" .. sendPacketsList[i].ID .. "|".. sendPacketsList[i].time .. "|" .. sendPacketsList[i].event) sendReliable( client, "U:" .. sendPacketsList[i].ID .. "|" .. sendPacketsList[i].time .. "|" .. sendPacketsList[i].event .. "\n") -- send all events to client that have already happened (in the right order) end if serverTime then client:send("T: " .. serverTime .. "\n") end else --print(client[1], "SENT:","NEXT_MATCH:" .. timeUntilNextMatch) client:send("NEXT_MATCH:" .. timeUntilNextMatch .. "\n") end end function connection.handleServer() if server then newClient = server:accept() if newClient then table.insert(clientList, newClient) newClient:settimeout(.0001) print("New client!") -- send everything to the new client that has been sent to others already clientSynchronize(newClient) end for k, cl in pairs(clientList) do data, msg = cl:receive() --print(data, msg) if not msg then cl:send("echo: " .. data .. "\n") else --print("error: " .. msg) if msg == "closed" then cl:shutdown() clientList[k] = nil print("Client left.") end end end end end ok = connection.startServer() if not ok then return end print("Connection started.") curTime = os.time() local packet while true do dt = os.time()-curTime curTime = os.time() connection.handleServer() --input = thisThread:get("input") packet = channelIn:pop() if packet then if packet.key == "close" then return end if packet.key == "reset" then sendPackets.init() -- important! if there's a new map, reset everything you did last round! end if packet.key == "curMap" then curMapStr = packet[1] -- careful: in this thread, it's only in string form, not in a table! serverTime = 0 for k, cl in pairs(clientList) do ok, msg = cl:send("MAP:" .. curMapStr .. "\n") ok, err = cl:send("T:" .. serverTime .. "\n") -- send update to clients. --print(cl[1], "SENT:","MAP:" .. curMapStr) end end if packet.key == "nextMatch" then timeUntilNextMatch = tonumber(packet[1]) end if packet.key == "packet" then local msg = packet[1] newPacketID = sendPackets.getPacketNum() + 1 for k, cl in pairs(clientList) do ok, err = cl:send("U:" .. newPacketID .. "|" .. msg .. "\n") -- send update to clients. --print(cl[1], "SENT:","U:" .. newPacketID .. "|" .. msg) end packetNumber = incrementID(packetNumber) s, e = msg:find("|") if not s then print("ERROR: no timestamp found in packet! Aborting.") return end time = tonumber(msg:sub(1, s-1)) msg = msg:sub(e+1, #msg) sendPackets.add(newPacketID, msg, time) end -- tell the clients at what time they should currently be: if packet.key == "time" then serverTime = packet[1] for k, cl in pairs(clientList) do ok, err = cl:send("T:" .. serverTime .. "\n") -- send update to clients. end end end timeUntilNextMatch = timeUntilNextMatch - dt end
local WeaponCustomization = GoonBase.WeaponCustomization if not GoonBase.WeaponCustomization then return end WeaponCustomization._advanced_menu_options = { [1] = { text = "wc_adv_toggle_preview_spin", func = "AdvancedToggleWeaponSpin", }, [2] = { text = "wc_adv_toggle_colour_grading", func = "AdvancedToggleColourGrading", }, [3] = { text = "wc_adv_clear_weapon", func = "AdvancedClearWeaponCheck", } } WeaponCustomization._menu_text_scaling = 0.80 WeaponCustomization._controller_index = { modifying = 1, not_modifying = 1, } WeaponCustomization._invalid_melee_weapons = { ["weapon"] = true, ["fists"] = true, } local BTN_X = utf8.char(57346) local BTN_Y = utf8.char(57347) local BTN_LT = utf8.char(57354) local BTN_LB = utf8.char(57352) local BTN_RT = utf8.char(57355) local BTN_RB = utf8.char(57353) local BTN_START = utf8.char(57349) function WeaponCustomization:IsUsingController() local type = managers.controller:get_default_wrapper_type() return type == "xbox360" or type == "ps3" end function WeaponCustomization.weapon_visual_customization_callback(self, data) local all_mods_by_type = { materials = managers.blackmarket:get_inventory_category("materials"), textures = managers.blackmarket:get_inventory_category("textures"), colors = managers.blackmarket:get_inventory_category("colors") } local new_node_data = {} local list = { "materials", "textures", "colors" } local mask_default_blueprint = { ["materials"] = { id = "plastic", global_value = "normal", }, ["textures"] = { id = "no_color_no_material", global_value = "normal", }, ["colors"] = { id = "nothing", global_value = "normal", }, } for _, category in pairs(list) do local listed_items = {} local items = all_mods_by_type[category] local default = mask_default_blueprint[category] local mods = {} if default then if default.id == "no_color_no_material" then default = managers.blackmarket:customize_mask_category_default(category) end if default.id ~= "nothing" and default.id ~= "no_color_no_material" then table.insert(mods, default) mods[#mods].pcs = {0} mods[#mods].default = true listed_items[default.id] = true end end if category == "materials" and not listed_items.plastic then table.insert(mods, {id = "plastic", global_value = "normal"}) mods[#mods].pcs = {0} mods[#mods].default = true end local td for i = 1, #items do td = tweak_data.blackmarket[category][items[i].id] if not listed_items[items[i].id] and td.texture or td.colors then table.insert(mods, items[i]) mods[#mods].pc = td.pc or td.pcs and td.pcs[1] or 10 mods[#mods].colors = td.colors end end local sort_td = tweak_data.blackmarket[category] local x_pc, y_pc table.sort(mods, function(x, y) if x.colors and y.colors then for i = 1, 2 do local x_color = x.colors[i] local x_max = math.max(x_color.r, x_color.g, x_color.b) local x_min = math.min(x_color.r, x_color.g, x_color.b) local x_diff = x_max - x_min local x_wl if x_max == x_min then x_wl = 10 - x_color.r elseif x_max == x_color.r then x_wl = (x_color.g - x_color.b) / x_diff % 6 elseif x_max == x_color.g then x_wl = (x_color.b - x_color.r) / x_diff + 2 elseif x_max == x_color.b then x_wl = (x_color.r - x_color.g) / x_diff + 4 end local y_color = y.colors[i] local y_max = math.max(y_color.r, y_color.g, y_color.b) local y_min = math.min(y_color.r, y_color.g, y_color.b) local y_diff = y_max - y_min local y_wl if y_max == y_min then y_wl = 10 - y_color.r elseif y_max == y_color.r then y_wl = (y_color.g - y_color.b) / y_diff % 6 elseif y_max == y_color.g then y_wl = (y_color.b - y_color.r) / y_diff + 2 elseif y_max == y_color.b then y_wl = (y_color.r - y_color.g) / y_diff + 4 end if x_wl ~= y_wl then return x_wl < y_wl end end end x_pc = x.pc or x.pcs and x.pcs[1] or 1001 y_pc = y.pc or y.pcs and y.pcs[1] or 1001 x_pc = x_pc + (x.global_value and tweak_data.lootdrop.global_values[x.global_value].sort_number or 0) y_pc = y_pc + (y.global_value and tweak_data.lootdrop.global_values[y.global_value].sort_number or 0) return x_pc < y_pc end) local max_x = 6 local max_y = 3 local mod_data = mods or {} table.insert(new_node_data, { name = category, category = category, prev_node_data = data, name_localized = managers.localization:to_upper_text("bm_menu_" .. category), on_create_func_name = "populate_choose_mask_mod", on_create_data = mod_data, override_slots = {max_x, max_y}, identifier = BlackMarketGui.identifiers.weapon_customization }) end local weapon_name = WeaponCustomization._is_previewing and WeaponCustomization._is_previewing.data and WeaponCustomization._is_previewing.data.name_localized new_node_data.topic_id = "bm_menu_customize_weapon_title" new_node_data.topic_params = { weapon_name = weapon_name or data.name_localized } new_node_data.blur_fade = self._data and self._data.blur_fade or 0 new_node_data.weapon_slot_data = data if data.category == "primaries" or data.category == "secondaries" then managers.blackmarket:view_weapon( data.category, data.slot, callback(self, self, "_open_weapon_customization_preview_node", {new_node_data}) ) end if data.category == "melee_weapons" then managers.blackmarket._customizing_weapon_data = new_node_data managers.blackmarket:preview_melee_weapon(data.name) end end function WeaponCustomization._open_weapon_customization_preview_node(self, data) if not managers.blackmarket._customizing_weapon_data and not data then return end managers.blackmarket._customizing_weapon = true if data then managers.blackmarket._customizing_weapon_data = data[1].weapon_slot_data else data = { managers.blackmarket._customizing_weapon_data } managers.blackmarket._customizing_weapon_data = managers.blackmarket._customizing_weapon_data.weapon_slot_data end local weapon_data = managers.blackmarket._customizing_weapon_data if not weapon_data then return end local category = weapon_data.category local slot = weapon_data.slot local weapon = WeaponCustomization:GetWeaponTableFromInventory( weapon_data ) WeaponCustomization:CreateCustomizablePartsList( weapon, category == "melee_weapons" ) managers.blackmarket._selected_weapon_parts = clone( WeaponCustomization._default_part_visual_blueprint ) WeaponCustomization._controller_index = { modifying = 1, not_modifying = 1, } managers.menu:open_node( "blackmarket_mask_node", data ) WeaponCustomization:LoadCurrentWeaponCustomization( weapon_data ) end Hooks:Add("MenuSceneManagerOverrideSceneTemplate", "MenuSceneManagerOverrideSceneTemplate_WeaponCustomization", function(scene, template, data, custom_name, skip_transition) if managers.blackmarket._customizing_weapon and template == "blackmarket_mask" then return "blackmarket_item" end end) Hooks:Add("BlackMarketGUIStartPageData", "BlackMarketGUIStartPageData_WeaponCustomization", function(gui) if gui.identifiers then gui.identifiers.weapon_customization = Idstring("weapon_customization") end end) Hooks:Add("BlackMarketGUIPostSetup", "BlackMarketGUIPostSetup_WeaponCustomization", function(gui, is_start_page, component_data) if Utils:IsInGameState() then return end gui.customize_weapon_visuals = function(gui, data) WeaponCustomization.weapon_visual_customization_callback(gui, data) end gui._open_weapon_customization_preview_node = function(gui, data) WeaponCustomization._open_weapon_customization_preview_node(gui, data) end local w_visual_customize = { prio = 5, btn = "BTN_BACK", pc_btn = "toggle_chat", name = "bm_menu_customize_weapon", callback = callback(gui, gui, "customize_weapon_visuals") } local btn_x = 10 gui._btns["w_visual_customize"] = BlackMarketGuiButtonItem:new(gui._buttons, w_visual_customize, btn_x) end) Hooks:Add("BlackMarketGUIOnPopulateWeaponActionList", "BlackMarketGUIOnPopulateWeaponActionList_WeaponCustomization", function(gui, data) if data.unlocked then table.insert(data, "w_visual_customize") end end) Hooks:Add("BlackMarketGUIOnPopulateMeleeWeaponActionList", "BlackMarketGUIOnPopulateMeleeWeaponActionList_WeaponCustomization", function(gui, data) if data.unlocked and not WeaponCustomization._invalid_melee_weapons[data.name] then table.insert(data, "w_visual_customize") end end) Hooks:Add("BlackMarketGUIOnPopulateWeapons", "BlackMarketGUIOnPopulateWeapons_WeaponCustomization", function(gui, category, data) if managers.blackmarket._customizing_weapon then managers.blackmarket._customizing_weapon = nil end end) Hooks:Add("BlackMarketGUIChooseMaskPartCallback", "BlackMarketGUIChooseMaskPartCallback_WeaponCustomization", function(gui, data) WeaponCustomization:UpdateWeaponPartsWithMaskMod( data ) end) Hooks:Add("BlackMarketGUIButtonPostSetTextParameters", "BlackMarketGUIButtonPostSetTextParameters_WeaponCustomization", function(self, params) local bm = BlackMarketGui._instance if bm then local tab_data = bm._tabs[bm._selected]._data if tab_data.identifier == bm.identifiers.weapon_customization then self._btn_text:set_text( self._btn_text:text():lower():gsub("mask", "weapon"):upper() ) BlackMarketGui.make_fine_text(self, self._btn_text) end end end) Hooks:Add("BlackMarketGUIUpdateInfoText", "BlackMarketGUIUpdateInfoText_WeaponCustomization", function(self) local slot_data = self._slot_data local tab_data = self._tabs[self._selected]._data local prev_data = tab_data.prev_node_data local ids_category = slot_data and slot_data.category and Idstring(slot_data.category) local identifier = tab_data.identifier local updated_texts = { {text = ""}, {text = ""}, {text = ""}, {text = ""}, {text = ""}, } local id = "none" for k, v in pairs( self.identifiers ) do if v == identifier then id = k end end if identifier == self.identifiers.weapon_customization then if not WeaponCustomization._select_rect or not alive( WeaponCustomization._select_rect ) then WeaponCustomization._select_rect = self._panel:child("info_box_panel"):rect({ name = "wc_select_rect", blend_mode = "add", color = tweak_data.screen_colors.button_stage_3, alpha = 0.3, valign = "scale", halign = "scale", x = 10, y = 10, w = self._panel:child("info_box_panel"):w() - 20, h = tweak_data.menu.pd2_small_font_size * WeaponCustomization._menu_text_scaling, }) end local blackmarket = managers.blackmarket if blackmarket._customizing_weapon and blackmarket._customizing_weapon_data and blackmarket._customizing_weapon_parts then local weapon_data = managers.blackmarket._customizing_weapon_data local category = weapon_data.category local slot = weapon_data.slot local weapon = WeaponCustomization:GetWeaponTableFromInventory( weapon_data ) if not WeaponCustomization:_IsCustomizingMeleeWeapon() then updated_texts[2].text = managers.localization:to_upper_text("wc_modifying_parts") .. "\n" updated_texts[3].text = managers.localization:to_upper_text("wc_not_modifying_parts") .. "\n" if WeaponCustomization:IsUsingController() then updated_texts[2].text = BTN_LT .. " " .. updated_texts[2].text updated_texts[3].text = BTN_RT .. " " .. updated_texts[3].text end local num_modifying = 0 local num_not_modifying = 0 for k, v in pairs( blackmarket._customizing_weapon_parts ) do if v and v.modifying then num_modifying = num_modifying + 1 else num_not_modifying = num_not_modifying + 1 end end local modifying_lines = 0 local not_modifying_lines = 0 for k, v in pairs( blackmarket._customizing_weapon_parts ) do if v.id then local part = tweak_data.weapon.factory.parts[v.id] if part then local part_name = WeaponCustomization:_GetLocalizedPartName(v.id, part) local modifying = (v and v.modifying or false) local part_index = modifying and 2 or 3 if WeaponCustomization:IsUsingController() then if v and v.modifying then modifying_lines = modifying_lines + 1 else not_modifying_lines = not_modifying_lines + 1 end -- Clamp values if WeaponCustomization._controller_index.modifying > num_modifying then WeaponCustomization._controller_index.modifying = 1 end if WeaponCustomization._controller_index.not_modifying > num_not_modifying then WeaponCustomization._controller_index.not_modifying = 1 end -- Place markers on appropriate lines local ind = WeaponCustomization:_GetIndexFromLine(modifying and modifying_lines or not_modifying_lines, modifying) if modifying then if WeaponCustomization._controller_index.modifying == modifying_lines then part_name = BTN_X .. " " .. part_name end else if WeaponCustomization._controller_index.not_modifying == not_modifying_lines then part_name = BTN_Y .. " " .. part_name end end end part_name = " " .. part_name .. "\n" updated_texts[ part_index ].text = updated_texts[ part_index ].text .. part_name end end end end end -- Add advanced options self._info_texts_color[5] = tweak_data.screen_colors.text updated_texts[5].text = "\n" if WeaponCustomization:IsUsingController() then updated_texts[5].text = updated_texts[5].text .. BTN_START .. " " end updated_texts[5].text = updated_texts[5].text .. managers.localization:to_upper_text("wc_advanced_options") .. "\n" for k, v in ipairs( WeaponCustomization._advanced_menu_options ) do updated_texts[5].text = updated_texts[5].text .. managers.localization:text( v.text ) .. "\n" end -- Selected Mod updated_texts[4].text = WeaponCustomization:_IsCustomizingMeleeWeapon() and "" or "\n" if slot_data then updated_texts[4].text = updated_texts[4].text .. managers.localization:to_upper_text("wc_highlighted_mod") .. "\n" .. slot_data.name_localized if not slot_data.unlocked or (type(slot_data.unlocked) == "number" and slot_data.unlocked <= 0) then self._info_texts_color[5] = tweak_data.screen_colors.important_1 updated_texts[5].text = managers.localization:text("wc_unavailable_mod") end end -- Update texts self:_update_info_text(slot_data, updated_texts, nil, WeaponCustomization._menu_text_scaling) end end) Hooks:Add("BlackMarketGUIOnMouseMoved", "BlackMarketGUIOnMouseMoved_WeaponCustomization", function(gui, button, x, y) WeaponCustomization:UpdateHighlight(gui, button, x, y) end) Hooks:Add("BlackMarketGUIMouseReleased", "BlackMarketGUIMouseReleased_WeaponCustomization", function(gui, button, x, y) if not managers.blackmarket._customizing_weapon then return end if button == Idstring("0") then WeaponCustomization:LeftMouseReleased(gui, button, x, y) end if button == Idstring("1") then WeaponCustomization:RightMouseReleased(gui, button, x, y) end end) Hooks:Add("MenuUpdate", "MenuUpdate_WeaponCustomization", function(t, dt) if managers.blackmarket._customizing_weapon then WeaponCustomization:_UpdateControllerBindings() end end) Hooks:Add("BlackMarketGUIOnPopulateWeapons", "BlackMarketGUIOnPopulateWeapons_WeaponCustomization", function(gui, category, data) managers.blackmarket._customizing_weapon_data = nil WeaponCustomization:RestoreMenuColourGrading() end) function WeaponCustomization:_UpdateControllerBindings() if WeaponCustomization:IsUsingController() then local controller = managers.menu:get_controller() local r_trigger = controller:get_input_pressed("primary_attack") local l_trigger = controller:get_input_pressed("secondary_attack") local button_x = controller:get_input_pressed("reload") local button_y = controller:get_input_pressed("switch_weapon") local start = controller:get_input_pressed("start") -- Cycle through modifying and not modifying options if r_trigger then WeaponCustomization._controller_index.not_modifying = WeaponCustomization._controller_index.not_modifying + 1 WeaponCustomization:_UpdateBlackmarketGUI() end if l_trigger then WeaponCustomization._controller_index.modifying = WeaponCustomization._controller_index.modifying + 1 WeaponCustomization:_UpdateBlackmarketGUI() end -- Switch modifying and not modifying items if button_x then WeaponCustomization:_SwapWeaponPartModifyingStatus(WeaponCustomization._controller_index.modifying, true, true) end if button_y then WeaponCustomization:_SwapWeaponPartModifyingStatus(WeaponCustomization._controller_index.not_modifying, false, true) end -- Controller advanced options if start then WeaponCustomization:ShowControllerAdvancedOptions() end end end function WeaponCustomization:_UpdateBlackmarketGUI() if managers.menu_component and managers.menu_component._blackmarket_gui then managers.menu_component._blackmarket_gui:update_info_text() end end function WeaponCustomization:UpdateHighlight(gui, button, x, y) if not gui then return end local inside = false for k, v in pairs( gui._info_texts ) do if v:inside(x, y) and gui._info_texts_panel:inside(x, y) then local line, line_str = WeaponCustomization:_GetLineFromObjectRect(x, y, v) line = line - 1 if alive( WeaponCustomization._select_rect ) and line and (not string.is_nil_or_empty(line_str) and line_str ~= '\n') then inside = true line = line < 0 and 0 or line WeaponCustomization._select_rect:set_alpha( 0.3 ) local lh = tweak_data.menu.pd2_small_font_size * WeaponCustomization._menu_text_scaling WeaponCustomization._select_rect:set_y( v:y() + line * lh + lh * 0.5 + line ) if WeaponCustomization._select_rect_line ~= line then WeaponCustomization._select_rect_line = line managers.menu_component:post_event("highlight") end end end end if not inside then if alive( WeaponCustomization._select_rect ) then WeaponCustomization._select_rect:set_alpha( 0 ) end end end function WeaponCustomization:LeftMouseReleased(gui, button, x, y) WeaponCustomization:LeftMouseReleased_SelectParts(gui, button, x, y) WeaponCustomization:LeftMouseReleased_Advanced(gui, button, x, y) end function WeaponCustomization:LeftMouseReleased_SelectParts(gui, button, x, y) for k, v in pairs( gui._info_texts ) do if v:inside(x, y) then local line = WeaponCustomization:_GetLineFromObjectRect(x, y, v) - 1 local modifying_item = nil if k == 2 then modifying_item = true end if k == 3 then modifying_item = false end if modifying_item ~= nil then WeaponCustomization:_SwapWeaponPartModifyingStatus(line, modifying_item) gui:update_info_text() managers.menu_component:post_event("menu_enter") break end end end end function WeaponCustomization:LeftMouseReleased_Advanced(gui, button, x, y) local v = gui._info_texts[5] if not v then return end if v:inside(x, y) then local line = WeaponCustomization:_GetLineFromObjectRect(x, y, v) - 2 local adv_option = self._advanced_menu_options[ line ] if adv_option and adv_option.func then self[ adv_option.func ](self) managers.menu_component:post_event("menu_enter") end end end function WeaponCustomization:RightMouseReleased(gui, button, x, y) for k, v in pairs( gui._info_texts ) do if v:inside(x, y) then local line = WeaponCustomization:_GetLineFromObjectRect(x, y, v) - 1 local modifying_item = nil if k == 2 then modifying_item = true end if k == 3 then modifying_item = false end if modifying_item ~= nil then local tbl_index = WeaponCustomization:_GetIndexFromLine(line, modifying_item) if tbl_index and managers.blackmarket._customizing_weapon_parts[ tbl_index ] then local mod = managers.blackmarket._customizing_weapon_parts[ tbl_index ].modifying for a, b in ipairs( managers.blackmarket._customizing_weapon_parts ) do if a ~= tbl_index then managers.blackmarket._customizing_weapon_parts[a].modifying = not mod end end end gui:update_info_text() managers.menu_component:post_event("menu_enter") break end end end end function WeaponCustomization:_SwapWeaponPartModifyingStatus( line, modifying, update ) local tbl_index = WeaponCustomization:_GetIndexFromLine(line, modifying) if tbl_index and managers.blackmarket._customizing_weapon_parts[ tbl_index ] then managers.blackmarket._customizing_weapon_parts[ tbl_index ].modifying = not managers.blackmarket._customizing_weapon_parts[ tbl_index ].modifying end if update then WeaponCustomization:_UpdateBlackmarketGUI() end end function WeaponCustomization:_GetLineFromObjectRect(x, y, obj) local rx, ry, rw, rh = obj:text_rect() local font_size = tweak_data.menu.pd2_small_font_size * WeaponCustomization._menu_text_scaling y = y - ry + font_size / 2 y = y / (font_size * 1.05) local line = math.round_with_precision(y, 0) local strs = string.split( obj:text(), "[\n]" ) if strs and obj:text():sub(1, 1) == '\n' then table.insert( strs, 1, "\n" ) end if strs then return line, strs[line] end return line end function WeaponCustomization:_GetIndexFromLine(line, modifying) local i = 0 for k, v in ipairs( managers.blackmarket._customizing_weapon_parts ) do if (modifying and v.modifying) or (not modifying and not v.modifying) then i = i + 1 if i == line then return k end end end return nil end function WeaponCustomization:_IsCustomizingMeleeWeapon() if managers.blackmarket._customizing_weapon_data then local weapon_data = managers.blackmarket._customizing_weapon_data local category = weapon_data.category if category == "primaries" or category == "secondaries" then return false else return true end end end -- Clear Weapon Function function WeaponCustomization:AdvancedToggleWeaponSpin() if managers.menu_scene then if managers.menu_scene._disable_rotate ~= nil then managers.menu_scene._disable_rotate = not managers.menu_scene._disable_rotate else managers.menu_scene._disable_rotate = true end end end function WeaponCustomization:AdvancedToggleColourGrading() if managers and managers.environment_controller then local self = WeaponCustomization local grading = "color_payday" if self._previous_colour_grading then grading = self._previous_colour_grading self._previous_colour_grading = nil else self._previous_colour_grading = managers.environment_controller:default_color_grading() end managers.environment_controller:set_default_color_grading( grading ) managers.environment_controller:refresh_render_settings() end end function WeaponCustomization:RestoreMenuColourGrading() managers.environment_controller:set_default_color_grading( "color_matrix" ) managers.environment_controller:refresh_render_settings() self._previous_colour_grading = nil end function WeaponCustomization:AdvancedClearWeaponCheck() local title = managers.localization:text("wc_clear_weapon_title") local message = managers.localization:text("wc_clear_weapon_message") local menuOptions = {} menuOptions[1] = { text = managers.localization:text("wc_clear_weapon_accept"), callback = callback(self, self, "_AdvancedClearWeaponAccept") } menuOptions[2] = { text = managers.localization:text("wc_clear_weapon_cancel"), is_cancel_button = true } local menu = QuickMenu:new(title, message, menuOptions, true) end function WeaponCustomization:_AdvancedClearWeaponAccept() if not managers.blackmarket._customizing_weapon_data then return end local category = managers.blackmarket._customizing_weapon_data.category local weapon = self:GetWeaponTableFromInventory( managers.blackmarket._customizing_weapon_data ) -- Rebuild weapon parts list if category ~= "melee_weapons" then self:CreateCustomizablePartsList( weapon ) end -- Clear selected parts managers.blackmarket._selected_weapon_parts = clone( WeaponCustomization._default_part_visual_blueprint ) -- Save self:UpdateWeaponPartsWithMod( nil, nil, managers.blackmarket._customizing_weapon_parts, category ~= "melee_weapons" ) -- Clear data on slot if weapon.visual_blueprint then weapon.visual_blueprint = nil end end -- Advanced options for controller function WeaponCustomization:ShowControllerAdvancedOptions() local title = managers.localization:text("wc_advanced_options_menu") local message = "" local menuOptions = {} menuOptions[1] = { text = managers.localization:text("wc_adv_toggle_preview_spin"), callback = callback(self, self, "AdvancedToggleWeaponSpin") } menuOptions[2] = { text = managers.localization:text("wc_adv_toggle_colour_grading"), callback = callback(self, self, "AdvancedToggleColourGrading") } menuOptions[3] = { text = managers.localization:text("wc_adv_clear_weapon"), callback = callback(self, self, "AdvancedClearWeaponCheck") } menuOptions[4] = { text = managers.localization:text("wc_clear_weapon_cancel"), is_cancel_button = true } local menu = QuickMenu:new(title, message, menuOptions, true) end -- Inventory Hooks function WeaponCustomization:NewInventoryOpenWeaponCustomization( weapon_category ) -- Look for equipped weapon for slot, data in pairs( Global.blackmarket_manager.crafted_items[weapon_category] ) do if data.equipped then -- Preview the weapon using the weapon customizer local data = { slot = slot, category = weapon_category, name = data.weapon_id, name_localized = args and args["text_object"] and args["text_object"]["selected_text"] or data.weapon_id, data = data, } GoonBase.WeaponCustomization.weapon_visual_customization_callback(GoonBase.WeaponCustomization, data) return true end end -- Didn't find one, so fallback to regular preview return nil end Hooks:Add("PlayerInventoryGUIOnPreviewPrimary", "PlayerInventoryGUIOnPreviewPrimary.WeaponCustomization", function( inv, args ) return WeaponCustomization:NewInventoryOpenWeaponCustomization( "primaries" ) end) Hooks:Add("PlayerInventoryGUIOnPreviewSecondary", "PlayerInventoryGUIOnPreviewSecondary.WeaponCustomization", function( inv, args ) return WeaponCustomization:NewInventoryOpenWeaponCustomization( "secondaries" ) end) Hooks:Add("PlayerInventoryGUIOnPreviewMelee", "PlayerInventoryGUIOnPreviewMelee.WeaponCustomization", function( inv, args ) -- Look for equipped weapon local wep_id = nil local wep_data = nil for id, data in pairs( managers.blackmarket._global.melee_weapons ) do if data.equipped then -- Preview the weapon using the weapon customizer local data = { category = "melee_weapons", name = id, name_localized = args and args["text_object"] and args["text_object"]["selected_text"] or id, data = data, } GoonBase.WeaponCustomization.weapon_visual_customization_callback(GoonBase.WeaponCustomization, data) return true end end -- Didn't find one, so fallback to regular preview return nil end)
------------------------------------------------------------------------------ -- Dialog class ------------------------------------------------------------------------------ local ctrl = { nick = "dialog", parent = iup.WIDGET, creation = "I", callback = { map_cb = "", unmap_cb = "", destroy_cb = "", close_cb = "", show_cb = "n", move_cb = "nn", tips_cb = "nn", copydata_cb = "sn", trayclick_cb = "nnn", dropfiles_cb = "snnn", } } function ctrl.createElement(class, param) return iup.Dialog(param[1]) end function ctrl.popup(handle, x, y) iup.Popup(handle,x,y) end function ctrl.showxy(handle, x, y) return iup.ShowXY(handle, x, y) end function ctrl.destroy(handle) return iup.Destroy(handle) end iup.RegisterWidget(ctrl) iup.SetClass(ctrl, "iup widget")
include('shared.lua') function ENT:Draw() self.Entity:DrawModel() end function ENT:IsTranslucent() return false end
ZO_CreateStringId("SI_JOGROUP_SLASH1", "Thank you for using JoGroup!") ZO_CreateStringId("SI_JOGROUP_SLASH2", "-- Type |cFAF0E6/jogroup unlock|r to unlock and move the frames") ZO_CreateStringId("SI_JOGROUP_SLASH3", "-- Type |cFAF0E6/jogroup lock|r to lock the frames") ZO_CreateStringId("SI_JOGROUP_UNLOCKED", "JoGroup unlocked") ZO_CreateStringId("SI_JOGROUP_LOCKED", "JoGroup locked") ZO_CreateStringId("SI_JOGROUP_GROUPFRAMES", "Group Frames") ZO_CreateStringId("SI_JOGROUP_UNLOCK", "Unlock frames (for moving)") ZO_CreateStringId("SI_JOGROUP_UNLOCKTIP", "You can also type /jogroup unlock and /jogroup lock") ZO_CreateStringId("SI_JOGROUP_SHOWDEFAULT", "Show default group/raidframes") ZO_CreateStringId("SI_JOGROUP_NOTIFICATIONS", "Show notifications") ZO_CreateStringId("SI_JOGROUP_OORALPHA", "Out of support range opacity") ZO_CreateStringId("SI_JOGROUP_UNITSPCOL", "Units per column") ZO_CreateStringId("SI_JOGROUP_UNITSX", "Horizontal growth direction") ZO_CreateStringId("SI_JOGROUP_UNITSY", "Vertical growth direction") ZO_CreateStringId("SI_JOGROUP_GLOSSALPHA", "Healthbar glossiness") ZO_CreateStringId("SI_JOGROUP_PADDING", "Space between units") ZO_CreateStringId("SI_JOGROUP_SHOWHIDE", "Show/Hide") ZO_CreateStringId("SI_JOGROUP_SHOWACCTNAME", "Show @Account names in Group Frames") ZO_CreateStringId("SI_JOGROUP_SHOWVRCROWN", "Indicate group difficulty using the group leader icon") ZO_CreateStringId("SI_JOGROUP_SHOWVRCROWNTIP", "When this is set to True, the group leader's icon changes to the Veteran icon when the dungeon difficulty is set to Veteran, and set to a crown when dungeons are set to normal difficulty. When this is set to False, the icon is always a crown.") ZO_CreateStringId("SI_JOGROUP_SHOWHEALTHVALUES", "Show health values") ZO_CreateStringId("SI_JOGROUP_SHOWFULLHEALTHNUMBER", "Show full number for health") ZO_CreateStringId("SI_JOGROUP_SHOWFULLHEALTHNUMBERTIP", "When set to True, a health value will display as, for example, 16766. When set to False, it would display as 17k.") ZO_CreateStringId("SI_JOGROUP_SHOWFOOD", "Show food buffs") ZO_CreateStringId("SI_JOGROUP_SHOWREGEN", "Show regen arrows") ZO_CreateStringId("SI_JOGROUP_SHOWBOTH", "Always show both Magicka and Stamina bars") ZO_CreateStringId("SI_JOGROUP_SHOWHORN", "Show War Horn") ZO_CreateStringId("SI_JOGROUP_SHOWCRSHADE", "Warn for Cloudrest Shade from Corpse") ZO_CreateStringId("SI_JOGROUP_FONTFAM", "Font family") ZO_CreateStringId("SI_JOGROUP_FONTSIZE", "Font size / Unit height") ZO_CreateStringId("SI_JOGROUP_UNITWIDTH", "Unit width") ZO_CreateStringId("SI_JOGROUP_TANKCOLOUR", "Tank healthbar colour") ZO_CreateStringId("SI_JOGROUP_HEALERCOLOUR", "Healer healthbar colour") ZO_CreateStringId("SI_JOGROUP_DPSCOLOUR", "DPS healthbar colour") ZO_CreateStringId("SI_JOGROUP_REINCARNATING", "Reincarnating") -- Limited space! ZO_CreateStringId("SI_JOGROUP_BEINGRESSED", "Being ressed") -- Limited space! ZO_CreateStringId("SI_JOGROUP_RESPENDING", "Res pending") -- Limited space! ZO_CreateStringId("SI_JOGROUP_JOINED", "<<1>> has joined the group.") ZO_CreateStringId("SI_JOGROUP_MARK", "Mark player") ZO_CreateStringId("SI_JOGROUP_UNMARK", "Remove mark")
#!/usr/bin/env gamecake local lcs={ ["lib_chipmonk"] ="lib_chipmonk/LICENSE.txt", ["lib_freetype"] ="lib_freetype/freetype/docs/LICENSE.TXT", ["lib_gif"] ="lib_gif/COPYING", ["lib_hidapi"] ="lib_hidapi/LICENSE-bsd.txt", ["lib_jpeg"] ="lib_jpeg/README", ["lib_lua"] ="lib_lua/COPYRIGHT", ["lib_luajit"] ="lib_luajit/COPYRIGHT", ["lib_ogg"] ="lib_ogg/COPYING", ["lib_openal"] ="lib_openal/asoft/COPYING", ["lib_openssl"] ="lib_openssl/LICENSE", ["lib_pcre"] ="lib_pcre/LICENCE", ["lib_png"] ="lib_png/LICENSE", ["lib_vorbis"] ="lib_vorbis/COPYING", ["lib_vpx"] ="lib_vpx/git/LICENSE", ["lib_z"] ="lib_z/README", ["lib_zzip"] ="lib_zzip/COPYING.LIB", ["lua_bit"] ="lua_bit/README", ["lua_lanes"] ="lua_lanes/COPYRIGHT", ["lua_lash"] ="lua_lash/src/LICENSE", ["lua_lfs"] ="lua_lfs/LICENSE", ["lua_posix"] ="lua_posix/COPYING", ["lua_profiler"] ="lua_profiler/LICENSE", ["lua_sec"] ="lua_sec/LICENSE", ["lua_socket"] ="lua_socket/LICENSE", ["lua_zip"] ="lua_zip/LICENSE", ["lua_zlib"] ="lua_zip/README", } local wbake=require("wetgenes.bake") local head=[[ Files: * Copyright: 2013 Kriss Blank <kriss@wetgenes.com> License: The MIT License (MIT) Copyright (c) 2013 Kriss Blank <kriss@wetgenes.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]] print(head) for n,v in pairs(lcs) do local d=wbake.readfile(v) local t=" "..string.gsub(d,"\n","\n ") print("Files: "..n.."/*") print("Copyright: ...") print("License: ...") print(t.."\n") end
local shouldUpdatePosition = true local shouldUpdateRotation = false local shouldUpdateOrigin = false local second = 1E9 -- 1 billion nanoseconds local movingEntities function init() sub = director.subscriptions.new() sub.require(components.Transform) movingEntities = sub.build() director.addSubscription(movingEntities) end function update() for _, eid in ipairs(movingEntities.getEntities()) do updateEntity(eid) end end function updateEntity(eid) trs, found = scene.components.transform.get(eid) if not found then return end origin, found = scene.components.origin.get(eid) if not found then return end if shouldUpdatePosition then tx, ty, tz = trs.translation() tx, ty, tz = tx + 1, ty + 1, tz rw, rh = scene.sys.renderer.window.size() if tx > rw + 150 then tx = -150 end if ty > rh + 150 then ty = -150 end trs.translation(tx, ty, tz) end if shouldUpdateRotation then rx, ry, rz = trs.rotation() ry = ry + 1 trs.rotation(rx, ry, rz) end if shouldUpdateOrigin then n = elapsed / second ox, oy, oz = origin.xyz() ox = math.cos(n) oy = math.sin(n) origin.xyz(ox, oy, oz) end end
Player = Entity:extend() function Player:new() Player.super.new(self) self:loadImage("data/images/player.png", 8, 8) self:addAnimation("idle", { 1, 2 }, 1) self:playAnimation("idle") self.id = "player" end function Player:onClick() print("click!") end player = Player()
{ name = "evt_halloween_muertos", hasAdmin = false, authors = { "Bolodefchoco#0015" }, description = "Halloween 2018 - Day of the Dead event" }
local class = require "com/class" local ParticlePiece = class:derive("ParticlePiece") local Vec2 = require("src/Essentials/Vector2") local Sprite = require("src/Essentials/Sprite") function ParticlePiece:new(manager, spawner, data) self.manager = manager self.packet = spawner.packet self.spawner = spawner self.spawner.pieceCount = self.spawner.pieceCount + 1 self.packetPos = self.packet.pos self.startPos = self.spawner.pos if not data.posRelative then self.startPos = self.spawner:getPos() end self.pos = self.startPos self.speedMode = data.speedMode self.spawnScale = parseVec2(data.spawnScale) self.posAngle = math.random() * math.pi * 2 local spawnRotVec = Vec2(1):rotate(self.posAngle) local spawnPos = spawnRotVec * self.spawnScale self.pos = self.pos + spawnPos if self.speedMode == "loose" then self.speed = parseVec2(data.speed) elseif self.speedMode == "radius" then self.speed = spawnPos * parseVec2(data.speed) elseif self.speedMode == "circle" then self.speed = parseNumber(data.speed) * math.pi / 180 -- convert degrees to radians else error("Unknown particle speed mode: " .. tostring(self.speedMode)) end if self.speedMode == "circle" then self.acceleration = parseNumber(data.acceleration) else self.acceleration = parseVec2(data.acceleration) end self.lifespan = parseNumber(data.lifespan) -- nil if it lives indefinitely self.lifetime = self.lifespan self.time = 0 self.sprite = game.resourceManager:getSprite(data.sprite) self.animationSpeed = data.animationSpeed self.animationFrameCount = data.animationFrameCount self.animationLoop = data.animationLoop self.fadeInPoint = data.fadeInPoint self.fadeOutPoint = data.fadeOutPoint self.posRelative = data.posRelative self.directionDeviation = false -- is switched to true after directionDeviationTime seconds (if that exists) self.directionDeviationTime = parseNumber(data.directionDeviationTime) self.directionDeviationSpeed = data.directionDeviationSpeed -- evaluated every frame self.animationFrame = data.animationFrameRandom and math.random(1, self.animationFrameCount) or 1 self.colorPalette = data.colorPalette and game.resourceManager:getColorPalette(data.colorPalette) self.colorPaletteSpeed = data.colorPaletteSpeed self.delQueue = false end function ParticlePiece:update(dt) -- lifespan if self.lifetime then self.lifetime = self.lifetime - dt if self.lifetime <= 0 then self:destroy() end end self.time = self.time + dt if not self.directionDeviation and self.directionDeviationTime and self.time >= self.directionDeviationTime then self.directionDeviation = true end -- position stuff if self.directionDeviation then self.speed = self.speed:rotate(parseNumber(self.directionDeviationSpeed) * dt) end self.speed = self.speed + self.acceleration * dt if self.speedMode == "circle" then self.posAngle = self.posAngle + self.speed * dt self.pos = self.startPos + (self.spawnScale * Vec2(1):rotate(self.posAngle)) else self.pos = self.pos + self.speed * dt end -- cache last packet position if self.packet then self.packetPos = self.packet.pos end -- animation self.animationFrame = self.animationFrame + self.animationSpeed * dt if self.animationFrame >= self.animationFrameCount + 1 then if self.animationLoop then self.animationFrame = self.animationFrame - self.animationFrameCount end --self:destroy() end -- detach when spawner/packet is gone if self.spawner and self.spawner.delQueue then self.spawner = nil end if self.packet and self.packet.delQueue then self.packet = nil end -- when living indefinitely and packet inexistent, destroy if not self.packet and not self.lifetime then self:destroy() end end function ParticlePiece:destroy() if self.delQueue then return end self.delQueue = true self.manager:destroyParticlePiece(self) if self.spawner then self.spawner.pieceCount = self.spawner.pieceCount - 1 end end function ParticlePiece:getPos() if self.posRelative then return self.packetPos + self.pos else return self.pos end end function ParticlePiece:getColor() if self.colorPalette then local t = (self.colorPaletteSpeed and self.time * self.colorPaletteSpeed or 0) return self.colorPalette:getColor(t) end end function ParticlePiece:getAlpha() if not self.lifespan then return 1 end if self.lifetime < self.lifespan * (1 - self.fadeOutPoint) then return self.lifetime / (self.lifespan * (1 - self.fadeOutPoint)) elseif self.lifetime > self.lifespan * (1 - self.fadeInPoint) then return 1 - (self.lifetime - self.lifespan * (1 - self.fadeInPoint)) / (self.lifespan * self.fadeInPoint) else return 1 end end function ParticlePiece:draw() self.sprite:draw(self:getPos(), Vec2(0.5), nil, Vec2(math.min(math.floor(self.animationFrame), self.animationFrameCount), 1), nil, self:getColor(), self:getAlpha()) end return ParticlePiece
-------------------------------------------------------------------------------- --<[ Внутренние события ]>------------------------------------------------------ -------------------------------------------------------------------------------- addEvent( "Lobby.onClientRequestDimension", true ) -- Клиент запросил ID измерения лобби () -------------------------------------------------------------------------------- --<[ Модуль Lobby ]>------------------------------------------------------------ -------------------------------------------------------------------------------- Lobby = { dimension = nil; init = function() addEventHandler( "Main.onServerLoad", root, Lobby.onServerLoad ) addEventHandler( "Lobby.onClientRequestDimension", resourceRoot, Lobby.onClientRequestDimension ) Main.setModuleLoaded( "Lobby", 1 ) end; onServerLoad = function() Lobby.dimension = Dimension.register( "Lobby" ) end; -- Клиент запросил ID измерения лобби onClientRequestDimension = function() triggerClientEvent( client, "Lobby.onDimensionRequest", resourceRoot, Lobby.dimension ) end; }; addEventHandler( "onResourceStart", resourceRoot, Lobby.init )
--[[ © 2020 TERRANOVA do not share, re-distribute or modify without permission of its author. --]] local META = ix.meta.charPanel or {} META.__index = META META.slots = META.slots or {} META.vars = META.vars or {} META.receivers = META.receivers or {} function META:__tostring() return "charpanel["..(self.id or 0).."]" end function META:GetID() return self.id or 0 end function META:GetOwner() for _, v in ipairs(player.GetAll()) do if (v:GetCharacter() and v:GetCharacter().id == self.owner) then return v end end end function META:HasEquipped() for _, v in pairs(self.slots) do return true end return false end function META:GetItems() local items = {} for k, v in pairs(self.slots) do table.insert(items, v) end return items or {} end function META:SetOwner(owner, fullUpdate) if (type(owner) == "Player" and owner:GetNetVar("char")) then owner = owner:GetNetVar("char") elseif (!isnumber(owner)) then return end if (SERVER) then if (fullUpdate) then for _, v in ipairs(player.GetAll()) do if (v:GetNetVar("char") == owner) then self:Sync(v, true) break end end end local query = mysql:Update("ix_charpanels") query:Update("character_id", owner) query:Where("panel_id", self:GetID()) query:Execute() end self.owner = owner end function META:OnCheckAccess(client) local bAccess = false for _, v in ipairs(self:GetReceivers()) do if (v == client) then bAccess = true break end end return bAccess end function META:GetItemAt(category) if (self.slots and self.slots[category]) then return self.slots[category] end end function META:Remove(id) for k, item in pairs(self.slots) do if(item and item.id == id) then self.slots[k] = nil end end if (SERVER) then local receivers = self:GetReceivers() if (istable(receivers)) then net.Start("ixCharPanelRemove") net.WriteUInt(id, 32) net.WriteUInt(self:GetID(), 32) net.Send(receivers) end end end function META:AddReceiver(client) self.receivers[client] = true end function META:RemoveReceiver(client) self.receivers[client] = nil end function META:GetReceivers() local result = {} if (self.receivers) then for k, _ in pairs(self.receivers) do if (IsValid(k) and k:IsPlayer()) then result[#result + 1] = k end end end return result end if (SERVER) then function META:SendSlot(category, item) local receivers = self:GetReceivers() local sendData = item and item.data and !table.IsEmpty(item.data) and item.data or {} net.Start("ixCharPanelSet") net.WriteUInt(self:GetID(), 32) net.WriteString(category) net.WriteString(item and item.uniqueID or "") net.WriteUInt(item and item.id or 0, 32) net.WriteUInt(self.owner or 0, 32) net.WriteTable(sendData) net.Send(receivers) end function META:Add(uniqueID, data, category) local client = self.GetOwner and self:GetOwner() or nil local item = isnumber(uniqueID) and ix.item.instances[uniqueID] or ix.item.list[uniqueID] local targetCharPanel = self if (!item) then return false, "invalidItem" end if (isnumber(uniqueID)) then if (category) then targetCharPanel.slots[category] = item item:Transfer(nil, nil, nil, item.player, nil, true, true) item.panelID = targetCharPanel:GetID() local query = mysql:Update("ix_items") query:Update("panel_id", targetCharPanel:GetID()) query:Where("item_id", item.id) query:Execute() hook.Run("CharPanelItemEquipped", client, item) targetCharPanel:SendSlot(category, item) return category, targetCharPanel:GetID() else return false, "noFit" end end end function META:Transfer(uniqueID, invID, x, y) local item = isnumber(uniqueID) and ix.item.instances[uniqueID] or ix.item.list[uniqueID] local inventory = ix.item.inventories[invID] local charPanel = self local world = 0 if (charPanel) then client = charPanel:GetOwner() or nil item.panelID = world hook.Run("CharPanelItemUnequipped", client, item) charPanel:Remove(item.id) if(invID == world) then item.invID = world inventory = ix.item.inventories[world] inventory[item:GetID()] = item local query = mysql:Update("ix_items") query:Update("inventory_id", world) query:Update("panel_id", world) query:Where("item_id", item.id) query:Execute() return item:Spawn(client) elseif(invID != world) then local targetInv = inventory local bagInv if (!item) then return false, "invalidItem" end if (isnumber(uniqueID)) then if (!x and !y) then x, y, bagInv = inventory:FindEmptySlot(item.width, item.height) end if (bagInv) then targetInv = bagInv end -- we need to check for owner since the item instance already exists if (!item.bAllowMultiCharacterInteraction and IsValid(client) and client:GetCharacter() and item:GetPlayerID() == client:SteamID64() and item:GetCharacterID() != client:GetCharacter():GetID()) then return false, "itemOwned" end if (hook.Run("CanTransferItem", item, ix.item.inventories[0], targetInv) == false) then return false, "notAllowed" end if (x and y) then targetInv.slots[x] = targetInv.slots[x] or {} targetInv.slots[x][y] = true item.gridX = x item.gridY = y item.invID = targetInv:GetID() for x2 = 0, item.width - 1 do local index = x + x2 for y2 = 0, item.height - 1 do targetInv.slots[index] = targetInv.slots[index] or {} targetInv.slots[index][y + y2] = item end end if (!noReplication) then targetInv:SendSlot(x, y, item) end if (!inventory.noSave) then local query = mysql:Update("ix_items") query:Update("inventory_id", targetInv:GetID()) query:Update("panel_id", world) query:Update("x", x) query:Update("y", y) query:Where("item_id", item.id) query:Execute() end --hook.Run("InventoryItemAdded", ix.item.inventories[oldInvID], targetInv, item) return x, y, targetInv:GetID() end return false, "noFit" end end else return false, "invalidInventory" end end function META:Sync(receiver, fullUpdate, func) local slots = {} for k, item in pairs(self.slots) do if (istable(item)) then slots[#slots + 1] = {item.uniqueID, item.id, item.outfitCategory, item.data} end end net.Start("ixCharPanelSync") net.WriteTable(slots) net.WriteUInt(self:GetID(), 32) net.WriteType((receiver == nil or fullUpdate) and self.owner or nil) net.WriteTable(self.vars or {}) net.Send(receiver) for _, v in pairs(self:GetItems()) do v:Call("OnSendData", receiver) end if(func) then func() end end end ix.meta.charPanel = META
--[[ A header, which is always exactly two numbers: The quantity of child nodes. The quantity of metadata entries. Zero or more child nodes (as specified in the header). One or more metadata entries (as specified in the header). ]]-- infile = io.open("2018_advent_8a.txt") input = infile:read("a") infile:close() summeta = 0 invec = {} for v in string.gmatch(input, "(%d+)") do invec[#invec+1] = tonumber(v) end print ("Read ", #invec, "values") function readtree (vec, i) local t = {} t.sz = vec[i] i = i + 1 t.ms = vec[i] i = i + 1 for j = 1, t.sz do c, e = readtree(vec, i) if e > #vec then print ("Error size ", e, #vec) end i = e t[j] = c end for j = 1, t.ms do local m = vec[i] i = i + 1 summeta = summeta + m t[j + t.sz] = m end return t, i end tree, vals = readtree(invec, 1) if (vals ~= (#invec + 1)) then print ("WARNING ", vals, "not eq", #invec) end print ("Part 1, Sum meta = ", summeta) --[[ The value of a node depends on whether it has child nodes. If a node has no child nodes, its value is the sum of its metadata entries. However, if a node does have child nodes, the metadata entries become indexes which refer to those child nodes. A metadata entry of 1 refers to the first child node, 2 to the second, 3 to the third, and so on. The value of this node is the sum of the values of the child nodes referenced by the metadata entries. If a referenced child node does not exist, that reference is skipped. A child node can be referenced multiple time and counts each time it is referenced. A metadata entry of 0 does not refer to any child node. ]] function treeval (t) local sum = 0 if t.sz == 0 then for i = 1, t.ms do sum = sum + t[i] end else for i = 1, t.ms do local m = t[i + t.sz] if m < 1 or m > t.sz then -- skip else sum = sum + treeval(t[m]) end end end return sum end print ("Part 2, Sum tree = ", treeval(tree)) print ("Done")
game.Workspace.epicikr.Humanoid.MaxHealth = math.huge --Mediafire
if GetBot():IsInvulnerable() or not GetBot():IsHero() or not string.find(GetBot():GetUnitName(), "hero") or GetBot():IsIllusion() then return; end local ability_item_usage_generic = dofile( GetScriptDirectory().."/ability_item_usage_generic" ) local utils = require(GetScriptDirectory() .. "/util") local mutil = require(GetScriptDirectory() .. "/MyUtility") function AbilityLevelUpThink() ability_item_usage_generic.AbilityLevelUpThink(); end function BuybackUsageThink() ability_item_usage_generic.BuybackUsageThink(); end function CourierUsageThink() ability_item_usage_generic.CourierUsageThink(); end function ItemUsageThink() ability_item_usage_generic.ItemUsageThink() end local castHMDesire = 0; local castRBDesire = 0; local castCDDesire = 0; local castFCDesire = 0; local abilityHM = nil; local abilityRB = nil; local abilityCD = nil; local abilityFC = nil; local npcBot = nil; function AbilityUsageThink() if npcBot == nil then npcBot = GetBot(); end -- Check if we're already using an ability if mutil.CanNotUseAbility(npcBot) then return end if abilityHM == nil then abilityHM = npcBot:GetAbilityByName( "gyrocopter_homing_missile" ) end if abilityRB == nil then abilityRB = npcBot:GetAbilityByName( "gyrocopter_rocket_barrage" ) end if abilityCD == nil then abilityCD = npcBot:GetAbilityByName( "gyrocopter_call_down" ) end if abilityFC == nil then abilityFC = npcBot:GetAbilityByName( "gyrocopter_flak_cannon" ) end -- Consider using each ability castHMDesire, castHMTarget = ConsiderHomingMissile(); castRBDesire = ConsiderRocketBarrage(); castCDDesire, castCDLocation = ConsiderCallDown(); castFCDesire = ConsiderFlakCannon(); if ( castCDDesire > 0 ) then npcBot:Action_UseAbilityOnLocation( abilityCD, castCDLocation ); return; end if ( castRBDesire > 0 ) then npcBot:Action_UseAbility( abilityRB ); return; end if ( castFCDesire > 0 ) then npcBot:Action_UseAbility ( abilityFC ); return; end if ( castHMDesire > 0 ) then npcBot:Action_UseAbilityOnEntity( abilityHM, castHMTarget ); return; end end function ConsiderHomingMissile() -- Make sure it's castable if ( not abilityHM:IsFullyCastable() ) then return BOT_ACTION_DESIRE_NONE, 0; end -- Get some of its values local nCastRange = abilityHM:GetCastRange(); local nDamage = abilityHM:GetAbilityDamage(); -------------------------------------- -- Mode based usage -------------------------------------- -- If a mode has set a target, and we can kill them, do it local npcTarget = npcBot:GetTarget(); if mutil.IsValidTarget(npcTarget) and mutil.CanCastOnMagicImmune(npcTarget) and mutil.CanKillTarget(npcTarget,nDamage,DAMAGE_TYPE_MAGICAL) and mutil.IsInRange(npcTarget, npcBot, nCastRange+200) then return BOT_ACTION_DESIRE_MODERATE, npcTarget; end -- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently if mutil.IsRetreating(npcBot) then local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE ); for _,npcEnemy in pairs( tableNearbyEnemyHeroes ) do if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) and mutil.CanCastOnMagicImmune(npcEnemy) ) then return BOT_ACTION_DESIRE_MODERATE, npcEnemy; end end end if mutil.IsInTeamFight(npcBot, 1200) then local npcMostDangerousEnemy = nil; local nMostDangerousDamage = 0; local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange, true, BOT_MODE_NONE ); for _,npcEnemy in pairs( tableNearbyEnemyHeroes ) do if ( mutil.CanCastOnMagicImmune(npcEnemy) ) then local nDamage = npcEnemy:GetEstimatedDamageToTarget( false, npcBot, 3.0, DAMAGE_TYPE_ALL ); if ( nDamage > nMostDangerousDamage ) then nMostDangerousDamage = nDamage; npcMostDangerousEnemy = npcEnemy; end end end if ( npcMostDangerousEnemy ~= nil ) then return BOT_ACTION_DESIRE_HIGH, npcMostDangerousEnemy; end end -- If we're going after someone if mutil.IsGoingOnSomeone(npcBot) then local npcTarget = npcBot:GetTarget(); if mutil.IsValidTarget(npcTarget) and mutil.CanCastOnNonMagicImmune(npcTarget) and mutil.IsInRange(npcTarget, npcBot, nCastRange+200) then return BOT_ACTION_DESIRE_HIGH, npcTarget; end end return BOT_ACTION_DESIRE_NONE, 0; end function ConsiderRocketBarrage() -- Make sure it's castable if ( not abilityRB:IsFullyCastable() ) then return BOT_ACTION_DESIRE_NONE; end -- Get some of its values local nRadius = abilityRB:GetSpecialValueInt( "radius" ); -------------------------------------- -- Mode based usage -------------------------------------- -- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently if mutil.IsRetreating(npcBot) then local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nRadius, true, BOT_MODE_NONE ); for _,npcEnemy in pairs( tableNearbyEnemyHeroes ) do if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) then return BOT_ACTION_DESIRE_MODERATE; end end end if ( npcBot:GetActiveMode() == BOT_MODE_ROSHAN ) then local npcTarget = npcBot:GetAttackTarget(); if ( mutil.IsRoshan(npcTarget) and mutil.CanCastOnMagicImmune(npcTarget) and mutil.IsInRange(npcTarget, npcBot, nRadius) ) then return BOT_ACTION_DESIRE_LOW; end end if mutil.IsInTeamFight(npcBot, 1200) then local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nRadius - 100, true, BOT_MODE_NONE ); if tableNearbyEnemyHeroes ~= nil and #tableNearbyEnemyHeroes >= 1 then return BOT_ACTION_DESIRE_MODERATE; end end -- If we're going after someone if mutil.IsGoingOnSomeone(npcBot) then local npcTarget = npcBot:GetTarget(); if mutil.IsValidTarget(npcTarget) and mutil.CanCastOnNonMagicImmune(npcTarget) and mutil.IsInRange(npcTarget, npcBot, nRadius-100) then return BOT_ACTION_DESIRE_MODERATE; end end -- return BOT_ACTION_DESIRE_NONE; end function ConsiderCallDown() -- Make sure it's castable if ( not abilityCD:IsFullyCastable() ) then return BOT_ACTION_DESIRE_NONE, 0; end -- Get some of its values local nRadius = abilityCD:GetSpecialValueInt("radius"); local nCastRange = abilityCD:GetCastRange(); local nCastPoint = abilityCD:GetCastPoint( ); -------------------------------------- -- Mode based usage -------------------------------------- -- If we're seriously retreating, see if we can land a stun on someone who's damaged us recently if mutil.IsRetreating(npcBot) then local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( nCastRange+(nRadius/2), true, BOT_MODE_NONE ); for _,npcEnemy in pairs( tableNearbyEnemyHeroes ) do if ( npcBot:WasRecentlyDamagedByHero( npcEnemy, 2.0 ) ) then return BOT_ACTION_DESIRE_MODERATE, npcBot:GetLocation(); end end end if mutil.IsInTeamFight(npcBot, 1200) then local locationAoE = npcBot:FindAoELocation( true, true, npcBot:GetLocation(), nCastRange, nRadius/2, 0, 0 ); if ( locationAoE.count >= 2 ) then return BOT_ACTION_DESIRE_MODERATE, locationAoE.targetloc; end end -- If we're going after someone if mutil.IsGoingOnSomeone(npcBot) then local npcTarget = npcBot:GetTarget(); if mutil.IsValidTarget(npcTarget) and mutil.CanCastOnNonMagicImmune(npcTarget) and mutil.IsInRange(npcTarget, npcBot, nCastRange+(nRadius/2)) then return BOT_ACTION_DESIRE_MODERATE, npcTarget:GetExtrapolatedLocation( nCastPoint + 2 ); end end -- return BOT_ACTION_DESIRE_NONE, 0; end function ConsiderFlakCannon() -- Make sure it's castable if ( not abilityFC:IsFullyCastable() ) then return BOT_ACTION_DESIRE_NONE; end -- Get some of its values local nCastRange = abilityFC:GetSpecialValueInt("radius"); -------------------------------------- -- Mode based usage -------------------------------------- if mutil.IsInTeamFight(npcBot, 1200) then local tableNearbyEnemyHeroes = npcBot:GetNearbyHeroes( 1000, true, BOT_MODE_NONE ); if tableNearbyEnemyHeroes ~= nil and #tableNearbyEnemyHeroes >= 2 then return BOT_ACTION_DESIRE_MODERATE; end end return BOT_ACTION_DESIRE_NONE; end
function love.conf(t) t.identity = nil -- The name of the save directory (string) t.version = "0.10.1" -- The LÖVE version this game was made for (string) t.console = true -- Attach a console (boolean, Windows only) t.accelerometerjoystick = true -- Enable the accelerometer on iOS and Android by exposing it as a Joystick (boolean) t.externalstorage = false -- True to save files (and read from the save directory) in external storage on Android (boolean) t.gammacorrect = false -- Enable gamma-correct rendering, when supported by the system (boolean) t.window.title = "Untitled" -- The window title (string) t.window.icon = nil -- Filepath to an image to use as the window's icon (string) t.window.width = 800 -- The window width (number) t.window.height = 600 -- The window height (number) t.window.borderless = false -- Remove all border visuals from the window (boolean) t.window.resizable = false -- Let the window be user-resizable (boolean) t.window.fullscreen = false -- Enable fullscreen (boolean) t.window.fullscreentype = "desktop" -- Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string) t.window.vsync = true -- Enable vertical sync (boolean) end
-- Copyright 2015-2019 Sandor Balazsi <sandor.balazsi@gmail.com> -- Licensed to the public under the Apache License 2.0. function string.urlencode(str) return str:gsub("([^%w %-%_%.%~])", function (c) return string.format ("%%%02X", string.byte(c)) end):gsub("%s+", "+") end function string.ends(str, tail) return tail == "" or string.sub(str, -string.len(tail)) == tail end
covenant_gui_lines = {"BLURGH"} vote_gui_lines = {} gui = gui or GuiCreate() xpos_covenant = xpos_covenant or 2 ypos_covenant = ypos_covenant or 30 xpos_vote = xpos_vote or 70 ypos_vote = ypos_vote or 30 max_covenants = 3 vote_time_left = 0 max_vote_time = 80 time_between_covenants = 240 -- this will show up in the same directory as noita.exe -- (so you can use it as the source of an obs text overlay) write_vote_gui_to_file = false vote_gui_filename = "obs.txt" function draw_twitch_display() GuiStartFrame( gui ) GuiLayoutBeginVertical( gui, xpos_covenant, ypos_covenant ) for idx, line in ipairs(covenant_gui_lines) do GuiText(gui, 0, 0, line) end GuiLayoutEnd( gui ) if not write_vote_gui_to_file then GuiLayoutBeginVertical( gui, xpos_vote, ypos_vote ) for idx, line in ipairs(vote_gui_lines) do GuiText(gui, 0, 0, line) end GuiLayoutEnd( gui ) end end function write_lines_to_file(fn, lines) local f = io.open(fn, "wt") for _, line in ipairs(lines) do f:write(line, "\n") end f:close() end covenants = {} outcomes = {} conditions = {} function update_covenants() covenant_gui_lines = {#covenants .. "/" .. max_covenants .. " COVENANTS: "} local player = get_player() if not player then covenant_gui_lines[1] = "(POLYMORPHED!)" end local new_covenants = {} for idx, covenant in ipairs(covenants) do table.insert(covenant_gui_lines, "> " .. covenant:get_text()) if player then local happy, err = pcall(covenant.tick, covenant) if not happy then pcall(covenant.stop, covenant) print("Covenant error: " .. err) end end if covenant:is_live() then table.insert(new_covenants, covenant) end end covenants = new_covenants end function draw_n_generators(generators, n, filter) local candidates = {} for idx, option in ipairs(generators) do if (not filter) or filter(option) then if type(option) == "table" and option.mutate then option:mutate() end table.insert(candidates, {math.random(), option}) end end table.sort(candidates, function(a, b) return a[1] < b[1] end) local res = {} for idx = 1, n do local v = candidates[idx][2] if type(v) == "function" then v = v() end res[idx] = v res[idx].votes = 0 end return res end function set_votes(outcome_votes, condition_votes) for idx, outcome in ipairs(outcomes) do outcome.votes = outcome_votes[idx] or 0 end for idx, condition in ipairs(conditions) do condition.votes = condition_votes[idx] or 0 end return UNPRINTABLE_RESULT end local function find_winner(options) local max_votes, best_option = -1, nil for _, option in ipairs(options) do if (option.votes or 0) > max_votes then max_votes = option.votes or 0 best_option = option end end return best_option end function remove_covenant() if #covenants == 0 then return end local idx = 1 -- try to find an 'each' covenant to remove, -- because otherwise they have no expiry for cand_id, cand in ipairs(covenants) do if cand.kind == "each" then idx = cand_id break end end local c = covenants[idx] c:stop() table.remove(covenants, idx) end function push_covenant(covenant) while #covenants >= max_covenants do remove_covenant() end table.insert(covenants, covenant) end function do_winner() local outcome = copy_outcome(find_winner(outcomes)) local condition = find_winner(conditions) conjunction:start(condition, outcome) push_covenant(conjunction) GamePrintImportant("A New Covenant!", conjunction:get_text()) end function random_conjunction() if math.random() < 0.5 then return EachCovenant() else return UntilCovenant() end end function update_vote_display() vote_gui_lines = { ("-- VOTE: %ds --"):format(vote_time_left), } local outcome_keys = make_vote_keys(false) local condition_keys = make_vote_keys(true) for idx, outcome in ipairs(outcomes) do table.insert( vote_gui_lines, ("%s> %s (%d)"):format(outcome_keys[idx], outcome.text, outcome.votes) ) end table.insert(vote_gui_lines, conjunction:get_text()) for idx, condition in ipairs(conditions) do table.insert( vote_gui_lines, ("%s> %s (%d)"):format(condition_keys[idx], condition:get_vote_text(), condition.votes) ) end if write_vote_gui_to_file then write_lines_to_file(vote_gui_filename, vote_gui_lines) end end function setup_vote() conjunction = random_conjunction() outcomes = draw_n_generators(all_outcomes, num_vote_options, function(candidate) return conjunction:filter_outcome(candidate) end) conditions = draw_n_generators(all_conditions[conjunction.kind], num_vote_options) end function wait_opportunity() local timeleft = time_between_covenants while (#covenants >= max_covenants) and timeleft > 0 do timeleft = timeleft - 1 vote_gui_lines = {("Covenant change: %ds"):format(timeleft)} wait(60) end end function force_vote(a, b) local TT = {a=1, b=2, c=3, d=4, [1]=1, [2]=2, [3]=3, [4]=4} outcomes[TT[a]].votes = 1000 conditions[TT[b]].votes = 1000 vote_time_left = 0 end function vote_covenant() setup_vote() socket_send('{"kind": "open_voting"}') vote_time_left = max_vote_time while vote_time_left > 0 do update_vote_display() socket_send('{"kind": "query_votes"}') vote_time_left = vote_time_left - 1 wait(60) end socket_send('{"kind": "close_voting"}') do_winner() end function main_script() wait(1) while true do wait_opportunity() vote_covenant() wait(1) -- just for safety end end function restart_main() async(main_script) end function list_outcomes(mutate) for idx, outcome in ipairs(all_outcomes) do if mutate and outcome.mutate then outcome:mutate() end local kind = "discrete" if outcome.start then kind = "continuous" end print(idx, ": ", outcome.text, "[" .. kind .. "]") end end local in_progress_tests = {} function test_outcome(idx) local outcome = all_outcomes[idx] if outcome.apply then outcome:apply() elseif outcome.start then outcome:start() table.insert(in_progress_tests, outcome) if outcome.tick then print("Spinning up test outcome coroutine.") async(function() while outcome:is_live() do outcome:tick() wait(1) end print("Test outcome coroutine ended.") end) end end end function stop_tests() for idx, outcome in pairs(in_progress_tests) do outcome:stop() end in_progress_tests = {} end add_persistent_func("update_covenants", update_covenants) add_persistent_func("twitch_gui", draw_twitch_display) restart_main() print("got through setup???")
local util = require("__bzsilicon__.data-util"); if not mods["Krastorio2"] then util.remove_ingredient("concrete", "stone-brick"); if mods["Bio_Industries"] or mods["omnimatter"] then util.add_ingredient("concrete", "stone-brick", 3); util.add_ingredient("concrete", "silica", 10); else util.add_ingredient("concrete", "silica", 25); end util.add_prerequisite("concrete", "silica-processing") if util.me.more_intermediates() then util.replace_some_ingredient("processing-unit", "electronic-circuit", 10, "silicon-wafer", 3) util.multiply_recipe("effectivity-module", 2) util.remove_ingredient("effectivity-module", "electronic-circuit") util.add_ingredient("effectivity-module", "silicon-wafer", 3) util.multiply_recipe("productivity-module", 2) util.remove_ingredient("productivity-module", "electronic-circuit") util.add_ingredient("productivity-module", "silicon-wafer", 3) util.multiply_recipe("speed-module", 2) util.remove_ingredient("speed-module", "electronic-circuit") util.add_ingredient("speed-module", "silicon-wafer", 3) if mods.IndustrialRevolution then util.add_ingredient("solar-panel", "solar-cell", 9) util.add_effect("ir2-solar-energy-1", {type = "unlock-recipe", recipe="solar-cell"}) else util.replace_ingredient("solar-panel", "electronic-circuit", "solar-cell") util.add_effect("solar-energy", {type = "unlock-recipe", recipe="solar-cell"}) end util.replace_ingredient("solar-panel-equipment", "solar-panel", "solar-cell") if not mods.modmashsplinterelectronics then util.multiply_recipe("advanced-circuit", 3) util.replace_some_ingredient("advanced-circuit", "electronic-circuit", 3, "silicon-wafer", 1) end util.add_prerequisite("advanced-electronics", util.me.silicon_processing) else util.replace_some_ingredient("solar-panel", "electronic-circuit", 10, "silicon", 10) util.replace_some_ingredient("processing-unit", "electronic-circuit", 10, "silicon", 6) util.remove_ingredient("effectivity-module", "electronic-circuit") util.add_ingredient("effectivity-module", "silicon", 3) util.remove_ingredient("productivity-module", "electronic-circuit") util.add_ingredient("productivity-module", "silicon", 3) util.remove_ingredient("speed-module", "electronic-circuit") util.add_ingredient("speed-module", "silicon", 3) util.add_prerequisite("advanced-electronics-2", util.me.silicon_processing) end util.add_prerequisite("solar-energy", "silicon-processing") util.add_prerequisite("modules", util.me.silicon_processing) else util.add_ingredient("concrete", "silica", 15); if not mods["aai-industry"] then util.add_ingredient("concrete", "sand", 10); end end util.replace_ingredient("beacon", "copper-cable", "optical-fiber") util.add_prerequisite("effect-transmission", "fiber-optics") -- Circuit network changes local useful_combinators = {"timer-combinator", "counting-combinator", "random-combinator", "power-combinator", "max-combinator", "min-combinator", "and-gate-combinator", "nand-gate-combinator", "nor-gate-combinator", "not-gate-combinator", "or-gate-combinator", "xnor-gate-combinator", "xor-gate-combinator", "converter-combinator", "detector-combinator", "sensor-combinator", "railway-combinator", "color-combinator", "daytime-combinator", "statistic-combinator", "pollution-combinator", "emitter-combinator", "receiver-combinator"} util.replace_ingredient("green-wire", "copper-cable", "optical-fiber") util.replace_ingredient("green-wire", "electronic-circuit", "silicon") util.replace_ingredient("red-wire", "copper-cable", "optical-fiber") util.replace_ingredient("red-wire", "electronic-circuit", "silicon") if not mods["IndustrialRevolution"] then util.add_ingredient("arithmetic-combinator", "silicon", 1) util.add_ingredient("constant-combinator", "silicon", 1) util.add_ingredient("decider-combinator", "silicon", 1) util.add_ingredient("programmable-speaker", "silicon", 1) if mods["UsefulCombinators"] then for i, v in ipairs(useful_combinators) do util.add_ingredient(v, "silicon", 1) end end if mods["crafting_combinator"] then util.add_ingredient("crafting_combinator:crafting-combinator", "silicon", 1) util.add_ingredient("crafting_combinator:recipe-combinator", "silicon", 1) end util.add_ingredient("clock-combinator", "silicon", 1) util.add_ingredient("power-meter-combinator", "silicon", 1) util.add_ingredient("ghost-scanner", "silicon", 1) util.add_ingredient("item-sensor", "silicon", 1) util.add_ingredient("bi-pollution-sensor", "silicon", 1) else util.add_prerequisite("circuit-network", "fiber-optics") end util.add_ingredient("arithmetic-combinator", "optical-fiber", 1) util.add_ingredient("constant-combinator", "optical-fiber", 1) util.add_ingredient("decider-combinator", "optical-fiber", 1) util.add_ingredient("programmable-speaker", "optical-fiber", 1) if mods["UsefulCombinators"] then for i, v in ipairs(useful_combinators) do util.add_ingredient(v, "optical-fiber", 1) end end if mods["crafting_combinator"] then util.add_ingredient("crafting_combinator:crafting-combinator", "optical-fiber", 1) util.add_ingredient("crafting_combinator:recipe-combinator", "optical-fiber", 1) end util.add_ingredient("clock-combinator", "optical-fiber", 1) util.add_ingredient("power-meter-combinator", "optical-fiber", 1) util.add_ingredient("ghost-scanner", "optical-fiber", 1) util.add_ingredient("item-sensor", "optical-fiber", 1) util.add_ingredient("bi-pollution-sensor", "optical-fiber", 1) -- Transport Drones util.add_ingredient("road-network-reader", "optical-fiber", 5) util.replace_some_ingredient("road-network-reader", "electronic-circuit", 5, "silicon", 5) util.add_ingredient("transport-depot-reader", "optical-fiber", 5) util.replace_some_ingredient("transport-depot-reader", "electronic-circuit", 5, "silicon", 5) util.add_ingredient("transport-depot-writer", "optical-fiber", 5) util.replace_some_ingredient("transport-depot-writer", "electronic-circuit", 5, "silicon", 5) util.add_prerequisite("circuit-network", "fiber-optics") util.add_prerequisite("circuit-network", util.me.silicon_processing) if mods["Krastorio2"] then util.add_ingredient("biusart-lab", "optical-fiber", 10) util.add_ingredient("ai-core", "optical-fiber", 2) util.add_prerequisite(util.me.silicon_processing, "silica-processing") if util.me.more_intermediates() then util.add_effect(util.me.silicon_processing, {type = "unlock-recipe", recipe="silicon-wafer"}) util.remove_ingredient("electronic-components", "silicon") util.add_ingredient("electronic-components", "silicon-wafer", 1) util.multiply_recipe("electronic-components-lithium", 2) util.remove_ingredient("electronic-components-lithium", "silicon") util.add_ingredient("electronic-components-lithium", "silicon-wafer", 3) util.replace_ingredient("solar-panel", "electronic-circuit", "solar-cell") util.remove_ingredient("solar-panel", "silicon") util.replace_ingredient("solar-panel-equipment", "solar-panel", "solar-cell") util.add_effect("solar-energy", {type = "unlock-recipe", recipe="solar-cell"}) end end if mods["aai-signal-transimission"] then util.add_ingredient("aai-signal-receiver", "optical-fiber", 2) util.add_ingredient("aai-signal-sender", "optical-fiber", 2) end if mods["aai-industry"] then util.add_ingredient("beacon", "optical-fiber", 10) end if mods["space-exploration"] then util.add_ingredient("se-space-astrometrics-laboratory", "optical-fiber", 10) util.add_ingredient("se-space-gravimetrics-laboratory", "optical-fiber", 10) util.add_ingredient("se-space-laser-laboratory", "optical-fiber", 10) util.add_ingredient("se-space-science-lab", "optical-fiber", 10) util.add_ingredient("se-space-supercomputer-1", "optical-fiber", 100) util.add_ingredient("se-space-supercomputer-2", "optical-fiber", 500) util.add_ingredient("se-polarisation-data", "optical-fiber", 1) util.add_ingredient("se-chemical-gel", "silica", 10) util.add_ingredient("se-material-testing-pack", "silica", 1) end if mods["zombiesextended-core"] then if util.me.more_intermediates() then util.add_ingredient("complex-processing-unit", "silicon-wafer", 1) else util.add_ingredient("complex-processing-unit", "silicon", 2) end end if mods["extended-research-system"] and mods["Bio_Industries"] then data:extend({{ type = "recipe", name = "bi-stone-crusher-ers", category = "crafting", enabled = true, energy_required = 6, ingredients = {{"iron-plate", 100}, {"iron-gear-wheel", 5}}, result = "bi-stone-crusher", }}) if data.raw.recipe["bi-crushed-stone-1"] then data.raw.recipe["bi-crushed-stone-1"].enabled = true end end
-- Provides: -- evil::weather -- emote (string - emoji for weather) -- temp (integer - temperatur in °C) -- wind (integer - wind velocity in km/h) local awful = require("awful") local beautiful = require("beautiful") local city = beautiful.weather_city or "Tokyo" local update_interval = 60 * 60 local disk_script = [[ sh -c ' wttr_str=`curl wttr.in/]] .. city .. [[?format=2` echo $wttr_str ' ]] -- Periodically get disk space info awful.widget.watch(disk_script, update_interval, function(_, stdout) local list_weather_data = {} for element in stdout:gmatch("%S+") do table.insert(list_weather_data, element) end local emoji = list_weather_data[1] local temp = tonumber(string.sub(list_weather_data[2], 8, #list_weather_data[2] - 3)) local wind = tonumber(string.sub(list_weather_data[3], 11, #list_weather_data[3] - 4)) awesome.emit_signal("ears::weather", temp, wind, emoji) end)
local gen_code = require("Q/UTILS/lua/gen_code") local num_produced = 0 local sp_fn = assert(require("vnot_specialize")) local function generate_files(in_qtype, args) local subs = assert(sp_fn(in_qtype, args)) assert(type(subs) == "table") gen_code.doth(subs, subs.incdir) gen_code.dotc(subs, subs.srcdir) print("Produced ", subs.fn) num_produced = num_produced + 1 return true end for _, in_qtype in ipairs({"B1"}) do assert(generate_files(in_qtype)) end assert(num_produced > 0)
local colors = { white = "#abb2bf", darker_black = "#2a303c", black = "#2E3440", -- nvim bg black2 = "#343a46", one_bg = "#373d49", one_bg2 = "#3a404c", one_bg3 = "#3d434f", grey = "#474d59", grey_fg = "#565c68", grey_fg2 = "#606672", light_grey = "#646a76", red = "#BF616A", baby_pink = "#de878f", pink = "#e89199", line = "#3a404c", -- for lines like vertsplit green = "#A3BE8C", vibrant_green = "#afca98", blue = "#7797b7", nord_blue = "#81A1C1", yellow = "#EBCB8B", sun = "#e1c181", purple = "#aab1be", dark_purple = "##B48EAD", teal = "#6484a4", orange = "#e39a83", cyan = "#9aafe6", statusline_bg = "#333945", lightbg = "#3f4551", lightbg2 = "#393f4b" } return colors
local events = {} events.lk = {} --LIKO-12 events registry events.cc = {} --Computercraft events stack events.c = 0 --Events counter --Register a LIKO-12 event function events:register(event,func) if not self.lk[event] then self.lk[event] = {} end table.insert(self.lk[event],func) end --Trigger a computercraft event function events:trigger(name,...) table.insert(self.cc,{name=name, args={...}}) end --Pull a CC event from the stack local function pullCC(filter) if #events.cc > events.c then for i=events.c+1, #events.cc do local event = events.cc[i] if event and ((not filter) or (event.name == filter)) then events.cc[i] = false if not filter then events.c = events.c + 1 end return true, {event.name, unpack(event.args)} end end end end --Pull a CC event form the stack function events:pullEvent(filter) --Pull a CC event from the stack local found, args = pullCC(filter) if found then return args end --Pull LIKO-12 events for event, a,b,c,d,e,f in CPU.pullEvent do local oldcc = #self.cc if self.lk[event] then for k,f in ipairs(self.lk[event]) do f(a,b,c,d,e,f) end end if #self.cc > oldcc then local found, args = pullCC(filter) if found then return args end end end end return events
--========================================================= -- 消息注册管理 --========================================================= local EventRegister = class("EventRegister"); -- 构造函数 function EventRegister:ctor() self._EventCallBackTable = {}; -- 事件回调表 end -- 注册某个事件 function EventRegister:RegisterEvent(Name, Obj, Func) if (nil == Name) then logError("RegisterEvent Name == nil!") return; end local Handler = handler(Obj, Func); local EventTable = self:GetEventRegisterTable(Name); if (nil ~= EventTable) then local idx = #EventTable; EventTable[idx + 1] = Handler; else local v = {}; v[1] = Handler; self._EventCallBackTable[Name] = v; end EventController.Instance():RegisterEvent(Name, Handler); end -- 获取事件注册表 function EventRegister:GetEventRegisterTable(Name) for k,v in pairs(self._EventCallBackTable) do if(k == Name) then return v; end end return nil; end -- 删除所有事件 function EventRegister:UnRegisterAllEvent() for k,v in pairs(self._EventCallBackTable) do for i = 1, #v do EventController.Instance():RemoveEvent(k, v[i]); end end self._EventCallBackTable = {}; end return EventRegister;
--====================================================================-- -- dmc_objects.lua -- -- by David McCuskey -- Documentation: http://docs.davidmccuskey.com/display/docs/dmc_objects.lua --====================================================================-- --[[ Copyright (C) 2011-2014 David McCuskey. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --]] --====================================================================-- --== DMC Corona Library : DMC Objects --====================================================================-- -- Semantic Versioning Specification: http://semver.org/ local VERSION = "1.1.0" --====================================================================-- --== DMC Corona Library Config --====================================================================-- --====================================================================-- --== Support Functions local Utils = {} -- make copying from dmc_utils easier function Utils.extend( fromTable, toTable ) function _extend( fT, tT ) for k,v in pairs( fT ) do if type( fT[ k ] ) == "table" and type( tT[ k ] ) == "table" then tT[ k ] = _extend( fT[ k ], tT[ k ] ) elseif type( fT[ k ] ) == "table" then tT[ k ] = _extend( fT[ k ], {} ) else tT[ k ] = v end end return tT end return _extend( fromTable, toTable ) end --====================================================================-- --== Configuration local dmc_lib_data, dmc_lib_info -- boot dmc_library with boot script or -- setup basic defaults if it doesn't exist -- if false == pcall( function() require( "dmc_corona_boot" ) end ) then _G.__dmc_corona = { dmc_corona={}, } end dmc_lib_data = _G.__dmc_corona dmc_lib_info = dmc_lib_data.dmc_library --====================================================================-- --== DMC Objects --====================================================================-- --====================================================================-- --== Configuration dmc_lib_data.dmc_objects = dmc_lib_data.dmc_objects or {} local DMC_OBJECTS_DEFAULTS = { } local dmc_objects_data = Utils.extend( dmc_lib_data.dmc_objects, DMC_OBJECTS_DEFAULTS ) --====================================================================-- --== Imports local LuaObject = require 'lua_objects' local Utils = require 'dmc_utils' --====================================================================-- --== Setup, Constants -- setup some aliases to make code cleaner local inheritsFrom = LuaObject.inheritsFrom local ObjectBase = LuaObject.ObjectBase --====================================================================-- --== Support Functions _G.getDMCObject = function( object ) return object.__dmc_ref end --====================================================================-- --== Corona Base Class --====================================================================-- local CoronaBase = inheritsFrom( ObjectBase ) CoronaBase.NAME = "Corona Base" --== Class Constants --references for setAnchor() CoronaBase.TopLeftReferencePoint = { 0, 0 } CoronaBase.TopCenterReferencePoint = { 0.5, 0 } CoronaBase.TopRightReferencePoint = { 1, 0 } CoronaBase.CenterLeftReferencePoint = { 0, 0.5 } CoronaBase.CenterReferencePoint = { 0.5, 0.5 } CoronaBase.CenterRightReferencePoint = { 1, 0.5 } CoronaBase.BottomLeftReferencePoint = { 0, 1 } CoronaBase.BottomCenterReferencePoint = { 0.5, 1 } CoronaBase.BottomRightReferencePoint = { 1, 1 } -- style of event dispatch CoronaBase.DMC_EVENT_DISPATCH = 'dmc_event_style_dispatch' CoronaBase.CORONA_EVENT_DISPATCH = 'corona_event_style_dispatch' -- new() -- class constructor -- function CoronaBase:new( ... ) print( "CoronaBase:new" ) local args = {...} params = args[1] or {} --==-- -- figure object type, Class or Instance local is_class = false if #args==1 and type(args[1]) == 'table' then local p = args[1] if p.__set_isClass ~= nil then is_class = p.__set_isClass p.__set_isClass = nil end end local o = self:_bless() -- set flag if this object is a Class (ie, Class or Instance) o.__is_class = is_class -- configure the type of event dispatch o.__dispatch_type = params.dispatch_type == nil and CoronaBase.DMC_EVENT_DISPATCH or params.dispatch_type --== Start setup sequence o:_init( ... ) -- skip these if a Class object (ie, NOT an instance) if rawget( o, '__is_class' ) == false then o:_createView() o:_initComplete() end return o end --====================================================================-- --== Start: Setup DMC Objects -- _init() -- initialize the object - setting the view -- function CoronaBase:_init( options ) self:superCall( "_init" ) --==-- --== Create Properties ==-- --== Display Groups ==-- --== Object References ==-- -- create our class view container self:_setView( display.newGroup() ) end -- _undoInit() -- remove items added during _init() -- function CoronaBase:_undoInit( options ) self:_unsetView() --==-- self:superCall( "_undoInit" ) end -- _createView() -- create any visual items specific to object -- function CoronaBase:_createView() self:superCall( "_createView" ) -- Subclasses should call self:superCall( "_createView" ) --==-- end -- _undoCreateView() -- remove any items added during _createView() -- function CoronaBase:_undoCreateView() --==-- -- Subclasses should call self:superCall( "_undoCreateView" ) self:superCall( "_undoCreateView" ) end -- _initComplete() -- any setup after object is done being created -- function CoronaBase:_initComplete() self:superCall( "_initComplete" ) --==-- end -- _undoInitComplete() -- remove any items added during _initComplete() -- function CoronaBase:_undoInitComplete() --==-- self:superCall( "_undoInitComplete" ) end --== END: Setup DMC Objects --====================================================================-- --====================================================================-- --== Private Methods -- _setView( viewObject ) -- set the view property to incoming view object -- remove current if already set, only check direct property, not hierarchy -- function CoronaBase:_setView( viewObject ) self:_unsetView() self.view = viewObject self.display = self.view -- deprecated -- save ref of our Lua object on Corona element -- in case we need to get back to the object self.view.__dmc_ref = self end -- _unsetView() -- remove the view property -- function CoronaBase:_unsetView() if rawget( self, 'view' ) ~= nil then local view = self.view if view.__dmc_ref then view.__dmc_ref = nil end if view.numChildren ~= nil then for i = view.numChildren, 1, -1 do local o = view[i] o.parent:remove( o ) end end view:removeSelf() self.view = nil self.display = nil end end --====================================================================-- --== Public Methods / Corona API function CoronaBase:setTouchBlock( o ) assert( o, 'setTouchBlock: expected object' ) o.touch = function(e) return true end o:addEventListener( 'touch', o ) end function CoronaBase:unsetTouchBlock( o ) assert( o, 'unsetTouchBlock: expected object' ) if o and o.touch then o:removeEventListener( 'touch', o ) o.touch = nil end end function CoronaBase.__setters:dispatch_type( value ) self.__dispatch_type = value end -- destroy() -- remove the view object from the stage -- function CoronaBase:destroy() self:removeSelf() end function CoronaBase:show() self.view.isVisible = true end function CoronaBase:hide() self.view.isVisible = false end --== Corona Specific Properties and Methods ==-- --= DISPLAY GROUP =-- -- Properties -- -- numChildren -- function CoronaBase.__getters:numChildren() return self.view.numChildren end -- Methods -- -- insert( [index,] child, [, resetTransform] ) -- function CoronaBase:insert( ... ) self.view:insert( ... ) end -- remove( indexOrChild ) -- function CoronaBase:remove( ... ) self.view:remove( ... ) end --= CORONA OBJECT =-- -- Properties -- alpha -- function CoronaBase.__getters:alpha() return self.view.alpha end function CoronaBase.__setters:alpha( value ) self.view.alpha = value end -- contentBounds -- function CoronaBase.__getters:contentBounds() return self.view.contentBounds end -- contentHeight -- function CoronaBase.__getters:contentHeight() return self.view.contentHeight end -- contentWidth -- function CoronaBase.__getters:contentWidth() return self.view.contentWidth end -- height -- function CoronaBase.__getters:height() return self.view.height end function CoronaBase.__setters:height( value ) self.view.height = value end -- isHitTestMasked -- function CoronaBase.__getters:isHitTestMasked() return self.view.isHitTestMasked end function CoronaBase.__setters:isHitTestMasked( value ) self.view.isHitTestMasked = value end -- isHitTestable -- function CoronaBase.__getters:isHitTestable() return self.view.isHitTestable end function CoronaBase.__setters:isHitTestable( value ) self.view.isHitTestable = value end -- isVisible -- function CoronaBase.__getters:isVisible() return self.view.isVisible end function CoronaBase.__setters:isVisible( value ) self.view.isVisible = value end -- maskRotation -- function CoronaBase.__getters:maskRotation() return self.view.maskRotation end function CoronaBase.__setters:maskRotation( value ) self.view.maskRotation = value end -- maskScaleX -- function CoronaBase.__getters:maskScaleX() return self.view.maskScaleX end function CoronaBase.__setters:maskScaleX( value ) self.view.maskScaleX = value end -- maskScaleY -- function CoronaBase.__getters:maskScaleY() return self.view.maskScaleY end function CoronaBase.__setters:maskScaleY( value ) self.view.maskScaleY = value end -- maskX -- function CoronaBase.__getters:maskX() return self.view.maskX end function CoronaBase.__setters:maskX( value ) self.view.maskX = value end -- maskY -- function CoronaBase.__getters:maskY() return self.view.maskY end function CoronaBase.__setters:maskY( value ) self.view.maskY = value end -- parent -- function CoronaBase.__getters:parent() return self.view.parent end -- rotation -- function CoronaBase.__getters:rotation() return self.view.rotation end function CoronaBase.__setters:rotation( value ) self.view.rotation = value end -- stageBounds -- function CoronaBase.__getters:stageBounds() print( "\nDEPRECATED: object.stageBounds - use object.contentBounds\n" ) return self.view.stageBounds end -- width -- function CoronaBase.__getters:width() return self.view.width end function CoronaBase.__setters:width( value ) self.view.width = value end -- x -- function CoronaBase.__getters:x() return self.view.x end function CoronaBase.__setters:x( value ) self.view.x = value end -- xOrigin -- function CoronaBase.__getters:xOrigin() return self.view.xOrigin end function CoronaBase.__setters:xOrigin( value ) self.view.xOrigin = value end -- xReference -- function CoronaBase.__getters:xReference() return self.view.xReference end function CoronaBase.__setters:xReference( value ) self.view.xReference = value end -- xScale -- function CoronaBase.__getters:xScale() return self.view.xScale end function CoronaBase.__setters:xScale( value ) self.view.xScale = value end -- y -- function CoronaBase.__getters:y() return self.view.y end function CoronaBase.__setters:y( value ) self.view.y = value end -- yOrigin -- function CoronaBase.__getters:yOrigin() return self.view.yOrigin end function CoronaBase.__setters:yOrigin( value ) self.view.yOrigin = value end -- yReference -- function CoronaBase.__getters:yReference() return self.view.yReference end function CoronaBase.__setters:yReference( value ) self.view.yReference = value end -- yScale -- function CoronaBase.__getters:yScale() return self.view.yScale end function CoronaBase.__setters:yScale( value ) self.view.yScale = value end -- Methods -- -- addEventListener( eventName, handler ) -- function CoronaBase:addEventListener( ... ) local args = { ... } if args[1] == nil then error( "ERROR addEventListener: event type can't be nil", 2 ) end if args[2] == nil then error( "ERROR addEventListener: listener function can't be nil", 2 ) end self.view:addEventListener( ... ) end -- contentToLocal( x_content, y_content ) -- function CoronaBase:contentToLocal( ... ) self.view:contentToLocal( ... ) end CoronaBase._buildDmcEvent = ObjectBase._buildDmcEvent -- dispatchEvent( event info ) -- can either be dmc style event -- or corona style event function CoronaBase:dispatchEvent( ... ) -- print( 'CoronaBase:dispatchEvent', self.__dispatch_type) if self.__dispatch_type == CoronaBase.CORONA_EVENT_DISPATCH then self.view:dispatchEvent( ... ) else self.view:dispatchEvent( self:_buildDmcEvent( ... ) ) end end -- localToContent( x, y ) -- function CoronaBase:localToContent( ... ) self.view:localToContent( ... ) end -- removeEventListener( eventName, handler ) -- function CoronaBase:removeEventListener( ... ) self.view:removeEventListener( ... ) end -- removeSelf() -- function CoronaBase:removeSelf() -- print( "\nOVERRIDE: removeSelf()\n" ); -- skip these if we're an intermediate class (eg, subclass) if rawget( self, '__is_class' ) == false then self:_undoInitComplete() self:_undoCreateView() end self:_undoInit() end -- rotate( deltaAngle ) -- function CoronaBase:rotate( ... ) self.view:rotate( ... ) end -- scale( sx, sy ) -- function CoronaBase:scale( ... ) self.view:scale( ... ) end -- setAnchor -- function CoronaBase:setAnchor( ... ) local args = {...} if type( args[2] ) == 'table' then self.view.anchorX, self.view.anchorY = unpack( args[2] ) end if type( args[2] ) == 'number' then self.view.anchorX = args[2] end if type( args[3] ) == 'number' then self.view.anchorY = args[3] end end function CoronaBase:setMask( ... ) print( "\nWARNING: setMask( mask ) not tested \n" ); self.view:setMask( ... ) end -- setReferencePoint( referencePoint ) -- function CoronaBase:setReferencePoint( ... ) self.view:setReferencePoint( ... ) end -- toBack() -- function CoronaBase:toBack() self.view:toBack() end -- toFront() -- function CoronaBase:toFront() self.view:toFront() end -- translate( deltaX, deltaY ) -- function CoronaBase:translate( ... ) self.view:translate( ... ) end --[[ -- ========================================================= -- CoronaPhysics Class -- ========================================================= local CoronaPhysics = inheritsFrom( CoronaBase ) CoronaPhysics.NAME = "Corona Physics" -- Properties -- -- angularDamping() -- function CoronaPhysics.__getters:angularDamping() return self.view.angularDamping end function CoronaPhysics.__setters:angularDamping( value ) self.view.angularDamping = value end -- angularVelocity() -- function CoronaPhysics.__getters:angularVelocity() return self.view.angularVelocity end function CoronaPhysics.__setters:angularVelocity( value ) self.view.angularVelocity = value end -- bodyType() -- function CoronaPhysics.__getters:bodyType() return self.view.bodyType end function CoronaPhysics.__setters:bodyType( value ) self.view.bodyType = value end -- isAwake() -- function CoronaPhysics.__getters:isAwake() return self.view.isAwake end function CoronaPhysics.__setters:isAwake( value ) self.view.isAwake = value end -- isBodyActive() -- function CoronaPhysics.__getters:isBodyActive() return self.view.isBodyActive end function CoronaPhysics.__setters:isBodyActive( value ) self.view.isBodyActive = value end -- isBullet() -- function CoronaPhysics.__getters:isBullet() return self.view.isBullet end function CoronaPhysics.__setters:isBullet( value ) self.view.isBullet = value end -- isFixedRotation() -- function CoronaPhysics.__getters:isFixedRotation() return self.view.isFixedRotation end function CoronaPhysics.__setters:isFixedRotation( value ) self.view.isFixedRotation = value end -- isSensor() -- function CoronaPhysics.__getters:isSensor() return self.view.isSensor end function CoronaPhysics.__setters:isSensor( value ) self.view.isSensor = value end -- isSleepingAllowed() -- function CoronaPhysics.__getters:isSleepingAllowed() return self.view.isSleepingAllowed end function CoronaPhysics.__setters:isSleepingAllowed( value ) self.view.isSleepingAllowed = value end -- linearDamping() -- function CoronaPhysics.__getters:linearDamping() return self.view.linearDamping end function CoronaPhysics.__setters:linearDamping( value ) self.view.linearDamping = value end -- Methods -- -- applyAngularImpulse( appliedForce ) -- function CoronaPhysics:applyAngularImpulse( ... ) self.view:applyAngularImpulse( ... ) end -- applyForce( xForce, yForce, bodyX, bodyY ) -- function CoronaPhysics:applyForce( ... ) self.view:applyForce( ... ) end -- applyLinearImpulse( xForce, yForce, bodyX, bodyY ) -- function CoronaPhysics:applyLinearImpulse( ... ) self.view:applyLinearImpulse( ... ) end -- applyTorque( appliedForce ) -- function CoronaPhysics:applyTorque( ... ) self.view:applyTorque( ... ) end -- getLinearVelocity() -- function CoronaPhysics:getLinearVelocity() return self.view:getLinearVelocity() end -- resetMassData() -- function CoronaPhysics:resetMassData() self.view:resetMassData() end -- setLinearVelocity( xVelocity, yVelocity ) -- function CoronaPhysics:setLinearVelocity( ... ) self.view:setLinearVelocity( ... ) end --]] --====================================================================-- --== DMC Objects Exports --====================================================================-- -- simply add to current exports LuaObject.CoronaBase = CoronaBase return LuaObject
revan_quest1 = Creature:new { --objectName = "@mob/creature_names:", customName = "Revan Decoy", socialGroup = "dark_jedi", pvpFaction = "", faction = "", level = 300, chanceHit = 50.00, damageMin = 1800, damageMax = 3310, baseXp = 278490, baseHAM = 421000, baseHAMmax = 592000, armor = 3, resists = {25,25,25,25,25,25,25,25,25}, meatType = "", meatAmount = 0, hideType = "", hideAmount = 0, boneType = "", boneAmount = 0, milk = 0, tamingChance = 0.0, ferocity = 0, pvpBitmask = AGGRESSIVE + ATTACKABLE + ENEMY, creatureBitmask = KILLER + STALKER, optionsBitmask = AIENABLED, diet = HERBIVORE, templates = {"object/mobile/som/blackguard_wilder.iff"}, lootGroups = { { groups = { {group = "junk", chance = 5000000}, {group = "armor_all", chance = 4500000}, {group = "weapons_all", chance = 500000} }, lootChance = 10000000 }, { groups = { {group = "wearables_all", chance = 5000000}, {group = "loot_kit_parts", chance = 2500000}, {group = "tailor_components", chance = 2500000} }, lootChance = 10000000 }, }, weapons = {"unarmed_weapons"}, reactionStf = "@npc_reaction/slang", attacks = { {"creatureareacombo","StateAccuracyBonus=100"}, {"creatureareaknockdown","StateAccuracyBonus=100"}, {"knockdownattack","KnockdownChance=100"}, {"creatureareaknockdown","KnockdownChance=100"}, {"dizzyattack","DizzyChance=100"}, {"stunattack","StunChance=100"}, {"mildpoison","PoisonChance=100"}, {"intimidationattack","IntimidationChance=100"}, {"mediumpoison","PoisonChance=100"}, {"creatureareapoison","PoisonChance=100"}, {"strongpoison","PoisonChance=100"}, {"creatureareaattack","StateAccuracyBonus=100"} } } CreatureTemplates:addCreatureTemplate(revan_quest1, "revan_quest1")
--Don't use without a triggerHook logic applied to Eluna GiveXP to prevent xp loop. local function pLogin(event, player) local pAccountID = player:GetAccountId() local SQL_pMaxLevel = "SELECT COUNT(*) FROM characters WHERE level=80 AND account="..pAccountID..";" local QUERY_MaxLevelCount = CharDBQuery(SQL_pMaxLevel) local pMaxLevel = QUERY_MaxLevelCount:GetUInt32(0) if(pMaxLevel >= 1) then player:SendBroadcastMessage("[WoQ] Bonus d'expérience activé. "..pMaxLevel.." personnage(s) niveau 80.") end end local function pGainExp(event, player, amount, victim) local victim = null local pAccountID = player:GetAccountId() local SQL_pMaxLevel = "SELECT COUNT(*) FROM characters WHERE level=80 AND account="..pAccountID..";" local QUERY_MaxLevelCount = CharDBQuery(SQL_pMaxLevel) local pMaxLevel = QUERY_MaxLevelCount:GetUInt32(0) if(pMaxLevel >= 1) then -- Check if the account has at least 1 level 80. if (pMaxLevel == 1) then local BonusPercent = amount player:GiveXP(BonusPercent, victim, false, 1.0) elseif (pMaxLevel == 2) then local BonusPercent = amount * 2 player:GiveXP(BonusPercent, victim, false, 1.0) elseif (pMaxLevel == 3) then local BonusPercent = amount * 3 player:GiveXP(BonusPercent, victim, false, 1.0) elseif (pMaxLevel == 4) then local BonusPercent = amount * 4 player:GiveXP(BonusPercent, victim, false, 1.0) elseif (pMaxLevel == 5) then local BonusPercent = amount * 5 player:GiveXP(BonusPercent, victim, false, 1.0) elseif (pMaxLevel == 6) then local BonusPercent = amount * 6 player:GiveXP(BonusPercent, victim, false, 1.0) elseif (pMaxLevel == 7) then local BonusPercent = amount * 7 player:GiveXP(BonusPercent, victim, false, 1.0) elseif (pMaxLevel == 8) then local BonusPercent = amount * 8 player:GiveXP(BonusPercent, victim, false, 1.0) elseif (pMaxLevel == 9) then local BonusPercent = amount * 9 player:GiveXP(BonusPercent, victim, false, 1.0) else end end end RegisterPlayerEvent(3, pLogin) RegisterPlayerEvent(12, pGainExp)
gameNpcs.removeNPC = function(npcName, target) local npc = gameNpcs.characters[npcName] if not target then for player, v in next, npc.players do if v.image then removeImage(v.image) gameNpcs.removeTextAreas(v.id, player) v.image = nil end end npc.visible = false else local v = npc.players[target] if v.image then removeImage(v.image) v.image = nil gameNpcs.removeTextAreas(v.id, target) end end end
--[[ @file httpd.lua @license The MIT License (MIT) @author Alex <alex@maximum.guru> @author William Fleurant <william@netblazr.com> @author Serg <sklassen410@gmail.com> @copyright 2016 Alex @copyright 2016 William Fleurant @copyright 2016 Serg --]] --- @module httpd local httpd = {} local xavante = require("xavante") local filehandler = require("xavante.filehandler") local redirecthandler = require("xavante.redirecthandler") local wsapixavante = require("wsapi.xavante") local config = require("config") local threadman = require("threadman") local rpc = require("rpc") -- Define here where Xavante HTTP documents scripts are located local webDir = script_path().."www" local luaDir = script_path() local rules = {} -- index (redirect) table.insert(rules, { match = "^[^%./]*/$", with = redirecthandler, params = { "index.html" } }) -- rpc (redirect) table.insert(rules, { match = "^[^%./]*/jsonrpc/?$", with = redirecthandler, params = { "jsonrpc.lua" } }) local sapi = require "wsapi.sapi" local launcher_params = { isolated = false, reload = true, period = ONE_HOUR, ttl = ONE_DAY } -- custom lua handler that executes lua scripts within the same lua state as the main daemon process function lua_handler(env) local sapi = require "wsapi.sapi" local filepath = luaDir..env["PATH_INFO"]; local lfs = require('lfs') if lfs.attributes(filepath) then env["PATH_TRANSLATED"] = filepath env["SCRIPT_FILENAME"] = filepath return sapi.run(env) else return 404, {}, nil; end end -- jsonrpc.lua table.insert(rules, { match = "^/jsonrpc.lua$", with = wsapixavante.makeHandler(lua_handler, nil, luaDir, nil, nil), }) -- static content table.insert(rules, { match = ".", with = filehandler, params = { baseDir = webDir } }) local listenOn = {} local function xavante_params(addr, port) return { host = addr, port = port } end if (config.daemon.listenIpv6) then table.insert(listenOn, xavante_params('::', config.daemon.rpcport)) end if (config.daemon.listenIpv4) then table.insert(listenOn, xavante_params('0.0.0.0', config.daemon.rpcport)) end function httpd.run() for ifs, server in pairs(listenOn) do print('[xavante]', 'listening on '..server.host..' port '..server.port) xavante.HTTP { defaultHost = { rules = rules }, server = server } end local listener = threadman.registerListener("xavante", {"nonblockingcall.complete","exit"}) xavante.start(function() local msg = ""; while msg ~= nil do msg = listener:listen(true) if msg ~= nil then if msg["type"] == "exit" then return true end if msg["type"] == "nonblockingcall.complete" then rpc.processBlockingCallMsg(msg) end end end return false end, 1); threadman.unregisterListener(listener) end return httpd
AddCSLuaFile() ENT.Base = "base_brush" ENT.ShootingBarrels = false function ENT:Initialize() end function ENT:StartShootingBarrels() if self.ShootingBarrels then return end self.ShootingBarrels = true local mins = self:OBBMins() local maxs = self:OBBMaxs() timer.Create( self:EntIndex() .. "_timer", 0.1, 0, function() -- Shoot a barrel local barrel = ents.Create( "prop_physics" ) barrel:SetModel( "models/props_c17/oildrum001_explosive.mdl" ) barrel:SetPos( Vector( math.random( mins.x, maxs.x ), math.random( mins.y, maxs.y ), math.random( mins.z, maxs.z ) ) ) barrel:Spawn() barrel:PhysWake() barrel:SetVelocity( Vector( 0, 0, -6000 ) ) barrel:Ignite( 20 ) end ) end function ENT:StopShootingBarrels() self.ShootingBarrels = false timer.Remove( self:EntIndex() .. "_timer" ) end
local _, XB = ... local usedGUIs = {} XB.Interface = {} XB.Globals.Interface = {} -- Locals local LibStub = LibStub local strupper = strupper local DiesalGUI = LibStub("DiesalGUI-1.0") local DiesalTools = LibStub("DiesalTools-1.0") local SharedMedia = LibStub("LibSharedMedia-3.0") local L = (function(key) return XB.Locale:TA('Any',key) end) function XB.Interface:Header(element, parent, offset, table) local tmp = DiesalGUI:Create("FontString") tmp:SetParent(parent.content) parent:AddChild(tmp) tmp = tmp.fontString tmp:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset) tmp:SetText('|cff'..table.color..element.text) if element.justify then tmp:SetJustifyH(element.justify) else tmp:SetJustifyH('LEFT') end tmp:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 13) tmp:SetWidth(parent.content:GetWidth()-10) if element.align then tmp:SetJustifyH(strupper(element.align)) end if element.key then usedGUIs[table.key].elements[element.key] = tmp end end function XB.Interface:Text(element, parent, offset, table) local tmp = DiesalGUI:Create("FontString") tmp:SetParent(parent.content) parent:AddChild(tmp) tmp = tmp.fontString tmp:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset) tmp:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset) tmp:SetText(element.text) tmp:SetJustifyH('LEFT') tmp:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), element.size or 10) tmp:SetWidth(parent.content:GetWidth()-10) if not element.offset then element.offset = tmp:GetStringHeight() end if element.align then tmp:SetJustifyH(strupper(element.align)) end if element.key then usedGUIs[table.key].elements[element.key] = tmp end end function XB.Interface:Rule(element, parent, offset, table) local tmp = DiesalGUI:Create('Rule') parent:AddChild(tmp) tmp:SetParent(parent.content) tmp.frame:SetPoint('TOPLEFT', parent.content, 'TOPLEFT', 5, offset-3) tmp.frame:SetPoint('BOTTOMRIGHT', parent.content, 'BOTTOMRIGHT', -5, offset-3) if element.key then usedGUIs[table.key].elements[element.key] = tmp end end function XB.Interface:Texture(element, parent, offset, table) local tmp = CreateFrame('Frame') tmp:SetParent(parent.content) if element.center then tmp:SetPoint('CENTER', parent.content, 'CENTER', (element.x or 0), offset-(element.y or 0)) else tmp:SetPoint('TOPLEFT', parent.content, 'TOPLEFT', 5+(element.x or 0), offset-3+(element.y or 0)) end tmp:SetWidth(parent:GetWidth()-10) tmp:SetHeight(element.height) tmp:SetWidth(element.width) tmp.texture = tmp:CreateTexture() tmp.texture:SetTexture(element.texture) tmp.texture:SetAllPoints(tmp) if element.key then usedGUIs[table.key].elements[element.key] = tmp end end function XB.Interface:Checkbox(element, parent, offset, table) local tmp = DiesalGUI:Create('CheckBox') parent:AddChild(tmp) tmp:SetParent(parent.content) tmp:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-3) tmp:SetEventListener('OnValueChanged', function(_, _, checked) XB.Config:Write(table.key, element.key, checked) end) tmp:SetChecked(XB.Config:Read(table.key, element.key, element.default or false)) XB.Config:Write(table.key, element.key, XB.Config:Read(table.key, element.key, element.default or false)) local tmp_text = DiesalGUI:Create("FontString") tmp_text:SetParent(parent.content) parent:AddChild(tmp_text) tmp_text = tmp_text.fontString tmp_text:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 20, offset-3) tmp_text:SetText(element.text) tmp_text:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 13) if element.desc then local tmp_desc = DiesalGUI:Create("FontString") tmp_desc:SetParent(parent.content) parent:AddChild(tmp_desc) tmp_desc = tmp_desc.fontString tmp_desc:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-15) tmp_desc:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset-15) tmp_desc:SetText(element.desc) tmp_desc:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 9) tmp_desc:SetWidth(parent.content:GetWidth()-10) tmp_desc:SetJustifyH('LEFT') element.push = tmp_desc:GetStringHeight() + 5 end element.tooltip = element.tooltip or '' local checkState = element.default and L('Checked') or L('Unchecked') local tooltip = element.tooltip..'|r|n|n|cff00ff96'..L('CheckState')..'|r'..checkState..'|r|n' tmp:SetEventListener('OnEnter', function() GameTooltip:SetOwner(tmp.frame, "ANCHOR_LEFT") GameTooltip:AddLine(tooltip, 255/255, 187/255, 00/255, true) GameTooltip:Show() end) tmp:SetEventListener('OnLeave', function() GameTooltip:Hide() end) if element.key then usedGUIs[table.key].elements[element.key..'Text'] = tmp_text usedGUIs[table.key].elements[element.key] = tmp end end function XB.Interface:Spinner(element, parent, offset, table) local tmp_spin = DiesalGUI:Create('Spinner') parent:AddChild(tmp_spin) tmp_spin:SetParent(parent.content) tmp_spin:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset-1) tmp_spin:SetNumber( XB.Config:Read(table.key, element.key, element.default) ) XB.Config:Write(table.key, element.key, XB.Config:Read(table.key, element.key, element.default)) if element.width then tmp_spin.settings.width = element.width end if element.min then tmp_spin.settings.min = element.min end if element.max then tmp_spin.settings.max = element.max end if element.step then tmp_spin.settings.step = element.step end if element.shiXBtep then tmp_spin.settings.shiXBtep = element.shiXBtep end tmp_spin:ApplySettings() tmp_spin:AddStyleSheet(XB.UI.spinnerStyleSheet) tmp_spin:SetEventListener('OnValueChanged', function(_, _, userInput, number) if not userInput then return end XB.Config:Write(table.key, element.key, number) if element.callback then element.callback(number) end end) local tmp_text = DiesalGUI:Create("FontString") tmp_text:SetParent(parent.content) parent:AddChild(tmp_text) tmp_text = tmp_text.fontString tmp_text:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 20, offset-4) tmp_text:SetText(element.text) tmp_text:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 13) tmp_text:SetJustifyH('LEFT') tmp_text:SetWidth(parent.content:GetWidth()-10) if element.desc then local tmp_desc = DiesalGUI:Create("FontString") tmp_desc:SetParent(parent.content) parent:AddChild(tmp_desc) tmp_desc = tmp_desc.fontString tmp_desc:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-18) tmp_desc:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset-18) tmp_desc:SetText(element.desc) tmp_desc:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 9) tmp_desc:SetWidth(parent.content:GetWidth()-10) tmp_desc:SetJustifyH('LEFT') element.push = tmp_desc:GetStringHeight() + 5 end element.tooltip = element.tooltip or '' local tooltip = element.tooltip..'|r|n|n|cff00ff96'..L('DefValue')..'|r'..tostring(element.default or 0)..'|r|n' tmp_spin:SetEventListener('OnEnter', function() GameTooltip:SetOwner(tmp_spin.frame, "ANCHOR_RIGHT") GameTooltip:AddLine(tooltip, 255/255, 187/255, 00/255, true) GameTooltip:Show() end) tmp_spin:SetEventListener('OnLeave', function() GameTooltip:Hide() end) if element.key then usedGUIs[table.key].elements[element.key..'Text'] = tmp_text usedGUIs[table.key].elements[element.key] = tmp_spin end end function XB.Interface:Checkspin(element, parent, offset, table) local tmp_spin = DiesalGUI:Create('Spinner') parent:AddChild(tmp_spin) tmp_spin:SetParent(parent.content) tmp_spin:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset-1) if element.width then tmp_spin.settings.width = element.width end if element.min then tmp_spin.settings.min = element.min end if element.max then tmp_spin.settings.max = element.max end if element.step then tmp_spin.settings.step = element.step end if element.shiXBtep then tmp_spin.settings.shiXBtep = element.shiXBtep end tmp_spin:SetNumber( XB.Config:Read(table.key, element.key..'_spin', element.default_spin or 0) ) XB.Config:Write(table.key, element.key..'_spin', XB.Config:Read(table.key, element.key..'_spin', element.default_spin or 0)) tmp_spin:AddStyleSheet(XB.UI.spinnerStyleSheet) tmp_spin:ApplySettings() tmp_spin:SetEventListener('OnValueChanged', function(_, _, userInput, number) if not userInput then return end XB.Config:Write(table.key, element.key..'_spin', number) end) local tmp_check = DiesalGUI:Create('CheckBox') parent:AddChild(tmp_check) tmp_check:SetParent(parent.content) tmp_check:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-4) tmp_check:SetEventListener('OnValueChanged', function(_, _, checked) XB.Config:Write(table.key, element.key..'_check', checked) end) tmp_check:SetChecked(XB.Config:Read(table.key, element.key..'_check', element.default_check or false)) XB.Config:Write(table.key, element.key..'_check', XB.Config:Read(table.key, element.key..'_check', element.default_check or false)) local tmp_text = DiesalGUI:Create("FontString") tmp_text:SetParent(parent.content) parent:AddChild(tmp_text) tmp_text = tmp_text.fontString tmp_text:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 20, offset-4) tmp_text:SetText(element.text) tmp_text:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 13) tmp_text:SetJustifyH('LEFT') tmp_text:SetWidth(parent.content:GetWidth()-10) if element.desc then local tmp_desc = DiesalGUI:Create("FontString") tmp_desc:SetParent(parent.content) parent:AddChild(tmp_desc) tmp_desc = tmp_desc.fontString tmp_desc:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-18) tmp_desc:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset-18) tmp_desc:SetText(element.desc) tmp_desc:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 9) tmp_desc:SetWidth(parent.content:GetWidth()-10) tmp_desc:SetJustifyH('LEFT') element.push = tmp_desc:GetStringHeight() + 5 end element.tooltip = element.tooltip or '' local checkState = element.default_check and L('Checked') or L('Unchecked') local tooltip = element.tooltip..'|r|n|n|cff00ff96'..L('CheckState')..'|r'..checkState..'|r|n|cff00ff96'..L('DefValue')..'|r'..tostring(element.default_spin or 0)..'|r|n' local OnEnter = function(self,al) GameTooltip:SetOwner(self.frame, al) GameTooltip:AddLine(tooltip, 255/255, 187/255, 00/255, true) GameTooltip:Show() end tmp_spin:SetEventListener('OnEnter', function() OnEnter(tmp_spin,'ANCHOR_RIGHT') end) tmp_check:SetEventListener('OnEnter', function() OnEnter(tmp_check,'ANCHOR_LEFT') end) tmp_spin:SetEventListener('OnLeave', function() GameTooltip:Hide() end) tmp_check:SetEventListener('OnLeave', function() GameTooltip:Hide() end) if element.key then usedGUIs[table.key].elements[element.key..'Text'] = tmp_text usedGUIs[table.key].elements[element.key..'Check'] = tmp_check usedGUIs[table.key].elements[element.key..'Spin'] = tmp_spin end end function XB.Interface:Combo(element, parent, offset, table) local tmp_list = DiesalGUI:Create('Dropdown') parent:AddChild(tmp_list) tmp_list:SetParent(parent.content) tmp_list:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset) local orderdKeys = { } local list = { } for i, value in pairs(element.list) do orderdKeys[i] = value.key list[value.key] = value.text end tmp_list:SetList(list, orderdKeys) tmp_list:SetEventListener('OnValueChanged', function(_, _, value) XB.Config:Write(table.key, element.key, value) end) tmp_list:SetValue(XB.Config:Read(table.key, element.key, element.default)) XB.Config:Write(table.key, element.key, XB.Config:Read(table.key, element.key, element.default)) local tmp_text = DiesalGUI:Create("FontString") tmp_text:SetParent(parent.content) parent:AddChild(tmp_text) tmp_text = tmp_text.fontString tmp_text:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-3) tmp_text:SetText(element.text) tmp_text:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 10) tmp_text:SetJustifyH('LEFT') tmp_text:SetWidth(parent.content:GetWidth()-10) if element.desc then local tmp_desc = DiesalGUI:Create("FontString") tmp_desc:SetParent(parent.content) parent:AddChild(tmp_desc) tmp_desc = tmp_desc.fontString tmp_desc:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-18) tmp_desc:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset-18) tmp_desc:SetText(element.desc) tmp_desc:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 9) tmp_desc:SetWidth(parent.content:GetWidth()-10) tmp_desc:SetJustifyH('LEFT') element.push = tmp_desc:GetStringHeight() + 5 end if element.key then usedGUIs[table.key].elements[element.key..'Text'] = tmp_text usedGUIs[table.key].elements[element.key] = tmp_list end end function XB.Interface:Button(element, parent, offset, table) local tmp = DiesalGUI:Create("Button") parent:AddChild(tmp) tmp:SetParent(parent.content) tmp:SetText(element.text) tmp:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 12) tmp:SetWidth(element.width or 100) tmp:SetHeight(element.height or 20) tmp:AddStyleSheet(XB.UI.buttonStyleSheet) tmp:SetEventListener("OnClick", element.callback) if element.desc then local tmp_desc = DiesalGUI:Create("FontString") tmp_desc:SetParent(parent.content) parent:AddChild(tmp_desc) tmp_desc = tmp_desc.fontString tmp_desc:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-element.height-3) tmp_desc:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset-element.height-3) tmp_desc:SetText(element.desc) tmp_desc:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 9) tmp_desc:SetWidth(parent.content:GetWidth()-10) tmp_desc:SetJustifyH('LEFT') element.push = tmp_desc:GetStringHeight() + 5 end if element.align then local loc = element.align tmp:SetPoint(loc, parent.content, 0, offset) else tmp:SetPoint("TOPLEFT", parent.content, 0, offset) end if element.key then usedGUIs[table.key].elements[element.key] = tmp end end function XB.Interface:Input(element, parent, offset, table) local tmp_input = DiesalGUI:Create('Input') parent:AddChild(tmp_input) tmp_input:SetParent(parent.content) tmp_input:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset) if element.width then tmp_input:SetWidth(element.width) end tmp_input:SetText(XB.Config:Read(table.key, element.key, element.default or '')) XB.Config:Write(table.key, element.key, XB.Config:Read(table.key, element.key, element.default or '')) tmp_input:SetEventListener('OnEditFocusLost', function(this) XB.Config:Write(table.key, element.key, this:GetText()) end) local tmp_text = DiesalGUI:Create("FontString") tmp_text:SetParent(parent.content) parent:AddChild(tmp_text) tmp_text = tmp_text.fontString tmp_text:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-3) tmp_text:SetText(element.text) tmp_text:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 10) tmp_text:SetJustifyH('LEFT') if element.desc then local tmp_desc = DiesalGUI:Create("FontString") tmp_desc:SetParent(parent.content) parent:AddChild(tmp_desc) tmp_desc = tmp_desc.fontString tmp_desc:SetPoint("TOPLEFT", parent.content, "TOPLEFT", 5, offset-18) tmp_desc:SetPoint("TOPRIGHT", parent.content, "TOPRIGHT", -5, offset-18) tmp_desc:SetText(element.desc) tmp_desc:SetFont(SharedMedia:Fetch('font', 'Calibri Bold'), 9) tmp_desc:SetWidth(parent.content:GetWidth()-10) tmp_desc:SetJustifyH('LEFT') element.push = tmp_desc:GetStringHeight() + 5 end if element.key then usedGUIs[table.key].elements[element.key..'Text'] = tmp_text usedGUIs[table.key].elements[element.key] = tmp_input end end function XB.Interface:Statusbar(element, parent, _, table) local tmp_statusbar = DiesalGUI:Create('StatusBar') parent:AddChild(tmp_statusbar) tmp_statusbar:SetParent(parent.content) tmp_statusbar.frame:SetStatusBarColor(DiesalTools:GetColor(element.color)) if element.value then tmp_statusbar:SetValue(element.value) end if element.textLeft then tmp_statusbar.frame.Left:SetText(element.textLeft) end if element.textRight then tmp_statusbar.frame.Right:SetText(element.textRight) end if element.key then usedGUIs[table.key].elements[element.key] = tmp_statusbar end end function XB.Interface:Noop() end local _Elements = { header = { func = 'Header', offset = -16 }, text = { func = 'Text', offset = 0 }, rule = { func = 'Rule', offset = -10 }, ruler = { func = 'Rule', offset = -10 }, texture = { func = 'Texture', offset = 0 }, checkbox = { func = 'Checkbox', offset = -16 }, spinner = { func = 'Spinner', offset = -19 }, checkspin = { func = 'Checkspin', offset = -19 }, combo = { func = 'Combo', offset = -20 }, dropdown = { func = 'Combo', offset = -20 }, button = { func = 'Button', offset = -20 }, input = { func = 'Input', offset = -16 }, spacer = { func = 'Noop', offset = -10 }, } function XB.Interface:BuildElements(table, parent) local offset = -5 usedGUIs[table.key].elements = {} for _, element in ipairs(table.config) do local push, pull = 0, 0 -- Create defaults if element.key and not XB.Config:Read(table.key, element.key) then if element.default then XB.Config:Write(table.key, element.key, element.default) elseif element.default_check then XB.Config:Write(table.key, element.key, element.default_check) XB.Config:Write(table.key, element.key, element.default_Spin) end end if _Elements[element.type] then local func = _Elements[element.type].func local _offset = _Elements[element.type].offset self[func](self, element, parent, offset, table) offset = offset + _offset end if element.type == 'texture' then offset = offset + -(element.offset or 0) elseif element.type == "text" then offset = offset + -(element.offset) - (element.size or 10) end if element.push then push = push + element.push offset = offset + -(push) end if element.pull then pull = pull + element.pull offset = offset + pull end end end function XB.Interface:GetElement(key, element) return usedGUIs[key].elements[element] end function XB.Interface:BuildGUI(eval) -- This opens a existing GUI instead of creating another local test = type(eval) == 'string' and eval or eval.key if usedGUIs[test] then usedGUIs[test].parent:Show() return end -- Create a new one if not eval.key then return end usedGUIs[eval.key] = {} local parent = DiesalGUI:Create('Window') usedGUIs[eval.key].parent = parent parent:SetWidth(eval.width or 200) parent:SetHeight(eval.height or 300) parent:SetTitleFont(SharedMedia:Fetch('font', 'Fira Sans'), 11) parent.frame:SetClampedToScreen(true) parent:SetEventListener('OnDragStop', function(self, _, left, top) XB.Config:Write(eval.key, 'Location', {left, top}) end) XB.Core:WhenInGame(function() local left, top = unpack(XB.Config:Read(eval.key, 'Location', {500, 500})) parent.settings.left = left parent.settings.top = top parent:UpdatePosition() if not eval.color then eval.color = XB.Color end if type(eval.color) == 'function' then eval.color = eval.color() end -- XB.UI.spinnerStyleSheet['bar-background']['color'] = eval.color if eval.title then parent:SetTitle("|cff"..eval.color..eval.title.."|r", eval.subtitle) end if eval.config then local window = DiesalGUI:Create('ScrollFrame') parent:AddChild(window) window:SetParent(parent.content) window:SetAllPoints(parent.content) window.elements = { } eval.window = window XB.Interface:BuildElements(eval, window) end end) return parent end -- Gobals XB.Globals.Interface = { BuildGUI = XB.Interface.BuildGUI, Fetch = XB.Config.Read, GetElement = XB.Interface.GetElement }
-- -- Class Mods - Shaman settings -- -- Check the player's class before creating these settings if (select(2, UnitClass("player")) ~= "SHAMAN") then return end -- -- ResourceBar Module -- ClassMods.enableprediction = true ClassMods.powerGenerationSpells = { [1] = { -- Elemental { 51505, 12 }, -- Lava Burst { 188196, 8 }, -- Lightning Bolt { 188443, 4 }, -- Chain Lightning }, } ClassMods.highwarn = true -- -- ResourceBar: Tick Marks -- ClassMods.enableticks = true --[[ ClassMods.ticks 1: Enabled 2: SpellID 3: Offset from main spell 4: Change colour of the resource bar when focus is <= tick value 5: Colour of the Tick Mark r,b,g,a 6: UnitPowerType to display the tick (Special for PowerType changing classes Im looking at YOU DRUIDS!) 7: Use spell icon for the tick mark --]] ClassMods.ticks = { [1] = { -- Elemental -- { 1, 2, 3, 4, 5, 6, 7 }, -- index { true, 188389, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- Flame Shock { false, 196840, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- Frost Shock { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- }, [2] = { -- Enhancement { true, 17364, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- Stormstrike { true, 60103, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- Lava Lash { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- }, [3] = { -- Restoration { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- { false, nil, true, false, {1,1,1,1}, SPELL_POWER_MAELSTROM, false }, -- }, } --[[ ClassMods.classSpells 1: spellID 2: cost 3: power type --]] ClassMods.classSpells = { [1] = { -- Elemental -- { 1, 2, 3 }, -- index { 188389, 20, SPELL_POWER_MAELSTROM }, -- Flame Shock { 196840, 20, SPELL_POWER_MAELSTROM }, -- Frost Shock { 8042, 10, SPELL_POWER_MAELSTROM }, -- Earth Shock }, [2] = { -- Enhancement { 187874, 20, SPELL_POWER_MAELSTROM }, -- Crash Lightning { 196834, 20, SPELL_POWER_MAELSTROM }, -- Frostbrand { 60103, 30, SPELL_POWER_MAELSTROM }, -- Lava Lash { 17364, 40, SPELL_POWER_MAELSTROM }, -- Stormstrike }, [3] = {}, -- Restoration } -- -- ResourceBar: Stacks -- --[[ ClassMods.stacks 1: enabled 2: spellID 3: unitID to check 4: numBars 5: flashtype 6: check type - "aura" for UnitAura() or "charge" for GetSpellCharges() --]] ClassMods.stacks = { [1] = { -- Elemental -- { 1, 2, 3, 4, 5, 6 }, -- index { true, 16164, "player", 2, "AtMax", "aura" }, -- Elemental Focus { false, 210714, "player", 4, "Always", "aura" }, -- Icefury { false, 51505, "player", 2, "AtMax", "charge" }, -- Lava Burst (Echo of Elements) }, [2] = { -- Enhancement { true, 201846, "player", 2, "Always", "aura" }, -- Stormbringer (Tempest) }, [3] = { -- Restoration { true, 53390, "player", 2, "AtMax", "aura" }, -- Tidal Waves { false, 5394, "player", 2, "AtMax", "charge" }, -- Healing Stream Totem { false, 61295, "player", 2, "AtMax", "charge" }, -- Riptide { false, 51505, "player", 2, "AtMax", "charge" }, -- Lava Burst }, } -- -- Alternate Resource Bar -- ClassMods.alternateResource = false -- -- Timers -- --[[ ClassMods.timerbarDefaults 1: Spell 2: Item 3: Check target 4: Check type 5: Owner 6: What specilization (no longer used) 7: Timer text position 8: Flash when expiring? 9: Only if known flag (mandatory true) 10: <removed, was growth setting> 11: - <removed, Grow start> 12: - <removed, Grow size> 13: Change alpha over time? 14: - Alpha Start 15: - Alpha End 16: Internal Cooldown time 17: Last time for Internal Cooldown 18: Show the icon when? { 1 = Active / 0 or nil = Always } 19: Position on bar (values: 1 - total timers) 20: Inactive Alpha when "always" on bar for stationary timers. 21: Collapse flag, for options. (used internally) --]] ClassMods.timerbarDefaults = { ["timerbar1"] = { -- { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,16, 17, 18, 19, 20 }, -- Index { 187837, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 1, 0.5 }, -- Lightning Bolt { 187874, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 2, 0.5 }, -- Crash Lightning { 17364, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 3, 0.5 }, -- Stormstrike { 207399, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 4, 0.5 }, -- Ancestral Protection Totem { 2008, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 5, 0.5 }, -- Ancestral Spirit { 370, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 6, 0.5 }, -- Purge { 51886, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 7, 0.5 }, -- Cleanse Spirit { 77130, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 8, 0.5 }, -- Purify Spirit { 57994, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 9, 0.5 }, -- Wind Shear { 198103, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 10, 0.5 }, -- Earth Elemental { 198067, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 11, 0.5 }, -- Fire Elemental { 192249, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 12, 0.5 }, -- Storm Elemental { 201897, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 13, 0.5 }, -- Boulderfist { 114050, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 14, 0.5 }, -- Acendance (Elemental) { 114051, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 15, 0.5 }, -- Acendance (Enhancement) { 114052, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 16, 0.5 }, -- Acendance (Restoration) { 108281, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 17, 0.5 }, -- Ancestral Guidence { 108271, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 18, 0.5 }, -- Astral Shift { 157153, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 19, 0.5 }, -- Cloudburst Totem { 198838, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 20, 0.5 }, -- Earthen Shield Totem { 188089, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 21, 0.5 }, -- Earthen Spike { 51485, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 22, 0.5 }, -- Earthgrab Totem { 61882, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 23, 0.5 }, -- Earthquake Totem { 117014, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 24, 0.5 }, -- Elemental Blast { 16166, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 25, 0.5 }, -- Elemental Mastery { 196884, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 26, 0.5 }, -- Feral Lunge { 51533, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 27, 0.5 }, -- Feral Spirits { 188838, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 28, 0.5 }, -- Flame Shock (Restoration) { 193796, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 29, 0.5 }, -- Flametongue { 192063, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 30, 0.5 }, -- Gust of Wind { 73920, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 31, 0.5 }, -- Healing Rain { 5394, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 32, 0.5 }, -- Healing Stream Totem { 108280, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 33, 0.5 }, -- Healing Tide Totem { 32182, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 34, 0.5 }, -- Heroism { 51514, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 35, 0.5 }, -- Hex { 51505, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 36, 0.5 }, -- Lava Burst { 192058, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 37, 0.5 }, -- Lightning Surge Totem { 192222, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 38, 0.5 }, -- Liquid Magma Totem --{ 215864, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 39, 0.5 }, -- Rainfall { 61295, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 40, 0.5 }, -- Riptide { 98008, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 41, 0.5 }, -- Spirit Link Totem { 58875, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 42, 0.5 }, -- Spirit Walk { 79206, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 43, 0.5 }, -- Spirit Walker's Grace { 197214, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 44, 0.5 }, -- Sundering { 51490, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 45, 0.5 }, -- Thunderstorm { 73685, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 46, 0.5 }, -- Unleash Life { 196932, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 47, 0.5 }, -- Voodoo Totem { 197995, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 48, 0.5 }, -- Wellspring { 192077, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 49, 0.5 }, -- Wind Rush Totem { 201898, nil, "player", "COOLDOWN", "PLAYERS", 0, "CENTER", nil, true, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 50, 0.5 }, -- Windsong }, ["timerbar2"] = { -- { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,16, 17, 18, 19, 20 }, -- Index { 53390, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 1, 0.5 }, -- Tidal Waves --{ 16164, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 2, 0.5 }, -- Elemental Focus { 198103, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 3, 0.5 }, -- Earth Elemental { 198067, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 4, 0.5 }, -- Fire Elemental { 210714, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 5, 0.5 }, -- Icefury { 108281, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 6, 0.5 }, -- Ancestral Guidence { 215785, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 7, 0.5 }, -- Hot Hand { 77762, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 8, 0.5 }, -- Lava Surge { 201846, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 9, 0.5 }, -- Stormbringer { 216251, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 10, 0.5 }, -- Undulation { 32182, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 11, 0.5 }, -- Heroism { 114050, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 12, 0.5 }, -- Acendance (Elemental) { 114051, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 13, 0.5 }, -- Acendance (Enhancement) { 114052, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 14, 0.5 }, -- Acendance (Restoration) { 108271, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 15, 0.5 }, -- Astral Shift { 118522, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 16, 0.5 }, -- Elemental Blast: Critical Strike { 173183, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 17, 0.5 }, -- Elemental Blast: Haste { 173184, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 18, 0.5 }, -- Elemental Blast: Mastery { 16166, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 19, 0.5 }, -- Elemental Mastery { 171114, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 20, 0.5 }, -- Feral Spirits { 194084, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 21, 0.5 }, -- Flametongue { 196834, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 22, 0.5 }, -- Frostbrand { 73920, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 23, 0.5 }, -- Healing Rain { 202004, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 24, 0.5 }, -- Landslide { 192106, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 25, 0.5 }, -- Lightning Shield --{ 215864, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 26, 0.5 }, -- Rainfall { 58875, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 27, 0.5 }, -- Spirit Walk { 79206, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 28, 0.5 }, -- Spirit Walker's Grace { 73685, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 29, 0.5 }, -- Unleash Life { 192082, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 30, 0.5 }, -- Wind Rush { 201898, nil, "player", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 31, 0.5 }, -- Windsong }, ["timerbar3"] = { -- { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,16, 17, 18, 19, 20 }, -- Index { 197209, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 1, 0.5 }, -- Lightning Rod { 51514, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 2, 0.5 }, -- Hex { 207400, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 3, 0.5 }, -- Ancestral Vigor { 116947, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 4, 0.5 }, -- Earthbind { 188089, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 5, 0.5 }, -- Earthen Spike { 64695, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 6, 0.5 }, -- Earthgrab { 188389, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 7, 0.5 }, -- Flame Shock (Elemental) { 188838, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 8, 0.5 }, -- Flame Shock (Restoration) { 196840, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 9, 0.5 }, -- Frost Shock { 147732, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 10, 0.5 }, -- Frostbrand { 61295, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 11, 0.5 }, -- Riptide { 118905, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 12, 0.5 }, -- Static Charge { 51490, nil, "target", "DURATION", "PLAYERS", 0, "CENTER", nil, nil, nil, nil, nil, nil, 0.4, 1, 0, nil, 1, 13, 0.5 }, -- Thunderstorm }, } --[[ ClassMods.spellTracker.spells: [spellID] 1 = GUID applied to 2 = expireTime 3 = knownDuration in seconds --]] ClassMods.spellTrackerSpells = {} -- -- Alerts -- ClassMods.pethealthtexture = nil ClassMods.alertDefaults = { ["Player Health Alert"] = { enabled = true, alerttype = "HEALTH", enablesound = true, sound = "Raid Warning", aura = "", target = "player", sparkles = true, healthpercent = 0.3 }, [select(1, GetSpellInfo(108281))] = { -- Ancestral Guidence enabled = true, alerttype = "BUFF", enablesound = true, sound = "Ding", aura = 108281, target = "player", sparkles = true }, --//TODO --[[ [select(1, GetSpellInfo(16164))] = { -- Elemental Focus enabled = true, alerttype = "BUFF", enablesound = true, sound = "Ding", aura = 16164, target = "player", sparkles = true }, --]] [select(1, GetSpellInfo(215785))] = { -- Hot Hand enabled = true, alerttype = "BUFF", enablesound = true, sound = "Ding", aura = 215785, target = "player", sparkles = true }, [select(1, GetSpellInfo(77762))] = { -- Lava Surge enabled = true, alerttype = "BUFF", enablesound = true, sound = "Ding", aura = 77762, target = "player", sparkles = true }, [select(1, GetSpellInfo(197209))] = { -- Lightning Rod enabled = true, alerttype = "DEBUFF", enablesound = true, sound = "Ding", aura = 197209, target = "target", sparkles = true }, [select(1, GetSpellInfo(201846))] = { -- Stormbringer enabled = true, alerttype = "BUFF", enablesound = true, sound = "Ding", aura = 201846, target = "player", sparkles = true }, [select(1, GetSpellInfo(216251))] = { -- Undulation enabled = true, alerttype = "BUFF", enablesound = true, sound = "Ding", aura = 216251, target = "player", sparkles = true }, } -- -- Announcements -- --[[ ClassMods.announcementDefaults 1: enabled 2: spellID 3: announce end 4: solo channel 5: party channel 6: raid channel 7: arena channel 8: pvp channel --]] ClassMods.announcementDefaults = { [select(1, GetSpellInfo(207399))] = { -- Ancestral Protection Totem enabled = true, spellid = 207399, announceend = false, solochan = "AUTO", partychan = "AUTO", raidchan = "AUTO", arenachan = "AUTO", pvpchan = "AUTO", }, [select(1, GetSpellInfo(2008))] = { -- Ancestral Spirit enabled = true, spellid = 2008, announceend = false, solochan = "AUTO", partychan = "AUTO", raidchan = "AUTO", arenachan = "AUTO", pvpchan = "AUTO", }, [select(1, GetSpellInfo(32182))] = { -- Heroism enabled = true, spellid = 32182, announceend = true, solochan = "AUTO", partychan = "AUTO", raidchan = "AUTO", arenachan = "AUTO", pvpchan = "AUTO", }, [select(1, GetSpellInfo(212048))] = { -- Ancestral Vision enabled = true, spellid = 212048, announceend = false, solochan = "AUTO", partychan = "AUTO", raidchan = "AUTO", arenachan = "AUTO", pvpchan = "AUTO", }, } -- -- Click to Cast -- ClassMods.clickToCastDefault = select(1, GetSpellInfo(2008)) -- Ancestral Spirit -- -- Crowd Control -- --[[ ClassMods.crowdcontrolDefaults 1: spellID 2: enabled 3: aura 4: pve duration 5: pvp duration 6: can the CC be refreshed --]] ClassMods.enableCrowdControl = true -- TODO: UPDATE THE NON DR PVP DURATIONS ClassMods.crowdControlSpells = { -- { 1, 2, 3, 4, 5 }, -- index { 51514, true, 51514, 60, 30 }, -- Hex { 210873, true, 210873, 60, 30 }, -- Hex: Compy { 211004, true, 211004, 60, 30 }, -- Hex: Spider { 211010, true, 211010, 60, 30 }, -- Hex: Snake { 211015, true, 211015, 60, 30 }, -- Hex: Cocroach } -- -- Dispel -- ClassMods.enableDispel = true ClassMods.dispelTexture = select(3, GetSpellInfo(370)) -- Purge -- -- Healthbar -- ClassMods.pethealth = true ClassMods.pethealthfont = { "Big Noodle", 14, "OUTLINE" } ClassMods.pethealthfontoffset = -80 -- -- Totems -- --[[ ClassMods.totems 1: enabled 2: spellID 3: duration --]] ClassMods.enableTotems = true ClassMods.totems = { { true, 51485, 20 }, -- Earthgrab Totem { true, 61882, 10 }, -- Earthquake Totem { true, 192222, 15 }, -- Liquid Magma Totem { true, 196932, 10 }, -- Voodoo Totem { true, 192077, 15 }, -- Wind Rush Totem { true, 210643, 120}, -- Totem Mastery { true, 207399, 30 }, -- Ancestral Protection Totem { true, 157153, 15 }, -- Cloudburst Totem { true, 198838, 15 }, -- Earthen Shield Totem { true, 5394, 15 }, -- Healing Stream Totem { true, 108280, 10 }, -- Healing Tide Totem { true, 98008, 6 }, -- Spirit Link Totem }
ITEM.name = "Military SKAT-9M Exoskeleton" ITEM.description = "A basic SKAT-9M Exoskeleton colored in favor of Ukranian Military." ITEM.category = "Outfit" ITEM.model = "models/tnb/stalker/items/exo.mdl" ITEM.width = 2 ITEM.height = 3 ITEM.outfitCategory = "model" ITEM.pacData = {} ITEM.newSkin = 4 ITEM.replacements = "models/tnb/stalker/male_skat_exo.mdl"
--[[ Apache License 2.0 Copyright (c) 2016-2021 SinisterRectus (Original author) Copyright (c) 2021-2022 Bilal2453 (Heavily modified to partially support EmmyLua) 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. ]] local fs = require('fs') local pathjoin = require('pathjoin') local insert, sort, concat = table.insert, table.sort, table.concat local format = string.format local pathJoin = pathjoin.pathJoin local function scan(dir) for fileName, fileType in fs.scandirSync(dir) do local path = pathJoin(dir, fileName) if fileType == 'file' then coroutine.yield(path) else scan(path) end end end local function match(s, pattern) -- only useful for one capture return assert(s:match(pattern), s) end local function gmatch(s, pattern, hash) -- only useful for one capture local tbl = {} if hash then for k in s:gmatch(pattern) do tbl[k] = true end else for v in s:gmatch(pattern) do insert(tbl, v) end end return tbl end local function matchType(c) local line for _, s in ipairs(c) do if s:find '<!ignore>' then return 'ignore' end end for _, s in ipairs(c) do local m = s:match('%-%-%-%s*@(%S+)') if m then line = m; break end end return line end local function matchComments(s) local lines = {} local last_line = {} for l in s:gmatch('[^\n]*\n?') do if l:match '^%-%-' then last_line[#last_line + 1] = l elseif #last_line > 0 then last_line[#last_line + 1] = l lines[#lines+1] = last_line last_line = {} end end return lines end local function matchClassName(s) return match(s, '@class ([^%s:]+)') end local function matchMethodName(s) local m = s:match 'function%s*.-[:.]%s*([_%w]+)' or s:match 'function%s*([_%w]+)' or s:match '([_%w]+)%s*=%s*function' if not m then error(s) end return m end local function matchDescription(c) local desc = {} for _, v in ipairs(c) do local n, m = v:match('%-%-%-*%s*@'), v:match('%-%-+%s*(.+)') if not n and m then m = m:gsub('<!.->', '') -- invisible custom tags desc[#desc+1] = m end end return table.concat(desc):gsub('^%s+', ''):gsub('%s+$', '') end local function matchParents(c) local line for _, s in ipairs(c) do local m = s:match('@class [%a_][%a_%-%.%*]+%s*:%s*([^\n#@%-]+)') if m then line = m; break end end if not line then return {} end local ret = {} for s in line:gmatch('[^,]+') do ret[#ret + 1] = s:match('%S+'):gsub('%s+', '') end return ret end local function matchReturns(s) return gmatch(s, '@return (%S+)') end local function matchTags(s) local ret = {} for m in s:gmatch '<!tag%s*:%s*(.-)>' do ret[m] = true end return ret end local function matchMethodTags(s) local ret = {} for m in s:gmatch '<!method%p?tags%s*:%s*(.-)>' do ret[m] = true end return ret end local function matchProperties(s) local ret = {} for n, t, d in s:gmatch '@field%s*(%S+)%s*(%S+)%s*([^\n]*)' do ret[#ret+1] = { name = n, type = t, desc = d or '', } end return ret end local function matchParameters(c) local ret = {} for _, s in ipairs(c) do local param_name, optional, param_type = s:match('@param%s*([^%s%?]+)%s*(%??)%s*(%S+)') if param_name then ret[#ret+1] = {param_name, param_type, optional == '?'} end end if #ret > 0 then return ret end for _, s in ipairs(c) do local params = s:match('@type%s*fun%s*%((.-)%)') if not params then goto continue end for pp in params:gmatch('[^,]+') do local param_name, optional = pp:match('([%w_%-]+)%s*(%??)') local param_type = pp:match(':%s*(.+)') if param_name then ret[#ret+1] = {param_name, param_type, optional == '?'} end end ::continue:: end return ret end local function matchMethod(s, c) return { name = matchMethodName(c[#c]), desc = matchDescription(c), parameters = matchParameters(c), returns = matchReturns(s), tags = matchTags(s), } end ---- local docs = {} local function newClass() local class = { methods = {}, statics = {}, } local function init(s, c) class.name = matchClassName(s) class.parents = matchParents(c) class.desc = matchDescription(c) class.parameters = matchParameters(c) class.tags = matchTags(s) class.methodTags = matchMethodTags(s) class.properties = matchProperties(s) assert(not docs[class.name], 'duplicate class: ' .. class.name) docs[class.name] = class end return class, init end for f in coroutine.wrap(scan), './libs' do local d = assert(fs.readFileSync(f)) local class, initClass = newClass() local comments = matchComments(d) for i = 1, #comments do local s = table.concat(comments[i], '\n') local t = matchType(comments[i]) if t == 'ignore' then goto continue elseif t == 'class' then initClass(s, comments[i]) elseif t == 'param' or t == 'return' then local method = matchMethod(s, comments[i]) for k, v in pairs(class.methodTags) do method.tags[k] = v end method.class = class insert(method.tags.static and class.statics or class.methods, method) end ::continue:: end end ---- local output = 'docs' local function link(str) if type(str) == 'table' then local ret = {} for i, v in ipairs(str) do ret[i] = link(v) end return concat(ret, ', ') else local ret, optional = {}, false if str:match('%?$') then str = str:gsub('%?$', '') optional = true end for t in str:gmatch('[^|]+') do insert(ret, docs[t] and format('[[%s]]', t) or t) end if optional then insert(ret, 'nil') end return concat(ret, '/') end end local function sorter(a, b) return a.name < b.name end local function writeHeading(f, heading) f:write('## ', heading, '\n\n') end local function writeProperties(f, properties) sort(properties, sorter) f:write('| Name | Type | Description |\n') f:write('|-|-|-|\n') for _, v in ipairs(properties) do f:write('| ', v.name, ' | ', link(v.type), ' | ', v.desc, ' |\n') end f:write('\n') end local function writeParameters(f, parameters) f:write('(') local optional if #parameters > 0 then for i, param in ipairs(parameters) do f:write(param[1]) if i < #parameters then f:write(', ') end optional = param[3] param[2] = param[2]:gsub('|', '/') end f:write(')\n\n') if optional then f:write('| Parameter | Type | Optional |\n') f:write('|-|-|:-:|\n') for _, param in ipairs(parameters) do local o = param[3] and '✔' or '' f:write('| ', param[1], ' | ', link(param[2]), ' | ', o, ' |\n') end f:write('\n') else f:write('| Parameter | Type |\n') f:write('|-|-|\n') for _, param in ipairs(parameters) do f:write('| ', param[1], ' | ', link(param[2]), ' |\n') end f:write('\n') end else f:write(')\n\n') end end local methodTags = {} methodTags['http'] = 'This method always makes an HTTP request.' methodTags['http?'] = 'This method may make an HTTP request.' methodTags['ws'] = 'This method always makes a WebSocket request.' methodTags['mem'] = 'This method only operates on data in memory.' local function checkTags(tbl, check) for i, v in ipairs(check) do if tbl[v] then for j, w in ipairs(check) do if i ~= j then if tbl[w] then return error(string.format('mutually exclusive tags encountered: %s and %s', v, w), 1) end end end end end end local function writeMethods(f, methods) sort(methods, sorter) for _, method in ipairs(methods) do f:write('### ', method.name) writeParameters(f, method.parameters) f:write(method.desc, '\n\n') local tags = method.tags checkTags(tags, {'http', 'http?', 'mem'}) checkTags(tags, {'ws', 'mem'}) for k in pairs(tags) do if k ~= 'static' then assert(methodTags[k], k) f:write('*', methodTags[k], '*\n\n') end end f:write('**Returns:** ', link(method.returns), '\n\n----\n\n') end end if not fs.existsSync(output) then fs.mkdirSync(output) end local function collectParents(parents, k, ret, seen) ret = ret or {} seen = seen or {} for _, parent in ipairs(parents) do parent = docs[parent] if parent then for _, v in ipairs(parent[k]) do if not seen[v] then seen[v] = true insert(ret, v) end end end if parent then collectParents(parent.parents, k, ret, seen) end end return ret end for _, class in pairs(docs) do local f = io.open(pathJoin(output, class.name .. '.md'), 'w') local parents = class.parents local parentLinks = link(parents) if next(parents) then f:write('#### *extends ', parentLinks, '*\n\n') end f:write(class.desc, '\n\n') checkTags(class.tags, {'interface', 'abstract', 'patch'}) if class.tags.interface then writeHeading(f, 'Constructor') f:write('### ', class.name) writeParameters(f, class.parameters) elseif class.tags.abstract then f:write('*This is an abstract base class. Direct instances should never exist.*\n\n') elseif class.tags.patch then f:write("*This is a patched class.\nFor full usage refer to the Discordia Wiki, only patched methods and properities are documented here.*\n\n") else f:write('*Instances of this class should not be constructed by users.*\n\n') end local properties = collectParents(parents, 'properties') if next(properties) then writeHeading(f, 'Properties Inherited From ' .. parentLinks) writeProperties(f, properties) end if next(class.properties) then writeHeading(f, 'Properties') writeProperties(f, class.properties) end local statics = collectParents(parents, 'statics') if next(statics) then writeHeading(f, 'Static Methods Inherited From ' .. parentLinks) writeMethods(f, statics) end local methods = collectParents(parents, 'methods') if next(methods) then writeHeading(f, 'Methods Inherited From ' .. parentLinks) writeMethods(f, methods) end if next(class.statics) then writeHeading(f, 'Static Methods') writeMethods(f, class.statics) end if next(class.methods) then writeHeading(f, 'Methods') writeMethods(f, class.methods) end f:close() end
---------------------------------------------------------------- -- Fontのキャッシュです. -- フレームワーク内部で使用します. -- @class table -- @name FontManager ---------------------------------------------------------------- local M = { cache = {} } function M:getFont(path) if self.cache[path] == nil then local font = MOAIFont.new() font:load(path) font.path = path self.cache[path] = font end return self.cache[path] end return M
return {'folke/todo-comments.nvim', opt = true, cmd = { 'TodoQuickFix', 'TodoTrouble', 'TodoTelescope', }, keys = { '<leader>ct', '<leader>ctt', '<leader>st', '<leader>ctq', '<leader>ctd', }, requires = { 'folke/lsp-trouble.nvim' }, config = function () require('plugins.todo.config') require('plugins.todo.keys').setup() end, }
local ENT = FindMetaTable("Entity") function ENT:AddWUMAParent(limit) self.WUMAParents = self.WUMAParents or {} self.WUMAParents[limit:GetUniqueID()] = limit self:CallOnRemove("NotifyWUMAParents", function(ent) ent:NotifyWUMAParents() end) end function ENT:RemoveWUMAParent(limit) self.WUMAParents[limit:GetUniqueID()] = nil end function ENT:GetWUMAParents() return self.WUMAParents end function ENT:NotifyWUMAParents() for _,parent in pairs(self:GetWUMAParents()) do parent:DeleteEntity(self:GetCreationID()) end end
local GUI = require("GUI") local computer = require("computer") local MineOSInterface = require("MineOSInterface") local MineOSPaths = require("MineOSPaths") local MineOSCore = require("MineOSCore") local module = {} local application, window, localization = table.unpack({...}) -------------------------------------------------------------------------------- module.name = localization.appearance module.margin = 12 module.onTouch = function() window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.appearanceFiles)) local showExtensionSwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.appearanceExtensions .. ":", MineOSCore.properties.showExtension)).switch local showHiddenFilesSwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.appearanceHidden .. ":", MineOSCore.properties.showHiddenFiles)).switch local showApplicationIconsSwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.appearanceApplications .. ":", MineOSCore.properties.showApplicationIcons)).switch local transparencySwitch = window.contentLayout:addChild(GUI.switchAndLabel(1, 1, 36, 8, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, localization.appearanceTransparencyEnabled .. ":", MineOSCore.properties.transparencyEnabled)).switch window.contentLayout:addChild(GUI.textBox(1, 1, 36, 1, nil, 0xA5A5A5, {localization.appearanceTransparencyInfo}, 1, 0, 0, true, true)) window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.appearanceColorScheme)) local backgroundColorSelector = window.contentLayout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.backgroundColor, localization.appearanceDesktopBackground)) local menuColorSelector = window.contentLayout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.menuColor, localization.appearanceMenu)) local dockColorSelector = window.contentLayout:addChild(GUI.colorSelector(1, 1, 36, 3, MineOSCore.properties.dockColor, localization.appearanceDock)) backgroundColorSelector.onColorSelected = function() MineOSCore.properties.backgroundColor = backgroundColorSelector.color MineOSCore.properties.menuColor = menuColorSelector.color MineOSCore.properties.dockColor = dockColorSelector.color MineOSInterface.application.menu.colors.default.background = MineOSCore.properties.menuColor MineOSInterface.application:draw() end menuColorSelector.onColorSelected = backgroundColorSelector.onColorSelected dockColorSelector.onColorSelected = backgroundColorSelector.onColorSelected window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.appearanceSize)) local iconWidthSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 8, 16, MineOSCore.properties.iconWidth, false, localization.appearanceHorizontal .. ": ", "")) local iconHeightSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 6, 16, MineOSCore.properties.iconHeight, false, localization.appearanceVertical .. ": ", "")) iconHeightSlider.height = 2 window.contentLayout:addChild(GUI.text(1, 1, 0x2D2D2D, localization.appearanceSpace)) local iconHorizontalSpaceBetweenSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 0, 5, MineOSCore.properties.iconHorizontalSpaceBetween, false, localization.appearanceHorizontal .. ": ", "")) local iconVerticalSpaceBetweenSlider = window.contentLayout:addChild(GUI.slider(1, 1, 36, 0x66DB80, 0xE1E1E1, 0xFFFFFF, 0xA5A5A5, 0, 5, MineOSCore.properties.iconVerticalSpaceBetween, false, localization.appearanceVertical .. ": ", "")) iconVerticalSpaceBetweenSlider.height = 2 iconHorizontalSpaceBetweenSlider.roundValues, iconVerticalSpaceBetweenSlider.roundValues = true, true iconWidthSlider.roundValues, iconHeightSlider.roundValues = true, true iconWidthSlider.onValueChanged = function() MineOSInterface.setIconProperties(math.floor(iconWidthSlider.value), math.floor(iconHeightSlider.value), MineOSCore.properties.iconHorizontalSpaceBetween, MineOSCore.properties.iconVerticalSpaceBetween) end iconHeightSlider.onValueChanged = iconWidthSlider.onValueChanged iconHorizontalSpaceBetweenSlider.onValueChanged = function() MineOSInterface.setIconProperties(MineOSCore.properties.iconWidth, MineOSCore.properties.iconHeight, math.floor(iconHorizontalSpaceBetweenSlider.value), math.floor(iconVerticalSpaceBetweenSlider.value)) end iconVerticalSpaceBetweenSlider.onValueChanged = iconHorizontalSpaceBetweenSlider.onValueChanged showExtensionSwitch.onStateChanged = function() MineOSCore.properties.showExtension = showExtensionSwitch.state MineOSCore.properties.showHiddenFiles = showHiddenFilesSwitch.state MineOSCore.properties.showApplicationIcons = showApplicationIconsSwitch.state MineOSCore.saveProperties() computer.pushSignal("MineOSCore", "updateFileList") end showHiddenFilesSwitch.onStateChanged, showApplicationIconsSwitch.onStateChanged = showExtensionSwitch.onStateChanged, showExtensionSwitch.onStateChanged transparencySwitch.onStateChanged = function() MineOSCore.properties.transparencyEnabled = transparencySwitch.state MineOSInterface.applyTransparency() MineOSInterface.application:draw() MineOSCore.saveProperties() end end -------------------------------------------------------------------------------- return module
slot0 = class("MetaCharacterProxy", import(".NetProxy")) slot0.METAPROGRESS_UPDATED = "MetaCharacterProxy:METAPROGRESS_UPDATED" slot1 = pg.ship_strengthen_meta slot0.register = function (slot0) slot0.data = {} slot0.metaProgressVOList = {} slot0.metaTacticsInfoTable = nil slot0.metaTacticsInfoTableOnStart = nil slot0.metaSkillLevelMaxInfoList = nil slot0.lastMetaSkillExpInfoList = nil slot0.startRecordTag = false for slot4, slot5 in pairs(slot0.all) do slot0.data[slot5] = MetaProgress.New({ id = slot5 }) table.insert(slot0.metaProgressVOList, MetaProgress.New()) end slot0.redTagTable = {} for slot4, slot5 in pairs(slot0.all) do slot0.redTagTable[slot5] = { false, false } end slot0:on(63315, function (slot0) print("63315 get red tag info") slot1 = {} for slot5, slot6 in ipairs(slot0.arg1) do table.insert(slot1, MetaCharacterConst.GetMetaShipGroupIDByConfigID(slot6)) end if slot0.type == 1 then for slot5, slot6 in pairs(slot0.redTagTable) do if table.contains(slot1, slot5) then slot6[1] = true slot6[2] = false else slot6[1] = false slot6[2] = false end end end end) slot0.on(slot0, 63316, function (slot0) print("63316 get meta skill exp info") slot1 = {} slot2 = {} slot3 = slot0.metaSkillLevelMaxInfoList or {} for slot7, slot8 in ipairs(slot0.skill_info_list) do print("shipID", slot8.ship_id) slot12 = slot8.skill_exp slot14 = slot8.add_exp slot0:addExpToMetaTacticsInfo(slot8) slot0:setLastMetaSkillExpInfo(slot2, slot8) slot0:setMetaSkillLevelMaxInfo(slot3, slot8) slot18 = pg.gameset.meta_skill_exp_max.key_value <= slot8.day_exp slot19 = getProxy(BayProxy):getShipById(slot9):getMetaSkillLevelBySkillID(slot8.skill_id) < slot8.skill_level if slot18 or slot19 then pg.ToastMgr.GetInstance():ShowToast(pg.ToastMgr.TYPE_META, { metaShipVO = slot15, newDayExp = slot13, addDayExp = slot14, curSkillID = slot10, newSkillLevel = slot11, oldSkillLevel = slot17 }) end slot15:updateSkill({ skill_id = slot10, skill_lv = slot11, skill_exp = slot12 }) getProxy(BayProxy):updateShip(slot15) end if #slot3 > 0 then slot0.metaSkillLevelMaxInfoList = slot3 end if #slot2 > 0 then slot0.lastMetaSkillExpInfoList = slot2 end end) end slot0.getMetaProgressVOList = function (slot0) for slot4, slot5 in ipairs(slot0.metaProgressVOList) do slot5:setDataBeforeGet() end return slot0.metaProgressVOList end slot0.getMetaProgressVOByID = function (slot0, slot1) if slot0.data[slot1] then slot2:setDataBeforeGet() end return slot2 end slot0.updateRedTag = function (slot0, slot1) if slot0.redTagTable[slot1][1] == true then slot0.redTagTable[slot1][2] = true end end slot0.getRedTag = function (slot0, slot1) return slot0.redTagTable[slot1][2] == false and slot2[1] == true end slot0.isHaveVaildMetaProgressVO = function (slot0) for slot5, slot6 in ipairs(slot1) do if slot6:isShow() then return true end end return false end slot0.isHaveBuildMetaProgressVO = function (slot0) for slot5, slot6 in ipairs(slot1) do if slot6:isBuildType() and slot6:isInAct() then return true end end return false end slot0.setMetaTacticsInfo = function (slot0, slot1) slot0.metaTacticsInfoTable = slot0.metaTacticsInfoTable or {} slot2 = slot1.ship_id if MetaTacticsInfo.New(slot1) then slot0.metaTacticsInfoTable[slot2] = slot3 slot3:printInfo() else errorMessage("Creat MetaTacticsInfo Fail!") end end slot0.addExpToMetaTacticsInfo = function (slot0, slot1) if slot0.metaTacticsInfoTable[slot1.ship_id] then slot3:updateExp(slot1) slot3:printInfo() else errorMessage("MetaTacticsInfo is Null", slot2) end end slot0.switchMetaTacticsSkill = function (slot0, slot1, slot2) if slot0.metaTacticsInfoTable[slot1] then slot3:switchSkill(slot2) slot3:printInfo() else errorMessage("MetaTacticsInfo is Null", slot1) end end slot0.unlockMetaTacticsSkill = function (slot0, slot1, slot2, slot3) slot0.metaTacticsInfoTable = slot0.metaTacticsInfoTable or {} if slot0.metaTacticsInfoTable[slot1] then slot4:unlockSkill(slot2, slot3) else slot0.metaTacticsInfoTable[slot1] = MetaTacticsInfo.New({ ship_id = slot1, exp = slot3 and 0, skill_id = slot3 and slot2, skill_exp = { { exp = 0, skill_id = slot2 } } }) end slot4:printInfo() end slot0.requestMetaTacticsInfo = function (slot0, slot1, slot2) if #(slot1 or getProxy(BayProxy):getMetaShipIDList()) == 0 then return end if slot2 then slot0:sendNotification(GAME.TACTICS_EXP_META_INFO_REQUEST, { idList = slot3 }) elseif not slot0.metaTacticsInfoTable then slot0:sendNotification(GAME.TACTICS_EXP_META_INFO_REQUEST, { idList = slot3 }) end end slot0.getMetaTacticsInfoByShipID = function (slot0, slot1) if not slot0.metaTacticsInfoTable then return MetaTacticsInfo.New() end return slot0.metaTacticsInfoTable[slot1] or MetaTacticsInfo.New() end slot0.printAllMetaTacticsInfo = function (slot0) for slot4, slot5 in pairs(slot0.metaTacticsInfoTable) do slot5:printInfo() end end slot0.setMetaTacticsInfoOnStart = function (slot0) if slot0.startRecordTag then return end slot1 = true if slot0.metaTacticsInfoTable then for slot5, slot6 in pairs(slot0.metaTacticsInfoTable) do if slot6 then slot1 = false break end end end if slot0.metaTacticsInfoTable and not slot1 then slot0.metaTacticsInfoTableOnStart = Clone(slot0.metaTacticsInfoTable) slot0.startRecordTag = true end end slot0.getMetaTacticsInfoOnEnd = function (slot0) if not slot0.metaTacticsInfoTableOnStart then return false end slot1 = {} slot3 = slot0.metaTacticsInfoTableOnStart for slot7, slot8 in pairs(slot2) do slot12 = slot2[slot8.shipID]:isAnyLearning() and slot3[slot8.shipID] or MetaTacticsInfo.New():isAnyLearning() slot13 = getProxy(BayProxy):getShipById(slot9):isAllMetaSkillLevelMax() slot14 = ((slot3[slot8.shipID] or MetaTacticsInfo.New()) and slot3[slot8.shipID] or MetaTacticsInfo.New():isExpMaxPerDay()) or false if slot12 and not slot13 and not slot14 then slot18 = slot10.curDayExp - slot11.curDayExp > 0 and getProxy(BayProxy):getShipById(slot9):isSkillLevelMax(slot10.curSkillID) slot19 = slot10:isExpMaxPerDay() slot20 = slot11.curDayExp / pg.gameset.meta_skill_exp_max.key_value slot21 = slot10.curDayExp / pg.gameset.meta_skill_exp_max.key_value if slot16 > 0 then table.insert(slot1, { shipID = slot9, addDayExp = slot16, isUpLevel = slot18, isMaxLevel = slot17, isExpMax = slot19, progressOld = slot20, progressNew = slot21 }) end end end slot0:clearMetaTacticsInfoRecord() return slot1 end slot0.clearMetaTacticsInfoRecord = function (slot0) slot0.metaTacticsInfoTableOnStart = nil slot0.startRecordTag = false end slot0.setMetaSkillLevelMaxInfo = function (slot0, slot1, slot2) slot6 = slot2.skill_exp slot7 = slot2.day_exp slot8 = slot2.add_exp slot12 = getProxy(BayProxy):getShipById(slot3).getMetaSkillLevelBySkillID(slot9, slot2.skill_id) < slot2.skill_level slot13 = pg.skill_data_template[slot2.skill_id].max_level <= slot5 if slot12 and slot13 then slot14 = { metaShipVO = slot9, metaSkillID = slot4 } slot15 = false for slot19, slot20 in pairs(slot1) do if slot20.metaShipVO.configId == slot14.metaShipVO.configId then slot15 = true break end end if not slot15 then table.insert(slot1, slot14) end end end slot0.getMetaSkillLevelMaxInfoList = function (slot0) return slot0.metaSkillLevelMaxInfoList or {} end slot0.clearMetaSkillLevelMaxInfoList = function (slot0) slot0.metaSkillLevelMaxInfoList = nil end slot0.tryRemoveMetaSkillLevelMaxInfo = function (slot0, slot1, slot2) if slot0.metaSkillLevelMaxInfoList and #slot0.metaSkillLevelMaxInfoList > 0 then slot3 = nil for slot7, slot8 in ipairs(slot0.metaSkillLevelMaxInfoList) do slot11 = slot8.metaShipVO.metaSkillID if slot1 == slot8.metaShipVO.id and slot2 ~= slot11 then slot3 = slot7 break end end if slot3 then table.remove(slot0.metaSkillLevelMaxInfoList, slot3) end end end slot0.setLastMetaSkillExpInfo = function (slot0, slot1, slot2) slot6 = slot2.skill_exp table.insert(slot1, { shipID = slot3, addDayExp = slot2.add_exp, isUpLevel = getProxy(BayProxy):getShipById(slot3).getMetaSkillLevelBySkillID(slot9, slot2.skill_id) < slot2.skill_level, isMaxLevel = pg.skill_data_template[slot2.skill_id].max_level <= slot5, isExpMax = pg.gameset.meta_skill_exp_max.key_value <= slot2.day_exp, progress = slot2.day_exp / pg.gameset.meta_skill_exp_max.key_value }) end slot0.getLastMetaSkillExpInfoList = function (slot0) return slot0.lastMetaSkillExpInfoList or {} end slot0.clearLastMetaSkillExpInfoList = function (slot0) slot0.lastMetaSkillExpInfoList = nil end return slot0
local Players = game:GetService("Players") local RunService = game:GetService("RunService") local joinTimes = {} Players.PlayerAdded:Connect(function(player) joinTimes[player] = tick() end) Players.PlayerRemoving:Connect(function(player) joinTimes[player] = nil end) for _,player in pairs(Players:GetPlayers()) do joinTimes[player] = tick() end return function(timeRequirement,name,desc,badgeId) local joinTimes = {} -- function that returns true if a player has completed this objective local function queryComplete(server,player) return (joinTimes[player] ~= nil) and ((tick() - joinTimes[player]) > timeRequirement) end return { id = "SessionLength_"..timeRequirement, name = name, desc = desc, badgeId = badgeId, startListening = (function(server, awardBadge) print("Listening for",name) spawn(function() while true do for _,player in pairs(Players:GetPlayers()) do if not joinTimes[player] then joinTimes[player] = tick() end if queryComplete(server,player) then awardBadge(player) end end wait(0.3) end end) end), queryComplete = queryComplete, } end
function on_activate(parent, ability) local targets = parent:targets() local targeter = parent:create_targeter(ability) targeter:set_selection_radius(ability:range()) targeter:set_free_select(ability:range()) targeter:set_shape_object_size("9by9round") targeter:add_all_effectable(targets) targeter:invis_blocks_affected_points(true) targeter:activate() end function on_target_select(parent, ability, targets) local position = targets:selected_point() local anim = parent:create_particle_generator("particles/circle20", 1.0) anim:set_position(anim:param(position.x - 1.0), anim:param(position.y - 10.0)) anim:set_particle_size_dist(anim:fixed_dist(2.5), anim:fixed_dist(2.5)) anim:set_gen_rate(anim:param(0.0)) anim:set_initial_gen(400.0) anim:set_particle_position_dist(anim:dist_param(anim:uniform_dist(-1.5, 1.5), anim:fixed_dist(0.0)), anim:dist_param(anim:uniform_dist(0.0, 10.0), anim:fixed_dist(0.0))) anim:set_color(anim:param(1.0), anim:param(1.0), anim:param(1.0), anim:param(0.0, 1.0, -1.0)) anim:set_particle_duration_dist(anim:fixed_dist(1.0)) anim:activate() local anim = parent:create_particle_generator("particles/circle20", 2.0) anim:set_position(anim:param(position.x - 1.0), anim:param(position.y - 1.0)) anim:set_particle_size_dist(anim:fixed_dist(2.5), anim:fixed_dist(2.5)) anim:set_gen_rate(anim:param(0.0)) anim:set_initial_gen(500.0) anim:set_particle_position_dist(anim:dist_param(anim:angular_dist(0.0, 2 * math.pi, 0.0, 4.0))) anim:set_color(anim:param(1.0), anim:param(1.0), anim:param(1.0), anim:param(0.0, 0.5, -0.5)) anim:set_particle_duration_dist(anim:fixed_dist(2.0)) anim:activate() local targets = targets:to_table() for i = 1, #targets do attack_target(parent, ability, targets[i]) end ability:activate(parent) game:play_sfx("sfx/blessing2") end function attack_target(parent, ability, target) local stats = parent:stats() local min_dmg = 5 + stats.caster_level / 4 + stats.wisdom_bonus / 4 local max_dmg = 10 + stats.wisdom_bonus / 2 + stats.caster_level / 2 local hit = parent:special_attack(target, "Reflex", "Spell", min_dmg, max_dmg, 6, "Fire") local amount = -(20 + stats.wisdom_bonus) if hit:is_miss() then return elseif hit:is_graze() then amount = amount / 2 elseif hit:is_hit() then -- do nothing elseif hit:is_crit() then amount = amount * 1.5 end effect = target:create_effect(ability:name(), ability:duration()) effect:set_tag("blind") effect:add_num_bonus("melee_accuracy", amount) effect:add_num_bonus("ranged_accuracy", amount) effect:add_num_bonus("spell_accuracy", amount) local anim = target:create_particle_generator("particles/circle4") anim:set_moves_with_parent() anim:set_color(anim:param(0.0), anim:param(0.0), anim:param(0.0)) anim:set_position(anim:param(-0.5), anim:param(-1.5)) anim:set_particle_size_dist(anim:fixed_dist(0.5), anim:fixed_dist(0.5)) anim:set_gen_rate(anim:param(6.0)) anim:set_initial_gen(2.0) anim:set_particle_position_dist(anim:dist_param(anim:uniform_dist(-0.5, 0.5), anim:uniform_dist(-0.1, 0.1)), anim:dist_param(anim:fixed_dist(0.0), anim:uniform_dist(-1.0, -1.5))) anim:set_particle_duration_dist(anim:fixed_dist(1.0)) effect:add_anim(anim) effect:apply() end
-- Test case 4 with 1 object with a port and the port surrounded by blocking rectangle on 3 sides and connector on the other. So drawing a connector from the port will always create a jumping connector o1 = cnvobj:drawObj("RECT",{{x=200,y=300},{x=300,y=450}}) -- Now add a port to each object p1 = cnvobj:addPort(300,380,o1.id) -- Add the port visual rectangles cnvobj.grid.snapGrid = false o2 = cnvobj:drawObj("FILLEDRECT",{{x=300-3,y=380-3},{x=300+3,y=380+3}}) cnvobj.grid.snapGrid = true -- Group the port visuals with the objects cnvobj:groupObjects({o1,o2}) -- Now draw the connector cnvobj:drawConnector({ {start_x = 300,start_y=380,end_x=150,end_y=380}, }) -- Now draw the blocking rectangles o3 = cnvobj:drawObj("BLOCKINGRECT",2,{{x=250,y=300},{x=340,y=374}}) -- Misaligned to the grid by 4 (Grid is 10x10) in Demo project o4 = cnvobj:drawObj("BLOCKINGRECT",2,{{x=250,y=386},{x=340,y=460}}) -- Misaligned to the grid by 4 (Grid is 10x10) in Demo project o5 = cnvobj:drawObj("BLOCKINGRECT",2,{{x=310,y=320},{x=360,y=440}}) cnvobj:refresh()
--Automatically generated by SWGEmu Spawn Tool v0.12 loot editor. sith_shadow_encounter_datapad = { description = "", minimumLevel = 0, maximumLevel = 0, lootItems = { {itemTemplate = "waypoint_datapad", weight = 10000000} } } addLootGroupTemplate("sith_shadow_encounter_datapad", sith_shadow_encounter_datapad)
hsyncCache = { syncIdx = 0, callback = {}, } hsync = {} ---@private hsync.key = function() hsyncCache.syncIdx = hsyncCache.syncIdx + 1 return "syk" .. hsyncCache.syncIdx end ---@private hsync.mix = function(key, array) array = array or {} if (type(array) ~= "table") then array = {} end local data = table.merge({ key }, array) return string.implode("|", data) end ---@private hsync.call = function(key, callback, array) hsyncCache.callback[key] = callback return hsync.mix(key, array) end ---@private hsync.init = function() local trig = cj.CreateTrigger() hjapi.DzTriggerRegisterSyncData(trig, "hsync", false) cj.TriggerAddAction(trig, function() local syncData = hjapi.DzGetTriggerSyncData() syncData = string.explode("|", syncData) local key = syncData[1] if (type(hsyncCache.callback[key]) ~= "function") then return end table.remove(syncData, 1) local callbackData = { triggerPlayer = hjapi.DzGetTriggerSyncPlayer(), triggerKey = key, triggerData = syncData, } hsyncCache.callback[key](callbackData) end) end --- 发送执行一般消息同步操作 --- 与onSend配套,hsync.onSend 接数据 ---@param key string 自定义回调key ---@param array table<string> 支持string、number hsync.send = function(key, array) if (key == nil) then return end hjapi.DzSyncData("hsync", hsync.mix(key, array)) end --- [事件]注册一般消息同步操作 --- 与send配套,接 hsync.send ---@alias onHSync fun(syncData: {triggerPlayer:"触发玩家",triggerKey:"触发索引",triggerData:"数组数据"}):void ---@param key string 自定义回调key ---@param callback onHSync | "function(syncData) end" 同步响应回调 hsync.onSend = function(key, callback) key = key or hsync.key() hsync.call(key, callback) end
-- add lucky blocks if minetest.get_modpath("lucky_block") then lucky_block:add_blocks({ {"dro", {"protector:protect"}, 1}, {"dro", {"protector:protect_pvp"}, 1}, {"dro", {"protector:door_wood"}, 1}, {"dro", {"protector:door_steel"}, 1}, {"dro", {"protector:chest"}, 1}, {"exp"}, }) end
local M = {} function M.setup() local cmp = safe_require("luasnip") if not cmp then return end require("luasnip.loaders.from_vscode").lazy_load() end return M
local map = {} map = { image = "tutorial_3.png", load = false, pics = "blondy_warning.png", soundClear = "japanese_yes", {-- etage 1 { 1, 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1, 1 }, { 1, 1, 1, 1, 1, 1, 1, 1 } }, {-- etage 2 { "", "", "", "", "", "", "", "" }, { "", 1, 1, 1, 1, 1, 1, "" }, { "", 1, 1, 1, 1, 1, 1, "" }, { "", 1, 1, 1, 1, 1, 1, "" }, { "", 1, 1, 1, 1, 1, 1, "" }, { "", "", "", "" , "", "", "", "" } }, {-- etage 3 { "", "", "", "", "", "", "", "" }, { "", "", 1, 1, 1, 1, "", "" }, { "", "", 1, 1, 1, 1, "", "" }, { "", "", 1, 1, 1, 1, "", "" }, { "", "", 1, 1, 1, 1, "", "" }, { "", "", "", "" , "", "", "", "" } }, {-- etage 4 { "", "", "", "", "", "", "", "" }, { "", "", "", "", "", "", "", "" }, { "", "", "", 1, 1, "", "", "" }, { "", "", "", 1, 1, "", "", "" }, { "", "", "", "", "", "", "", "" }, { "", "", "", "" , "", "", "", "" } } } return map
return {'yuen'}
local class = require 'middleclass' local Vector = require 'Vector' local TankChassis = class('littletanks.TankChassis') function TankChassis:initialize() self.turretAttachmentPoint = Vector(0, 0) end function TankChassis:destroy() -- Nothing to do here (yet) end function TankChassis:update( timeDelta ) -- Nothing to do here (yet). end function TankChassis:draw() error('Missing implementation.') end function TankChassis:onTankRotation( angle ) -- Nothing to do here (yet). end return TankChassis
--- GENERATED CODE - DO NOT MODIFY -- Amazon Comprehend (comprehend-2017-11-27) local M = {} M.metadata = { api_version = "2017-11-27", json_version = "1.1", protocol = "json", checksum_format = "", endpoint_prefix = "comprehend", service_abbreviation = "", service_full_name = "Amazon Comprehend", signature_version = "v4", target_prefix = "Comprehend_20171127", timestamp_format = "", global_endpoint = "", uid = "comprehend-2017-11-27", } local keys = {} local asserts = {} keys.StopKeyPhrasesDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStopKeyPhrasesDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StopKeyPhrasesDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StopKeyPhrasesDetectionJobResponse[k], "StopKeyPhrasesDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StopKeyPhrasesDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>Either <code>STOP_REQUESTED</code> if the job is currently running, or <code>STOPPED</code> if the job was previously stopped with the <code>StopKeyPhrasesDetectionJob</code> operation.</p> -- * JobId [JobId] <p>The identifier of the key phrases detection job to stop.</p> -- @return StopKeyPhrasesDetectionJobResponse structure as a key-value pair table function M.StopKeyPhrasesDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StopKeyPhrasesDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStopKeyPhrasesDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectKeyPhrasesRequest = { ["LanguageCode"] = true, ["TextList"] = true, nil } function asserts.AssertBatchDetectKeyPhrasesRequest(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectKeyPhrasesRequest to be of type 'table'") assert(struct["TextList"], "Expected key TextList to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["TextList"] then asserts.AssertStringList(struct["TextList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectKeyPhrasesRequest[k], "BatchDetectKeyPhrasesRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectKeyPhrasesRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- * TextList [StringList] <p>A list containing the text of the input documents. The list can contain a maximum of 25 documents. Each document must contain fewer that 5,000 bytes of UTF-8 encoded characters.</p> -- Required key: TextList -- Required key: LanguageCode -- @return BatchDetectKeyPhrasesRequest structure as a key-value pair table function M.BatchDetectKeyPhrasesRequest(args) assert(args, "You must provide an argument table when creating BatchDetectKeyPhrasesRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["LanguageCode"] = args["LanguageCode"], ["TextList"] = args["TextList"], } asserts.AssertBatchDetectKeyPhrasesRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeSentimentDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertDescribeSentimentDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeSentimentDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.DescribeSentimentDetectionJobRequest[k], "DescribeSentimentDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeSentimentDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier that Amazon Comprehend generated for the job. The operation returns this identifier in its response.</p> -- Required key: JobId -- @return DescribeSentimentDetectionJobRequest structure as a key-value pair table function M.DescribeSentimentDetectionJobRequest(args) assert(args, "You must provide an argument table when creating DescribeSentimentDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertDescribeSentimentDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StopKeyPhrasesDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertStopKeyPhrasesDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StopKeyPhrasesDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StopKeyPhrasesDetectionJobRequest[k], "StopKeyPhrasesDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StopKeyPhrasesDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier of the key phrases detection job to stop.</p> -- Required key: JobId -- @return StopKeyPhrasesDetectionJobRequest structure as a key-value pair table function M.StopKeyPhrasesDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StopKeyPhrasesDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertStopKeyPhrasesDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.KeyPhrasesDetectionJobProperties = { ["InputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["LanguageCode"] = true, ["JobId"] = true, ["JobStatus"] = true, ["JobName"] = true, ["SubmitTime"] = true, ["OutputDataConfig"] = true, ["Message"] = true, ["EndTime"] = true, nil } function asserts.AssertKeyPhrasesDetectionJobProperties(struct) assert(struct) assert(type(struct) == "table", "Expected KeyPhrasesDetectionJobProperties to be of type 'table'") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["SubmitTime"] then asserts.AssertTimestamp(struct["SubmitTime"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end if struct["Message"] then asserts.AssertAnyLengthString(struct["Message"]) end if struct["EndTime"] then asserts.AssertTimestamp(struct["EndTime"]) end for k,_ in pairs(struct) do assert(keys.KeyPhrasesDetectionJobProperties[k], "KeyPhrasesDetectionJobProperties contains unknown key " .. tostring(k)) end end --- Create a structure of type KeyPhrasesDetectionJobProperties -- <p>Provides information about a key phrases detection job.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>The input data configuration that you supplied when you created the key phrases detection job.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) that gives Amazon Comprehend read access to your input data.</p> -- * LanguageCode [LanguageCode] <p>The language code of the input documents.</p> -- * JobId [JobId] <p>The identifier assigned to the key phrases detection job.</p> -- * JobStatus [JobStatus] <p>The current status of the key phrases detection job. If the status is <code>FAILED</code>, the <code>Message</code> field shows the reason for the failure.</p> -- * JobName [JobName] <p>The name that you assigned the key phrases detection job.</p> -- * SubmitTime [Timestamp] <p>The time that the key phrases detection job was submitted for processing.</p> -- * OutputDataConfig [OutputDataConfig] <p>The output data configuration that you supplied when you created the key phrases detection job.</p> -- * Message [AnyLengthString] <p>A description of the status of a job.</p> -- * EndTime [Timestamp] <p>The time that the key phrases detection job completed.</p> -- @return KeyPhrasesDetectionJobProperties structure as a key-value pair table function M.KeyPhrasesDetectionJobProperties(args) assert(args, "You must provide an argument table when creating KeyPhrasesDetectionJobProperties") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["LanguageCode"] = args["LanguageCode"], ["JobId"] = args["JobId"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], ["SubmitTime"] = args["SubmitTime"], ["OutputDataConfig"] = args["OutputDataConfig"], ["Message"] = args["Message"], ["EndTime"] = args["EndTime"], } asserts.AssertKeyPhrasesDetectionJobProperties(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectEntitiesRequest = { ["LanguageCode"] = true, ["TextList"] = true, nil } function asserts.AssertBatchDetectEntitiesRequest(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectEntitiesRequest to be of type 'table'") assert(struct["TextList"], "Expected key TextList to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["TextList"] then asserts.AssertStringList(struct["TextList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectEntitiesRequest[k], "BatchDetectEntitiesRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectEntitiesRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- * TextList [StringList] <p>A list containing the text of the input documents. The list can contain a maximum of 25 documents. Each document must contain fewer than 5,000 bytes of UTF-8 encoded characters.</p> -- Required key: TextList -- Required key: LanguageCode -- @return BatchDetectEntitiesRequest structure as a key-value pair table function M.BatchDetectEntitiesRequest(args) assert(args, "You must provide an argument table when creating BatchDetectEntitiesRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["LanguageCode"] = args["LanguageCode"], ["TextList"] = args["TextList"], } asserts.AssertBatchDetectEntitiesRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectDominantLanguageRequest = { ["Text"] = true, nil } function asserts.AssertDetectDominantLanguageRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DetectDominantLanguageRequest to be of type 'table'") assert(struct["Text"], "Expected key Text to exist in table") if struct["Text"] then asserts.AssertString(struct["Text"]) end for k,_ in pairs(struct) do assert(keys.DetectDominantLanguageRequest[k], "DetectDominantLanguageRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectDominantLanguageRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Text [String] <p>A UTF-8 text string. Each string should contain at least 20 characters and must contain fewer that 5,000 bytes of UTF-8 encoded characters.</p> -- Required key: Text -- @return DetectDominantLanguageRequest structure as a key-value pair table function M.DetectDominantLanguageRequest(args) assert(args, "You must provide an argument table when creating DetectDominantLanguageRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Text"] = args["Text"], } asserts.AssertDetectDominantLanguageRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListKeyPhrasesDetectionJobsResponse = { ["KeyPhrasesDetectionJobPropertiesList"] = true, ["NextToken"] = true, nil } function asserts.AssertListKeyPhrasesDetectionJobsResponse(struct) assert(struct) assert(type(struct) == "table", "Expected ListKeyPhrasesDetectionJobsResponse to be of type 'table'") if struct["KeyPhrasesDetectionJobPropertiesList"] then asserts.AssertKeyPhrasesDetectionJobPropertiesList(struct["KeyPhrasesDetectionJobPropertiesList"]) end if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end for k,_ in pairs(struct) do assert(keys.ListKeyPhrasesDetectionJobsResponse[k], "ListKeyPhrasesDetectionJobsResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type ListKeyPhrasesDetectionJobsResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * KeyPhrasesDetectionJobPropertiesList [KeyPhrasesDetectionJobPropertiesList] <p>A list containing the properties of each job that is returned.</p> -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- @return ListKeyPhrasesDetectionJobsResponse structure as a key-value pair table function M.ListKeyPhrasesDetectionJobsResponse(args) assert(args, "You must provide an argument table when creating ListKeyPhrasesDetectionJobsResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["KeyPhrasesDetectionJobPropertiesList"] = args["KeyPhrasesDetectionJobPropertiesList"], ["NextToken"] = args["NextToken"], } asserts.AssertListKeyPhrasesDetectionJobsResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListDominantLanguageDetectionJobsRequest = { ["Filter"] = true, ["NextToken"] = true, ["MaxResults"] = true, nil } function asserts.AssertListDominantLanguageDetectionJobsRequest(struct) assert(struct) assert(type(struct) == "table", "Expected ListDominantLanguageDetectionJobsRequest to be of type 'table'") if struct["Filter"] then asserts.AssertDominantLanguageDetectionJobFilter(struct["Filter"]) end if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end if struct["MaxResults"] then asserts.AssertMaxResultsInteger(struct["MaxResults"]) end for k,_ in pairs(struct) do assert(keys.ListDominantLanguageDetectionJobsRequest[k], "ListDominantLanguageDetectionJobsRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type ListDominantLanguageDetectionJobsRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Filter [DominantLanguageDetectionJobFilter] <p>Filters that jobs that are returned. You can filter jobs on their name, status, or the date and time that they were submitted. You can only set one filter at a time.</p> -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- * MaxResults [MaxResultsInteger] <p>The maximum number of results to return in each page. The default is 100.</p> -- @return ListDominantLanguageDetectionJobsRequest structure as a key-value pair table function M.ListDominantLanguageDetectionJobsRequest(args) assert(args, "You must provide an argument table when creating ListDominantLanguageDetectionJobsRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Filter"] = args["Filter"], ["NextToken"] = args["NextToken"], ["MaxResults"] = args["MaxResults"], } asserts.AssertListDominantLanguageDetectionJobsRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.KeyPhrase = { ["Text"] = true, ["Score"] = true, ["BeginOffset"] = true, ["EndOffset"] = true, nil } function asserts.AssertKeyPhrase(struct) assert(struct) assert(type(struct) == "table", "Expected KeyPhrase to be of type 'table'") if struct["Text"] then asserts.AssertString(struct["Text"]) end if struct["Score"] then asserts.AssertFloat(struct["Score"]) end if struct["BeginOffset"] then asserts.AssertInteger(struct["BeginOffset"]) end if struct["EndOffset"] then asserts.AssertInteger(struct["EndOffset"]) end for k,_ in pairs(struct) do assert(keys.KeyPhrase[k], "KeyPhrase contains unknown key " .. tostring(k)) end end --- Create a structure of type KeyPhrase -- <p>Describes a key noun phrase.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Text [String] <p>The text of a key noun phrase.</p> -- * Score [Float] <p>The level of confidence that Amazon Comprehend has in the accuracy of the detection.</p> -- * BeginOffset [Integer] <p>A character offset in the input text that shows where the key phrase begins (the first character is at position 0). The offset returns the position of each UTF-8 code point in the string. A <i>code point</i> is the abstract character from a particular graphical representation. For example, a multi-byte UTF-8 character maps to a single code point.</p> -- * EndOffset [Integer] <p>A character offset in the input text where the key phrase ends. The offset returns the position of each UTF-8 code point in the string. A <code>code point</code> is the abstract character from a particular graphical representation. For example, a multi-byte UTF-8 character maps to a single code point.</p> -- @return KeyPhrase structure as a key-value pair table function M.KeyPhrase(args) assert(args, "You must provide an argument table when creating KeyPhrase") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Text"] = args["Text"], ["Score"] = args["Score"], ["BeginOffset"] = args["BeginOffset"], ["EndOffset"] = args["EndOffset"], } asserts.AssertKeyPhrase(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectSentimentItemResult = { ["Index"] = true, ["Sentiment"] = true, ["SentimentScore"] = true, nil } function asserts.AssertBatchDetectSentimentItemResult(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectSentimentItemResult to be of type 'table'") if struct["Index"] then asserts.AssertInteger(struct["Index"]) end if struct["Sentiment"] then asserts.AssertSentimentType(struct["Sentiment"]) end if struct["SentimentScore"] then asserts.AssertSentimentScore(struct["SentimentScore"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectSentimentItemResult[k], "BatchDetectSentimentItemResult contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectSentimentItemResult -- <p>The result of calling the operation. The operation returns one object for each document that is successfully processed by the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Index [Integer] <p>The zero-based index of the document in the input list.</p> -- * Sentiment [SentimentType] <p>The sentiment detected in the document.</p> -- * SentimentScore [SentimentScore] <p>The level of confidence that Amazon Comprehend has in the accuracy of its sentiment detection.</p> -- @return BatchDetectSentimentItemResult structure as a key-value pair table function M.BatchDetectSentimentItemResult(args) assert(args, "You must provide an argument table when creating BatchDetectSentimentItemResult") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Index"] = args["Index"], ["Sentiment"] = args["Sentiment"], ["SentimentScore"] = args["SentimentScore"], } asserts.AssertBatchDetectSentimentItemResult(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectEntitiesRequest = { ["Text"] = true, ["LanguageCode"] = true, nil } function asserts.AssertDetectEntitiesRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DetectEntitiesRequest to be of type 'table'") assert(struct["Text"], "Expected key Text to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["Text"] then asserts.AssertString(struct["Text"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end for k,_ in pairs(struct) do assert(keys.DetectEntitiesRequest[k], "DetectEntitiesRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectEntitiesRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Text [String] <p>A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters.</p> -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- Required key: Text -- Required key: LanguageCode -- @return DetectEntitiesRequest structure as a key-value pair table function M.DetectEntitiesRequest(args) assert(args, "You must provide an argument table when creating DetectEntitiesRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Text"] = args["Text"], ["LanguageCode"] = args["LanguageCode"], } asserts.AssertDetectEntitiesRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DominantLanguageDetectionJobFilter = { ["SubmitTimeAfter"] = true, ["SubmitTimeBefore"] = true, ["JobStatus"] = true, ["JobName"] = true, nil } function asserts.AssertDominantLanguageDetectionJobFilter(struct) assert(struct) assert(type(struct) == "table", "Expected DominantLanguageDetectionJobFilter to be of type 'table'") if struct["SubmitTimeAfter"] then asserts.AssertTimestamp(struct["SubmitTimeAfter"]) end if struct["SubmitTimeBefore"] then asserts.AssertTimestamp(struct["SubmitTimeBefore"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end for k,_ in pairs(struct) do assert(keys.DominantLanguageDetectionJobFilter[k], "DominantLanguageDetectionJobFilter contains unknown key " .. tostring(k)) end end --- Create a structure of type DominantLanguageDetectionJobFilter -- <p>Provides information for filtering a list of dominant language detection jobs. For more information, see the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * SubmitTimeAfter [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.</p> -- * SubmitTimeBefore [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.</p> -- * JobStatus [JobStatus] <p>Filters the list of jobs based on job status. Returns only jobs with the specified status.</p> -- * JobName [JobName] <p>Filters on the name of the job.</p> -- @return DominantLanguageDetectionJobFilter structure as a key-value pair table function M.DominantLanguageDetectionJobFilter(args) assert(args, "You must provide an argument table when creating DominantLanguageDetectionJobFilter") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["SubmitTimeAfter"] = args["SubmitTimeAfter"], ["SubmitTimeBefore"] = args["SubmitTimeBefore"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], } asserts.AssertDominantLanguageDetectionJobFilter(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StopSentimentDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStopSentimentDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StopSentimentDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StopSentimentDetectionJobResponse[k], "StopSentimentDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StopSentimentDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>Either <code>STOP_REQUESTED</code> if the job is currently running, or <code>STOPPED</code> if the job was previously stopped with the <code>StopSentimentDetectionJob</code> operation.</p> -- * JobId [JobId] <p>The identifier of the sentiment detection job to stop.</p> -- @return StopSentimentDetectionJobResponse structure as a key-value pair table function M.StopSentimentDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StopSentimentDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStopSentimentDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeSentimentDetectionJobResponse = { ["SentimentDetectionJobProperties"] = true, nil } function asserts.AssertDescribeSentimentDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeSentimentDetectionJobResponse to be of type 'table'") if struct["SentimentDetectionJobProperties"] then asserts.AssertSentimentDetectionJobProperties(struct["SentimentDetectionJobProperties"]) end for k,_ in pairs(struct) do assert(keys.DescribeSentimentDetectionJobResponse[k], "DescribeSentimentDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeSentimentDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * SentimentDetectionJobProperties [SentimentDetectionJobProperties] <p>An object that contains the properties associated with a sentiment detection job.</p> -- @return DescribeSentimentDetectionJobResponse structure as a key-value pair table function M.DescribeSentimentDetectionJobResponse(args) assert(args, "You must provide an argument table when creating DescribeSentimentDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["SentimentDetectionJobProperties"] = args["SentimentDetectionJobProperties"], } asserts.AssertDescribeSentimentDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectDominantLanguageResponse = { ["ResultList"] = true, ["ErrorList"] = true, nil } function asserts.AssertBatchDetectDominantLanguageResponse(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectDominantLanguageResponse to be of type 'table'") assert(struct["ResultList"], "Expected key ResultList to exist in table") assert(struct["ErrorList"], "Expected key ErrorList to exist in table") if struct["ResultList"] then asserts.AssertListOfDetectDominantLanguageResult(struct["ResultList"]) end if struct["ErrorList"] then asserts.AssertBatchItemErrorList(struct["ErrorList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectDominantLanguageResponse[k], "BatchDetectDominantLanguageResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectDominantLanguageResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ResultList [ListOfDetectDominantLanguageResult] <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p> -- * ErrorList [BatchItemErrorList] <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p> -- Required key: ResultList -- Required key: ErrorList -- @return BatchDetectDominantLanguageResponse structure as a key-value pair table function M.BatchDetectDominantLanguageResponse(args) assert(args, "You must provide an argument table when creating BatchDetectDominantLanguageResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ResultList"] = args["ResultList"], ["ErrorList"] = args["ErrorList"], } asserts.AssertBatchDetectDominantLanguageResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.SentimentDetectionJobProperties = { ["InputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["LanguageCode"] = true, ["JobId"] = true, ["JobStatus"] = true, ["JobName"] = true, ["SubmitTime"] = true, ["OutputDataConfig"] = true, ["Message"] = true, ["EndTime"] = true, nil } function asserts.AssertSentimentDetectionJobProperties(struct) assert(struct) assert(type(struct) == "table", "Expected SentimentDetectionJobProperties to be of type 'table'") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["SubmitTime"] then asserts.AssertTimestamp(struct["SubmitTime"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end if struct["Message"] then asserts.AssertAnyLengthString(struct["Message"]) end if struct["EndTime"] then asserts.AssertTimestamp(struct["EndTime"]) end for k,_ in pairs(struct) do assert(keys.SentimentDetectionJobProperties[k], "SentimentDetectionJobProperties contains unknown key " .. tostring(k)) end end --- Create a structure of type SentimentDetectionJobProperties -- <p>Provides information about a sentiment detection job.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>The input data configuration that you supplied when you created the sentiment detection job.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) that gives Amazon Comprehend read access to your input data.</p> -- * LanguageCode [LanguageCode] <p>The language code of the input documents.</p> -- * JobId [JobId] <p>The identifier assigned to the sentiment detection job.</p> -- * JobStatus [JobStatus] <p>The current status of the sentiment detection job. If the status is <code>FAILED</code>, the <code>Messages</code> field shows the reason for the failure.</p> -- * JobName [JobName] <p>The name that you assigned to the sentiment detection job</p> -- * SubmitTime [Timestamp] <p>The time that the sentiment detection job was submitted for processing.</p> -- * OutputDataConfig [OutputDataConfig] <p>The output data configuration that you supplied when you created the sentiment detection job.</p> -- * Message [AnyLengthString] <p>A description of the status of a job.</p> -- * EndTime [Timestamp] <p>The time that the sentiment detection job ended.</p> -- @return SentimentDetectionJobProperties structure as a key-value pair table function M.SentimentDetectionJobProperties(args) assert(args, "You must provide an argument table when creating SentimentDetectionJobProperties") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["LanguageCode"] = args["LanguageCode"], ["JobId"] = args["JobId"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], ["SubmitTime"] = args["SubmitTime"], ["OutputDataConfig"] = args["OutputDataConfig"], ["Message"] = args["Message"], ["EndTime"] = args["EndTime"], } asserts.AssertSentimentDetectionJobProperties(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectSyntaxRequest = { ["LanguageCode"] = true, ["TextList"] = true, nil } function asserts.AssertBatchDetectSyntaxRequest(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectSyntaxRequest to be of type 'table'") assert(struct["TextList"], "Expected key TextList to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["LanguageCode"] then asserts.AssertSyntaxLanguageCode(struct["LanguageCode"]) end if struct["TextList"] then asserts.AssertStringList(struct["TextList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectSyntaxRequest[k], "BatchDetectSyntaxRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectSyntaxRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * LanguageCode [SyntaxLanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- * TextList [StringList] <p>A list containing the text of the input documents. The list can contain a maximum of 25 documents. Each document must contain fewer that 5,000 bytes of UTF-8 encoded characters.</p> -- Required key: TextList -- Required key: LanguageCode -- @return BatchDetectSyntaxRequest structure as a key-value pair table function M.BatchDetectSyntaxRequest(args) assert(args, "You must provide an argument table when creating BatchDetectSyntaxRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["LanguageCode"] = args["LanguageCode"], ["TextList"] = args["TextList"], } asserts.AssertBatchDetectSyntaxRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.KeyPhrasesDetectionJobFilter = { ["SubmitTimeAfter"] = true, ["SubmitTimeBefore"] = true, ["JobStatus"] = true, ["JobName"] = true, nil } function asserts.AssertKeyPhrasesDetectionJobFilter(struct) assert(struct) assert(type(struct) == "table", "Expected KeyPhrasesDetectionJobFilter to be of type 'table'") if struct["SubmitTimeAfter"] then asserts.AssertTimestamp(struct["SubmitTimeAfter"]) end if struct["SubmitTimeBefore"] then asserts.AssertTimestamp(struct["SubmitTimeBefore"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end for k,_ in pairs(struct) do assert(keys.KeyPhrasesDetectionJobFilter[k], "KeyPhrasesDetectionJobFilter contains unknown key " .. tostring(k)) end end --- Create a structure of type KeyPhrasesDetectionJobFilter -- <p>Provides information for filtering a list of dominant language detection jobs. For more information, see the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * SubmitTimeAfter [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.</p> -- * SubmitTimeBefore [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.</p> -- * JobStatus [JobStatus] <p>Filters the list of jobs based on job status. Returns only jobs with the specified status.</p> -- * JobName [JobName] <p>Filters on the name of the job.</p> -- @return KeyPhrasesDetectionJobFilter structure as a key-value pair table function M.KeyPhrasesDetectionJobFilter(args) assert(args, "You must provide an argument table when creating KeyPhrasesDetectionJobFilter") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["SubmitTimeAfter"] = args["SubmitTimeAfter"], ["SubmitTimeBefore"] = args["SubmitTimeBefore"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], } asserts.AssertKeyPhrasesDetectionJobFilter(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.SyntaxToken = { ["Text"] = true, ["EndOffset"] = true, ["BeginOffset"] = true, ["PartOfSpeech"] = true, ["TokenId"] = true, nil } function asserts.AssertSyntaxToken(struct) assert(struct) assert(type(struct) == "table", "Expected SyntaxToken to be of type 'table'") if struct["Text"] then asserts.AssertString(struct["Text"]) end if struct["EndOffset"] then asserts.AssertInteger(struct["EndOffset"]) end if struct["BeginOffset"] then asserts.AssertInteger(struct["BeginOffset"]) end if struct["PartOfSpeech"] then asserts.AssertPartOfSpeechTag(struct["PartOfSpeech"]) end if struct["TokenId"] then asserts.AssertInteger(struct["TokenId"]) end for k,_ in pairs(struct) do assert(keys.SyntaxToken[k], "SyntaxToken contains unknown key " .. tostring(k)) end end --- Create a structure of type SyntaxToken -- <p>Represents a work in the input text that was recognized and assigned a part of speech. There is one syntax token record for each word in the source text.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Text [String] <p>The word that was recognized in the source text.</p> -- * EndOffset [Integer] <p>The zero-based offset from the beginning of the source text to the last character in the word.</p> -- * BeginOffset [Integer] <p>The zero-based offset from the beginning of the source text to the first character in the word.</p> -- * PartOfSpeech [PartOfSpeechTag] <p>Provides the part of speech label and the confidence level that Amazon Comprehend has that the part of speech was correctly identified. For more information, see <a>how-syntax</a>.</p> -- * TokenId [Integer] <p>A unique identifier for a token.</p> -- @return SyntaxToken structure as a key-value pair table function M.SyntaxToken(args) assert(args, "You must provide an argument table when creating SyntaxToken") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Text"] = args["Text"], ["EndOffset"] = args["EndOffset"], ["BeginOffset"] = args["BeginOffset"], ["PartOfSpeech"] = args["PartOfSpeech"], ["TokenId"] = args["TokenId"], } asserts.AssertSyntaxToken(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DominantLanguage = { ["LanguageCode"] = true, ["Score"] = true, nil } function asserts.AssertDominantLanguage(struct) assert(struct) assert(type(struct) == "table", "Expected DominantLanguage to be of type 'table'") if struct["LanguageCode"] then asserts.AssertString(struct["LanguageCode"]) end if struct["Score"] then asserts.AssertFloat(struct["Score"]) end for k,_ in pairs(struct) do assert(keys.DominantLanguage[k], "DominantLanguage contains unknown key " .. tostring(k)) end end --- Create a structure of type DominantLanguage -- <p>Returns the code for the dominant language in the input text and the level of confidence that Amazon Comprehend has in the accuracy of the detection.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * LanguageCode [String] <p>The RFC 5646 language code for the dominant language. For more information about RFC 5646, see <a href="https://tools.ietf.org/html/rfc5646">Tags for Identifying Languages</a> on the <i>IETF Tools</i> web site.</p> -- * Score [Float] <p>The level of confidence that Amazon Comprehend has in the accuracy of the detection.</p> -- @return DominantLanguage structure as a key-value pair table function M.DominantLanguage(args) assert(args, "You must provide an argument table when creating DominantLanguage") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["LanguageCode"] = args["LanguageCode"], ["Score"] = args["Score"], } asserts.AssertDominantLanguage(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.Entity = { ["Text"] = true, ["Score"] = true, ["Type"] = true, ["BeginOffset"] = true, ["EndOffset"] = true, nil } function asserts.AssertEntity(struct) assert(struct) assert(type(struct) == "table", "Expected Entity to be of type 'table'") if struct["Text"] then asserts.AssertString(struct["Text"]) end if struct["Score"] then asserts.AssertFloat(struct["Score"]) end if struct["Type"] then asserts.AssertEntityType(struct["Type"]) end if struct["BeginOffset"] then asserts.AssertInteger(struct["BeginOffset"]) end if struct["EndOffset"] then asserts.AssertInteger(struct["EndOffset"]) end for k,_ in pairs(struct) do assert(keys.Entity[k], "Entity contains unknown key " .. tostring(k)) end end --- Create a structure of type Entity -- <p>Provides information about an entity. </p> <p> </p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Text [String] <p>The text of the entity.</p> -- * Score [Float] <p>The level of confidence that Amazon Comprehend has in the accuracy of the detection.</p> -- * Type [EntityType] <p>The entity's type.</p> -- * BeginOffset [Integer] <p>A character offset in the input text that shows where the entity begins (the first character is at position 0). The offset returns the position of each UTF-8 code point in the string. A <i>code point</i> is the abstract character from a particular graphical representation. For example, a multi-byte UTF-8 character maps to a single code point.</p> -- * EndOffset [Integer] <p>A character offset in the input text that shows where the entity ends. The offset returns the position of each UTF-8 code point in the string. A <i>code point</i> is the abstract character from a particular graphical representation. For example, a multi-byte UTF-8 character maps to a single code point. </p> -- @return Entity structure as a key-value pair table function M.Entity(args) assert(args, "You must provide an argument table when creating Entity") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Text"] = args["Text"], ["Score"] = args["Score"], ["Type"] = args["Type"], ["BeginOffset"] = args["BeginOffset"], ["EndOffset"] = args["EndOffset"], } asserts.AssertEntity(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectEntitiesResponse = { ["ResultList"] = true, ["ErrorList"] = true, nil } function asserts.AssertBatchDetectEntitiesResponse(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectEntitiesResponse to be of type 'table'") assert(struct["ResultList"], "Expected key ResultList to exist in table") assert(struct["ErrorList"], "Expected key ErrorList to exist in table") if struct["ResultList"] then asserts.AssertListOfDetectEntitiesResult(struct["ResultList"]) end if struct["ErrorList"] then asserts.AssertBatchItemErrorList(struct["ErrorList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectEntitiesResponse[k], "BatchDetectEntitiesResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectEntitiesResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ResultList [ListOfDetectEntitiesResult] <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p> -- * ErrorList [BatchItemErrorList] <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p> -- Required key: ResultList -- Required key: ErrorList -- @return BatchDetectEntitiesResponse structure as a key-value pair table function M.BatchDetectEntitiesResponse(args) assert(args, "You must provide an argument table when creating BatchDetectEntitiesResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ResultList"] = args["ResultList"], ["ErrorList"] = args["ErrorList"], } asserts.AssertBatchDetectEntitiesResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectSyntaxRequest = { ["Text"] = true, ["LanguageCode"] = true, nil } function asserts.AssertDetectSyntaxRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DetectSyntaxRequest to be of type 'table'") assert(struct["Text"], "Expected key Text to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["Text"] then asserts.AssertString(struct["Text"]) end if struct["LanguageCode"] then asserts.AssertSyntaxLanguageCode(struct["LanguageCode"]) end for k,_ in pairs(struct) do assert(keys.DetectSyntaxRequest[k], "DetectSyntaxRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectSyntaxRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Text [String] <p>A UTF-8 string. Each string must contain fewer that 5,000 bytes of UTF encoded characters.</p> -- * LanguageCode [SyntaxLanguageCode] <p>The language code of the input documents. You can specify English ("en") or Spanish ("es").</p> -- Required key: Text -- Required key: LanguageCode -- @return DetectSyntaxRequest structure as a key-value pair table function M.DetectSyntaxRequest(args) assert(args, "You must provide an argument table when creating DetectSyntaxRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Text"] = args["Text"], ["LanguageCode"] = args["LanguageCode"], } asserts.AssertDetectSyntaxRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartEntitiesDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStartEntitiesDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StartEntitiesDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StartEntitiesDetectionJobResponse[k], "StartEntitiesDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StartEntitiesDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>The status of the job. </p> <ul> <li> <p>SUBMITTED - The job has been received and is queued for processing.</p> </li> <li> <p>IN_PROGRESS - Amazon Comprehend is processing the job.</p> </li> <li> <p>COMPLETED - The job was successfully completed and the output is available.</p> </li> <li> <p>FAILED - The job did not complete. To get details, use the operation.</p> </li> </ul> -- * JobId [JobId] <p>The identifier generated for the job. To get the status of job, use this identifier with the operation.</p> -- @return StartEntitiesDetectionJobResponse structure as a key-value pair table function M.StartEntitiesDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StartEntitiesDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStartEntitiesDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectDominantLanguageResponse = { ["Languages"] = true, nil } function asserts.AssertDetectDominantLanguageResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DetectDominantLanguageResponse to be of type 'table'") if struct["Languages"] then asserts.AssertListOfDominantLanguages(struct["Languages"]) end for k,_ in pairs(struct) do assert(keys.DetectDominantLanguageResponse[k], "DetectDominantLanguageResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectDominantLanguageResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Languages [ListOfDominantLanguages] <p>The languages that Amazon Comprehend detected in the input text. For each language, the response returns the RFC 5646 language code and the level of confidence that Amazon Comprehend has in the accuracy of its inference. For more information about RFC 5646, see <a href="https://tools.ietf.org/html/rfc5646">Tags for Identifying Languages</a> on the <i>IETF Tools</i> web site.</p> -- @return DetectDominantLanguageResponse structure as a key-value pair table function M.DetectDominantLanguageResponse(args) assert(args, "You must provide an argument table when creating DetectDominantLanguageResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Languages"] = args["Languages"], } asserts.AssertDetectDominantLanguageResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartSentimentDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStartSentimentDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StartSentimentDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StartSentimentDetectionJobResponse[k], "StartSentimentDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StartSentimentDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>The status of the job. </p> <ul> <li> <p>SUBMITTED - The job has been received and is queued for processing.</p> </li> <li> <p>IN_PROGRESS - Amazon Comprehend is processing the job.</p> </li> <li> <p>COMPLETED - The job was successfully completed and the output is available.</p> </li> <li> <p>FAILED - The job did not complete. To get details, use the operation.</p> </li> </ul> -- * JobId [JobId] <p>The identifier generated for the job. To get the status of a job, use this identifier with the operation.</p> -- @return StartSentimentDetectionJobResponse structure as a key-value pair table function M.StartSentimentDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StartSentimentDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStartSentimentDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectSentimentResponse = { ["SentimentScore"] = true, ["Sentiment"] = true, nil } function asserts.AssertDetectSentimentResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DetectSentimentResponse to be of type 'table'") if struct["SentimentScore"] then asserts.AssertSentimentScore(struct["SentimentScore"]) end if struct["Sentiment"] then asserts.AssertSentimentType(struct["Sentiment"]) end for k,_ in pairs(struct) do assert(keys.DetectSentimentResponse[k], "DetectSentimentResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectSentimentResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * SentimentScore [SentimentScore] <p>An object that lists the sentiments, and their corresponding confidence levels.</p> -- * Sentiment [SentimentType] <p>The inferred sentiment that Amazon Comprehend has the highest level of confidence in.</p> -- @return DetectSentimentResponse structure as a key-value pair table function M.DetectSentimentResponse(args) assert(args, "You must provide an argument table when creating DetectSentimentResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["SentimentScore"] = args["SentimentScore"], ["Sentiment"] = args["Sentiment"], } asserts.AssertDetectSentimentResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectSentimentRequest = { ["LanguageCode"] = true, ["TextList"] = true, nil } function asserts.AssertBatchDetectSentimentRequest(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectSentimentRequest to be of type 'table'") assert(struct["TextList"], "Expected key TextList to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["TextList"] then asserts.AssertStringList(struct["TextList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectSentimentRequest[k], "BatchDetectSentimentRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectSentimentRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- * TextList [StringList] <p>A list containing the text of the input documents. The list can contain a maximum of 25 documents. Each document must contain fewer that 5,000 bytes of UTF-8 encoded characters.</p> -- Required key: TextList -- Required key: LanguageCode -- @return BatchDetectSentimentRequest structure as a key-value pair table function M.BatchDetectSentimentRequest(args) assert(args, "You must provide an argument table when creating BatchDetectSentimentRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["LanguageCode"] = args["LanguageCode"], ["TextList"] = args["TextList"], } asserts.AssertBatchDetectSentimentRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeKeyPhrasesDetectionJobResponse = { ["KeyPhrasesDetectionJobProperties"] = true, nil } function asserts.AssertDescribeKeyPhrasesDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeKeyPhrasesDetectionJobResponse to be of type 'table'") if struct["KeyPhrasesDetectionJobProperties"] then asserts.AssertKeyPhrasesDetectionJobProperties(struct["KeyPhrasesDetectionJobProperties"]) end for k,_ in pairs(struct) do assert(keys.DescribeKeyPhrasesDetectionJobResponse[k], "DescribeKeyPhrasesDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeKeyPhrasesDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * KeyPhrasesDetectionJobProperties [KeyPhrasesDetectionJobProperties] <p>An object that contains the properties associated with a key phrases detection job. </p> -- @return DescribeKeyPhrasesDetectionJobResponse structure as a key-value pair table function M.DescribeKeyPhrasesDetectionJobResponse(args) assert(args, "You must provide an argument table when creating DescribeKeyPhrasesDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["KeyPhrasesDetectionJobProperties"] = args["KeyPhrasesDetectionJobProperties"], } asserts.AssertDescribeKeyPhrasesDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListSentimentDetectionJobsResponse = { ["NextToken"] = true, ["SentimentDetectionJobPropertiesList"] = true, nil } function asserts.AssertListSentimentDetectionJobsResponse(struct) assert(struct) assert(type(struct) == "table", "Expected ListSentimentDetectionJobsResponse to be of type 'table'") if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end if struct["SentimentDetectionJobPropertiesList"] then asserts.AssertSentimentDetectionJobPropertiesList(struct["SentimentDetectionJobPropertiesList"]) end for k,_ in pairs(struct) do assert(keys.ListSentimentDetectionJobsResponse[k], "ListSentimentDetectionJobsResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type ListSentimentDetectionJobsResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- * SentimentDetectionJobPropertiesList [SentimentDetectionJobPropertiesList] <p>A list containing the properties of each job that is returned.</p> -- @return ListSentimentDetectionJobsResponse structure as a key-value pair table function M.ListSentimentDetectionJobsResponse(args) assert(args, "You must provide an argument table when creating ListSentimentDetectionJobsResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["NextToken"] = args["NextToken"], ["SentimentDetectionJobPropertiesList"] = args["SentimentDetectionJobPropertiesList"], } asserts.AssertListSentimentDetectionJobsResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartSentimentDetectionJobRequest = { ["InputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["LanguageCode"] = true, ["JobName"] = true, ["ClientRequestToken"] = true, ["OutputDataConfig"] = true, nil } function asserts.AssertStartSentimentDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StartSentimentDetectionJobRequest to be of type 'table'") assert(struct["InputDataConfig"], "Expected key InputDataConfig to exist in table") assert(struct["OutputDataConfig"], "Expected key OutputDataConfig to exist in table") assert(struct["DataAccessRoleArn"], "Expected key DataAccessRoleArn to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["ClientRequestToken"] then asserts.AssertClientRequestTokenString(struct["ClientRequestToken"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end for k,_ in pairs(struct) do assert(keys.StartSentimentDetectionJobRequest[k], "StartSentimentDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StartSentimentDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>Specifies the format and location of the input data for the job.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend read access to your input data. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions">https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions</a>.</p> -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- * JobName [JobName] <p>The identifier of the job.</p> -- * ClientRequestToken [ClientRequestTokenString] <p>A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.</p> -- * OutputDataConfig [OutputDataConfig] <p>Specifies where to send the output files. </p> -- Required key: InputDataConfig -- Required key: OutputDataConfig -- Required key: DataAccessRoleArn -- Required key: LanguageCode -- @return StartSentimentDetectionJobRequest structure as a key-value pair table function M.StartSentimentDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StartSentimentDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["LanguageCode"] = args["LanguageCode"], ["JobName"] = args["JobName"], ["ClientRequestToken"] = args["ClientRequestToken"], ["OutputDataConfig"] = args["OutputDataConfig"], } asserts.AssertStartSentimentDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeEntitiesDetectionJobResponse = { ["EntitiesDetectionJobProperties"] = true, nil } function asserts.AssertDescribeEntitiesDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeEntitiesDetectionJobResponse to be of type 'table'") if struct["EntitiesDetectionJobProperties"] then asserts.AssertEntitiesDetectionJobProperties(struct["EntitiesDetectionJobProperties"]) end for k,_ in pairs(struct) do assert(keys.DescribeEntitiesDetectionJobResponse[k], "DescribeEntitiesDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeEntitiesDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * EntitiesDetectionJobProperties [EntitiesDetectionJobProperties] <p>An object that contains the properties associated with an entities detection job.</p> -- @return DescribeEntitiesDetectionJobResponse structure as a key-value pair table function M.DescribeEntitiesDetectionJobResponse(args) assert(args, "You must provide an argument table when creating DescribeEntitiesDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["EntitiesDetectionJobProperties"] = args["EntitiesDetectionJobProperties"], } asserts.AssertDescribeEntitiesDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeDominantLanguageDetectionJobResponse = { ["DominantLanguageDetectionJobProperties"] = true, nil } function asserts.AssertDescribeDominantLanguageDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeDominantLanguageDetectionJobResponse to be of type 'table'") if struct["DominantLanguageDetectionJobProperties"] then asserts.AssertDominantLanguageDetectionJobProperties(struct["DominantLanguageDetectionJobProperties"]) end for k,_ in pairs(struct) do assert(keys.DescribeDominantLanguageDetectionJobResponse[k], "DescribeDominantLanguageDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeDominantLanguageDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * DominantLanguageDetectionJobProperties [DominantLanguageDetectionJobProperties] <p>An object that contains the properties associated with a dominant language detection job.</p> -- @return DescribeDominantLanguageDetectionJobResponse structure as a key-value pair table function M.DescribeDominantLanguageDetectionJobResponse(args) assert(args, "You must provide an argument table when creating DescribeDominantLanguageDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["DominantLanguageDetectionJobProperties"] = args["DominantLanguageDetectionJobProperties"], } asserts.AssertDescribeDominantLanguageDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartEntitiesDetectionJobRequest = { ["InputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["LanguageCode"] = true, ["JobName"] = true, ["ClientRequestToken"] = true, ["OutputDataConfig"] = true, nil } function asserts.AssertStartEntitiesDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StartEntitiesDetectionJobRequest to be of type 'table'") assert(struct["InputDataConfig"], "Expected key InputDataConfig to exist in table") assert(struct["OutputDataConfig"], "Expected key OutputDataConfig to exist in table") assert(struct["DataAccessRoleArn"], "Expected key DataAccessRoleArn to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["ClientRequestToken"] then asserts.AssertClientRequestTokenString(struct["ClientRequestToken"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end for k,_ in pairs(struct) do assert(keys.StartEntitiesDetectionJobRequest[k], "StartEntitiesDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StartEntitiesDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>Specifies the format and location of the input data for the job.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend read access to your input data. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions">https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions</a>.</p> -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- * JobName [JobName] <p>The identifier of the job.</p> -- * ClientRequestToken [ClientRequestTokenString] <p>A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.</p> -- * OutputDataConfig [OutputDataConfig] <p>Specifies where to send the output files.</p> -- Required key: InputDataConfig -- Required key: OutputDataConfig -- Required key: DataAccessRoleArn -- Required key: LanguageCode -- @return StartEntitiesDetectionJobRequest structure as a key-value pair table function M.StartEntitiesDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StartEntitiesDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["LanguageCode"] = args["LanguageCode"], ["JobName"] = args["JobName"], ["ClientRequestToken"] = args["ClientRequestToken"], ["OutputDataConfig"] = args["OutputDataConfig"], } asserts.AssertStartEntitiesDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListTopicsDetectionJobsResponse = { ["TopicsDetectionJobPropertiesList"] = true, ["NextToken"] = true, nil } function asserts.AssertListTopicsDetectionJobsResponse(struct) assert(struct) assert(type(struct) == "table", "Expected ListTopicsDetectionJobsResponse to be of type 'table'") if struct["TopicsDetectionJobPropertiesList"] then asserts.AssertTopicsDetectionJobPropertiesList(struct["TopicsDetectionJobPropertiesList"]) end if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end for k,_ in pairs(struct) do assert(keys.ListTopicsDetectionJobsResponse[k], "ListTopicsDetectionJobsResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type ListTopicsDetectionJobsResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * TopicsDetectionJobPropertiesList [TopicsDetectionJobPropertiesList] <p>A list containing the properties of each job that is returned.</p> -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- @return ListTopicsDetectionJobsResponse structure as a key-value pair table function M.ListTopicsDetectionJobsResponse(args) assert(args, "You must provide an argument table when creating ListTopicsDetectionJobsResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["TopicsDetectionJobPropertiesList"] = args["TopicsDetectionJobPropertiesList"], ["NextToken"] = args["NextToken"], } asserts.AssertListTopicsDetectionJobsResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListEntitiesDetectionJobsRequest = { ["Filter"] = true, ["NextToken"] = true, ["MaxResults"] = true, nil } function asserts.AssertListEntitiesDetectionJobsRequest(struct) assert(struct) assert(type(struct) == "table", "Expected ListEntitiesDetectionJobsRequest to be of type 'table'") if struct["Filter"] then asserts.AssertEntitiesDetectionJobFilter(struct["Filter"]) end if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end if struct["MaxResults"] then asserts.AssertMaxResultsInteger(struct["MaxResults"]) end for k,_ in pairs(struct) do assert(keys.ListEntitiesDetectionJobsRequest[k], "ListEntitiesDetectionJobsRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type ListEntitiesDetectionJobsRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Filter [EntitiesDetectionJobFilter] <p>Filters the jobs that are returned. You can filter jobs on their name, status, or the date and time that they were submitted. You can only set one filter at a time.</p> -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- * MaxResults [MaxResultsInteger] <p>The maximum number of results to return in each page. The default is 100.</p> -- @return ListEntitiesDetectionJobsRequest structure as a key-value pair table function M.ListEntitiesDetectionJobsRequest(args) assert(args, "You must provide an argument table when creating ListEntitiesDetectionJobsRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Filter"] = args["Filter"], ["NextToken"] = args["NextToken"], ["MaxResults"] = args["MaxResults"], } asserts.AssertListEntitiesDetectionJobsRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectKeyPhrasesResponse = { ["ResultList"] = true, ["ErrorList"] = true, nil } function asserts.AssertBatchDetectKeyPhrasesResponse(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectKeyPhrasesResponse to be of type 'table'") assert(struct["ResultList"], "Expected key ResultList to exist in table") assert(struct["ErrorList"], "Expected key ErrorList to exist in table") if struct["ResultList"] then asserts.AssertListOfDetectKeyPhrasesResult(struct["ResultList"]) end if struct["ErrorList"] then asserts.AssertBatchItemErrorList(struct["ErrorList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectKeyPhrasesResponse[k], "BatchDetectKeyPhrasesResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectKeyPhrasesResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ResultList [ListOfDetectKeyPhrasesResult] <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p> -- * ErrorList [BatchItemErrorList] <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p> -- Required key: ResultList -- Required key: ErrorList -- @return BatchDetectKeyPhrasesResponse structure as a key-value pair table function M.BatchDetectKeyPhrasesResponse(args) assert(args, "You must provide an argument table when creating BatchDetectKeyPhrasesResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ResultList"] = args["ResultList"], ["ErrorList"] = args["ErrorList"], } asserts.AssertBatchDetectKeyPhrasesResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StopDominantLanguageDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertStopDominantLanguageDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StopDominantLanguageDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StopDominantLanguageDetectionJobRequest[k], "StopDominantLanguageDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StopDominantLanguageDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier of the dominant language detection job to stop.</p> -- Required key: JobId -- @return StopDominantLanguageDetectionJobRequest structure as a key-value pair table function M.StopDominantLanguageDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StopDominantLanguageDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertStopDominantLanguageDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StopEntitiesDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStopEntitiesDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StopEntitiesDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StopEntitiesDetectionJobResponse[k], "StopEntitiesDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StopEntitiesDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>Either <code>STOP_REQUESTED</code> if the job is currently running, or <code>STOPPED</code> if the job was previously stopped with the <code>StopEntitiesDetectionJob</code> operation.</p> -- * JobId [JobId] <p>The identifier of the entities detection job to stop.</p> -- @return StopEntitiesDetectionJobResponse structure as a key-value pair table function M.StopEntitiesDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StopEntitiesDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStopEntitiesDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartKeyPhrasesDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStartKeyPhrasesDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StartKeyPhrasesDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StartKeyPhrasesDetectionJobResponse[k], "StartKeyPhrasesDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StartKeyPhrasesDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>The status of the job. </p> <ul> <li> <p>SUBMITTED - The job has been received and is queued for processing.</p> </li> <li> <p>IN_PROGRESS - Amazon Comprehend is processing the job.</p> </li> <li> <p>COMPLETED - The job was successfully completed and the output is available.</p> </li> <li> <p>FAILED - The job did not complete. To get details, use the operation.</p> </li> </ul> -- * JobId [JobId] <p>The identifier generated for the job. To get the status of a job, use this identifier with the operation.</p> -- @return StartKeyPhrasesDetectionJobResponse structure as a key-value pair table function M.StartKeyPhrasesDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StartKeyPhrasesDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStartKeyPhrasesDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartDominantLanguageDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStartDominantLanguageDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StartDominantLanguageDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StartDominantLanguageDetectionJobResponse[k], "StartDominantLanguageDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StartDominantLanguageDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>The status of the job. </p> <ul> <li> <p>SUBMITTED - The job has been received and is queued for processing.</p> </li> <li> <p>IN_PROGRESS - Amazon Comprehend is processing the job.</p> </li> <li> <p>COMPLETED - The job was successfully completed and the output is available.</p> </li> <li> <p>FAILED - The job did not complete. To get details, use the operation.</p> </li> </ul> -- * JobId [JobId] <p>The identifier generated for the job. To get the status of a job, use this identifier with the operation.</p> -- @return StartDominantLanguageDetectionJobResponse structure as a key-value pair table function M.StartDominantLanguageDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StartDominantLanguageDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStartDominantLanguageDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectEntitiesItemResult = { ["Index"] = true, ["Entities"] = true, nil } function asserts.AssertBatchDetectEntitiesItemResult(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectEntitiesItemResult to be of type 'table'") if struct["Index"] then asserts.AssertInteger(struct["Index"]) end if struct["Entities"] then asserts.AssertListOfEntities(struct["Entities"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectEntitiesItemResult[k], "BatchDetectEntitiesItemResult contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectEntitiesItemResult -- <p>The result of calling the operation. The operation returns one object for each document that is successfully processed by the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Index [Integer] <p>The zero-based index of the document in the input list.</p> -- * Entities [ListOfEntities] <p>One or more <a>Entity</a> objects, one for each entity detected in the document.</p> -- @return BatchDetectEntitiesItemResult structure as a key-value pair table function M.BatchDetectEntitiesItemResult(args) assert(args, "You must provide an argument table when creating BatchDetectEntitiesItemResult") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Index"] = args["Index"], ["Entities"] = args["Entities"], } asserts.AssertBatchDetectEntitiesItemResult(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeEntitiesDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertDescribeEntitiesDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeEntitiesDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.DescribeEntitiesDetectionJobRequest[k], "DescribeEntitiesDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeEntitiesDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier that Amazon Comprehend generated for the job. The operation returns this identifier in its response.</p> -- Required key: JobId -- @return DescribeEntitiesDetectionJobRequest structure as a key-value pair table function M.DescribeEntitiesDetectionJobRequest(args) assert(args, "You must provide an argument table when creating DescribeEntitiesDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertDescribeEntitiesDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.OutputDataConfig = { ["S3Uri"] = true, nil } function asserts.AssertOutputDataConfig(struct) assert(struct) assert(type(struct) == "table", "Expected OutputDataConfig to be of type 'table'") assert(struct["S3Uri"], "Expected key S3Uri to exist in table") if struct["S3Uri"] then asserts.AssertS3Uri(struct["S3Uri"]) end for k,_ in pairs(struct) do assert(keys.OutputDataConfig[k], "OutputDataConfig contains unknown key " .. tostring(k)) end end --- Create a structure of type OutputDataConfig -- <p>Provides configuration parameters for the output of topic detection jobs.</p> <p/> -- @param args Table with arguments in key-value form. -- Valid keys: -- * S3Uri [S3Uri] <p>When you use the <code>OutputDataConfig</code> object with asynchronous operations, you specify the Amazon S3 location where you want to write the output data. The URI must be in the same region as the API endpoint that you are calling. The location is used as the prefix for the actual location of the output file.</p> <p>When the topic detection job is finished, the service creates an output file in a directory specific to the job. The <code>S3Uri</code> field contains the location of the output file, called <code>output.tar.gz</code>. It is a compressed archive that contains the ouput of the operation.</p> -- Required key: S3Uri -- @return OutputDataConfig structure as a key-value pair table function M.OutputDataConfig(args) assert(args, "You must provide an argument table when creating OutputDataConfig") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["S3Uri"] = args["S3Uri"], } asserts.AssertOutputDataConfig(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListTopicsDetectionJobsRequest = { ["Filter"] = true, ["NextToken"] = true, ["MaxResults"] = true, nil } function asserts.AssertListTopicsDetectionJobsRequest(struct) assert(struct) assert(type(struct) == "table", "Expected ListTopicsDetectionJobsRequest to be of type 'table'") if struct["Filter"] then asserts.AssertTopicsDetectionJobFilter(struct["Filter"]) end if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end if struct["MaxResults"] then asserts.AssertMaxResultsInteger(struct["MaxResults"]) end for k,_ in pairs(struct) do assert(keys.ListTopicsDetectionJobsRequest[k], "ListTopicsDetectionJobsRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type ListTopicsDetectionJobsRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Filter [TopicsDetectionJobFilter] <p>Filters the jobs that are returned. Jobs can be filtered on their name, status, or the date and time that they were submitted. You can set only one filter at a time.</p> -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- * MaxResults [MaxResultsInteger] <p>The maximum number of results to return in each page. The default is 100.</p> -- @return ListTopicsDetectionJobsRequest structure as a key-value pair table function M.ListTopicsDetectionJobsRequest(args) assert(args, "You must provide an argument table when creating ListTopicsDetectionJobsRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Filter"] = args["Filter"], ["NextToken"] = args["NextToken"], ["MaxResults"] = args["MaxResults"], } asserts.AssertListTopicsDetectionJobsRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListDominantLanguageDetectionJobsResponse = { ["DominantLanguageDetectionJobPropertiesList"] = true, ["NextToken"] = true, nil } function asserts.AssertListDominantLanguageDetectionJobsResponse(struct) assert(struct) assert(type(struct) == "table", "Expected ListDominantLanguageDetectionJobsResponse to be of type 'table'") if struct["DominantLanguageDetectionJobPropertiesList"] then asserts.AssertDominantLanguageDetectionJobPropertiesList(struct["DominantLanguageDetectionJobPropertiesList"]) end if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end for k,_ in pairs(struct) do assert(keys.ListDominantLanguageDetectionJobsResponse[k], "ListDominantLanguageDetectionJobsResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type ListDominantLanguageDetectionJobsResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * DominantLanguageDetectionJobPropertiesList [DominantLanguageDetectionJobPropertiesList] <p>A list containing the properties of each job that is returned.</p> -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- @return ListDominantLanguageDetectionJobsResponse structure as a key-value pair table function M.ListDominantLanguageDetectionJobsResponse(args) assert(args, "You must provide an argument table when creating ListDominantLanguageDetectionJobsResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["DominantLanguageDetectionJobPropertiesList"] = args["DominantLanguageDetectionJobPropertiesList"], ["NextToken"] = args["NextToken"], } asserts.AssertListDominantLanguageDetectionJobsResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectSyntaxItemResult = { ["Index"] = true, ["SyntaxTokens"] = true, nil } function asserts.AssertBatchDetectSyntaxItemResult(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectSyntaxItemResult to be of type 'table'") if struct["Index"] then asserts.AssertInteger(struct["Index"]) end if struct["SyntaxTokens"] then asserts.AssertListOfSyntaxTokens(struct["SyntaxTokens"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectSyntaxItemResult[k], "BatchDetectSyntaxItemResult contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectSyntaxItemResult -- <p>The result of calling the operation. The operation returns one object that is successfully processed by the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Index [Integer] <p>The zero-based index of the document in the input list.</p> -- * SyntaxTokens [ListOfSyntaxTokens] <p>The syntax tokens for the words in the document, one token for each word.</p> -- @return BatchDetectSyntaxItemResult structure as a key-value pair table function M.BatchDetectSyntaxItemResult(args) assert(args, "You must provide an argument table when creating BatchDetectSyntaxItemResult") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Index"] = args["Index"], ["SyntaxTokens"] = args["SyntaxTokens"], } asserts.AssertBatchDetectSyntaxItemResult(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectDominantLanguageRequest = { ["TextList"] = true, nil } function asserts.AssertBatchDetectDominantLanguageRequest(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectDominantLanguageRequest to be of type 'table'") assert(struct["TextList"], "Expected key TextList to exist in table") if struct["TextList"] then asserts.AssertStringList(struct["TextList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectDominantLanguageRequest[k], "BatchDetectDominantLanguageRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectDominantLanguageRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * TextList [StringList] <p>A list containing the text of the input documents. The list can contain a maximum of 25 documents. Each document should contain at least 20 characters and must contain fewer than 5,000 bytes of UTF-8 encoded characters.</p> -- Required key: TextList -- @return BatchDetectDominantLanguageRequest structure as a key-value pair table function M.BatchDetectDominantLanguageRequest(args) assert(args, "You must provide an argument table when creating BatchDetectDominantLanguageRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["TextList"] = args["TextList"], } asserts.AssertBatchDetectDominantLanguageRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StopDominantLanguageDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStopDominantLanguageDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StopDominantLanguageDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StopDominantLanguageDetectionJobResponse[k], "StopDominantLanguageDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StopDominantLanguageDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>Either <code>STOP_REQUESTED</code> if the job is currently running, or <code>STOPPED</code> if the job was previously stopped with the <code>StopDominantLanguageDetectionJob</code> operation.</p> -- * JobId [JobId] <p>The identifier of the dominant language detection job to stop.</p> -- @return StopDominantLanguageDetectionJobResponse structure as a key-value pair table function M.StopDominantLanguageDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StopDominantLanguageDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStopDominantLanguageDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.TopicsDetectionJobFilter = { ["SubmitTimeAfter"] = true, ["SubmitTimeBefore"] = true, ["JobStatus"] = true, ["JobName"] = true, nil } function asserts.AssertTopicsDetectionJobFilter(struct) assert(struct) assert(type(struct) == "table", "Expected TopicsDetectionJobFilter to be of type 'table'") if struct["SubmitTimeAfter"] then asserts.AssertTimestamp(struct["SubmitTimeAfter"]) end if struct["SubmitTimeBefore"] then asserts.AssertTimestamp(struct["SubmitTimeBefore"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end for k,_ in pairs(struct) do assert(keys.TopicsDetectionJobFilter[k], "TopicsDetectionJobFilter contains unknown key " .. tostring(k)) end end --- Create a structure of type TopicsDetectionJobFilter -- <p>Provides information for filtering topic detection jobs. For more information, see .</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * SubmitTimeAfter [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Only returns jobs submitted after the specified time. Jobs are returned in ascending order, oldest to newest.</p> -- * SubmitTimeBefore [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Only returns jobs submitted before the specified time. Jobs are returned in descending order, newest to oldest.</p> -- * JobStatus [JobStatus] <p>Filters the list of topic detection jobs based on job status. Returns only jobs with the specified status.</p> -- * JobName [JobName] <p/> -- @return TopicsDetectionJobFilter structure as a key-value pair table function M.TopicsDetectionJobFilter(args) assert(args, "You must provide an argument table when creating TopicsDetectionJobFilter") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["SubmitTimeAfter"] = args["SubmitTimeAfter"], ["SubmitTimeBefore"] = args["SubmitTimeBefore"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], } asserts.AssertTopicsDetectionJobFilter(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.EntitiesDetectionJobFilter = { ["SubmitTimeAfter"] = true, ["SubmitTimeBefore"] = true, ["JobStatus"] = true, ["JobName"] = true, nil } function asserts.AssertEntitiesDetectionJobFilter(struct) assert(struct) assert(type(struct) == "table", "Expected EntitiesDetectionJobFilter to be of type 'table'") if struct["SubmitTimeAfter"] then asserts.AssertTimestamp(struct["SubmitTimeAfter"]) end if struct["SubmitTimeBefore"] then asserts.AssertTimestamp(struct["SubmitTimeBefore"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end for k,_ in pairs(struct) do assert(keys.EntitiesDetectionJobFilter[k], "EntitiesDetectionJobFilter contains unknown key " .. tostring(k)) end end --- Create a structure of type EntitiesDetectionJobFilter -- <p>Provides information for filtering a list of dominant language detection jobs. For more information, see the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * SubmitTimeAfter [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.</p> -- * SubmitTimeBefore [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.</p> -- * JobStatus [JobStatus] <p>Filters the list of jobs based on job status. Returns only jobs with the specified status.</p> -- * JobName [JobName] <p>Filters on the name of the job.</p> -- @return EntitiesDetectionJobFilter structure as a key-value pair table function M.EntitiesDetectionJobFilter(args) assert(args, "You must provide an argument table when creating EntitiesDetectionJobFilter") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["SubmitTimeAfter"] = args["SubmitTimeAfter"], ["SubmitTimeBefore"] = args["SubmitTimeBefore"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], } asserts.AssertEntitiesDetectionJobFilter(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListEntitiesDetectionJobsResponse = { ["NextToken"] = true, ["EntitiesDetectionJobPropertiesList"] = true, nil } function asserts.AssertListEntitiesDetectionJobsResponse(struct) assert(struct) assert(type(struct) == "table", "Expected ListEntitiesDetectionJobsResponse to be of type 'table'") if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end if struct["EntitiesDetectionJobPropertiesList"] then asserts.AssertEntitiesDetectionJobPropertiesList(struct["EntitiesDetectionJobPropertiesList"]) end for k,_ in pairs(struct) do assert(keys.ListEntitiesDetectionJobsResponse[k], "ListEntitiesDetectionJobsResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type ListEntitiesDetectionJobsResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- * EntitiesDetectionJobPropertiesList [EntitiesDetectionJobPropertiesList] <p>A list containing the properties of each job that is returned.</p> -- @return ListEntitiesDetectionJobsResponse structure as a key-value pair table function M.ListEntitiesDetectionJobsResponse(args) assert(args, "You must provide an argument table when creating ListEntitiesDetectionJobsResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["NextToken"] = args["NextToken"], ["EntitiesDetectionJobPropertiesList"] = args["EntitiesDetectionJobPropertiesList"], } asserts.AssertListEntitiesDetectionJobsResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.PartOfSpeechTag = { ["Tag"] = true, ["Score"] = true, nil } function asserts.AssertPartOfSpeechTag(struct) assert(struct) assert(type(struct) == "table", "Expected PartOfSpeechTag to be of type 'table'") if struct["Tag"] then asserts.AssertPartOfSpeechTagType(struct["Tag"]) end if struct["Score"] then asserts.AssertFloat(struct["Score"]) end for k,_ in pairs(struct) do assert(keys.PartOfSpeechTag[k], "PartOfSpeechTag contains unknown key " .. tostring(k)) end end --- Create a structure of type PartOfSpeechTag -- <p>Identifies the part of speech represented by the token and gives the confidence that Amazon Comprehend has that the part of speech was correctly identified. For more information about the parts of speech that Amazon Comprehend can identify, see <a>how-syntax</a>.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Tag [PartOfSpeechTagType] <p>Identifies the part of speech that the token represents.</p> -- * Score [Float] <p>The confidence that Amazon Comprehend has that the part of speech was correctly identified.</p> -- @return PartOfSpeechTag structure as a key-value pair table function M.PartOfSpeechTag(args) assert(args, "You must provide an argument table when creating PartOfSpeechTag") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Tag"] = args["Tag"], ["Score"] = args["Score"], } asserts.AssertPartOfSpeechTag(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.InputDataConfig = { ["S3Uri"] = true, ["InputFormat"] = true, nil } function asserts.AssertInputDataConfig(struct) assert(struct) assert(type(struct) == "table", "Expected InputDataConfig to be of type 'table'") assert(struct["S3Uri"], "Expected key S3Uri to exist in table") if struct["S3Uri"] then asserts.AssertS3Uri(struct["S3Uri"]) end if struct["InputFormat"] then asserts.AssertInputFormat(struct["InputFormat"]) end for k,_ in pairs(struct) do assert(keys.InputDataConfig[k], "InputDataConfig contains unknown key " .. tostring(k)) end end --- Create a structure of type InputDataConfig -- <p>The input properties for a topic detection job.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * S3Uri [S3Uri] <p>The Amazon S3 URI for the input data. The URI must be in same region as the API endpoint that you are calling. The URI can point to a single input file or it can provide the prefix for a collection of data files. </p> <p>For example, if you use the URI <code>S3://bucketName/prefix</code>, if the prefix is a single file, Amazon Comprehend uses that file as input. If more than one file begins with the prefix, Amazon Comprehend uses all of them as input.</p> -- * InputFormat [InputFormat] <p>Specifies how the text in an input file should be processed:</p> <ul> <li> <p> <code>ONE_DOC_PER_FILE</code> - Each file is considered a separate document. Use this option when you are processing large documents, such as newspaper articles or scientific papers.</p> </li> <li> <p> <code>ONE_DOC_PER_LINE</code> - Each line in a file is considered a separate document. Use this option when you are processing many short documents, such as text messages.</p> </li> </ul> -- Required key: S3Uri -- @return InputDataConfig structure as a key-value pair table function M.InputDataConfig(args) assert(args, "You must provide an argument table when creating InputDataConfig") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["S3Uri"] = args["S3Uri"], ["InputFormat"] = args["InputFormat"], } asserts.AssertInputDataConfig(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeDominantLanguageDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertDescribeDominantLanguageDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeDominantLanguageDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.DescribeDominantLanguageDetectionJobRequest[k], "DescribeDominantLanguageDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeDominantLanguageDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier that Amazon Comprehend generated for the job. The operation returns this identifier in its response.</p> -- Required key: JobId -- @return DescribeDominantLanguageDetectionJobRequest structure as a key-value pair table function M.DescribeDominantLanguageDetectionJobRequest(args) assert(args, "You must provide an argument table when creating DescribeDominantLanguageDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertDescribeDominantLanguageDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectEntitiesResponse = { ["Entities"] = true, nil } function asserts.AssertDetectEntitiesResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DetectEntitiesResponse to be of type 'table'") if struct["Entities"] then asserts.AssertListOfEntities(struct["Entities"]) end for k,_ in pairs(struct) do assert(keys.DetectEntitiesResponse[k], "DetectEntitiesResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectEntitiesResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Entities [ListOfEntities] <p>A collection of entities identified in the input text. For each entity, the response provides the entity text, entity type, where the entity text begins and ends, and the level of confidence that Amazon Comprehend has in the detection. For a list of entity types, see <a>how-entities</a>. </p> -- @return DetectEntitiesResponse structure as a key-value pair table function M.DetectEntitiesResponse(args) assert(args, "You must provide an argument table when creating DetectEntitiesResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Entities"] = args["Entities"], } asserts.AssertDetectEntitiesResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.EntitiesDetectionJobProperties = { ["InputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["LanguageCode"] = true, ["JobId"] = true, ["JobStatus"] = true, ["JobName"] = true, ["SubmitTime"] = true, ["OutputDataConfig"] = true, ["Message"] = true, ["EndTime"] = true, nil } function asserts.AssertEntitiesDetectionJobProperties(struct) assert(struct) assert(type(struct) == "table", "Expected EntitiesDetectionJobProperties to be of type 'table'") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["SubmitTime"] then asserts.AssertTimestamp(struct["SubmitTime"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end if struct["Message"] then asserts.AssertAnyLengthString(struct["Message"]) end if struct["EndTime"] then asserts.AssertTimestamp(struct["EndTime"]) end for k,_ in pairs(struct) do assert(keys.EntitiesDetectionJobProperties[k], "EntitiesDetectionJobProperties contains unknown key " .. tostring(k)) end end --- Create a structure of type EntitiesDetectionJobProperties -- <p>Provides information about an entities detection job.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>The input data configuration that you supplied when you created the entities detection job.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) that gives Amazon Comprehend read access to your input data.</p> -- * LanguageCode [LanguageCode] <p>The language code of the input documents.</p> -- * JobId [JobId] <p>The identifier assigned to the entities detection job.</p> -- * JobStatus [JobStatus] <p>The current status of the entities detection job. If the status is <code>FAILED</code>, the <code>Message</code> field shows the reason for the failure.</p> -- * JobName [JobName] <p>The name that you assigned the entities detection job.</p> -- * SubmitTime [Timestamp] <p>The time that the entities detection job was submitted for processing.</p> -- * OutputDataConfig [OutputDataConfig] <p>The output data configuration that you supplied when you created the entities detection job. </p> -- * Message [AnyLengthString] <p>A description of the status of a job.</p> -- * EndTime [Timestamp] <p>The time that the entities detection job completed</p> -- @return EntitiesDetectionJobProperties structure as a key-value pair table function M.EntitiesDetectionJobProperties(args) assert(args, "You must provide an argument table when creating EntitiesDetectionJobProperties") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["LanguageCode"] = args["LanguageCode"], ["JobId"] = args["JobId"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], ["SubmitTime"] = args["SubmitTime"], ["OutputDataConfig"] = args["OutputDataConfig"], ["Message"] = args["Message"], ["EndTime"] = args["EndTime"], } asserts.AssertEntitiesDetectionJobProperties(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeKeyPhrasesDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertDescribeKeyPhrasesDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeKeyPhrasesDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.DescribeKeyPhrasesDetectionJobRequest[k], "DescribeKeyPhrasesDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeKeyPhrasesDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier that Amazon Comprehend generated for the job. The operation returns this identifier in its response.</p> -- Required key: JobId -- @return DescribeKeyPhrasesDetectionJobRequest structure as a key-value pair table function M.DescribeKeyPhrasesDetectionJobRequest(args) assert(args, "You must provide an argument table when creating DescribeKeyPhrasesDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertDescribeKeyPhrasesDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.TopicsDetectionJobProperties = { ["InputDataConfig"] = true, ["NumberOfTopics"] = true, ["JobId"] = true, ["JobStatus"] = true, ["JobName"] = true, ["SubmitTime"] = true, ["OutputDataConfig"] = true, ["Message"] = true, ["EndTime"] = true, nil } function asserts.AssertTopicsDetectionJobProperties(struct) assert(struct) assert(type(struct) == "table", "Expected TopicsDetectionJobProperties to be of type 'table'") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["NumberOfTopics"] then asserts.AssertInteger(struct["NumberOfTopics"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["SubmitTime"] then asserts.AssertTimestamp(struct["SubmitTime"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end if struct["Message"] then asserts.AssertAnyLengthString(struct["Message"]) end if struct["EndTime"] then asserts.AssertTimestamp(struct["EndTime"]) end for k,_ in pairs(struct) do assert(keys.TopicsDetectionJobProperties[k], "TopicsDetectionJobProperties contains unknown key " .. tostring(k)) end end --- Create a structure of type TopicsDetectionJobProperties -- <p>Provides information about a topic detection job.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>The input data configuration supplied when you created the topic detection job.</p> -- * NumberOfTopics [Integer] <p>The number of topics to detect supplied when you created the topic detection job. The default is 10. </p> -- * JobId [JobId] <p>The identifier assigned to the topic detection job.</p> -- * JobStatus [JobStatus] <p>The current status of the topic detection job. If the status is <code>Failed</code>, the reason for the failure is shown in the <code>Message</code> field.</p> -- * JobName [JobName] <p>The name of the topic detection job.</p> -- * SubmitTime [Timestamp] <p>The time that the topic detection job was submitted for processing.</p> -- * OutputDataConfig [OutputDataConfig] <p>The output data configuration supplied when you created the topic detection job.</p> -- * Message [AnyLengthString] <p>A description for the status of a job.</p> -- * EndTime [Timestamp] <p>The time that the topic detection job was completed.</p> -- @return TopicsDetectionJobProperties structure as a key-value pair table function M.TopicsDetectionJobProperties(args) assert(args, "You must provide an argument table when creating TopicsDetectionJobProperties") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["NumberOfTopics"] = args["NumberOfTopics"], ["JobId"] = args["JobId"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], ["SubmitTime"] = args["SubmitTime"], ["OutputDataConfig"] = args["OutputDataConfig"], ["Message"] = args["Message"], ["EndTime"] = args["EndTime"], } asserts.AssertTopicsDetectionJobProperties(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeTopicsDetectionJobResponse = { ["TopicsDetectionJobProperties"] = true, nil } function asserts.AssertDescribeTopicsDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeTopicsDetectionJobResponse to be of type 'table'") if struct["TopicsDetectionJobProperties"] then asserts.AssertTopicsDetectionJobProperties(struct["TopicsDetectionJobProperties"]) end for k,_ in pairs(struct) do assert(keys.DescribeTopicsDetectionJobResponse[k], "DescribeTopicsDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeTopicsDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * TopicsDetectionJobProperties [TopicsDetectionJobProperties] <p>The list of properties for the requested job.</p> -- @return DescribeTopicsDetectionJobResponse structure as a key-value pair table function M.DescribeTopicsDetectionJobResponse(args) assert(args, "You must provide an argument table when creating DescribeTopicsDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["TopicsDetectionJobProperties"] = args["TopicsDetectionJobProperties"], } asserts.AssertDescribeTopicsDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectKeyPhrasesItemResult = { ["Index"] = true, ["KeyPhrases"] = true, nil } function asserts.AssertBatchDetectKeyPhrasesItemResult(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectKeyPhrasesItemResult to be of type 'table'") if struct["Index"] then asserts.AssertInteger(struct["Index"]) end if struct["KeyPhrases"] then asserts.AssertListOfKeyPhrases(struct["KeyPhrases"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectKeyPhrasesItemResult[k], "BatchDetectKeyPhrasesItemResult contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectKeyPhrasesItemResult -- <p>The result of calling the operation. The operation returns one object for each document that is successfully processed by the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Index [Integer] <p>The zero-based index of the document in the input list.</p> -- * KeyPhrases [ListOfKeyPhrases] <p>One or more <a>KeyPhrase</a> objects, one for each key phrase detected in the document.</p> -- @return BatchDetectKeyPhrasesItemResult structure as a key-value pair table function M.BatchDetectKeyPhrasesItemResult(args) assert(args, "You must provide an argument table when creating BatchDetectKeyPhrasesItemResult") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Index"] = args["Index"], ["KeyPhrases"] = args["KeyPhrases"], } asserts.AssertBatchDetectKeyPhrasesItemResult(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartTopicsDetectionJobResponse = { ["JobStatus"] = true, ["JobId"] = true, nil } function asserts.AssertStartTopicsDetectionJobResponse(struct) assert(struct) assert(type(struct) == "table", "Expected StartTopicsDetectionJobResponse to be of type 'table'") if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StartTopicsDetectionJobResponse[k], "StartTopicsDetectionJobResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type StartTopicsDetectionJobResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobStatus [JobStatus] <p>The status of the job: </p> <ul> <li> <p>SUBMITTED - The job has been received and is queued for processing.</p> </li> <li> <p>IN_PROGRESS - Amazon Comprehend is processing the job.</p> </li> <li> <p>COMPLETED - The job was successfully completed and the output is available.</p> </li> <li> <p>FAILED - The job did not complete. To get details, use the <code>DescribeTopicDetectionJob</code> operation.</p> </li> </ul> -- * JobId [JobId] <p>The identifier generated for the job. To get the status of the job, use this identifier with the <code>DescribeTopicDetectionJob</code> operation.</p> -- @return StartTopicsDetectionJobResponse structure as a key-value pair table function M.StartTopicsDetectionJobResponse(args) assert(args, "You must provide an argument table when creating StartTopicsDetectionJobResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobStatus"] = args["JobStatus"], ["JobId"] = args["JobId"], } asserts.AssertStartTopicsDetectionJobResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartDominantLanguageDetectionJobRequest = { ["InputDataConfig"] = true, ["ClientRequestToken"] = true, ["OutputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["JobName"] = true, nil } function asserts.AssertStartDominantLanguageDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StartDominantLanguageDetectionJobRequest to be of type 'table'") assert(struct["InputDataConfig"], "Expected key InputDataConfig to exist in table") assert(struct["OutputDataConfig"], "Expected key OutputDataConfig to exist in table") assert(struct["DataAccessRoleArn"], "Expected key DataAccessRoleArn to exist in table") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["ClientRequestToken"] then asserts.AssertClientRequestTokenString(struct["ClientRequestToken"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end for k,_ in pairs(struct) do assert(keys.StartDominantLanguageDetectionJobRequest[k], "StartDominantLanguageDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StartDominantLanguageDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>Specifies the format and location of the input data for the job.</p> -- * ClientRequestToken [ClientRequestTokenString] <p>A unique identifier for the request. If you do not set the client request token, Amazon Comprehend generates one.</p> -- * OutputDataConfig [OutputDataConfig] <p>Specifies where to send the output files.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend read access to your input data. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions">https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions</a>.</p> -- * JobName [JobName] <p>An identifier for the job.</p> -- Required key: InputDataConfig -- Required key: OutputDataConfig -- Required key: DataAccessRoleArn -- @return StartDominantLanguageDetectionJobRequest structure as a key-value pair table function M.StartDominantLanguageDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StartDominantLanguageDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["ClientRequestToken"] = args["ClientRequestToken"], ["OutputDataConfig"] = args["OutputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["JobName"] = args["JobName"], } asserts.AssertStartDominantLanguageDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.SentimentDetectionJobFilter = { ["SubmitTimeAfter"] = true, ["SubmitTimeBefore"] = true, ["JobStatus"] = true, ["JobName"] = true, nil } function asserts.AssertSentimentDetectionJobFilter(struct) assert(struct) assert(type(struct) == "table", "Expected SentimentDetectionJobFilter to be of type 'table'") if struct["SubmitTimeAfter"] then asserts.AssertTimestamp(struct["SubmitTimeAfter"]) end if struct["SubmitTimeBefore"] then asserts.AssertTimestamp(struct["SubmitTimeBefore"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end for k,_ in pairs(struct) do assert(keys.SentimentDetectionJobFilter[k], "SentimentDetectionJobFilter contains unknown key " .. tostring(k)) end end --- Create a structure of type SentimentDetectionJobFilter -- <p>Provides information for filtering a list of dominant language detection jobs. For more information, see the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * SubmitTimeAfter [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted after the specified time. Jobs are returned in descending order, newest to oldest.</p> -- * SubmitTimeBefore [Timestamp] <p>Filters the list of jobs based on the time that the job was submitted for processing. Returns only jobs submitted before the specified time. Jobs are returned in ascending order, oldest to newest.</p> -- * JobStatus [JobStatus] <p>Filters the list of jobs based on job status. Returns only jobs with the specified status.</p> -- * JobName [JobName] <p>Filters on the name of the job.</p> -- @return SentimentDetectionJobFilter structure as a key-value pair table function M.SentimentDetectionJobFilter(args) assert(args, "You must provide an argument table when creating SentimentDetectionJobFilter") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["SubmitTimeAfter"] = args["SubmitTimeAfter"], ["SubmitTimeBefore"] = args["SubmitTimeBefore"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], } asserts.AssertSentimentDetectionJobFilter(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DescribeTopicsDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertDescribeTopicsDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DescribeTopicsDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.DescribeTopicsDetectionJobRequest[k], "DescribeTopicsDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DescribeTopicsDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier assigned by the user to the detection job.</p> -- Required key: JobId -- @return DescribeTopicsDetectionJobRequest structure as a key-value pair table function M.DescribeTopicsDetectionJobRequest(args) assert(args, "You must provide an argument table when creating DescribeTopicsDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertDescribeTopicsDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectSyntaxResponse = { ["ResultList"] = true, ["ErrorList"] = true, nil } function asserts.AssertBatchDetectSyntaxResponse(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectSyntaxResponse to be of type 'table'") assert(struct["ResultList"], "Expected key ResultList to exist in table") assert(struct["ErrorList"], "Expected key ErrorList to exist in table") if struct["ResultList"] then asserts.AssertListOfDetectSyntaxResult(struct["ResultList"]) end if struct["ErrorList"] then asserts.AssertBatchItemErrorList(struct["ErrorList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectSyntaxResponse[k], "BatchDetectSyntaxResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectSyntaxResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ResultList [ListOfDetectSyntaxResult] <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p> -- * ErrorList [BatchItemErrorList] <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p> -- Required key: ResultList -- Required key: ErrorList -- @return BatchDetectSyntaxResponse structure as a key-value pair table function M.BatchDetectSyntaxResponse(args) assert(args, "You must provide an argument table when creating BatchDetectSyntaxResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ResultList"] = args["ResultList"], ["ErrorList"] = args["ErrorList"], } asserts.AssertBatchDetectSyntaxResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartTopicsDetectionJobRequest = { ["InputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["NumberOfTopics"] = true, ["JobName"] = true, ["ClientRequestToken"] = true, ["OutputDataConfig"] = true, nil } function asserts.AssertStartTopicsDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StartTopicsDetectionJobRequest to be of type 'table'") assert(struct["InputDataConfig"], "Expected key InputDataConfig to exist in table") assert(struct["OutputDataConfig"], "Expected key OutputDataConfig to exist in table") assert(struct["DataAccessRoleArn"], "Expected key DataAccessRoleArn to exist in table") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["NumberOfTopics"] then asserts.AssertNumberOfTopicsInteger(struct["NumberOfTopics"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["ClientRequestToken"] then asserts.AssertClientRequestTokenString(struct["ClientRequestToken"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end for k,_ in pairs(struct) do assert(keys.StartTopicsDetectionJobRequest[k], "StartTopicsDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StartTopicsDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>Specifies the format and location of the input data for the job.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend read access to your input data. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions">https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions</a>.</p> -- * NumberOfTopics [NumberOfTopicsInteger] <p>The number of topics to detect.</p> -- * JobName [JobName] <p>The identifier of the job.</p> -- * ClientRequestToken [ClientRequestTokenString] <p>A unique identifier for the request. If you do not set the client request token, Amazon Comprehend generates one.</p> -- * OutputDataConfig [OutputDataConfig] <p>Specifies where to send the output files. The output is a compressed archive with two files, <code>topic-terms.csv</code> that lists the terms associated with each topic, and <code>doc-topics.csv</code> that lists the documents associated with each topic</p> -- Required key: InputDataConfig -- Required key: OutputDataConfig -- Required key: DataAccessRoleArn -- @return StartTopicsDetectionJobRequest structure as a key-value pair table function M.StartTopicsDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StartTopicsDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["NumberOfTopics"] = args["NumberOfTopics"], ["JobName"] = args["JobName"], ["ClientRequestToken"] = args["ClientRequestToken"], ["OutputDataConfig"] = args["OutputDataConfig"], } asserts.AssertStartTopicsDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectKeyPhrasesRequest = { ["Text"] = true, ["LanguageCode"] = true, nil } function asserts.AssertDetectKeyPhrasesRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DetectKeyPhrasesRequest to be of type 'table'") assert(struct["Text"], "Expected key Text to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["Text"] then asserts.AssertString(struct["Text"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end for k,_ in pairs(struct) do assert(keys.DetectKeyPhrasesRequest[k], "DetectKeyPhrasesRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectKeyPhrasesRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Text [String] <p>A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters.</p> -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- Required key: Text -- Required key: LanguageCode -- @return DetectKeyPhrasesRequest structure as a key-value pair table function M.DetectKeyPhrasesRequest(args) assert(args, "You must provide an argument table when creating DetectKeyPhrasesRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Text"] = args["Text"], ["LanguageCode"] = args["LanguageCode"], } asserts.AssertDetectKeyPhrasesRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StartKeyPhrasesDetectionJobRequest = { ["InputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["LanguageCode"] = true, ["JobName"] = true, ["ClientRequestToken"] = true, ["OutputDataConfig"] = true, nil } function asserts.AssertStartKeyPhrasesDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StartKeyPhrasesDetectionJobRequest to be of type 'table'") assert(struct["InputDataConfig"], "Expected key InputDataConfig to exist in table") assert(struct["OutputDataConfig"], "Expected key OutputDataConfig to exist in table") assert(struct["DataAccessRoleArn"], "Expected key DataAccessRoleArn to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["ClientRequestToken"] then asserts.AssertClientRequestTokenString(struct["ClientRequestToken"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end for k,_ in pairs(struct) do assert(keys.StartKeyPhrasesDetectionJobRequest[k], "StartKeyPhrasesDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StartKeyPhrasesDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>Specifies the format and location of the input data for the job.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) of the AWS Identity and Access Management (IAM) role that grants Amazon Comprehend read access to your input data. For more information, see <a href="https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions">https://docs.aws.amazon.com/comprehend/latest/dg/access-control-managing-permissions.html#auth-role-permissions</a>.</p> -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- * JobName [JobName] <p>The identifier of the job.</p> -- * ClientRequestToken [ClientRequestTokenString] <p>A unique identifier for the request. If you don't set the client request token, Amazon Comprehend generates one.</p> -- * OutputDataConfig [OutputDataConfig] <p>Specifies where to send the output files.</p> -- Required key: InputDataConfig -- Required key: OutputDataConfig -- Required key: DataAccessRoleArn -- Required key: LanguageCode -- @return StartKeyPhrasesDetectionJobRequest structure as a key-value pair table function M.StartKeyPhrasesDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StartKeyPhrasesDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["LanguageCode"] = args["LanguageCode"], ["JobName"] = args["JobName"], ["ClientRequestToken"] = args["ClientRequestToken"], ["OutputDataConfig"] = args["OutputDataConfig"], } asserts.AssertStartKeyPhrasesDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchItemError = { ["ErrorCode"] = true, ["Index"] = true, ["ErrorMessage"] = true, nil } function asserts.AssertBatchItemError(struct) assert(struct) assert(type(struct) == "table", "Expected BatchItemError to be of type 'table'") if struct["ErrorCode"] then asserts.AssertString(struct["ErrorCode"]) end if struct["Index"] then asserts.AssertInteger(struct["Index"]) end if struct["ErrorMessage"] then asserts.AssertString(struct["ErrorMessage"]) end for k,_ in pairs(struct) do assert(keys.BatchItemError[k], "BatchItemError contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchItemError -- <p>Describes an error that occurred while processing a document in a batch. The operation returns on <code>BatchItemError</code> object for each document that contained an error.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * ErrorCode [String] <p>The numeric error code of the error.</p> -- * Index [Integer] <p>The zero-based index of the document in the input list.</p> -- * ErrorMessage [String] <p>A text description of the error.</p> -- @return BatchItemError structure as a key-value pair table function M.BatchItemError(args) assert(args, "You must provide an argument table when creating BatchItemError") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ErrorCode"] = args["ErrorCode"], ["Index"] = args["Index"], ["ErrorMessage"] = args["ErrorMessage"], } asserts.AssertBatchItemError(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StopSentimentDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertStopSentimentDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StopSentimentDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StopSentimentDetectionJobRequest[k], "StopSentimentDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StopSentimentDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier of the sentiment detection job to stop.</p> -- Required key: JobId -- @return StopSentimentDetectionJobRequest structure as a key-value pair table function M.StopSentimentDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StopSentimentDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertStopSentimentDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.SentimentScore = { ["Mixed"] = true, ["Positive"] = true, ["Neutral"] = true, ["Negative"] = true, nil } function asserts.AssertSentimentScore(struct) assert(struct) assert(type(struct) == "table", "Expected SentimentScore to be of type 'table'") if struct["Mixed"] then asserts.AssertFloat(struct["Mixed"]) end if struct["Positive"] then asserts.AssertFloat(struct["Positive"]) end if struct["Neutral"] then asserts.AssertFloat(struct["Neutral"]) end if struct["Negative"] then asserts.AssertFloat(struct["Negative"]) end for k,_ in pairs(struct) do assert(keys.SentimentScore[k], "SentimentScore contains unknown key " .. tostring(k)) end end --- Create a structure of type SentimentScore -- <p>Describes the level of confidence that Amazon Comprehend has in the accuracy of its detection of sentiments.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Mixed [Float] <p>The level of confidence that Amazon Comprehend has in the accuracy of its detection of the <code>MIXED</code> sentiment.</p> -- * Positive [Float] <p>The level of confidence that Amazon Comprehend has in the accuracy of its detection of the <code>POSITIVE</code> sentiment.</p> -- * Neutral [Float] <p>The level of confidence that Amazon Comprehend has in the accuracy of its detection of the <code>NEUTRAL</code> sentiment.</p> -- * Negative [Float] <p>The level of confidence that Amazon Comprehend has in the accuracy of its detection of the <code>NEGATIVE</code> sentiment.</p> -- @return SentimentScore structure as a key-value pair table function M.SentimentScore(args) assert(args, "You must provide an argument table when creating SentimentScore") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Mixed"] = args["Mixed"], ["Positive"] = args["Positive"], ["Neutral"] = args["Neutral"], ["Negative"] = args["Negative"], } asserts.AssertSentimentScore(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectDominantLanguageItemResult = { ["Languages"] = true, ["Index"] = true, nil } function asserts.AssertBatchDetectDominantLanguageItemResult(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectDominantLanguageItemResult to be of type 'table'") if struct["Languages"] then asserts.AssertListOfDominantLanguages(struct["Languages"]) end if struct["Index"] then asserts.AssertInteger(struct["Index"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectDominantLanguageItemResult[k], "BatchDetectDominantLanguageItemResult contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectDominantLanguageItemResult -- <p>The result of calling the operation. The operation returns one object for each document that is successfully processed by the operation.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * Languages [ListOfDominantLanguages] <p>One or more <a>DominantLanguage</a> objects describing the dominant languages in the document.</p> -- * Index [Integer] <p>The zero-based index of the document in the input list.</p> -- @return BatchDetectDominantLanguageItemResult structure as a key-value pair table function M.BatchDetectDominantLanguageItemResult(args) assert(args, "You must provide an argument table when creating BatchDetectDominantLanguageItemResult") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Languages"] = args["Languages"], ["Index"] = args["Index"], } asserts.AssertBatchDetectDominantLanguageItemResult(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectSyntaxResponse = { ["SyntaxTokens"] = true, nil } function asserts.AssertDetectSyntaxResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DetectSyntaxResponse to be of type 'table'") if struct["SyntaxTokens"] then asserts.AssertListOfSyntaxTokens(struct["SyntaxTokens"]) end for k,_ in pairs(struct) do assert(keys.DetectSyntaxResponse[k], "DetectSyntaxResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectSyntaxResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * SyntaxTokens [ListOfSyntaxTokens] <p>A collection of syntax tokens describing the text. For each token, the response provides the text, the token type, where the text begins and ends, and the level of confidence that Amazon Comprehend has that the token is correct. For a list of token types, see <a>how-syntax</a>.</p> -- @return DetectSyntaxResponse structure as a key-value pair table function M.DetectSyntaxResponse(args) assert(args, "You must provide an argument table when creating DetectSyntaxResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["SyntaxTokens"] = args["SyntaxTokens"], } asserts.AssertDetectSyntaxResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectSentimentRequest = { ["Text"] = true, ["LanguageCode"] = true, nil } function asserts.AssertDetectSentimentRequest(struct) assert(struct) assert(type(struct) == "table", "Expected DetectSentimentRequest to be of type 'table'") assert(struct["Text"], "Expected key Text to exist in table") assert(struct["LanguageCode"], "Expected key LanguageCode to exist in table") if struct["Text"] then asserts.AssertString(struct["Text"]) end if struct["LanguageCode"] then asserts.AssertLanguageCode(struct["LanguageCode"]) end for k,_ in pairs(struct) do assert(keys.DetectSentimentRequest[k], "DetectSentimentRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectSentimentRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Text [String] <p>A UTF-8 text string. Each string must contain fewer that 5,000 bytes of UTF-8 encoded characters.</p> -- * LanguageCode [LanguageCode] <p>The language of the input documents. You can specify English ("en") or Spanish ("es"). All documents must be in the same language.</p> -- Required key: Text -- Required key: LanguageCode -- @return DetectSentimentRequest structure as a key-value pair table function M.DetectSentimentRequest(args) assert(args, "You must provide an argument table when creating DetectSentimentRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Text"] = args["Text"], ["LanguageCode"] = args["LanguageCode"], } asserts.AssertDetectSentimentRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListKeyPhrasesDetectionJobsRequest = { ["Filter"] = true, ["NextToken"] = true, ["MaxResults"] = true, nil } function asserts.AssertListKeyPhrasesDetectionJobsRequest(struct) assert(struct) assert(type(struct) == "table", "Expected ListKeyPhrasesDetectionJobsRequest to be of type 'table'") if struct["Filter"] then asserts.AssertKeyPhrasesDetectionJobFilter(struct["Filter"]) end if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end if struct["MaxResults"] then asserts.AssertMaxResultsInteger(struct["MaxResults"]) end for k,_ in pairs(struct) do assert(keys.ListKeyPhrasesDetectionJobsRequest[k], "ListKeyPhrasesDetectionJobsRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type ListKeyPhrasesDetectionJobsRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Filter [KeyPhrasesDetectionJobFilter] <p>Filters the jobs that are returned. You can filter jobs on their name, status, or the date and time that they were submitted. You can only set one filter at a time.</p> -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- * MaxResults [MaxResultsInteger] <p>The maximum number of results to return in each page. The default is 100.</p> -- @return ListKeyPhrasesDetectionJobsRequest structure as a key-value pair table function M.ListKeyPhrasesDetectionJobsRequest(args) assert(args, "You must provide an argument table when creating ListKeyPhrasesDetectionJobsRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Filter"] = args["Filter"], ["NextToken"] = args["NextToken"], ["MaxResults"] = args["MaxResults"], } asserts.AssertListKeyPhrasesDetectionJobsRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DominantLanguageDetectionJobProperties = { ["InputDataConfig"] = true, ["DataAccessRoleArn"] = true, ["JobId"] = true, ["JobStatus"] = true, ["JobName"] = true, ["SubmitTime"] = true, ["OutputDataConfig"] = true, ["Message"] = true, ["EndTime"] = true, nil } function asserts.AssertDominantLanguageDetectionJobProperties(struct) assert(struct) assert(type(struct) == "table", "Expected DominantLanguageDetectionJobProperties to be of type 'table'") if struct["InputDataConfig"] then asserts.AssertInputDataConfig(struct["InputDataConfig"]) end if struct["DataAccessRoleArn"] then asserts.AssertIamRoleArn(struct["DataAccessRoleArn"]) end if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end if struct["JobStatus"] then asserts.AssertJobStatus(struct["JobStatus"]) end if struct["JobName"] then asserts.AssertJobName(struct["JobName"]) end if struct["SubmitTime"] then asserts.AssertTimestamp(struct["SubmitTime"]) end if struct["OutputDataConfig"] then asserts.AssertOutputDataConfig(struct["OutputDataConfig"]) end if struct["Message"] then asserts.AssertAnyLengthString(struct["Message"]) end if struct["EndTime"] then asserts.AssertTimestamp(struct["EndTime"]) end for k,_ in pairs(struct) do assert(keys.DominantLanguageDetectionJobProperties[k], "DominantLanguageDetectionJobProperties contains unknown key " .. tostring(k)) end end --- Create a structure of type DominantLanguageDetectionJobProperties -- <p>Provides information about a dominant language detection job.</p> -- @param args Table with arguments in key-value form. -- Valid keys: -- * InputDataConfig [InputDataConfig] <p>The input data configuration that you supplied when you created the dominant language detection job.</p> -- * DataAccessRoleArn [IamRoleArn] <p>The Amazon Resource Name (ARN) that gives Amazon Comprehend read access to your input data.</p> -- * JobId [JobId] <p>The identifier assigned to the dominant language detection job.</p> -- * JobStatus [JobStatus] <p>The current status of the dominant language detection job. If the status is <code>FAILED</code>, the <code>Message</code> field shows the reason for the failure.</p> -- * JobName [JobName] <p>The name that you assigned to the dominant language detection job.</p> -- * SubmitTime [Timestamp] <p>The time that the dominant language detection job was submitted for processing.</p> -- * OutputDataConfig [OutputDataConfig] <p>The output data configuration that you supplied when you created the dominant language detection job.</p> -- * Message [AnyLengthString] <p>A description for the status of a job.</p> -- * EndTime [Timestamp] <p>The time that the dominant language detection job completed.</p> -- @return DominantLanguageDetectionJobProperties structure as a key-value pair table function M.DominantLanguageDetectionJobProperties(args) assert(args, "You must provide an argument table when creating DominantLanguageDetectionJobProperties") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["InputDataConfig"] = args["InputDataConfig"], ["DataAccessRoleArn"] = args["DataAccessRoleArn"], ["JobId"] = args["JobId"], ["JobStatus"] = args["JobStatus"], ["JobName"] = args["JobName"], ["SubmitTime"] = args["SubmitTime"], ["OutputDataConfig"] = args["OutputDataConfig"], ["Message"] = args["Message"], ["EndTime"] = args["EndTime"], } asserts.AssertDominantLanguageDetectionJobProperties(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.BatchDetectSentimentResponse = { ["ResultList"] = true, ["ErrorList"] = true, nil } function asserts.AssertBatchDetectSentimentResponse(struct) assert(struct) assert(type(struct) == "table", "Expected BatchDetectSentimentResponse to be of type 'table'") assert(struct["ResultList"], "Expected key ResultList to exist in table") assert(struct["ErrorList"], "Expected key ErrorList to exist in table") if struct["ResultList"] then asserts.AssertListOfDetectSentimentResult(struct["ResultList"]) end if struct["ErrorList"] then asserts.AssertBatchItemErrorList(struct["ErrorList"]) end for k,_ in pairs(struct) do assert(keys.BatchDetectSentimentResponse[k], "BatchDetectSentimentResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type BatchDetectSentimentResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * ResultList [ListOfDetectSentimentResult] <p>A list of objects containing the results of the operation. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If all of the documents contain an error, the <code>ResultList</code> is empty.</p> -- * ErrorList [BatchItemErrorList] <p>A list containing one object for each document that contained an error. The results are sorted in ascending order by the <code>Index</code> field and match the order of the documents in the input list. If there are no errors in the batch, the <code>ErrorList</code> is empty.</p> -- Required key: ResultList -- Required key: ErrorList -- @return BatchDetectSentimentResponse structure as a key-value pair table function M.BatchDetectSentimentResponse(args) assert(args, "You must provide an argument table when creating BatchDetectSentimentResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["ResultList"] = args["ResultList"], ["ErrorList"] = args["ErrorList"], } asserts.AssertBatchDetectSentimentResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.DetectKeyPhrasesResponse = { ["KeyPhrases"] = true, nil } function asserts.AssertDetectKeyPhrasesResponse(struct) assert(struct) assert(type(struct) == "table", "Expected DetectKeyPhrasesResponse to be of type 'table'") if struct["KeyPhrases"] then asserts.AssertListOfKeyPhrases(struct["KeyPhrases"]) end for k,_ in pairs(struct) do assert(keys.DetectKeyPhrasesResponse[k], "DetectKeyPhrasesResponse contains unknown key " .. tostring(k)) end end --- Create a structure of type DetectKeyPhrasesResponse -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * KeyPhrases [ListOfKeyPhrases] <p>A collection of key phrases that Amazon Comprehend identified in the input text. For each key phrase, the response provides the text of the key phrase, where the key phrase begins and ends, and the level of confidence that Amazon Comprehend has in the accuracy of the detection. </p> -- @return DetectKeyPhrasesResponse structure as a key-value pair table function M.DetectKeyPhrasesResponse(args) assert(args, "You must provide an argument table when creating DetectKeyPhrasesResponse") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["KeyPhrases"] = args["KeyPhrases"], } asserts.AssertDetectKeyPhrasesResponse(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.StopEntitiesDetectionJobRequest = { ["JobId"] = true, nil } function asserts.AssertStopEntitiesDetectionJobRequest(struct) assert(struct) assert(type(struct) == "table", "Expected StopEntitiesDetectionJobRequest to be of type 'table'") assert(struct["JobId"], "Expected key JobId to exist in table") if struct["JobId"] then asserts.AssertJobId(struct["JobId"]) end for k,_ in pairs(struct) do assert(keys.StopEntitiesDetectionJobRequest[k], "StopEntitiesDetectionJobRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type StopEntitiesDetectionJobRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * JobId [JobId] <p>The identifier of the entities detection job to stop.</p> -- Required key: JobId -- @return StopEntitiesDetectionJobRequest structure as a key-value pair table function M.StopEntitiesDetectionJobRequest(args) assert(args, "You must provide an argument table when creating StopEntitiesDetectionJobRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["JobId"] = args["JobId"], } asserts.AssertStopEntitiesDetectionJobRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end keys.ListSentimentDetectionJobsRequest = { ["Filter"] = true, ["NextToken"] = true, ["MaxResults"] = true, nil } function asserts.AssertListSentimentDetectionJobsRequest(struct) assert(struct) assert(type(struct) == "table", "Expected ListSentimentDetectionJobsRequest to be of type 'table'") if struct["Filter"] then asserts.AssertSentimentDetectionJobFilter(struct["Filter"]) end if struct["NextToken"] then asserts.AssertString(struct["NextToken"]) end if struct["MaxResults"] then asserts.AssertMaxResultsInteger(struct["MaxResults"]) end for k,_ in pairs(struct) do assert(keys.ListSentimentDetectionJobsRequest[k], "ListSentimentDetectionJobsRequest contains unknown key " .. tostring(k)) end end --- Create a structure of type ListSentimentDetectionJobsRequest -- -- @param args Table with arguments in key-value form. -- Valid keys: -- * Filter [SentimentDetectionJobFilter] <p>Filters the jobs that are returned. You can filter jobs on their name, status, or the date and time that they were submitted. You can only set one filter at a time.</p> -- * NextToken [String] <p>Identifies the next page of results to return.</p> -- * MaxResults [MaxResultsInteger] <p>The maximum number of results to return in each page. The default is 100.</p> -- @return ListSentimentDetectionJobsRequest structure as a key-value pair table function M.ListSentimentDetectionJobsRequest(args) assert(args, "You must provide an argument table when creating ListSentimentDetectionJobsRequest") local query_args = { } local uri_args = { } local header_args = { } local all_args = { ["Filter"] = args["Filter"], ["NextToken"] = args["NextToken"], ["MaxResults"] = args["MaxResults"], } asserts.AssertListSentimentDetectionJobsRequest(all_args) return { all = all_args, query = query_args, uri = uri_args, headers = header_args, } end function asserts.AssertLanguageCode(str) assert(str) assert(type(str) == "string", "Expected LanguageCode to be of type 'string'") end -- function M.LanguageCode(str) asserts.AssertLanguageCode(str) return str end function asserts.AssertPartOfSpeechTagType(str) assert(str) assert(type(str) == "string", "Expected PartOfSpeechTagType to be of type 'string'") end -- function M.PartOfSpeechTagType(str) asserts.AssertPartOfSpeechTagType(str) return str end function asserts.AssertClientRequestTokenString(str) assert(str) assert(type(str) == "string", "Expected ClientRequestTokenString to be of type 'string'") assert(#str <= 64, "Expected string to be max 64 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.ClientRequestTokenString(str) asserts.AssertClientRequestTokenString(str) return str end function asserts.AssertJobName(str) assert(str) assert(type(str) == "string", "Expected JobName to be of type 'string'") assert(#str <= 256, "Expected string to be max 256 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.JobName(str) asserts.AssertJobName(str) return str end function asserts.AssertJobId(str) assert(str) assert(type(str) == "string", "Expected JobId to be of type 'string'") assert(#str <= 32, "Expected string to be max 32 characters") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.JobId(str) asserts.AssertJobId(str) return str end function asserts.AssertSyntaxLanguageCode(str) assert(str) assert(type(str) == "string", "Expected SyntaxLanguageCode to be of type 'string'") end -- function M.SyntaxLanguageCode(str) asserts.AssertSyntaxLanguageCode(str) return str end function asserts.AssertJobStatus(str) assert(str) assert(type(str) == "string", "Expected JobStatus to be of type 'string'") end -- function M.JobStatus(str) asserts.AssertJobStatus(str) return str end function asserts.AssertInputFormat(str) assert(str) assert(type(str) == "string", "Expected InputFormat to be of type 'string'") end -- function M.InputFormat(str) asserts.AssertInputFormat(str) return str end function asserts.AssertIamRoleArn(str) assert(str) assert(type(str) == "string", "Expected IamRoleArn to be of type 'string'") end -- function M.IamRoleArn(str) asserts.AssertIamRoleArn(str) return str end function asserts.AssertString(str) assert(str) assert(type(str) == "string", "Expected String to be of type 'string'") assert(#str >= 1, "Expected string to be min 1 characters") end -- function M.String(str) asserts.AssertString(str) return str end function asserts.AssertAnyLengthString(str) assert(str) assert(type(str) == "string", "Expected AnyLengthString to be of type 'string'") end -- function M.AnyLengthString(str) asserts.AssertAnyLengthString(str) return str end function asserts.AssertSentimentType(str) assert(str) assert(type(str) == "string", "Expected SentimentType to be of type 'string'") end -- function M.SentimentType(str) asserts.AssertSentimentType(str) return str end function asserts.AssertEntityType(str) assert(str) assert(type(str) == "string", "Expected EntityType to be of type 'string'") end -- function M.EntityType(str) asserts.AssertEntityType(str) return str end function asserts.AssertS3Uri(str) assert(str) assert(type(str) == "string", "Expected S3Uri to be of type 'string'") assert(#str <= 1024, "Expected string to be max 1024 characters") end -- function M.S3Uri(str) asserts.AssertS3Uri(str) return str end function asserts.AssertFloat(float) assert(float) assert(type(float) == "number", "Expected Float to be of type 'number'") end function M.Float(float) asserts.AssertFloat(float) return float end function asserts.AssertInteger(integer) assert(integer) assert(type(integer) == "number", "Expected Integer to be of type 'number'") assert(integer % 1 == 0, "Expected a while integer number") end function M.Integer(integer) asserts.AssertInteger(integer) return integer end function asserts.AssertMaxResultsInteger(integer) assert(integer) assert(type(integer) == "number", "Expected MaxResultsInteger to be of type 'number'") assert(integer % 1 == 0, "Expected a while integer number") assert(integer <= 500, "Expected integer to be max 500") assert(integer >= 1, "Expected integer to be min 1") end function M.MaxResultsInteger(integer) asserts.AssertMaxResultsInteger(integer) return integer end function asserts.AssertNumberOfTopicsInteger(integer) assert(integer) assert(type(integer) == "number", "Expected NumberOfTopicsInteger to be of type 'number'") assert(integer % 1 == 0, "Expected a while integer number") assert(integer <= 100, "Expected integer to be max 100") assert(integer >= 1, "Expected integer to be min 1") end function M.NumberOfTopicsInteger(integer) asserts.AssertNumberOfTopicsInteger(integer) return integer end function asserts.AssertTimestamp(timestamp) assert(timestamp) assert(type(timestamp) == "string", "Expected Timestamp to be of type 'string'") end function M.Timestamp(timestamp) asserts.AssertTimestamp(timestamp) return timestamp end function asserts.AssertSentimentDetectionJobPropertiesList(list) assert(list) assert(type(list) == "table", "Expected SentimentDetectionJobPropertiesList to be of type ''table") for _,v in ipairs(list) do asserts.AssertSentimentDetectionJobProperties(v) end end -- -- List of SentimentDetectionJobProperties objects function M.SentimentDetectionJobPropertiesList(list) asserts.AssertSentimentDetectionJobPropertiesList(list) return list end function asserts.AssertListOfDetectDominantLanguageResult(list) assert(list) assert(type(list) == "table", "Expected ListOfDetectDominantLanguageResult to be of type ''table") for _,v in ipairs(list) do asserts.AssertBatchDetectDominantLanguageItemResult(v) end end -- -- List of BatchDetectDominantLanguageItemResult objects function M.ListOfDetectDominantLanguageResult(list) asserts.AssertListOfDetectDominantLanguageResult(list) return list end function asserts.AssertDominantLanguageDetectionJobPropertiesList(list) assert(list) assert(type(list) == "table", "Expected DominantLanguageDetectionJobPropertiesList to be of type ''table") for _,v in ipairs(list) do asserts.AssertDominantLanguageDetectionJobProperties(v) end end -- -- List of DominantLanguageDetectionJobProperties objects function M.DominantLanguageDetectionJobPropertiesList(list) asserts.AssertDominantLanguageDetectionJobPropertiesList(list) return list end function asserts.AssertBatchItemErrorList(list) assert(list) assert(type(list) == "table", "Expected BatchItemErrorList to be of type ''table") for _,v in ipairs(list) do asserts.AssertBatchItemError(v) end end -- -- List of BatchItemError objects function M.BatchItemErrorList(list) asserts.AssertBatchItemErrorList(list) return list end function asserts.AssertStringList(list) assert(list) assert(type(list) == "table", "Expected StringList to be of type ''table") for _,v in ipairs(list) do asserts.AssertString(v) end end -- -- List of String objects function M.StringList(list) asserts.AssertStringList(list) return list end function asserts.AssertListOfEntities(list) assert(list) assert(type(list) == "table", "Expected ListOfEntities to be of type ''table") for _,v in ipairs(list) do asserts.AssertEntity(v) end end -- -- List of Entity objects function M.ListOfEntities(list) asserts.AssertListOfEntities(list) return list end function asserts.AssertListOfDetectEntitiesResult(list) assert(list) assert(type(list) == "table", "Expected ListOfDetectEntitiesResult to be of type ''table") for _,v in ipairs(list) do asserts.AssertBatchDetectEntitiesItemResult(v) end end -- -- List of BatchDetectEntitiesItemResult objects function M.ListOfDetectEntitiesResult(list) asserts.AssertListOfDetectEntitiesResult(list) return list end function asserts.AssertEntitiesDetectionJobPropertiesList(list) assert(list) assert(type(list) == "table", "Expected EntitiesDetectionJobPropertiesList to be of type ''table") for _,v in ipairs(list) do asserts.AssertEntitiesDetectionJobProperties(v) end end -- -- List of EntitiesDetectionJobProperties objects function M.EntitiesDetectionJobPropertiesList(list) asserts.AssertEntitiesDetectionJobPropertiesList(list) return list end function asserts.AssertKeyPhrasesDetectionJobPropertiesList(list) assert(list) assert(type(list) == "table", "Expected KeyPhrasesDetectionJobPropertiesList to be of type ''table") for _,v in ipairs(list) do asserts.AssertKeyPhrasesDetectionJobProperties(v) end end -- -- List of KeyPhrasesDetectionJobProperties objects function M.KeyPhrasesDetectionJobPropertiesList(list) asserts.AssertKeyPhrasesDetectionJobPropertiesList(list) return list end function asserts.AssertListOfDetectSentimentResult(list) assert(list) assert(type(list) == "table", "Expected ListOfDetectSentimentResult to be of type ''table") for _,v in ipairs(list) do asserts.AssertBatchDetectSentimentItemResult(v) end end -- -- List of BatchDetectSentimentItemResult objects function M.ListOfDetectSentimentResult(list) asserts.AssertListOfDetectSentimentResult(list) return list end function asserts.AssertListOfKeyPhrases(list) assert(list) assert(type(list) == "table", "Expected ListOfKeyPhrases to be of type ''table") for _,v in ipairs(list) do asserts.AssertKeyPhrase(v) end end -- -- List of KeyPhrase objects function M.ListOfKeyPhrases(list) asserts.AssertListOfKeyPhrases(list) return list end function asserts.AssertListOfDetectKeyPhrasesResult(list) assert(list) assert(type(list) == "table", "Expected ListOfDetectKeyPhrasesResult to be of type ''table") for _,v in ipairs(list) do asserts.AssertBatchDetectKeyPhrasesItemResult(v) end end -- -- List of BatchDetectKeyPhrasesItemResult objects function M.ListOfDetectKeyPhrasesResult(list) asserts.AssertListOfDetectKeyPhrasesResult(list) return list end function asserts.AssertListOfDetectSyntaxResult(list) assert(list) assert(type(list) == "table", "Expected ListOfDetectSyntaxResult to be of type ''table") for _,v in ipairs(list) do asserts.AssertBatchDetectSyntaxItemResult(v) end end -- -- List of BatchDetectSyntaxItemResult objects function M.ListOfDetectSyntaxResult(list) asserts.AssertListOfDetectSyntaxResult(list) return list end function asserts.AssertListOfSyntaxTokens(list) assert(list) assert(type(list) == "table", "Expected ListOfSyntaxTokens to be of type ''table") for _,v in ipairs(list) do asserts.AssertSyntaxToken(v) end end -- -- List of SyntaxToken objects function M.ListOfSyntaxTokens(list) asserts.AssertListOfSyntaxTokens(list) return list end function asserts.AssertTopicsDetectionJobPropertiesList(list) assert(list) assert(type(list) == "table", "Expected TopicsDetectionJobPropertiesList to be of type ''table") for _,v in ipairs(list) do asserts.AssertTopicsDetectionJobProperties(v) end end -- -- List of TopicsDetectionJobProperties objects function M.TopicsDetectionJobPropertiesList(list) asserts.AssertTopicsDetectionJobPropertiesList(list) return list end function asserts.AssertListOfDominantLanguages(list) assert(list) assert(type(list) == "table", "Expected ListOfDominantLanguages to be of type ''table") for _,v in ipairs(list) do asserts.AssertDominantLanguage(v) end end -- -- List of DominantLanguage objects function M.ListOfDominantLanguages(list) asserts.AssertListOfDominantLanguages(list) return list end local content_type = require "aws-sdk.core.content_type" local request_headers = require "aws-sdk.core.request_headers" local request_handlers = require "aws-sdk.core.request_handlers" local settings = {} local function endpoint_for_region(region, use_dualstack) if not use_dualstack then if region == "us-east-1" then return "comprehend.amazonaws.com" end end local ss = { "comprehend" } if use_dualstack then ss[#ss + 1] = "dualstack" end ss[#ss + 1] = region ss[#ss + 1] = "amazonaws.com" if region == "cn-north-1" then ss[#ss + 1] = "cn" end return table.concat(ss, ".") end function M.init(config) assert(config, "You must provide a config table") assert(config.region, "You must provide a region in the config table") settings.service = M.metadata.endpoint_prefix settings.protocol = M.metadata.protocol settings.region = config.region settings.endpoint = config.endpoint_override or endpoint_for_region(config.region, config.use_dualstack) settings.signature_version = M.metadata.signature_version settings.uri = (config.scheme or "https") .. "://" .. settings.endpoint end -- -- OPERATIONS -- --- Call StopEntitiesDetectionJob asynchronously, invoking a callback when done -- @param StopEntitiesDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StopEntitiesDetectionJobAsync(StopEntitiesDetectionJobRequest, cb) assert(StopEntitiesDetectionJobRequest, "You must provide a StopEntitiesDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StopEntitiesDetectionJob", } for header,value in pairs(StopEntitiesDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StopEntitiesDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StopEntitiesDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StopEntitiesDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StopEntitiesDetectionJobSync(StopEntitiesDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StopEntitiesDetectionJobAsync(StopEntitiesDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DetectSyntax asynchronously, invoking a callback when done -- @param DetectSyntaxRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DetectSyntaxAsync(DetectSyntaxRequest, cb) assert(DetectSyntaxRequest, "You must provide a DetectSyntaxRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DetectSyntax", } for header,value in pairs(DetectSyntaxRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DetectSyntaxRequest, headers, settings, cb) else cb(false, err) end end --- Call DetectSyntax synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DetectSyntaxRequest -- @return response -- @return error_type -- @return error_message function M.DetectSyntaxSync(DetectSyntaxRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DetectSyntaxAsync(DetectSyntaxRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call StartDominantLanguageDetectionJob asynchronously, invoking a callback when done -- @param StartDominantLanguageDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StartDominantLanguageDetectionJobAsync(StartDominantLanguageDetectionJobRequest, cb) assert(StartDominantLanguageDetectionJobRequest, "You must provide a StartDominantLanguageDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StartDominantLanguageDetectionJob", } for header,value in pairs(StartDominantLanguageDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StartDominantLanguageDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StartDominantLanguageDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StartDominantLanguageDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StartDominantLanguageDetectionJobSync(StartDominantLanguageDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StartDominantLanguageDetectionJobAsync(StartDominantLanguageDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call ListKeyPhrasesDetectionJobs asynchronously, invoking a callback when done -- @param ListKeyPhrasesDetectionJobsRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.ListKeyPhrasesDetectionJobsAsync(ListKeyPhrasesDetectionJobsRequest, cb) assert(ListKeyPhrasesDetectionJobsRequest, "You must provide a ListKeyPhrasesDetectionJobsRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.ListKeyPhrasesDetectionJobs", } for header,value in pairs(ListKeyPhrasesDetectionJobsRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", ListKeyPhrasesDetectionJobsRequest, headers, settings, cb) else cb(false, err) end end --- Call ListKeyPhrasesDetectionJobs synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param ListKeyPhrasesDetectionJobsRequest -- @return response -- @return error_type -- @return error_message function M.ListKeyPhrasesDetectionJobsSync(ListKeyPhrasesDetectionJobsRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.ListKeyPhrasesDetectionJobsAsync(ListKeyPhrasesDetectionJobsRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call BatchDetectDominantLanguage asynchronously, invoking a callback when done -- @param BatchDetectDominantLanguageRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.BatchDetectDominantLanguageAsync(BatchDetectDominantLanguageRequest, cb) assert(BatchDetectDominantLanguageRequest, "You must provide a BatchDetectDominantLanguageRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.BatchDetectDominantLanguage", } for header,value in pairs(BatchDetectDominantLanguageRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", BatchDetectDominantLanguageRequest, headers, settings, cb) else cb(false, err) end end --- Call BatchDetectDominantLanguage synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param BatchDetectDominantLanguageRequest -- @return response -- @return error_type -- @return error_message function M.BatchDetectDominantLanguageSync(BatchDetectDominantLanguageRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.BatchDetectDominantLanguageAsync(BatchDetectDominantLanguageRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DescribeEntitiesDetectionJob asynchronously, invoking a callback when done -- @param DescribeEntitiesDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DescribeEntitiesDetectionJobAsync(DescribeEntitiesDetectionJobRequest, cb) assert(DescribeEntitiesDetectionJobRequest, "You must provide a DescribeEntitiesDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DescribeEntitiesDetectionJob", } for header,value in pairs(DescribeEntitiesDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DescribeEntitiesDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call DescribeEntitiesDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DescribeEntitiesDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.DescribeEntitiesDetectionJobSync(DescribeEntitiesDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DescribeEntitiesDetectionJobAsync(DescribeEntitiesDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call BatchDetectSentiment asynchronously, invoking a callback when done -- @param BatchDetectSentimentRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.BatchDetectSentimentAsync(BatchDetectSentimentRequest, cb) assert(BatchDetectSentimentRequest, "You must provide a BatchDetectSentimentRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.BatchDetectSentiment", } for header,value in pairs(BatchDetectSentimentRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", BatchDetectSentimentRequest, headers, settings, cb) else cb(false, err) end end --- Call BatchDetectSentiment synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param BatchDetectSentimentRequest -- @return response -- @return error_type -- @return error_message function M.BatchDetectSentimentSync(BatchDetectSentimentRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.BatchDetectSentimentAsync(BatchDetectSentimentRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call StopKeyPhrasesDetectionJob asynchronously, invoking a callback when done -- @param StopKeyPhrasesDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StopKeyPhrasesDetectionJobAsync(StopKeyPhrasesDetectionJobRequest, cb) assert(StopKeyPhrasesDetectionJobRequest, "You must provide a StopKeyPhrasesDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StopKeyPhrasesDetectionJob", } for header,value in pairs(StopKeyPhrasesDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StopKeyPhrasesDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StopKeyPhrasesDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StopKeyPhrasesDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StopKeyPhrasesDetectionJobSync(StopKeyPhrasesDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StopKeyPhrasesDetectionJobAsync(StopKeyPhrasesDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call StopDominantLanguageDetectionJob asynchronously, invoking a callback when done -- @param StopDominantLanguageDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StopDominantLanguageDetectionJobAsync(StopDominantLanguageDetectionJobRequest, cb) assert(StopDominantLanguageDetectionJobRequest, "You must provide a StopDominantLanguageDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StopDominantLanguageDetectionJob", } for header,value in pairs(StopDominantLanguageDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StopDominantLanguageDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StopDominantLanguageDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StopDominantLanguageDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StopDominantLanguageDetectionJobSync(StopDominantLanguageDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StopDominantLanguageDetectionJobAsync(StopDominantLanguageDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DetectEntities asynchronously, invoking a callback when done -- @param DetectEntitiesRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DetectEntitiesAsync(DetectEntitiesRequest, cb) assert(DetectEntitiesRequest, "You must provide a DetectEntitiesRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DetectEntities", } for header,value in pairs(DetectEntitiesRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DetectEntitiesRequest, headers, settings, cb) else cb(false, err) end end --- Call DetectEntities synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DetectEntitiesRequest -- @return response -- @return error_type -- @return error_message function M.DetectEntitiesSync(DetectEntitiesRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DetectEntitiesAsync(DetectEntitiesRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DescribeTopicsDetectionJob asynchronously, invoking a callback when done -- @param DescribeTopicsDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DescribeTopicsDetectionJobAsync(DescribeTopicsDetectionJobRequest, cb) assert(DescribeTopicsDetectionJobRequest, "You must provide a DescribeTopicsDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DescribeTopicsDetectionJob", } for header,value in pairs(DescribeTopicsDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DescribeTopicsDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call DescribeTopicsDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DescribeTopicsDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.DescribeTopicsDetectionJobSync(DescribeTopicsDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DescribeTopicsDetectionJobAsync(DescribeTopicsDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call ListEntitiesDetectionJobs asynchronously, invoking a callback when done -- @param ListEntitiesDetectionJobsRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.ListEntitiesDetectionJobsAsync(ListEntitiesDetectionJobsRequest, cb) assert(ListEntitiesDetectionJobsRequest, "You must provide a ListEntitiesDetectionJobsRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.ListEntitiesDetectionJobs", } for header,value in pairs(ListEntitiesDetectionJobsRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", ListEntitiesDetectionJobsRequest, headers, settings, cb) else cb(false, err) end end --- Call ListEntitiesDetectionJobs synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param ListEntitiesDetectionJobsRequest -- @return response -- @return error_type -- @return error_message function M.ListEntitiesDetectionJobsSync(ListEntitiesDetectionJobsRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.ListEntitiesDetectionJobsAsync(ListEntitiesDetectionJobsRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call StartEntitiesDetectionJob asynchronously, invoking a callback when done -- @param StartEntitiesDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StartEntitiesDetectionJobAsync(StartEntitiesDetectionJobRequest, cb) assert(StartEntitiesDetectionJobRequest, "You must provide a StartEntitiesDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StartEntitiesDetectionJob", } for header,value in pairs(StartEntitiesDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StartEntitiesDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StartEntitiesDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StartEntitiesDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StartEntitiesDetectionJobSync(StartEntitiesDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StartEntitiesDetectionJobAsync(StartEntitiesDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DetectSentiment asynchronously, invoking a callback when done -- @param DetectSentimentRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DetectSentimentAsync(DetectSentimentRequest, cb) assert(DetectSentimentRequest, "You must provide a DetectSentimentRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DetectSentiment", } for header,value in pairs(DetectSentimentRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DetectSentimentRequest, headers, settings, cb) else cb(false, err) end end --- Call DetectSentiment synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DetectSentimentRequest -- @return response -- @return error_type -- @return error_message function M.DetectSentimentSync(DetectSentimentRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DetectSentimentAsync(DetectSentimentRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DescribeSentimentDetectionJob asynchronously, invoking a callback when done -- @param DescribeSentimentDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DescribeSentimentDetectionJobAsync(DescribeSentimentDetectionJobRequest, cb) assert(DescribeSentimentDetectionJobRequest, "You must provide a DescribeSentimentDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DescribeSentimentDetectionJob", } for header,value in pairs(DescribeSentimentDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DescribeSentimentDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call DescribeSentimentDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DescribeSentimentDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.DescribeSentimentDetectionJobSync(DescribeSentimentDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DescribeSentimentDetectionJobAsync(DescribeSentimentDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call StartTopicsDetectionJob asynchronously, invoking a callback when done -- @param StartTopicsDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StartTopicsDetectionJobAsync(StartTopicsDetectionJobRequest, cb) assert(StartTopicsDetectionJobRequest, "You must provide a StartTopicsDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StartTopicsDetectionJob", } for header,value in pairs(StartTopicsDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StartTopicsDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StartTopicsDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StartTopicsDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StartTopicsDetectionJobSync(StartTopicsDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StartTopicsDetectionJobAsync(StartTopicsDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call ListTopicsDetectionJobs asynchronously, invoking a callback when done -- @param ListTopicsDetectionJobsRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.ListTopicsDetectionJobsAsync(ListTopicsDetectionJobsRequest, cb) assert(ListTopicsDetectionJobsRequest, "You must provide a ListTopicsDetectionJobsRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.ListTopicsDetectionJobs", } for header,value in pairs(ListTopicsDetectionJobsRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", ListTopicsDetectionJobsRequest, headers, settings, cb) else cb(false, err) end end --- Call ListTopicsDetectionJobs synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param ListTopicsDetectionJobsRequest -- @return response -- @return error_type -- @return error_message function M.ListTopicsDetectionJobsSync(ListTopicsDetectionJobsRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.ListTopicsDetectionJobsAsync(ListTopicsDetectionJobsRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DetectKeyPhrases asynchronously, invoking a callback when done -- @param DetectKeyPhrasesRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DetectKeyPhrasesAsync(DetectKeyPhrasesRequest, cb) assert(DetectKeyPhrasesRequest, "You must provide a DetectKeyPhrasesRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DetectKeyPhrases", } for header,value in pairs(DetectKeyPhrasesRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DetectKeyPhrasesRequest, headers, settings, cb) else cb(false, err) end end --- Call DetectKeyPhrases synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DetectKeyPhrasesRequest -- @return response -- @return error_type -- @return error_message function M.DetectKeyPhrasesSync(DetectKeyPhrasesRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DetectKeyPhrasesAsync(DetectKeyPhrasesRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call ListSentimentDetectionJobs asynchronously, invoking a callback when done -- @param ListSentimentDetectionJobsRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.ListSentimentDetectionJobsAsync(ListSentimentDetectionJobsRequest, cb) assert(ListSentimentDetectionJobsRequest, "You must provide a ListSentimentDetectionJobsRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.ListSentimentDetectionJobs", } for header,value in pairs(ListSentimentDetectionJobsRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", ListSentimentDetectionJobsRequest, headers, settings, cb) else cb(false, err) end end --- Call ListSentimentDetectionJobs synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param ListSentimentDetectionJobsRequest -- @return response -- @return error_type -- @return error_message function M.ListSentimentDetectionJobsSync(ListSentimentDetectionJobsRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.ListSentimentDetectionJobsAsync(ListSentimentDetectionJobsRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call StartSentimentDetectionJob asynchronously, invoking a callback when done -- @param StartSentimentDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StartSentimentDetectionJobAsync(StartSentimentDetectionJobRequest, cb) assert(StartSentimentDetectionJobRequest, "You must provide a StartSentimentDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StartSentimentDetectionJob", } for header,value in pairs(StartSentimentDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StartSentimentDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StartSentimentDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StartSentimentDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StartSentimentDetectionJobSync(StartSentimentDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StartSentimentDetectionJobAsync(StartSentimentDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DescribeKeyPhrasesDetectionJob asynchronously, invoking a callback when done -- @param DescribeKeyPhrasesDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DescribeKeyPhrasesDetectionJobAsync(DescribeKeyPhrasesDetectionJobRequest, cb) assert(DescribeKeyPhrasesDetectionJobRequest, "You must provide a DescribeKeyPhrasesDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DescribeKeyPhrasesDetectionJob", } for header,value in pairs(DescribeKeyPhrasesDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DescribeKeyPhrasesDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call DescribeKeyPhrasesDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DescribeKeyPhrasesDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.DescribeKeyPhrasesDetectionJobSync(DescribeKeyPhrasesDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DescribeKeyPhrasesDetectionJobAsync(DescribeKeyPhrasesDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DetectDominantLanguage asynchronously, invoking a callback when done -- @param DetectDominantLanguageRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DetectDominantLanguageAsync(DetectDominantLanguageRequest, cb) assert(DetectDominantLanguageRequest, "You must provide a DetectDominantLanguageRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DetectDominantLanguage", } for header,value in pairs(DetectDominantLanguageRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DetectDominantLanguageRequest, headers, settings, cb) else cb(false, err) end end --- Call DetectDominantLanguage synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DetectDominantLanguageRequest -- @return response -- @return error_type -- @return error_message function M.DetectDominantLanguageSync(DetectDominantLanguageRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DetectDominantLanguageAsync(DetectDominantLanguageRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call StartKeyPhrasesDetectionJob asynchronously, invoking a callback when done -- @param StartKeyPhrasesDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StartKeyPhrasesDetectionJobAsync(StartKeyPhrasesDetectionJobRequest, cb) assert(StartKeyPhrasesDetectionJobRequest, "You must provide a StartKeyPhrasesDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StartKeyPhrasesDetectionJob", } for header,value in pairs(StartKeyPhrasesDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StartKeyPhrasesDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StartKeyPhrasesDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StartKeyPhrasesDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StartKeyPhrasesDetectionJobSync(StartKeyPhrasesDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StartKeyPhrasesDetectionJobAsync(StartKeyPhrasesDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call BatchDetectSyntax asynchronously, invoking a callback when done -- @param BatchDetectSyntaxRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.BatchDetectSyntaxAsync(BatchDetectSyntaxRequest, cb) assert(BatchDetectSyntaxRequest, "You must provide a BatchDetectSyntaxRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.BatchDetectSyntax", } for header,value in pairs(BatchDetectSyntaxRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", BatchDetectSyntaxRequest, headers, settings, cb) else cb(false, err) end end --- Call BatchDetectSyntax synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param BatchDetectSyntaxRequest -- @return response -- @return error_type -- @return error_message function M.BatchDetectSyntaxSync(BatchDetectSyntaxRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.BatchDetectSyntaxAsync(BatchDetectSyntaxRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call DescribeDominantLanguageDetectionJob asynchronously, invoking a callback when done -- @param DescribeDominantLanguageDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.DescribeDominantLanguageDetectionJobAsync(DescribeDominantLanguageDetectionJobRequest, cb) assert(DescribeDominantLanguageDetectionJobRequest, "You must provide a DescribeDominantLanguageDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.DescribeDominantLanguageDetectionJob", } for header,value in pairs(DescribeDominantLanguageDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", DescribeDominantLanguageDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call DescribeDominantLanguageDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param DescribeDominantLanguageDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.DescribeDominantLanguageDetectionJobSync(DescribeDominantLanguageDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.DescribeDominantLanguageDetectionJobAsync(DescribeDominantLanguageDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call StopSentimentDetectionJob asynchronously, invoking a callback when done -- @param StopSentimentDetectionJobRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.StopSentimentDetectionJobAsync(StopSentimentDetectionJobRequest, cb) assert(StopSentimentDetectionJobRequest, "You must provide a StopSentimentDetectionJobRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.StopSentimentDetectionJob", } for header,value in pairs(StopSentimentDetectionJobRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", StopSentimentDetectionJobRequest, headers, settings, cb) else cb(false, err) end end --- Call StopSentimentDetectionJob synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param StopSentimentDetectionJobRequest -- @return response -- @return error_type -- @return error_message function M.StopSentimentDetectionJobSync(StopSentimentDetectionJobRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.StopSentimentDetectionJobAsync(StopSentimentDetectionJobRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call BatchDetectKeyPhrases asynchronously, invoking a callback when done -- @param BatchDetectKeyPhrasesRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.BatchDetectKeyPhrasesAsync(BatchDetectKeyPhrasesRequest, cb) assert(BatchDetectKeyPhrasesRequest, "You must provide a BatchDetectKeyPhrasesRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.BatchDetectKeyPhrases", } for header,value in pairs(BatchDetectKeyPhrasesRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", BatchDetectKeyPhrasesRequest, headers, settings, cb) else cb(false, err) end end --- Call BatchDetectKeyPhrases synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param BatchDetectKeyPhrasesRequest -- @return response -- @return error_type -- @return error_message function M.BatchDetectKeyPhrasesSync(BatchDetectKeyPhrasesRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.BatchDetectKeyPhrasesAsync(BatchDetectKeyPhrasesRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call ListDominantLanguageDetectionJobs asynchronously, invoking a callback when done -- @param ListDominantLanguageDetectionJobsRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.ListDominantLanguageDetectionJobsAsync(ListDominantLanguageDetectionJobsRequest, cb) assert(ListDominantLanguageDetectionJobsRequest, "You must provide a ListDominantLanguageDetectionJobsRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.ListDominantLanguageDetectionJobs", } for header,value in pairs(ListDominantLanguageDetectionJobsRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", ListDominantLanguageDetectionJobsRequest, headers, settings, cb) else cb(false, err) end end --- Call ListDominantLanguageDetectionJobs synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param ListDominantLanguageDetectionJobsRequest -- @return response -- @return error_type -- @return error_message function M.ListDominantLanguageDetectionJobsSync(ListDominantLanguageDetectionJobsRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.ListDominantLanguageDetectionJobsAsync(ListDominantLanguageDetectionJobsRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end --- Call BatchDetectEntities asynchronously, invoking a callback when done -- @param BatchDetectEntitiesRequest -- @param cb Callback function accepting three args: response, error_type, error_message function M.BatchDetectEntitiesAsync(BatchDetectEntitiesRequest, cb) assert(BatchDetectEntitiesRequest, "You must provide a BatchDetectEntitiesRequest") local headers = { [request_headers.CONTENT_TYPE_HEADER] = content_type.from_protocol(M.metadata.protocol, M.metadata.json_version), [request_headers.AMZ_TARGET_HEADER] = "Comprehend_20171127.BatchDetectEntities", } for header,value in pairs(BatchDetectEntitiesRequest.headers) do headers[header] = value end local request_handler, err = request_handlers.from_protocol_and_method("json", "POST") if request_handler then request_handler(settings.uri, "/", BatchDetectEntitiesRequest, headers, settings, cb) else cb(false, err) end end --- Call BatchDetectEntities synchronously, returning when done -- This assumes that the function is called from within a coroutine -- @param BatchDetectEntitiesRequest -- @return response -- @return error_type -- @return error_message function M.BatchDetectEntitiesSync(BatchDetectEntitiesRequest, ...) local co = coroutine.running() assert(co, "You must call this function from within a coroutine") M.BatchDetectEntitiesAsync(BatchDetectEntitiesRequest, function(response, error_type, error_message) assert(coroutine.resume(co, response, error_type, error_message)) end) return coroutine.yield() end return M
hyper = {"ctrl", "alt", "cmd"} hypershift = {"ctrl", "alt", "cmd", "shift"} require('watcher') require('position')
local correctVersion = require 'correctversion' if correctVersion then require 'utils' local debugger = require 'debugger' local Gamestate = require 'vendor/gamestate' local Level = require 'level' local camera = require 'camera' local fonts = require 'fonts' local sound = require 'vendor/TEsound' local window = require 'window' local controls = require 'controls' local hud = require 'hud' local cli = require 'vendor/cliargs' local mixpanel = require 'vendor/mixpanel' local character = require 'character' local cheat = require 'cheat' -- XXX Hack for level loading Gamestate.Level = Level -- Get the current version of the game local function getVersion() return split(love.graphics.getCaption(), "v")[2] end function love.load(arg) table.remove(arg, 1) local state = 'splash' -- SCIENCE! mixpanel.init("ac1c2db50f1332444fd0cafffd7a5543") mixpanel.track('game.opened') -- set settings local options = require 'options' options:init() cli:add_option("-l, --level=NAME", "The level to display") cli:add_option("-c, --character=NAME", "The character to use in the game") cli:add_option("-o, --costume=NAME", "The costume to use in the game") cli:add_option("-m, --mute=CHANNEL", "Disable sound: all, music, sfx") cli:add_option("-g, --god", "Enable God Mode Cheat") cli:add_option("-j, --jump", "Enable High Jump Cheat") cli:add_option("-d, --debug", "Enable Memory Debugger") cli:add_option("-b, --bbox", "Draw all bounding boxes ( enables memory debugger )") cli:add_option("--console", "Displays print info") local args = cli:parse(arg) if not args then error( "Error parsing command line arguments!") end if args["level"] ~= "" then state = args["level"] end if args["character"] ~= "" then character:setCharacter( args["c"] ) end if args["costume"] ~= "" then character:setCostume( args["o"] ) end if args["mute"] == 'all' then sound.disabled = true elseif args["mute"] == 'music' then sound.volume('music',0) elseif args["mute"] == 'sfx' then sound.volume('sfx',0) end if args["d"] then debugger.set( true, false ) end if args["b"] then debugger.set( true, true ) end if args["g"] then cheat.god = true end if args["j"] then cheat.jump_high = true end love.graphics.setDefaultImageFilter('nearest', 'nearest') camera:setScale(window.scale, window.scale) love.graphics.setMode(window.screen_width, window.screen_height) Gamestate.switch(state) end function love.update(dt) if paused then return end if debugger.on then debugger:update(dt) end dt = math.min(0.033333333, dt) Gamestate.update(dt) sound.cleanup() end function love.keyreleased(key) local button = controls.getButton(key) if button then Gamestate.keyreleased(button) end end function love.keypressed(key) if key == 'f5' then debugger:toggle() end local button = controls.getButton(key) if button then Gamestate.keypressed(button) end end function love.draw() camera:set() Gamestate.draw() camera:unset() if paused then love.graphics.setColor(75, 75, 75, 125) love.graphics.rectangle('fill', 0, 0, love.graphics:getWidth(), love.graphics:getHeight()) love.graphics.setColor(255, 255, 255, 255) end if debugger.on then debugger:draw() end end -- Override the default screenshot functionality so we can disable the fps before taking it local newScreenshot = love.graphics.newScreenshot function love.graphics.newScreenshot() window.dressing_visible = false love.draw() local ss = newScreenshot() window.dressing_visible = true return ss end end
require "xavante" require "xavante.davhandler" local davFileRepository = require "xavante.davFileRepository" local davFileProps = require "xavante.davFileProps" webDir = "." local simplerules = { { match = ".", with = xavante.davhandler, params = { repos_b = davFileRepository.makeSource(), props_b = davFileProps.makeProps(), }, }, } xavante.HTTP{ server = { host = "*", port = 8080, }, defaultHost = { rules = simplerules, }, } -- Displays a message in the console with the used ports xavante.start_message(function (ports) local date = os.date("[%Y-%m-%d %H:%M:%S]") print(string.format("%s Xavante started on port(s) %s", date, table.concat(ports, ", "))) end) xavante.start()
function start (song) end function update (elapsed) end function beatHit (beat) end function stepHit (step) end function keyPressed (key) end
help([[ OMERO scripts ]]) local base = "/n/groups/lsp/o2/apps/omero-scripts/" local pkgName = myModuleName() local fullVersion = myModuleVersion() load("gcc") load(atleast("python", "2.7")) load("omero") append_path("PATH", pathJoin(base, fullVersion, "/venv/bin/")) whatis("Name: ".. pkgName) whatis("Version: " .. fullVersion) whatis("Category: tools") whatis("URL: http://github.com/sorgerlab/OMERO_scripts") whatis("Description: OMERO scripts")
function randomBoolean() return math.random(0, 5) == 0 end function countTries() -- Counter variable local tries = 0 -- While Loop while randomBoolean() == false do tries += 1 end -- Prints the tries it took for the loop to end print("It took " .. tries .. " tries to end the loop.") end countTries()
function Client_PresentMenuUI(rootParent, setMaxSize, setScrollable, game) Game = game; --global variables print(Game.Game.ID .. ' GameID'); LastTurn = {}; --we get the orders from History later Distribution = {}; setMaxSize(450, 300); vert = UI.CreateVerticalLayoutGroup(rootParent); vert2 = UI.CreateVerticalLayoutGroup(rootParent); if (not game.Settings.LocalDeployments) then return UI.CreateLabel(vert).SetText("This mod only works in Local Deployment games. This isn't a Local Deployment.") elseif (not game.Us or game.Us.State ~= WL.GamePlayerState.Playing) then return UI.CreateLabel(vert).SetText("You cannot do anything since you're not in the game."); end local row1 = UI.CreateHorizontalLayoutGroup(vert); addOrders = UI.CreateButton(row1).SetText("Add last turns deployment and transfers").SetOnClick(AddOrdersHelper).SetColor("#00ff05"); local row2 = UI.CreateHorizontalLayoutGroup(vert); addDeployOnly = UI.CreateButton(row2).SetText("Add last turns deployment only").SetOnClick(AddDeployHelper).SetColor("#00ff05"); local row3 = UI.CreateHorizontalLayoutGroup(vert); clearOrders = UI.CreateButton(row3).SetText("Clear Orders").SetOnClick(clearOrdersFunction).SetColor("#0000FF"); end function clearOrdersFunction() if(Game.Us.HasCommittedOrders)then return UI.Alert("You need to uncommit first"); end local orderTabel = Game.Orders;--get client order list if (next(orderTabel) ~= nil) then orderTabel = {} Game.Orders = orderTabel end end; function AddDeploy() print ('running AddDeploy'); if(Game.Us.HasCommittedOrders == true)then UI.Alert("You need to uncommit first"); return; end local orderTabel = Game.Orders;--get client order list if (next(orderTabel) ~= nil) then --make sure we don't have past orders, since that is alot of extra work UI.Alert('Please clear your order list before using this mod.') return; end; local maxDeployBonues = {}; --aray with the bonuses for _, bonus in pairs (Game.Map.Bonuses) do maxDeployBonues[bonus.ID] = bonus.Amount --store the bonus value end; local newOrder; for _,order in pairs(LastTurn) do if (order.PlayerID == Game.Us.ID) then if (order.proxyType == "GameOrderDeploy")then --check that we own the territory if (Game.Us.ID == standing.Territories[order.DeployOn].OwnerPlayerID) then --check that we have armies to deploy local bonusID; for i, bonus in ipairs(Game.Map.Territories[order.DeployOn].PartOfBonuses) do print(bonus) bonusID = bonus; break; end; --make sure we deploy more then 0 if (order.NumArmies == 0) then break; end; if (maxDeployBonues[bonusID] == 0) then break; end; if (maxDeployBonues[bonusID] - order.NumArmies >=0) then --deploy full maxDeployBonues[bonusID] = maxDeployBonues[bonusID] - order.NumArmies newOrder = WL.GameOrderDeploy.Create(Game.Us.ID, order.NumArmies, order.DeployOn, false) table.insert(orderTabel, newOrder); elseif (maxDeployBonues[bonusID] > 0) then --deploy the max we can newOrder = WL.GameOrderDeploy.Create(Game.Us.ID, maxDeployBonues[bonusID], order.DeployOn, false) table.insert(orderTabel, newOrder); maxDeployBonues[bonusID] = 0; end; end; end; end; end; --update client orders list Game.Orders = orderTabel; end; function AddOrdersConfirmes() print ('running addOrders'); if(Game.Us.HasCommittedOrders == true)then UI.Alert("You need to uncommit first"); return; end local standing = Game.LatestStanding; --used to make sure we can make the depoly/transfear local orderTabel = Game.Orders;--get clinet order list if (next(orderTabel) ~= nil) then --make sure we don't have past orders, since that is alot of extra work UI.Alert('Please clear your order list before using this mod.') return; end; local maxDeployBonues = {}; --aray with the bonuses for _, bonus in pairs (Game.Map.Bonuses) do maxDeployBonues[bonus.ID] = bonus.Amount --store the bonus value end; local newOrder; for _,order in pairs(LastTurn) do if (order.PlayerID == Game.Us.ID) then if (order.proxyType == "GameOrderDeploy")then --check that we own the territory if (Game.Us.ID == standing.Territories[order.DeployOn].OwnerPlayerID) then --check that we have armies to deploy local bonusID; for i, bonus in ipairs(Game.Map.Territories[order.DeployOn].PartOfBonuses) do print(bonus .. ' bonusID') bonusID = bonus; break; end; --make sure we deploy more then 0 if (order.NumArmies == 0) then break; end; if (maxDeployBonues[bonusID] == 0) then break; end; if (maxDeployBonues[bonusID] - order.NumArmies >=0) then --deploy full maxDeployBonues[bonusID] = maxDeployBonues[bonusID] - order.NumArmies newOrder = WL.GameOrderDeploy.Create(Game.Us.ID, order.NumArmies, order.DeployOn, false) table.insert(orderTabel, newOrder); elseif (maxDeployBonues[bonusID] > 0) then --deploy the max we can newOrder = WL.GameOrderDeploy.Create(Game.Us.ID, maxDeployBonues[bonusID], order.DeployOn, false) table.insert(orderTabel, newOrder); maxDeployBonues[bonusID] = 0; end; end; end; if (order.proxyType == "GameOrderAttackTransfer") then if (Game.Us.ID == standing.Territories[order.From].OwnerPlayerID) then --from us if (Game.Us.ID == standing.Territories[order.To].OwnerPlayerID) then -- to us newOrder = WL.GameOrderAttackTransfer.Create(Game.Us.ID, order.From, order.To,3, order.ByPercent, order.NumArmies, false) table.insert(orderTabel, newOrder); end; end; end; end; end; --update client orders list Game.Orders = orderTabel; end; function AddDeployHelper() standing = Game.LatestStanding; --used to make sure we can make the deploy/transfer LastTurn = Game.Orders --can we get rid of this Call? Game.GetDistributionStanding(function(data) getDistHelper(data) end) local turn = Game.Game.TurnNumber; local firstTurn = 1; if (Distribution == nil) then --auto dist firstTurn = 0; end; if(turn -1 <= firstTurn) then UI.Alert("You can't use the mod during distribution or for the first turn."); return; end; local turn = turn -2; print('request Game.GetTurn for turn: ' .. turn); Game.GetTurn(turn, function(data) getTurnHelperAdd(data) end)--getTurnHelperAdd(data) end) end; function AddOrdersHelper() standing = Game.LatestStanding; --used to make sure we can make the depoly/transfear LastTurn = Game.Orders --can we get rid of this Call? Game.GetDistributionStanding(function(data) getDistHelper(data) end) local turn = Game.Game.TurnNumber; local firstTurn = 1; if (Distribution == nil) then --auto dist firstTurn = 0; end; if(turn -1 <= firstTurn) then UI.Alert("You can't use the mod during distribution or for the first turn."); return; end; local turn = turn -2; print('request Game.GetTurn for turn: ' .. turn); Game.GetTurn(turn, function(data) getTurnHelperAddOrders(data) end)--getTurnHelperAdd(data) end) end; function getTurnHelperAdd(prevTurn) print('got prevTurn'); LastTurn = prevTurn.Orders; AddDeploy(); end; function getTurnHelperAddOrders(prevTurn) print('got prevTurn'); LastTurn = prevTurn.Orders; AddOrdersConfirmes(); end; --Your function will be called with nil if the distribution standing is not available, --for example if it's an automatic distribution game function getDistHelper(data) print('got Distribution'); Distribution = data; end;
entity = { special = true, name = "test", TransformComponent = { x = 0, y = 0, width = 1280, height = 720, angle = 0.0 }, RenderableComponent = { }, TextComponent = { text = "TEST!!!", font = "GameOver18", colour = { r = 255, g = 255, b = 255, a = 255 }, offsetX = 0, offsetY = 0, layer = 1 }, SpriteComponent = { spriteName = "background", layer = 0 } }
--- -- Precomputed values for DAA instruction -- 2048 local DAATable = { [0] = 68, 256, 512, 772, 1024, 1284, 1540, 1792, 2056, 2316, 4112, 4372, 4628, 4880, 5140, 5392, 4096, 4356, 4612, 4864, 5124, 5376, 5632, 5892, 6156, 6408, 8240, 8500, 8756, 9008, 9268, 9520, 8224, 8484, 8740, 8992, 9252, 9504, 9760, 10020, 10284, 10536, 12340, 12592, 12848, 13108, 13360, 13620, 12324, 12576, 12832, 13092, 13344, 13604, 13860, 14112, 14376, 14636, 16400, 16660, 16916, 17168, 17428, 17680, 16384, 16644, 16900, 17152, 17412, 17664, 17920, 18180, 18444, 18696, 20500, 20752, 21008, 21268, 21520, 21780, 20484, 20736, 20992, 21252, 21504, 21764, 22020, 22272, 22536, 22796, 24628, 24880, 25136, 25396, 25648, 25908, 24612, 24864, 25120, 25380, 25632, 25892, 26148, 26400, 26664, 26924, 28720, 28980, 29236, 29488, 29748, 30000, 28704, 28964, 29220, 29472, 29732, 29984, 30240, 30500, 30764, 31016, -32624, -32364, -32108, -31856, -31596, -31344, -32640, -32380, -32124, -31872, -31612, -31360, -31104, -30844, -30580, -30328, -28524, -28272, -28016, -27756, -27504, -27244, -28540, -28288, -28032, -27772, -27520, -27260, -27004, -26752, -26488, -26228, 85, 273, 529, 789, 1041, 1301, 69, 257, 513, 773, 1025, 1285, 1541, 1793, 2057, 2317, 4113, 4373, 4629, 4881, 5141, 5393, 4097, 4357, 4613, 4865, 5125, 5377, 5633, 5893, 6157, 6409, 8241, 8501, 8757, 9009, 9269, 9521, 8225, 8485, 8741, 8993, 9253, 9505, 9761, 10021, 10285, 10537, 12341, 12593, 12849, 13109, 13361, 13621, 12325, 12577, 12833, 13093, 13345, 13605, 13861, 14113, 14377, 14637, 16401, 16661, 16917, 17169, 17429, 17681, 16385, 16645, 16901, 17153, 17413, 17665, 17921, 18181, 18445, 18697, 20501, 20753, 21009, 21269, 21521, 21781, 20485, 20737, 20993, 21253, 21505, 21765, 22021, 22273, 22537, 22797, 24629, 24881, 25137, 25397, 25649, 25909, 24613, 24865, 25121, 25381, 25633, 25893, 26149, 26401, 26665, 26925, 28721, 28981, 29237, 29489, 29749, 30001, 28705, 28965, 29221, 29473, 29733, 29985, 30241, 30501, 30765, 31017, -32623, -32363, -32107, -31855, -31595, -31343, -32639, -32379, -32123, -31871, -31611, -31359, -31103, -30843, -30579, -30327, -28523, -28271, -28015, -27755, -27503, -27243, -28539, -28287, -28031, -27771, -27519, -27259, -27003, -26751, -26487, -26227, -24395, -24143, -23887, -23627, -23375, -23115, -24411, -24159, -23903, -23643, -23391, -23131, -22875, -22623, -22359, -22099, -20303, -20043, -19787, -19535, -19275, -19023, -20319, -20059, -19803, -19551, -19291, -19039, -18783, -18523, -18259, -18007, -16235, -15983, -15727, -15467, -15215, -14955, -16251, -15999, -15743, -15483, -15231, -14971, -14715, -14463, -14199, -13939, -12143, -11883, -11627, -11375, -11115, -10863, -12159, -11899, -11643, -11391, -11131, -10879, -10623, -10363, -10099, -9847, -8015, -7755, -7499, -7247, -6987, -6735, -8031, -7771, -7515, -7263, -7003, -6751, -6495, -6235, -5971, -5719, -3915, -3663, -3407, -3147, -2895, -2635, -3931, -3679, -3423, -3163, -2911, -2651, -2395, -2143, -1879, -1619, 85, 273, 529, 789, 1041, 1301, 69, 257, 513, 773, 1025, 1285, 1541, 1793, 2057, 2317, 4113, 4373, 4629, 4881, 5141, 5393, 4097, 4357, 4613, 4865, 5125, 5377, 5633, 5893, 6157, 6409, 8241, 8501, 8757, 9009, 9269, 9521, 8225, 8485, 8741, 8993, 9253, 9505, 9761, 10021, 10285, 10537, 12341, 12593, 12849, 13109, 13361, 13621, 12325, 12577, 12833, 13093, 13345, 13605, 13861, 14113, 14377, 14637, 16401, 16661, 16917, 17169, 17429, 17681, 16385, 16645, 16901, 17153, 17413, 17665, 17921, 18181, 18445, 18697, 20501, 20753, 21009, 21269, 21521, 21781, 20485, 20737, 20993, 21253, 21505, 21765, 22021, 22273, 22537, 22797, 24629, 24881, 25137, 25397, 25649, 25909, 1540, 1792, 2056, 2316, 2572, 2824, 3084, 3336, 3592, 3852, 4112, 4372, 4628, 4880, 5140, 5392, 5632, 5892, 6156, 6408, 6664, 6924, 7176, 7436, 7692, 7944, 8240, 8500, 8756, 9008, 9268, 9520, 9760, 10020, 10284, 10536, 10792, 11052, 11304, 11564, 11820, 12072, 12340, 12592, 12848, 13108, 13360, 13620, 13860, 14112, 14376, 14636, 14892, 15144, 15404, 15656, 15912, 16172, 16400, 16660, 16916, 17168, 17428, 17680, 17920, 18180, 18444, 18696, 18952, 19212, 19464, 19724, 19980, 20232, 20500, 20752, 21008, 21268, 21520, 21780, 22020, 22272, 22536, 22796, 23052, 23304, 23564, 23816, 24072, 24332, 24628, 24880, 25136, 25396, 25648, 25908, 26148, 26400, 26664, 26924, 27180, 27432, 27692, 27944, 28200, 28460, 28720, 28980, 29236, 29488, 29748, 30000, 30240, 30500, 30764, 31016, 31272, 31532, 31784, 32044, 32300, 32552, -32624, -32364, -32108, -31856, -31596, -31344, -31104, -30844, -30580, -30328, -30072, -29812, -29560, -29300, -29044, -28792, -28524, -28272, -28016, -27756, -27504, -27244, -27004, -26752, -26488, -26228, -25972, -25720, -25460, -25208, -24952, -24692, 85, 273, 529, 789, 1041, 1301, 1541, 1793, 2057, 2317, 2573, 2825, 3085, 3337, 3593, 3853, 4113, 4373, 4629, 4881, 5141, 5393, 5633, 5893, 6157, 6409, 6665, 6925, 7177, 7437, 7693, 7945, 8241, 8501, 8757, 9009, 9269, 9521, 9761, 10021, 10285, 10537, 10793, 11053, 11305, 11565, 11821, 12073, 12341, 12593, 12849, 13109, 13361, 13621, 13861, 14113, 14377, 14637, 14893, 15145, 15405, 15657, 15913, 16173, 16401, 16661, 16917, 17169, 17429, 17681, 17921, 18181, 18445, 18697, 18953, 19213, 19465, 19725, 19981, 20233, 20501, 20753, 21009, 21269, 21521, 21781, 22021, 22273, 22537, 22797, 23053, 23305, 23565, 23817, 24073, 24333, 24629, 24881, 25137, 25397, 25649, 25909, 26149, 26401, 26665, 26925, 27181, 27433, 27693, 27945, 28201, 28461, 28721, 28981, 29237, 29489, 29749, 30001, 30241, 30501, 30765, 31017, 31273, 31533, 31785, 32045, 32301, 32553, -32623, -32363, -32107, -31855, -31595, -31343, -31103, -30843, -30579, -30327, -30071, -29811, -29559, -29299, -29043, -28791, -28523, -28271, -28015, -27755, -27503, -27243, -27003, -26751, -26487, -26227, -25971, -25719, -25459, -25207, -24951, -24691, -24395, -24143, -23887, -23627, -23375, -23115, -22875, -22623, -22359, -22099, -21843, -21591, -21331, -21079, -20823, -20563, -20303, -20043, -19787, -19535, -19275, -19023, -18783, -18523, -18259, -18007, -17751, -17491, -17239, -16979, -16723, -16471, -16235, -15983, -15727, -15467, -15215, -14955, -14715, -14463, -14199, -13939, -13683, -13431, -13171, -12919, -12663, -12403, -12143, -11883, -11627, -11375, -11115, -10863, -10623, -10363, -10099, -9847, -9591, -9331, -9079, -8819, -8563, -8311, -8015, -7755, -7499, -7247, -6987, -6735, -6495, -6235, -5971, -5719, -5463, -5203, -4951, -4691, -4435, -4183, -3915, -3663, -3407, -3147, -2895, -2635, -2395, -2143, -1879, -1619, -1363, -1111, -851, -599, -343, -83, 85, 273, 529, 789, 1041, 1301, 1541, 1793, 2057, 2317, 2573, 2825, 3085, 3337, 3593, 3853, 4113, 4373, 4629, 4881, 5141, 5393, 5633, 5893, 6157, 6409, 6665, 6925, 7177, 7437, 7693, 7945, 8241, 8501, 8757, 9009, 9269, 9521, 9761, 10021, 10285, 10537, 10793, 11053, 11305, 11565, 11821, 12073, 12341, 12593, 12849, 13109, 13361, 13621, 13861, 14113, 14377, 14637, 14893, 15145, 15405, 15657, 15913, 16173, 16401, 16661, 16917, 17169, 17429, 17681, 17921, 18181, 18445, 18697, 18953, 19213, 19465, 19725, 19981, 20233, 20501, 20753, 21009, 21269, 21521, 21781, 22021, 22273, 22537, 22797, 23053, 23305, 23565, 23817, 24073, 24333, 24629, 24881, 25137, 25397, 25649, 25909, 70, 258, 514, 774, 1026, 1286, 1542, 1794, 2058, 2318, 1026, 1286, 1542, 1794, 2058, 2318, 4098, 4358, 4614, 4866, 5126, 5378, 5634, 5894, 6158, 6410, 5126, 5378, 5634, 5894, 6158, 6410, 8226, 8486, 8742, 8994, 9254, 9506, 9762, 10022, 10286, 10538, 9254, 9506, 9762, 10022, 10286, 10538, 12326, 12578, 12834, 13094, 13346, 13606, 13862, 14114, 14378, 14638, 13346, 13606, 13862, 14114, 14378, 14638, 16386, 16646, 16902, 17154, 17414, 17666, 17922, 18182, 18446, 18698, 17414, 17666, 17922, 18182, 18446, 18698, 20486, 20738, 20994, 21254, 21506, 21766, 22022, 22274, 22538, 22798, 21506, 21766, 22022, 22274, 22538, 22798, 24614, 24866, 25122, 25382, 25634, 25894, 26150, 26402, 26666, 26926, 25634, 25894, 26150, 26402, 26666, 26926, 28706, 28966, 29222, 29474, 29734, 29986, 30242, 30502, 30766, 31018, 29734, 29986, 30242, 30502, 30766, 31018, -32638, -32378, -32122, -31870, -31610, -31358, -31102, -30842, -30578, -30326, -31610, -31358, -31102, -30842, -30578, -30326, -28538, -28286, -28030, -27770, -27518, -27258, -27002, -26750, -26486, -26226, 13347, 13607, 13863, 14115, 14379, 14639, 16387, 16647, 16903, 17155, 17415, 17667, 17923, 18183, 18447, 18699, 17415, 17667, 17923, 18183, 18447, 18699, 20487, 20739, 20995, 21255, 21507, 21767, 22023, 22275, 22539, 22799, 21507, 21767, 22023, 22275, 22539, 22799, 24615, 24867, 25123, 25383, 25635, 25895, 26151, 26403, 26667, 26927, 25635, 25895, 26151, 26403, 26667, 26927, 28707, 28967, 29223, 29475, 29735, 29987, 30243, 30503, 30767, 31019, 29735, 29987, 30243, 30503, 30767, 31019, -32637, -32377, -32121, -31869, -31609, -31357, -31101, -30841, -30577, -30325, -31609, -31357, -31101, -30841, -30577, -30325, -28537, -28285, -28029, -27769, -27517, -27257, -27001, -26749, -26485, -26225, -27517, -27257, -27001, -26749, -26485, -26225, -24409, -24157, -23901, -23641, -23389, -23129, -22873, -22621, -22357, -22097, -23389, -23129, -22873, -22621, -22357, -22097, -20317, -20057, -19801, -19549, -19289, -19037, -18781, -18521, -18257, -18005, -19289, -19037, -18781, -18521, -18257, -18005, -16249, -15997, -15741, -15481, -15229, -14969, -14713, -14461, -14197, -13937, -15229, -14969, -14713, -14461, -14197, -13937, -12157, -11897, -11641, -11389, -11129, -10877, -10621, -10361, -10097, -9845, -11129, -10877, -10621, -10361, -10097, -9845, -8029, -7769, -7513, -7261, -7001, -6749, -6493, -6233, -5969, -5717, -7001, -6749, -6493, -6233, -5969, -5717, -3929, -3677, -3421, -3161, -2909, -2649, -2393, -2141, -1877, -1617, -2909, -2649, -2393, -2141, -1877, -1617, 71, 259, 515, 775, 1027, 1287, 1543, 1795, 2059, 2319, 1027, 1287, 1543, 1795, 2059, 2319, 4099, 4359, 4615, 4867, 5127, 5379, 5635, 5895, 6159, 6411, 5127, 5379, 5635, 5895, 6159, 6411, 8227, 8487, 8743, 8995, 9255, 9507, 9763, 10023, 10287, 10539, 9255, 9507, 9763, 10023, 10287, 10539, 12327, 12579, 12835, 13095, 13347, 13607, 13863, 14115, 14379, 14639, 13347, 13607, 13863, 14115, 14379, 14639, 16387, 16647, 16903, 17155, 17415, 17667, 17923, 18183, 18447, 18699, 17415, 17667, 17923, 18183, 18447, 18699, 20487, 20739, 20995, 21255, 21507, 21767, 22023, 22275, 22539, 22799, 21507, 21767, 22023, 22275, 22539, 22799, 24615, 24867, 25123, 25383, 25635, 25895, 26151, 26403, 26667, 26927, 25635, 25895, 26151, 26403, 26667, 26927, 28707, 28967, 29223, 29475, 29735, 29987, 30243, 30503, 30767, 31019, 29735, 29987, 30243, 30503, 30767, 31019, -32637, -32377, -32121, -31869, -31609, -31357, -31101, -30841, -30577, -30325, -31609, -31357, -31101, -30841, -30577, -30325, -28537, -28285, -28029, -27769, -27517, -27257, -27001, -26749, -26485, -26225, -27517, -27257, -27001, -26749, -26485, -26225, -1346, -1094, -834, -582, -326, -66, 70, 258, 514, 774, 1026, 1286, 1542, 1794, 2058, 2318, 2590, 2842, 3102, 3354, 3610, 3870, 4098, 4358, 4614, 4866, 5126, 5378, 5634, 5894, 6158, 6410, 6682, 6942, 7194, 7454, 7710, 7962, 8226, 8486, 8742, 8994, 9254, 9506, 9762, 10022, 10286, 10538, 10810, 11070, 11322, 11582, 11838, 12090, 12326, 12578, 12834, 13094, 13346, 13606, 13862, 14114, 14378, 14638, 14910, 15162, 15422, 15674, 15930, 16190, 16386, 16646, 16902, 17154, 17414, 17666, 17922, 18182, 18446, 18698, 18970, 19230, 19482, 19742, 19998, 20250, 20486, 20738, 20994, 21254, 21506, 21766, 22022, 22274, 22538, 22798, 23070, 23322, 23582, 23834, 24090, 24350, 24614, 24866, 25122, 25382, 25634, 25894, 26150, 26402, 26666, 26926, 27198, 27450, 27710, 27962, 28218, 28478, 28706, 28966, 29222, 29474, 29734, 29986, 30242, 30502, 30766, 31018, 31290, 31550, 31802, 32062, 32318, 32570, -32638, -32378, -32122, -31870, -31610, -31358, -31102, -30842, -30578, -30326, -30054, -29794, -29542, -29282, -29026, -28774, -28538, -28286, -28030, -27770, 13347, 13607, 13863, 14115, 14379, 14639, 14911, 15163, 15423, 15675, 15931, 16191, 16387, 16647, 16903, 17155, 17415, 17667, 17923, 18183, 18447, 18699, 18971, 19231, 19483, 19743, 19999, 20251, 20487, 20739, 20995, 21255, 21507, 21767, 22023, 22275, 22539, 22799, 23071, 23323, 23583, 23835, 24091, 24351, 24615, 24867, 25123, 25383, 25635, 25895, 26151, 26403, 26667, 26927, 27199, 27451, 27711, 27963, 28219, 28479, 28707, 28967, 29223, 29475, 29735, 29987, 30243, 30503, 30767, 31019, 31291, 31551, 31803, 32063, 32319, 32571, -32637, -32377, -32121, -31869, -31609, -31357, -31101, -30841, -30577, -30325, -30053, -29793, -29541, -29281, -29025, -28773, -28537, -28285, -28029, -27769, -27517, -27257, -27001, -26749, -26485, -26225, -25953, -25701, -25441, -25189, -24933, -24673, -24409, -24157, -23901, -23641, -23389, -23129, -22873, -22621, -22357, -22097, -21825, -21573, -21313, -21061, -20805, -20545, -20317, -20057, -19801, -19549, -19289, -19037, -18781, -18521, -18257, -18005, -17733, -17473, -17221, -16961, -16705, -16453, -16249, -15997, -15741, -15481, -15229, -14969, -14713, -14461, -14197, -13937, -13665, -13413, -13153, -12901, -12645, -12385, -12157, -11897, -11641, -11389, -11129, -10877, -10621, -10361, -10097, -9845, -9573, -9313, -9061, -8801, -8545, -8293, -8029, -7769, -7513, -7261, -7001, -6749, -6493, -6233, -5969, -5717, -5445, -5185, -4933, -4673, -4417, -4165, -3929, -3677, -3421, -3161, -2909, -2649, -2393, -2141, -1877, -1617, -1345, -1093, -833, -581, -325, -65, 71, 259, 515, 775, 1027, 1287, 1543, 1795, 2059, 2319, 2591, 2843, 3103, 3355, 3611, 3871, 4099, 4359, 4615, 4867, 5127, 5379, 5635, 5895, 6159, 6411, 6683, 6943, 7195, 7455, 7711, 7963, 8227, 8487, 8743, 8995, 9255, 9507, 9763, 10023, 10287, 10539, 10811, 11071, 11323, 11583, 11839, 12091, 12327, 12579, 12835, 13095, 13347, 13607, 13863, 14115, 14379, 14639, 14911, 15163, 15423, 15675, 15931, 16191, 16387, 16647, 16903, 17155, 17415, 17667, 17923, 18183, 18447, 18699, 18971, 19231, 19483, 19743, 19999, 20251, 20487, 20739, 20995, 21255, 21507, 21767, 22023, 22275, 22539, 22799, 23071, 23323, 23583, 23835, 24091, 24351, 24615, 24867, 25123, 25383, 25635, 25895, 26151, 26403, 26667, 26927, 27199, 27451, 27711, 27963, 28219, 28479, 28707, 28967, 29223, 29475, 29735, 29987, 30243, 30503, 30767, 31019, 31291, 31551, 31803, 32063, 32319, 32571, -32637, -32377, -32121, -31869, -31609, -31357, -31101, -30841, -30577, -30325, -30053, -29793, -29541, -29281, -29025, -28773, -28537, -28285, -28029, -27769, -27517, -27257, -27001, -26749, -26485, -26225 } return DAATable
if vim.fn.has "nvim-0.5.1" == 1 then vim.lsp.handlers["textDocument/codeAction"] = require("lsputil.codeAction").code_action_handler vim.lsp.handlers["textDocument/references"] = require("lsputil.locations").references_handler vim.lsp.handlers["textDocument/definition"] = require("lsputil.locations").definition_handler vim.lsp.handlers["textDocument/declaration"] = require("lsputil.locations").declaration_handler vim.lsp.handlers["textDocument/typeDefinition"] = require("lsputil.locations").typeDefinition_handler vim.lsp.handlers["textDocument/implementation"] = require("lsputil.locations").implementation_handler vim.lsp.handlers["textDocument/documentSymbol"] = require("lsputil.symbols").document_handler vim.lsp.handlers["workspace/symbol"] = require("lsputil.symbols").workspace_handler else local bufnr = vim.api.nvim_buf_get_number(0) vim.lsp.handlers["textDocument/codeAction"] = function(_, _, actions) require("lsputil.codeAction").code_action_handler(nil, actions, nil, nil, nil) end vim.lsp.handlers["textDocument/references"] = function(_, _, result) require("lsputil.locations").references_handler(nil, result, { bufnr = bufnr }, nil) end vim.lsp.handlers["textDocument/definition"] = function(_, method, result) require("lsputil.locations").definition_handler(nil, result, { bufnr = bufnr, method = method }, nil) end vim.lsp.handlers["textDocument/declaration"] = function(_, method, result) require("lsputil.locations").declaration_handler(nil, result, { bufnr = bufnr, method = method }, nil) end vim.lsp.handlers["textDocument/typeDefinition"] = function(_, method, result) require("lsputil.locations").typeDefinition_handler(nil, result, { bufnr = bufnr, method = method }, nil) end vim.lsp.handlers["textDocument/implementation"] = function(_, method, result) require("lsputil.locations").implementation_handler(nil, result, { bufnr = bufnr, method = method }, nil) end vim.lsp.handlers["textDocument/documentSymbol"] = function(_, _, result, _, bufn) require("lsputil.symbols").document_handler(nil, result, { bufnr = bufn }, nil) end vim.lsp.handlers["textDocument/symbol"] = function(_, _, result, _, bufn) require("lsputil.symbols").workspace_handler(nil, result, { bufnr = bufn }, nil) end end vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { focusable = false }) vim.lsp.protocol.CompletionItemKind = { " (Text)", " (Method)", " (Function)", " (Constructor)", " (Field)", "[] (Variable)", " (Class)", " (Interface)", "{} (Module)", " (Property)", " (Unit)", " (Value)", "  (Enum)", " (Keyword)", " (Snippet)", " (Color)", " (File)", " (Reference)", " (Folder)", " (EnumMember)", " (Constant)", " (Struct)", " (Event)", " (Operator)", " (TypeParameter)", } local installer = require "nvim-lsp-installer" local lsp = require "nvim-lsp-installer.server" local capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.workspace.configuration = true capabilities.window.workDoneProgress = true capabilities.textDocument.completion.completionItem.documentationFormat = { "markdown", "plaintext" } capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.preselectSupport = true capabilities.textDocument.completion.completionItem.insertReplaceSupport = true capabilities.textDocument.completion.completionItem.labelDetailsSupport = true capabilities.textDocument.completion.completionItem.deprecatedSupport = true capabilities.textDocument.completion.completionItem.commitCharactersSupport = true capabilities.textDocument.completion.completionItem.tagSupport = { valueSet = { 1 } } capabilities.textDocument.completion.completionItem.snippetSupport = true capabilities.textDocument.completion.completionItem.resolveSupport = { properties = { "documentation", "detail", "additionalTextEdits", }, } local function common_on_attach(client, bufnr) local augroup = require("events").nvim_create_augroups local function buf_keymap(mode, key, action) vim.api.nvim_buf_set_keymap(bufnr, mode, key, action, { noremap = true, silent = true }) end local command = require("modules").define_command local cap = client.resolved_capabilities if cap.declaration then command("LspDeclaration", "lua vim.lps.buf.declaration()", { buffer = true }) buf_keymap("n", "gC", ":lua vim.lsp.buf.declaration()<cr>") end if cap.goto_definition then command("LspPreviewDefinition", "lua require'goto-preview'.goto_preview_definition()", { buffer = true }) buf_keymap("n", "gd", "<cmd>LspPreviewDefinition<cr>") command("LspDefinition", "lua vim.lsp.buf.definition()", { buffer = true }) buf_keymap("n", "gD", "<cmd>LspDefinition<cr>") end if cap.type_definition then command("LspTypeDefinition", "lua vim.lsp.buf.type_definition()", { buffer = true }) end if cap.implementation then command("LspPreviewImplementation", "lua require'goto-preview'.goto_preview_implementation()", { buffer = true }) buf_keymap("n", "gi", "<cmd>LspPreviewImplementation<cr>") command("LspImplementation", "lua vim.lsp.buf.implementation()", { buffer = true }) buf_keymap("n", "gI", "<cmd>LspImplementation<cr>") end if cap.code_action then command( "LspCodeAction", "lua require'lsp.code_action'.code_action(<range> ~= 0, <line1>, <line2>)", { buffer = true } ) end if cap.rename then command( "LspRename", "lua require'lsp.rename'.rename(<f-args>)", { buffer = true, nargs = "?", complete = "custom,v:lua.require'lsp.completion'.rename" } ) buf_keymap("n", "gr", "<cmd>LspRename<cr>") end if cap.find_references then command("LspReferences", "lua vim.lsp.buf.references()", { buffer = true }) buf_keymap("n", "<a-n>", "<cmd>lua require'illuminate'.next_reference({ wrap = true })<cr>") buf_keymap("n", "<a-p>", "<cmd>lua require'illuminate'.next_reference({ wrap = true, reverse = true })<cr>") buf_keymap("n", "gR", "<cmd>Lspreferences<cr>") end if cap.document_symbol then command("LspDocumentSymbol", "lua vim.lsp.buf.document_symbol()", { buffer = true }) end if cap.workspace_symbol then command( "LspWorkspaceSymbol", "lua vim.lsp.buf.workspace_symbol(<f-args>)", { buffer = true, nargs = "?", complete = "custom,v:lua.require'lsp.completion'.workspace_symbol" } ) end if cap.call_hierarchy then command("LspIncomingCalls", "lua vim.lsp.buf.incoming_calls()", { buffer = true }) command("LspOutgoingCalls", "lua vim.lsp.buf.outgoing_calls()", { buffer = true }) end if cap.code_lens then augroup { code_lens = { { "CursorMoved,CursorMovedI", "<buffer>", "lua vim.lsp.codelens.refresh()" }, }, } command("LspCodeLensRun", "lua vim.lsp.codelens.run()", { buffer = true }) end command( "LspWorkspaceFolders", "lua print(table.concat(vim.lsp.buf.list_workspace_folders(), '\\n'))", { buffer = true } ) if cap.workspace_folder_properties.supported then command( "LspAddWorkspaceFolder", "lua vim.lsp.buf.add_workspace_folder(<q-args> ~= '' and vim.fn.fnamemodify(<q-args>, ':p'))", { buffer = true, nargs = "?", complete = "dir" } ) command( "LspRemoveWorkspaceFolder", "lua vim.lsp.buf.remove_workspace_folder(<f-args>)", { buffer = true, nargs = "?", complete = "custom,v:lua.vim.lsp.buf.list_workspace_folders" } ) end command("LspDiagnosticsNext", "lua vim.lsp.diagnostic.goto_next()", { buffer = true }) command("LspDiagNext", "lua vim.lsp.diagnostic.goto_next()", { buffer = true }) command("LspDiagnosticPrev", "lua vim.lsp.diagnostic.goto_prev()", { buffer = true }) command("LspDiagPrev", "lua vim.lsp.diagnostic.goto_prev()", { buffer = true }) command("LspDiagnosticsLine", "lua vim.lsp.diagnostic.show_line_diagnostics()", { buffer = true }) command("LspDiagLine", "lua vim.lsp.diagnostic.show_line_diagnostics()", { buffer = true }) buf_keymap("n", "gla", "<cmd>LspDiagnosticsLine<cr>") buf_keymap("n", "[a", "<cmd>LspDiagnosticPrev<cr>") buf_keymap("n", "]a", "<cmd>LspDiagnosticNext<cr>") command("LspLog", "execute '<mods> pedit +$' v:lua.vim.lsp.get_log_path()", {}) command("LspVirtualTextToggle", "lua require'lsp.virtual-text'.toggle()", { nargs = 0 }) if cap.hover then command("LspHover", "lua vim.lsp.buf.hover()", { buffer = true }) buf_keymap("n", "K", "<cmd>LspHover<cr>") augroup { lsphover = { { "CursorHold,CursorHoldI", "<buffer>", "silent! lua vim.lsp.buf.hover()" }, }, } end if cap.signature_help then command("LspSignatureHelp", "lua vim.lsp.buf.signature_help()", { buffer = true }) buf_keymap("i", "<C-k>", "<cmd>LspSignatureHelp<cr>") end -- fix 'command not found' error command("IlluminationDisable", "call illuminate#disable_illumination(<bang>0)", { nargs = 0, bang = true }) require("illuminate").on_attach(client, bufnr) require("lsp_signature").on_attach({ bind = true, hint_prefix = "", hi_parameter = "Blue", handler_opts = { border = "none", }, fix_pos = function(signatures, lspclient) if signatures[1].activeParameter >= 0 and #signatures[1].parameters == 1 then return false end if lspclient.name == "sumneko_lua" then return true end return false end, }, bufnr) end vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( vim.lsp.diagnostic.on_publish_diagnostics, { signs = false, virtual_text = { spacing = 0 }, update_in_insert = true } ) local tsserver_root = lsp.get_server_root_path "tsserver" installer.register(lsp.Server:new { name = "tsserver", root_dir = tsserver_root, installer = require("nvim-lsp-installer.installers.npm").packages { "typescript", "typescript-language-server", "typescript-deno-plugin", }, default_options = { init_options = { hostInfo = "neovim", plugins = { name = "typescript-deno-plugin", location = tsserver_root, enableForWorkspaceTypeScriptVersions = true, }, }, }, }) installer.register(lsp.Server:new { name = "jdtls", root_dir = lsp.get_server_root_path "jdtls", installer = require("nvim-lsp-installer.installers.zx").file(config_dir .. "lua/lsp/java/install.mjs"), default_options = {}, }) installer.on_server_ready(function(server) local util = require "lspconfig.util" local Path = require "plenary.path" local opts = { capabilities = capabilities, on_attach = common_on_attach, } if vim.tbl_contains({ "html", "jsonls" }, server.name) then opts.root_dir = vim.loop.cwd end if server.name == "jsonls" then local schemas = require "lsp.json.schemas" opts.settings = { json = { schemas = schemas.schemas, }, } end if server.name == "vuels" then opts.init_options = { config = { vetur = { completion = { autoImport = true, useScaffoldSnippets = true, }, experimental = { templateInterPolationService = true, }, format = { defaultFormatter = { js = "eslint", ts = "eslint", }, options = { tabSize = vim.opt.tabstop:get(), useTabs = not vim.opt.expandtab:get(), }, scriptInitialIndent = O.vue.initial_indent.script, styleInitialIndent = O.vue.initial_indent.style, }, }, }, } end if server.name == "pyright" then local a = require "plenary.async_lib" local async, await = a.async, a.await local defer_setup = async(function(fn) local defer_opts = vim.deepcopy(opts) local defer_server = vim.deepcopy(server) local name, python_bin = await(fn) if name ~= nil then defer_opts.settings = { python = { pythonPath = python_bin, }, } CURRENT_VENV = name end defer_opts.settings = { python = { analysis = { autoSearchPaths = true, diagnosticMode = "workspace", useLibraryCodeForTypes = true, }, }, } defer_server:setup(defer_opts) end) local function find_python_bin() local fname = vim.fn.expand "%:p" local root_files = { "pyproject.toml", "setup.py", "setup.cfg", "requirements.txt", "Pipfile", "pyrightconfig.json", } local root_dir = util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) or util.path.dirname(fname) if root_dir == nil then return end local poetry_file = Path:new(root_dir .. "/pyproject.toml") local pipenv_file = Path:new(root_dir .. "/Pipfile") local venv_dir = Path:new(root_dir .. "/.venv") if vim.env.VIRTUAL_ENV ~= nil then return "venv", vim.fn.exepath "python" elseif poetry_file:is_file() then if vim.fn.executable "poetry" ~= 1 then return end local toml_ok, toml = pcall(require, "toml") if not toml_ok then vim.notify( "lua-toml rocks not installed!\nlsp will disable poetry support for pyright.", vim.log.levels.WARN, { title = "lsp" } ) return end defer_setup(async(function() local read_ok, data = pcall(Path.read, poetry_file) if not read_ok then vim.notify( "Cannot read pyproject.toml!\nlsp will disable poetry support for pyright.", vim.log.levels.WARN, { title = "lsp" } ) return end local parse_ok, pyproject = pcall(toml.parse, data) if not parse_ok then vim.notify( "malformed toml format in pyproject.toml!\nlsp will disable poetry support for pyright.", vim.log.levels.WARN, { title = "lsp" } ) return end if pyproject.tool == nil or pyproject.tool.poetry == nil then return end local venv_path = vim.trim(vim.fn.system "poetry config virtualenvs.path") local venv_directory = vim.trim(vim.fn.system "poetry env list") if #vim.split(venv_directory, "\n") == 1 then return "poetry", string.format("%s/%s/bin/python", venv_path, vim.split(venv_directory, " ")[1]) end end)) elseif pipenv_file:is_file() then if vim.fn.executable "pipenv" ~= 1 then return end defer_setup(async(function() local venv_directory = vim.trim(vim.fn.system "pipenv --venv") if venv_directory:match "No virtualenv" ~= nil then return end return "pipenv", venv_directory .. "/bin/python" end)) elseif venv_dir:is_dir() then local venv_bin = Path:new(venv_dir:expand() .. "/bin/python") if not venv_bin:exists() or vim.fn.executable(venv_bin:expand()) ~= 1 then return end return "venv", venv_bin:expand() end end local name, python_bin = find_python_bin() if name == "defer" then return end if name ~= nil then opts.settings = { python = { pythonPath = python_bin, }, } CURRENT_VENV = name end opts.settings = { python = { analysis = { autoSearchPaths = true, diagnosticMode = "workspace", useLibraryCodeForTypes = true, }, }, } end if server.name == "tsserver" then opts.on_attach = function(client, bufnr) client.resolved_capabilities.document_formatting = false common_on_attach(client, bufnr) if O.typescript.on_save.organize_imports then require("events").nvim_create_autocmd { "BufWritePre", "<buffer>", "require'nvim-lsp-installer.extras.tsserver'.organize_imports(bufnr)", } end end end if server.name == "eslintls" then opts.on_attach = function(client, bufnr) client.resolved_capabilities.document_formatting = true common_on_attach(client, bufnr) end opts.settings = { format = { enable = true, }, } end if server.name == "denols" then opts.init_options = { enable = true, lint = true, unstable = true, importMap = "./import_map.json", codeLens = { implementations = true, references = true, }, } opts.settings = { deno = opts.init_options, } end if server.name == "sumneko_lua" then local lua_dev = require("lua-dev").setup {} opts.on_new_config = lua_dev.on_new_config opts.settings = lua_dev.settings end if server.name == "clangd" then opts.init_options = { clangdFileStatus = true, } end if server.name == "jdtls" then local jdtls_bin if vim.fn.has "mac" == 1 then jdtls_bin = "java-mac-ls" elseif vim.fn.has "unix" == 1 then jdtls_bin = "java-linux-ls" end local bundles = { vim.fn.glob( data_dir .. "/dapinstall/java/java-debug/com.microsoft.java.debug.plugin/target/com.microsoft.java.debug.plugin-*.jar" ), } vim.list_extend(bundles, vim.split(vim.fn.glob(data_dir .. "/dapinstall/java/java-test/server/*.jar"), "\n")) vim.list_extend( bundles, vim.split(vim.fn.glob(data_dir .. "/lsp_servers/jdtls/java-decompiler/server/*.jar"), "\n") ) local on_attach = function(client, bufnr) require("jdtls").setup_dap { hotcoderplace = "auto" } require("lsp").common_on_attach(client, bufnr) end local extendedClientCapabilities = require("jdtls").extendedClientCapabilities extendedClientCapabilities.resolveAdditionalTextEditsSupport = true require("jdtls").start_or_attach { before_init = function() vim.notify("Starting eclipse.jdt.ls, this take a while...", vim.log.levels.INFO, { title = "jdtls" }) end, cmd = { config_dir .. "/bin/" .. jdtls_bin }, on_attach = on_attach, capabilities = capabilities, root_dir = require("jdtls.setup").find_root { "build.gradle", "pom.xml", ".git" }, init_options = { bundles = bundles, extendedClientCapabilities = extendedClientCapabilities, }, flags = { allow_incremental_sync = true, }, settings = { java = { format = { enabled = O.java.format.enabled, settings = { url = config_dir .. "/lua/lsp/java/styles/" .. O.java.format.name .. ".xml", profile = O.java.format.profile, }, }, referenceCodeLens = O.java.codelens.references, implementationCodeLens = O.java.codelens.implementation, signatureHelp = { enabled = true, }, contentProvider = { preferred = "fernflower", }, completion = { favoriteStaticMembers = { "org.hamcrest.MatcherAssert.assertThat", "org.hamcrest.Matchers.*", "org.hamcrest.CoreMatchers.*", "org.junit.Assert.*", "org.junit.Assume.*", "org.junit.jupiter.api.Assertions.*", "org.junit.jupiter.api.Assumptions.*", "org.junit.jupiter.api.DynamicContainer.*", "org.junit.jupiter.api.DynamicTest.*", "java.util.Objects.requireNonNull", "java.util.Objects.requireNonNullElse", "org.mockito.Mockito.*", "org.mockito.ArgumentMatchers.*", "org.mockito.Answers.*", "org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*", "org.springframework.test.web.servlet.result.MockMvcResultMatchers.*", }, }, sources = { organizeImports = { starThreshold = 9999, staticStarThreshold = 9999, }, }, configuration = { runtimes = O.java.runtimes, updateBuildConfiguration = "automatic", }, autobuild = { enabled = O.java.autobuild, }, import = { gradle = { enabled = true, }, maven = { enabled = true, }, exclusions = { "**/node_modules/**", "**/.metadata/**", "**/archetype-resources", "**/META-INF/maven/**", "**/test/**", }, }, }, }, } return end server:setup(opts) vim.cmd [[ do User LspAttachBuffers ]] end) return { common_on_attach = common_on_attach }
require 'nnf' require 'inn' require 'cudnn' require 'gnuplot' cutorch.setDevice(2) dt = torch.load('pascal_2007_train.t7') if false then ds = nnf.DataSetPascal{image_set='train', datadir='/home/francisco/work/datasets/VOCdevkit', roidbdir='/home/francisco/work/datasets/rcnn/selective_search_data' } else ds = nnf.DataSetPascal{image_set='trainval', datadir='datasets/VOCdevkit', roidbdir='data/selective_search_data' } end if false then ds.roidb = {} for i=1,ds:size() do ds.roidb[i] = torch.IntTensor(10,4):random(1,5) ds.roidb[i][{{},{3,4}}]:add(6) end elseif false then ds.roidb = dt.roidb end local image_transformer= nnf.ImageTransformer{mean_pix={102.9801,115.9465,122.7717},--{103.939, 116.779, 123.68}, raw_scale = 255, swap = {3,2,1}} if true then bp = nnf.BatchProviderROI(ds) bp.image_transformer = image_transformer bp.bg_threshold = {0.1,0.5} bp:setupData() else bp = nnf.BatchProviderROI(ds) bp.image_transformer = image_transformer local temp = torch.load('pascal_2007_train_bp.t7') bp.bboxes = temp.bboxes end if false then local mytest = nnf.ROIPooling(50,50):float() function do_mytest() local input0,target0 = bp:getBatch(input0,target0) local o = mytest:forward(input0) return input0,target0,o end --input0,target0,o = do_mytest() end --------------------------------------------------------------------------------------- -- model --------------------------------------------------------------------------------------- do model = nn.Sequential() local features = nn.Sequential() local classifier = nn.Sequential() if false then features:add(nn.SpatialConvolutionMM(3,96,11,11,4,4,5,5)) features:add(nn.ReLU(true)) features:add(nn.SpatialConvolutionMM(96,128,5,5,2,2,2,2)) features:add(nn.ReLU(true)) features:add(nn.SpatialMaxPooling(2,2,2,2)) classifier:add(nn.Linear(128*7*7,1024)) classifier:add(nn.ReLU(true)) classifier:add(nn.Dropout(0.5)) classifier:add(nn.Linear(1024,21)) elseif false then require 'loadcaffe' -- local rcnnfold = '/home/francisco/work/libraries/rcnn/' -- local base_model = loadcaffe.load( -- rcnnfold..'model-defs/pascal_finetune_deploy.prototxt', -- rcnnfold..'data/caffe_nets/finetune_voc_2012_train_iter_70k', -- 'cudnn') local rcnnfold = '/home/francisco/work/libraries/caffe/examples/imagenet/' local base_model = loadcaffe.load( rcnnfold..'imagenet_deploy.prototxt', rcnnfold..'caffe_reference_imagenet_model', 'cudnn') for i=1,14 do features:add(base_model:get(i):clone()) end for i=17,22 do classifier:add(base_model:get(i):clone()) end classifier:add(nn.Linear(4096,21):cuda()) collectgarbage() else local fold = 'data/models/imagenet_models/alexnet/' local m1 = torch.load(fold..'features.t7') local m2 = torch.load(fold..'top.t7') for i=1,14 do features:add(m1:get(i):clone()) end features:get(3).padW = 1 features:get(3).padH = 1 features:get(7).padW = 1 features:get(7).padH = 1 for i=2,7 do classifier:add(m2:get(i):clone()) end local linear = nn.Linear(4096,21):cuda() linear.weight:normal(0,0.01) linear.bias:zero() classifier:add(linear) end collectgarbage() local prl = nn.ParallelTable() prl:add(features) prl:add(nn.Identity()) model:add(prl) --model:add(nnf.ROIPooling(6,6):setSpatialScale(1/16)) model:add(inn.ROIPooling(6,6):setSpatialScale(1/16)) model:add(nn.View(-1):setNumInputDims(3)) model:add(classifier) end print(model) model:cuda() parameters,gradParameters = model:getParameters() parameters2,gradParameters2 = model:parameters() lr = {0,0,1,2,1,2,1,2,1,2,1,2,1,2,1,2} wd = {0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0} local function updateGPlrwd(clr) local clr = clr or 1 for i,p in pairs(gradParameters2) do p:add(wd[i]*0.0005,parameters2[i]) p:mul(lr[i]*clr) end end optimState = {learningRate = 1,--1e-3, weightDecay = 0.000, momentum = 0.9, learningRateDecay = 0, dampening=0} -------------------------------------------------------------------------- -- training -------------------------------------------------------------------------- confusion_matrix = optim.ConfusionMatrix(21) model:training() savedModel = model:clone('weight','bias','running_mean','running_std') criterion = nn.CrossEntropyCriterion():cuda() --criterion.nll.sizeAverage = false --normalize = true display_iter = 20 --inputs = {torch.CudaTensor(),torch.FloatTensor()} inputs = {torch.CudaTensor(),torch.CudaTensor()} target = torch.CudaTensor() learningRate = 1e-3 function train() local err = 0 for i=1,display_iter do xlua.progress(i,display_iter) inputs0,target0 = bp:getBatch(inputs0,target0) inputs[1]:resize(inputs0[1]:size()):copy(inputs0[1]) inputs[2]:resize(inputs0[2]:size()):copy(inputs0[2]) target:resize(target0:size()):copy(target0) local batchSize = target:size(1) local feval = function(x) if x ~= parameters then parameters:copy(x) end gradParameters:zero() local outputs = model:forward(inputs) local f = criterion:forward(outputs,target) local df_do = criterion:backward(outputs,target) model:backward(inputs,df_do) -- mimic different learning rates per layer -- without the cost of having a huge tensor updateGPlrwd(learningRate) if normalize then gradParameters:div(batchSize) f = f/batchSize end confusion_matrix:batchAdd(outputs,target) return f,gradParameters end local x,fx = optim.sgd(feval,parameters,optimState) err = err + fx[1] end print('Training error: '..err/display_iter) return err/display_iter end epoch_size = math.ceil(ds:size()/bp.imgs_per_batch) stepsize = 30000--30000 print_step = 10 num_iter = 40000--40000 num_iter = num_iter/display_iter--3000 confusion_matrix:zero() train_err = {} exp_name = 'frcnn_t11' paths.mkdir(paths.concat('cachedir',exp_name)) --logger = optim.Logger(paths.concat('cachedir',exp_name,'train_err.log')) train_acc = {} for i=1,num_iter do if i%(stepsize/display_iter) == 0 then --optimState.learningRate = optimState.learningRate/10 learningRate = learningRate/10 end --print(('Iteration: %d/%d, lr: %.5f'):format(i,num_iter,optimState.learningRate)) print(('Iteration: %d/%d, lr: %.5f'):format(i,num_iter,learningRate)) local t_err = train() table.insert(train_err,t_err) if i%print_step == 0 then print(confusion_matrix) table.insert(train_acc,confusion_matrix.averageUnionValid*100) gnuplot.epsfigure(paths.concat('cachedir',exp_name,'train_err.eps')) gnuplot.plot('train',torch.Tensor(train_acc),'-') gnuplot.xlabel('Iterations (200 batch update)') gnuplot.ylabel('Training accuracy') gnuplot.grid('on') gnuplot.plotflush() gnuplot.closeall() confusion_matrix:zero() end if i%100 == 0 then torch.save(paths.concat('cachedir',exp_name..'.t7'),savedModel) end end -- test dsv = nnf.DataSetPascal{image_set='test', datadir='datasets/VOCdevkit', roidbdir='data/selective_search_data' } local fpv = {dataset=dsv} tester = nnf.Tester_FRCNN(model,fpv) tester.cachefolder = 'cachedir/'..exp_name tester:test(num_iter)
module( "GPM", package.seeall ) local file_Exists = file.Exists local type = type Loader = Loader or {} Packages = Packages or {} do local log = Logger( 'GPM' ) concommand.Add("gpm_list", function() for name, package in pairs( Packages ) do log:info( "{1} - {2}", package, package.description == "" and "No Description" or package.description ) end end) end local log = Logger( 'GPM.Loader' ) do local ErrorNoHaltWithStack = ErrorNoHaltWithStack local table_insert = table.insert local file_Find = file.Find local xpcall = xpcall local ipairs = ipairs local function getPackagesPathsFromDir( root ) local files, dirs = file_Find( Path( root, '*' ), 'LUA' ) local packages = {} for num, dir in ipairs( dirs ) do if file_Exists( Path( root, dir, 'package.lua' ), 'LUA' ) then table_insert( packages, Path( root, dir ) ) end end return packages end local getPackageFromPath do local AddCSLuaFile = AddCSLuaFile local CompileFile = CompileFile local setfenv = setfenv local assert = assert local Error = Error local pairs = pairs function getPackageFromPath( path ) local packageName = path:GetFileFromFilename() local filename = Path( path, 'package.lua' ) if file_Exists( filename, "LUA" ) then assert( CLIENT or file.Size( filename, "LUA" ) > 0, filename .. " is empty!" ) if (CLIENT) and (package.onlyserver == true) then return end if (SERVER) then AddCSLuaFile( filename ) if (package.onlyclient == true) then return end end local func = CompileFile( filename ) assert( type( func ) == "function", "Attempt to compile package " .. packageName .. " failed!" ) local env = {} setfenv( func, env ) local ok, data = pcall( func ) if (ok) then local package = {} if type( data ) == "table" then package = data else package = env end for key, value in pairs( package ) do package[ key:lower() ] = value end package.name = package.name or packageName package.root = path return Package( package ) end Error( "Package '" .. packageName .. "' сontains an error!" ) end Error( filename .. " not found!" ) end end do local roots = {} function Loader.Root( path ) table_insert( roots, path ) end local table_Merge = table.Merge function Loader.LoadPackages( root ) local dirs = {} local packages = {} if (root == nil) then for num, root in ipairs( roots ) do log:info( 'Resolving packages from "{1}"...', root ) dirs = table_Merge( dirs, getPackagesPathsFromDir( root ) ) end else log:info( 'Resolving packages from "{1}"...', root ) dirs = getPackagesPathsFromDir( root ) end for num, dir in ipairs( dirs ) do local ok, package = xpcall( getPackageFromPath, function( err ) log:error( 'failed to load package from "{1}":', dir ) ErrorNoHaltWithStack( err ) end, dir ) if ok then table_insert( packages, package ) end end return packages end end function Loader.ResolvePackages( packages, noRegister ) CheckType( packages, 1, 'table', 3 ) -- Adding packages to registry local registry = not noRegister and Packages or {} for num, pkg in ipairs( packages ) do if registry[ pkg.name ] then log:warn( 'Package {1} already existing. Replacing with new package {2}.', registry[ pkg.name ], pkg ) end registry[ pkg.name ] = pkg end for num, pkg in ipairs( packages ) do Loader.ResolvePackage( pkg, noRegister and registry ) end end end local resolveDependencies local resolvePeerDependencies local resolveOptionalDependencies do local pairs = pairs function resolveDependencies( pkg, packages ) if not pkg.dependencies then return true end log:debug( 'resolving dependencies for package {1}', pkg ) for name, rule in pairs( pkg.dependencies ) do local dependency = Loader.FindPackage( name, packages ) if not dependency then pkg.state = 'failed' log:error( 'dependency {1} not found for package {2}.', name, pkg ) return false end -- Checking if found version of the dependency matches with rule if not (dependency.version % rule) then pkg.state = 'failed' log:error( 'dependency {1} not matches with package {2} specified version', dependency, pkg ) return false end --Circular dependency protection if (dependency.state == 'resolving') or (dependency.state == 'running') then pkg.state = 'failed' log:error( 'package {1} dependency {2} already resolving or running. Maybe we have circular dependency', pkg, dependency ) return false end local ok = Loader.ResolvePackage( dependency, packages ) if not ok then pkg.state = 'failed' log:error( 'failed to resolve dependency {1} for package {2}', dependency, pkg ) return false end end return true end function resolvePeerDependencies(pkg, packages) if not pkg.peerDependencies then return true end log:debug( 'resolving peerDependencies for package {1}', pkg ) for name, rule in pairs( pkg.peerDependencies ) do local dependency = Loader.FindPackage( name, packages ) if not dependency then -- Ignore if package not installed continue end -- Checking if found version of the dependency matches with rule if not (dependency.version % rule) then pkg.state = 'failed' log:error( 'peerDependency {1} not matches with package {2} specified version', dependency, pkg ) return false end --Circular dependency protection if (dependency.state == 'resolving') or (dependency.state == 'running') then pkg.state = 'failed' log:error( 'package {1} peerDependency {2} already resolving or running. Maybe we have circular dependency', pkg, dependency ) return false end local ok = Loader.ResolvePackage( dependency, packages ) if not ok then pkg.state = 'failed' log:error( 'failed to resolve peerDependency {1} for package {2}', dependency, pkg ) return false end end return true end function resolveOptionalDependencies(pkg, packages) if not pkg.optionalDependencies then return true end log:debug( 'resolving optionalDependencies for package {1}', pkg ) for name, rule in pairs( pkg.optionalDependencies ) do local dependency = Loader.FindPackage( name, packages ) if not dependency then -- ignore if package not found continue end -- Checking if found version of the dependency matches with rule if not (dependency.version % rule) then -- ignore if package not matches with specified version continue end --Circular dependency protection if (dependency.state == 'resolving') or (dependency.state == 'running') then pkg.state = 'failed' log:error( 'optionalDependency {2} of package {1} already resolving or running. Maybe we have circular dependency', pkg, dependency ) return false end local ok = Loader.ResolvePackage( dependency, packages ) if not ok then log:warn( 'optionalDependency {1} of package {2} found, but not resolved. Skipping...', dependency, pkg ) end end return true end function Loader.FindPackage( name, packages ) if type( name ) ~= "string" then return end if type( packages ) == "table" then for pkg_name, pkg_info in pairs( packages ) do if (pkg_name == name) then log:debug( 'found package {1} in custom registry', pkg_info ) return pkg_info end end end for pkg_name, pkg_info in pairs( Packages ) do if (pkg_name == name) then log:debug( 'found package {1} in global registry', pkg_info ) return pkg_info end end log:debug( 'package {1} not found', name ) end end function Loader.RunPackage( pkg ) if not pkg.root then pkg.state = 'failed' log:error( 'package with unknown root? i do not know how to run package.' ) return false end local main = pkg.main or 'main.lua' local path if file_Exists( Path( pkg.root, main ), 'LUA' ) then path = Path( pkg.root, main ) elseif (main ~= 'main.lua') and file_Exists( main, 'LUA' ) then path = main else pkg.state = 'failed' log:error( 'cannot find {1} package main "{2}" (file does not exist)', pkg, main ) return false end if (pkg.state ~= 'resolved') then log:warn( 'package {1} not resolved, some dependencies may be missed.', pkg ) end pkg.state = 'running' -- PrintTable( pkg ) local ok, err = false, nil if (pkg.onlyserver == true) then ok, err = SV( path ) elseif (pkg.onlyclient == true) then ok, err = CL( path ) else ok, err = SH( path ) end if not ok then pkg.state = 'failed' log:error( '{1} package run error:\n{2}', pkg, err ) return false end pkg.state = 'started' return true end function Loader.ResolvePackage( pkg, packages ) if (pkg.state == 'loaded') then log:debug( 'package {1} already loaded.', pkg ) return true end if (pkg.onlyserver == true) and (CLIENT) then return end pkg.state = 'resolving' local ok = resolveDependencies( pkg, packages ) and resolvePeerDependencies( pkg, packages ) and resolveOptionalDependencies( pkg, packages ) if not ok then pkg.state = 'failed' log:error( 'failed to resolve dependencies of {1} package', pkg ) return false end pkg.state = 'resolved' ok = Loader.RunPackage( pkg ) if (ok) then pkg.state = 'loaded' log:info( '{1} loaded.', pkg ) end return ok end function Loader.ResolveAllPackages( noRegister ) return Loader.ResolvePackages( Loader.LoadPackages(), noRegister ) end
local cmdline = require('vfiler/libs/cmdline') local config = require('vfiler/fzf/config') local core = require('vfiler/libs/core') local vim = require('vfiler/libs/vim') local VFiler = require('vfiler/vfiler') local M = {} local function fzf_options() local configs = config.configs local options = vim.dict({}) options.options = '' -- Layout if configs.layout then for key, value in pairs(configs.layout) do if type(value) == 'table' then options[key] = vim.dict(value) else options[key] = value end end end -- Action if configs.action then local keys = {} for key, _ in pairs(configs.action) do -- skip default (enter) key if key ~= 'default' then table.insert(keys, key) end end if #keys > 0 then local expect = '--expect=' .. table.concat(keys, ',') options.options = options.options .. expect end end -- Fzf options if configs.options then local ops = table.concat(configs.options, ' ') options.options = options.options .. ' ' .. ops end return options end local function get_current_dirpath(view) local item = view:get_item() local path = item.isdirectory and item.path or item.parent.path local slash = '/' if core.is_windows and not vim.get_option('shellslash') then slash = '\\' end return path:gsub('[/\\]', slash) end local function input_pattern() return cmdline.input('Pattern?') end ------------------------------------------------------------------------------ -- Internal interfaces function M._sink(key, condidate) local action = config.configs.action[key] if not action then core.message.error('No action has been set for "configs.action".') return end local path = core.path.normalize(condidate) if type(action) == 'string' then vim.command(action .. ' ' .. path) elseif type(action) == 'function' then local current = VFiler.get() current:do_action(function(filer, context, view) action(filer, context, view, path) end) else core.message.error('Action "%s" is no supported.', key) end end ------------------------------------------------------------------------------ -- Actions -- --- fzf Ag function M.ag(vfiler, context, view) if vim.fn.executable('ag') == 0 then core.message.error('Not found "ag" command.') return end local pattern = input_pattern() if pattern == '' then return end local fzf_opts = fzf_options() local dirpath = get_current_dirpath(view) vim.fn['vfiler#fzf#ag'](dirpath, fzf_opts) end --- fzf Grep function M.grep(vfiler, context, view) if vim.fn.executable('grep') == 0 then core.message.error('Not found "grep" command.') return end local pattern = input_pattern() if pattern == '' then return end local fzf_opts = fzf_options() local dirpath = get_current_dirpath(view) vim.fn['vfiler#fzf#grep'](dirpath, fzf_opts) end --- fzf Files function M.files(vfiler, context, view) local fzf_opts = fzf_options() local dirpath = get_current_dirpath(view) vim.fn['vfiler#fzf#files'](dirpath, fzf_opts) end --- fzf Rg function M.rg(vfiler, context, view) if vim.fn.executable('rg') == 0 then core.message.error('Not found "rg" command.') return end local pattern = input_pattern() if pattern == '' then return end local fzf_opts = fzf_options() local dirpath = get_current_dirpath(view) vim.fn['vfiler#fzf#rg'](dirpath, fzf_opts) end return M
local ok=require("test").ok local Num=require("Num") local lib=require("lib") ok {numOkay = function( n,t) n = Num:new() t = {4,10,15,38,54,57,62,83,100,100,174,190,215,225, 233,250,260,270,299,300,306,333,350,375,443,475, 525,583,780,1000} n:incs(t) assert(lib.close(n.mu, 270.3, 0.001)) assert(lib.close(n:sd(), 231.946, 0.001)) end} ok {numIncOkay = function ( n) local mu, sd, n = {}, {}, Num:new() local t={4,10,15,38,54,57,62,83,100,100,174,190,215,225, 233,250,260,270,299,300,306,333,350,375,443,475, 525,583,780,1000} for i=1,#t do n:inc( t[i] ) mu[i], sd[i] = n.mu, n:sd() end for i=#t,1,-1 do if i>2 then assert(lib.close( mu[i] , n.mu, 0.01)) assert(lib.close( sd[i] , n:sd(), 0.01)) n:dec( t[i] ) end end end}
_G.StorySystem = CSystem:Create("StorySystem"); StorySystem.objScene = nil; --story scene StorySystem.cfgStory = nil; --current story config StorySystem.tbTimeActors = {}; --有TimeEvent事件的Actor function StorySystem:Create() end function StorySystem:OnEnterScene(bEditorMode) if bEditorMode then -- Game:InitMainCamera(); -- self:Play(Game:GetStoryScriptID()); self:Play(1001); end end function StorySystem:Update() local dwNow = GetTime(); for i, objActor in pairs(self.tbTimeActors) do objActor:Update(dwNow); end end --基本函数 function StorySystem:GetStory() return self.cfgStory; end function StorySystem:Play(dwStoryID) print("StorySystem:Play:", dwStoryID); self.cfgStory = self:LoadScript(dwStoryID); if self.cfgStory == nil then return end -- self.cfgStory:SetStoryID(dwStoryID); -- self:PushState(); -- UIStory:Create(); -- local objMainActor = self:CPMainPlayer(); local b,info = pcall(self.cfgStory.OnStoryStart,self.cfgStory, "123"); if b == false then warn("StorySystem Play Failed "..info); self:Stop(); end end function StorySystem:Stop() print("StorySystem:Stop:......") self.tbTimeActors = {}; if self.cfgStory == nil then return end -- self:PopState(); self.cfgStory = nil; -- _System:GarbageCollect(); end --private function StorySystem:LoadScript(dwStoryID) local szScriptName = string.format("StoryScript_%d",dwStoryID); if _G[szScriptName] == nil then local szFile = string.format("ScriptConfig/StoryConfig/%s.lua",szScriptName); dofile(szFile) end return _G[szScriptName]; end --[[ function StorySystem:PushState() UIManager:PushState("Story"); -- UIManager:MakeDefault(); Input:PushState(); Game:GetScene():PushRenderSetting(); UITipManager:Hide(); local objMainCamera = Game:GetMainCamera(); objMainCamera:SavePoint(); objMainCamera:LookTarget(); Game:AddExtraCamera("MainCamera-juqing") self.cfgStory.objMainCamera = Game:GetExtraCamera(); self.cfgStory.objMainCamera.type = 1; self:DoEvent("OnStartStoryPlay"); if _G["CCommandMgr"] then self.actionFn = CCommandMgr:PauseMainActCommond() Game:StopEffectType(Player, "JN/"); local objMagicWp = Player:GetMagicWeapon(); if objMagicWp ~= nil then Game:StopEffectType(objMagicWp, "Fabao/"); end end Input:AddKeyboardListener(function(dwKeyCode, dwKeyDown) if dwKeyCode == KeyCode.Escape then self:Stop(); return end end); if self.cfgStory:bNewScene() then Game:GetScene():HideAll(); end self.objScene = Game:CreateScene(); end function StorySystem:PopState() --还原场景 if self.cfgStory:bNewScene() then Game:GetScene():ShowAll(); end Game:DestroyScene(self.objScene); self.objScene = nil; -- Game:GetScene():PopRenderSetting(); UIManager:PopState(); Input:PopState(); UIStory:ShowInfo(" ", " "); Game:RemoveExtraCamera("MainCamera-juqing") if self.actionFn then self.actionFn(); self.actionFn = nil; end local objCamera = Game:GetMainCamera(); if objCamera then objCamera:BackPoint(); end self:DoEvent("OnEndStoryPlay", self.taskID); end --创建剧情动画中的角色 --角色名称 --角色的骨骼文件 --x,y,z 角色初始化坐标位置 --fDir, 角色初始化朝向 function StorySystem:CActor(name,szSkeleton,x,y,z,fDir) local objActor = self:GetEntity(name); if objActor then self:DActor(objActor); end objActor = self.objScene:CreateActor(name,szSkeleton); if objActor == nil then return end objActor.type = ActorType.Monster; StoryActor:Init(objActor); if x and y and z then objActor:SetLocalPosition(x,y,z); end if fDir then objActor:SetLocalRotate(0,fDir,0); end return objActor; end --删除角色 --name 可以是角色的对象,也可以是创建时的名称 function StorySystem:DActor(name,fDelay) if name == nil then return end local objActor = self:GetEntity(name); if objActor == nil then return end self.tbTimeActors[objActor:GetID()] = nil; return self.objScene:RemoveActor(objActor,fDelay); end function StorySystem:GetEntity(name) local dwID = 0; if type(name) == "string" then dwID = Game:GetStringHash(name); else dwID = name; end return self.objScene:GetEntity(dwID); end function StorySystem:CPlayer(name,cfgPlayer,x,y,z,fDir) local objActor = self:CActor(name,cfgPlayer.skeleton,x,y,z,fDir); if objActor == nil then return end return objActor; end --创建剧情动画中的虚拟对象,用于定位虚拟空间 --角色名称 --szSkeleton为了保持与CActor参数统一,无作用 --x,y,z 虚拟对象初始化坐标位置 --fDir, 虚拟对象初始化朝向 function StorySystem:CEmpty(name,szSkeleton,x,y,z,fDir) local objActor = self:GetEntity(name); if objActor then self:DActor(objActor); end objActor = self.objScene:CreateEmptyObject(name); if objActor == nil then return end objActor.type = ActorType.Entity; StoryActor:Init(objActor); if x and y and z then objActor:SetLocalPosition(x,y,z); end if fDir then objActor:SetLocalRotate(0,fDir,0); end return objActor; end; --------------------------------------------------- function StorySystem:GetScene() return self.objScene; end --private function StorySystem:AddTimeActor(objActor) self.tbTimeActors[objActor:GetID()] = objActor; end --private function StorySystem:RemoveTimeActor(objActor) if not objActor then return end; objActor:RemoveEvent(); self.tbTimeActors[objActor:GetID()] = nil; end --]]
resource_manifest_version "44febabe-d386-4d18-afbe-5e627f4af937" server_script "GHMattiMySQL.net.dll"
local K, C = unpack(select(2, ...)) local _G = _G local math_ceil = _G.math.ceil local math_floor = _G.math.floor local print = _G.print local string_find = _G.string.find local string_format = _G.string.format local string_split = _G.string.split local table_wipe = _G.table.wipe local tostring = _G.tostring local C_ChatInfo_RegisterAddonMessagePrefix = _G.C_ChatInfo.RegisterAddonMessagePrefix local C_ChatInfo_SendAddonMessage = _G.C_ChatInfo.SendAddonMessage local DESCRIPTION = _G.DESCRIPTION local EJ_GetCurrentTier = _G.EJ_GetCurrentTier local EJ_GetEncounterInfoByIndex = _G.EJ_GetEncounterInfoByIndex local EJ_GetInstanceInfo = _G.EJ_GetInstanceInfo local EJ_SelectInstance = _G.EJ_SelectInstance local EnumerateFrames = _G.EnumerateFrames local GetInstanceInfo = _G.GetInstanceInfo local GetScreenHeight = _G.GetScreenHeight local GetScreenWidth = _G.GetScreenWidth local GetSpellDescription = _G.GetSpellDescription local GetSpellInfo = _G.GetSpellInfo local GetSpellTexture = _G.GetSpellTexture local IsInGuild = _G.IsInGuild local IsInRaid = _G.IsInRaid local MouseIsOver = _G.MouseIsOver local NAME = _G.NAME local SlashCmdList = _G.SlashCmdList local UNKNOWN = _G.UNKNOWN local UnitGUID = _G.UnitGUID local UnitName = _G.UnitName -- KkthnxUI DevTools: -- /getenc, get selected encounters info -- /getid, get instance id -- /getnpc, get npc name and id -- /kf, get frame names -- /kg, show grid on WorldFrame -- /ks, get spell name and description -- /kt, get gametooltip names K.Devs = { ["Kthnx-Arena 52"] = true, } local function isDeveloper() return K.Devs[K.Name.."-"..K.Realm] end K.isDeveloper = isDeveloper() -- Commands SlashCmdList["KKTHNXUI_ENUMTIP"] = function() local enumf = EnumerateFrames() while enumf do if (enumf:GetObjectType() == "GameTooltip" or string_find((enumf:GetName() or ""):lower(), "tip")) and enumf:IsVisible() and enumf:GetPoint() then print(enumf:GetName()) end enumf = EnumerateFrames(enumf) end end _G.SLASH_KKTHNXUI_ENUMTIP1 = "/gettip" _G.SLASH_KKTHNXUI_ENUMTIP2 = "/gettooltip" SlashCmdList["KKTHNXUI_ENUMFRAME"] = function() local frame = EnumerateFrames() local chatModule = K:GetModule("Chat") while frame do if (frame:IsVisible() and MouseIsOver(frame)) then print(frame:GetName() or string_format(UNKNOWN..": [%s]", tostring(frame))) chatModule:ChatCopy_OnClick("LeftButton") end frame = EnumerateFrames(frame) end end _G.SLASH_KKTHNXUI_ENUMFRAME1 = "/getframe" SlashCmdList["KKTHNXUI_DUMPSPELL"] = function(arg) local name = GetSpellInfo(arg) if not name then print("Please enter a spell name --> /getspell SPELLNAME") return end local des = GetSpellDescription(arg) print(K.InfoColor.."------------------------") print(" \124T"..GetSpellTexture(arg)..":16:16:::64:64:5:59:5:59\124t", K.InfoColor..arg) print(NAME, K.InfoColor..(name or "nil")) print(DESCRIPTION, K.InfoColor..(des or "nil")) print(K.InfoColor.."------------------------") end _G.SLASH_KKTHNXUI_DUMPSPELL1 = "/getspell" SlashCmdList["INSTANCEID"] = function() local name, _, _, _, _, _, _, id = GetInstanceInfo() print(name, id) end _G.SLASH_INSTANCEID1 = "/getinstance" SlashCmdList["KKTHNXUI_NPCID"] = function() local name = UnitName("target") local guid = UnitGUID("target") if name and guid then local npcID = K.GetNPCID(guid) print(name, K.InfoColor..(npcID or "nil")) end end _G.SLASH_KKTHNXUI_NPCID1 = "/getnpc" SlashCmdList["KKTHNXUI_GETFONT"] = function(msg) local font = _G[msg] if not font then print(msg, "not found.") return end local a, b, c = font:GetFont() print(msg,a,b,c) end _G.SLASH_KKTHNXUI_GETFONT1 = "/getfont" do local versionList = {} C_ChatInfo_RegisterAddonMessagePrefix("KKUI_VersonCheck") local function PrintVerCheck() print("------------------------") for name, version in pairs(versionList) do print(name.." "..version) end end local function SendVerCheck(channel) table_wipe(versionList) C_ChatInfo_SendAddonMessage("KKUI_VersonCheck", "VersionCheck", channel) C_Timer.After(3, PrintVerCheck) end local function VerCheckListen(_, ...) local prefix, msg, distType, sender = ... if prefix == "KKUI_VersonCheck" then if msg == "VersionCheck" then C_ChatInfo_SendAddonMessage("KKUI_VersonCheck", "MyVer-"..K.Version, distType) elseif string_find(msg, "MyVer") then local _, version = string_split("-", msg) versionList[sender] = version.." - "..distType end end end K:RegisterEvent("CHAT_MSG_ADDON", VerCheckListen) SlashCmdList["KKTHNXUI_VER_CHECK"] = function(msg) local channel if IsInRaid() then channel = "RAID" elseif IsInGuild() and not IsInGroup() then channel = "GUILD" elseif IsInGroup() then channel = "PARTY" end if msg ~= "" then channel = msg end if channel then SendVerCheck(channel) end end _G.SLASH_KKTHNXUI_VER_CHECK1 = "/kkver" end SlashCmdList["KKTHNXUI_GET_ENCOUNTERS"] = function() if not _G.EncounterJournal then return end local tierID = EJ_GetCurrentTier() local instID = _G.EncounterJournal.instanceID EJ_SelectInstance(instID) local instName = EJ_GetInstanceInfo() print(" ") print("TIER = "..tierID) print("INSTANCE = "..instID.." -- "..instName) print("BOSS") print(" ") local i = 0 while true do i = i + 1 local name, _, boss = EJ_GetEncounterInfoByIndex(i) if not name then return end print("BOSS = "..boss.." -- "..name) end end _G.SLASH_KKTHNXUI_GET_ENCOUNTERS1 = "/getencounter" -- Inform us of the patch info we play on. SlashCmdList["WOWVERSION"] = function() print(K.InfoColor.."------------------------") K.Print("Build: ", K.WowBuild) K.Print("Released: ", K.WowRelease) K.Print("Interface: ", K.TocVersion) print(K.InfoColor.."------------------------") end _G.SLASH_WOWVERSION1 = "/getpatch" _G.SLASH_WOWVERSION2 = "/getbuild" _G.SLASH_WOWVERSION3 = "/getinterface" -- Grids local grid local boxSize = 32 local function Grid_Create() grid = CreateFrame("Frame", nil, UIParent) grid.boxSize = boxSize grid:SetAllPoints(UIParent) local size = 2 local width = GetScreenWidth() local ratio = width / GetScreenHeight() local height = GetScreenHeight() * ratio local wStep = width / boxSize local hStep = height / boxSize for i = 0, boxSize do local tx = grid:CreateTexture(nil, "BACKGROUND") if i == boxSize / 2 then tx:SetColorTexture(1, 0, 0, .5) else tx:SetColorTexture(0, 0, 0, .5) end tx:SetPoint("TOPLEFT", grid, "TOPLEFT", i * wStep - (size / 2), 0) tx:SetPoint("BOTTOMRIGHT", grid, "BOTTOMLEFT", i * wStep + (size / 2), 0) end height = GetScreenHeight() do local tx = grid:CreateTexture(nil, "BACKGROUND") tx:SetColorTexture(1, 0, 0, .5) tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height / 2) + (size / 2)) tx:SetPoint("BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height / 2 + size / 2)) end for i = 1, math_floor((height / 2) / hStep) do local tx = grid:CreateTexture(nil, "BACKGROUND") tx:SetColorTexture(0, 0, 0, .5) tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height / 2 + i * hStep) + (size / 2)) tx:SetPoint("BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height / 2 + i * hStep + size / 2)) tx = grid:CreateTexture(nil, "BACKGROUND") tx:SetColorTexture(0, 0, 0, .5) tx:SetPoint("TOPLEFT", grid, "TOPLEFT", 0, -(height / 2 - i * hStep) + (size / 2)) tx:SetPoint("BOTTOMRIGHT", grid, "TOPRIGHT", 0, -(height / 2 - i * hStep + size / 2)) end end local function Grid_Show() if not grid then Grid_Create() elseif grid.boxSize ~= boxSize then grid:Hide() Grid_Create() else grid:Show() end end local isAligning = false SlashCmdList["KKUI_TOGGLEGRID"] = function(arg) if isAligning or arg == "1" then if grid then grid:Hide() end isAligning = false else boxSize = (math_ceil((tonumber(arg) or boxSize) / 32) * 32) if boxSize > 256 then boxSize = 256 end Grid_Show() isAligning = true end end _G.SLASH_KKUI_TOGGLEGRID1 = "/showgrid" _G.SLASH_KKUI_TOGGLEGRID2 = "/align" _G.SLASH_KKUI_TOGGLEGRID3 = "/grid" -- Test UnitFrames (ShestakUI) local moving = false SlashCmdList.TEST_UF = function() if InCombatLockdown() then print("|cffffff00"..ERR_NOT_IN_COMBAT.."|r") return end if not moving then for _, frames in pairs({"oUF_Target", "oUF_TargetTarget", "oUF_Pet", "oUF_Focus", "oUF_FocusTarget"}) do if _G[frames] then _G[frames].oldunit = _G[frames].unit _G[frames]:SetAttribute("unit", "player") end end if C["Arena"].Enable then for i = 1, 5 do _G["oUF_Arena"..i].oldunit = _G["oUF_Arena"..i].unit _G["oUF_Arena"..i].Trinket.Hide = K.Noop _G["oUF_Arena"..i].Trinket.Icon:SetTexture("Interface\\Icons\\INV_Jewelry_Necklace_37") _G["oUF_Arena"..i]:SetAttribute("unit", "player") end end if C["Boss"].Enable then for i = 1, MAX_BOSS_FRAMES do _G["oUF_Boss"..i].oldunit = _G["oUF_Boss"..i].unit _G["oUF_Boss"..i]:SetAttribute("unit", "player") end end moving = true else for _, frames in pairs({"oUF_Target", "oUF_TargetTarget", "oUF_Pet", "oUF_Focus", "oUF_FocusTarget"}) do if _G[frames] then _G[frames].unit = _G[frames].oldunit _G[frames]:SetAttribute("unit", _G[frames].unit) end end if C["Arena"].Enable then for i = 1, 5 do _G["oUF_Arena"..i].Trinket.Hide = nil _G["oUF_Arena"..i].unit = _G["oUF_Arena"..i].oldunit _G["oUF_Arena"..i]:SetAttribute("unit", _G["oUF_Arena"..i].unit) end end if C["Boss"].Enable then for i = 1, MAX_BOSS_FRAMES do _G["oUF_Boss"..i].unit = _G["oUF_Boss"..i].oldunit _G["oUF_Boss"..i]:SetAttribute("unit", _G["oUF_Boss"..i].unit) end end moving = false end end SLASH_TEST_UF1 = "/testui"
--InputBindings.lua --[[ File used to map keys to input actions via lua Will read mappings from this file if UseLuaInputs is set to true ]] UseLuaInputs = false InputBindings = { JUMP="SPACE", SPRINT="LSHIFT", MOVE_FORWARD="W", MOVE_LEFT="A", MOVE_RIGHT="D", MOVE_BACKWARD="S", CROUCH="LCTRL", ACTION_1="E", ACTION_2="K", ACTION_3="M", ACTION_4="B" }
-- Generated By protoc-gen-lua Do not Edit local protobuf = require "protobuf" module('BseJoinGuild_pb', package.seeall) local BSEJOINGUILD = protobuf.Descriptor(); local BSEJOINGUILD_GUILDID_FIELD = protobuf.FieldDescriptor(); local BSEJOINGUILD_GUILDNAME_FIELD = protobuf.FieldDescriptor(); local BSEJOINGUILD_RESULT_FIELD = protobuf.FieldDescriptor(); local BSEJOINGUILD_GUILDINFO_FIELD = protobuf.FieldDescriptor(); BSEJOINGUILD_GUILDID_FIELD.name = "guildID" BSEJOINGUILD_GUILDID_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseJoinGuild.guildID" BSEJOINGUILD_GUILDID_FIELD.number = 1 BSEJOINGUILD_GUILDID_FIELD.index = 0 BSEJOINGUILD_GUILDID_FIELD.label = 1 BSEJOINGUILD_GUILDID_FIELD.has_default_value = false BSEJOINGUILD_GUILDID_FIELD.default_value = 0 BSEJOINGUILD_GUILDID_FIELD.type = 5 BSEJOINGUILD_GUILDID_FIELD.cpp_type = 1 BSEJOINGUILD_GUILDNAME_FIELD.name = "guildName" BSEJOINGUILD_GUILDNAME_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseJoinGuild.guildName" BSEJOINGUILD_GUILDNAME_FIELD.number = 2 BSEJOINGUILD_GUILDNAME_FIELD.index = 1 BSEJOINGUILD_GUILDNAME_FIELD.label = 1 BSEJOINGUILD_GUILDNAME_FIELD.has_default_value = false BSEJOINGUILD_GUILDNAME_FIELD.default_value = "" BSEJOINGUILD_GUILDNAME_FIELD.type = 9 BSEJOINGUILD_GUILDNAME_FIELD.cpp_type = 9 BSEJOINGUILD_RESULT_FIELD.name = "result" BSEJOINGUILD_RESULT_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseJoinGuild.result" BSEJOINGUILD_RESULT_FIELD.number = 3 BSEJOINGUILD_RESULT_FIELD.index = 2 BSEJOINGUILD_RESULT_FIELD.label = 1 BSEJOINGUILD_RESULT_FIELD.has_default_value = false BSEJOINGUILD_RESULT_FIELD.default_value = 0 BSEJOINGUILD_RESULT_FIELD.type = 5 BSEJOINGUILD_RESULT_FIELD.cpp_type = 1 BSEJOINGUILD_GUILDINFO_FIELD.name = "guildInfo" BSEJOINGUILD_GUILDINFO_FIELD.full_name = ".com.xinqihd.sns.gameserver.proto.BseJoinGuild.guildInfo" BSEJOINGUILD_GUILDINFO_FIELD.number = 4 BSEJOINGUILD_GUILDINFO_FIELD.index = 3 BSEJOINGUILD_GUILDINFO_FIELD.label = 1 BSEJOINGUILD_GUILDINFO_FIELD.has_default_value = false BSEJOINGUILD_GUILDINFO_FIELD.default_value = nil BSEJOINGUILD_GUILDINFO_FIELD.message_type = GUILDINFO_PB_GUILDINFO BSEJOINGUILD_GUILDINFO_FIELD.type = 11 BSEJOINGUILD_GUILDINFO_FIELD.cpp_type = 10 BSEJOINGUILD.name = "BseJoinGuild" BSEJOINGUILD.full_name = ".com.xinqihd.sns.gameserver.proto.BseJoinGuild" BSEJOINGUILD.nested_types = {} BSEJOINGUILD.enum_types = {} BSEJOINGUILD.fields = {BSEJOINGUILD_GUILDID_FIELD, BSEJOINGUILD_GUILDNAME_FIELD, BSEJOINGUILD_RESULT_FIELD, BSEJOINGUILD_GUILDINFO_FIELD} BSEJOINGUILD.is_extendable = false BSEJOINGUILD.extensions = {} BseJoinGuild = protobuf.Message(BSEJOINGUILD) _G.BSEJOINGUILD_PB_BSEJOINGUILD = BSEJOINGUILD
-- Created by Elfansoer --[[ Ability checklist (erase if done/checked): - Scepter Upgrade - Break behavior - Linken/Reflect behavior - Spell Immune/Invulnerable/Invisible behavior - Illusion behavior - Stolen behavior ]] -------------------------------------------------------------------------------- modifier_primal_beast_pulverize_lua = class({}) -------------------------------------------------------------------------------- -- Classifications function modifier_primal_beast_pulverize_lua:IsHidden() return false end function modifier_primal_beast_pulverize_lua:IsDebuff() return false end function modifier_primal_beast_pulverize_lua:IsPurgable() return false end -------------------------------------------------------------------------------- -- Initializations function modifier_primal_beast_pulverize_lua:OnCreated( kv ) if not IsServer() then return end end function modifier_primal_beast_pulverize_lua:OnRefresh( kv ) end function modifier_primal_beast_pulverize_lua:OnRemoved() end function modifier_primal_beast_pulverize_lua:OnDestroy() end -------------------------------------------------------------------------------- -- Modifier Effects function modifier_primal_beast_pulverize_lua:DeclareFunctions() local funcs = { MODIFIER_PROPERTY_DISABLE_TURNING, } return funcs end function modifier_primal_beast_pulverize_lua:GetModifierDisableTurning() return 1 end
return { "_CRT_SECURE_NO_WARNINGS", "_SCL_SECURE_NO_WARNINGS", "BOOST_ALL_NO_LIB", }
MousePressed = class("MousePressed") function MousePressed:initialize(x, y, button) self.button = button self.y = y self.x = x end
local tab = { }; tab.Name = "Jump Boots"; tab.Desc = "Lets you jump higher."; tab.Ingredients = { "metal", "circuitry", "circuitry", "fuel" }; tab.JumpMul = 3.5; tab.OnJump = function( ply ) if( SERVER ) then ply:EmitSound( Sound( "ambient/machines/machine1_hit" .. math.random( 1, 2 ) .. ".wav" ), 80, math.random( 90, 110 ) ); net.Start( "nJumpBoots" ); net.WriteEntity( ply ); net.SendPVS( ply:GetPos() ); end end if( CLIENT ) then net.Receive( "nJumpBoots", function( len ) local ply = net.ReadEntity(); local ed = EffectData(); ed:SetEntity( ply ); ed:SetNormal( Vector( 0, 0, -1 ) ); ed:SetMagnitude( 0 ); util.Effect( "nss_rocket", ed ); end ); else util.AddNetworkString( "nJumpBoots" ); end EXPORTS["jumpboots"] = tab;
local LOM = assert(require("lxp.lom"), "LuaExpat doesn't seem to be installed. feedparser kind of needs it to work...") local XMLElement = require "feedparser.XMLElement" local dateparser = require "feedparser.dateparser" local URL = require "feedparser.url" local tinsert, tremove, tconcat = table.insert, table.remove, table.concat local pairs, ipairs = pairs, ipairs --- feedparser, similar to the Universal Feed Parser for python, but a good deal weaker. -- see http://feedparser.org for details about the Universal Feed Parser local feedparser= { _DESCRIPTION = "RSS and Atom feed parser", _VERSION = "feedparser 0.71" } local blanky = XMLElement.new() --useful in a whole bunch of places local function resolve(url, base_url) return URL.absolute(base_url, url) end local function rebase(el, base_uri) local xml_base = el:getAttr('xml:base') if not xml_base then return base_uri end return resolve(xml_base, base_uri) end local function parse_entries(entries_el, format_str, base) local entries = {} for i, entry_el in ipairs(entries_el) do local entry = {enclosures={}, links={}, contributors={}} local entry_base = rebase(entry_el, base) for i, el in ipairs(entry_el:getChildren('*')) do local tag = el:getTag() local el_base = rebase(el, entry_base) --title if tag == 'title' or tag == 'dc:title' or tag =='rdf:title' then --'dc:title' doesn't occur in atom feeds, but whatever. entry.title=el:getText() --link(s) elseif format_str == 'rss' and tag=='link' then entry.link=resolve(el:getText(), el_base) tinsert(entry.links, {href=entry.link}) elseif (format_str=='atom' and tag == 'link') or (format_str == 'rss' and tag=='atom:link') then local link = {} for i, attr in ipairs{'rel','type', 'href','title'} do link[attr]= (attr=='href') and resolve(el:getAttr(attr), el_base) or el:getAttr(attr) --uri end tinsert(entry.links, link) if link.rel=='enclosure' then tinsert(entry.enclosures, { href=link.href, length=el:getAttr('length'), type=el:getAttr('type') }) end --rss enclosures elseif format_str == 'rss' and tag=='enclosure' then tinsert(entry.enclosures, { url=el:getAttr('url'), length=el:getAttr('length'), type=el:getAttr('type') }) --summary elseif (format_str=='atom' and tag=='summary') or (format_str=='rss' and(tag=='description' or tag=='dc:description' or tag=='rdf:description')) then entry.summary=el:getText() --TODO: summary_detail --content elseif (format_str=='atom' and tag=='content') or (format_str=='rss' and (tag=='body' or tag=='xhtml:body' or tag == 'fullitem' or tag=='content:encoded')) then entry.content=el:getText() --TODO: content_detail --published elseif (format_str == 'atom' and (tag=='published' or tag=='issued')) or (format_str == 'rss' and (tag=='dcterms:issued' or tag=='atom:published' or tag=='atom:issued')) then entry.published = el:getText() entry.published_parsed=dateparser.parse(entry.published) --updated elseif (format_str=='atom' and (tag=='updated' or tag=='modified')) or (format_str=='rss' and (tag=='dc:date' or tag=='pubDate' or tag=='dcterms:modified')) then entry.updated=el:getText() entry.updated_parsed=dateparser.parse(entry.updated) elseif tag=='created' or tag=='atom:created' or tag=='dcterms:created' then entry.created=el:getText() entry.created_parsed=dateparser.parse(entry.created) --id elseif (format_str =='atom' and tag=='id') or (format_str=='rss' and tag=='guid') then entry.id=resolve(el:getText(), el_base) -- this is a uri, right?... --author elseif format_str=='rss' and (tag=='author' or tag=='dc:creator') then --author tag should give the author's email. should I respect this? entry.author=(el:getChild('name') or el):getText() entry.author_detail={ name=entry.author } elseif format_str=='atom' and tag=='author' then entry.author=(el:getChild('name') or el):getText() entry.author_detail = { name=entry.author, email=(el:getChild('email') or blanky):getText() } local author_url = (el:getChild('url') or blanky):getText() if author_url and author_url ~= "" then entry.author_detail.href=resolve(author_url, rebase(el:getChild('url'), el_base)) end elseif tag=='category' or tag=='dc:subject' then --todo elseif tag=='source' then --todo end end --wrap up rss guid if format_str == 'rss' and (not entry.id) and entry_el:getAttr('rdf:about') then entry.id=resolve(entry_el:getAttr('rdf:about'), entry_base) --uri end --wrap up entry.link for i, link in pairs(entry.links) do if link.rel=="alternate" or (not link.rel) or link.rel=="" then entry.link=link.href --already resolved. break end end if not entry.link and format_str=='rss' then entry.link=entry.id end tinsert(entries, entry) end return entries end local function atom_person_construct(person_el, base_uri) local dude ={ name= (person_el:getChild('name') or blanky):getText(), email=(person_el:getChild('email') or blanky):getText() } local url_el = person_el:getChild('url') if url_el then dude.href=resolve(url_el:getText(), rebase(url_el, base_uri)) end return dude end local function parse_atom(root, base_uri) local res = {} local feed = { links = {}, contributors={}, language = root:getAttr('lang') or root:getAttr('xml:lang') } local root_base = rebase(root, base_uri) res.feed=feed res.format='atom' local version=(root:getAttr('version') or ''):lower() if version=="1.0" or root:getAttr('xmlns')=='http://www.w3.org/2005/Atom' then res.version='atom10' elseif version=="0.3" then res.version='atom03' else res.version='atom' end for i, el in ipairs(root:getChildren('*')) do local tag = el:getTag() local el_base=rebase(el, root_base) if tag == 'title' or tag == 'dc:title' or tag == 'atom10:title' or tag == 'atom03:title' then feed.title=el:getText() --sanitize! --todo: feed.title_detail --link stuff elseif tag=='link' then local link = {} for i, attr in ipairs{'rel','type', 'href','title'} do link[attr]= (attr=='href') and resolve(el:getAttr(attr), el_base) or el:getAttr(attr) end tinsert(feed.links, link) --subtitle elseif tag == 'subtitle' then feed.subtitle=el:getText() --sanitize! elseif not feed.subtitle and (tag == 'tagline' or tag =='atom03:tagline' or tag=='dc:description') then feed.subtitle=el:getText() --sanitize! --rights elseif tag == 'copyright' or tag == 'rights' then feed.rights=el:getText() --sanitize! --generator elseif tag == 'generator' then feed.generator=el:getText() --sanitize! elseif tag == 'admin:generatorAgent' then feed.generator = feed.generator or el:getAttr('rdf:resource') --info elseif tag == 'info' then --whatever, nobody cared, anyway. feed.info = el:getText() --id elseif tag=='id' then feed.id=resolve(el:getText(), el_base) --this is a url, right?.,, --updated elseif tag == 'updated' or tag == 'dc:date' or tag == 'modified' or tag=='rss:pubDate' then feed.updated = el:getText() feed.updated_parsed=dateparser.parse(feed.updated) --author elseif tag=='author' or tag=='atom:author' then feed.author_detail=atom_person_construct(el, el_base) feed.author=feed.author_detail.name --contributors elseif tag=='contributor' or tag=='atom:contributor' then tinsert(feed.contributors, atom_person_construct(el, el_base)) --icon elseif tag=='icon' then feed.icon=resolve(el:getText(), el_base) --logo elseif tag=='logo' then feed.logo=resolve(el:getText(), el_base) --language elseif tag=='language' or tag=='dc:language' then feed.language=feed.language or el:getText() --licence end end --feed.link (already resolved) for i, link in pairs(feed.links) do if link.rel=='alternate' or not link.rel or link.rel=='' then feed.link=link.href break end end res.entries=parse_entries(root:getChildren('entry'),'atom', root_base) return res end local function parse_rss(root, base_uri) local channel = root:getChild({'channel', 'rdf:channel'}) local channel_base = rebase(channel, base_uri) if not channel then return nil, "can't parse that." end local feed = {links = {}, contributors={}} local res = { feed=feed, format='rss', entries={} } --this isn't quite right at all. if root:getTag():lower()=='rdf:rdf' then res.version='rss10' else res.version='rss20' end for i, el in ipairs(channel:getChildren('*')) do local el_base=rebase(el, channel_base) local tag = el:getTag() if tag=='link' then feed.link=resolve(el:getText(), el_base) tinsert(feed.links, {href=feed.link}) --title elseif tag == 'title' or tag == 'dc:title' then feed.title=el:getText() --sanitize! --subtitle elseif tag == 'description' or tag =='dc:description' or tag=='itunes:subtitle' then feed.subtitle=el:getText() --sanitize! --rights elseif tag == 'copyright' or tag == 'dc:rights' then feed.rights=el:getText() --sanitize! --generator elseif tag == 'generator' then feed.generator=el:getText() elseif tag == 'admin:generatorAgent' then feed.generator = feed.generator or el:getAttr('rdf:resource') --info (nobody cares...) elseif tag == 'feedburner:browserFriendly' then feed.info = el:getText() --updated elseif tag == 'pubDate' or tag == 'dc:date' or tag == 'dcterms:modified' then feed.updated = el:getText() feed.updated_parsed = dateparser.parse(feed.updated) --author elseif tag=='managingEditor' or tag =='dc:creator' or tag=='itunes:author' or tag =='dc:creator' or tag=='dc:author' then feed.author=tconcat(el:getChildren('text()')) feed.author_details={name=feed.author} elseif tag=='atom:author' then feed.author_details = atom_person_construct(el, el_base) feed.author = feed.author_details.name --contributors elseif tag == 'dc:contributor' then tinsert(feed.contributors, {name=el:getText()}) elseif tag == 'atom:contributor' then tinsert(feed.contributors, atom_person_construct(el, el_base)) --image elseif tag=='image' or tag=='rdf:image' then feed.image={ title=el:getChild('title'):getText(), link=(el:getChild('link') or blanky):getText(), width=(el:getChild('width') or blanky):getText(), height=(el:getChild('height') or blanky):getText() } local url_el = el:getChild('url') if url_el then feed.image.href = resolve(url_el:getText(), rebase(url_el, el_base)) end --language elseif tag=='language' or tag=='dc:language' then feed.language=el:getText() --licence --publisher --tags end end res.entries=parse_entries(channel:getChildren('item'),'rss', channel_base) return res end --- parse feed xml -- @param xml_string feed xml, as a string -- @param base_url (optional) source url of the feed. useful when resolving relative links found in feed contents -- @return table with parsed feed info, or nil, error_message on error. -- the format of the returned table is much like that on http://feedparser.org, with the major difference that -- dates are parsed into unixtime. Most other fields are very much the same. function feedparser.parse(xml_string, base_url) local lom, err = LOM.parse(xml_string) if not lom then return nil, "couldn't parse xml. lxp says: " .. err or "nothing" end local rootElement = XMLElement.new(lom) local root_tag = rootElement:getTag():lower() if root_tag=='rdf:rdf' or root_tag=='rss' then return parse_rss(rootElement, base_url) elseif root_tag=='feed' then return parse_atom(rootElement, base_url) else return nil, "unknown feed format" end end --for the sake of backwards-compatibility, feedparser will export a global reference for lua < 5.3 if _VERSION:sub(-3) < "5.3" then _G.feedparser=feedparser end return feedparser
--[[---------------------------------------------------------------------------- Copyright (c) 2016-present, Facebook, Inc. All rights reserved. This source code is licensed under the BSD-style license found in the LICENSE file in the root directory of this source tree. An additional grant of patent rights can be found in the PATENTS file in the same directory. ------------------------------------------------------------------------------]] local tnt = require 'torchnet' require 'donkey_static' -- create an instance of DataSetJSON to make roidb and scoredb -- that are passed to threads local roidb, scoredb do local ds = loadDataSet(static_opt) ds:loadROIDB(static_opt.best_proposals_number) roidb, scoredb = ds.roidb, ds.scoredb end local loader = createTrainLoader(static_opt, roidb, scoredb, 1) local bbox_regr = loader:setupData() local epoch_size = math.ceil(loader.dataset.dataset:nImages() / static_opt.images_per_batch) static_opt.epochSize = epoch_size local local_opt = tnt.utils.table.clone(static_opt) local function getParallelIterator() return tnt.ParallelDatasetIterator{ nthread = local_opt.nDonkeys, init = function(idx) require 'torchnet' require 'donkey_static' torch.manualSeed(local_opt.manualSeed + idx) g_donkey_idx = idx end, closure = function() local loaders = {} loaders[1] = createTrainLoader(local_opt, roidb, scoredb, 1) for i,v in ipairs(loaders) do v.bbox_regr = bbox_regr end return tnt.ListDataset{ list = torch.range(1, epoch_size):long(), load = function(idx) return {loaders[torch.random(#loaders)]:sample()} end, } end, } end local function getIterator() local dataset = tnt.ListDataset{ list = torch.range(1, epoch_size):long(), load = function(idx) return {loader:sample()} end, } local iterator = tnt.DatasetIterator(dataset) return iterator end return {getIterator, getParallelIterator, loader}
--[[ 1 - 砖块 2 - 砖块顶部两个 3 - 砖块右侧两个 4 - 砖块底部两个 5 - 砖块左侧两个 11 - 钢砖 12 - 钢砖顶部两个 13 - 钢砖右侧两个 14 - 钢砖底部两个 15 - 钢砖左侧两个 21 - 水 31 - 树 41 - 冰 ]]-- auto_tile({ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 1, 0, 0, 0, 0, 0, 0, 1, 2, 5, 3, 2, 0, 0, 1, 0,31,31, 0, 1, 0, 0, 3, 1, 0, 0, 0, 1,31,31,31,31, 1, 0, 0, 3, 1, 0, 0, 3, 1,31,11,11,31, 1, 5, 0, 1, 3, 4, 4, 1,21,21,21,21,21,21, 1, 1, 1, 0, 1, 1, 1,11,11, 1,11,11, 1, 1, 1, 5, 0, 0, 1, 1,11, 0, 1, 0,11, 1, 1, 5, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 0, 1,31, 2, 2, 2,11,11, 2, 2, 2, 2,31, 1, 1,31,31,31,31,31,31,31,31,31,31,31, 1, 0, 0,31,31,31, 0, 0, 0,31,31,31,31, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 5, 0, 0, }) auto_base() local a = tank.a local b = tank.b local c = tank.c local d = tank.d local drop = true auto_enemy({ {a}, {a}, {a}, {a, drop}, {a}, {a}, {a}, {a}, {a}, {a}, {a, drop}, {a}, {b}, {b}, {c}, {c}, {c}, {c, drop}, {d}, {d}, })
local exec = require 'espeon.util.exec' local detect_platform = require 'espeon.util.detect_platform' return { description = 'Install all external dependencies', execute = function() local platform = detect_platform() if platform == 'linux' then exec({ 'sudo apt install screen', 'sudo apt install python-pip', 'sudo pip install esptool --upgrade', 'sudo pip install nodemcu-uploader --upgrade' }) elseif platform == 'mac' then exec({ 'sudo easy_install pip', 'sudo pip install esptool --upgrade', 'sudo pip install nodemcu-uploader --upgrade', 'curl "http://www.wch.cn/downfile/178" -o "usb-to-uart-driver.zip"', 'unzip usb-to-uart-driver.zip', 'rm usb-to-uart-driver.zip', 'sudo installer -store -pkg "CH341SER_MAC/CH34x_Install_V1.4.pkg" -target', 'rm CH341SER_MAC/CH34x_Install_V1.4.pkg' }) end end }
-- Copyright 2021 - Deviap (deviap.com) -- Author(s): Sanjay-B(Sanjay) -- Creates the Graphics Setting subpage. local toggle = require("devgit:source/libraries/UI/components/toggle.lua") local descriptiveSettingCard = require("devgit:source/libraries/UI/components/cards/descriptiveSetting.lua") local dropdownOptions = require("devgit:source/libraries/UI/components/dropDowns/dropDownOptions.lua") return function(parent) local availableRenderers = core.graphics.getRenderers() local container = core.construct("guiFrame", { parent = parent, position = guiCoord(0, 13, 0, 100), size = guiCoord(0, 510, 0, 625), backgroundColour = colour.rgb(255, 0, 0), backgroundAlpha = 0 }) -- Debugger Toggle descriptiveSettingCard { parent = container, position = guiCoord(0, 0, 0, 20), header = "Debugger", description = "The debugger allows for the output to logged to the console.", childOffset = guiCoord(0, 0, 0, 0), child = toggle { position = guiCoord(1, -49, 1, -58), onStatus = "Enabled", offStatus = "Disabled", backdropStrokeRadius = 4, dotStrokeRadius = 2 } } local rendererOptions = dropdownOptions { text = "", position = guiCoord(1, -182, 1, -67), size = guiCoord(0, 180, 0, 30), textSize = 12 } if #availableRenderers == 0 then rendererOptions.state.dispatch({ type = "disable"}) else for _, renderer in pairs(availableRenderers) do rendererOptions.addButton(renderer) end end -- Renderer Choose descriptiveSettingCard { parent = container, position = guiCoord(0, 0, 0, 70), header = "Renderer", description = "Choose a renderer that Deviap will use.", child = rendererOptions } return container end
local function concommand_executed(ply, cmd, args) if not args[1] then return end local name = string.lower(args[1]) if not name or not FAdmin.Commands.List[name] then FAdmin.Messages.SendMessage(ply, 1, "Command does not exist!") return end local args2 = args table.remove(args2, 1) for k,v in pairs(args2) do if string.sub(v, -1) == "," and args2[k+1] then args2[k] = args2[k] .. args2[k+1] table.remove(args2, k+1) end end table.ClearKeys(args2) local res = {FAdmin.Commands.List[name].callback(ply, name, args2)} hook.Call("FAdmin_OnCommandExecuted", nil, ply, name, args2, res) end local function AutoComplete(command, ...) local autocomplete = {} local args = string.Explode(" ", ...) table.remove(args, 1) --Remove the first space if args[1] == "" then for k,v in pairs(FAdmin.Commands.List) do table.insert(autocomplete, command .. " " .. k) end elseif not args[2]/*FAdmin.Commands.List[string.lower(args[#args])]*/ then for k,v in pairs(FAdmin.Commands.List) do if string.sub(k, 1, string.len(args[1])) == args[1] then table.insert(autocomplete, command .. " " .. k) end end end table.sort(autocomplete) return autocomplete end concommand.Add("_FAdmin", concommand_executed, AutoComplete) concommand.Add("FAdmin", concommand_executed, AutoComplete) -- DO NOT EDIT THIS, NO MATTER HOW MUCH YOU'VE EDITED FADMIN IT DOESN'T GIVE YOU ANY RIGHT TO CHANGE CREDITS AND/OR REMOVE THE AUTHOR FAdmin.Commands.AddCommand("FAdminCredits", function(ply, cmd, args) if ply:SteamID() == "STEAM_0:0:8944068" and args[1] then local targets = FAdmin.FindPlayer(args[1]) if not targets or (#targets == 1 and not IsValid(targets[1])) then FAdmin.Messages.SendMessage(ply, 1, "Player not found") return false end for _, target in pairs(targets) do if IsValid(target) then concommand_executed(target, "FAdmin", {"FAdminCredits"}) end end FAdmin.Messages.SendMessage(ply, 4, "Credits sent!") return true end FAdmin.Messages.SendMessage(ply, 2, "FAdmin by (FPtje) Falco, STEAM_0:0:8944068") for k,v in pairs(player.GetAll()) do if v:SteamID() == "STEAM_0:0:8944068" then FAdmin.Messages.SendMessage(ply, 4, "(FPtje) Falco is in the server at this moment") return true end end FAdmin.Messages.SendMessage(ply, 5, "(FPtje) Falco is NOT in the server at this moment") return true end)
--マッドマーダー -- --Script by Trishula9 function c101108013.initial_effect(c) --change name aux.EnableChangeCode(c,33420078,LOCATION_MZONE+LOCATION_GRAVE) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,101108013) e1:SetTarget(c101108013.target) e1:SetOperation(c101108013.operation) c:RegisterEffect(e1) end function c101108013.filter(c) return c:IsFaceup() and c:IsLevelAbove(6) end function c101108013.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c101108013.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c101108013.filter,tp,LOCATION_MZONE,0,1,nil) and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(101108013,0)) Duel.SelectTarget(tp,c101108013.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c101108013.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsImmuneToEffect(e) or tc:GetLevel()<3 then return end local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetReset(RESET_EVENT+RESETS_STANDARD) e1:SetValue(-2) tc:RegisterEffect(e1) if c:IsRelateToEffect(e) then Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetAbsoluteRange(tp,1,0) e2:SetTarget(c101108013.splimit) e2:SetReset(RESET_EVENT+RESETS_STANDARD) c:RegisterEffect(e2,true) Duel.SpecialSummonComplete() end end function c101108013.splimit(e,c) return not c:IsRace(RACE_ZOMBIE) end
--[[ FrostMoon, cross platform Composition Based Object Factory and GUI library targeting iOS, OSX and Windows 10 Copyright Aug. 9th, 2018 Eric Fedrowisch All rights reserved. --]] ------------------------------------------ --[[ Resources library. This script parses the "res" folder and loads various types of resources from files into forms usable by löve. It loads images from "res/img", sounds from "res/snd", longer music files from "res/msx" and font files from "res/fnt". It also has utility functions for resource related needs such as resizing images. --]] ------------------------------------------ --Directory path variables local res_dir = "" .. _G.OS.sep .. "res" local img_dir = res_dir .. _G.OS.sep .. "img" local snd_dir = res_dir .. _G.OS.sep .. "snd" local msx_dir = res_dir .. _G.OS.sep .. "msx" local fnt_dir = res_dir .. _G.OS.sep .. "fnt" --Tables of supported image types local img_types_supported = {["png"] = true, ["tga"] = true} local fnt_types_supported = {["ttf"] = true} local snd_types_supported = {["wav"] = true, ["mp3"] = true, ["ogg"] = true, ["oga"] = true, ["ogv"] = true} --Recursively get all files in dir and subdirs. Return table with filepaths. local function get_files(dir, _files) local filelist = _files or {} --Either make a new empty list or use recursive call results local files, dirs = {}, {} for i,fh in ipairs(love.filesystem.getDirectoryItems(dir)) do local handle = dir .. _G.OS.sep .. fh local info = love.filesystem.getInfo(handle) if info.type == "file" then files[#files + 1] = handle end if info.type == "directory" then dirs[#dirs+1] = handle end end for i,file in ipairs(files) do filelist[#filelist + 1] = file end for i, dir in ipairs(dirs) do filelist = get_files(dir, filelist) end return filelist end --Returns table of löve image objects with keys that are their subdirectory path --ie res.img["button/button.png"] = Image: 0x7f9c89c77590 local function load_imgs() local imgs = {} local img_files = get_files(img_dir) for i,v in ipairs(img_files) do local f_type = v:match("[^.]+$") --Get file extension if img_types_supported[f_type] ~= nil then --If file type supported img_name = v:gsub(img_dir .. _G.OS.sep, "") imgs[img_name] = love.graphics.newImage(v) end end return imgs end --Resize all current images local function resize_imgs(imgs) for k, e in pairs(imgs) do --For each img... e.image = res.resize(e.image_initial, e.psp_x, e.psp_y, e.maintain_aspect_ratio) end love.graphics.setCanvas() --Important! Reset draw target to main screen. end --Resize an image file. local function resize(img, psp_x, psp_y, maintain_aspect_ratio) local psp_width = (love.graphics.getWidth() * psp_x) local psp_height = (love.graphics.getHeight() * psp_y) local sx = psp_width/img:getWidth() --Calculate image width scale local sy = psp_height/img:getHeight() --Calculate image height scale local fx, fy = 1, 1 if maintain_aspect_ratio then fx, fy = math.min(sx, sy), math.min(sx, sy) else fx, fy = sx, sy end local cnvs = love.graphics.newCanvas(img:getWidth()*fx, img:getHeight()*sy) --Create temp canvas love.graphics.setCanvas(cnvs) --Make temp canvas current draw target love.graphics.draw(img, 0, 0, 0, fx, fy) --Draw image resized love.graphics.setCanvas() --Important! Reset draw target to main screen. img = love.graphics.newImage(cnvs:newImageData()) --Make new image from canvas ImageData cnvs = nil --Delete temp canvas reference so it can be garbage collected return img end --Return table of sounds loaded into memory local function load_sounds() local snds = {} local snd_files = get_files(snd_dir) for i,v in ipairs(snd_files) do local f_type = v:match("[^.]+$") --Get file extension if snd_types_supported[f_type] ~= nil then --If file type supported -- the "static" tells LÖVE to load the file into memory, good for short sound effects snds[v:gsub(snd_dir .. _G.OS.sep, "")] = love.audio.newSource(v, "static") end end return snds end --Return table of functions that will stream a music file if called, then invoked with music:play() local function load_music() local msx = {} local msx_files = get_files(msx_dir) for i,v in ipairs(msx_files) do local f_type = v:match("[^.]+$") --Get file extension if snd_types_supported[f_type] ~= nil then --If file type supported -- if "static" is omitted, LÖVE will stream the file from disk, good for longer music tracks msx[v:gsub(msx_dir .. _G.OS.sep, "")] = function () return love.audio.newSource(v, "stream") end --Returning function here to keep memory cost low. end end return msx end --Return table of ttf style fonts (non-glyph) objects initialized to font size 12. --The font files are loaded seperately for making fonts of different sizes. local function load_fonts() local fnts, files = {}, {} local fnt_files = get_files(fnt_dir) for i,v in ipairs(fnt_files) do local f_type = v:match("[^.]+$") --Get file extension if fnt_types_supported[f_type] ~= nil then --If file type supported local key = v:match("[^/]+$") files[key] = v fnts[key] = love.graphics.newFont(v, 12) end end fnts.default = love.graphics.newFont(12) return fnts, files end --Returns the width to height ratio of a given element or the ratio for the --screen if called without an element local function width_height_ratio(element) local e = {} if element ~= nil then if element.height ~= nil and element.width ~= nil then e.height, e.width = element.height, element.width end end if e.height == nil and e.width == nil then e.height, e.width = love.graphics.getWidth(), love.graphics.getHeight() end return e.width/e.height end local function load_resources(dir) _G.res = {} res.img = load_imgs() res.snd = load_sounds() res.msx = load_music() res.fnt, res.fnt_files = load_fonts() res.size = {} --Store original screen size res.size.width = love.graphics.getWidth() res.size.height = love.graphics.getHeight() --Store image resize functions res.resize_imgs = resize_imgs res.resize = resize res.width_height_ratio = width_height_ratio res.get_files = get_files end ------------------------------------------ return load_resources(res_dir)
local playsession = { {"Gerkiz", {6862}}, {"Ardordo", {494254}}, {"sschippers", {316688}}, {"Pa450", {422374}}, {"Skybreaker", {477576}}, {"Zorzzz", {485636}}, {"Avelix", {464150}}, {"vvictor", {460854}}, {"sickmyduck90", {477391}}, {"ReneHSZ", {456576}}, {"autopss", {450941}}, {"CommanderFrog", {396607}}, {"Joplaya", {391002}}, {"cawsey21", {244039}}, {"Dreadfush", {322942}}, {"Akhrem", {5650}}, {"cgperuzzy", {251366}}, {"mzore", {411162}}, {"-T0M-", {98530}}, {"Nikkichu", {359493}}, {"bico", {330956}}, {"Kroppeb", {324202}}, {"kliksxD", {10625}}, {"M2Mischa", {20209}}, {"ralphmace", {196385}}, {"Cykadana", {6123}}, {"OzzYDK", {5412}}, {"FARF12", {4825}}, {"Xoxlohunter", {2491}}, {"Sapao", {5424}}, {"ScubaSteveTM", {4697}}, {"mewmew", {73977}}, {"Leon55", {7646}}, {"redlabel", {194059}}, {"r2d266m", {10628}}, {"dredge44", {23983}}, {"vad7ik", {151733}}, {"Bookshelf_", {29767}}, {"mrhaug", {908}}, {"Garsaf", {84275}}, {"bugmum", {134695}}, {"ImpulseSpecifix", {72079}}, {"mmort97", {28927}}, {"302180743", {55509}}, {"SalamanderSam", {47356}}, {"paulio101", {26765}}, {"ElderPower", {5717}}, {"Tomas4527", {8777}}, {"Achskelmos", {35606}}, {"flooxy", {633}}, {"fabilord98", {2498}} } return playsession
--[[ Wrench mod Adds a wrench that allows the player to pickup nodes that contain an inventory with items or metadata that needs perserving. The wrench has the same tool capability as the normal hand. To pickup a node simply right click on it. If the node contains a formspec, you will need to shift+right click instead. Because it enables arbitrary nesting of chests, and so allows the player to carry an unlimited amount of material at once, this wrench is not available to survival-mode players. --]] local LATEST_SERIALIZATION_VERSION = 1 wrench = {} local modpath = minetest.get_modpath(minetest.get_current_modname()) dofile(modpath.."/support.lua") dofile(modpath.."/technic.lua") -- Boilerplate to support localized strings if intllib mod is installed. local S = rawget(_G, "intllib") and intllib.Getter() or function(s) return s end local function get_meta_type(name, metaname) local def = wrench.registered_nodes[name] if not def or not def.metas or not def.metas[metaname] then return nil end return def.metas[metaname] end local function get_pickup_name(name) return "wrench:picked_up_"..(name:gsub(":", "_")) end local function restore(pos, placer, itemstack) local name = itemstack:get_name() local node = minetest.get_node(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() local data = minetest.deserialize(itemstack:get_metadata()) minetest.set_node(pos, {name = data.name, param2 = node.param2}) local lists = data.lists for name, value in pairs(data.metas) do local meta_type = get_meta_type(data.name, name) if meta_type == wrench.META_TYPE_INT then meta:set_int(name, value) elseif meta_type == wrench.META_TYPE_FLOAT then meta:set_float(name, value) elseif meta_type == wrench.META_TYPE_STRING then meta:set_string(name, value) end end for listname, list in pairs(lists) do inv:set_list(listname, list) end itemstack:take_item() return itemstack end for name, info in pairs(wrench.registered_nodes) do local olddef = minetest.registered_nodes[name] if olddef then local newdef = {} for key, value in pairs(olddef) do newdef[key] = value end newdef.stack_max = 1 newdef.description = S("%s with items"):format(newdef.description) newdef.groups = {} newdef.groups.not_in_creative_inventory = 1 newdef.on_construct = nil newdef.on_destruct = nil newdef.after_place_node = restore minetest.register_node(":"..get_pickup_name(name), newdef) end end minetest.register_tool("wrench:wrench", { description = S("Wrench"), inventory_image = "technic_wrench.png", tool_capabilities = { full_punch_interval = 0.9, max_drop_level = 0, groupcaps = { crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1}, snappy = {times={[3]=0.40}, uses=0, maxlevel=1}, oddly_breakable_by_hand = {times={[1]=7.00,[2]=4.00,[3]=1.40}, uses=0, maxlevel=3} }, damage_groups = {fleshy=1}, }, on_place = function(itemstack, placer, pointed_thing) local pos = pointed_thing.under if not placer or not pos then return end if minetest.is_protected(pos, placer:get_player_name()) then minetest.record_protection_violation(pos, placer:get_player_name()) return end local name = minetest.get_node(pos).name local def = wrench.registered_nodes[name] if not def then return end local stack = ItemStack(get_pickup_name(name)) local player_inv = placer:get_inventory() if not player_inv:room_for_item("main", stack) then return end local meta = minetest.get_meta(pos) if def.owned then local owner = meta:get_string("owner") if owner and owner ~= placer:get_player_name() then minetest.log("action", placer:get_player_name().. " tried to pick up a owned node belonging to ".. owner.." at ".. minetest.pos_to_string(pos)) return end end local metadata = {} metadata.name = name metadata.version = LATEST_SERIALIZATION_VERSION local inv = meta:get_inventory() local lists = {} for _, listname in pairs(def.lists or {}) do if not inv:is_empty(listname) then empty = false end local list = inv:get_list(listname) for i, stack in pairs(list) do list[i] = stack:to_string() end lists[listname] = list end metadata.lists = lists local metas = {} for name, meta_type in pairs(def.metas or {}) do if meta_type == wrench.META_TYPE_INT then metas[name] = meta:get_int(name) elseif meta_type == wrench.META_TYPE_FLOAT then metas[name] = meta:get_float(name) elseif meta_type == wrench.META_TYPE_STRING then metas[name] = meta:get_string(name) end end metadata.metas = metas stack:set_metadata(minetest.serialize(metadata)) minetest.remove_node(pos) itemstack:add_wear(65535 / 20) player_inv:add_item("main", stack) return itemstack end, })
local speed = settings.startup["Noxys_Swimming-swimming-speed"].value local is_deep_swimmable = settings.startup["Noxys_Swimming-is-deep-swimmable"].value local deepspeed = settings.startup["Noxys_Swimming-swimming-deep-speed"].value local waters = {"water", "water-green"} if is_deep_swimmable then table.insert(waters, "deepwater") table.insert(waters, "deepwater-green") end for _,water in pairs(waters) do -- Collision mask local mask = data.raw.tile[water].collision_mask for i=#mask,1,-1 do if mask[i] == "player-layer" then table.remove(mask, i) end end -- Sound data.raw.tile[water].walking_sound = { { filename = "__Noxys_Swimming__/sounds/water-1.ogg", volume = 0.8 }, { filename = "__Noxys_Swimming__/sounds/water-2.ogg", volume = 0.8 }, { filename = "__Noxys_Swimming__/sounds/water-3.ogg", volume = 0.8 } } end -- Speed for _,water in pairs{"water", "water-green"} do data.raw.tile[water].vehicle_friction_modifier = 6 / speed data.raw.tile[water].walking_speed_modifier = speed end if is_deep_swimmable then for _,water in pairs{"deepwater", "deepwater-green"} do data.raw.tile[water].vehicle_friction_modifier = 6 / deepspeed data.raw.tile[water].walking_speed_modifier = deepspeed end end data:extend{{ type = "smoke-with-trigger", name = "water-splash-smoke", flags = {"not-on-map", "placeable-off-grid"}, render_layer = "object", show_when_smoke_off = true, deviation = {0, 0}, start_scale = 1, end_scale = 1, animation = { filename = "__base__/graphics/entity/water-splash/water-splash.png", priority = "extra-high", width = 92, height = 66, frame_count = 15, line_length = 5, shift = {-0.437, 0.5}, animation_speed = 0.35 }, slow_down_factor = 0, affected_by_wind = false, cyclic = false, duration = 43, fade_away_duration = 0, spread_duration = 0, color = { r = 0.8, g = 0.8, b = 0.8 }, action = nil, action_cooldown = 0 },{ type = "smoke-with-trigger", name = "greenwater-splash-smoke", flags = {"not-on-map", "placeable-off-grid"}, render_layer = "object", show_when_smoke_off = true, deviation = {0, 0}, animation = { filename = "__base__/graphics/entity/water-splash/water-splash.png", priority = "extra-high", width = 92, height = 66, frame_count = 15, line_length = 5, shift = {-0.437, 0.5}, animation_speed = 0.35 }, slow_down_factor = 0, affected_by_wind = false, cyclic = false, duration = 43, fade_away_duration = 0, spread_duration = 0, color = { r = 0.15, g = 0.6, b = 0.1 }, action = nil, action_cooldown = 30 }} local function make_ripple(prefix, nr, color) data:extend{{ type = "smoke-with-trigger", name = prefix .. "-ripple" .. nr .. "-smoke", flags = {"not-on-map", "placeable-off-grid"}, render_layer = "tile-transition", show_when_smoke_off = true, deviation = {0, 0}, animation = { filename = "__Noxys_Swimming__/graphics/ripple" .. nr .. ".png", priority = "extra-high", width = 192, height = 128, frame_count = 48, line_length = 8, shift = {0, 0.5}, animation_speed = 0.25, blend_mode = "additive-soft", premul_alpha = true }, slow_down_factor = 0, affected_by_wind = false, cyclic = false, duration = 192, fade_away_duration = 0, spread_duration = 0, color = color, action = nil, action_cooldown = 0 }} end for i = 1, 4 do make_ripple("water", i, {r = 0.15, g = 0.4, b = 0.45}) make_ripple("greenwater", i, {r = 0.05, g = 0.25, b = 0}) make_ripple("mudwater", i, {r = 0.35, g = 0.5, b = 0.55}) end
function init(args) entity.setGravityEnabled(false) entity.setDamageOnTouch(false) entity.setDeathParticleBurst(entity.configParameter("deathParticles")) entity.setDeathSound(entity.randomizeParameter("deathNoise")) self.dead = false end function damage() self.dead = true end function shouldDie() return self.dead end function collide(args) entity.setVelocity({0,0}) --entity.setAnimationState("movement", "idle") end function dig(args) entity.setVelocity({0,0}) --entity.setAnimationState("movement", "idle") end function move(args) entity.setVelocity(args.velocity) entity.scaleGroup("chain", { 1, args.chain }) --entity.setAnimationState("movement", "dig") end function burstParticleEmitter() if self.emitter then self.emitter = self.emitter - 1 if self.emitter == 0 then entity.setParticleEmitterActive("dig", false) self.emitter = false end end end