repo_name
stringlengths
6
69
path
stringlengths
6
178
copies
stringclasses
278 values
size
stringlengths
4
7
content
stringlengths
671
917k
license
stringclasses
15 values
kidaa/darkstar
scripts/zones/Bibiki_Bay/TextIDs.lua
4
2478
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item> come back again after sorting your inventory. ITEM_OBTAINED = 6383; -- Obtained: <item>. GIL_OBTAINED = 6384; -- Obtained <number> gil. KEYITEM_OBTAINED = 6386; -- Obtained key item: <keyitem>. FISHING_MESSAGE_OFFSET = 7253; -- You can't fish here. -- Dialogs MEP_NHAPOPOLUKO_DIALOG = 7211; -- Welcome! Fishermen's Guild representative, at your service!?Prompt? NOTHING_OUT_OF_ORDINARY = 6397; -- There is nothing out of the ordinary here. -- Manaclipper NO_BILLET = 7465; -- You were refused passage for failing to present HAVE_BILLET = 7470; -- You cannot buy morrre than one . Use the one you have now to ride the next ship. LEFT_BILLET = 7475; -- You use your END_BILLET = 7476; -- You use up your NEWS_BILLET = 7477; -- added to your -- Conquest Base CONQUEST_BASE = 7038; -- Tallying conquest results... -- Shop Texts POHKA_SHOP_DIALOG = 7209; --Hey buddy, need a rod? I've got loads of state-of-the-art, top-of-the-line, high quality rods right here waitin' fer ya! Whaddya say? -- Clamming YOU_OBTAIN = 6389; -- You obtain WHOA_HOLD_ON_NOW = 7227; -- Whoa, hold on now. Ain't look like you got 'nuff room in that spiffy bag o' yours to carrrry all these darn clams. YOU_GIT_YER_BAG_READY = 7228; -- You git yer bag ready, pardner? Well alrighty then. Here'rrre yer clams. YOU_RETURN_THE = 7235; -- You return the AREA_IS_LITTERED = 7236; -- The area is littered with pieces of broken seashells. YOU_FIND_ITEM = 7238; -- You find$ and toss it into your bucket THE_WEIGHT_IS_TOO_MUCH = 7239; -- You find$ and toss it into your bucket... But the weight is too much for the bucket and its bottom breaks! All your shellfish are washed back into the sea... YOU_CANNOT_COLLECT = 7240; -- You cannot collect any clams with a broken bucket! IT_LOOKS_LIKE_SOMEONE = 7241; -- It looks like someone has been digging here. YOUR_CLAMMING_CAPACITY = 7249; -- Your clamming capacity has increased toponzes! Now you may be able to dig up a... SOMETHING_JUMPS_INTO = 7252; -- Something jumps into your bucket and breaks through the bottom! All your shellfish are washed back into the sea... --chocobo digging DIG_THROW_AWAY = 7266; -- You dig up$, but your inventory is full. You regretfully throw the # away. FIND_NOTHING = 7268; -- You dig and you dig, but find nothing.
gpl-3.0
davidedmonds/darkstar
scripts/zones/PsoXja/npcs/_090.lua
17
1763
----------------------------------- -- Area: Pso'Xja -- NPC: _090 (Stone Gate) -- Notes: Spawns Gargoyle when triggered -- @pos -330.000 14.074 -261.600 9 -- TODO: The spawned Gargoyle should spawn as claimed to the trigger target. -- Text Message not displaying players name before the text at all. ----------------------------------- package.loaded["scripts/zones/PsoXja/TextIDs"] = nil; ----------------------------------- require("scripts/zones/PsoXja/TextIDs"); require("scripts/globals/keyitems"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) local X=player:getXPos(); if (npc:getAnimation() == 9) then if (X <= 341) then if (GetMobAction(16814081) == 0) then local Rand = math.random(1,10); if (Rand <=9) then -- Spawn Gargoyle player:messageSpecial(TRAP_ACTIVATED); SpawnMob(16814081,120):updateClaim(player); -- Gargoyle else player:messageSpecial(TRAP_FAILS); npc:openDoor(30); end else player:messageSpecial(DOOR_LOCKED); end elseif (X >= 342) then player:startEvent(0x001A); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) if (csid == 0x001A and option == 1) then player:setPos(260,-0.25,-20,254,111); end end;
gpl-3.0
will4wachter/Project1
scripts/zones/Caedarva_Mire/npcs/qm1.lua
15
1168
----------------------------------- -- Area: Caedarva Mire -- NPC: ??? (Spawn Verdelet(ZNM T2)) -- @pos 417 -19 -69 79 ----------------------------------- package.loaded["scripts/zones/Caedarva_Mire/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Caedarva_Mire/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(trade:hasItemQty(2599,1) and trade:getItemCount() == 1) then -- Trade Mint Drop player:tradeComplete(); SpawnMob(17101202,180):updateEnmity(player); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_HAPPENS); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
davidedmonds/darkstar
scripts/zones/Caedarva_Mire/npcs/Nasheefa.lua
19
1384
----------------------------------- -- Area: Caedarva Mire -- NPC: Nasheefa -- Type: Alzadaal Undersea Ruins -- @pos -440.998 0.107 -740.015 79 ----------------------------------- package.loaded["scripts/zones/Caedarva_Mire/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/Caedarva_Mire/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:getItemCount() == 1 and trade:hasItemQty(2185,1)) then -- Silver player:tradeComplete(); player:startEvent(0x00b7); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getXPos() < -440) then player:startEvent(0x00be); else player:startEvent(0x00b6); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x00b7) then player:setPos(-219.977,-4,474.522,64,72); -- To Alzadaal Undersea Ruins {R} end end;
gpl-3.0
kidaa/darkstar
scripts/zones/Mhaura/npcs/Koh_Lenbalalako.lua
19
2170
----------------------------------- -- Area: Mhaura -- NPC: Koh Lenbalalako -- Type: Standard NPC -- @pos -64.412 -17 29.213 249 ----------------------------------- package.loaded["scripts/zones/Mhaura/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Mhaura/TextIDs"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(trade:hasItemQty(13315,1) and trade:getItemCount() == 1) then -- Trade gold earring (during Rng AF3 quest) local UnbridledPassionCS = player:getVar("unbridledPassion"); if (UnbridledPassionCS == 2) then player:startEvent(0x271b); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local FireAndBrimstoneCS = player:getVar("fireAndBrimstone"); local UnbridledPassionCS = player:getVar("unbridledPassion"); -- during RNG af2 if (FireAndBrimstoneCS == 1) then player:startEvent(0x2717); -- during RNG af3 elseif(UnbridledPassionCS == 1) then player:startEvent(0x2719, 0, 13360, 13315); elseif(UnbridledPassionCS == 2) then player:startEvent(0x271a, 0, 0, 13315); elseif(UnbridledPassionCS == 3) then player:startEvent(0x271c); else player:startEvent(0x271d); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x2717) then player:startEvent(0x2730); player:setVar("fireAndBrimstone",2); elseif(csid == 0x2719) then player:setVar("unbridledPassion",2); elseif(csid == 0x271b) then player:addKeyItem(KOHS_LETTER); player:messageSpecial(KEYITEM_OBTAINED,KOHS_LETTER); player:tradeComplete(); player:setVar("unbridledPassion",3); end end;
gpl-3.0
failcoder/SVUI_-Core
_options/libs/AceGUI-3.0-SharedMediaWidgets/Libs/LibStub/LibStub.lua
184
1367
-- LibStub is a simple versioning stub meant for use in Libraries. http://www.wowace.com/wiki/LibStub for more info -- LibStub is hereby placed in the Public Domain Credits: Kaelten, Cladhaire, ckknight, Mikk, Ammo, Nevcairiel, joshborke local LIBSTUB_MAJOR, LIBSTUB_MINOR = "LibStub", 2 -- NEVER MAKE THIS AN SVN REVISION! IT NEEDS TO BE USABLE IN ALL REPOS! local LibStub = _G[LIBSTUB_MAJOR] if not LibStub or LibStub.minor < LIBSTUB_MINOR then LibStub = LibStub or {libs = {}, minors = {} } _G[LIBSTUB_MAJOR] = LibStub LibStub.minor = LIBSTUB_MINOR function LibStub:NewLibrary(major, minor) assert(type(major) == "string", "Bad argument #2 to `NewLibrary' (string expected)") minor = assert(tonumber(strmatch(minor, "%d+")), "Minor version must either be a number or contain a number.") local oldminor = self.minors[major] if oldminor and oldminor >= minor then return nil end self.minors[major], self.libs[major] = minor, self.libs[major] or {} return self.libs[major], oldminor end function LibStub:GetLibrary(major, silent) if not self.libs[major] and not silent then error(("Cannot find a library instance of %q."):format(tostring(major)), 2) end return self.libs[major], self.minors[major] end function LibStub:IterateLibraries() return pairs(self.libs) end setmetatable(LibStub, { __call = LibStub.GetLibrary }) end
mit
waterlgndx/darkstar
scripts/zones/Windurst_Woods/npcs/Illu_Bohjaa.lua
2
1594
----------------------------------- -- Area: Windurst Woods -- NPC: Illu Bohjaa -- Involved in the repeatable quest "Creepy Crawlies" ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil ----------------------------------- require("scripts/zones/Windurst_Woods/TextIDs") require("scripts/globals/npc_util") require("scripts/globals/settings") require("scripts/globals/quests") require("scripts/globals/titles") ----------------------------------- function onTrade(player,npc,trade) if player:getQuestStatus(WINDURST,CREEPY_CRAWLIES) ~= QUEST_AVAILABLE then if npcUtil.tradeHas(trade, {{816, 3}}) then -- silk thread x3 player:addFame(WINDURST, 15) player:startEvent(335, 600 * GIL_RATE, 816, 938, 1156) elseif npcUtil.tradeHas(trade, {{1156, 3}}) then -- crawler calculus x3 player:addFame(WINDURST, 30) player:startEvent(335, 600 * GIL_RATE, 816, 938, 1156) end end end function onTrigger(player,npc) if player:getQuestStatus(WINDURST, CREEPY_CRAWLIES) == QUEST_AVAILABLE then player:startEvent(333, 0, 816, 938, 1156) else player:startEvent(334, 0, 816, 938, 1156) end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) if csid == 333 and option == 1 then player:addQuest(WINDURST, CREEPY_CRAWLIES) elseif csid == 335 and npcUtil.completeQuest(player, WINDURST, CREEPY_CRAWLIES, {gil=600, fame=0, title=dsp.title.CRAWLER_CULLER}) then player:confirmTrade() end end
gpl-3.0
lhog/Zero-K
LuaRules/Gadgets/weapon_timed_replace.lua
7
2950
function gadget:GetInfo() return { name = "Weapon Timed Replace", desc = "Replaces a projectile with another projectile a certain time after firing.", author = "Google Frog", date = "10 June 2014", license = "GNU GPL, v2 or later", layer = 0, enabled = false, } end ------------------------------------------------------------- ------------------------------------------------------------- if not (gadgetHandler:IsSyncedCode()) then return false end ------------------------------------------------------------- ------------------------------------------------------------- local FEATURE = 102 local UNIT = 117 local weaponLoseTrackingFrames = {} local projectiles = {} local projectileAllyTeam = {} function gadget:Initialize() weaponLoseTrackingFrames[WeaponDefNames["bomberdive_bombsabot"].id] = 14 Script.SetWatchProjectile(WeaponDefNames["bomberdive_bombsabot"].id, true) end function gadget:GameFrame(n) for proID, frame in pairs(projectiles) do if n == frame then local targetType, targetID = Spring.GetProjectileTarget(proID) if targetType == UNIT then local allyTeam = projectileAllyTeam[proID] local los = Spring.GetUnitLosState(targetID,allyTeam,true) if los and (los % 2 == 1) then -- If the unit is visible then target the ground beneath it. local x,_,z = Spring.GetUnitPosition(targetID) local y = Spring.GetGroundHeight(x,z) Spring.SetProjectileTarget(proID, x, y, z) else -- If the unit is not visible we have been homing onto a radar -- dot. The radar dot position is unknown to lua so target -- ground beneath the projectile. local x,_,z = Spring.GetProjectilePosition(proID) local y = Spring.GetGroundHeight(x,z) Spring.SetProjectileTarget(proID, x, y, z) end elseif targetType == FEATURE then local x,_,z = Spring.GetFeaturePosition(targetID) local y = Spring.GetGroundHeight(x,z) Spring.SetProjectileTarget(proID, x, y, z) end projectiles[proID] = nil projectileAllyTeam[proID] = nil --local x, _, z = Spring.GetProjectilePosition(proID) --[[local x, y, z = Spring.GetProjectilePosition(proID) local vx, vy, vz = Spring.GetProjectileVelocity(proID) -- Create new projectile Spring.SpawnProjectile(data.replacement, { pos = {x, y, z}, speed = {vx, vy, vz}, ttl = 180, tracking = false }) -- Destroy old projectile Spring.DeleteProjectile(proID) --]] end end end function gadget:ProjectileCreated(proID, proOwnerID, weaponID) if weaponLoseTrackingFrames[weaponID] then projectiles[proID] = Spring.GetGameFrame() + weaponLoseTrackingFrames[weaponID] if proOwnerID then projectileAllyTeam[proID] = Spring.GetUnitAllyTeam(proOwnerID) end end end function gadget:ProjectileDestroyed(proID) if projectiles[proID] then projectiles[proID] = nil projectileAllyTeam[proID] = nil end end
gpl-2.0
MonokuroInzanaito/ygopro-777DIY
expansions/script/c10957776.lua
1
4374
--KV-欧娜尔 function c10957776.initial_effect(c) aux.EnablePendulumAttribute(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(10957776,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,10957776) e1:SetCost(c10957776.thcost) e1:SetTarget(c10957776.sptg) e1:SetOperation(c10957776.spop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(10957776,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DECKDES) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,10957776) e2:SetCost(c10957776.cost) e2:SetTarget(c10957776.target) e2:SetOperation(c10957776.operation) c:RegisterEffect(e2) --special summon local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetDescription(aux.Stringid(10957776,0)) e4:SetCode(EVENT_TO_GRAVE) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCondition(c10957776.condtion) e4:SetTarget(c10957776.target2) e4:SetOperation(c10957776.operation2) c:RegisterEffect(e4) end function c10957776.dfilter(c) return c:IsAbleToGraveAsCost() and c:IsType(TYPE_PENDULUM) and c:IsFaceup() end function c10957776.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c10957776.dfilter,tp,LOCATION_EXTRA,0,3,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c10957776.dfilter,tp,LOCATION_EXTRA,0,3,3,e:GetHandler()) Duel.SendtoGrave(g,REASON_COST) end function c10957776.filter(c,e,tp) return c:IsSetCard(0x239) and c:IsAttribute(ATTRIBUTE_WATER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c10957776.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c10957776.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c10957776.spop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c10957776.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function c10957776.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_NORMALSUMMON)==0 and e:GetHandler():IsAbleToGraveAsCost() end Duel.SendtoGrave(e:GetHandler(),REASON_COST) --oath effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SUMMON) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetTargetRange(1,0) Duel.RegisterEffect(e1,tp) end function c10957776.filter2(c) return c:IsSetCard(0x239) and c:IsAbleToHand() end function c10957776.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c10957776.filter2,tp,LOCATION_DECK,0,1,nil) and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>1 end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c10957776.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c10957776.filter2,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) Duel.ShuffleDeck(tp) end local g=Duel.GetDecktopGroup(tp,1) Duel.DisableShuffleCheck() Duel.Destroy(g,REASON_EFFECT) end function c10957776.condtion(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetPreviousLocation()==LOCATION_DECK end function c10957776.setfilter(c) return c:IsSetCard(0x239) and c:IsType(TYPE_PENDULUM) end function c10957776.target2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c10957776.setfilter,tp,LOCATION_GRAVE+LOCATION_DECK,0,1,nil) end end function c10957776.operation2(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(10957776,2)) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c10957776.setfilter),tp,LOCATION_GRAVE+LOCATION_DECK,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SendtoExtraP(g,nil,REASON_EFFECT) end end
gpl-3.0
kidaa/darkstar
scripts/zones/Crawlers_Nest/npcs/qm10.lua
57
2127
----------------------------------- -- Area: Crawlers' Nest -- NPC: qm10 (??? - Exoray Mold Crumbs) -- Involved in Quest: In Defiant Challenge -- @pos -83.391 -8.222 79.065 197 ----------------------------------- package.loaded["scripts/zones/Crawlers_Nest/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/globals/settings"); require("scripts/zones/Crawlers_Nest/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (OldSchoolG1 == false) then if (player:hasItem(1089) == false and player:hasKeyItem(EXORAY_MOLD_CRUMB1) == false and player:getQuestStatus(JEUNO,IN_DEFIANT_CHALLENGE) == QUEST_ACCEPTED) then player:addKeyItem(EXORAY_MOLD_CRUMB1); player:messageSpecial(KEYITEM_OBTAINED,EXORAY_MOLD_CRUMB1); end if (player:hasKeyItem(EXORAY_MOLD_CRUMB1) and player:hasKeyItem(EXORAY_MOLD_CRUMB2) and player:hasKeyItem(EXORAY_MOLD_CRUMB3)) then if (player:getFreeSlotsCount() >= 1) then player:addItem(1089, 1); player:messageSpecial(ITEM_OBTAINED, 1089); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 1089); end end if (player:hasItem(1089)) then player:delKeyItem(EXORAY_MOLD_CRUMB1); player:delKeyItem(EXORAY_MOLD_CRUMB2); player:delKeyItem(EXORAY_MOLD_CRUMB3); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID2: %u",csid); -- printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
kidaa/darkstar
scripts/globals/spells/Vital_Etude.lua
11
1611
----------------------------------------- -- Spell: Vital Etude -- Static VIT Boost, BRD 70 ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED); local power = 0; if (sLvl+iLvl <= 416) then power = 12; elseif((sLvl+iLvl >= 417) and (sLvl+iLvl <= 445)) then power = 13; elseif((sLvl+iLvl >= 446) and (sLvl+iLvl <= 474)) then power = 14; elseif(sLvl+iLvl >= 475) then power = 15; end local iBoost = caster:getMod(MOD_ETUDE_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT); power = power + iBoost; if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then power = power * 2; elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then power = power * 1.5; end caster:delStatusEffect(EFFECT_MARCATO); local duration = 120; duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1); if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then duration = duration * 2; end if not (target:addBardSong(caster,EFFECT_ETUDE,power,10,duration,caster:getID(), MOD_VIT, 2)) then spell:setMsg(75); end return EFFECT_ETUDE; end;
gpl-3.0
davidedmonds/darkstar
scripts/zones/Tahrongi_Canyon/TextIDs.lua
4
1936
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6552; -- You cannot obtain the item <item> come back again after sorting your inventory. ITEM_OBTAINED = 6556; -- Obtained: <item>. GIL_OBTAINED = 6557; -- Obtained <number> gil. KEYITEM_OBTAINED = 6559; -- Obtained key item: <keyitem>. FISHING_MESSAGE_OFFSET = 7213; -- You can't fish here. ALREADY_OBTAINED_TELE = 7308; -- You already possess the gate crystal for this telepoint. NOTHING_HAPPENS = 292; -- Nothing happens. -- Mining MINING_IS_POSSIBLE_HERE = 7410; -- Mining is possible here if you have -- ??? that spawns NM Yara Ma Yha Who SPROUT_LOOKS_WITHERED = 7534; -- There is something sprouting from the ground here. It looks a little withered. REPULSIVE_CREATURE_EMERGES = 7535; -- A repulsive creature emerges from the ground! SPROUT_DOES_NOT_NEED_WATER = 7536; -- The sprout does not need any more water now. SPROUT_LOOKING_BETTER = 7538; -- The sprout is looking better. -- Other Texts TELEPOINT_HAS_BEEN_SHATTERED = 7491; -- The telepoint has been shattered into a thousand pieces... TELEPOINT_DISAPPEARED = 7309; -- The telepoint has disappeared... -- Signs SIGN_1 = 7383; -- North: Meriphataud Mountains Northeast: Crag of Mea South: East Sarutabaruta SIGN_3 = 7384; -- North: Meriphataud Mountains East: Crag of Mea South: East Sarutabaruta SIGN_5 = 7385; -- North: Meriphataud Mountains East: Buburimu Peninsula South: East Sarutabaruta SIGN_7 = 7386; -- East: Buburimu Peninsula West: East Sarutabaruta -- conquest Base CONQUEST_BASE = 0; -- chocobo digging DIG_THROW_AWAY = 7226; -- You dig up ?Possible Special Code: 01??Possible Special Code: 01??Possible Special Code: 01? ?Possible Special Code: 01??Possible Special Code: 05?$?BAD CHAR: 8280??BAD CHAR: 80??BAD CHAR: 80?, but your inventory is full. FIND_NOTHING = 7228; -- You dig and you dig, but find nothing.
gpl-3.0
davidedmonds/darkstar
scripts/zones/Riverne-Site_A01/npcs/_0u2.lua
17
1341
----------------------------------- -- Area: Riverne Site #A01 -- NPC: Unstable Displacement ----------------------------------- package.loaded["scripts/zones/Riverne-Site_A01/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Riverne-Site_A01/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) if (trade:hasItemQty(1691,1) and trade:getItemCount() == 1) then -- Trade Giant Scale player:tradeComplete(); npc:openDoor(RIVERNE_PORTERS); player:messageSpecial(SD_HAS_GROWN); end end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) if (npc:getAnimation() == 8) then player:startEvent(0x11); else player:messageSpecial(SD_VERY_SMALL); end; return 1; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
MonokuroInzanaito/ygopro-777DIY
expansions/script/c60150613.lua
1
6321
--千夜 风行者 function c60150613.initial_effect(c) c:SetUniqueOnField(1,0,60150613) --fusion material c:EnableReviveLimit() aux.AddFusionProcFun2(c,c60150613.ffilter,aux.FilterBoolFunction(c60150613.ffilter2),false) --spsummon condition local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) e2:SetValue(c60150613.splimit) c:RegisterEffect(e2) --special summon rule local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_SPSUMMON_PROC) e3:SetProperty(EFFECT_FLAG_UNCOPYABLE) e3:SetRange(LOCATION_EXTRA) e3:SetCondition(c60150613.sprcon) e3:SetOperation(c60150613.sprop) c:RegisterEffect(e3) --actlimit local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_FIELD) e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e6:SetCode(EFFECT_CANNOT_ACTIVATE) e6:SetRange(LOCATION_MZONE) e6:SetTargetRange(0,1) e6:SetValue(c60150613.aclimit) e6:SetCondition(c60150613.actcon) c:RegisterEffect(e6) --Activate local e7=Effect.CreateEffect(c) e7:SetCategory(CATEGORY_ATKCHANGE) e7:SetType(EFFECT_TYPE_QUICK_O) e7:SetCode(EVENT_CHAINING) e7:SetRange(LOCATION_MZONE) e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e7:SetCountLimit(1) e7:SetCondition(c60150613.condition) e7:SetCost(c60150613.cost) e7:SetTarget(c60150613.target) e7:SetOperation(c60150613.activate) c:RegisterEffect(e7) end function c60150613.ffilter(c) return c:IsSetCard(0x3b21) and c:IsType(TYPE_MONSTER) end function c60150613.ffilter2(c) return c:IsAttribute(ATTRIBUTE_WIND) or c:IsHasEffect(60150618) end function c60150613.splimit(e,se,sp,st) return bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION end function c60150613.spfilter1(c,tp,fc) return c:IsSetCard(0x3b21) and c:IsCanBeFusionMaterial(fc,true) and c:IsFaceup() and c:IsAbleToDeckOrExtraAsCost() and Duel.IsExistingMatchingCard(c60150613.spfilter2,tp,LOCATION_MZONE,0,1,c,fc) end function c60150613.spfilter2(c,fc) return c:IsAttribute(ATTRIBUTE_WIND) and c:IsCanBeFusionMaterial(fc) and c:IsAbleToDeckOrExtraAsCost() end function c60150613.filter(c) return c:IsFaceup() and c:IsSetCard(0x3b21) and (c:GetSequence()==6 or c:GetSequence()==7) end function c60150613.sprcon(e,c) if c==nil then return true end local tp=c:GetControler() local g=Duel.GetMatchingGroup(c60150613.filter,tp,LOCATION_ONFIELD,0,nil) if g:GetCount()>0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingMatchingCard(c60150613.spfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp,c) else return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2 and Duel.IsExistingMatchingCard(c60150613.spfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp,c) end end function c60150613.gfilter(c) return c:IsType(TYPE_PENDULUM) end function c60150613.sprop(e,tp,eg,ep,ev,re,r,rp,c) local g1=Duel.SelectMatchingCard(tp,c60150613.spfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tp,c) local g2=Duel.SelectMatchingCard(tp,c60150613.spfilter2,tp,LOCATION_ONFIELD,0,1,1,g1:GetFirst(),c) g1:Merge(g2) local tc=g1:GetFirst() while tc do if not tc:IsFaceup() then Duel.ConfirmCards(1-tp,tc) end tc=g1:GetNext() end c:SetMaterial(g1) local g=g1:Filter(c60150613.gfilter,nil) if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(60150602,0)) then Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(60150602,1)) local sg=g:Select(tp,1,g:GetCount(),nil) local gtc=sg:GetFirst() while gtc do g1:RemoveCard(gtc) gtc=sg:GetNext() end Duel.SendtoExtraP(sg,nil,REASON_COST+REASON_MATERIAL+REASON_FUSION) end Duel.SendtoDeck(g1,nil,2,REASON_COST+REASON_FUSION+REASON_MATERIAL) end function c60150613.aclimit(e,re,tp) return not re:GetHandler():IsImmuneToEffect(e) end function c60150613.actcon(e) return Duel.GetAttacker()==e:GetHandler() or Duel.GetAttackTarget()==e:GetHandler() end function c60150613.condition(e,tp,eg,ep,ev,re,r,rp) return (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and rp~=tp end function c60150613.cfilter(c) return c:IsSetCard(0x3b21) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeckOrExtraAsCost() end function c60150613.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) and Duel.IsExistingMatchingCard(c60150613.cfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) local g=Duel.GetMatchingGroup(c60150613.cfilter,tp,LOCATION_MZONE+LOCATION_GRAVE,0,nil) if g:GetCount()>0 then local g2=g:Filter(c60150613.gfilter,nil) if g2:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(60150608,0)) then Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(60150608,1)) local sg=g2:Select(tp,1,1,nil) local tc2=sg:GetFirst() while tc2 do if not tc2:IsFaceup() then Duel.ConfirmCards(1-tp,tc2) end tc2=sg:GetNext() end Duel.SendtoExtraP(sg,nil,REASON_COST) else Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(60150608,2)) local sg=g:Select(tp,1,1,nil) local tc2=sg:GetFirst() while tc2 do if not tc2:IsFaceup() then Duel.ConfirmCards(1-tp,tc2) end tc2=sg:GetNext() end Duel.SendtoDeck(sg,nil,2,REASON_COST) end end end function c60150613.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local opt=Duel.SelectOption(tp,aux.Stringid(60150613,4),aux.Stringid(60150613,5)) e:SetLabel(opt) end function c60150613.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end if e:GetLabel()==0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(3500) e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_PIERCE) e2:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END) c:RegisterEffect(e2) else local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(c60150613.efilter2) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) c:RegisterEffect(e1) end end function c60150613.efilter2(e,re) return e:GetHandler()~=re:GetOwner() end
gpl-3.0
will4wachter/Project1
scripts/zones/Bastok_Markets/npcs/Shamarhaan.lua
38
1856
----------------------------------- -- Area: Bastok Markets -- NPC: Shamarhaan -- Type: Quest Starter -- Involved in quest: No Strings Attached -- @zone: 235 -- @pos -285.382 -13.021 -84.743 -- -- Auto-Script: Requires Verification. Verified standard dialog - thrydwolf 12/8/2011 ----------------------------------- package.loaded["scripts/zones/Bastok_Markets/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Bastok_Markets/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local NoStringsAttached = player:getQuestStatus(AHT_URHGAN,NO_STRINGS_ATTACHED); local NoStringsAttachedProgress = player:getVar("NoStringsAttachedProgress"); if (player:getMainLvl() >= ADVANCED_JOB_LEVEL and NoStringsAttached == QUEST_AVAILABLE) then player:startEvent(0x01b2); -- initial cs to start the quest, go and see Iruki-Waraki at Whitegate elseif (NoStringsAttachedProgress == 1) then player:startEvent(0x01b3); -- reminder to go see Iruki-Waraki at Whitegate else player:startEvent(0x01b1); end; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x01b2) then player:setVar("NoStringsAttachedProgress",1); player:addQuest(AHT_URHGAN,NO_STRINGS_ATTACHED); end; end;
gpl-3.0
davidedmonds/darkstar
scripts/globals/items/serving_of_cilbir.lua
35
1562
----------------------------------------- -- ID: 5642 -- Item: serving_of_cilbir -- Food Effect: 3Hrs, All Races ----------------------------------------- -- HP % 5 -- MP % 5 -- HP recovered while healing 3 -- MP recovered while healing 3 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,5642); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_HPP, 5); target:addMod(MOD_FOOD_HP_CAP, 999); target:addMod(MOD_FOOD_MPP, 5); target:addMod(MOD_FOOD_MP_CAP, 999); target:addMod(MOD_MPHEAL, 3); target:addMod(MOD_HPHEAL, 3); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_HPP, 5); target:delMod(MOD_FOOD_HP_CAP, 999); target:delMod(MOD_FOOD_MPP, 5); target:delMod(MOD_FOOD_MP_CAP, 999); target:delMod(MOD_MPHEAL, 3); target:delMod(MOD_HPHEAL, 3); end;
gpl-3.0
waterlgndx/darkstar
scripts/commands/hp.lua
22
1359
--------------------------------------------------------------------------------------------------- -- func: hp <amount> <player> -- desc: Sets the GM or target players health. --------------------------------------------------------------------------------------------------- cmdprops = { permission = 1, parameters = "is" }; function error(player, msg) player:PrintToPlayer(msg); player:PrintToPlayer("!hp <amount> {player}"); end; function onTrigger(player, hp, target) -- validate amount if (hp == nil or tonumber(hp) == nil) then error(player, "You must provide an amount."); return; elseif (hp < 0) then error(player, "Invalid amount."); return; end -- validate target local targ; if (target == nil) then targ = player; else targ = GetPlayerByName(target); if (targ == nil) then error(player, string.format( "Player named '%s' not found!", target ) ); return; end end -- set hp if (targ:getHP() > 0) then targ:setHP(hp); if(targ:getID() ~= player:getID()) then player:PrintToPlayer(string.format("Set %s's HP to %i.", targ:getName(), targ:getHP())); end else player:PrintToPlayer(string.format("%s is currently dead.", targ:getName())); end end
gpl-3.0
xingh/google-diff-match-patch
lua/diff_match_patch.lua
265
73869
--[[ * Diff Match and Patch * * Copyright 2006 Google Inc. * http://code.google.com/p/google-diff-match-patch/ * * Based on the JavaScript implementation by Neil Fraser. * Ported to Lua by Duncan Cross. * * 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. --]] --[[ -- Lua 5.1 and earlier requires the external BitOp library. -- This library is built-in from Lua 5.2 and later as 'bit32'. require 'bit' -- <http://bitop.luajit.org/> local band, bor, lshift = bit.band, bit.bor, bit.lshift --]] local band, bor, lshift = bit32.band, bit32.bor, bit32.lshift local type, setmetatable, ipairs, select = type, setmetatable, ipairs, select local unpack, tonumber, error = unpack, tonumber, error local strsub, strbyte, strchar, gmatch, gsub = string.sub, string.byte, string.char, string.gmatch, string.gsub local strmatch, strfind, strformat = string.match, string.find, string.format local tinsert, tremove, tconcat = table.insert, table.remove, table.concat local max, min, floor, ceil, abs = math.max, math.min, math.floor, math.ceil, math.abs local clock = os.clock -- Utility functions. local percentEncode_pattern = '[^A-Za-z0-9%-=;\',./~!@#$%&*%(%)_%+ %?]' local function percentEncode_replace(v) return strformat('%%%02X', strbyte(v)) end local function tsplice(t, idx, deletions, ...) local insertions = select('#', ...) for i = 1, deletions do tremove(t, idx) end for i = insertions, 1, -1 do -- do not remove parentheses around select tinsert(t, idx, (select(i, ...))) end end local function strelement(str, i) return strsub(str, i, i) end local function indexOf(a, b, start) if (#b == 0) then return nil end return strfind(a, b, start, true) end local htmlEncode_pattern = '[&<>\n]' local htmlEncode_replace = { ['&'] = '&amp;', ['<'] = '&lt;', ['>'] = '&gt;', ['\n'] = '&para;<br>' } -- Public API Functions -- (Exported at the end of the script) local diff_main, diff_cleanupSemantic, diff_cleanupEfficiency, diff_levenshtein, diff_prettyHtml local match_main local patch_make, patch_toText, patch_fromText, patch_apply --[[ * The data structure representing a diff is an array of tuples: * {{DIFF_DELETE, 'Hello'}, {DIFF_INSERT, 'Goodbye'}, {DIFF_EQUAL, ' world.'}} * which means: delete 'Hello', add 'Goodbye' and keep ' world.' --]] local DIFF_DELETE = -1 local DIFF_INSERT = 1 local DIFF_EQUAL = 0 -- Number of seconds to map a diff before giving up (0 for infinity). local Diff_Timeout = 1.0 -- Cost of an empty edit operation in terms of edit characters. local Diff_EditCost = 4 -- At what point is no match declared (0.0 = perfection, 1.0 = very loose). local Match_Threshold = 0.5 -- How far to search for a match (0 = exact location, 1000+ = broad match). -- A match this many characters away from the expected location will add -- 1.0 to the score (0.0 is a perfect match). local Match_Distance = 1000 -- When deleting a large block of text (over ~64 characters), how close do -- the contents have to be to match the expected contents. (0.0 = perfection, -- 1.0 = very loose). Note that Match_Threshold controls how closely the -- end points of a delete need to match. local Patch_DeleteThreshold = 0.5 -- Chunk size for context length. local Patch_Margin = 4 -- The number of bits in an int. local Match_MaxBits = 32 function settings(new) if new then Diff_Timeout = new.Diff_Timeout or Diff_Timeout Diff_EditCost = new.Diff_EditCost or Diff_EditCost Match_Threshold = new.Match_Threshold or Match_Threshold Match_Distance = new.Match_Distance or Match_Distance Patch_DeleteThreshold = new.Patch_DeleteThreshold or Patch_DeleteThreshold Patch_Margin = new.Patch_Margin or Patch_Margin Match_MaxBits = new.Match_MaxBits or Match_MaxBits else return { Diff_Timeout = Diff_Timeout; Diff_EditCost = Diff_EditCost; Match_Threshold = Match_Threshold; Match_Distance = Match_Distance; Patch_DeleteThreshold = Patch_DeleteThreshold; Patch_Margin = Patch_Margin; Match_MaxBits = Match_MaxBits; } end end -- --------------------------------------------------------------------------- -- DIFF API -- --------------------------------------------------------------------------- -- The private diff functions local _diff_compute, _diff_bisect, _diff_halfMatchI, _diff_halfMatch, _diff_cleanupSemanticScore, _diff_cleanupSemanticLossless, _diff_cleanupMerge, _diff_commonPrefix, _diff_commonSuffix, _diff_commonOverlap, _diff_xIndex, _diff_text1, _diff_text2, _diff_toDelta, _diff_fromDelta --[[ * Find the differences between two texts. Simplifies the problem by stripping * any common prefix or suffix off the texts before diffing. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {boolean} opt_checklines Has no effect in Lua. * @param {number} opt_deadline Optional time when the diff should be complete * by. Used internally for recursive calls. Users should set DiffTimeout * instead. * @return {Array.<Array.<number|string>>} Array of diff tuples. --]] function diff_main(text1, text2, opt_checklines, opt_deadline) -- Set a deadline by which time the diff must be complete. if opt_deadline == nil then if Diff_Timeout <= 0 then opt_deadline = 2 ^ 31 else opt_deadline = clock() + Diff_Timeout end end local deadline = opt_deadline -- Check for null inputs. if text1 == nil or text1 == nil then error('Null inputs. (diff_main)') end -- Check for equality (speedup). if text1 == text2 then if #text1 > 0 then return {{DIFF_EQUAL, text1}} end return {} end -- LUANOTE: Due to the lack of Unicode support, Lua is incapable of -- implementing the line-mode speedup. local checklines = false -- Trim off common prefix (speedup). local commonlength = _diff_commonPrefix(text1, text2) local commonprefix if commonlength > 0 then commonprefix = strsub(text1, 1, commonlength) text1 = strsub(text1, commonlength + 1) text2 = strsub(text2, commonlength + 1) end -- Trim off common suffix (speedup). commonlength = _diff_commonSuffix(text1, text2) local commonsuffix if commonlength > 0 then commonsuffix = strsub(text1, -commonlength) text1 = strsub(text1, 1, -commonlength - 1) text2 = strsub(text2, 1, -commonlength - 1) end -- Compute the diff on the middle block. local diffs = _diff_compute(text1, text2, checklines, deadline) -- Restore the prefix and suffix. if commonprefix then tinsert(diffs, 1, {DIFF_EQUAL, commonprefix}) end if commonsuffix then diffs[#diffs + 1] = {DIFF_EQUAL, commonsuffix} end _diff_cleanupMerge(diffs) return diffs end --[[ * Reduce the number of edits by eliminating semantically trivial equalities. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. --]] function diff_cleanupSemantic(diffs) local changes = false local equalities = {} -- Stack of indices where equalities are found. local equalitiesLength = 0 -- Keeping our own length var is faster. local lastequality = nil -- Always equal to diffs[equalities[equalitiesLength]][2] local pointer = 1 -- Index of current position. -- Number of characters that changed prior to the equality. local length_insertions1 = 0 local length_deletions1 = 0 -- Number of characters that changed after the equality. local length_insertions2 = 0 local length_deletions2 = 0 while diffs[pointer] do if diffs[pointer][1] == DIFF_EQUAL then -- Equality found. equalitiesLength = equalitiesLength + 1 equalities[equalitiesLength] = pointer length_insertions1 = length_insertions2 length_deletions1 = length_deletions2 length_insertions2 = 0 length_deletions2 = 0 lastequality = diffs[pointer][2] else -- An insertion or deletion. if diffs[pointer][1] == DIFF_INSERT then length_insertions2 = length_insertions2 + #(diffs[pointer][2]) else length_deletions2 = length_deletions2 + #(diffs[pointer][2]) end -- Eliminate an equality that is smaller or equal to the edits on both -- sides of it. if lastequality and (#lastequality <= max(length_insertions1, length_deletions1)) and (#lastequality <= max(length_insertions2, length_deletions2)) then -- Duplicate record. tinsert(diffs, equalities[equalitiesLength], {DIFF_DELETE, lastequality}) -- Change second copy to insert. diffs[equalities[equalitiesLength] + 1][1] = DIFF_INSERT -- Throw away the equality we just deleted. equalitiesLength = equalitiesLength - 1 -- Throw away the previous equality (it needs to be reevaluated). equalitiesLength = equalitiesLength - 1 pointer = (equalitiesLength > 0) and equalities[equalitiesLength] or 0 length_insertions1, length_deletions1 = 0, 0 -- Reset the counters. length_insertions2, length_deletions2 = 0, 0 lastequality = nil changes = true end end pointer = pointer + 1 end -- Normalize the diff. if changes then _diff_cleanupMerge(diffs) end _diff_cleanupSemanticLossless(diffs) -- Find any overlaps between deletions and insertions. -- e.g: <del>abcxxx</del><ins>xxxdef</ins> -- -> <del>abc</del>xxx<ins>def</ins> -- e.g: <del>xxxabc</del><ins>defxxx</ins> -- -> <ins>def</ins>xxx<del>abc</del> -- Only extract an overlap if it is as big as the edit ahead or behind it. pointer = 2 while diffs[pointer] do if (diffs[pointer - 1][1] == DIFF_DELETE and diffs[pointer][1] == DIFF_INSERT) then local deletion = diffs[pointer - 1][2] local insertion = diffs[pointer][2] local overlap_length1 = _diff_commonOverlap(deletion, insertion) local overlap_length2 = _diff_commonOverlap(insertion, deletion) if (overlap_length1 >= overlap_length2) then if (overlap_length1 >= #deletion / 2 or overlap_length1 >= #insertion / 2) then -- Overlap found. Insert an equality and trim the surrounding edits. tinsert(diffs, pointer, {DIFF_EQUAL, strsub(insertion, 1, overlap_length1)}) diffs[pointer - 1][2] = strsub(deletion, 1, #deletion - overlap_length1) diffs[pointer + 1][2] = strsub(insertion, overlap_length1 + 1) pointer = pointer + 1 end else if (overlap_length2 >= #deletion / 2 or overlap_length2 >= #insertion / 2) then -- Reverse overlap found. -- Insert an equality and swap and trim the surrounding edits. tinsert(diffs, pointer, {DIFF_EQUAL, strsub(deletion, 1, overlap_length2)}) diffs[pointer - 1] = {DIFF_INSERT, strsub(insertion, 1, #insertion - overlap_length2)} diffs[pointer + 1] = {DIFF_DELETE, strsub(deletion, overlap_length2 + 1)} pointer = pointer + 1 end end pointer = pointer + 1 end pointer = pointer + 1 end end --[[ * Reduce the number of edits by eliminating operationally trivial equalities. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. --]] function diff_cleanupEfficiency(diffs) local changes = false -- Stack of indices where equalities are found. local equalities = {} -- Keeping our own length var is faster. local equalitiesLength = 0 -- Always equal to diffs[equalities[equalitiesLength]][2] local lastequality = nil -- Index of current position. local pointer = 1 -- The following four are really booleans but are stored as numbers because -- they are used at one point like this: -- -- (pre_ins + pre_del + post_ins + post_del) == 3 -- -- ...i.e. checking that 3 of them are true and 1 of them is false. -- Is there an insertion operation before the last equality. local pre_ins = 0 -- Is there a deletion operation before the last equality. local pre_del = 0 -- Is there an insertion operation after the last equality. local post_ins = 0 -- Is there a deletion operation after the last equality. local post_del = 0 while diffs[pointer] do if diffs[pointer][1] == DIFF_EQUAL then -- Equality found. local diffText = diffs[pointer][2] if (#diffText < Diff_EditCost) and (post_ins == 1 or post_del == 1) then -- Candidate found. equalitiesLength = equalitiesLength + 1 equalities[equalitiesLength] = pointer pre_ins, pre_del = post_ins, post_del lastequality = diffText else -- Not a candidate, and can never become one. equalitiesLength = 0 lastequality = nil end post_ins, post_del = 0, 0 else -- An insertion or deletion. if diffs[pointer][1] == DIFF_DELETE then post_del = 1 else post_ins = 1 end --[[ * Five types to be split: * <ins>A</ins><del>B</del>XY<ins>C</ins><del>D</del> * <ins>A</ins>X<ins>C</ins><del>D</del> * <ins>A</ins><del>B</del>X<ins>C</ins> * <ins>A</del>X<ins>C</ins><del>D</del> * <ins>A</ins><del>B</del>X<del>C</del> --]] if lastequality and ( (pre_ins+pre_del+post_ins+post_del == 4) or ( (#lastequality < Diff_EditCost / 2) and (pre_ins+pre_del+post_ins+post_del == 3) )) then -- Duplicate record. tinsert(diffs, equalities[equalitiesLength], {DIFF_DELETE, lastequality}) -- Change second copy to insert. diffs[equalities[equalitiesLength] + 1][1] = DIFF_INSERT -- Throw away the equality we just deleted. equalitiesLength = equalitiesLength - 1 lastequality = nil if (pre_ins == 1) and (pre_del == 1) then -- No changes made which could affect previous entry, keep going. post_ins, post_del = 1, 1 equalitiesLength = 0 else -- Throw away the previous equality. equalitiesLength = equalitiesLength - 1 pointer = (equalitiesLength > 0) and equalities[equalitiesLength] or 0 post_ins, post_del = 0, 0 end changes = true end end pointer = pointer + 1 end if changes then _diff_cleanupMerge(diffs) end end --[[ * Compute the Levenshtein distance; the number of inserted, deleted or * substituted characters. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. * @return {number} Number of changes. --]] function diff_levenshtein(diffs) local levenshtein = 0 local insertions, deletions = 0, 0 for x, diff in ipairs(diffs) do local op, data = diff[1], diff[2] if (op == DIFF_INSERT) then insertions = insertions + #data elseif (op == DIFF_DELETE) then deletions = deletions + #data elseif (op == DIFF_EQUAL) then -- A deletion and an insertion is one substitution. levenshtein = levenshtein + max(insertions, deletions) insertions = 0 deletions = 0 end end levenshtein = levenshtein + max(insertions, deletions) return levenshtein end --[[ * Convert a diff array into a pretty HTML report. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. * @return {string} HTML representation. --]] function diff_prettyHtml(diffs) local html = {} for x, diff in ipairs(diffs) do local op = diff[1] -- Operation (insert, delete, equal) local data = diff[2] -- Text of change. local text = gsub(data, htmlEncode_pattern, htmlEncode_replace) if op == DIFF_INSERT then html[x] = '<ins style="background:#e6ffe6;">' .. text .. '</ins>' elseif op == DIFF_DELETE then html[x] = '<del style="background:#ffe6e6;">' .. text .. '</del>' elseif op == DIFF_EQUAL then html[x] = '<span>' .. text .. '</span>' end end return tconcat(html) end -- --------------------------------------------------------------------------- -- UNOFFICIAL/PRIVATE DIFF FUNCTIONS -- --------------------------------------------------------------------------- --[[ * Find the differences between two texts. Assumes that the texts do not * have any common prefix or suffix. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {boolean} checklines Has no effect in Lua. * @param {number} deadline Time when the diff should be complete by. * @return {Array.<Array.<number|string>>} Array of diff tuples. * @private --]] function _diff_compute(text1, text2, checklines, deadline) if #text1 == 0 then -- Just add some text (speedup). return {{DIFF_INSERT, text2}} end if #text2 == 0 then -- Just delete some text (speedup). return {{DIFF_DELETE, text1}} end local diffs local longtext = (#text1 > #text2) and text1 or text2 local shorttext = (#text1 > #text2) and text2 or text1 local i = indexOf(longtext, shorttext) if i ~= nil then -- Shorter text is inside the longer text (speedup). diffs = { {DIFF_INSERT, strsub(longtext, 1, i - 1)}, {DIFF_EQUAL, shorttext}, {DIFF_INSERT, strsub(longtext, i + #shorttext)} } -- Swap insertions for deletions if diff is reversed. if #text1 > #text2 then diffs[1][1], diffs[3][1] = DIFF_DELETE, DIFF_DELETE end return diffs end if #shorttext == 1 then -- Single character string. -- After the previous speedup, the character can't be an equality. return {{DIFF_DELETE, text1}, {DIFF_INSERT, text2}} end -- Check to see if the problem can be split in two. do local text1_a, text1_b, text2_a, text2_b, mid_common = _diff_halfMatch(text1, text2) if text1_a then -- A half-match was found, sort out the return data. -- Send both pairs off for separate processing. local diffs_a = diff_main(text1_a, text2_a, checklines, deadline) local diffs_b = diff_main(text1_b, text2_b, checklines, deadline) -- Merge the results. local diffs_a_len = #diffs_a diffs = diffs_a diffs[diffs_a_len + 1] = {DIFF_EQUAL, mid_common} for i, b_diff in ipairs(diffs_b) do diffs[diffs_a_len + 1 + i] = b_diff end return diffs end end return _diff_bisect(text1, text2, deadline) end --[[ * Find the 'middle snake' of a diff, split the problem in two * and return the recursively constructed diff. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {number} deadline Time at which to bail if not yet complete. * @return {Array.<Array.<number|string>>} Array of diff tuples. * @private --]] function _diff_bisect(text1, text2, deadline) -- Cache the text lengths to prevent multiple calls. local text1_length = #text1 local text2_length = #text2 local _sub, _element local max_d = ceil((text1_length + text2_length) / 2) local v_offset = max_d local v_length = 2 * max_d local v1 = {} local v2 = {} -- Setting all elements to -1 is faster in Lua than mixing integers and nil. for x = 0, v_length - 1 do v1[x] = -1 v2[x] = -1 end v1[v_offset + 1] = 0 v2[v_offset + 1] = 0 local delta = text1_length - text2_length -- If the total number of characters is odd, then -- the front path will collide with the reverse path. local front = (delta % 2 ~= 0) -- Offsets for start and end of k loop. -- Prevents mapping of space beyond the grid. local k1start = 0 local k1end = 0 local k2start = 0 local k2end = 0 for d = 0, max_d - 1 do -- Bail out if deadline is reached. if clock() > deadline then break end -- Walk the front path one step. for k1 = -d + k1start, d - k1end, 2 do local k1_offset = v_offset + k1 local x1 if (k1 == -d) or ((k1 ~= d) and (v1[k1_offset - 1] < v1[k1_offset + 1])) then x1 = v1[k1_offset + 1] else x1 = v1[k1_offset - 1] + 1 end local y1 = x1 - k1 while (x1 <= text1_length) and (y1 <= text2_length) and (strelement(text1, x1) == strelement(text2, y1)) do x1 = x1 + 1 y1 = y1 + 1 end v1[k1_offset] = x1 if x1 > text1_length + 1 then -- Ran off the right of the graph. k1end = k1end + 2 elseif y1 > text2_length + 1 then -- Ran off the bottom of the graph. k1start = k1start + 2 elseif front then local k2_offset = v_offset + delta - k1 if k2_offset >= 0 and k2_offset < v_length and v2[k2_offset] ~= -1 then -- Mirror x2 onto top-left coordinate system. local x2 = text1_length - v2[k2_offset] + 1 if x1 > x2 then -- Overlap detected. return _diff_bisectSplit(text1, text2, x1, y1, deadline) end end end end -- Walk the reverse path one step. for k2 = -d + k2start, d - k2end, 2 do local k2_offset = v_offset + k2 local x2 if (k2 == -d) or ((k2 ~= d) and (v2[k2_offset - 1] < v2[k2_offset + 1])) then x2 = v2[k2_offset + 1] else x2 = v2[k2_offset - 1] + 1 end local y2 = x2 - k2 while (x2 <= text1_length) and (y2 <= text2_length) and (strelement(text1, -x2) == strelement(text2, -y2)) do x2 = x2 + 1 y2 = y2 + 1 end v2[k2_offset] = x2 if x2 > text1_length + 1 then -- Ran off the left of the graph. k2end = k2end + 2 elseif y2 > text2_length + 1 then -- Ran off the top of the graph. k2start = k2start + 2 elseif not front then local k1_offset = v_offset + delta - k2 if k1_offset >= 0 and k1_offset < v_length and v1[k1_offset] ~= -1 then local x1 = v1[k1_offset] local y1 = v_offset + x1 - k1_offset -- Mirror x2 onto top-left coordinate system. x2 = text1_length - x2 + 1 if x1 > x2 then -- Overlap detected. return _diff_bisectSplit(text1, text2, x1, y1, deadline) end end end end end -- Diff took too long and hit the deadline or -- number of diffs equals number of characters, no commonality at all. return {{DIFF_DELETE, text1}, {DIFF_INSERT, text2}} end --[[ * Given the location of the 'middle snake', split the diff in two parts * and recurse. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {number} x Index of split point in text1. * @param {number} y Index of split point in text2. * @param {number} deadline Time at which to bail if not yet complete. * @return {Array.<Array.<number|string>>} Array of diff tuples. * @private --]] function _diff_bisectSplit(text1, text2, x, y, deadline) local text1a = strsub(text1, 1, x - 1) local text2a = strsub(text2, 1, y - 1) local text1b = strsub(text1, x) local text2b = strsub(text2, y) -- Compute both diffs serially. local diffs = diff_main(text1a, text2a, false, deadline) local diffsb = diff_main(text1b, text2b, false, deadline) local diffs_len = #diffs for i, v in ipairs(diffsb) do diffs[diffs_len + i] = v end return diffs end --[[ * Determine the common prefix of two strings. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {number} The number of characters common to the start of each * string. --]] function _diff_commonPrefix(text1, text2) -- Quick check for common null cases. if (#text1 == 0) or (#text2 == 0) or (strbyte(text1, 1) ~= strbyte(text2, 1)) then return 0 end -- Binary search. -- Performance analysis: http://neil.fraser.name/news/2007/10/09/ local pointermin = 1 local pointermax = min(#text1, #text2) local pointermid = pointermax local pointerstart = 1 while (pointermin < pointermid) do if (strsub(text1, pointerstart, pointermid) == strsub(text2, pointerstart, pointermid)) then pointermin = pointermid pointerstart = pointermin else pointermax = pointermid end pointermid = floor(pointermin + (pointermax - pointermin) / 2) end return pointermid end --[[ * Determine the common suffix of two strings. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {number} The number of characters common to the end of each string. --]] function _diff_commonSuffix(text1, text2) -- Quick check for common null cases. if (#text1 == 0) or (#text2 == 0) or (strbyte(text1, -1) ~= strbyte(text2, -1)) then return 0 end -- Binary search. -- Performance analysis: http://neil.fraser.name/news/2007/10/09/ local pointermin = 1 local pointermax = min(#text1, #text2) local pointermid = pointermax local pointerend = 1 while (pointermin < pointermid) do if (strsub(text1, -pointermid, -pointerend) == strsub(text2, -pointermid, -pointerend)) then pointermin = pointermid pointerend = pointermin else pointermax = pointermid end pointermid = floor(pointermin + (pointermax - pointermin) / 2) end return pointermid end --[[ * Determine if the suffix of one string is the prefix of another. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {number} The number of characters common to the end of the first * string and the start of the second string. * @private --]] function _diff_commonOverlap(text1, text2) -- Cache the text lengths to prevent multiple calls. local text1_length = #text1 local text2_length = #text2 -- Eliminate the null case. if text1_length == 0 or text2_length == 0 then return 0 end -- Truncate the longer string. if text1_length > text2_length then text1 = strsub(text1, text1_length - text2_length + 1) elseif text1_length < text2_length then text2 = strsub(text2, 1, text1_length) end local text_length = min(text1_length, text2_length) -- Quick check for the worst case. if text1 == text2 then return text_length end -- Start by looking for a single character match -- and increase length until no match is found. -- Performance analysis: http://neil.fraser.name/news/2010/11/04/ local best = 0 local length = 1 while true do local pattern = strsub(text1, text_length - length + 1) local found = strfind(text2, pattern, 1, true) if found == nil then return best end length = length + found - 1 if found == 1 or strsub(text1, text_length - length + 1) == strsub(text2, 1, length) then best = length length = length + 1 end end end --[[ * Does a substring of shorttext exist within longtext such that the substring * is at least half the length of longtext? * This speedup can produce non-minimal diffs. * Closure, but does not reference any external variables. * @param {string} longtext Longer string. * @param {string} shorttext Shorter string. * @param {number} i Start index of quarter length substring within longtext. * @return {?Array.<string>} Five element Array, containing the prefix of * longtext, the suffix of longtext, the prefix of shorttext, the suffix * of shorttext and the common middle. Or nil if there was no match. * @private --]] function _diff_halfMatchI(longtext, shorttext, i) -- Start with a 1/4 length substring at position i as a seed. local seed = strsub(longtext, i, i + floor(#longtext / 4)) local j = 0 -- LUANOTE: do not change to 1, was originally -1 local best_common = '' local best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b while true do j = indexOf(shorttext, seed, j + 1) if (j == nil) then break end local prefixLength = _diff_commonPrefix(strsub(longtext, i), strsub(shorttext, j)) local suffixLength = _diff_commonSuffix(strsub(longtext, 1, i - 1), strsub(shorttext, 1, j - 1)) if #best_common < suffixLength + prefixLength then best_common = strsub(shorttext, j - suffixLength, j - 1) .. strsub(shorttext, j, j + prefixLength - 1) best_longtext_a = strsub(longtext, 1, i - suffixLength - 1) best_longtext_b = strsub(longtext, i + prefixLength) best_shorttext_a = strsub(shorttext, 1, j - suffixLength - 1) best_shorttext_b = strsub(shorttext, j + prefixLength) end end if #best_common * 2 >= #longtext then return {best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common} else return nil end end --[[ * Do the two texts share a substring which is at least half the length of the * longer text? * @param {string} text1 First string. * @param {string} text2 Second string. * @return {?Array.<string>} Five element Array, containing the prefix of * text1, the suffix of text1, the prefix of text2, the suffix of * text2 and the common middle. Or nil if there was no match. * @private --]] function _diff_halfMatch(text1, text2) if Diff_Timeout <= 0 then -- Don't risk returning a non-optimal diff if we have unlimited time. return nil end local longtext = (#text1 > #text2) and text1 or text2 local shorttext = (#text1 > #text2) and text2 or text1 if (#longtext < 4) or (#shorttext * 2 < #longtext) then return nil -- Pointless. end -- First check if the second quarter is the seed for a half-match. local hm1 = _diff_halfMatchI(longtext, shorttext, ceil(#longtext / 4)) -- Check again based on the third quarter. local hm2 = _diff_halfMatchI(longtext, shorttext, ceil(#longtext / 2)) local hm if not hm1 and not hm2 then return nil elseif not hm2 then hm = hm1 elseif not hm1 then hm = hm2 else -- Both matched. Select the longest. hm = (#hm1[5] > #hm2[5]) and hm1 or hm2 end -- A half-match was found, sort out the return data. local text1_a, text1_b, text2_a, text2_b if (#text1 > #text2) then text1_a, text1_b = hm[1], hm[2] text2_a, text2_b = hm[3], hm[4] else text2_a, text2_b = hm[1], hm[2] text1_a, text1_b = hm[3], hm[4] end local mid_common = hm[5] return text1_a, text1_b, text2_a, text2_b, mid_common end --[[ * Given two strings, compute a score representing whether the internal * boundary falls on logical boundaries. * Scores range from 6 (best) to 0 (worst). * @param {string} one First string. * @param {string} two Second string. * @return {number} The score. * @private --]] function _diff_cleanupSemanticScore(one, two) if (#one == 0) or (#two == 0) then -- Edges are the best. return 6 end -- Each port of this function behaves slightly differently due to -- subtle differences in each language's definition of things like -- 'whitespace'. Since this function's purpose is largely cosmetic, -- the choice has been made to use each language's native features -- rather than force total conformity. local char1 = strsub(one, -1) local char2 = strsub(two, 1, 1) local nonAlphaNumeric1 = strmatch(char1, '%W') local nonAlphaNumeric2 = strmatch(char2, '%W') local whitespace1 = nonAlphaNumeric1 and strmatch(char1, '%s') local whitespace2 = nonAlphaNumeric2 and strmatch(char2, '%s') local lineBreak1 = whitespace1 and strmatch(char1, '%c') local lineBreak2 = whitespace2 and strmatch(char2, '%c') local blankLine1 = lineBreak1 and strmatch(one, '\n\r?\n$') local blankLine2 = lineBreak2 and strmatch(two, '^\r?\n\r?\n') if blankLine1 or blankLine2 then -- Five points for blank lines. return 5 elseif lineBreak1 or lineBreak2 then -- Four points for line breaks. return 4 elseif nonAlphaNumeric1 and not whitespace1 and whitespace2 then -- Three points for end of sentences. return 3 elseif whitespace1 or whitespace2 then -- Two points for whitespace. return 2 elseif nonAlphaNumeric1 or nonAlphaNumeric2 then -- One point for non-alphanumeric. return 1 end return 0 end --[[ * Look for single edits surrounded on both sides by equalities * which can be shifted sideways to align the edit to a word boundary. * e.g: The c<ins>at c</ins>ame. -> The <ins>cat </ins>came. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. --]] function _diff_cleanupSemanticLossless(diffs) local pointer = 2 -- Intentionally ignore the first and last element (don't need checking). while diffs[pointer + 1] do local prevDiff, nextDiff = diffs[pointer - 1], diffs[pointer + 1] if (prevDiff[1] == DIFF_EQUAL) and (nextDiff[1] == DIFF_EQUAL) then -- This is a single edit surrounded by equalities. local diff = diffs[pointer] local equality1 = prevDiff[2] local edit = diff[2] local equality2 = nextDiff[2] -- First, shift the edit as far left as possible. local commonOffset = _diff_commonSuffix(equality1, edit) if commonOffset > 0 then local commonString = strsub(edit, -commonOffset) equality1 = strsub(equality1, 1, -commonOffset - 1) edit = commonString .. strsub(edit, 1, -commonOffset - 1) equality2 = commonString .. equality2 end -- Second, step character by character right, looking for the best fit. local bestEquality1 = equality1 local bestEdit = edit local bestEquality2 = equality2 local bestScore = _diff_cleanupSemanticScore(equality1, edit) + _diff_cleanupSemanticScore(edit, equality2) while strbyte(edit, 1) == strbyte(equality2, 1) do equality1 = equality1 .. strsub(edit, 1, 1) edit = strsub(edit, 2) .. strsub(equality2, 1, 1) equality2 = strsub(equality2, 2) local score = _diff_cleanupSemanticScore(equality1, edit) + _diff_cleanupSemanticScore(edit, equality2) -- The >= encourages trailing rather than leading whitespace on edits. if score >= bestScore then bestScore = score bestEquality1 = equality1 bestEdit = edit bestEquality2 = equality2 end end if prevDiff[2] ~= bestEquality1 then -- We have an improvement, save it back to the diff. if #bestEquality1 > 0 then diffs[pointer - 1][2] = bestEquality1 else tremove(diffs, pointer - 1) pointer = pointer - 1 end diffs[pointer][2] = bestEdit if #bestEquality2 > 0 then diffs[pointer + 1][2] = bestEquality2 else tremove(diffs, pointer + 1, 1) pointer = pointer - 1 end end end pointer = pointer + 1 end end --[[ * Reorder and merge like edit sections. Merge equalities. * Any edit section can move as long as it doesn't cross an equality. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. --]] function _diff_cleanupMerge(diffs) diffs[#diffs + 1] = {DIFF_EQUAL, ''} -- Add a dummy entry at the end. local pointer = 1 local count_delete, count_insert = 0, 0 local text_delete, text_insert = '', '' local commonlength while diffs[pointer] do local diff_type = diffs[pointer][1] if diff_type == DIFF_INSERT then count_insert = count_insert + 1 text_insert = text_insert .. diffs[pointer][2] pointer = pointer + 1 elseif diff_type == DIFF_DELETE then count_delete = count_delete + 1 text_delete = text_delete .. diffs[pointer][2] pointer = pointer + 1 elseif diff_type == DIFF_EQUAL then -- Upon reaching an equality, check for prior redundancies. if count_delete + count_insert > 1 then if (count_delete > 0) and (count_insert > 0) then -- Factor out any common prefixies. commonlength = _diff_commonPrefix(text_insert, text_delete) if commonlength > 0 then local back_pointer = pointer - count_delete - count_insert if (back_pointer > 1) and (diffs[back_pointer - 1][1] == DIFF_EQUAL) then diffs[back_pointer - 1][2] = diffs[back_pointer - 1][2] .. strsub(text_insert, 1, commonlength) else tinsert(diffs, 1, {DIFF_EQUAL, strsub(text_insert, 1, commonlength)}) pointer = pointer + 1 end text_insert = strsub(text_insert, commonlength + 1) text_delete = strsub(text_delete, commonlength + 1) end -- Factor out any common suffixies. commonlength = _diff_commonSuffix(text_insert, text_delete) if commonlength ~= 0 then diffs[pointer][2] = strsub(text_insert, -commonlength) .. diffs[pointer][2] text_insert = strsub(text_insert, 1, -commonlength - 1) text_delete = strsub(text_delete, 1, -commonlength - 1) end end -- Delete the offending records and add the merged ones. if count_delete == 0 then tsplice(diffs, pointer - count_insert, count_insert, {DIFF_INSERT, text_insert}) elseif count_insert == 0 then tsplice(diffs, pointer - count_delete, count_delete, {DIFF_DELETE, text_delete}) else tsplice(diffs, pointer - count_delete - count_insert, count_delete + count_insert, {DIFF_DELETE, text_delete}, {DIFF_INSERT, text_insert}) end pointer = pointer - count_delete - count_insert + (count_delete>0 and 1 or 0) + (count_insert>0 and 1 or 0) + 1 elseif (pointer > 1) and (diffs[pointer - 1][1] == DIFF_EQUAL) then -- Merge this equality with the previous one. diffs[pointer - 1][2] = diffs[pointer - 1][2] .. diffs[pointer][2] tremove(diffs, pointer) else pointer = pointer + 1 end count_insert, count_delete = 0, 0 text_delete, text_insert = '', '' end end if diffs[#diffs][2] == '' then diffs[#diffs] = nil -- Remove the dummy entry at the end. end -- Second pass: look for single edits surrounded on both sides by equalities -- which can be shifted sideways to eliminate an equality. -- e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC local changes = false pointer = 2 -- Intentionally ignore the first and last element (don't need checking). while pointer < #diffs do local prevDiff, nextDiff = diffs[pointer - 1], diffs[pointer + 1] if (prevDiff[1] == DIFF_EQUAL) and (nextDiff[1] == DIFF_EQUAL) then -- This is a single edit surrounded by equalities. local diff = diffs[pointer] local currentText = diff[2] local prevText = prevDiff[2] local nextText = nextDiff[2] if strsub(currentText, -#prevText) == prevText then -- Shift the edit over the previous equality. diff[2] = prevText .. strsub(currentText, 1, -#prevText - 1) nextDiff[2] = prevText .. nextDiff[2] tremove(diffs, pointer - 1) changes = true elseif strsub(currentText, 1, #nextText) == nextText then -- Shift the edit over the next equality. prevDiff[2] = prevText .. nextText diff[2] = strsub(currentText, #nextText + 1) .. nextText tremove(diffs, pointer + 1) changes = true end end pointer = pointer + 1 end -- If shifts were made, the diff needs reordering and another shift sweep. if changes then -- LUANOTE: no return value, but necessary to use 'return' to get -- tail calls. return _diff_cleanupMerge(diffs) end end --[[ * loc is a location in text1, compute and return the equivalent location in * text2. * e.g. 'The cat' vs 'The big cat', 1->1, 5->8 * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. * @param {number} loc Location within text1. * @return {number} Location within text2. --]] function _diff_xIndex(diffs, loc) local chars1 = 1 local chars2 = 1 local last_chars1 = 1 local last_chars2 = 1 local x for _x, diff in ipairs(diffs) do x = _x if diff[1] ~= DIFF_INSERT then -- Equality or deletion. chars1 = chars1 + #diff[2] end if diff[1] ~= DIFF_DELETE then -- Equality or insertion. chars2 = chars2 + #diff[2] end if chars1 > loc then -- Overshot the location. break end last_chars1 = chars1 last_chars2 = chars2 end -- Was the location deleted? if diffs[x + 1] and (diffs[x][1] == DIFF_DELETE) then return last_chars2 end -- Add the remaining character length. return last_chars2 + (loc - last_chars1) end --[[ * Compute and return the source text (all equalities and deletions). * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. * @return {string} Source text. --]] function _diff_text1(diffs) local text = {} for x, diff in ipairs(diffs) do if diff[1] ~= DIFF_INSERT then text[#text + 1] = diff[2] end end return tconcat(text) end --[[ * Compute and return the destination text (all equalities and insertions). * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. * @return {string} Destination text. --]] function _diff_text2(diffs) local text = {} for x, diff in ipairs(diffs) do if diff[1] ~= DIFF_DELETE then text[#text + 1] = diff[2] end end return tconcat(text) end --[[ * Crush the diff into an encoded string which describes the operations * required to transform text1 into text2. * E.g. =3\t-2\t+ing -> Keep 3 chars, delete 2 chars, insert 'ing'. * Operations are tab-separated. Inserted text is escaped using %xx notation. * @param {Array.<Array.<number|string>>} diffs Array of diff tuples. * @return {string} Delta text. --]] function _diff_toDelta(diffs) local text = {} for x, diff in ipairs(diffs) do local op, data = diff[1], diff[2] if op == DIFF_INSERT then text[x] = '+' .. gsub(data, percentEncode_pattern, percentEncode_replace) elseif op == DIFF_DELETE then text[x] = '-' .. #data elseif op == DIFF_EQUAL then text[x] = '=' .. #data end end return tconcat(text, '\t') end --[[ * Given the original text1, and an encoded string which describes the * operations required to transform text1 into text2, compute the full diff. * @param {string} text1 Source string for the diff. * @param {string} delta Delta text. * @return {Array.<Array.<number|string>>} Array of diff tuples. * @throws {Errorend If invalid input. --]] function _diff_fromDelta(text1, delta) local diffs = {} local diffsLength = 0 -- Keeping our own length var is faster local pointer = 1 -- Cursor in text1 for token in gmatch(delta, '[^\t]+') do -- Each token begins with a one character parameter which specifies the -- operation of this token (delete, insert, equality). local tokenchar, param = strsub(token, 1, 1), strsub(token, 2) if (tokenchar == '+') then local invalidDecode = false local decoded = gsub(param, '%%(.?.?)', function(c) local n = tonumber(c, 16) if (#c ~= 2) or (n == nil) then invalidDecode = true return '' end return strchar(n) end) if invalidDecode then -- Malformed URI sequence. error('Illegal escape in _diff_fromDelta: ' .. param) end diffsLength = diffsLength + 1 diffs[diffsLength] = {DIFF_INSERT, decoded} elseif (tokenchar == '-') or (tokenchar == '=') then local n = tonumber(param) if (n == nil) or (n < 0) then error('Invalid number in _diff_fromDelta: ' .. param) end local text = strsub(text1, pointer, pointer + n - 1) pointer = pointer + n if (tokenchar == '=') then diffsLength = diffsLength + 1 diffs[diffsLength] = {DIFF_EQUAL, text} else diffsLength = diffsLength + 1 diffs[diffsLength] = {DIFF_DELETE, text} end else error('Invalid diff operation in _diff_fromDelta: ' .. token) end end if (pointer ~= #text1 + 1) then error('Delta length (' .. (pointer - 1) .. ') does not equal source text length (' .. #text1 .. ').') end return diffs end -- --------------------------------------------------------------------------- -- MATCH API -- --------------------------------------------------------------------------- local _match_bitap, _match_alphabet --[[ * Locate the best instance of 'pattern' in 'text' near 'loc'. * @param {string} text The text to search. * @param {string} pattern The pattern to search for. * @param {number} loc The location to search around. * @return {number} Best match index or -1. --]] function match_main(text, pattern, loc) -- Check for null inputs. if text == nil or pattern == nil or loc == nil then error('Null inputs. (match_main)') end if text == pattern then -- Shortcut (potentially not guaranteed by the algorithm) return 1 elseif #text == 0 then -- Nothing to match. return -1 end loc = max(1, min(loc, #text)) if strsub(text, loc, loc + #pattern - 1) == pattern then -- Perfect match at the perfect spot! (Includes case of null pattern) return loc else -- Do a fuzzy compare. return _match_bitap(text, pattern, loc) end end -- --------------------------------------------------------------------------- -- UNOFFICIAL/PRIVATE MATCH FUNCTIONS -- --------------------------------------------------------------------------- --[[ * Initialise the alphabet for the Bitap algorithm. * @param {string} pattern The text to encode. * @return {Object} Hash of character locations. * @private --]] function _match_alphabet(pattern) local s = {} local i = 0 for c in gmatch(pattern, '.') do s[c] = bor(s[c] or 0, lshift(1, #pattern - i - 1)) i = i + 1 end return s end --[[ * Locate the best instance of 'pattern' in 'text' near 'loc' using the * Bitap algorithm. * @param {string} text The text to search. * @param {string} pattern The pattern to search for. * @param {number} loc The location to search around. * @return {number} Best match index or -1. * @private --]] function _match_bitap(text, pattern, loc) if #pattern > Match_MaxBits then error('Pattern too long.') end -- Initialise the alphabet. local s = _match_alphabet(pattern) --[[ * Compute and return the score for a match with e errors and x location. * Accesses loc and pattern through being a closure. * @param {number} e Number of errors in match. * @param {number} x Location of match. * @return {number} Overall score for match (0.0 = good, 1.0 = bad). * @private --]] local function _match_bitapScore(e, x) local accuracy = e / #pattern local proximity = abs(loc - x) if (Match_Distance == 0) then -- Dodge divide by zero error. return (proximity == 0) and 1 or accuracy end return accuracy + (proximity / Match_Distance) end -- Highest score beyond which we give up. local score_threshold = Match_Threshold -- Is there a nearby exact match? (speedup) local best_loc = indexOf(text, pattern, loc) if best_loc then score_threshold = min(_match_bitapScore(0, best_loc), score_threshold) -- LUANOTE: Ideally we'd also check from the other direction, but Lua -- doesn't have an efficent lastIndexOf function. end -- Initialise the bit arrays. local matchmask = lshift(1, #pattern - 1) best_loc = -1 local bin_min, bin_mid local bin_max = #pattern + #text local last_rd for d = 0, #pattern - 1, 1 do -- Scan for the best match; each iteration allows for one more error. -- Run a binary search to determine how far from 'loc' we can stray at this -- error level. bin_min = 0 bin_mid = bin_max while (bin_min < bin_mid) do if (_match_bitapScore(d, loc + bin_mid) <= score_threshold) then bin_min = bin_mid else bin_max = bin_mid end bin_mid = floor(bin_min + (bin_max - bin_min) / 2) end -- Use the result from this iteration as the maximum for the next. bin_max = bin_mid local start = max(1, loc - bin_mid + 1) local finish = min(loc + bin_mid, #text) + #pattern local rd = {} for j = start, finish do rd[j] = 0 end rd[finish + 1] = lshift(1, d) - 1 for j = finish, start, -1 do local charMatch = s[strsub(text, j - 1, j - 1)] or 0 if (d == 0) then -- First pass: exact match. rd[j] = band(bor((rd[j + 1] * 2), 1), charMatch) else -- Subsequent passes: fuzzy match. -- Functions instead of operators make this hella messy. rd[j] = bor( band( bor( lshift(rd[j + 1], 1), 1 ), charMatch ), bor( bor( lshift(bor(last_rd[j + 1], last_rd[j]), 1), 1 ), last_rd[j + 1] ) ) end if (band(rd[j], matchmask) ~= 0) then local score = _match_bitapScore(d, j - 1) -- This match will almost certainly be better than any existing match. -- But check anyway. if (score <= score_threshold) then -- Told you so. score_threshold = score best_loc = j - 1 if (best_loc > loc) then -- When passing loc, don't exceed our current distance from loc. start = max(1, loc * 2 - best_loc) else -- Already passed loc, downhill from here on in. break end end end end -- No hope for a (better) match at greater error levels. if (_match_bitapScore(d + 1, loc) > score_threshold) then break end last_rd = rd end return best_loc end -- ----------------------------------------------------------------------------- -- PATCH API -- ----------------------------------------------------------------------------- local _patch_addContext, _patch_deepCopy, _patch_addPadding, _patch_splitMax, _patch_appendText, _new_patch_obj --[[ * Compute a list of patches to turn text1 into text2. * Use diffs if provided, otherwise compute it ourselves. * There are four ways to call this function, depending on what data is * available to the caller: * Method 1: * a = text1, b = text2 * Method 2: * a = diffs * Method 3 (optimal): * a = text1, b = diffs * Method 4 (deprecated, use method 3): * a = text1, b = text2, c = diffs * * @param {string|Array.<Array.<number|string>>} a text1 (methods 1,3,4) or * Array of diff tuples for text1 to text2 (method 2). * @param {string|Array.<Array.<number|string>>} opt_b text2 (methods 1,4) or * Array of diff tuples for text1 to text2 (method 3) or undefined (method 2). * @param {string|Array.<Array.<number|string>>} opt_c Array of diff tuples for * text1 to text2 (method 4) or undefined (methods 1,2,3). * @return {Array.<_new_patch_obj>} Array of patch objects. --]] function patch_make(a, opt_b, opt_c) local text1, diffs local type_a, type_b, type_c = type(a), type(opt_b), type(opt_c) if (type_a == 'string') and (type_b == 'string') and (type_c == 'nil') then -- Method 1: text1, text2 -- Compute diffs from text1 and text2. text1 = a diffs = diff_main(text1, opt_b, true) if (#diffs > 2) then diff_cleanupSemantic(diffs) diff_cleanupEfficiency(diffs) end elseif (type_a == 'table') and (type_b == 'nil') and (type_c == 'nil') then -- Method 2: diffs -- Compute text1 from diffs. diffs = a text1 = _diff_text1(diffs) elseif (type_a == 'string') and (type_b == 'table') and (type_c == 'nil') then -- Method 3: text1, diffs text1 = a diffs = opt_b elseif (type_a == 'string') and (type_b == 'string') and (type_c == 'table') then -- Method 4: text1, text2, diffs -- text2 is not used. text1 = a diffs = opt_c else error('Unknown call format to patch_make.') end if (diffs[1] == nil) then return {} -- Get rid of the null case. end local patches = {} local patch = _new_patch_obj() local patchDiffLength = 0 -- Keeping our own length var is faster. local char_count1 = 0 -- Number of characters into the text1 string. local char_count2 = 0 -- Number of characters into the text2 string. -- Start with text1 (prepatch_text) and apply the diffs until we arrive at -- text2 (postpatch_text). We recreate the patches one by one to determine -- context info. local prepatch_text, postpatch_text = text1, text1 for x, diff in ipairs(diffs) do local diff_type, diff_text = diff[1], diff[2] if (patchDiffLength == 0) and (diff_type ~= DIFF_EQUAL) then -- A new patch starts here. patch.start1 = char_count1 + 1 patch.start2 = char_count2 + 1 end if (diff_type == DIFF_INSERT) then patchDiffLength = patchDiffLength + 1 patch.diffs[patchDiffLength] = diff patch.length2 = patch.length2 + #diff_text postpatch_text = strsub(postpatch_text, 1, char_count2) .. diff_text .. strsub(postpatch_text, char_count2 + 1) elseif (diff_type == DIFF_DELETE) then patch.length1 = patch.length1 + #diff_text patchDiffLength = patchDiffLength + 1 patch.diffs[patchDiffLength] = diff postpatch_text = strsub(postpatch_text, 1, char_count2) .. strsub(postpatch_text, char_count2 + #diff_text + 1) elseif (diff_type == DIFF_EQUAL) then if (#diff_text <= Patch_Margin * 2) and (patchDiffLength ~= 0) and (#diffs ~= x) then -- Small equality inside a patch. patchDiffLength = patchDiffLength + 1 patch.diffs[patchDiffLength] = diff patch.length1 = patch.length1 + #diff_text patch.length2 = patch.length2 + #diff_text elseif (#diff_text >= Patch_Margin * 2) then -- Time for a new patch. if (patchDiffLength ~= 0) then _patch_addContext(patch, prepatch_text) patches[#patches + 1] = patch patch = _new_patch_obj() patchDiffLength = 0 -- Unlike Unidiff, our patch lists have a rolling context. -- http://code.google.com/p/google-diff-match-patch/wiki/Unidiff -- Update prepatch text & pos to reflect the application of the -- just completed patch. prepatch_text = postpatch_text char_count1 = char_count2 end end end -- Update the current character count. if (diff_type ~= DIFF_INSERT) then char_count1 = char_count1 + #diff_text end if (diff_type ~= DIFF_DELETE) then char_count2 = char_count2 + #diff_text end end -- Pick up the leftover patch if not empty. if (patchDiffLength > 0) then _patch_addContext(patch, prepatch_text) patches[#patches + 1] = patch end return patches end --[[ * Merge a set of patches onto the text. Return a patched text, as well * as a list of true/false values indicating which patches were applied. * @param {Array.<_new_patch_obj>} patches Array of patch objects. * @param {string} text Old text. * @return {Array.<string|Array.<boolean>>} Two return values, the * new text and an array of boolean values. --]] function patch_apply(patches, text) if patches[1] == nil then return text, {} end -- Deep copy the patches so that no changes are made to originals. patches = _patch_deepCopy(patches) local nullPadding = _patch_addPadding(patches) text = nullPadding .. text .. nullPadding _patch_splitMax(patches) -- delta keeps track of the offset between the expected and actual location -- of the previous patch. If there are patches expected at positions 10 and -- 20, but the first patch was found at 12, delta is 2 and the second patch -- has an effective expected position of 22. local delta = 0 local results = {} for x, patch in ipairs(patches) do local expected_loc = patch.start2 + delta local text1 = _diff_text1(patch.diffs) local start_loc local end_loc = -1 if #text1 > Match_MaxBits then -- _patch_splitMax will only provide an oversized pattern in -- the case of a monster delete. start_loc = match_main(text, strsub(text1, 1, Match_MaxBits), expected_loc) if start_loc ~= -1 then end_loc = match_main(text, strsub(text1, -Match_MaxBits), expected_loc + #text1 - Match_MaxBits) if end_loc == -1 or start_loc >= end_loc then -- Can't find valid trailing context. Drop this patch. start_loc = -1 end end else start_loc = match_main(text, text1, expected_loc) end if start_loc == -1 then -- No match found. :( results[x] = false -- Subtract the delta for this failed patch from subsequent patches. delta = delta - patch.length2 - patch.length1 else -- Found a match. :) results[x] = true delta = start_loc - expected_loc local text2 if end_loc == -1 then text2 = strsub(text, start_loc, start_loc + #text1 - 1) else text2 = strsub(text, start_loc, end_loc + Match_MaxBits - 1) end if text1 == text2 then -- Perfect match, just shove the replacement text in. text = strsub(text, 1, start_loc - 1) .. _diff_text2(patch.diffs) .. strsub(text, start_loc + #text1) else -- Imperfect match. Run a diff to get a framework of equivalent -- indices. local diffs = diff_main(text1, text2, false) if (#text1 > Match_MaxBits) and (diff_levenshtein(diffs) / #text1 > Patch_DeleteThreshold) then -- The end points match, but the content is unacceptably bad. results[x] = false else _diff_cleanupSemanticLossless(diffs) local index1 = 1 local index2 for y, mod in ipairs(patch.diffs) do if mod[1] ~= DIFF_EQUAL then index2 = _diff_xIndex(diffs, index1) end if mod[1] == DIFF_INSERT then text = strsub(text, 1, start_loc + index2 - 2) .. mod[2] .. strsub(text, start_loc + index2 - 1) elseif mod[1] == DIFF_DELETE then text = strsub(text, 1, start_loc + index2 - 2) .. strsub(text, start_loc + _diff_xIndex(diffs, index1 + #mod[2] - 1)) end if mod[1] ~= DIFF_DELETE then index1 = index1 + #mod[2] end end end end end end -- Strip the padding off. text = strsub(text, #nullPadding + 1, -#nullPadding - 1) return text, results end --[[ * Take a list of patches and return a textual representation. * @param {Array.<_new_patch_obj>} patches Array of patch objects. * @return {string} Text representation of patches. --]] function patch_toText(patches) local text = {} for x, patch in ipairs(patches) do _patch_appendText(patch, text) end return tconcat(text) end --[[ * Parse a textual representation of patches and return a list of patch objects. * @param {string} textline Text representation of patches. * @return {Array.<_new_patch_obj>} Array of patch objects. * @throws {Error} If invalid input. --]] function patch_fromText(textline) local patches = {} if (#textline == 0) then return patches end local text = {} for line in gmatch(textline, '([^\n]*)') do text[#text + 1] = line end local textPointer = 1 while (textPointer <= #text) do local start1, length1, start2, length2 = strmatch(text[textPointer], '^@@ %-(%d+),?(%d*) %+(%d+),?(%d*) @@$') if (start1 == nil) then error('Invalid patch string: "' .. text[textPointer] .. '"') end local patch = _new_patch_obj() patches[#patches + 1] = patch start1 = tonumber(start1) length1 = tonumber(length1) or 1 if (length1 == 0) then start1 = start1 + 1 end patch.start1 = start1 patch.length1 = length1 start2 = tonumber(start2) length2 = tonumber(length2) or 1 if (length2 == 0) then start2 = start2 + 1 end patch.start2 = start2 patch.length2 = length2 textPointer = textPointer + 1 while true do local line = text[textPointer] if (line == nil) then break end local sign; sign, line = strsub(line, 1, 1), strsub(line, 2) local invalidDecode = false local decoded = gsub(line, '%%(.?.?)', function(c) local n = tonumber(c, 16) if (#c ~= 2) or (n == nil) then invalidDecode = true return '' end return strchar(n) end) if invalidDecode then -- Malformed URI sequence. error('Illegal escape in patch_fromText: ' .. line) end line = decoded if (sign == '-') then -- Deletion. patch.diffs[#patch.diffs + 1] = {DIFF_DELETE, line} elseif (sign == '+') then -- Insertion. patch.diffs[#patch.diffs + 1] = {DIFF_INSERT, line} elseif (sign == ' ') then -- Minor equality. patch.diffs[#patch.diffs + 1] = {DIFF_EQUAL, line} elseif (sign == '@') then -- Start of next patch. break elseif (sign == '') then -- Blank line? Whatever. else -- WTF? error('Invalid patch mode "' .. sign .. '" in: ' .. line) end textPointer = textPointer + 1 end end return patches end -- --------------------------------------------------------------------------- -- UNOFFICIAL/PRIVATE PATCH FUNCTIONS -- --------------------------------------------------------------------------- local patch_meta = { __tostring = function(patch) local buf = {} _patch_appendText(patch, buf) return tconcat(buf) end } --[[ * Class representing one patch operation. * @constructor --]] function _new_patch_obj() return setmetatable({ --[[ @type {Array.<Array.<number|string>>} ]] diffs = {}; --[[ @type {?number} ]] start1 = 1; -- nil; --[[ @type {?number} ]] start2 = 1; -- nil; --[[ @type {number} ]] length1 = 0; --[[ @type {number} ]] length2 = 0; }, patch_meta) end --[[ * Increase the context until it is unique, * but don't let the pattern expand beyond Match_MaxBits. * @param {_new_patch_obj} patch The patch to grow. * @param {string} text Source text. * @private --]] function _patch_addContext(patch, text) if (#text == 0) then return end local pattern = strsub(text, patch.start2, patch.start2 + patch.length1 - 1) local padding = 0 -- LUANOTE: Lua's lack of a lastIndexOf function results in slightly -- different logic here than in other language ports. -- Look for the first two matches of pattern in text. If two are found, -- increase the pattern length. local firstMatch = indexOf(text, pattern) local secondMatch = nil if (firstMatch ~= nil) then secondMatch = indexOf(text, pattern, firstMatch + 1) end while (#pattern == 0 or secondMatch ~= nil) and (#pattern < Match_MaxBits - Patch_Margin - Patch_Margin) do padding = padding + Patch_Margin pattern = strsub(text, max(1, patch.start2 - padding), patch.start2 + patch.length1 - 1 + padding) firstMatch = indexOf(text, pattern) if (firstMatch ~= nil) then secondMatch = indexOf(text, pattern, firstMatch + 1) else secondMatch = nil end end -- Add one chunk for good luck. padding = padding + Patch_Margin -- Add the prefix. local prefix = strsub(text, max(1, patch.start2 - padding), patch.start2 - 1) if (#prefix > 0) then tinsert(patch.diffs, 1, {DIFF_EQUAL, prefix}) end -- Add the suffix. local suffix = strsub(text, patch.start2 + patch.length1, patch.start2 + patch.length1 - 1 + padding) if (#suffix > 0) then patch.diffs[#patch.diffs + 1] = {DIFF_EQUAL, suffix} end -- Roll back the start points. patch.start1 = patch.start1 - #prefix patch.start2 = patch.start2 - #prefix -- Extend the lengths. patch.length1 = patch.length1 + #prefix + #suffix patch.length2 = patch.length2 + #prefix + #suffix end --[[ * Given an array of patches, return another array that is identical. * @param {Array.<_new_patch_obj>} patches Array of patch objects. * @return {Array.<_new_patch_obj>} Array of patch objects. --]] function _patch_deepCopy(patches) local patchesCopy = {} for x, patch in ipairs(patches) do local patchCopy = _new_patch_obj() local diffsCopy = {} for i, diff in ipairs(patch.diffs) do diffsCopy[i] = {diff[1], diff[2]} end patchCopy.diffs = diffsCopy patchCopy.start1 = patch.start1 patchCopy.start2 = patch.start2 patchCopy.length1 = patch.length1 patchCopy.length2 = patch.length2 patchesCopy[x] = patchCopy end return patchesCopy end --[[ * Add some padding on text start and end so that edges can match something. * Intended to be called only from within patch_apply. * @param {Array.<_new_patch_obj>} patches Array of patch objects. * @return {string} The padding string added to each side. --]] function _patch_addPadding(patches) local paddingLength = Patch_Margin local nullPadding = '' for x = 1, paddingLength do nullPadding = nullPadding .. strchar(x) end -- Bump all the patches forward. for x, patch in ipairs(patches) do patch.start1 = patch.start1 + paddingLength patch.start2 = patch.start2 + paddingLength end -- Add some padding on start of first diff. local patch = patches[1] local diffs = patch.diffs local firstDiff = diffs[1] if (firstDiff == nil) or (firstDiff[1] ~= DIFF_EQUAL) then -- Add nullPadding equality. tinsert(diffs, 1, {DIFF_EQUAL, nullPadding}) patch.start1 = patch.start1 - paddingLength -- Should be 0. patch.start2 = patch.start2 - paddingLength -- Should be 0. patch.length1 = patch.length1 + paddingLength patch.length2 = patch.length2 + paddingLength elseif (paddingLength > #firstDiff[2]) then -- Grow first equality. local extraLength = paddingLength - #firstDiff[2] firstDiff[2] = strsub(nullPadding, #firstDiff[2] + 1) .. firstDiff[2] patch.start1 = patch.start1 - extraLength patch.start2 = patch.start2 - extraLength patch.length1 = patch.length1 + extraLength patch.length2 = patch.length2 + extraLength end -- Add some padding on end of last diff. patch = patches[#patches] diffs = patch.diffs local lastDiff = diffs[#diffs] if (lastDiff == nil) or (lastDiff[1] ~= DIFF_EQUAL) then -- Add nullPadding equality. diffs[#diffs + 1] = {DIFF_EQUAL, nullPadding} patch.length1 = patch.length1 + paddingLength patch.length2 = patch.length2 + paddingLength elseif (paddingLength > #lastDiff[2]) then -- Grow last equality. local extraLength = paddingLength - #lastDiff[2] lastDiff[2] = lastDiff[2] .. strsub(nullPadding, 1, extraLength) patch.length1 = patch.length1 + extraLength patch.length2 = patch.length2 + extraLength end return nullPadding end --[[ * Look through the patches and break up any which are longer than the maximum * limit of the match algorithm. * Intended to be called only from within patch_apply. * @param {Array.<_new_patch_obj>} patches Array of patch objects. --]] function _patch_splitMax(patches) local patch_size = Match_MaxBits local x = 1 while true do local patch = patches[x] if patch == nil then return end if patch.length1 > patch_size then local bigpatch = patch -- Remove the big old patch. tremove(patches, x) x = x - 1 local start1 = bigpatch.start1 local start2 = bigpatch.start2 local precontext = '' while bigpatch.diffs[1] do -- Create one of several smaller patches. local patch = _new_patch_obj() local empty = true patch.start1 = start1 - #precontext patch.start2 = start2 - #precontext if precontext ~= '' then patch.length1, patch.length2 = #precontext, #precontext patch.diffs[#patch.diffs + 1] = {DIFF_EQUAL, precontext} end while bigpatch.diffs[1] and (patch.length1 < patch_size-Patch_Margin) do local diff_type = bigpatch.diffs[1][1] local diff_text = bigpatch.diffs[1][2] if (diff_type == DIFF_INSERT) then -- Insertions are harmless. patch.length2 = patch.length2 + #diff_text start2 = start2 + #diff_text patch.diffs[#(patch.diffs) + 1] = bigpatch.diffs[1] tremove(bigpatch.diffs, 1) empty = false elseif (diff_type == DIFF_DELETE) and (#patch.diffs == 1) and (patch.diffs[1][1] == DIFF_EQUAL) and (#diff_text > 2 * patch_size) then -- This is a large deletion. Let it pass in one chunk. patch.length1 = patch.length1 + #diff_text start1 = start1 + #diff_text empty = false patch.diffs[#patch.diffs + 1] = {diff_type, diff_text} tremove(bigpatch.diffs, 1) else -- Deletion or equality. -- Only take as much as we can stomach. diff_text = strsub(diff_text, 1, patch_size - patch.length1 - Patch_Margin) patch.length1 = patch.length1 + #diff_text start1 = start1 + #diff_text if (diff_type == DIFF_EQUAL) then patch.length2 = patch.length2 + #diff_text start2 = start2 + #diff_text else empty = false end patch.diffs[#patch.diffs + 1] = {diff_type, diff_text} if (diff_text == bigpatch.diffs[1][2]) then tremove(bigpatch.diffs, 1) else bigpatch.diffs[1][2] = strsub(bigpatch.diffs[1][2], #diff_text + 1) end end end -- Compute the head context for the next patch. precontext = _diff_text2(patch.diffs) precontext = strsub(precontext, -Patch_Margin) -- Append the end context for this patch. local postcontext = strsub(_diff_text1(bigpatch.diffs), 1, Patch_Margin) if postcontext ~= '' then patch.length1 = patch.length1 + #postcontext patch.length2 = patch.length2 + #postcontext if patch.diffs[1] and (patch.diffs[#patch.diffs][1] == DIFF_EQUAL) then patch.diffs[#patch.diffs][2] = patch.diffs[#patch.diffs][2] .. postcontext else patch.diffs[#patch.diffs + 1] = {DIFF_EQUAL, postcontext} end end if not empty then x = x + 1 tinsert(patches, x, patch) end end end x = x + 1 end end --[[ * Emulate GNU diff's format. * Header: @@ -382,8 +481,9 @@ * @return {string} The GNU diff string. --]] function _patch_appendText(patch, text) local coords1, coords2 local length1, length2 = patch.length1, patch.length2 local start1, start2 = patch.start1, patch.start2 local diffs = patch.diffs if length1 == 1 then coords1 = start1 else coords1 = ((length1 == 0) and (start1 - 1) or start1) .. ',' .. length1 end if length2 == 1 then coords2 = start2 else coords2 = ((length2 == 0) and (start2 - 1) or start2) .. ',' .. length2 end text[#text + 1] = '@@ -' .. coords1 .. ' +' .. coords2 .. ' @@\n' local op -- Escape the body of the patch with %xx notation. for x, diff in ipairs(patch.diffs) do local diff_type = diff[1] if diff_type == DIFF_INSERT then op = '+' elseif diff_type == DIFF_DELETE then op = '-' elseif diff_type == DIFF_EQUAL then op = ' ' end text[#text + 1] = op .. gsub(diffs[x][2], percentEncode_pattern, percentEncode_replace) .. '\n' end return text end -- Expose the API local _M = {} _M.DIFF_DELETE = DIFF_DELETE _M.DIFF_INSERT = DIFF_INSERT _M.DIFF_EQUAL = DIFF_EQUAL _M.diff_main = diff_main _M.diff_cleanupSemantic = diff_cleanupSemantic _M.diff_cleanupEfficiency = diff_cleanupEfficiency _M.diff_levenshtein = diff_levenshtein _M.diff_prettyHtml = diff_prettyHtml _M.match_main = match_main _M.patch_make = patch_make _M.patch_toText = patch_toText _M.patch_fromText = patch_fromText _M.patch_apply = patch_apply -- Expose some non-API functions as well, for testing purposes etc. _M.diff_commonPrefix = _diff_commonPrefix _M.diff_commonSuffix = _diff_commonSuffix _M.diff_commonOverlap = _diff_commonOverlap _M.diff_halfMatch = _diff_halfMatch _M.diff_bisect = _diff_bisect _M.diff_cleanupMerge = _diff_cleanupMerge _M.diff_cleanupSemanticLossless = _diff_cleanupSemanticLossless _M.diff_text1 = _diff_text1 _M.diff_text2 = _diff_text2 _M.diff_toDelta = _diff_toDelta _M.diff_fromDelta = _diff_fromDelta _M.diff_xIndex = _diff_xIndex _M.match_alphabet = _match_alphabet _M.match_bitap = _match_bitap _M.new_patch_obj = _new_patch_obj _M.patch_addContext = _patch_addContext _M.patch_splitMax = _patch_splitMax _M.patch_addPadding = _patch_addPadding _M.settings = settings return _M
apache-2.0
will4wachter/Project1
scripts/globals/weaponskills/freezebite.lua
6
1231
----------------------------------- -- Freezebite -- Great Sword weapon skill -- Skill Level: 100 -- Delivers an ice elemental attack. Damage varies with TP. -- Aligned with the Snow Gorget & Breeze Gorget. -- Aligned with the Snow Belt & Breeze Belt. -- Element: Ice -- Modifiers: STR:30% ; INT:20% -- 100%TP 200%TP 300%TP -- 1.00 1.50 3.00 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function OnUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 1; params.ftp100 = 1; params.ftp200 = 1.5; params.ftp300 = 3; params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.2; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0; params.canCrit = false; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
waterlgndx/darkstar
scripts/globals/items/cup_of_date_tea.lua
2
1104
----------------------------------------- -- ID: 5926 -- Item: Cup of Date Tea -- Food Effect: 3 Hrs, All Races ----------------------------------------- -- HP 20 -- MP 30 -- Vitality -1 -- Charisma 5 -- Intelligence 3 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(dsp.effect.FOOD) == true or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,10800,5926); end; function onEffectGain(target, effect) target:addMod(dsp.mod.HP, 20); target:addMod(dsp.mod.MP, 30); target:addMod(dsp.mod.VIT, -1); target:addMod(dsp.mod.CHR, 5); target:addMod(dsp.mod.INT, 3); end; function onEffectLose(target, effect) target:delMod(dsp.mod.HP, 20); target:delMod(dsp.mod.MP, 30); target:delMod(dsp.mod.VIT, -1); target:delMod(dsp.mod.CHR, 5); target:delMod(dsp.mod.INT, 3); end;
gpl-3.0
MonokuroInzanaito/ygopro-777DIY
expansions/script/c21520006.lua
1
7607
--乱数原符-M function c21520006.initial_effect(c) --change attack & defence local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(21520006,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_ACTIVATE_COST) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(1,1) e1:SetOperation(c21520006.atkval) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetOperation(c21520006.defval) c:RegisterEffect(e2) --summons local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(21520006,0)) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_SUMMON_COST) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(0xff,0xff) e3:SetOperation(c21520006.atkval) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetOperation(c21520006.defval) c:RegisterEffect(e4) local e5=e3:Clone() e5:SetCode(EFFECT_FLIPSUMMON_COST) c:RegisterEffect(e5) local e6=e5:Clone() e6:SetOperation(c21520006.defval) c:RegisterEffect(e6) local e7=e3:Clone() e7:SetCode(EFFECT_SPSUMMON_COST) c:RegisterEffect(e7) local e8=e7:Clone() e8:SetOperation(c21520006.defval) c:RegisterEffect(e8) --to grave local e9=Effect.CreateEffect(c) e9:SetDescription(aux.Stringid(21520006,1)) e9:SetCategory(CATEGORY_TOGRAVE) e9:SetType(EFFECT_TYPE_IGNITION) e9:SetRange(LOCATION_MZONE) e9:SetCountLimit(1,21520006) e9:SetCondition(c21520006.condition) e9:SetTarget(c21520006.target) e9:SetOperation(c21520006.operation) c:RegisterEffect(e9) --game local e10=Effect.CreateEffect(c) e10:SetDescription(aux.Stringid(21520006,2)) e10:SetCategory(CATEGORY_DAMAGE+CATEGORY_RECOVER) e10:SetType(EFFECT_TYPE_QUICK_O) e10:SetCode(EVENT_FREE_CHAIN) e10:SetRange(LOCATION_HAND) e10:SetCountLimit(1,21520006) e10:SetCost(c21520006.cost2) e10:SetTarget(c21520006.target2) e10:SetOperation(c21520006.operation2) c:RegisterEffect(e10) end function c21520006.MinValue(...) local val=... return val or 0 end function c21520006.MaxValue(...) local val=... return val or 2688 end function c21520006.atkval(e,tp,eg,ep,ev,re,r,rp) local tempmin=c21520006.MinValue() local tempmax=c21520006.MaxValue() local c=e:GetHandler() math.randomseed(c:GetFieldID()+Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)+Duel.GetTurnCount()+2688) local val=math.random(tempmin,tempmax) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(val) e1:SetReset(RESET_EVENT+0xdfc0000) c:RegisterEffect(e1) end function c21520006.defval(e,tp,eg,ep,ev,re,r,rp) local tempmin=c21520006.MinValue() local tempmax=c21520006.MaxValue() local c=e:GetHandler() math.randomseed(c:GetFieldID()+Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)+Duel.GetTurnCount()+2688+1) local val=math.random(tempmin,tempmax) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCategory(CATEGORY_DEFCHANGE) e1:SetCode(EFFECT_SET_DEFENSE_FINAL) e1:SetValue(val) e1:SetReset(RESET_EVENT+0xdfc0000) c:RegisterEffect(e1) end function c21520006.condition(e,tp,eg,ep,ev,re,r,rp) local tempmin=c21520006.MinValue() local tempmax=c21520006.MaxValue() return e:GetHandler():GetAttack()>=tempmax/2 end function c21520006.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil) end end function c21520006.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rg1=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_REMOVED,0,nil) local rg2=Duel.GetMatchingGroup(Card.IsAbleToDeck,1-tp,LOCATION_REMOVED,0,nil) local count1=6 local count2=6 if count1>rg1:GetCount() then count1=rg1:GetCount() end if count2>rg2:GetCount() then count2=rg2:GetCount() end math.randomseed(c:GetFieldID()+Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)+Duel.GetTurnCount()+2688+5) local ct1,ct2=0,0 if count1~=0 then ct1=math.random(1,count1) end math.randomseed(c:GetFieldID()+Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)+Duel.GetTurnCount()+2688+6) if count2~=0 then ct2=math.random(1,count2) end local bg1=rg1:RandomSelect(tp,ct1) local bg2=rg2:RandomSelect(1-tp,ct2) Duel.ConfirmCards(tp,bg2) Duel.ConfirmCards(1-tp,bg1) Duel.SendtoDeck(bg1,nil,2,REASON_EFFECT) Duel.SendtoDeck(bg2,nil,2,REASON_EFFECT) Duel.BreakEffect() local sg1=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,0,nil) local sg2=Duel.GetMatchingGroup(Card.IsAbleToGrave,1-tp,LOCATION_ONFIELD,0,nil) if sg1:GetCount()==0 or sg2:GetCount()==0 then return end local ct=math.abs(ct1-ct2) if ct1>ct2 then if sg2:GetCount()<ct then ct=sg2:GetCount() end Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(21520006,8)) Duel.Hint(HINT_MESSAGE,1-tp,aux.Stringid(21520006,9)) Duel.Hint(HINT_NUMBER,1-tp,ct) local dg2=sg2:Select(1-tp,ct,ct,nil) Duel.SendtoGrave(dg2,REASON_RULE) elseif ct2>ct1 then if sg1:GetCount()<ct then ct=sg1:GetCount() end Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(21520006,9)) Duel.Hint(HINT_MESSAGE,1-tp,aux.Stringid(21520006,8)) Duel.Hint(HINT_NUMBER,tp,ct) local dg1=sg1:Select(tp,ct,ct,nil) Duel.SendtoGrave(dg1,REASON_RULE) else Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(21520006,10)) Duel.Hint(HINT_MESSAGE,1-tp,aux.Stringid(21520006,10)) local g=Duel.GetFieldGroup(tp,LOCATION_REMOVED,LOCATION_REMOVED) Duel.SendtoDeck(g,nil,2,REASON_EFFECT) end end function c21520006.dfilter(c,tp) return c:GetOwner()==tp end function c21520006.cost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable() end Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD) end function c21520006.target2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,LOCATION_DECK,nil)>0 end --[[ local yn=0 if Duel.GetFieldGroupCount(tp,LOCATION_DECK,LOCATION_DECK,nil)>=12 then if Duel.SelectYesNo(1-tp,aux.Stringid(21520006,3)) then yn=1 Duel.Hint(HINT_MESSAGE,tp,aux.Stringid(21520006,4)) end end e:SetLabel(yn) --]] end function c21520006.operation2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() -- local yn=e:GetLabel() local g=Duel.GetFieldGroup(tp,LOCATION_DECK,LOCATION_DECK,nil) --[[ local ct=0 if yn==1 then ct=12 if g:GetCount()<12 then ct=g:GetCount() end else ct=6 if g:GetCount()<6 then ct=g:GetCount() end end -]] local ct=6 if g:GetCount()<6 then ct=g:GetCount() end local rg=g:RandomSelect(tp,ct) Duel.BreakEffect() local tc=rg:GetFirst() local player=e:GetHandlerPlayer() local tct=0 while tc do Duel.Hint(HINT_SELECTMSG,player,HINTMSG_CARDTYPE) local op=Duel.SelectOption(player,aux.Stringid(21520006,5),aux.Stringid(21520006,6),aux.Stringid(21520006,7)) --[[ if op==0 then Duel.Hint(HINT_OPSELECTED,1-player,aux.Stringid(21520006,5)) elseif op==1 then Duel.Hint(HINT_OPSELECTED,1-player,aux.Stringid(21520006,6)) elseif op==2 then Duel.Hint(HINT_OPSELECTED,1-player,aux.Stringid(21520006,7)) end--]] Duel.ConfirmCards(player,tc) Duel.ConfirmCards(1-player,tc) if (op==0 and tc:IsType(TYPE_MONSTER)) or (op==1 and tc:IsType(TYPE_SPELL)) or (op==2 and tc:IsType(TYPE_TRAP)) then math.randomseed(c:GetFieldID()+Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)+Duel.GetTurnCount()+2688+3+tct) local val=math.random(1,1024) Duel.Recover(player,val,REASON_EFFECT) else math.randomseed(c:GetFieldID()+Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)+Duel.GetTurnCount()+2688+4+tct+10) local val=math.random(1,1024) Duel.Damage(player,val,REASON_EFFECT) end player=1-player tct=tct+1 Duel.BreakEffect() tc=rg:GetNext() end Duel.ShuffleDeck(tp) Duel.ShuffleDeck(1-tp) end
gpl-3.0
kidaa/darkstar
scripts/zones/RuLude_Gardens/npcs/Dugga.lua
34
1074
---------------------------------- -- Area: Ru'Lude Gardens -- NPC: Dugga -- Type: Item Deliverer -- @zone: 243 -- @pos -55.429 5.999 1.27 -- ----------------------------------- package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil; require("scripts/zones/RuLude_Gardens/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, ITEM_DELIVERY_DIALOG); player:openSendBox(); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
davidedmonds/darkstar
scripts/zones/North_Gustaberg/npcs/Ennigreaud_RK.lua
30
3061
----------------------------------- -- Area: North Gustaberg -- NPC: Ennigreaud, R.K. -- Type: Outpost Conquest Guards -- @pos -584.687 39.107 54.281 106 ----------------------------------- package.loaded["scripts/zones/North_Gustaberg/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/North_Gustaberg/TextIDs"); local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border local region = GUSTABERG; local csid = 0x7ffb; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then if (supplyRunFresh(player) == 1) then player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies ! else player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use." player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region)); player:setVar("supplyQuest_region",0); end else local arg1 = getArg1(guardnation, player) - 1; if (arg1 >= 1792) then -- foreign, non-allied player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0); else -- citizen or allied player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option == 2) then player:delKeyItem(getSupplyKey(region)); player:addCP(supplyReward[region + 1]) player:messageSpecial(CONQUEST); -- "You've earned conquest points!" if (hasOutpost(player, region+5) == 0) then local supply_quests = 2^(region+5); player:addNationTeleport(guardnation,supply_quests); player:setVar("supplyQuest_region",0); end elseif (option == 4) then if (player:delGil(giltosetHP(guardnation,player))) then player:setHomePoint(); player:messageSpecial(CONQUEST + 94); -- "Your home point has been set." else player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here." end end end;
gpl-3.0
davidedmonds/darkstar
scripts/zones/The_Garden_of_RuHmet/mobs/Ix_aern_drg.lua
13
2474
----------------------------------- -- Area: The Garden of Ru'Hmet -- NPC: Ix'aern (drg) ----------------------------------- require("scripts/globals/status"); require("scripts/zones/The_Garden_of_RuHmet/MobIDs"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) if (math.random(0,1) > 0) then SetDropRate(4396,1870,1000); -- Deed Of Sensib. SetDropRate(4396,1903,0); else SetDropRate(4396,1870,0); SetDropRate(4396,1903,1000); -- Vice Of Aspersion end end; ----------------------------------- -- onMobFight Action ----------------------------------- function onMobFight(mob,target) -- Spawn the pets if they are despawned -- TODO: summon animations? if (GetMobAction(wynavA) == 0) then GetMobByID(wynavA):setSpawn(mob:getXPos()+math.random(1,5), mob:getYPos(), mob:getZPos()+math.random(1,5)); SpawnMob(wynavA, 300):updateEnmity(target); elseif (GetMobAction(wynavB) == 0) then GetMobByID(wynavB):setSpawn(mob:getXPos()+math.random(1,5), mob:getYPos(), mob:getZPos()+math.random(1,5)); SpawnMob(wynavB, 300):updateEnmity(target); elseif (GetMobAction(wynavC) == 0) then GetMobByID(wynavC):setSpawn(mob:getXPos()+math.random(1,5), mob:getYPos(), mob:getZPos()+math.random(1,5)); SpawnMob(wynavC, 300):updateEnmity(target); end -- Ensure all spawned pets are doing stuff.. for pets = wynavA, wynavC do if (GetMobAction(pets) == 16) then -- Send pet after current target.. GetMobByID(pets):updateEnmity(target); end end end ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, killer) -- Despawn pets.. DespawnMob(wynavA); DespawnMob(wynavB); DespawnMob(wynavC); -- Pick a new for PH Ix'Aern (DRG) SetServerVariable("[SEA]IxAernDRG_PH", AwAernDRGGroups[math.random(1, #AwAernDRGGroups)] + math.random(0, 2)); end; ----------------------------------- -- OnMobDespawn ----------------------------------- function onMobDespawn( mob ) -- Despawn pets. DespawnMob(wynavA); DespawnMob(wynavB); DespawnMob(wynavC); -- Pick a new PH for Ix'Aern (DRG) SetServerVariable("[SEA]IxAernDRG_PH", AwAernDRGGroups[math.random(1, #AwAernDRGGroups)] + math.random(0, 2)); end
gpl-3.0
kidaa/darkstar
scripts/globals/spells/cure_ii.lua
13
3908
----------------------------------------- -- Spell: Cure II -- Restores target's HP. -- Shamelessly stolen from http://members.shaw.ca/pizza_steve/cure/Cure_Calculator.html ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local divisor = 0; local constant = 0; local basepower = 0; local power = 0; local basecure = 0; local final = 0; local minCure = 60; if(USE_OLD_CURE_FORMULA == true) then power = getCurePowerOld(caster); divisor = 1; constant = 20; if(power > 170) then divisor = 35.6666; constant = 87.62; elseif(power > 110) then divisor = 2; constant = 47.5; end else power = getCurePower(caster); if(power < 70) then divisor = 1; constant = 60; basepower = 40; elseif(power < 125) then divisor = 5.5; constant = 90; basepower = 70; elseif(power < 200) then divisor = 7.5; constant = 100; basepower = 125; elseif(power < 400) then divisor = 10; constant = 110; basepower = 200; elseif(power < 700) then divisor = 20; constant = 130; basepower = 400; else divisor = 999999; constant = 145; basepower = 0; end end if(target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == TYPE_PC or target:getObjType() == TYPE_MOB)) then if(USE_OLD_CURE_FORMULA == true) then basecure = getBaseCure(power,divisor,constant); else basecure = getBaseCure(power,divisor,constant,basepower); end final = getCureFinal(caster,spell,basecure,minCure,false); if(caster:hasStatusEffect(EFFECT_AFFLATUS_SOLACE) and target:hasStatusEffect(EFFECT_STONESKIN) == false) then local solaceStoneskin = 0; local equippedBody = caster:getEquipID(SLOT_BODY); if(equippedBody == 11186) then solaceStoneskin = math.floor(final * 0.30); elseif(equippedBody == 11086) then solaceStoneskin = math.floor(final * 0.35); else solaceStoneskin = math.floor(final * 0.25); end target:addStatusEffect(EFFECT_STONESKIN,solaceStoneskin,0,25); end; final = final + (final * (target:getMod(MOD_CURE_POTENCY_RCVD)/100)); --Applying server mods.... final = final * CURE_POWER; local diff = (target:getMaxHP() - target:getHP()); if(final > diff) then final = diff; end target:addHP(final); target:wakeUp(); caster:updateEnmityFromCure(target,final); else if(target:isUndead()) then spell:setMsg(2); local dmg = calculateMagicDamage(minCure,1,caster,spell,target,HEALING_MAGIC_SKILL,MOD_MND,false)*0.5; local resist = applyResistance(caster,spell,target,caster:getStat(MOD_MND)-target:getStat(MOD_MND),HEALING_MAGIC_SKILL,1.0); dmg = dmg*resist; dmg = addBonuses(caster,spell,target,dmg); dmg = adjustForTarget(target,dmg,spell:getElement()); dmg = finalMagicAdjustments(caster,target,spell,dmg); final = dmg; target:delHP(final); target:updateEnmityFromDamage(caster,final); elseif(caster:getObjType() == TYPE_PC) then spell:setMsg(75); else -- e.g. monsters healing themselves. if(USE_OLD_CURE_FORMULA == true) then basecure = getBaseCureOld(power,divisor,constant); else basecure = getBaseCure(power,divisor,constant,basepower); end final = getCureFinal(caster,spell,basecure,minCure,false); local diff = (target:getMaxHP() - target:getHP()); if(final > diff) then final = diff; end target:addHP(final); end end return final; end;
gpl-3.0
will4wachter/Project1
scripts/globals/weaponskills/rock_crusher.lua
6
1206
----------------------------------- -- Rock Crusher -- Staff weapon skill -- Skill Level: 40 -- Delivers an earth elemental attack. Damage varies with TP. -- Aligned with the Thunder Gorget. -- Aligned with the Thunder Belt. -- Element: Earth -- Modifiers: STR:20% ; INT:20% -- 100%TP 200%TP 300%TP -- 1.00 2.00 2.50 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function OnUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 1; params.ftp100 = 1; params.ftp200 = 2; params.ftp300 = 2.5; params.str_wsc = 0.2; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.2; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0; params.canCrit = false; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
will4wachter/Project1
scripts/zones/Dynamis-Bastok/npcs/qm1.lua
19
1256
----------------------------------- -- Area: Dynamis Bastok -- NPC: qm1 (???) -- Notes: Spawns when Megaboss is defeated ----------------------------------- package.loaded["scripts/zones/Dynamis-Bastok/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/Dynamis-Bastok/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) if(player:hasKeyItem(HYDRA_CORPS_EYEGLASS) == false) then player:setVar("DynaBastok_Win",1); player:addKeyItem(HYDRA_CORPS_EYEGLASS); player:messageSpecial(KEYITEM_OBTAINED,HYDRA_CORPS_EYEGLASS); else player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
moquist/mal
lua/stepA_mal.lua
40
6064
#!/usr/bin/env lua local table = require('table') local readline = require('readline') local utils = require('utils') local types = require('types') local reader = require('reader') local printer = require('printer') local Env = require('env') local core = require('core') local List, Vector, HashMap = types.List, types.Vector, types.HashMap -- read function READ(str) return reader.read_str(str) end -- eval function is_pair(x) return types._sequential_Q(x) and #x > 0 end function quasiquote(ast) if not is_pair(ast) then return types.List:new({types.Symbol:new("quote"), ast}) elseif types._symbol_Q(ast[1]) and ast[1].val == 'unquote' then return ast[2] elseif is_pair(ast[1]) and types._symbol_Q(ast[1][1]) and ast[1][1].val == 'splice-unquote' then return types.List:new({types.Symbol:new("concat"), ast[1][2], quasiquote(ast:slice(2))}) else return types.List:new({types.Symbol:new("cons"), quasiquote(ast[1]), quasiquote(ast:slice(2))}) end end function is_macro_call(ast, env) if types._list_Q(ast) and types._symbol_Q(ast[1]) and env:find(ast[1]) then local f = env:get(ast[1]) return types._malfunc_Q(f) and f.ismacro end end function macroexpand(ast, env) while is_macro_call(ast, env) do local mac = env:get(ast[1]) ast = mac.fn(unpack(ast:slice(2))) end return ast end function eval_ast(ast, env) if types._symbol_Q(ast) then return env:get(ast) elseif types._list_Q(ast) then return List:new(utils.map(function(x) return EVAL(x,env) end,ast)) elseif types._vector_Q(ast) then return Vector:new(utils.map(function(x) return EVAL(x,env) end,ast)) elseif types._hash_map_Q(ast) then local new_hm = {} for k,v in pairs(ast) do new_hm[EVAL(k, env)] = EVAL(v, env) end return HashMap:new(new_hm) else return ast end end function EVAL(ast, env) while true do --print("EVAL: "..printer._pr_str(ast,true)) if not types._list_Q(ast) then return eval_ast(ast, env) end -- apply list ast = macroexpand(ast, env) if not types._list_Q(ast) then return ast end local a0,a1,a2,a3 = ast[1], ast[2],ast[3],ast[4] local a0sym = types._symbol_Q(a0) and a0.val or "" if 'def!' == a0sym then return env:set(a1, EVAL(a2, env)) elseif 'let*' == a0sym then local let_env = Env:new(env) for i = 1,#a1,2 do let_env:set(a1[i], EVAL(a1[i+1], let_env)) end env = let_env ast = a2 -- TCO elseif 'quote' == a0sym then return a1 elseif 'quasiquote' == a0sym then ast = quasiquote(a1) -- TCO elseif 'defmacro!' == a0sym then local mac = EVAL(a2, env) mac.ismacro = true return env:set(a1, mac) elseif 'macroexpand' == a0sym then return macroexpand(a1, env) elseif 'try*' == a0sym then local exc, result = nil, nil xpcall(function() result = EVAL(a1, env) end, function(err) exc = err end) if exc ~= nil then if types._malexception_Q(exc) then exc = exc.val end if a2 and a2[1].val == 'catch*' then result = EVAL(a2[3], Env:new(env, {a2[2]}, {exc})) else types.throw(exc) end end return result elseif 'do' == a0sym then local el = eval_ast(ast:slice(2,#ast-1), env) ast = ast[#ast] -- TCO elseif 'if' == a0sym then local cond = EVAL(a1, env) if cond == types.Nil or cond == false then if a3 then ast = a3 else return types.Nil end -- TCO else ast = a2 -- TCO end elseif 'fn*' == a0sym then return types.MalFunc:new(function(...) return EVAL(a2, Env:new(env, a1, arg)) end, a2, env, a1) else local args = eval_ast(ast, env) local f = table.remove(args, 1) if types._malfunc_Q(f) then ast = f.ast env = Env:new(f.env, f.params, args) -- TCO else return f(unpack(args)) end end end end -- print function PRINT(exp) return printer._pr_str(exp, true) end -- repl local repl_env = Env:new() function rep(str) return PRINT(EVAL(READ(str),repl_env)) end -- core.lua: defined using Lua for k,v in pairs(core.ns) do repl_env:set(types.Symbol:new(k), v) end repl_env:set(types.Symbol:new('eval'), function(ast) return EVAL(ast, repl_env) end) repl_env:set(types.Symbol:new('*ARGV*'), types.List:new(types.slice(arg,2))) -- core.mal: defined using mal rep("(def! *host-language* \"lua\")") rep("(def! not (fn* (a) (if a false true)))") rep("(def! load-file (fn* (f) (eval (read-string (str \"(do \" (slurp f) \")\")))))") rep("(defmacro! cond (fn* (& xs) (if (> (count xs) 0) (list 'if (first xs) (if (> (count xs) 1) (nth xs 1) (throw \"odd number of forms to cond\")) (cons 'cond (rest (rest xs)))))))") rep("(defmacro! or (fn* (& xs) (if (empty? xs) nil (if (= 1 (count xs)) (first xs) `(let* (or_FIXME ~(first xs)) (if or_FIXME or_FIXME (or ~@(rest xs))))))))") function print_exception(exc) if exc then if types._malexception_Q(exc) then exc = printer._pr_str(exc.val, true) end print("Error: " .. exc) print(debug.traceback()) end end if #arg > 0 and arg[1] == "--raw" then readline.raw = true table.remove(arg,1) end if #arg > 0 then xpcall(function() rep("(load-file \""..arg[1].."\")") end, print_exception) os.exit(0) end rep("(println (str \"Mal [\" *host-language* \"]\"))") while true do line = readline.readline("user> ") if not line then break end xpcall(function() print(rep(line)) end, print_exception) end
mpl-2.0
kidaa/darkstar
scripts/zones/Northern_San_dOria/npcs/Jeanvirgaud.lua
18
1838
----------------------------------- -- Area: Northern San d'Oria -- NPC: Jeanvirgaud -- Outpost Teleporter NPC -- @pos 45.559 -0.199 26.300 231 ----------------------------------- package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Northern_San_dOria/TextIDs"); guardnation = SANDORIA; csid = 0x02cc; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(guardnation == player:getNation()) then player:startEvent(csid,0,0,0,0,0,0,player:getMainLvl(),1073741823 - player:getNationTeleport(guardnation)); else player:startEvent(csid,0,0,0,0,0,1,0,0); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); loca = option - 1073741829; player:updateEvent(player:getGil(),OP_TeleFee(player,loca),player:getCP(),OP_TeleFee(player,loca),player:getCP()); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(option >= 5 and option <= 23) then if (player:delGil(OP_TeleFee(player,option-5))) then toOutpost(player,option); end elseif(option >= 1029 and option <= 1047) then local cpCost = OP_TeleFee(player,option-1029); --printf("CP Cost: %u",cpCost); if (player:getCP()>=cpCost) then player:delCP(cpCost); toOutpost(player,option-1024); end end end;
gpl-3.0
MonokuroInzanaito/ygopro-777DIY
expansions/script/c10981245.lua
1
2401
--混沌之灵的抹灭者 function c10981245.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,c10981245.tfilter,aux.NonTuner(nil),1) c:EnableReviveLimit() --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(10981245,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCondition(c10981245.drcon) e1:SetOperation(c10981245.operation) c:RegisterEffect(e1) end function c10981245.tfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) or c:IsHasEffect(10981145) end function c10981245.drcon(e,tp,eg,ep,ev,re,r,rp) return bit.band(e:GetHandler():GetSummonType(),SUMMON_TYPE_SYNCHRO)==SUMMON_TYPE_SYNCHRO end function c10981245.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,564) local ac=Duel.AnnounceCard(tp,TYPE_MONSTER) c:SetHint(CHINT_CARD,ac) --remove local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(10981245,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCondition(c10981245.rmcon) e1:SetTarget(c10981245.rmtg) e1:SetOperation(c10981245.rmop) e1:SetLabel(ac) e1:SetReset(RESET_EVENT+0x1fe0000) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) end function c10981245.filter(c,code) return c:IsFaceup() and c:IsCode(code) end function c10981245.filter2(c) return c:IsFaceup() and c:IsHasEffect(10981145) end function c10981245.rmcon(e,tp,eg,ep,ev,re,r,rp) return (eg:IsExists(c10981245.filter,1,nil,e:GetLabel()) or eg:IsExists(c10981245.filter2,1,nil)) and Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>2 end function c10981245.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.HintSelection(g) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c10981245.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
gpl-3.0
MonokuroInzanaito/ygopro-777DIY
expansions/script/c1000206.lua
1
1754
--虹纹的交换 function c1000206.initial_effect(c) --① local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,1000206) e1:SetCost(c1000206.cost) e1:SetTarget(c1000206.target) e1:SetOperation(c1000206.activate) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(1000206,ACTIVITY_SPSUMMON,c1000206.counterfilter) end function c1000206.counterfilter(c) return c:IsSetCard(0x200) end function c1000206.filter(c) return c:IsSetCard(0x3200) and c:IsAbleToRemoveAsCost() end function c1000206.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c1000206.filter,tp,LOCATION_HAND,0,1,nil) and Duel.GetCustomActivityCount(1000206,tp,ACTIVITY_SPSUMMON)==0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,c1000206.filter,tp,LOCATION_HAND,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(c1000206.splimit) Duel.RegisterEffect(e1,tp) end function c1000206.splimit(e,c,tp,sumtp,sumpos) return not c:IsSetCard(0x200) end function c1000206.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function c1000206.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
gpl-3.0
waterlgndx/darkstar
scripts/globals/mobskills/erratic_flutter.lua
2
1454
--------------------------------------------- -- Erratic Flutter -- -- Description: Deals Fire damage around the caster. Grants the effect of Haste. -- Family: Wamoura -- Monipulators: Wamoura (MON), Coral Wamoura (MON) -- Level (Monstrosity): 60 -- TP Cost (Monstrosity): 1500 TP -- Type: Enhancing -- Element: Fire -- Can be dispelled: Yes -- Notes: -- Blue magic version is 307/1024 haste for 5 minutes. Wamaora haste is presumed identical. -- Wamoura version also deals Fire damage to targets around the wamoura. -- While it does not overwrite most forms of Slowga, Slow II, Slow II TP moves, -- Erratic Flutter does overwrite Hojo: Ni, Hojo: Ichi, and Slow. -- Player Blue magic version is wind element instead of fire. --------------------------------------------- require("scripts/globals/monstertpmoves"); require("scripts/globals/settings"); require("scripts/globals/status"); --------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0; end; function onMobWeaponSkill(target, mob, skill) local dmgmod = 1; local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*1.5,dsp.magic.ele.FIRE,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_FIRE,MOBPARAM_IGNORE_SHADOWS); MobBuffMove(mob, dsp.effect.HASTE, 307, 0, 300); -- There is no message for the self buff aspect, only dmg. target:delHP(dmg); return dmg; end;
gpl-3.0
will4wachter/Project1
scripts/zones/Windurst_Waters_[S]/npcs/Ezura-Romazura.lua
34
1541
----------------------------------- -- Area: Windurst Waters [S] -- NPC: Ezura-Romazura -- Standard Merchant NPC ----------------------------------- package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/zones/Windurst_Waters_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,EZURAROMAZURA_SHOP_DIALOG); stock = {0x12a3,123750, -- Scroll of Stone V 0x12ad,133110, -- Scroll of Water V 0x129e,144875, -- Scroll of Aero V 0x1294,162500, -- Scroll of Fire V 0x1299,186375, -- Scroll of Blizzard V 0x131d,168150, -- Scroll of Stoneja 0x131f,176700, -- Scroll of Waterja 0x131a,193800, -- Scroll of Firaja 0x131c,185240, -- Scroll of Aeroja 0x12ff,126000} -- Scroll of Break showShop(player, STATIC, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
will4wachter/Project1
scripts/globals/items/homemade_steak.lua
35
1124
----------------------------------------- -- ID: 5226 -- Item: homemade_steak -- Food Effect: 30Min, All Races ----------------------------------------- -- Strength 1 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,1800,5226); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 1); end;
gpl-3.0
kidaa/darkstar
scripts/globals/items/cup_of_healing_tea.lua
35
1373
----------------------------------------- -- ID: 4286 -- Item: cup_of_healing_tea -- Food Effect: 240Min, All Races ----------------------------------------- -- Magic 10 -- Vitality -1 -- Charisma 3 -- Magic Regen While Healing 2 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,14400,4286); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MP, 10); target:addMod(MOD_VIT, -1); target:addMod(MOD_CHR, 3); target:addMod(MOD_MPHEAL, 2); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MP, 10); target:delMod(MOD_VIT, -1); target:delMod(MOD_CHR, 3); target:delMod(MOD_MPHEAL, 2); end;
gpl-3.0
kidaa/darkstar
scripts/globals/items/bowl_of_goblin_stew.lua
22
1504
----------------------------------------- -- ID: 4465 -- Item: bowl_of_goblin_stew -- Food Effect: 3Hrs, All Races ----------------------------------------- -- Dexterity -4 -- Attack % 15.5 -- Ranged Attack % 15.5 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,4465); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, -4); target:addMod(MOD_FOOD_ATTP, 15.5); target:addMod(MOD_FOOD_ATT_CAP, 999); target:addMod(MOD_FOOD_RATTP, 15.5); target:addMod(MOD_FOOD_RATT_CAP, 999); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, -4); target:delMod(MOD_FOOD_ATTP, 15.5); target:delMod(MOD_FOOD_ATT_CAP, 999); target:delMod(MOD_FOOD_RATTP, 15.5); target:delMod(MOD_FOOD_RATT_CAP, 999); end;
gpl-3.0
davidedmonds/darkstar
scripts/zones/Valkurm_Dunes/npcs/Hieroglyphics.lua
17
2399
----------------------------------- -- Area: Valkurm_Dunes -- NPC: Hieroglyphics -- Dynamis Valkurm_Dunes Enter -- @pos 117 -10 133 172 103 ----------------------------------- package.loaded["scripts/zones/Valkurm_Dunes/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/dynamis"); require("scripts/globals/missions"); require("scripts/zones/Valkurm_Dunes/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasCompletedMission(COP,DARKNESS_NAMED) or FREE_COP_DYNAMIS == 1) then local firstDyna = 0; local realDay = os.time(); local dynaWaitxDay = player:getVar("dynaWaitxDay"); if (checkFirstDyna(player,7)) then player:startEvent(0x0021); elseif (player:getMainLvl() < DYNA_LEVEL_MIN) then player:messageSpecial(PLAYERS_HAVE_NOT_REACHED_LEVEL,DYNA_LEVEL_MIN); elseif ((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) < realDay or player:getVar("DynamisID") == GetServerVariable("[DynaValkurm]UniqueID")) then player:startEvent(0x0010,7,0,0,BETWEEN_2DYNA_WAIT_TIME,32,VIAL_OF_SHROUDED_SAND,4236,4237); else dayRemaining = math.floor(((dynaWaitxDay + (BETWEEN_2DYNA_WAIT_TIME * 24 * 60 * 60)) - realDay)/3456); printf("dayRemaining : %u",dayRemaining ); player:messageSpecial(YOU_CANNOT_ENTER_DYNAMIS,dayRemaining,7); end else player:messageSpecial(MYSTERIOUS_VOICE); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("updateRESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("finishRESULT: %u",option); if (csid == 0x0021) then if (checkFirstDyna(player,7)) then player:setVar("Dynamis_Status",player:getVar("Dynamis_Status") + 128); end elseif (csid == 0x0010 and option == 0) then player:setPos(100,-8,131,47,0x27); end end;
gpl-3.0
davidedmonds/darkstar
scripts/zones/Port_San_dOria/npcs/Milva.lua
36
1839
----------------------------------- -- Area: Port San d'Oria -- NPC: Milva -- Only sells when San d'Oria has control of Sarutabaruta ----------------------------------- package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); require("scripts/globals/quests"); require("scripts/zones/Port_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) RegionOwner = GetRegionOwner(SARUTABARUTA); if (RegionOwner ~= SANDORIA) then player:showText(npc,MILVA_CLOSED_DIALOG); else player:showText(npc,MILVA_OPEN_DIALOG); stock = {0x115c,22, --Rarab Tail 0x02b1,33, --Lauan Log 0x026b,43, --Popoto 0x1128,29, --Saruta Orange 0x027b,18} --Windurstian Tea Leaves showShop(player,SANDORIA,stock); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
lhog/Zero-K
LuaRules/Gadgets/weapon_torpedo_stay_underwater.lua
2
3684
if (not gadgetHandler:IsSyncedCode()) then return false end function gadget:GetInfo() return { name = "Torpedo Stay Underwater", desc = "Makes relevant torpedoes stay underwater.", author = "GoogleFrog", date = "27 Feb 2019", license = "GNU GPL, v2 or later", layer = 0, enabled = true, } end local projectileDefs = { [WeaponDefNames["subraider_torpedo"].id] = true, [WeaponDefNames["amphriot_torpedo"].id] = true, [WeaponDefNames["amphraid_torpedo"].id] = true, [WeaponDefNames["shiptorpraider_torpedo"].id] = true, [WeaponDefNames["turrettorp_torpedo"].id] = true, } ------------------------------------------------------------- ------------------------------------------------------------- local projectiles = {} local projectileIndex = {} local killProjs = {} local killProjIndex = {} local killProjIter = 1 local projectileKillHeight = -500 local function RemoveProjectile(proID) local index = projectileIndex[proID] if not index then return end local lastIndex = #projectiles local lastID = projectiles[lastIndex] projectiles[index] = lastID projectileIndex[lastID] = index projectiles[lastIndex] = nil projectileIndex[proID] = nil end local function RemoveKillProjectile(proID) local index = killProjIndex[proID] if not index then return end local lastIndex = #killProjs local lastID = killProjs[lastIndex] killProjs[index] = lastID killProjIndex[lastID] = index killProjs[lastIndex] = nil killProjIndex[proID] = nil end local function AddKillProjectile(proID) local index = #killProjs + 1 killProjs[index] = proID killProjIndex[proID] = index end ------------------------------------------------------------- ------------------------------------------------------------- local spSetProjectileGravity = Spring.SetProjectileGravity function gadget:ProjectileCreated(proID, proOwnerID, weaponDefID) if not projectileDefs[weaponDefID] then return end local _, py = Spring.GetProjectilePosition(proID) if not py then return end if py > 0 then local index = #projectiles + 1 projectiles[index] = proID projectileIndex[proID] = index return end spSetProjectileGravity(proID, -1) AddKillProjectile(proID) end local function KeepProjectilesBelowWaterSurface(n) if n%3 ~= 0 then return end local cnt = #projectiles local i = 1 while i <= cnt do local proID = projectiles[i] if proID then local _, py = Spring.GetProjectilePosition(proID) if (not py) or py < 0 then if py then spSetProjectileGravity(proID, -1) AddKillProjectile(proID) end RemoveProjectile(proID) i = i - 1 cnt = cnt - 1 end end i = i + 1 end end local function KeepProjectilesAboveSeaFloor(n) if n%6 ~= 5 then return end local count = #killProjs killProjIter = killProjIter + 1 if killProjIter > count then killProjIter = 1 end local proID = killProjs[killProjIter] if proID then local _, py = Spring.GetProjectilePosition(proID) if (not py) or py < projectileKillHeight then --local px, py, pz = Spring.GetProjectilePosition(proID) --Spring.MarkerAddPoint(px, py, pz, "") if py then Spring.DeleteProjectile(proID) end RemoveKillProjectile(proID) end end end function gadget:GameFrame(n) KeepProjectilesBelowWaterSurface(n) KeepProjectilesAboveSeaFloor(n) end function gadget:ProjectileDestroyed(proID) RemoveProjectile(proID) RemoveKillProjectile(proID) end function gadget:Initialize() for id,_ in pairs(projectileDefs) do Script.SetWatchProjectile(id, true) end local minHeight = Spring.GetGroundExtremes() projectileKillHeight = math.min(projectileKillHeight, minHeight - 200) end
gpl-2.0
will4wachter/Project1
scripts/zones/Port_Windurst/npcs/Pichichi.lua
36
2675
----------------------------------- -- Area: Port Windurst -- NPC: Pichichi ----------------------------------- package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/zones/Port_Windurst/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) TruthJusticeOnionWay = player:getQuestStatus(WINDURST,TRUTH_JUSTICE_AND_THE_ONION_WAY); KnowOnesOnions = player:getQuestStatus(WINDURST,KNOW_ONE_S_ONIONS); InspectorsGadget = player:getQuestStatus(WINDURST,INSPECTOR_S_GADGET); OnionRings = player:getQuestStatus(WINDURST,ONION_RINGS); CryingOverOnions = player:getQuestStatus(WINDURST,CRYING_OVER_ONIONS); ThePromise = player:getQuestStatus(WINDURST,THE_PROMISE); if (ThePromise == QUEST_COMPLETED) then Message = math.random(0,1) if (Message == 1) then player:startEvent(0x0212); else player:startEvent(0x0218); end elseif (CryingOverOnions == QUEST_COMPLETED) then player:startEvent(0x01ff); elseif (CryingOverOnions == QUEST_ACCEPTED) then player:startEvent(0x01f7); elseif (OnionRings == QUEST_COMPLETED) then player:startEvent(0x01bd); elseif (OnionRings == QUEST_ACCEPTED ) then player:startEvent(0x01b6); elseif (InspectorsGadget == QUEST_COMPLETED) then player:startEvent(0x01a7); elseif (InspectorsGadget == QUEST_ACCEPTED) then player:startEvent(0x019f); elseif (KnowOnesOnions == QUEST_COMPLETED) then player:startEvent(0x019b); elseif (KnowOnesOnions == QUEST_ACCEPTED) then KnowOnesOnionsVar = player:getVar("KnowOnesOnions"); if (KnowOnesOnionsVar == 2) then player:startEvent(0x019a); else player:startEvent(0x018b); end elseif (TruthJusticeOnionWay == QUEST_COMPLETED) then player:startEvent(0x0181); elseif (TruthJusticeOnionWay == QUEST_ACCEPTED) then player:startEvent(0x0176); else player:startEvent(0x016c); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID2: %u",csid); --printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
kidaa/darkstar
scripts/zones/Upper_Jeuno/npcs/Brutus.lua
11
9517
----------------------------------- -- Area: Upper Jeuno -- NPC: Brutus -- Starts Quest: Chocobo's Wounds, Save My Son, Path of the Beastmaster, Wings of gold, Scattered into Shadow, Chocobo on the Loose! -- @pos -55 8 95 244 ----------------------------------- package.loaded["scripts/zones/Upper_Jeuno/TextIDs"] = nil; package.loaded["scripts/globals/settings"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Upper_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local chocoboOnTheLoose = player:getQuestStatus(JEUNO,CHOCOBO_ON_THE_LOOSE); local chocoboOnTheLooseStatus = player:getVar("ChocoboOnTheLoose"); local ChocobosWounds = player:getQuestStatus(JEUNO,CHOCOBO_S_WOUNDS); local saveMySon = player:getQuestStatus(JEUNO,SAVE_MY_SON); local wingsOfGold = player:getQuestStatus(JEUNO,WINGS_OF_GOLD); local scatIntoShadow = player:getQuestStatus(JEUNO,SCATTERED_INTO_SHADOW); local mLvl = player:getMainLvl(); local mJob = player:getMainJob(); if(chocoboOnTheLoose == QUEST_AVAILABLE) then player:startEvent(0x276D); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and chocoboOnTheLooseStatus == 0) then player:startEvent(0x276E); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and chocoboOnTheLooseStatus == 2) then player:startEvent(0x276F); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and chocoboOnTheLooseStatus == 3) then player:startEvent(0x2773); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and (chocoboOnTheLooseStatus == 5 or chocoboOnTheLooseStatus == 6)) then player:startEvent(0x2774); elseif(chocoboOnTheLoose == QUEST_ACCEPTED and chocoboOnTheLooseStatus == 7 and player:needToZone() == false and (player:getVar("ChocoboOnTheLooseDay") < VanadielDayOfTheYear() or player:getVar("ChocoboOnTheLooseYear") < VanadielYear())) then player:startEvent(0x277D); elseif(player:getMainLvl() >= 20 and ChocobosWounds ~= QUEST_COMPLETED) then local chocoFeed = player:getVar("ChocobosWounds_Event"); if(ChocobosWounds == QUEST_AVAILABLE) then player:startEvent(0x0047); elseif(chocoFeed == 1) then player:startEvent(0x0041); elseif(chocoFeed == 2) then player:startEvent(0x0042); else player:startEvent(0x0066); end elseif(ChocobosWounds == QUEST_COMPLETED and saveMySon == QUEST_AVAILABLE) then player:startEvent(0x0016); elseif(saveMySon == QUEST_COMPLETED and player:getQuestStatus(JEUNO,PATH_OF_THE_BEASTMASTER) == QUEST_AVAILABLE) then player:startEvent(0x0046); elseif(mLvl >= AF1_QUEST_LEVEL and mJob == 9 and wingsOfGold == QUEST_AVAILABLE) then if(player:getVar("wingsOfGold_shortCS") == 1) then player:startEvent(0x0089); -- Start Quest "Wings of gold" (Short dialog) else player:setVar("wingsOfGold_shortCS",1); player:startEvent(0x008b); -- Start Quest "Wings of gold" (Long dialog) end elseif(wingsOfGold == QUEST_ACCEPTED) then if(player:hasKeyItem(GUIDING_BELL) == false) then player:startEvent(0x0088); else player:startEvent(0x008a); -- Finish Quest "Wings of gold" end elseif(wingsOfGold == QUEST_COMPLETED and mLvl < AF2_QUEST_LEVEL and mJob == 9) then player:startEvent(0x0086); -- Standard dialog after "Wings of gold" elseif(scatIntoShadow == QUEST_AVAILABLE and mLvl >= AF2_QUEST_LEVEL and mJob == 9) then if(player:getVar("scatIntoShadow_shortCS") == 1) then player:startEvent(0x008f); else player:setVar("scatIntoShadow_shortCS",1); player:startEvent(0x008d); end elseif(scatIntoShadow == QUEST_ACCEPTED) then local scatIntoShadowCS = player:getVar("scatIntoShadowCS"); if(player:hasKeyItem(AQUAFLORA1) or player:hasKeyItem(AQUAFLORA2) or player:hasKeyItem(AQUAFLORA3)) then player:startEvent(0x008e); elseif(scatIntoShadowCS == 0) then player:startEvent(0x0090); elseif(scatIntoShadowCS == 1) then player:startEvent(0x0095); elseif(scatIntoShadowCS == 2) then player:startEvent(0x0087); end elseif(scatIntoShadow == QUEST_COMPLETED) then player:startEvent(0x0097); elseif(player:getQuestStatus(JEUNO,PATH_OF_THE_BEASTMASTER) == QUEST_COMPLETED) then player:startEvent(0x0014); else player:startEvent(0x0042, player:getMainLvl()); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if(csid == 0x276D) then player:addQuest(JEUNO,CHOCOBO_ON_THE_LOOSE); elseif(csid == 0x276E) then player:setVar("ChocoboOnTheLoose", 1); elseif(csid == 0x276F) then player:setVar("ChocoboOnTheLoose", 3); elseif(csid == 0x2773) then player:setVar("ChocoboOnTheLoose", 4); elseif(csid == 0x2774) then player:setVar("ChocoboOnTheLoose", 7); player:setVar("ChocoboOnTheLooseDay", VanadielDayOfTheYear()); player:setVar("ChocoboOnTheLooseYear", VanadielYear()); player:needToZone(true); elseif(csid == 0x277D) then player:setVar("ChocoboOnTheLoose", 0); player:setVar("ChocoboOnTheLooseDay", 0); player:setVar("ChocoboOnTheLooseYear", 0); player:addFame(JEUNO, JEUNO_FAME*30); player:addItem(2317); player:messageSpecial(ITEM_OBTAINED,2317); -- Chocobo Egg (a bit warm) player:completeQuest(JEUNO,CHOCOBO_ON_THE_LOOSE); elseif(csid == 0x0047 and option == 1) then player:addQuest(JEUNO,CHOCOBO_S_WOUNDS); player:setVar("ChocobosWounds_Event",1); elseif(csid == 0x0046) then player:addQuest(JEUNO,PATH_OF_THE_BEASTMASTER); player:addTitle(ANIMAL_TRAINER); player:unlockJob(9); -- Beastmaster player:messageSpecial(YOU_CAN_NOW_BECOME_A_BEASTMASTER); player:addFame(JEUNO, JEUNO_FAME*30); player:completeQuest(JEUNO,PATH_OF_THE_BEASTMASTER); elseif((csid == 0x008b or csid == 0x0089) and option == 1) then player:addQuest(JEUNO,WINGS_OF_GOLD); player:setVar("wingsOfGold_shortCS",0); elseif(csid == 0x008a) then if(player:getFreeSlotsCount() < 1) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,16680); else player:delKeyItem(GUIDING_BELL); player:addItem(16680); player:messageSpecial(ITEM_OBTAINED,16680); -- Barbaroi Axe player:addFame(JEUNO,AF1_FAME); player:completeQuest(JEUNO,WINGS_OF_GOLD); end elseif((csid == 0x008f or csid == 0x008d) and option == 1) then player:addQuest(JEUNO,SCATTERED_INTO_SHADOW); player:setVar("scatIntoShadow_shortCS",0); player:addKeyItem(AQUAFLORA1); player:addKeyItem(AQUAFLORA2); player:addKeyItem(AQUAFLORA3); player:messageSpecial(KEYITEM_OBTAINED,AQUAFLORA1); elseif(csid == 0x0090) then player:setVar("scatIntoShadowCS",1); elseif(csid == 0x0087) then if(player:getFreeSlotsCount() < 1) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,14097); else player:setVar("scatIntoShadowCS",0); player:addItem(14097); player:messageSpecial(ITEM_OBTAINED,14097); -- Beast Gaiters player:addFame(JEUNO,JEUNO_FAME*AF2_FAME); player:completeQuest(JEUNO,SCATTERED_INTO_SHADOW); end end end;
gpl-3.0
kidaa/darkstar
scripts/zones/Misareaux_Coast/npcs/Logging_Point.lua
29
1107
----------------------------------- -- Area: Misareaux Coast -- NPC: Logging Point ----------------------------------- package.loaded["scripts/zones/Misareaux_Coast/TextIDs"] = nil; ------------------------------------- require("scripts/globals/logging"); require("scripts/zones/Misareaux_Coast/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) startLogging(player,player:getZoneID(),npc,trade,0x022B); end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:messageSpecial(LOGGING_IS_POSSIBLE_HERE,1021); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
will4wachter/Project1
scripts/zones/Aht_Urhgan_Whitegate/npcs/Hadayah.lua
10
1760
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Hadayah -- Type: Alchemy Image Support -- @pos -10.470 -6.25 -141.700 241 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); require("scripts/globals/status"); require("scripts/globals/crafting"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local guildMember = isGuildMember(player,1); local SkillLevel = player:getSkillLevel(2); if (guildMember == 1) then if (player:hasStatusEffect(EFFECT_ALCHEMY_IMAGERY) == false) then player:startEvent(0x027E,4,SkillLevel,1,511,187,0,7,2184); else player:startEvent(0x027E,4,SkillLevel,1,511,5662,6955,7,2184); end else player:startEvent(0x027E,0,0,0,0,0,0,7,0); -- Standard Dialogue end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x027E and option == 1) then player:messageSpecial(ALCHEMY_SUPPORT,0,7,1); player:addStatusEffect(EFFECT_ALCHEMY_IMAGERY,1,0,120); end end;
gpl-3.0
kidaa/darkstar
scripts/zones/Port_Windurst/npcs/Erabu-Fumulubu.lua
53
1835
----------------------------------- -- Area: Port Windurst -- NPC: Erabu-Fumulubu -- Type: Fishing Synthesis Image Support -- @pos -178.900 -2.789 76.200 240 ----------------------------------- package.loaded["scripts/zones/Port_Windurst/TextIDs"] = nil; ----------------------------------- require("scripts/globals/status"); require("scripts/globals/crafting"); require("scripts/zones/Port_Windurst/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local guildMember = isGuildMember(player,5); local SkillCap = getCraftSkillCap(player,SKILL_FISHING); local SkillLevel = player:getSkillLevel(SKILL_FISHING); if (guildMember == 1) then if (player:hasStatusEffect(EFFECT_FISHING_IMAGERY) == false) then player:startEvent(0x271C,SkillCap,SkillLevel,1,239,player:getGil(),0,0,0); -- p1 = skill level else player:startEvent(0x271C,SkillCap,SkillLevel,1,239,player:getGil(),19194,4031,0); end else player:startEvent(0x271C); -- Standard Dialogue end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x271C and option == 1) then player:messageSpecial(FISHING_SUPPORT,0,0,1); player:addStatusEffect(EFFECT_FISHING_IMAGERY,1,0,3600); end end;
gpl-3.0
lhog/Zero-K
units/shipassault.lua
1
6013
return { shipassault = { unitname = [[shipassault]], name = [[Siren]], description = [[Destroyer (Riot/Assault)]], acceleration = 0.46, activateWhenBuilt = true, brakeRate = 0.6, buildCostMetal = 600, builder = false, buildPic = [[shipassault.png]], canGuard = true, canMove = true, canPatrol = true, category = [[SHIP]], collisionVolumeOffsets = [[0 6 0]], collisionVolumeScales = [[55 55 110]], collisionVolumeType = [[ellipsoid]], corpse = [[DEAD]], --Core_color.dds Core_other.dds customParams = { bait_level_default = 0, modelradius = [[55]], turnatfullspeed = [[1]], extradrawrange = 800, }, explodeAs = [[BIG_UNITEX]], floater = true, footprintX = 4, footprintZ = 4, iconType = [[shipassault]], idleAutoHeal = 5, idleTime = 1800, losEmitHeight = 25, maxDamage = 5200, maxVelocity = 2.0, minWaterDepth = 5, movementClass = [[BOAT4]], noAutoFire = false, noChaseCategory = [[TERRAFORM FIXEDWING SATELLITE SUB SINK TURRET]], objectName = [[shipassault.s3o]], script = [[shipassault.lua]], selfDestructAs = [[BIG_UNITEX]], sfxtypes = { explosiongenerators = { [[custom:sonicfire_80]], [[custom:emg_shells_l]], }, }, sightDistance = 440, sonarDistance = 440, turninplace = 0, turnRate = 384, workerTime = 0, weapons = { { def = [[SONIC]], badTargetCategory = [[FIXEDWING]], onlyTargetCategory = [[FIXEDWING LAND SINK TURRET SHIP SWIM FLOAT GUNSHIP HOVER]], mainDir = [[0 -1 0]], maxAngleDif = 240, }, { def = [[MISSILE]], badTargetCategory = [[SWIM LAND SHIP HOVER]], onlyTargetCategory = [[SWIM LAND SINK TURRET FLOAT SHIP HOVER]], }, }, weaponDefs = { SONIC = { name = [[Sonic Blaster]], areaOfEffect = 190, avoidFeature = true, avoidFriendly = true, burnblow = true, craterBoost = 0, craterMult = 0, customParams = { force_ignore_ground = [[1]], slot = [[5]], muzzleEffectFire = [[custom:HEAVY_CANNON_MUZZLE]], miscEffectFire = [[custom:RIOT_SHELL_L]], lups_explodelife = 1.5, lups_explodespeed = 0.8, light_radius = 240, }, damage = { default = 280.01, }, cegTag = [[sonictrail]], cylinderTargeting = 5.0, explosionGenerator = [[custom:sonic_80]], edgeEffectiveness = 0.5, fireStarter = 150, impulseBoost = 300, impulseFactor = 0.5, interceptedByShieldType = 1, myGravity = 0.01, noSelfDamage = true, range = 270, reloadtime = 1.7, size = 64, sizeDecay = 0.2, soundStart = [[weapon/sonicgun2]], soundHit = [[weapon/sonicgun_hit]], soundStartVolume = 6, soundHitVolume = 10, stages = 1, texture1 = [[sonic_glow2]], texture2 = [[null]], texture3 = [[null]], rgbColor = {0.2, 0.6, 0.8}, turret = true, weaponType = [[Cannon]], weaponVelocity = 700, waterweapon = true, duration = 0.15, }, MISSILE = { name = [[Destroyer Missiles]], areaOfEffect = 48, cegTag = [[missiletrailyellow]], collideFriendly = false, craterBoost = 1, craterMult = 2, customParams = { combatRange = 265, }, damage = { default = 400.01, }, edgeEffectiveness = 0.5, fireStarter = 100, fixedLauncher = true, flightTime = 4, impulseBoost = 0, impulseFactor = 0.4, interceptedByShieldType = 2, model = [[wep_m_hailstorm.s3o]], noSelfDamage = true, range = 800, reloadtime = 16, smokeTrail = true, soundHit = [[weapon/missile/missile_fire12]], soundStart = [[weapon/missile/missile_fire10]], startVelocity = 100, tolerance = 4000, turnrate = 30000, turret = true, --waterWeapon = true, weaponAcceleration = 300, weaponTimer = 1, weaponType = [[StarburstLauncher]], weaponVelocity = 1800, }, }, featureDefs = { DEAD = { blocking = false, featureDead = [[HEAP]], footprintX = 4, footprintZ = 4, object = [[shipassault_dead.s3o]], }, HEAP = { blocking = false, footprintX = 4, footprintZ = 4, object = [[debris4x4a.s3o]], }, }, } }
gpl-2.0
kidaa/darkstar
scripts/zones/Port_Jeuno/npcs/Zona_Shodhun.lua
34
3745
----------------------------------- -- Area: Port Jeuno -- NPC: Zona Shodhun -- Starts and Finishes Quest: Pretty Little Things -- @zone 246 -- @pos -175 -5 -4 ----------------------------------- package.loaded["scripts/globals/settings"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) count = trade:getItemCount(); gil = trade:getGil(); itemQuality = 0; if (trade:getItemCount() == 1 and trade:getGil() == 0) then if (trade:hasItemQty(771,1)) then -- Yellow Rock itemQuality = 2; elseif (trade:hasItemQty(769,1) or -- Red Rock trade:hasItemQty(770,1) or -- Blue Rock trade:hasItemQty(772,1) or -- Green Rock trade:hasItemQty(773,1) or -- Translucent Rock trade:hasItemQty(774,1) or -- Purple Rock trade:hasItemQty(775,1) or -- Black Rock trade:hasItemQty(776,1) or -- White Rock trade:hasItemQty(957,1) or -- Amaryllis trade:hasItemQty(2554,1) or -- Asphodel trade:hasItemQty(948,1) or -- Carnation trade:hasItemQty(1120,1) or -- Casablanca trade:hasItemQty(1413,1) or -- Cattleya trade:hasItemQty(636,1) or -- Chamomile trade:hasItemQty(959,1) or -- Dahlia trade:hasItemQty(835,1) or -- Flax Flower trade:hasItemQty(956,1) or -- Lilac trade:hasItemQty(2507,1) or -- Lycopodium Flower trade:hasItemQty(958,1) or -- Marguerite trade:hasItemQty(1412,1) or -- Olive Flower trade:hasItemQty(938,1) or -- Papaka Grass trade:hasItemQty(1411,1) or -- Phalaenopsis trade:hasItemQty(949,1) or -- Rain Lily trade:hasItemQty(941,1) or -- Red Rose trade:hasItemQty(1725,1) or -- Snow Lily trade:hasItemQty(1410,1) or -- Sweet William trade:hasItemQty(950,1) or -- Tahrongi Cactus trade:hasItemQty(2960,1) or -- Water Lily trade:hasItemQty(951,1)) then -- Wijnruit itemQuality = 1; end end PrettyLittleThings = player:getQuestStatus(JEUNO,PRETTY_LITTLE_THINGS); if (itemQuality == 2) then if (PrettyLittleThings == QUEST_COMPLETED) then player:startEvent(0x2727, 0, 246, 4); else player:startEvent(0x2727, 0, 246, 2); end elseif (itemQuality == 1) then if (PrettyLittleThings == QUEST_COMPLETED) then player:startEvent(0x2727, 0, 246, 5); elseif (PrettyLittleThings == QUEST_ACCEPTED) then player:startEvent(0x2727, 0, 246, 3); else player:startEvent(0x2727, 0, 246, 1); end else player:startEvent(0x2727, 0, 246, 0); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x2727, 0, 246, 10); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x2727 and option == 4002) then player:moghouseFlag(8); player:messageSpecial(MOGHOUSE_EXIT); player:addFame(JEUNO, JEUNO_FAME*30); player:tradeComplete(); player:completeQuest(JEUNO,PRETTY_LITTLE_THINGS); elseif (csid == 0x2727 and option == 1) then player:tradeComplete(); player:addQuest(JEUNO,PRETTY_LITTLE_THINGS); end end;
gpl-3.0
davidedmonds/darkstar
scripts/zones/Pashhow_Marshlands/npcs/Mesachedeau_RK.lua
30
3070
----------------------------------- -- Area: Pashhow Marshlands -- NPC: Mesachedeau, R.K. -- Type: Outpost Conquest Guards -- @pos 470.843 23.465 415.520 109 ----------------------------------- package.loaded["scripts/zones/Pashhow_Marshlands/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Pashhow_Marshlands/TextIDs"); local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border local region = DERFLAND; local csid = 0x7ffb; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then if (supplyRunFresh(player) == 1) then player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies ! else player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use." player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region)); player:setVar("supplyQuest_region",0); end else local arg1 = getArg1(guardnation, player) - 1; if (arg1 >= 1792) then -- foreign, non-allied player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0); else -- citizen or allied player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option == 2) then player:delKeyItem(getSupplyKey(region)); player:addCP(supplyReward[region + 1]) player:messageSpecial(CONQUEST); -- "You've earned conquest points!" if (hasOutpost(player, region+5) == 0) then local supply_quests = 2^(region+5); player:addNationTeleport(guardnation,supply_quests); player:setVar("supplyQuest_region",0); end elseif (option == 4) then if (player:delGil(giltosetHP(guardnation,player))) then player:setHomePoint(); player:messageSpecial(CONQUEST + 94); -- "Your home point has been set." else player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here." end end end;
gpl-3.0
MonokuroInzanaito/ygopro-777DIY
expansions/script/c10981013.lua
1
3618
--调整再诞 function c10981013.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCountLimit(1,10981013+EFFECT_COUNT_CODE_OATH) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c10981013.target) e1:SetOperation(c10981013.activate) c:RegisterEffect(e1) end function c10981013.filter(c,e,tp) return c:IsFaceup() and c:IsType(TYPE_TUNER) and Duel.IsPlayerCanSpecialSummonMonster(tp,10981014,0,0x4011,c:GetAttack(),c:GetDefense(),c:GetLevel(),c:GetRace(),c:GetAttribute()) end function c10981013.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c10981013.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c10981013.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,c10981013.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end function c10981013.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc:IsFacedown() or not tc:IsRelateToEffect(e) then return end if not Duel.IsPlayerCanSpecialSummonMonster(tp,10981014,0,0x4011,tc:GetAttack(),tc:GetDefense(),tc:GetLevel(),tc:GetRace(),tc:GetAttribute()) then return end local token=Duel.CreateToken(tp,10981014) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(tc:GetAttack()) e1:SetReset(RESET_EVENT+0x1fe0000) token:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_DEFENSE) e2:SetValue(tc:GetDefense()) token:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EFFECT_CHANGE_LEVEL) e3:SetValue(tc:GetLevel()) token:RegisterEffect(e3) local e4=e1:Clone() e4:SetCode(EFFECT_CHANGE_RACE) e4:SetValue(tc:GetRace()) token:RegisterEffect(e4) local e5=e1:Clone() e5:SetCode(EFFECT_CHANGE_ATTRIBUTE) e5:SetValue(tc:GetAttribute()) token:RegisterEffect(e5) local e6=Effect.CreateEffect(e:GetHandler()) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM) e6:SetTarget(c10981013.syntg) e6:SetValue(1) e6:SetOperation(c10981013.synop) token:RegisterEffect(e6) Duel.SpecialSummonComplete() end function c10981013.tuner_filter(c) return not c:IsType(TYPE_SYNCHRO) and c:IsLevelAbove(3) end function c10981013.synfilter(c,syncard,tuner,f) return c:IsFaceup() and c:IsNotTuner() and c:IsCanBeSynchroMaterial(syncard,tuner) and not c:IsType(TYPE_SYNCHRO) and c:IsLevelAbove(3) and (f==nil or f(c)) end function c10981013.syntg(e,syncard,f,minc,maxc) local c=e:GetHandler() local lv=syncard:GetLevel()-c:GetLevel() if lv<=0 then return false end local g=Duel.GetMatchingGroup(c10981013.synfilter,syncard:GetControler(),LOCATION_MZONE,LOCATION_MZONE,c,syncard,c,f) return g:CheckWithSumEqual(Card.GetSynchroLevel,lv,minc,maxc,syncard) end function c10981013.synop(e,tp,eg,ep,ev,re,r,rp,syncard,f,minc,maxc) local c=e:GetHandler() local lv=syncard:GetLevel()-c:GetLevel() local g=Duel.GetMatchingGroup(c10981013.synfilter,syncard:GetControler(),LOCATION_MZONE,LOCATION_MZONE,c,syncard,c,f) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SMATERIAL) local sg=g:SelectWithSumEqual(tp,Card.GetSynchroLevel,lv,minc,maxc,syncard) Duel.SetSynchroMaterial(sg) end
gpl-3.0
MonokuroInzanaito/ygopro-777DIY
expansions/script/c60150530.lua
1
1910
--幻想曲 被褪去的面具 function c60150530.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,c60150530.tfilter,aux.NonTuner(nil),1) c:EnableReviveLimit() --remove local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(60150530,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(c60150530.tdtg) e1:SetOperation(c60150530.tdop) c:RegisterEffect(e1) --xyzlv local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_XYZ_LEVEL) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_MZONE) e2:SetValue(c60150530.xyzlv) c:RegisterEffect(e2) end function c60150530.xyzlv(e,c,rc) return 0xa0000+e:GetHandler():GetLevel() end function c60150530.tfilter(c) return c:IsSetCard(0xab20) end function c60150530.filter(c) return c:IsType(TYPE_XYZ) and c:IsAbleToDeck() end function c60150530.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingMatchingCard(c60150530.filter,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(c60150530.filter,tp,LOCATION_GRAVE,0,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function c60150530.tdop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,c60150530.filter,tp,LOCATION_GRAVE,0,1,2,nil) if g:GetCount()>0 then Duel.HintSelection(g) if Duel.SendtoDeck(g,nil,2,REASON_EFFECT)>0 then local g1=Duel.GetOperatedGroup():GetCount() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g2=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,g1,nil) if g2:GetCount()>0 then Duel.HintSelection(g2) Duel.SendtoDeck(g2,nil,2,REASON_EFFECT) end end end end
gpl-3.0
davidedmonds/darkstar
scripts/zones/Tavnazian_Safehold/npcs/Nivorajean.lua
38
1048
----------------------------------- -- Area: Tavnazian Safehold -- NPC: Nivorajean -- Type: Standard NPC -- @zone: 26 -- @pos 15.890 -22.999 13.322 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x00dd); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
lhog/Zero-K
LuaRules/Configs/MetalSpots/Charlie in the Hills v2.1.lua
8
3180
return { spots = { [1] = {x = 1960, z = 2760, metal = 1.7}, [2] = {x = 3416, z = 152, metal = 1.7}, [3] = {x = 4136, z = 8008, metal = 1.7}, [4] = {x = 4136, z = 3864, metal = 1.7}, [5] = {x = 4824, z = 7992, metal = 1.7}, [6] = {x = 4280, z = 7832, metal = 1.7}, [7] = {x = 6008, z = 2632, metal = 1.7}, [8] = {x = 3976, z = 7816, metal = 1.7}, [9] = {x = 4136, z = 7672, metal = 1.7}, [10] = {x = 5320, z = 3816, metal = 1.7}, [11] = {x = 3432, z = 7672, metal = 1.7}, [12] = {x = 4712, z = 6888, metal = 1.7}, [13] = {x = 4712, z = 2504, metal = 1.7}, [14] = {x = 3480, z = 6872, metal = 1.7}, [15] = {x = 3000, z = 3800, metal = 1.7}, [16] = {x = 3988, z = 6869, metal = 1.7}, [17] = {x = 4824, z = 6648, metal = 1.7}, [18] = {x = 3464, z = 2488, metal = 1.7}, [19] = {x = 3480, z = 6600, metal = 1.7}, [20] = {x = 6264, z = 3736, metal = 1.7}, [21] = {x = 5928, z = 6328, metal = 1.7}, [22] = {x = 5752, z = 2072, metal = 1.7}, [23] = {x = 5530, z = 6320, metal = 1.7}, [24] = {x = 2262, z = 6314, metal = 1.7}, [25] = {x = 2040, z = 3592, metal = 1.7}, [26] = {x = 2632, z = 6296, metal = 1.7}, [27] = {x = 2456, z = 6168, metal = 1.7}, [28] = {x = 2472, z = 2072, metal = 1.7}, [29] = {x = 5736, z = 6152, metal = 1.7}, [30] = {x = 3496, z = 5832, metal = 1.7}, [31] = {x = 6264, z = 3320, metal = 1.7}, [32] = {x = 4840, z = 5816, metal = 1.7}, [33] = {x = 5960, z = 5512, metal = 1.7}, [34] = {x = 6472, z = 4536, metal = 1.7}, [35] = {x = 2072, z = 5512, metal = 1.7}, [36] = {x = 2232, z = 5048, metal = 1.7}, [37] = {x = 4728, z = 1352, metal = 1.7}, [38] = {x = 3288, z = 4968, metal = 1.7}, [39] = {x = 4056, z = 4952, metal = 1.7}, [40] = {x = 5560, z = 1912, metal = 1.7}, [41] = {x = 6280, z = 4920, metal = 1.7}, [42] = {x = 4936, z = 4888, metal = 1.7}, [43] = {x = 3352, z = 3256, metal = 1.7}, [44] = {x = 1992, z = 4520, metal = 1.7}, [45] = {x = 3480, z = 1336, metal = 1.7}, [46] = {x = 2680, z = 1896, metal = 1.7}, [47] = {x = 2488, z = 1736, metal = 1.7}, [48] = {x = 5288, z = 4344, metal = 1.7}, [49] = {x = 4216, z = 3224, metal = 1.7}, [50] = {x = 4100, z = 440, metal = 1.7}, [51] = {x = 4936, z = 3288, metal = 1.7}, [52] = {x = 2296, z = 1896, metal = 1.7}, [53] = {x = 4728, z = 1624, metal = 1.7}, [54] = {x = 4776, z = 616, metal = 1.7,}, [55] = {x = 2344, z = 3144, metal = 1.7}, [56] = {x = 3384, z = 1592, metal = 1.7}, [57] = {x = 2952, z = 4376, metal = 1.7}, [58] = {x = 5757, z = 1784, metal = 1.7}, [59] = {x = 4136, z = 4328, metal = 1.7}, [60] = {x = 4136, z = 1260, metal = 1.7}, [61] = {x = 4137, z = 6738, metal = 1.7}, [62] = {x = 4303, z = 6859, metal = 1.7}, [63] = {x = 4137, z = 6982, metal = 1.7}, [64] = {x = 2440, z = 6420, metal = 1.7}, [65] = {x = 5700, z = 6470, metal = 1.7}, [66] = {x = 5937, z = 1912, metal = 1.7}, [67] = {x = 4375, z = 440, metal = 1.7}, [68] = {x = 4247, z = 302, metal = 1.7}, [69] = {x = 4270, z = 575, metal = 1.7}, [70] = {x = 4136, z = 1500, metal = 1.7}, [71] = {x = 3977, z = 1400, metal = 1.7}, [72] = {x = 4290, z = 1400, metal = 1.7}, }, }
gpl-2.0
waterlgndx/darkstar
scripts/globals/abilities/fight.lua
2
1027
----------------------------------- -- Ability: Fight -- Commands your pet to attack the target. -- Obtained: Beastmaster Level 1 -- Recast Time: 10 seconds -- Duration: N/A ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/msg"); ----------------------------------- function onAbilityCheck(player,target,ability) if (player:getPet() == nil) then return dsp.msg.basic.REQUIRES_A_PET,0; else if (target:getID() == player:getPet():getID() or (target:getMaster() ~= nil and target:getMaster():isPC())) then return dsp.msg.basic.CANNOT_ATTACK_TARGET,0; else return 0,0; end end end; function onUseAbility(player,target,ability) local pet = player:getPet(); if (player:checkDistance(pet) <= 25) then if (pet:hasStatusEffect(dsp.effect.HEALING)) then pet:delStatusEffect(dsp.effect.HEALING) end player:petAttack(target); end end;
gpl-3.0
davidedmonds/darkstar
scripts/globals/weaponskills/swift_blade.lua
30
1389
----------------------------------- -- Swift Blade -- Sword weapon skill -- Skill Level: 225 -- Delivers a three-hit attack. params.accuracy varies with TP. -- Will stack with Sneak Attack. -- Aligned with the Shadow Gorget & Soil Gorget. -- Aligned with the Shadow Belt & Soil Belt. -- Element: None -- Modifiers: STR:50% ; MND:50% -- 100%TP 200%TP 300%TP -- 1.50 1.50 1.50 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 3; params.ftp100 = 1.5; params.ftp200 = 1.5; params.ftp300 = 1.5; params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.3; params.chr_wsc = 0.0; params.crit100 = 0.0; params.crit200 = 0.0; params.crit300 = 0.0; params.canCrit = false; params.acc100 = 0.8; params.acc200= 0.9; params.acc300= 1; params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.5; params.mnd_wsc = 0.5; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
stevedonovan/luabuild
modules/luasocket/samples/cddb.lua
56
1415
local socket = require("socket") local http = require("socket.http") if not arg or not arg[1] or not arg[2] then print("luasocket cddb.lua <category> <disc-id> [<server>]") os.exit(1) end local server = arg[3] or "http://freedb.freedb.org/~cddb/cddb.cgi" function parse(body) local lines = string.gfind(body, "(.-)\r\n") local status = lines() local code, message = socket.skip(2, string.find(status, "(%d%d%d) (.*)")) if tonumber(code) ~= 210 then return nil, code, message end local data = {} for l in lines do local c = string.sub(l, 1, 1) if c ~= '#' and c ~= '.' then local key, value = socket.skip(2, string.find(l, "(.-)=(.*)")) value = string.gsub(value, "\\n", "\n") value = string.gsub(value, "\\\\", "\\") value = string.gsub(value, "\\t", "\t") data[key] = value end end return data, code, message end local host = socket.dns.gethostname() local query = "%s?cmd=cddb+read+%s+%s&hello=LuaSocket+%s+LuaSocket+2.0&proto=6" local url = string.format(query, server, arg[1], arg[2], host) local body, headers, code = http.get(url) if code == 200 then local data, code, error = parse(body) if not data then print(error or code) else for i,v in pairs(data) do io.write(i, ': ', v, '\n') end end else print(error) end
mit
davidedmonds/darkstar
scripts/globals/spells/paralyze.lua
18
1997
----------------------------------------- -- Spell: Paralyze -- Spell accuracy is most highly affected by Enfeebling Magic Skill, Magic Accuracy, and MND. ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) if (target:hasStatusEffect(EFFECT_PARALYSIS)) then --effect already on, do nothing spell:setMsg(75); else -- Calculate duration. local duration = math.random(20,120); if (caster:hasStatusEffect(EFFECT_SABOTEUR)) then duration = duration * 2; end -- Grabbing variables for paralyze potency local pMND = caster:getStat(MOD_MND); local mMND = target:getStat(MOD_MND); local dMND = (pMND - mMND); -- Calculate potency. local potency = (pMND + dMND)/5; --simplified from (2 * (pMND + dMND)) / 10 if potency > 25 then potency = 25; end if (caster:hasStatusEffect(EFFECT_SABOTEUR)) then potency = potency * 2; end caster:delStatusEffect(EFFECT_SABOTEUR); --printf("Duration : %u",duration); --printf("Potency : %u",potency); local resist = applyResistanceEffect(caster,spell,target,dMND,35,0,EFFECT_PARALYSIS); if (resist >= 0.5) then --there are no quarter or less hits, if target resists more than .5 spell is resisted completely if (target:addStatusEffect(EFFECT_PARALYSIS,potency,0,duration*resist)) then spell:setMsg(236); else -- no effect spell:setMsg(75); end else -- resist spell:setMsg(85); end end return EFFECT_PARALYSIS; end;
gpl-3.0
will4wachter/Project1
scripts/globals/spells/dark_carol.lua
6
1501
----------------------------------------- -- Spell: Dark Carol -- Increases dark resistance for party members within the area of effect. ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function OnMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local sLvl = caster:getSkillLevel(SKILL_SNG); -- Gets skill level of Singing local iLvl = caster:getWeaponSkillLevel(SLOT_RANGED); local power = 20; if (sLvl+iLvl > 200) then power = power + math.floor((sLvl+iLvl-200) / 10); end if(power >= 40) then power = 40; end local iBoost = caster:getMod(MOD_CAROL_EFFECT) + caster:getMod(MOD_ALL_SONGS_EFFECT); power = power + iBoost*5; if (caster:hasStatusEffect(EFFECT_SOUL_VOICE)) then power = power * 2; elseif (caster:hasStatusEffect(EFFECT_MARCATO)) then power = power * 1.5; end caster:delStatusEffect(EFFECT_MARCATO); local duration = 120; duration = duration * ((iBoost * 0.1) + (caster:getMod(MOD_SONG_DURATION_BONUS)/100) + 1); if (caster:hasStatusEffect(EFFECT_TROUBADOUR)) then duration = duration * 2; end if not (target:addBardSong(caster,EFFECT_CAROL,power,0,duration,caster:getID(), ELE_DARK, 1)) then spell:setMsg(75); end return EFFECT_CAROL; end;
gpl-3.0
will4wachter/Project1
scripts/globals/items/galette_des_rois.lua
39
1322
----------------------------------------- -- ID: 5875 -- Item: Galette Des Rois -- Food Effect: 180 Min, All Races ----------------------------------------- -- MP % 1 -- Intelligence +2 -- Random Jewel ----------------------------------------- require("scripts/globals/status"); require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD)) then result = 246; end if (target:getFreeSlotsCount() == 0) then result = 308; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,5875); local rand = math.random(784,815); target:addItem(rand); -- Random Jewel end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MPP, 1); target:addMod(MOD_INT, 2); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MPP, 1); target:delMod(MOD_INT, 2); end;
gpl-3.0
kidaa/darkstar
scripts/zones/Quicksand_Caves/npcs/_5sb.lua
19
1272
----------------------------------- -- Area: Quicksand Caves -- NPC: Ornate Door -- Door blocked by Weight system -- @pos -420 0 735 208 ----------------------------------- package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Quicksand_Caves/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local difX = player:getXPos()-(-420); local difZ = player:getZPos()-(726); local Distance = math.sqrt( math.pow(difX,2) + math.pow(difZ,2) ); if(Distance < 3) then return -1; end player:messageSpecial(DOOR_FIRMLY_SHUT); return 1; end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
will4wachter/Project1
scripts/zones/Konschtat_Highlands/npcs/qm2.lua
11
1422
----------------------------------- -- Area: Konschtat Highlands -- NPC: qm2 (???) -- Involved in Quest: Forge Your Destiny -- @pos -709 2 102 108 ----------------------------------- package.loaded["scripts/zones/Konschtat_Highlands/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Konschtat_Highlands/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(player:getQuestStatus(OUTLANDS,FORGE_YOUR_DESTINY) == QUEST_ACCEPTED) then if(trade:getItemCount() == 1 and trade:hasItemQty(1151,1) and GetMobAction(17219999) == 0) then -- Oriental Steel SpawnMob(17219999, 300):updateEnmity(player); -- Spawn Forger, Despawn after inactive for 5 minutes player:tradeComplete(); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID2: %u",csid); --printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
kidaa/darkstar
scripts/zones/Castle_Oztroja/npcs/_47x.lua
17
1245
----------------------------------- -- Area: Castle Oztroja -- NPC: _47x (Handle) -- Notes: Opens door _477 -- @pos -99 -71 -41 151 ----------------------------------- package.loaded["scripts/zones/Castle_Oztroja/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Castle_Oztroja/TextIDs"); require("scripts/globals/settings"); ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local DoorID = npc:getID() - 1; local DoorA = GetNPCByID(DoorID):getAnimation(); if(player:getZPos() > -45) then if(DoorA == 9 and npc:getAnimation() == 9) then npc:openDoor(6.5); -- Should be a ~1 second delay here before the door opens GetNPCByID(DoorID):openDoor(4.5); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
kidaa/darkstar
scripts/zones/Castle_Oztroja/Zone.lua
28
1816
----------------------------------- -- -- Zone: Castle_Oztroja (151) -- ----------------------------------- package.loaded["scripts/zones/Castle_Oztroja/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/zone"); require("scripts/zones/Castle_Oztroja/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) -- Yagudo Avatar SetRespawnTime(17396134, 900, 10800); UpdateTreasureSpawnPoint(17396206); UpdateTreasureSpawnPoint(17396207); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-162.895,22.136,-139.923,2); end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
footballhead/ld30
game.lua
1
11458
-- line used to preview where networks are built -- FIX: this should not be a global object!! preview_line = { -- location of start (endpoint is at mouse) -- if (-1,-1) then don't draw node = nil, master = nil, limit = 75, is_active = function( self ) return self.node ~= nil end, enable = function( self, node ) self.node = node self.master.mode = 'build' end, disable = function( self ) self.node = nil self.master.mode = 'stats' end, draw = function( self, endx, endy ) if not self:is_active() then return end local length = utils.eucdist( self.node.x, self.node.y, endx, endy ) local cost = Edge:get_cost( length ) if self.master.bank:has_funds( cost ) and length < self.limit then love.graphics.setColor( 0, 128, 0, 128 ) else love.graphics.setColor( 255, 0, 0, 128 ) end love.graphics.setLineWidth( 2 ) love.graphics.line( self.node.x, self.node.y, endx, endy ) if length > self.limit then love.graphics.printshadow( "Too long!", endx, endy - 16, 1, self.master.gui_font ) else love.graphics.printshadow( tostring(cost), endx, endy - 16, 1, self.master.gui_font ) end end, get_cost = function( self, endx, endy ) local length = utils.eucdist( self.node.x, self.node.y, endx, endy ) return Edge:get_cost( length ) end, } game = { init = function( self ) local winw, winh = love.graphics.getDimensions() local tmp = nil local stoptime = function() self.time.factor = 0; music:pause() end local starttime = function() self.time.factor = 1; music:play(); music:setPitch( 1 ) end local fastforwardtime = function() self.time.factor = 5; music:play(); music:setPitch( 2 ) end local menu_action = function( country, action ) --if action == "Take some funds" then -- self.bank:add_funds( 200, country ) --elseif action == "Give back funds" then -- self.bank:take_country_all_funds( country ) --end end preview_line.master = self -- load the map we will use self.map = Map:new( "assets/Map-790.png", "assets/Map-790-mask.png", 0, 0 ) -- load font used for gui self.gui_font = love.graphics.newFont( "assets/LiberationSans-Regular.ttf" ) self.gui_font_bold = love.graphics.newFont( "assets/LiberationSans-Bold.ttf" ) self.lmb = MouseState:new() self.rmb = MouseState:new() self.mmb = MouseState:new() self.menu = Menu:new( self, { "Herpaderp", "foo bar baz" }, self.gui_font, self.gui_font_bold, menu_action ) self.time = GameTime:new() self.bank = Bank:new( 1500 ) self.earnings = 0 -- valid modes are 'stats', 'menu', and 'build' self.mode = 'stats' -- load gui buttons Button:new( winw - 96, winh - 64 , "assets/pause.png", "assets/pause-press.png", stoptime ) tmp = Button:new( winw - 64, winh - 64 , "assets/play.png", "assets/play-press.png", starttime ) Button:new( winw - 32, winh - 64 , "assets/fast-forward.png", "assets/fast-forward-press.png", fastforwardtime ) -- HCK to get play button properly highlighted tmp:click() end, try_to_make_node = function( self, x, y ) local countryname = self.map:get_country( x, y, Country.rgb ) -- make sure we are clicking on a country if countryname ~= "None" then -- make sure we have enough money if self.bank:has_funds( Vertex.cost ) then -- make sure the vertex isn't too close to something else if self.map.graph:can_add_vertex( x, y ) then -- actually make the vertex and add to graph local countryobj = Country.instances[countryname] local newvert = Vertex:new( self.map.graph, x, y, countryobj ) self.bank:take( Vertex.cost ) RisingText:new( "-"..tostring(Vertex.cost), x, y, self.gui_font ) else RisingText:new( "Too close!", x, y, self.gui_font ) end else RisingText:new( "Need $"..tostring(Vertex.cost), x, y, self.gui_font ) end else RisingText:new( "Can only build hubs in countries!", x, y, self.gui_font ) end end, new_month = function( self, month ) if month == 20 then screen = notime end for key, val in pairs( Country.instances ) do print( key ) val:spread_politics() end end, try_to_make_line = function( self, endx, endy ) -- try to find an existing vertex; make one otherwise local node = self.map.graph:find_vertex( endx, endy ) if node == nil then RisingText:new( "Must end on a hub!", endx, endy, self.gui_font ) else if node == preview_line.node then RisingText:new( "Can't start and end on same hub!", endx, endy, self.gui_font ) else local cost = preview_line:get_cost( node.x, node.y ) if self.bank:has_funds( cost ) then Edge:new( self.map.graph, preview_line.node, node ) RisingText:new( "-"..tostring(cost), endx, endy, self.gui_font ) self.bank:take( cost ) else RisingText:new( "Need $"..tostring(cost), endx, endy, self.gui_font ) end end end -- disable build preview preview_line:disable() end, update = function( self, dt ) local mx, my = love.mouse.getPosition() -- GAMEOVER BANKRUPT if self.bank.total <= 0 then screen = bankrupt end local demo = 0 for key, val in pairs( Country.instances ) do -- GAMEOVER UNHAPPY COUNTRY if val.favor <= 0 then screen = death end if val.government == 'democracy' then demo = demo + 1 end end -- WIN: DEMOCRACY AND COMMUNISM if demo == 11 then screen = win elseif demo == 0 then screen = uhhh end -- update countries for key, val in pairs( Country.instances ) do val:update( dt ) end -- menu is updated before buttons to properly register input (menu appears overtop of buttons) self.menu:update() -- look for GUI button pushes next for i, but in ipairs( Button.instances ) do but:update() end -- update all built communication lines self.map.graph:update() -- update info text on HUD for i, txt in ipairs( RisingText.instances ) do txt:update( dt ) end self.earnings = 0 for i, vert in ipairs( self.map.graph.vertices ) do local rate = vert:get_rate() self.earnings = self.earnings + rate local delta = self.time:get_delta() self.bank.total = self.bank.total + rate * delta end if self.lmb.click then if self.mode == 'menu' then -- this happens if we click outside of the menu self.menu:close() elseif self.mode == 'build' then self:try_to_make_line( self.lmb.clickx, self.lmb.clicky ) elseif self.mode == 'stats' then local x = self.lmb.clickx local y = self.lmb.clicky local node = self.map.graph:find_vertex( x, y ) if node ~= nil then preview_line:enable( node ) else RisingText:new( "Must start at a hub!", x, y, self.gui_font ) end end end if self.rmb.click then if self.mode == 'menu' then self.menu:close() elseif self.mode == 'build' then preview_line:disable() elseif self.mode == 'stats' then local vert = self.map.graph:find_vertex( self.rmb.clickx, self.rmb.clicky ) if vert == nil then self:try_to_make_node( self.rmb.clickx, self.rmb.clicky ) else vert:try_to_upgrade( self ) end end end -- always reset click status so only active for 1 frame self.lmb.click = false self.rmb.click = false self.mmb.click = false -- update internal clock to push things along self.time:update( dt ) end, draw = function( self, dt ) local mx, my = love.mouse.getPosition() -- draw map img self.map:draw() -- draw all momentary hud text for i, txt in ipairs( RisingText.instances ) do txt:draw() end -- draw date in bottom corner of screen local winw, winh = love.graphics.getDimensions() love.graphics.setColor( 255, 255, 255, 255 ) love.graphics.setFont( self.gui_font_bold ) love.graphics.print( "DATE: " .. self.time:get_date(), winw - 192, winh - 32 ) -- draw the gui buttons for i, but in ipairs( Button.instances ) do but:draw() end -- mode dependent drawing if self.mode == 'build' then -- draw preview line if we are building preview_line:draw( mx, my ) elseif self.mode == 'stats' then -- draw stats menu if hovering over country local cntry = self.map:get_country( mx, my, Country.rgb ) if cntry ~= "None" then Country.instances[cntry]:draw_stats( mx, my, self.gui_font, self.gui_font_bold ) end elseif self.mode == 'menu' then -- draw menu if it is open self.menu:draw() end self.bank:draw( winw / 2, winh-32, self.gui_font_bold ) love.graphics.setFont( self.gui_font ) love.graphics.print( "Earnings: "..tostring(self.earnings), winw / 2, winh-16) love.graphics.setColor( 255, 255, 255, 255 ) love.graphics.setFont( self.gui_font_bold ) love.graphics.print( love.timer.getFPS(), 128, 128 ) end, mousepressed = function( self, x, y, button ) if button == 'l' then self.lmb.down = true elseif button == 'r' then self.rmb.down = true elseif button == 'm' then self.mmb.down = true end end, mousereleased = function( self, x, y, button ) if button == 'l' and self.lmb.down then self.lmb.down = false self.lmb.click = true self.lmb.clickx = x self.lmb.clicky = y elseif button == 'r' and self.rmb.down then self.rmb.click = true self.rmb.down = false self.rmb.clickx = x self.rmb.clicky = y elseif button == 'm' and self.mmb.down then self.mmb.click = true self.mmb.down = false self.mmb.clickx = x self.mmb.clicky = y end end, }
mit
badboyam/telebot
plugins/stats.lua
458
4098
-- Saves the number of messages from a user -- Can check the number of messages with !stats do local NUM_MSG_MAX = 5 local TIME_CHECK = 4 -- seconds local function user_print_name(user) if user.print_name then return user.print_name end local text = '' if user.first_name then text = user.last_name..' ' end if user.lastname then text = text..user.last_name end return text end -- Returns a table with `name` and `msgs` local function get_msgs_user_chat(user_id, chat_id) local user_info = {} local uhash = 'user:'..user_id local user = redis:hgetall(uhash) local um_hash = 'msgs:'..user_id..':'..chat_id user_info.msgs = tonumber(redis:get(um_hash) or 0) user_info.name = user_print_name(user)..' ('..user_id..')' return user_info end local function chat_stats(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = '' for k,user in pairs(users_info) do text = text..user.name..' => '..user.msgs..'\n' end return text end -- Save stats, ban user local function pre_process(msg) -- Ignore service msg if msg.service then print('Service message') return msg end -- Save user on Redis if msg.from.type == 'user' then local hash = 'user:'..msg.from.id print('Saving user', hash) if msg.from.print_name then redis:hset(hash, 'print_name', msg.from.print_name) end if msg.from.first_name then redis:hset(hash, 'first_name', msg.from.first_name) end if msg.from.last_name then redis:hset(hash, 'last_name', msg.from.last_name) end end -- Save stats on Redis if msg.to.type == 'chat' then -- User is on chat local hash = 'chat:'..msg.to.id..':users' redis:sadd(hash, msg.from.id) end -- Total user msgs local hash = 'msgs:'..msg.from.id..':'..msg.to.id redis:incr(hash) -- Check flood if msg.from.type == 'user' then local hash = 'user:'..msg.from.id..':msgs' local msgs = tonumber(redis:get(hash) or 0) if msgs > NUM_MSG_MAX then print('User '..msg.from.id..'is flooding '..msgs) msg = nil end redis:setex(hash, TIME_CHECK, msgs+1) end return msg end local function bot_stats() local redis_scan = [[ local cursor = '0' local count = 0 repeat local r = redis.call("SCAN", cursor, "MATCH", KEYS[1]) cursor = r[1] count = count + #r[2] until cursor == '0' return count]] -- Users local hash = 'msgs:*:'..our_id local r = redis:eval(redis_scan, 1, hash) local text = 'Users: '..r hash = 'chat:*:users' r = redis:eval(redis_scan, 1, hash) text = text..'\nChats: '..r return text end local function run(msg, matches) if matches[1]:lower() == "stats" then if not matches[2] then if msg.to.type == 'chat' then local chat_id = msg.to.id return chat_stats(chat_id) else return 'Stats works only on chats' end end if matches[2] == "bot" then if not is_sudo(msg) then return "Bot stats requires privileged user" else return bot_stats() end end if matches[2] == "chat" then if not is_sudo(msg) then return "This command requires privileged user" else return chat_stats(matches[3]) end end end end return { description = "Plugin to update user stats.", usage = { "!stats: Returns a list of Username [telegram_id]: msg_num", "!stats chat <chat_id>: Show stats for chat_id", "!stats bot: Shows bot stats (sudo users)" }, patterns = { "^!([Ss]tats)$", "^!([Ss]tats) (chat) (%d+)", "^!([Ss]tats) (bot)" }, run = run, pre_process = pre_process } end
gpl-2.0
tbastos/lift
lift/files/cli.lua
1
1534
------------------------------------------------------------------------------ -- Default Command-Line Interface ------------------------------------------------------------------------------ local color = require 'lift.color' local config = require 'lift.config' local diagnostics = require 'lift.diagnostics' local app = ... -- hide options --help and --version app.options.help.hidden = true app.options.version.hidden = true app:flag 'color' :desc('--color=off', 'Disable colorized output') :action(function(option, value) color.set_enabled(value) end) local quiet = app:flag 'quiet' :desc('--quiet', 'Suppress messages (prints warnings and errors)') :action(function(option, value) diagnostics.levels.remark = value and 'ignored' or 'remark' end) app:flag 'silent' :desc('--silent', 'Suppress messages (prints errors)') :action(function(option, value) quiet(value) -- implies -quiet diagnostics.levels.remark = value and 'ignored' or 'remark' end) app:flag 'trace' :desc('--trace', 'Enable debug tracing') :action(function(option, value) diagnostics.set_tracing(value) end) ------------------------------------------------------------------------------ -- If config 'gc' is set, toggle garbage collection ------------------------------------------------------------------------------ local gc = config:get_bool'gc' if gc ~= nil then collectgarbage(gc and 'restart' or 'stop') diagnostics.report('remark: Garbage collection is ${1}', gc and 'enabled' or 'disabled') end
mit
waterlgndx/darkstar
scripts/globals/mobskills/guillotine.lua
2
1035
--------------------------------------------- -- Guillotine -- -- Description: Delivers a four-hit attack. Silences enemy. Duration of effect varies with TP. -- Type: Physical -- Number of hits -- Range: Melee --------------------------------------------- require("scripts/globals/monstertpmoves"); require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/msg"); function onMobSkillCheck(target,mob,skill) mob:messageBasic(dsp.msg.basic.READIES_WS, 0, 689+256); return 0; end; function onMobWeaponSkill(target, mob, skill) local numhits = 4; local accmod = 1; local dmgmod = 1.2; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_SLASH,info.hitslanded); MobStatusEffectMove(mob, target, dsp.effect.SILENCE, 1, 0, (skill:getTP()*30/1000)+30); -- 242 to a NIN, but shadows ate some hits... target:delHP(dmg); return dmg; end;
gpl-3.0
kidaa/darkstar
scripts/zones/Dynamis-Windurst/mobs/Tzee_Xicu_Idol.lua
11
1290
----------------------------------- -- Area: Dynamis Windurst -- NPC: Tzee Xicu Idol ----------------------------------- require("scripts/globals/titles"); require("scripts/globals/dynamis"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) SpawnMob(17543597):updateEnmity(target); -- 122 SpawnMob(17543598):updateEnmity(target); -- 123 SpawnMob(17543599):updateEnmity(target); -- 124 SpawnMob(17543600):updateEnmity(target); -- 125 SpawnMob(17543170):updateEnmity(target); -- Maa Febi the Steadfast SpawnMob(17543171):updateEnmity(target); -- Muu Febi the Steadfast end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) if(alreadyReceived(killer,8) == false) then addDynamisList(killer,128); killer:addTitle(DYNAMISWINDURST_INTERLOPER); -- Add title local npc = GetNPCByID(17543480); -- Spawn ??? npc:setPos(mob:getXPos(),mob:getYPos(),mob:getZPos()); npc:setStatus(0); killer:launchDynamisSecondPart(); -- Spawn dynamis second part end end;
gpl-3.0
davidedmonds/darkstar
scripts/zones/Garlaige_Citadel/npcs/_5kr.lua
17
1534
----------------------------------- -- Area: Garlaige Citadel -- NPC: _5kr (Crematory Hatch) -- Type: Door -- @pos 139 -6 127 200 ----------------------------------- package.loaded["scripts/zones/Garlaige_Citadel/TextIDs"] = nil; ----------------------------------- require("scripts/globals/titles"); require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Garlaige_Citadel/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:hasItemQty(502,1) == true and trade:getItemCount() == 1) then -- Garlaige Key (Not Chest/Coffer) player:startEvent(0x0004); -- Open the door end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local X = player:getXPos(); local Z = player:getZPos(); if ((X >= 135 and X <= 144) and (Z >= 128 and Z <= 135)) then player:startEvent(0x0005); else player:messageSpecial(OPEN_WITH_THE_RIGHT_KEY); return 0; end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
dcos/dcos
packages/adminrouter/extra/src/lib/service.lua
2
13465
local url = require "url" local cjson_safe = require "cjson.safe" local util = require "util" RESOLVE_LIMIT = 10 local function resolve_srv_entry(service_name) -- Try to resolve SRV entry for given framework name using MesosDNS -- -- Arguments: -- service_name (str): name of the framework to resolve -- -- Returns: -- List of records as provided by the MesosDNS API. If the record was not -- found, MesosDNS by default returns "empty" record: -- -- { -- "service": "", -- "host": "", -- "ip": "", -- "port": "", -- } -- -- Such case is/should be handled in the calling function. In case of an -- error, nil is returned. -- local res = ngx.location.capture( "/internal/mesos_dns/v1/services/_" .. service_name .. "._tcp.marathon.mesos") if res.truncated then -- Remote connection dropped prematurely or timed out. ngx.log(ngx.ERR, "Request to Mesos DNS failed.") return nil end if res.status ~= 200 then ngx.log(ngx.ERR, "Mesos DNS response status: " .. res.status) return nil end local records, err = cjson_safe.decode(res.body) if not records then ngx.log(ngx.ERR, "Cannot decode JSON: " .. err) return nil end return records end local function upstream_url_from_srv_query(service_name) -- Create upstream_url basing on the data from MesosDNS SRV entries and -- given service_name -- -- Argument: -- service_name (str): name of the service to build -- -- Returns: -- A list with: -- - upstream_scheme - for now hardcoded to http -- - upstream_url -- - err_code, err_text - if an error occurred these will be HTTP status -- and error text that should be sent to the client. `nil` otherwise local upstream_url = nil local upstream_scheme = 'http' -- Hardcoded in case of MesosDNS local records = resolve_srv_entry(service_name) if records == nil then return nil, nil, ngx.HTTP_SERVICE_UNAVAILABLE, "503 Service Unavailable: MesosDNS request has failed" end if records[1]['ip'] == "" then return nil, nil, nil, nil end local first_ip = records[1]['ip'] local first_port = records[1]['port'] upstream_url = "http://" .. first_ip .. ":" .. first_port return upstream_scheme, upstream_url, nil, nil end local function resolve_via_marathon_apps_state(service_name, marathon_cache) -- Try to resolve upstream for given service name basing on -- Marathon apps DB -- -- Arguments: -- service_name (string): service name that should be resolved -- marathon_cache (table): cached root Marathon's apps state -- -- Returns: -- A list with: -- - true/false depending on whether resolving service name was successful -- or not, `nil` if there was an error. -- - err_code, err_text - if an error occurred these will be HTTP status -- and error text that should be sent to the client. `nil` otherwise if marathon_cache == nil then return nil, ngx.HTTP_SERVICE_UNAVAILABLE, "503 Service Unavailable: invalid Marathon svcapps cache" end if marathon_cache[service_name] == nil then return false, nil, nil end ngx.log(ngx.NOTICE, "Resolved via Marathon, service id: `".. service_name .. "`") ngx.var.upstream_url = marathon_cache[service_name]["url"] ngx.var.upstream_scheme = marathon_cache[service_name]["scheme"] return true, nil, nil end local function req_url_rewriting_required(service_name, marathon_cache) -- Determine if the upstream request should contain the -- `/service/<service_name>` part of the URL path or not. -- -- Arguments: -- service_name (string): service name that should be resolved -- marathon_cache (table): cached root Marathon's apps state -- -- Returns: -- A list with: -- - true/false depending on whether req_url rewriting is enabled or not, -- `nil` if there was an error -- - err_code, err_text - if an error occurred these will be HTTP status -- and error text that should be sent to the client. `nil` otherwise -- if service_name == 'marathon' or service_name == 'metronome' then -- These two services should always have the request URL rewriting -- enabled, no matter the marathon_cache, as they are resolved via Mesos -- anyway. return true, nil, nil end if marathon_cache[service_name] == nil then -- By default we always rewrite for Mesos Frameworks return true, nil, nil end return marathon_cache[service_name]['do_rewrite_req_url'], nil, nil end local function request_buffering_required(service_name, marathon_cache) -- Determine if the request buffering should be enabled for this request -- -- Arguments: -- service_name (string): service name that should be resolved -- marathon_cache (table): cached root Marathon's apps state -- -- Returns: -- true/false depending on whether req_url rewriting is enabled or not -- if service_name == 'marathon' or service_name == 'metronome' then -- These two services should always have the request buffering -- enabled, no matter the marathon_cache, as they are resolved via Mesos -- anyway. return true end if marathon_cache[service_name] == nil then -- By default we always cache for mesos frameworks return true end return marathon_cache[service_name]['do_request_buffering'] end local function resolve_via_mesos_dns(service_name) -- Try to resolve upstream for given service name basing on -- MesosDNS SRV entries -- -- Arguments: -- service_name (string): service name that should be resolved -- -- Returns: -- A list with: -- - true/false depending on whether resolving service name was successful -- or not, `nil` if there was an error. -- - err_code, err_text - if an error occurred these will be HTTP status -- and error text that should be sent to the client. `nil` otherwise local upstream_scheme, upstream_url, err_code, err_text = upstream_url_from_srv_query( service_name) if err_code ~= nil then return nil, err_code, err_text end if upstream_url == nil then return false, nil, nil end ngx.log(ngx.NOTICE, "Resolved via MesosDNS, service id: `".. service_name .. "`") ngx.var.upstream_scheme = upstream_scheme ngx.var.upstream_url = upstream_url return true, nil, nil end local function resolve_via_mesos_state(service_name, mesos_cache) -- Try to resolve upstream for given service name basing on -- Mesos state-summary endpoint data. -- -- In case when framework is registered, but relevant data is unavailable, -- MesosDNS SRV entries are used. -- -- Arguments: -- service_name (string): service name that should be resolved -- mesos_cache (table): cached Mesos's apps state -- -- Returns: -- A list with: -- - true/false depending on whether resolving service name was successful -- or not, `nil` if there was an error. -- - err_code, err_text - if an error occurred these will be HTTP status -- and error text that should be sent to the client. `nil` otherwise local webui_url = nil local service_name_bymesos = nil if mesos_cache == nil then return nil, ngx.HTTP_SERVICE_UNAVAILABLE, "503 Service Unavailable: invalid Mesos state cache" end -- Even though frameworks will be resolved much more often using their name -- than ID, we cannot optimize this and change the order as we may break -- services/software relying on that. if mesos_cache['f_by_id'][service_name] ~= nil then webui_url = mesos_cache['f_by_id'][service_name]['webui_url'] -- This effectively resolves framework ID into human-friendly service -- name. service_name = mesos_cache['f_by_id'][service_name]['name'] elseif mesos_cache['f_by_name'][service_name] ~= nil then webui_url = mesos_cache['f_by_name'][service_name]['webui_url'] end if webui_url == nil then return false, nil, nil end if webui_url == "" then return resolve_via_mesos_dns(service_name) end local parsed_webui_url = url.parse(webui_url) if parsed_webui_url.path == "/" then parsed_webui_url.path = "" end ngx.log(ngx.NOTICE, "Resolved via Mesos state-summary, service id: `".. service_name .. "`") ngx.var.upstream_url = parsed_webui_url:build() ngx.var.upstream_scheme = parsed_webui_url.scheme return true, nil, nil end local function resolve(service_name, mesos_cache, marathon_cache) -- Resolve given service name using DC/OS cluster data. -- -- Arguments: -- service_name (string): service name that should be resolved -- marathon_cache (table): cached root Marathon's apps state -- mesos_cache (table): cached Mesos's apps state -- -- Returns: -- A list with: -- - true/false depending on whether resolving service name was successful -- or not, `nil` if there was an error. -- - err_code, err_text - if an error occurred these will be HTTP status -- and error text that should be sent to the client. `nil` otherwise ngx.log(ngx.DEBUG, "Trying to resolve service name `".. service_name .. "`") local res = false local err_code local err_text -- `marathon` and `metronome` service names belong to the Root Marathon and -- Root Metronome respectively. They will never be present in Root -- Marathon's tasks list hence we skip the search. This improves the -- reliability a bit as the failure of the local Root Marathon/Root -- Metronome does not prevent `/service` endpoint to route to the healthy -- leader running on some other hosts (provided that there is a leader). if service_name ~= 'marathon' and service_name ~= 'metronome' then res, err_code, err_text = resolve_via_marathon_apps_state( service_name, marathon_cache) if err_code ~= nil then return nil, err_code, err_text end end if res == false then res, err_code, err_text = resolve_via_mesos_state( service_name, mesos_cache) end return res, err_code, err_text end local function recursive_resolve(auth, path, marathon_cache, mesos_cache) -- Resolve given service path using DC/OS cluster data. -- -- This function tries to determine the service name component of the path -- used to query `/service` endpoint and resolve it to correct upstream. -- -- Arguments: -- auth: auth module, already in an initialised state -- path (string): service path that should be resolved -- marathon_cache (table): cached root Marathon's apps state -- mesos_cache (table): cached Mesos's apps state -- -- Returns: -- Apart from setting some Nginx variables directly, it returns the -- resolved service name for the given URL. local resolved = false local more_segments = true local service_realpath = "" local do_req_url_rewriting = true local do_request_buffering = true local err_code = nil local err_text = nil local service_name = "" -- Resolve all the services! for i = 1, RESOLVE_LIMIT do if err_code ~= nil or resolved or not more_segments then break end service_name, service_realpath, more_segments = util.extract_service_path_component( path, i) resolved, err_code, err_text = resolve( service_name, mesos_cache, marathon_cache) end if resolved == false or err_code ~= nil then -- First, let's make sure that user has correct permissions to see -- error messages: auth.access_service_endpoint(nil) if err_code ~= nil then -- Send the error message to the user: ngx.status = err_code ngx.say(err_text) return ngx.exit(err_code) end ngx.status = ngx.HTTP_NOT_FOUND ngx.say("404 Not Found: service not found.") return ngx.exit(ngx.HTTP_NOT_FOUND) end -- Authorize the request: auth.access_service_endpoint(service_realpath) -- Trim the URI prefix (or not): do_req_url_rewriting, err_code, err_text = req_url_rewriting_required(service_name, marathon_cache) if err_code ~= nil then -- Send the error message to the user: ngx.status = err_code ngx.say(err_text) return ngx.exit(err_code) end if do_req_url_rewriting then local prefix = "/service/" .. service_realpath local adjusted_prefix = string.sub(ngx.var.uri, string.len(prefix) + 1) if adjusted_prefix == "" then adjusted_prefix = "/" end ngx.req.set_uri(adjusted_prefix) end -- Will be used for HTTP Redirects' Location header adjustments: ngx.var.service_realpath = service_realpath return service_name end -- Initialise and return the module: local _M = {} function _M.init() local res = {} res.recursive_resolve = recursive_resolve res.request_buffering_required = request_buffering_required return res end return _M
apache-2.0
kidaa/darkstar
scripts/zones/Lower_Jeuno/npcs/Ruslan.lua
37
2004
----------------------------------- -- Area: Lower Jeuno -- NPC: Ruslan -- Involved In Quest: Wondering Minstrel -- Working 100% -- @zone = 245 -- @pos = -19 -1 -58 ----------------------------------- package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/zones/Lower_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) wonderingstatus = player:getQuestStatus(WINDURST,WONDERING_MINSTREL); if (wonderingstatus == QUEST_ACCEPTED) then prog = player:getVar("QuestWonderingMin_var") if (prog == 0) then -- WONDERING_MINSTREL + Rosewood Lumber: During Quest / Progression player:startEvent(0x2719,0,718); player:setVar("QuestWonderingMin_var",1); elseif (prog == 1) then -- WONDERING_MINSTREL + Rosewood Lumber: Quest Objective Reminder player:startEvent(0x271a,0,718); end elseif (wonderingstatus == QUEST_COMPLETED) then rand = math.random(3); if (rand == 1) then player:startEvent(0x271b); -- WONDERING_MINSTREL: After Quest else player:startEvent(0x2718); -- Standard Conversation end else player:startEvent(0x2718); -- Standard Conversation end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
will4wachter/Project1
scripts/zones/Southern_San_dOria_[S]/npcs/Crochepallade.lua
36
1043
----------------------------------- -- Area: Southern SandOria [S] -- NPC: Crochepallade -- Name is Moogle for some reason -- @zone 80 -- @pos -46 2 -8 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria_[S]/TextIDs"] = nil; require("scripts/zones/Southern_San_dOria_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0149); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
waterlgndx/darkstar
scripts/zones/Bastok_Mines/npcs/Zemedars.lua
2
1304
----------------------------------- -- Area: Bastok Mines -- NPC: Zemedars -- Standard Merchant NPC ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Bastok_Mines/TextIDs") require("scripts/globals/shop") function onTrade(player,npc,trade) end function onTrigger(player,npc) local stock = { 12836, 23316, 1, --Iron Subligar 12825, 5003, 1, --Lizard Trousers 12962, 14484, 1, --Leggins 12953, 3162, 1, --Lizard Ledelsens 12301, 31544, 1, --Buckler 12833, 1840, 2, --Brass Subligar 12824, 493, 2, --Leather Trousers 12961, 1140, 2, --Brass Leggins 12952, 309, 2, --Leather Highboots 12300, 11076, 2, --Targe 12832, 191, 3, --Bronze Subligar 12808, 11592, 3, --Chain Gose 12960, 117, 3, --Bronze Leggins 12936, 7120, 3, --Greaves 12290, 556, 3, --Maple Shield 12289, 110, 3, --Lauan Shield } player:showText(npc, ZEMEDARS_SHOP_DIALOG) dsp.shop.nation(player, stock, dsp.nation.BASTOK) end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) end
gpl-3.0
kidaa/darkstar
scripts/globals/spells/deodorize.lua
24
1128
----------------------------------------- -- Spell: Deodorize -- Lessens chance of being detected by smell. -- Duration is random number between 30 seconds and 5 minutes ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) if (target:hasStatusEffect(EFFECT_DEODORIZE) == false) then local duration = math.random(30, 300); if (caster:hasStatusEffect(EFFECT_COMPOSURE) == true and caster:getID() == target:getID()) then duration = duration * 3; end if (target:getMainLvl() < 15) then duration = duration * target:getMainLvl() / 15; -- level adjustment end spell:setMsg(230); target:addStatusEffect(EFFECT_DEODORIZE,0,10,(math.floor(duration) * SNEAK_INVIS_DURATION_MULTIPLIER)); else spell:setMsg(75); -- no effect. end return EFFECT_DEODORIZE; end;
gpl-3.0
MonokuroInzanaito/ygopro-777DIY
expansions/script/c80101019.lua
1
3618
--刀术-花 function c80101019.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(80101019,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,80101019+EFFECT_COUNT_CODE_OATH) e1:SetCost(c80101019.cost1) e1:SetTarget(c80101019.target1) e1:SetOperation(c80101019.activate1) c:RegisterEffect(e1) --negate activate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(80101019,1)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_HAND) e2:SetCode(EVENT_CHAINING) e2:SetCountLimit(1,80101019) e2:SetCondition(c80101019.condition) e2:SetCost(c80101019.cost) e2:SetTarget(c80101019.target) e2:SetOperation(c80101019.operation) c:RegisterEffect(e2) end function c80101019.sdfilter(c) return c:IsFaceup() and c:IsSetCard(0x5400) and c:IsType(TYPE_SYNCHRO) end function c80101019.condition(e,tp,eg,ep,ev,re,r,rp,chk) return rp~=tp and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ev) and Duel.IsExistingMatchingCard(c80101019.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function c80101019.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable() end Duel.SendtoGrave(e:GetHandler(),REASON_COST+REASON_DISCARD) end function c80101019.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsPlayerCanDraw(1-tp,1) end end function c80101019.operation(e,tp,eg,ep,ev,re,r,rp) local g=Group.CreateGroup() Duel.ChangeTargetCard(ev,g) Duel.ChangeChainOperation(ev,c80101019.repop) end function c80101019.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Draw(tp,1,REASON_EFFECT) Duel.Draw(1-tp,1,REASON_EFFECT) end function c80101019.cost1(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function c80101019.rfilter(c,e,tp) return c:IsSetCard(0x5400) and Duel.IsExistingTarget(c80101019.spfilter,tp,LOCATION_DECK,0,1,nil,c:GetCode(),e,tp) end function c80101019.spfilter(c,code,e,tp) return c:IsSetCard(0x5400) and c:GetCode()~=code and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c80101019.target1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=1 then return false end e:SetLabel(0) return Duel.CheckReleaseGroup(tp,c80101019.rfilter,1,nil,e,tp) end local g=Duel.SelectReleaseGroup(tp,c80101019.rfilter,1,1,nil,e,tp) local code=g:GetFirst():GetCode() e:SetLabel(code) Duel.Release(g,REASON_COST) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,0,LOCATION_ONFIELD) end function c80101019.activate1(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local code=e:GetLabel() local c=e:GetHandler() local tc=Duel.GetFirstTarget() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c80101019.spfilter,tp,LOCATION_DECK,0,1,1,nil,code,e,tp) local sc=g:GetFirst() local rg=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_MZONE,e:GetHandler()) if sc and rg:GetCount()>0 and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)~=0 and Duel.SelectYesNo(tp,aux.Stringid(47222536,1)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local srg=rg:Select(tp,1,1,nil) Duel.Remove(srg,POS_FACEUP,REASON_EFFECT) end end
gpl-3.0
lhog/Zero-K
lups/ParticleClasses/UnitSmoke.lua
8
7800
-- $Id: UnitSmoke.lua 3171 2008-11-06 09:06:29Z det $ ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- local UnitSmoke = {} UnitSmoke.__index = UnitSmoke local UnitSmokeShader local widthLoc, timeLoc, headingLoc local trailDirsUniform = {} ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- function UnitSmoke.GetInfo() return { name = "UnitSmoke", backup = "", --// backup class, if this class doesn't work (old cards,ati's,etc.) desc = "", layer = 1, --// extreme simply z-ordering :x --// gfx requirement fbo = false, shader = true, rtt = false, ctt = false, } end UnitSmoke.Default = { layer = 1, life = math.huge, pos = {0,0,0}, size = 20, width = 5, quads = 10, --//max 16 repeatEffect = false, dieGameFrame = math.huge } ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- local glUniform = gl.Uniform local glUseShader = gl.UseShader ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- function UnitSmoke:BeginDraw() glUseShader(UnitSmokeShader) glUniform(timeLoc, thisGameFrame * 0.01 ) gl.Texture(1,"bitmaps/GPL/Lups/mynoise.png") gl.Texture(0,":c:bitmaps/GPL/Lups/smoketrail.png") --gl.Texture(0,":c:bitmaps/GPL/Lups/flametrail.png") --gl.Texture(0,":c:bitmaps/GPL/Lups/firetrail.png") --gl.Texture(false) --gl.Blending(GL.SRC_ALPHA,GL.ONE) local modelview = {gl.GetMatrixData("camera")} gl.MatrixMode(GL.TEXTURE) gl.PushMatrix() gl.LoadMatrix(modelview) --//FIXME: gl.MultMatrix("camera") gl.MatrixMode(GL.MODELVIEW) gl.PushMatrix() gl.LoadIdentity() --gl.PolygonMode(GL.FRONT_AND_BACK, GL.LINE) end function UnitSmoke:EndDraw() glUseShader(0) --gl.Blending(GL.SRC_ALPHA, GL.ONE_MINUS_SRC_ALPHA) gl.Texture(0,false) gl.Texture(1,false) gl.MatrixMode(GL.TEXTURE) gl.PopMatrix() gl.MatrixMode(GL.MODELVIEW) gl.PopMatrix() gl.PolygonMode(GL.FRONT_AND_BACK, GL.FILL) end function UnitSmoke:Draw() local pos = self.pos glUniform(widthLoc, self.width ) glUniform(headingLoc, Spring.GetUnitHeading(self.unit)/32000 ); local quads = self.quads-1 --// "-1" cause glsl is 0-indexed and lua 1-indexed for i=1,quads+1 do local dir = self.trailDirs[i] glUniform( trailDirsUniform[i] , dir[1], dir[2] + self.size*(i-1)/quads , dir[3] ) end gl.PushMatrix() gl.Translate(pos[1],pos[2],pos[3]) gl.BeginEnd(GL.QUADS,function() for i=0,quads-1 do --local tex_t = 1 - self.trailTexCoords[i] / self.totalLength --local tex_t_next = 1 - self.trailTexCoords[i+1] / self.totalLength local tex_t = 1 - i/quads local tex_t_next = 1 - (i+1)/quads gl.TexCoord(-1,tex_t_next,0,i+1) gl.Vertex(0,0,0) gl.TexCoord(1,tex_t_next,1,i+1) gl.Vertex(0,0,0) gl.TexCoord(1,tex_t,1,i) gl.Vertex(0,0,0) gl.TexCoord(-1,tex_t,0,i) gl.Vertex(0,0,0) end end) gl.PopMatrix() end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- function UnitSmoke.Initialize() UnitSmokeShader = gl.CreateShader({ vertex = [[ uniform float width; uniform float time; uniform float heading; uniform vec3 traildirs[16]; void main() { vec3 updir,right; gl_Position = (gl_ModelViewMatrix * gl_Vertex); updir = traildirs[int(gl_MultiTexCoord0.w)]; gl_Position.xyz += updir; //gl_TexCoord[0].pq = updir.xy*vec2(0.1) + vec2(heading, -time*3.0); gl_Position = gl_TextureMatrix[0] * gl_Position; updir = ( gl_TextureMatrix[0] * vec4(updir,0.0) ).xyz - gl_Position.xyz; right = normalize( cross(updir,gl_Position.xyz) ); //gl_Position.x += gl_MultiTexCoord0.x * size * 0.35; gl_Position.xyz += right * gl_MultiTexCoord0.x * width; gl_Position = gl_ProjectionMatrix * gl_Position; //gl_FrontColor = vec4(1.0,1.0,1.0,1.0); gl_TexCoord[0].st = gl_MultiTexCoord0.pt; //gl_TexCoord[0].st = gl_Position.xy; gl_TexCoord[0].pq = gl_TexCoord[0].st + vec2(heading, time*3.0); } ]], fragment = [[ uniform sampler2D SmokeTex; uniform sampler2D noiseMap; void main() { vec4 noise = texture2D(noiseMap, gl_TexCoord[0].pq*0.8); //vec4(0.0); gl_FragColor = texture2D(SmokeTex, gl_TexCoord[0].st + vec2( (noise.r-0.5) ,0.0) ); //gl_FragColor.a *= (gl_FragColor.r+gl_FragColor.g+gl_FragColor.b)*0.333; gl_FragColor.a *= 0.9; } ]], uniformInt={ SmokeTex = 0, noiseMap = 1, }, }) if (UnitSmokeShader == nil) then print(PRIO_MAJOR,"LUPS->UnitSmoke: critical shader error: "..gl.GetShaderLog()) return false end widthLoc = gl.GetUniformLocation(UnitSmokeShader, 'width') timeLoc = gl.GetUniformLocation(UnitSmokeShader, 'time') headingLoc = gl.GetUniformLocation(UnitSmokeShader, 'heading') for i=1,16 do trailDirsUniform[i] = gl.GetUniformLocation(UnitSmokeShader,"traildirs["..(i-1).."]") end end function UnitSmoke.Finalize() if (gl.DeleteShader) then gl.DeleteShader(UnitSmokeShader) end end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- function UnitSmoke:Update() local vel = {Spring.GetUnitVelocity(self.unit)} vel = Vmul( -1 , vel ) local x,y,z = Spring.GetWind() local wind = Vmul( 0.125 , {z,y,-x} ) self.trailDirs[2] = Vadd( Vadd(vel,wind), {0,2,0}) for i=self.quads,3,-1 do self.trailDirs[i] = Vadd( self.trailDirs[i-1], Vadd(vel,wind) ) end --[[ local tlength = 0 for i=1,16 do tlength = tlength + Vlength( self.trailDirs[i] ) self.trailTexCoords[i] = tlength end self.totalLength = tlength --]] end -- used if repeatEffect=true; function UnitSmoke:ReInitialize() self.dieGameFrame = self.dieGameFrame + self.life end function UnitSmoke:CreateParticle() --[[ self.trailTexCoords = { [0] = 0 } self.totalLength = 0 --]] if (self.quads>16) then self.quads=16 elseif (self.quads<5) then self.quads=5 end self.trailDirs = {} for i=1,self.quads do self.trailDirs[i] = {0,0.05,0} end self.startGameFrame = thisGameFrame self.dieGameFrame = self.startGameFrame + self.life end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- local MergeTable = MergeTable local setmetatable = setmetatable function UnitSmoke.Create(Options) local newObject = MergeTable(Options, UnitSmoke.Default) setmetatable(newObject,UnitSmoke) -- make handle lookup newObject:CreateParticle() return newObject end function UnitSmoke:Destroy() end ----------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------------------------------- return UnitSmoke
gpl-2.0
eriche2016/nn
SpatialClassNLLCriterion.lua
1
2400
local THNN = require 'nn.THNN' local SpatialClassNLLCriterion, parent = torch.class('nn.SpatialClassNLLCriterion', 'nn.Criterion') function SpatialClassNLLCriterion:__init(weights, sizeAverage) parent.__init(self) if sizeAverage ~= nil then self.sizeAverage = sizeAverage else self.sizeAverage = true end if weights then assert(weights:dim() == 1, "weights input should be 1-D Tensor") self.weights = weights end self.output_tensor = torch.zeros(1) self.total_weight_tensor = torch.ones(1) self.target = torch.zeros(1):long() end function SpatialClassNLLCriterion:__len() if (self.weights) then return #self.weights else return 0 end end function SpatialClassNLLCriterion:updateOutput(input, target) if type(target) == 'number' then if input:type() == 'torch.CudaTensor' then self.target = torch.CudaLongTensor and self.target:cudaLong() or self.target:cuda() else self.target = self.target:long() end self.target[1] = target elseif input:type() == 'torch.CudaTensor' then self.target = torch.CudaLongTensor and target:cudaLong() or target else self.target = target:long() end input.THNN.SpatialClassNLLCriterion_updateOutput( input:cdata(), self.target:cdata(), self.output_tensor:cdata(), self.sizeAverage, THNN.optionalTensor(self.weights), self.total_weight_tensor:cdata() ) self.output = self.output_tensor[1] return self.output, self.total_weight_tensor[1] end function SpatialClassNLLCriterion:updateGradInput(input, target) if type(target) == 'number' then if input:type() == 'torch.CudaTensor' then self.target = torch.CudaLongTensor and self.target:cudaLong() or self.target:cuda() else self.target = self.target:long() end self.target[1] = target elseif input:type() == 'torch.CudaTensor' then self.target = torch.CudaLongTensor and target:cudaLong() or target else self.target = target:long() end self.gradInput:resizeAs(input):zero() input.THNN.SpatialClassNLLCriterion_updateGradInput( input:cdata(), self.target:cdata(), self.gradInput:cdata(), self.sizeAverage, THNN.optionalTensor(self.weights), self.total_weight_tensor:cdata() ) return self.gradInput end
bsd-3-clause
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Tasks/ActDragonBoatFestival/ActDragonBoatFestival.lua
1
1713
--[[ Title: Act Dragon Boat Festival Author(s): big Date: 2021.6.8 Desc: action page for dragon boat festival Use Lib: ------------------------------------------------------- local ActDragonBoatFestival = NPL.load("(gl)script/apps/Aries/Creator/Game/Tasks/ActDragonBoatFestival/ActDragonBoatFestival.lua"); ActDragonBoatFestival:Init(); --]] local ActDragonBoatFestival = NPL.export() ActDragonBoatFestival.data = {}; function ActDragonBoatFestival:Init() self:GetData(function(data, err) if (type(data) == "table") then self.data = data; self:Show(); end end); end function ActDragonBoatFestival:Show() System.App.Commands.Call("File.MCMLWindowFrame", { url = "script/apps/Aries/Creator/Game/Tasks/ActDragonBoatFestival/ActDragonBoatFestival.html", name = "Tasks.ActDragonBoatFestival", isShowTitleBar = false, DestroyOnClose = true, style = CommonCtrl.WindowFrame.ContainerStyle, zorder = 0, allowDrag = false, bShow = nil, directPosition = true, align = "_ct", x = -912 / 2, y = -546 / 2, width = 912, height = 546, cancelShowAnimation = true, bToggleShowHide = true, }); end function ActDragonBoatFestival:GetData(callback) GameLogic.GetFilters():apply_filters("api.keepwork.dragon_boat.process", callback); end function ActDragonBoatFestival:SetRice(callback) GameLogic.GetFilters():apply_filters("api.keepwork.dragon_boat.rice", callback); end function ActDragonBoatFestival:GetGifts(step, callback) GameLogic.GetFilters():apply_filters("api.keepwork.dragon_boat.gifts", step, callback, callback); end
gpl-2.0
pakoito/ToME---t-engine4
game/modules/tome/dialogs/ShowStore.lua
2
10093
-- TE4 - T-Engine 4 -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org require "engine.class" local Dialog = require "engine.ui.Dialog" local Inventory = require "engine.ui.Inventory" local Separator = require "engine.ui.Separator" local Map = require "engine.Map" module(..., package.seeall, class.inherit(Dialog)) function _M:init(title, store_inven, actor_inven, store_filter, actor_filter, action, desc, descprice, allow_sell, allow_buy, on_select, store_actor, actor_actor) self.on_select = on_select self.allow_sell, self.allow_buy = allow_sell, allow_buy self.action = action self.desc = desc self.descprice = descprice self.store_inven = store_inven self.actor_inven = actor_inven self.store_filter = store_filter self.actor_filter = actor_filter self.actor_actor = actor_actor self.base_title = title or "Store" Dialog.init(self, self:getStoreTitle(), game.w * 0.8, game.h * 0.8) if store_actor.faction then local i = Map.tiles:loadImage("faction/"..store_actor.faction..".png") if i then self.faction_image = {i:glTexture()} end end self.c_inven = Inventory.new{actor=actor_actor, inven=actor_inven, filter=actor_filter, width=math.floor(self.iw / 2 - 10), height=self.ih - 10, columns={ {name="", width={20,"fixed"}, display_prop="char", sort="id"}, {name="", width={24,"fixed"}, display_prop="object", direct_draw=function(item, x, y) item.object:toScreen(nil, x+4, y, 16, 16) end}, {name="Inventory", width=80, display_prop="name", sort="name"}, {name="Category", width=20, display_prop="cat", sort="cat"}, {name="Price", width={70,"fixed"}, display_prop=function(item) return self.descprice("sell", item.object) end, sort=function(a, b) return descprice("sell", a.object) < descprice("sell", b.object) end}, }, fct=function(item, sel, button, event) self:use(item, button, event) end, select=function(item, sel) self:select(item) end, select_tab=function(item) self:select(item) end, on_drag=function(item) self:onDrag(item, "store-sell") end, on_drag_end=function() self:onDragTakeoff("store-buy") end, } local direct_draw= function(item, x, y, w, h, total_w, total_h, loffset_x, loffset_y, dest_area) -- if there is object and is withing visible bounds if core.display.FBOActive() and item.object and total_h + h > loffset_y and total_h < loffset_y + dest_area.h then local clip_y_start, clip_y_end = 0, 0 -- if it started before visible area then compute its top clip if total_h < loffset_y then clip_y_start = loffset_y - total_h end -- if it ended after visible area then compute its bottom clip if total_h + h > loffset_y + dest_area.h then clip_y_end = total_h + h - loffset_y - dest_area.h end -- get entity texture with everything it has i.e particles local texture = item.object:getEntityFinalTexture(nil, h, h) local one_by_tex_h = 1 / h texture:toScreenPrecise(x, y, h, h - clip_y_start - clip_y_end, 0, 1, clip_y_start * one_by_tex_h, (h - clip_y_end) * one_by_tex_h) return h, h, 0, 0, clip_y_start, clip_y_end end return 0, 0, 0, 0, 0, 0 end self.c_store = Inventory.new{actor=store_actor, inven=store_inven, filter=store_filter, width=math.floor(self.iw / 2 - 10), height=self.ih - 10, tabslist=false, columns={ {name="", width={20,"fixed"}, display_prop="char", sort="id"}, {name="", width={24,"fixed"}, display_prop="object", direct_draw=direct_draw}, {name="Store", width=80, display_prop="name"}, {name="Category", width=20, display_prop="cat"}, {name="Price", width={70,"fixed"}, display_prop=function(item) return self.descprice("buy", item.object) end, sort=function(a, b) return descprice("buy", a.object) < descprice("buy", b.object) end}, }, fct=function(item, sel, button, event) self:use(item, button, event) end, select=function(item, sel) self:select(item) end, on_drag=function(item) self:onDrag(item, "store-buy") end, on_drag_end=function() self:onDragTakeoff("store-sell") end, } self:loadUI{ {left=0, top=0, ui=self.c_store}, {right=0, top=0, ui=self.c_inven}, {hcenter=0, top=5, ui=Separator.new{dir="horizontal", size=self.ih - 10}}, } self.c_inven.c_inven.on_focus_change = function(ui_self, status) if status == true then self:select(ui_self.list[ui_self.sel]) end end self.c_store.c_inven.on_focus_change = function(ui_self, status) if status == true then self:select(ui_self.list[ui_self.sel]) end end self:setFocus(self.c_inven) self:setupUI() self.key:addCommands{ __TEXTINPUT = function(c) if self.focus_ui and self.focus_ui.ui == self.c_store then self.c_store:keyTrigger(c) elseif self.focus_ui and self.focus_ui.ui == self.c_inven then self.c_inven:keyTrigger(c) end end, } self.key:addCommands{ [{"_TAB","shift"}] = function() self:moveFocus(1) end, } self.key:addBinds{ EXIT = function() if self.c_inven.c_inven.scrollbar then self.actor_actor.inv_scroll = self.c_inven.c_inven.scrollbar.pos or 0 end if self.c_store.c_inven.scrollbar then self.actor_actor.store_scroll = self.c_store.c_inven.scrollbar.pos or 0 end game:unregisterDialog(self) end, } -- Add tooltips self.on_select = function(item) if item.last_display_x and item.object then local x = nil if self.focus_ui and self.focus_ui.ui == self.c_store then x = self.c_store._last_ox + self.c_store.w elseif self.focus_ui and self.focus_ui.ui == self.c_inven then x = self.c_inven._last_ox - game.tooltip.max end game:tooltipDisplayAtMap(x or item.last_display_x, item.last_display_y, item.object:getDesc({do_color=true}, game.player:getInven(item.object:wornInven()))) elseif item.last_display_x and item.data and item.data.desc then game:tooltipDisplayAtMap(item.last_display_x, item.last_display_y, item.data.desc, {up=true}) end end self.key.any_key = function(sym) -- Control resets the tooltip if sym == self.key._LCTRL or sym == self.key._RCTRL then local ctrl = core.key.modState("ctrl") if self.prev_ctrl ~= ctrl then self:select(self.cur_item, true) end self.prev_ctrl = ctrl end end if self.actor_actor.inv_scroll and self.c_inven.c_inven.scrollbar then self.c_inven.c_inven.scrollbar.pos = util.bound(self.actor_actor.inv_scroll, 0, self.c_inven.c_inven.scrollbar.max or 0) end if self.actor_actor.store_scroll and self.c_store.c_inven.scrollbar then self.c_store.c_inven.scrollbar.pos = util.bound(self.actor_actor.store_scroll, 0, self.c_store.c_inven.scrollbar.max or 0) end end function _M:on_register() game:onTickEnd(function() self.key:unicodeInput(true) end) end function _M:getStoreTitle() return self.base_title..(" (Gold available: %0.2f)"):format(self.actor_actor.money) end function _M:updateStore() self:generateList() self:updateTitle(self:getStoreTitle()) if self.actor_actor.inv_scroll and self.c_inven.c_inven.scrollbar then self.c_inven.c_inven.scrollbar.pos = util.bound(self.actor_actor.inv_scroll, 0, self.c_inven.c_inven.scrollbar.max or 0) end if self.actor_actor.store_scroll and self.c_store.c_inven.scrollbar then self.c_store.c_inven.scrollbar.pos = util.bound(self.actor_actor.store_scroll, 0, self.c_store.c_inven.scrollbar.max or 0) end end function _M:select(item, force) if self.cur_item == item and not force then return end if item then if self.on_select then self.on_select(item) end end self.cur_item = item end function _M:use(item, force) self.actor_actor.inv_scroll = self.c_inven.c_inven.scrollbar and self.c_inven.c_inven.scrollbar.pos or 0 self.actor_actor.store_scroll = self.c_store.c_inven.scrollbar and self.c_store.c_inven.scrollbar.pos or 0 if item and item.object then if self.focus_ui and self.focus_ui.ui == self.c_store then if util.getval(self.allow_buy, item.object, item.item) then self.action("buy", item.object, item.item) end else if util.getval(self.allow_sell, item.object, item.item) then self.action("sell", item.object, item.item) end end end end function _M:generateList() self.c_inven:generateList() self.c_store:generateList() end function _M:onDrag(item, what) if item and item.object then local s = item.object:getEntityFinalSurface(nil, 64, 64) local x, y = core.mouse.get() game.mouse:startDrag(x, y, s, {kind=what, item_idx=item.item, inven=item.inven, object=item.object, id=item.object:getName{no_add_name=true, force_id=true, no_count=true}}, function(drag, used) if not used then local x, y = core.mouse.get() game.mouse:receiveMouse("drag-end", x, y, true, nil, {drag=drag}) end end) end end function _M:onDragTakeoff(what) local drag = game.mouse.dragged.payload if drag.kind == what then if what == "store-buy" then if util.getval(self.allow_buy, drag.object, drag.item_idx) then self.action("buy", drag.object, drag.item_idx) end else if util.getval(self.allow_sell, drag.object, drag.item_idx) then self.action("sell", drag.object, drag.item_idx) end end game.mouse:usedDrag() end end function _M:innerDisplayBack(x, y, nb_keyframes) if not self.faction_image then return end local w, h = self.title_tex.h + 4, self.title_tex.h + 4 local x, y = x + (self.w - self.title_tex.w) / 2 + self.frame.title_x - 5 - w, y + self.frame.title_y self.faction_image[1]:toScreenFull(x, y, w, h, self.faction_image[2] * w / self.faction_image[6], self.faction_image[3] * h / self.faction_image[7]) end
gpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Items/ItemDoor.lua
1
2115
--[[ Title: ItemDoor Author(s): LiXizhi Date: 2014/5/6 Desc: when BlockImage is destroyed, it will generate an ItemDoor whose tooltip contains its filepath. use the lib: ------------------------------------------------------------ NPL.load("(gl)script/apps/Aries/Creator/Game/Items/ItemDoor.lua"); local ItemDoor = commonlib.gettable("MyCompany.Aries.Game.Items.ItemDoor"); local item = ItemDoor:new({icon,}); ------------------------------------------------------- ]] NPL.load("(gl)script/ide/math/vector.lua"); local Player = commonlib.gettable("MyCompany.Aries.Player"); local EntityManager = commonlib.gettable("MyCompany.Aries.Game.EntityManager"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local TaskManager = commonlib.gettable("MyCompany.Aries.Game.TaskManager") local block_types = commonlib.gettable("MyCompany.Aries.Game.block_types") local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") local ItemDoor = commonlib.inherit(commonlib.gettable("MyCompany.Aries.Game.Items.Item"), commonlib.gettable("MyCompany.Aries.Game.Items.ItemDoor")); block_types.RegisterItemClass("ItemDoor", ItemDoor); -- @param template: icon -- @param radius: the half radius of the object. function ItemDoor:ctor() end local door_to_window_map = { [232] = 108, [233] = 109, [230] = 194, [231] = 195, } -- just incase the tooltip contains the image path function ItemDoor:TryCreate(itemStack, entityPlayer, x,y,z, side, data, side_region) if(ItemDoor._super.TryCreate(self, itemStack, entityPlayer, x,y,z, side, data, side_region)) then -- create a window on top of the current block local block_id = BlockEngine:GetBlockId(x,y+1,z) if(not block_id or block_id == 0) then local window_block_id = BlockEngine:GetBlockId(x,y,z); local block_data = BlockEngine:GetBlockData(x,y,z); local block_template = BlockEngine:GetBlock(x,y,z); window_block_id = door_to_window_map[window_block_id or 0]; if(window_block_id and (block_data or 1) <= 4) then BlockEngine:SetBlock(x,y+1,z, window_block_id, block_data, 3); end end return true; end end
gpl-2.0
RyMarq/Zero-K
scripts/athena.lua
2
2651
local fuselage = piece 'fuselage' local head = piece 'head' local wingl = piece 'wingl' local wingr = piece 'wingr' local enginel = piece 'enginel' local enginer = piece 'enginer' local arm = piece 'arm' local lathe = piece 'lathe' local jaw1 = piece 'jaw1' local jaw2 = piece 'jaw2' local nanopoint = piece 'nanopoint' include "constants.lua" include "gunshipConstructionTurnHax.lua" local smokePiece = {fuselage} local nanoPieces = {nanopoint} -- Signal definitions local SIG_MOVE = 1 local SIG_BUILD = 2 local function BuildDecloakThread() Signal(SIG_BUILD) SetSignalMask(SIG_BUILD) while true do GG.PokeDecloakUnit(unitID, 50) Sleep(1000) end end function script.Create() StartThread(GG.Script.SmokeUnit, unitID, smokePiece) Spring.SetUnitNanoPieces(unitID, nanoPieces) end function script.Activate() end function script.Deactivate() end local function StartMoving() Signal(SIG_MOVE) SetSignalMask(SIG_MOVE) Turn(enginel, x_axis, math.rad(10), math.rad(200)) Turn(enginer, x_axis, math.rad(10), math.rad(200)) end local function Stopping() Signal(SIG_MOVE) SetSignalMask(SIG_MOVE) Turn(enginel, x_axis, 0, math.rad(100)) Turn(enginer, x_axis, 0, math.rad(100)) end function script.StartMoving() StartThread(StartMoving) end function script.StopMoving() StartThread(Stopping) end function script.StartBuilding() ConstructionTurnHax() StartThread(BuildDecloakThread) -- For rez. Turn(arm, x_axis, math.rad(-80), math.rad(200)) Turn(lathe, x_axis, math.rad(-80), math.rad(200)) SetUnitValue(COB.INBUILDSTANCE, 1) Turn(jaw1, x_axis, math.rad(-30), math.rad(150)) Turn(jaw2, x_axis, math.rad(30), math.rad(150)) end function script.StopBuilding() Signal(SIG_BUILD) Turn(arm, x_axis, 0, math.rad(200)) Turn(lathe, x_axis, 0, math.rad(200)) SetUnitValue(COB.INBUILDSTANCE, 0) Turn(jaw1, x_axis, 0, math.rad(100)) Turn(jaw2, x_axis, 0, math.rad(100)) end function script.QueryNanoPiece() GG.LUPS.QueryNanoPiece(unitID,unitDefID,Spring.GetUnitTeam(unitID),nanopoint) return nanopoint end function script.Killed(recentDamage, maxHealth) local severity = recentDamage / maxHealth if severity <= 0.25 then return 1 elseif severity <= 0.5 or ((Spring.GetUnitMoveTypeData(unitID).aircraftState or "") == "crashing") then Explode(enginel, SFX.FALL + SFX.FIRE) Explode(enginer, SFX.FALL + SFX.FIRE) return 1 else Explode(fuselage, SFX.FALL) Explode(head, SFX.FALL) Explode(wingl, SFX.FALL) Explode(wingr, SFX.FALL) Explode(enginel, SFX.FALL + SFX.SMOKE + SFX.FIRE) Explode(enginer, SFX.FALL + SFX.SMOKE + SFX.FIRE) Explode(lathe, SFX.FALL + SFX.SMOKE + SFX.FIRE) return 2 end end
gpl-2.0
Laterus/Darkstar-Linux-Fork
scripts/zones/The_Sanctuary_of_ZiTah/Zone.lua
1
2057
----------------------------------- -- -- Zone: The_Sanctuary_of_ZiTah -- ----------------------------------- package.loaded["scripts/globals/quests"] = nil; require("scripts/globals/quests"); require("scripts/globals/settings"); package.loaded["scripts/zones/The_Sanctuary_of_ZiTah/TextIDs"] = nil; require("scripts/zones/The_Sanctuary_of_ZiTah/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) cs = -1; if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == 1 and player:hasItem(1125)) then colors = player:getVar("ICanHearARainbow"); b = (tonumber(colors) % 32 >= 16); v = (tonumber(colors) % 128 >= 64); cs = 0x0002; if (b == false) then player:setVar("ICanHearARainbow_Weather",6); player:setVar("ICanHearARainbow",colors+16); elseif (v == false) then player:setVar("ICanHearARainbow_Weather",14); player:setVar("ICanHearARainbow",colors+64); else cs = -1; end end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,menuchoice) --print("CSID: ",csid); --print("RESULT: ",menuchoice); if (csid == 0x0002) then weather = player:getVar("ICanHearARainbow_Weather"); if (player:getVar("ICanHearARainbow") < 127) then player:updateEvent(0,0,weather); else player:updateEvent(0,0,weather,6); end end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,menuchoice) --print("CSID: ",csid); --print("RESULT: ",menuchoice); if (csid == 0x0002) then player:setVar("ICanHearARainbow_Weather",0); end end;
gpl-3.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Code/NplCad/NplCadDef/NplCadDef_Math.lua
1
6142
--[[ Title: NplCadDef_Math Author(s): leio Date: 2018/9/10 Desc: use the lib: ------------------------------------------------------- NPL.load("(gl)script/apps/Aries/Creator/Game/Code/NplCad/NplCadDef/NplCadDef_Math.lua"); local NplCadDef_Math = commonlib.gettable("MyCompany.Aries.Game.Code.NplCad.NplCadDef_Math"); ------------------------------------------------------- ]] local NplCadDef_Math = commonlib.gettable("MyCompany.Aries.Game.Code.NplCad.NplCadDef_Math"); local cmds = { { type = "math_op", message0 = L"%1 %2 %3", arg0 = { { name = "left", type = "input_value", shadow = { type = "math_number", }, }, { name = "op", type = "field_dropdown", options = { { "+", "+" },{ "-", "-" },{ "*", "*" },{ "/", "/" }, { ">", ">" },{ "<", "<" },{ ">=", ">=" },{ "<=", "<=" },{ "==", "==" },{ "~=", "~=" }, }, }, { name = "right", type = "input_value", shadow = { type = "math_number", }, }, }, output = {type = "field_number",}, category = "Math", helpUrl = "", canRun = false, func_description = '((%s) %s (%s))', func_description_js = '((%s) %s (%s))', ToNPL = function(self) return string.format('(%s) %s (%s)', self:getFieldAsString('left'), self:getFieldAsString('op'), self:getFieldAsString('right')); end, examples = {{desc = L"数字的加减乘除", canRun = true, code = [[ say("1+1=?") wait(1) say(1+1) ]]}}, }, { type = "random", message0 = L"随机选择从%1到%2", arg0 = { { name = "from", type = "input_value", shadow = { type = "math_number", value = 1,}, text = "1", }, { name = "to", type = "input_value", shadow = { type = "math_number", value = 10,}, text = "10", }, }, output = {type = "field_number",}, category = "Math", helpUrl = "", canRun = false, funcName = "math.random", func_description = 'math.random(%s,%s)', func_description_js = 'math.random(%s,%s)', ToNPL = function(self) return string.format('math.random(%s,%s)', self:getFieldAsString('from'), self:getFieldAsString('to')); end, examples = {{desc = "", canRun = true, code = [[ while(true) do say(math.random(1,100)) wait(0.5) end ]]}}, }, { type = "math_compared", message0 = L"%1 %2 %3", arg0 = { { name = "left", type = "input_value", }, { name = "op", type = "field_dropdown", options = { { L"并且", "and" },{ L"或", "or" }, }, }, { name = "right", type = "input_value", }, }, output = {type = "field_number",}, category = "Math", helpUrl = "", canRun = false, func_description = '((%s) %s (%s))', func_description_js = '((%s) %s (%s))', ToNPL = function(self) return string.format('(%s) %s (%s)', self:getFieldAsString('left'), self:getFieldAsString('op'),self:getFieldAsString('right')); end, examples = {{desc = L"同时满足条件", canRun = true, code = [[ while(true) do a = math.random(0,10) if(3<a and a<=6) then say("3<"..a.."<=6") else say(a) end wait(2) end ]]}}, }, { type = "not", message0 = L"不满足%1", arg0 = { { name = "left", type = "input_value", check = "Boolean", }, }, output = {type = "field_number",}, category = "Math", helpUrl = "", canRun = false, func_description = '(not %s)', func_description_js = '(!%s)', ToNPL = function(self) return string.format('(not %s)', self:getFieldAsString('left')); end, examples = {{desc = L"是否不为真", canRun = true, code = [[ while(true) do a = math.random(0,10) if((not (3<=a)) or (not (a>6))) then say("3<"..a.."<=6") else say(a) end wait(2) end ]]}}, }, { type = "mod", message0 = L"%1除以%2的余数", arg0 = { { name = "left", type = "input_value", shadow = { type = "math_number", value = 66,}, text = "66", }, { name = "right", type = "input_value", shadow = { type = "math_number", value = 10,}, text = "10", }, }, output = {type = "field_number",}, category = "Math", helpUrl = "", canRun = false, func_description = '(%s%%s)', func_description_js = '(%s%%s)', ToNPL = function(self) return string.format('(%s%%%s)', self:getFieldAsString('left'), self:getFieldAsString('right')); end, examples = {{desc = "", canRun = true, code = [[ say("66%10=="..(66%10)) ]]}}, }, { type = "round", message0 = L"四舍五入取整%1", arg0 = { { name = "left", type = "input_value", shadow = { type = "math_number", value = 5.5,}, text = 5.5, }, }, output = {type = "field_number",}, category = "Math", helpUrl = "", canRun = false, funcName = "math.floor", func_description = 'math.floor(%s+0.5)', func_description_js = 'Math.floor(%s+0.5)', ToNPL = function(self) return string.format('math.floor(%s+0.5)', self:getFieldAsString('left')); end, examples = {{desc = "", canRun = true, code = [[ while(true) do a = math.random(0,10) / 10 b = math.floor(a+0.5) say(a.."=>"..b) wait(2) end ]]}}, }, { type = "math_oneop", message0 = L"%1%2", arg0 = { { name = "name", type = "field_dropdown", options = { { L"开根号", "sqrt" }, { "sin", "sin"}, { "cos", "cos"}, { L"绝对值", "abs"}, { "asin", "asin"}, { "acos", "acos"}, { L"向上取整", "ceil"}, { L"向下取整", "floor"}, { "tab", "tan"}, { "atan", "atan"}, { "log10", "log10"}, { "exp", "exp"}, }, }, { name = "left", type = "input_value", shadow = { type = "math_number", value = 9,}, text = 9, }, }, output = {type = "field_number",}, category = "Math", helpUrl = "", canRun = false, funcName = "math", func_description = 'math.%s(%s)', func_description_js = 'Math.%s(%s)', ToNPL = function(self) return string.format('math.%s(%s)', self:getFieldAsString('name'), self:getFieldAsString('left')); end, examples = {{desc = "", canRun = true, code = [[ say("math.sqrt(9)=="..math.sqrt(9), 1) say("math.cos(1)=="..math.cos(1), 1) say("math.abs(-1)=="..math.abs(1), 1) ]]}}, }, }; function NplCadDef_Math.GetCmds() return cmds; end
gpl-2.0
Grocel/wire-extras
lua/entities/gmod_wire_dynamicmemory/init.lua
4
2667
/******************************* Dynamic Memory Gate for Wiremod (C) Sebastian J. ********************************/ AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include('shared.lua') ENT.WireDebugName = "DynamicMemoryGate" function ENT:Initialize() self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self.Inputs = Wire_CreateInputs( self, { "Reset" } ) self.Outputs = Wire_CreateOutputs( self, { "Memory" } ) self.Size = 1 self.Memory = {} self.Memory[0] = 0 self.Persistant = false self:SetNWString( "size", "1 Byte" ) self:SetOverlayText( "size", "1 Byte" ) end function ENT:Setup( size ) local size = math.floor( size or self.Size ) local overheap = size - self.Size if ( overheap < 0 ) then for i= size, self.Size -1 do self.Memory[i] = nil end elseif ( overheap > 0 ) then for i = self.Size, size - 1 do self.Memory[i] = 0 end end self.Size = size local sstr = self.Size local sunit = " Byte" if ( sstr > 10000000 ) then sunit = " MByte" sstr = math.floor( sstr / 1048.576 ) / 1000 elseif ( sstr > 10000 ) then sunit = " KByte" sstr = math.floor( sstr / 1.024 ) / 1000 end self:SetNWString( "size", tostring( sstr ) .. sunit ) end function ENT:Think() end function ENT:SetPersistant( val ) self.Persistant = val or self.Persistant end function ENT:TriggerInput( iname, Value ) if (iname == "Reset") then if (Value == 1) then for i=0, self.Size -1 do self.Memory[i] = 0 end end end end function ENT:ReadCell( Address ) if ( Address >= 0 && Address < self.Size ) then return self.Memory[Address] end end function ENT:WriteCell( Address, Value ) if ( Address >= 0 && Address < self.Size ) then self.Memory[Address] = Value or 0 return true end return false end // Adv duplicator stuff function ENT:BuildDupeInfo() local info = self.BaseClass.BuildDupeInfo( self ) or {} info.MemSize = self.Size info.Persistant = self.Persistant if ( self.Persistant ) then info.Memory = {} for i=0,self.Size - 1 do if ( self.Memory[i] ) then info.Memory[i] = self.Memory[i] end end end return info end function ENT:ApplyDupeInfo( ply, ent, info, GetEntByID ) self.BaseClass.ApplyDupeInfo( self, ply, ent, info, GetEntByID ) self:Setup( info.MemSize or 1 ) self.Persistant = info.Persistant if ( info.Persistant ) then info.Memory = info.Memory or {} for i=0,self.Size - 1 do if ( info.Memory[i] ) then self.Memory[i] = info.Memory[i] end end end end
apache-2.0
RyMarq/Zero-K
effects/lasers.lua
7
39350
-- gatorlaserflash -- flash1red2 -- flashlazer -- lasers_sparks1 -- lasers_melt1 -- flash1orange -- comlaserflash -- flash1purple -- lasers_melt3 -- flash1blue -- flash1green -- flash1red -- lasers_melt2 -- lasers_sparksr1 -- flash1yellow -- flash1white -- coregreen return { ["gatorlaserflash"] = { usedefaultexplosions = false, groundflash = { circlealpha = 1, circlegrowth = 1, flashalpha = 0.9, flashsize = 10.5, ttl = 3, color = { [1] = 1, [2] = 0, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT1]], pos = [[0, 0, 0]], }, }, sparkage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_SPARKS1]], pos = [[0, 0, 0]], }, }, }, ["flash1red2"] = { usedefaultexplosions = false, groundflash = { circlealpha = 1, circlegrowth = 1, flashalpha = 0.9, flashsize = 20, ttl = 3, color = { [1] = 1, [2] = 0, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT1]], pos = [[0, 0, 0]], }, }, sparkage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_SPARKSR1]], pos = [[0, 0, 0]], }, }, }, ["flashlazer"] = { usedefaultexplosions = false, groundflash = { circlealpha = 1, circlegrowth = -0.02, flashalpha = 0.4, flashsize = 12, ttl = 120, color = { [1] = 1, [2] = 0.5, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[0,0,1]], dir = [[-1 r2,-1 r2,-1 r2]], length = 7.5, width = 15, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 20, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["lasers_sparks1"] = { sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 20, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 3, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["lasers_melt1"] = { groundflash = { circlealpha = 1, circlegrowth = -0.02, flashalpha = 0.6, flashsize = 3.5, ttl = 40, color = { [1] = 1, [2] = 0.5, [3] = 0, }, }, }, ["flash1orange"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 18, ttl = 3, color = { [1] = 1, [2] = 0.25, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[1,0.25,0]], dir = [[-1 r2,-1 r2,-1 r2]], length = 3, width = 5, lengthGrowth = 0.1, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 40, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["comlaserflash"] = { usedefaultexplosions = false, groundflash = { circlealpha = 1, circlegrowth = 0, flashalpha = 0.9, flashsize = 13, ttl = 3, color = { [1] = 1, [2] = 0, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT1]], pos = [[0, 0, 0]], }, }, pikage = { air = true, class = [[explspike]], count = 15, ground = true, water = true, properties = { alpha = 0.8, alphadecay = 0.2, color = [[1,0,0]], dir = [[-5 r10,-5 r10,-5 r10]], length = 6, width = 2, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 20, particlelife = 7.5, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 3, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash1purple"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 18, ttl = 3, color = { [1] = 0.6, [2] = 0.2, [3] = 0.4, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[0.6, 0.2, 0.41]], dir = [[-1 r2,-1 r2,-1 r2]], length = 5, width = 10, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 40, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["lasers_melt3"] = { groundflash = { circlealpha = 1, circlegrowth = -0.02, flashalpha = 0.6, flashsize = 6, ttl = 80, color = { [1] = 1, [2] = 0.5, [3] = 0, }, }, pikage = { air = true, class = [[explspike]], count = 15, ground = true, water = true, properties = { alpha = 0.8, alphadecay = 0.2, color = [[1,0,0]], dir = [[-5 r10,-5 r10,-5 r10]], length = 6, width = 2, }, }, }, ["flash1blue"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 20, ttl = 3, color = { [1] = 0, [2] = 0, [3] = 1, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[0,0,1]], dir = [[-1 r2,-1 r2,-1 r2]], length = 5, width = 10, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 20, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash1bluedark"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 20, ttl = 3, color = { [1] = 0, [2] = 0, [3] = 1, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[0,0,1]], dir = [[-1 r2,-1 r2,-1 r2]], length = 5, width = 10, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 4, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash1green"] = { usedefaultexplosions = false, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 0.75, alphadecay = 0.075, color = [[0,1,0]], dir = [[-1 r2,-1 r2,-1 r2]], length = 6, width = 10, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 20, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash2purple"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 15, ttl = 3, color = { [1] = 0.6, [2] = 0, [3] = 0.7, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[0.4,0,0.5]], dir = [[-1 r2,-1 r2,-1 r2]], length = 5, width = 10, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 10, particlelife = 10, particlelifespread = 2, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash2purple_large"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 35, ttl = 4, color = { [1] = 0.6, [2] = 0, [3] = 0.7, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 3, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 8, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[0.4,0,0.5]], dir = [[-1 r2,-1 r2,-1 r2]], length = 10, width = 20, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 10, particlelife = 15, particlelifespread = 5, particlesize = 2, particlesizespread = 4.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash2green_large"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 35, ttl = 4, color = { [1] = 0, [2] = 1, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 3, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 8, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[0, 1, 0]], dir = [[-1 r2,-1 r2,-1 r2]], length = 10, width = 20, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 10, particlelife = 15, particlelifespread = 5, particlesize = 2, particlesizespread = 4.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash1red"] = { usedefaultexplosions = false, groundflash = { circlealpha = 1, circlegrowth = 1, flashalpha = 0.9, flashsize = 20, ttl = 3, color = { [1] = 1, [2] = 0, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT1]], pos = [[0, 0, 0]], }, }, pikage = { air = true, class = [[explspike]], count = 15, ground = true, water = true, properties = { alpha = 0.8, alphadecay = 0.2, color = [[1,0,0]], dir = [[-5 r10,-5 r10,-5 r10]], length = 6, width = 2, }, }, sparkage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_SPARKS1]], pos = [[0, 0, 0]], }, }, }, ["lasers_melt2"] = { groundflash = { circlealpha = 1, circlegrowth = -0.02, flashalpha = 0.6, flashsize = 6, ttl = 80, color = { [1] = 1, [2] = 0.5, [3] = 0, }, }, }, ["lasers_sparksr1"] = { sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 5, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 3, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash1yellow"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 18, ttl = 3, color = { [1] = 1, [2] = 1, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 15, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash1white"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 18, ttl = 3, color = { [1] = 1, [2] = 1, [3] = 1, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 15, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["coregreen"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 30, ttl = 5, color = { [1] = 0, [2] = 1, [3] = 0, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, pikage = { air = true, class = [[explspike]], count = 15, ground = true, water = true, properties = { alpha = 0.8, alphadecay = 0.2, color = [[0,1,0]], dir = [[-7 r14,-7 r14,-7 r14]], length = 16, width = 6, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 80, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flash1teal"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 1, flashsize = 18, ttl = 3, color = { [1] = 0.2, [2] = 0.5, [3] = 1, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:LASERS_MELT2]], pos = [[0, 0, 0]], }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 15, particlelife = 15, particlelifespread = 0, particlesize = 1, particlesizespread = 2.5, particlespeed = 6, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["flashslow"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 0.5, flashsize = 25, ttl = 10, color = { [1] = 0.6, [2] = 0, [3] = 0.7, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:SLOW_MELT]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.05, color = [[0.4,0,0.5]], dir = [[-1 r2,-1 r2,-1 r2]], length = 4, width = 8, }, }, sparks = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1.0 0.2 1.0 0.01 0.9 0.3 0.9 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.1, 0]], numparticles = 5, particlelife = 7, particlelifespread = 3, particlesize = 6, particlesizespread = 2.5, particlespeed = 4, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, ["slow_melt"] = { groundflash = { circlealpha = 1, circlegrowth = -0.02, flashalpha = 0.4, flashsize = 6, ttl = 80, color = { [1] = 1, [2] = 0.0, [3] = 1, }, }, }, ["flashslowwithsparks"] = { usedefaultexplosions = false, groundflash = { circlealpha = 0, circlegrowth = 0, flashalpha = 0.5, flashsize = 25, ttl = 10, color = { [1] = 0.6, [2] = 0, [3] = 0.7, }, }, meltage = { air = true, class = [[CExpGenSpawner]], count = 1, ground = true, water = true, properties = { delay = 0, explosiongenerator = [[custom:SLOW_MELT]], pos = [[0, 0, 0]], }, }, pikes = { air = true, class = [[explspike]], count = 5, ground = true, water = true, properties = { alpha = 1, alphadecay = 0.04, color = [[0.4,0,0.5]], dir = [[-1 r2,-1 r2,-1 r2]], length = 4, width = 8, }, }, sparks_purple = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1.0 0.2 1.0 0.01 0.9 0.3 0.9 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.1, 0]], numparticles = 5, particlelife = 8, particlelifespread = 3, particlesize = 6, particlesizespread = 2.5, particlespeed = 4, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, sparks_yellow = { air = true, class = [[CSimpleParticleSystem]], count = 1, ground = true, water = true, properties = { airdrag = 0.97, colormap = [[1 1 1 0.01 1 0.7 0.2 0.01 0 0 0 0.01]], directional = true, emitrot = 0, emitrotspread = 80, emitvector = [[0, 1, 0]], gravity = [[0, -0.4, 0]], numparticles = 10, particlelife = 18, particlelifespread = 2, particlesize = 1, particlesizespread = 2.5, particlespeed = 3, particlespeedspread = 2, pos = [[0, 0, 0]], sizegrowth = 0, sizemod = 1.0, texture = [[plasma]], }, }, }, }
gpl-2.0
flyzjhz/witi-openwrt
package/ramips/ui/luci-mtk/src/modules/base/luasrc/model/network.lua
47
33988
--[[ LuCI - Network model Copyright 2009-2010 Jo-Philipp Wich <xm@subsignal.org> 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 type, next, pairs, ipairs, loadfile, table = type, next, pairs, ipairs, loadfile, table local tonumber, tostring, math = tonumber, tostring, math local require = require local bus = require "ubus" local nxo = require "nixio" local nfs = require "nixio.fs" local ipc = require "luci.ip" local sys = require "luci.sys" local utl = require "luci.util" local dsp = require "luci.dispatcher" local uci = require "luci.model.uci" local lng = require "luci.i18n" module "luci.model.network" IFACE_PATTERNS_VIRTUAL = { } IFACE_PATTERNS_IGNORE = { "^wmaster%d", "^wifi%d", "^hwsim%d", "^imq%d", "^ifb%d", "^mon%.wlan%d", "^sit%d", "^gre%d", "^lo$" } IFACE_PATTERNS_WIRELESS = { "^wlan%d", "^wl%d", "^ath%d", "^%w+%.network%d" } protocol = utl.class() local _protocols = { } local _interfaces, _bridge, _switch, _tunnel local _ubus, _ubusnetcache, _ubusdevcache, _ubuswificache local _uci_real, _uci_state function _filter(c, s, o, r) local val = _uci_real:get(c, s, o) if val then local l = { } if type(val) == "string" then for val in val:gmatch("%S+") do if val ~= r then l[#l+1] = val end end if #l > 0 then _uci_real:set(c, s, o, table.concat(l, " ")) else _uci_real:delete(c, s, o) end elseif type(val) == "table" then for _, val in ipairs(val) do if val ~= r then l[#l+1] = val end end if #l > 0 then _uci_real:set(c, s, o, l) else _uci_real:delete(c, s, o) end end end end function _append(c, s, o, a) local val = _uci_real:get(c, s, o) or "" if type(val) == "string" then local l = { } for val in val:gmatch("%S+") do if val ~= a then l[#l+1] = val end end l[#l+1] = a _uci_real:set(c, s, o, table.concat(l, " ")) elseif type(val) == "table" then local l = { } for _, val in ipairs(val) do if val ~= a then l[#l+1] = val end end l[#l+1] = a _uci_real:set(c, s, o, l) end end function _stror(s1, s2) if not s1 or #s1 == 0 then return s2 and #s2 > 0 and s2 else return s1 end end function _get(c, s, o) return _uci_real:get(c, s, o) end function _set(c, s, o, v) if v ~= nil then if type(v) == "boolean" then v = v and "1" or "0" end return _uci_real:set(c, s, o, v) else return _uci_real:delete(c, s, o) end end function _wifi_iface(x) local _, p for _, p in ipairs(IFACE_PATTERNS_WIRELESS) do if x:match(p) then return true end end return false end function _wifi_state(key, val, field) if not next(_ubuswificache) then _ubuswificache = _ubus:call("network.wireless", "status", {}) or {} end local radio, radiostate for radio, radiostate in pairs(_ubuswificache) do local ifc, ifcstate for ifc, ifcstate in pairs(radiostate.interfaces) do if ifcstate[key] == val then return ifcstate[field] end end end end function _wifi_lookup(ifn) -- got a radio#.network# pseudo iface, locate the corresponding section local radio, ifnidx = ifn:match("^(%w+)%.network(%d+)$") if radio and ifnidx then local sid = nil local num = 0 ifnidx = tonumber(ifnidx) _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device == radio then num = num + 1 if num == ifnidx then sid = s['.name'] return false end end end) return sid -- looks like wifi, try to locate the section via state vars elseif _wifi_iface(ifn) then local sid = _wifi_state("ifname", ifn, "section") if not sid then _uci_state:foreach("wireless", "wifi-iface", function(s) if s.ifname == ifn then sid = s['.name'] return false end end) end return sid end end function _iface_virtual(x) local _, p for _, p in ipairs(IFACE_PATTERNS_VIRTUAL) do if x:match(p) then return true end end return false end function _iface_ignore(x) local _, p for _, p in ipairs(IFACE_PATTERNS_IGNORE) do if x:match(p) then return true end end return _iface_virtual(x) end function init(cursor) _uci_real = cursor or _uci_real or uci.cursor() _uci_state = _uci_real:substate() _interfaces = { } _bridge = { } _switch = { } _tunnel = { } _ubus = bus.connect() _ubusnetcache = { } _ubusdevcache = { } _ubuswificache = { } -- read interface information local n, i for n, i in ipairs(nxo.getifaddrs()) do local name = i.name:match("[^:]+") local prnt = name:match("^([^%.]+)%.") if _iface_virtual(name) then _tunnel[name] = true end if _tunnel[name] or not _iface_ignore(name) then _interfaces[name] = _interfaces[name] or { idx = i.ifindex or n, name = name, rawname = i.name, flags = { }, ipaddrs = { }, ip6addrs = { } } if prnt then _switch[name] = true _switch[prnt] = true end if i.family == "packet" then _interfaces[name].flags = i.flags _interfaces[name].stats = i.data _interfaces[name].macaddr = i.addr elseif i.family == "inet" then _interfaces[name].ipaddrs[#_interfaces[name].ipaddrs+1] = ipc.IPv4(i.addr, i.netmask) elseif i.family == "inet6" then _interfaces[name].ip6addrs[#_interfaces[name].ip6addrs+1] = ipc.IPv6(i.addr, i.netmask) end end end -- read bridge informaton local b, l for l in utl.execi("brctl show") do if not l:match("STP") then local r = utl.split(l, "%s+", nil, true) if #r == 4 then b = { name = r[1], id = r[2], stp = r[3] == "yes", ifnames = { _interfaces[r[4]] } } if b.ifnames[1] then b.ifnames[1].bridge = b end _bridge[r[1]] = b elseif b then b.ifnames[#b.ifnames+1] = _interfaces[r[2]] b.ifnames[#b.ifnames].bridge = b end end end return _M end function save(self, ...) _uci_real:save(...) _uci_real:load(...) end function commit(self, ...) _uci_real:commit(...) _uci_real:load(...) end function ifnameof(self, x) if utl.instanceof(x, interface) then return x:name() elseif utl.instanceof(x, protocol) then return x:ifname() elseif type(x) == "string" then return x:match("^[^:]+") end end function get_protocol(self, protoname, netname) local v = _protocols[protoname] if v then return v(netname or "__dummy__") end end function get_protocols(self) local p = { } local _, v for _, v in ipairs(_protocols) do p[#p+1] = v("__dummy__") end return p end function register_protocol(self, protoname) local proto = utl.class(protocol) function proto.__init__(self, name) self.sid = name end function proto.proto(self) return protoname end _protocols[#_protocols+1] = proto _protocols[protoname] = proto return proto end function register_pattern_virtual(self, pat) IFACE_PATTERNS_VIRTUAL[#IFACE_PATTERNS_VIRTUAL+1] = pat end function has_ipv6(self) return nfs.access("/proc/net/ipv6_route") end function add_network(self, n, options) local oldnet = self:get_network(n) if n and #n > 0 and n:match("^[a-zA-Z0-9_]+$") and not oldnet then if _uci_real:section("network", "interface", n, options) then return network(n) end elseif oldnet and oldnet:is_empty() then if options then local k, v for k, v in pairs(options) do oldnet:set(k, v) end end return oldnet end end function get_network(self, n) if n and _uci_real:get("network", n) == "interface" then return network(n) end end function get_networks(self) local nets = { } local nls = { } _uci_real:foreach("network", "interface", function(s) nls[s['.name']] = network(s['.name']) end) local n for n in utl.kspairs(nls) do nets[#nets+1] = nls[n] end return nets end function del_network(self, n) local r = _uci_real:delete("network", n) if r then _uci_real:delete_all("network", "alias", function(s) return (s.interface == n) end) _uci_real:delete_all("network", "route", function(s) return (s.interface == n) end) _uci_real:delete_all("network", "route6", function(s) return (s.interface == n) end) _uci_real:foreach("wireless", "wifi-iface", function(s) local net local rest = { } for net in utl.imatch(s.network) do if net ~= n then rest[#rest+1] = net end end if #rest > 0 then _uci_real:set("wireless", s['.name'], "network", table.concat(rest, " ")) else _uci_real:delete("wireless", s['.name'], "network") end end) end return r end function rename_network(self, old, new) local r if new and #new > 0 and new:match("^[a-zA-Z0-9_]+$") and not self:get_network(new) then r = _uci_real:section("network", "interface", new, _uci_real:get_all("network", old)) if r then _uci_real:foreach("network", "alias", function(s) if s.interface == old then _uci_real:set("network", s['.name'], "interface", new) end end) _uci_real:foreach("network", "route", function(s) if s.interface == old then _uci_real:set("network", s['.name'], "interface", new) end end) _uci_real:foreach("network", "route6", function(s) if s.interface == old then _uci_real:set("network", s['.name'], "interface", new) end end) _uci_real:foreach("wireless", "wifi-iface", function(s) local net local list = { } for net in utl.imatch(s.network) do if net == old then list[#list+1] = new else list[#list+1] = net end end if #list > 0 then _uci_real:set("wireless", s['.name'], "network", table.concat(list, " ")) end end) _uci_real:delete("network", old) end end return r or false end function get_interface(self, i) if _interfaces[i] or _wifi_iface(i) then return interface(i) else local ifc local num = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 if s['.name'] == i then ifc = interface( "%s.network%d" %{s.device, num[s.device] }) return false end end end) return ifc end end function get_interfaces(self) local iface local ifaces = { } local seen = { } local nfs = { } local baseof = { } -- find normal interfaces _uci_real:foreach("network", "interface", function(s) for iface in utl.imatch(s.ifname) do if not _iface_ignore(iface) and not _wifi_iface(iface) then seen[iface] = true nfs[iface] = interface(iface) end end end) for iface in utl.kspairs(_interfaces) do if not (seen[iface] or _iface_ignore(iface) or _wifi_iface(iface)) then nfs[iface] = interface(iface) end end -- find vlan interfaces _uci_real:foreach("network", "switch_vlan", function(s) if not s.device then return end local base = baseof[s.device] if not base then if not s.device:match("^eth%d") then local l for l in utl.execi("swconfig dev %q help 2>/dev/null" % s.device) do if not base then base = l:match("^%w+: (%w+)") end end if not base or not base:match("^eth%d") then base = "eth0" end else base = s.device end baseof[s.device] = base end local vid = tonumber(s.vid or s.vlan) if vid ~= nil and vid >= 0 and vid <= 4095 then local iface = "%s.%d" %{ base, vid } if not seen[iface] then seen[iface] = true nfs[iface] = interface(iface) end end end) for iface in utl.kspairs(nfs) do ifaces[#ifaces+1] = nfs[iface] end -- find wifi interfaces local num = { } local wfs = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 local i = "%s.network%d" %{ s.device, num[s.device] } wfs[i] = interface(i) end end) for iface in utl.kspairs(wfs) do ifaces[#ifaces+1] = wfs[iface] end return ifaces end function ignore_interface(self, x) return _iface_ignore(x) end function get_wifidev(self, dev) if _uci_real:get("wireless", dev) == "wifi-device" then return wifidev(dev) end end function get_wifidevs(self) local devs = { } local wfd = { } _uci_real:foreach("wireless", "wifi-device", function(s) wfd[#wfd+1] = s['.name'] end) local dev for _, dev in utl.vspairs(wfd) do devs[#devs+1] = wifidev(dev) end return devs end function get_wifinet(self, net) local wnet = _wifi_lookup(net) if wnet then return wifinet(wnet) end end function add_wifinet(self, net, options) if type(options) == "table" and options.device and _uci_real:get("wireless", options.device) == "wifi-device" then local wnet = _uci_real:section("wireless", "wifi-iface", nil, options) return wifinet(wnet) end end function del_wifinet(self, net) local wnet = _wifi_lookup(net) if wnet then _uci_real:delete("wireless", wnet) return true end return false end function get_status_by_route(self, addr, mask) local _, object for _, object in ipairs(_ubus:objects()) do local net = object:match("^network%.interface%.(.+)") if net then local s = _ubus:call(object, "status", {}) if s and s.route then local rt for _, rt in ipairs(s.route) do if not rt.table and rt.target == addr and rt.mask == mask then return net, s end end end end end end function get_status_by_address(self, addr) local _, object for _, object in ipairs(_ubus:objects()) do local net = object:match("^network%.interface%.(.+)") if net then local s = _ubus:call(object, "status", {}) if s and s['ipv4-address'] then local a for _, a in ipairs(s['ipv4-address']) do if a.address == addr then return net, s end end end if s and s['ipv6-address'] then local a for _, a in ipairs(s['ipv6-address']) do if a.address == addr then return net, s end end end end end end function get_wannet(self) local net = self:get_status_by_route("0.0.0.0", 0) return net and network(net) end function get_wandev(self) local _, stat = self:get_status_by_route("0.0.0.0", 0) return stat and interface(stat.l3_device or stat.device) end function get_wan6net(self) local net = self:get_status_by_route("::", 0) return net and network(net) end function get_wan6dev(self) local _, stat = self:get_status_by_route("::", 0) return stat and interface(stat.l3_device or stat.device) end function network(name, proto) if name then local p = proto or _uci_real:get("network", name, "proto") local c = p and _protocols[p] or protocol return c(name) end end function protocol.__init__(self, name) self.sid = name end function protocol._get(self, opt) local v = _uci_real:get("network", self.sid, opt) if type(v) == "table" then return table.concat(v, " ") end return v or "" end function protocol._ubus(self, field) if not _ubusnetcache[self.sid] then _ubusnetcache[self.sid] = _ubus:call("network.interface.%s" % self.sid, "status", { }) end if _ubusnetcache[self.sid] and field then return _ubusnetcache[self.sid][field] end return _ubusnetcache[self.sid] end function protocol.get(self, opt) return _get("network", self.sid, opt) end function protocol.set(self, opt, val) return _set("network", self.sid, opt, val) end function protocol.ifname(self) local ifname if self:is_floating() then ifname = self:_ubus("l3_device") else ifname = self:_ubus("device") end if not ifname then local num = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 local net for net in utl.imatch(s.network) do if net == self.sid then ifname = "%s.network%d" %{ s.device, num[s.device] } return false end end end end) end return ifname end function protocol.proto(self) return "none" end function protocol.get_i18n(self) local p = self:proto() if p == "none" then return lng.translate("Unmanaged") elseif p == "static" then return lng.translate("Static address") elseif p == "dhcp" then return lng.translate("DHCP client") else return lng.translate("Unknown") end end function protocol.type(self) return self:_get("type") end function protocol.name(self) return self.sid end function protocol.uptime(self) return self:_ubus("uptime") or 0 end function protocol.expires(self) local a = tonumber(_uci_state:get("network", self.sid, "lease_acquired")) local l = tonumber(_uci_state:get("network", self.sid, "lease_lifetime")) if a and l then l = l - (nxo.sysinfo().uptime - a) return l > 0 and l or 0 end return -1 end function protocol.metric(self) return tonumber(_uci_state:get("network", self.sid, "metric")) or 0 end function protocol.ipaddr(self) local addrs = self:_ubus("ipv4-address") return addrs and #addrs > 0 and addrs[1].address end function protocol.netmask(self) local addrs = self:_ubus("ipv4-address") return addrs and #addrs > 0 and ipc.IPv4("0.0.0.0/%d" % addrs[1].mask):mask():string() end function protocol.gwaddr(self) local _, route for _, route in ipairs(self:_ubus("route") or { }) do if route.target == "0.0.0.0" and route.mask == 0 then return route.nexthop end end end function protocol.dnsaddrs(self) local dns = { } local _, addr for _, addr in ipairs(self:_ubus("dns-server") or { }) do if not addr:match(":") then dns[#dns+1] = addr end end return dns end function protocol.ip6addr(self) local addrs = self:_ubus("ipv6-address") if addrs and #addrs > 0 then return "%s/%d" %{ addrs[1].address, addrs[1].mask } else addrs = self:_ubus("ipv6-prefix-assignment") if addrs and #addrs > 0 then return "%s/%d" %{ addrs[1].address, addrs[1].mask } end end end function protocol.gw6addr(self) local _, route for _, route in ipairs(self:_ubus("route") or { }) do if route.target == "::" and route.mask == 0 then return ipc.IPv6(route.nexthop):string() end end end function protocol.dns6addrs(self) local dns = { } local _, addr for _, addr in ipairs(self:_ubus("dns-server") or { }) do if addr:match(":") then dns[#dns+1] = addr end end return dns end function protocol.is_bridge(self) return (not self:is_virtual() and self:type() == "bridge") end function protocol.opkg_package(self) return nil end function protocol.is_installed(self) return true end function protocol.is_virtual(self) return false end function protocol.is_floating(self) return false end function protocol.is_empty(self) if self:is_floating() then return false else local rv = true if (self:_get("ifname") or ""):match("%S+") then rv = false end _uci_real:foreach("wireless", "wifi-iface", function(s) local n for n in utl.imatch(s.network) do if n == self.sid then rv = false return false end end end) return rv end end function protocol.add_interface(self, ifname) ifname = _M:ifnameof(ifname) if ifname and not self:is_floating() then -- if its a wifi interface, change its network option local wif = _wifi_lookup(ifname) if wif then _append("wireless", wif, "network", self.sid) -- add iface to our iface list else _append("network", self.sid, "ifname", ifname) end end end function protocol.del_interface(self, ifname) ifname = _M:ifnameof(ifname) if ifname and not self:is_floating() then -- if its a wireless interface, clear its network option local wif = _wifi_lookup(ifname) if wif then _filter("wireless", wif, "network", self.sid) end -- remove the interface _filter("network", self.sid, "ifname", ifname) end end function protocol.get_interface(self) if self:is_virtual() then _tunnel[self:proto() .. "-" .. self.sid] = true return interface(self:proto() .. "-" .. self.sid, self) elseif self:is_bridge() then _bridge["br-" .. self.sid] = true return interface("br-" .. self.sid, self) else local ifn = nil local num = { } for ifn in utl.imatch(_uci_real:get("network", self.sid, "ifname")) do ifn = ifn:match("^[^:/]+") return ifn and interface(ifn, self) end ifn = nil _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 local net for net in utl.imatch(s.network) do if net == self.sid then ifn = "%s.network%d" %{ s.device, num[s.device] } return false end end end end) return ifn and interface(ifn, self) end end function protocol.get_interfaces(self) if self:is_bridge() or (self:is_virtual() and not self:is_floating()) then local ifaces = { } local ifn local nfs = { } for ifn in utl.imatch(self:get("ifname")) do ifn = ifn:match("^[^:/]+") nfs[ifn] = interface(ifn, self) end for ifn in utl.kspairs(nfs) do ifaces[#ifaces+1] = nfs[ifn] end local num = { } local wfs = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 local net for net in utl.imatch(s.network) do if net == self.sid then ifn = "%s.network%d" %{ s.device, num[s.device] } wfs[ifn] = interface(ifn, self) end end end end) for ifn in utl.kspairs(wfs) do ifaces[#ifaces+1] = wfs[ifn] end return ifaces end end function protocol.contains_interface(self, ifname) ifname = _M:ifnameof(ifname) if not ifname then return false elseif self:is_virtual() and self:proto() .. "-" .. self.sid == ifname then return true elseif self:is_bridge() and "br-" .. self.sid == ifname then return true else local ifn for ifn in utl.imatch(self:get("ifname")) do ifn = ifn:match("[^:]+") if ifn == ifname then return true end end local wif = _wifi_lookup(ifname) if wif then local n for n in utl.imatch(_uci_real:get("wireless", wif, "network")) do if n == self.sid then return true end end end end return false end function protocol.adminlink(self) return dsp.build_url("admin", "network", "network", self.sid) end interface = utl.class() function interface.__init__(self, ifname, network) local wif = _wifi_lookup(ifname) if wif then self.wif = wifinet(wif) self.ifname = _wifi_state("section", wif, "ifname") end self.ifname = self.ifname or ifname self.dev = _interfaces[self.ifname] self.network = network end function interface._ubus(self, field) if not _ubusdevcache[self.ifname] then _ubusdevcache[self.ifname] = _ubus:call("network.device", "status", { name = self.ifname }) end if _ubusdevcache[self.ifname] and field then return _ubusdevcache[self.ifname][field] end return _ubusdevcache[self.ifname] end function interface.name(self) return self.wif and self.wif:ifname() or self.ifname end function interface.mac(self) return (self:_ubus("macaddr") or "00:00:00:00:00:00"):upper() end function interface.ipaddrs(self) return self.dev and self.dev.ipaddrs or { } end function interface.ip6addrs(self) return self.dev and self.dev.ip6addrs or { } end function interface.type(self) if self.wif or _wifi_iface(self.ifname) then return "wifi" elseif _bridge[self.ifname] then return "bridge" elseif _tunnel[self.ifname] then return "tunnel" elseif self.ifname:match("%.") then return "vlan" elseif _switch[self.ifname] then return "switch" else return "ethernet" end end function interface.shortname(self) if self.wif then return "%s %q" %{ self.wif:active_mode(), self.wif:active_ssid() or self.wif:active_bssid() } else return self.ifname end end function interface.get_i18n(self) if self.wif then return "%s: %s %q" %{ lng.translate("Wireless Network"), self.wif:active_mode(), self.wif:active_ssid() or self.wif:active_bssid() } else return "%s: %q" %{ self:get_type_i18n(), self:name() } end end function interface.get_type_i18n(self) local x = self:type() if x == "wifi" then return lng.translate("Wireless Adapter") elseif x == "bridge" then return lng.translate("Bridge") elseif x == "switch" then return lng.translate("Ethernet Switch") elseif x == "vlan" then return lng.translate("VLAN Interface") elseif x == "tunnel" then return lng.translate("Tunnel Interface") else return lng.translate("Ethernet Adapter") end end function interface.adminlink(self) if self.wif then return self.wif:adminlink() end end function interface.ports(self) local members = self:_ubus("bridge-members") if members then local _, iface local ifaces = { } for _, iface in ipairs(members) do ifaces[#ifaces+1] = interface(iface) end end end function interface.bridge_id(self) if self.br then return self.br.id else return nil end end function interface.bridge_stp(self) if self.br then return self.br.stp else return false end end function interface.is_up(self) return self:_ubus("up") or false end function interface.is_bridge(self) return (self:type() == "bridge") end function interface.is_bridgeport(self) return self.dev and self.dev.bridge and true or false end function interface.tx_bytes(self) local stat = self:_ubus("statistics") return stat and stat.tx_bytes or 0 end function interface.rx_bytes(self) local stat = self:_ubus("statistics") return stat and stat.rx_bytes or 0 end function interface.tx_packets(self) local stat = self:_ubus("statistics") return stat and stat.tx_packets or 0 end function interface.rx_packets(self) local stat = self:_ubus("statistics") return stat and stat.rx_packets or 0 end function interface.get_network(self) return self:get_networks()[1] end function interface.get_networks(self) if not self.networks then local nets = { } local _, net for _, net in ipairs(_M:get_networks()) do if net:contains_interface(self.ifname) or net:ifname() == self.ifname then nets[#nets+1] = net end end table.sort(nets, function(a, b) return a.sid < b.sid end) self.networks = nets return nets else return self.networks end end function interface.get_wifinet(self) return self.wif end wifidev = utl.class() function wifidev.__init__(self, dev) self.sid = dev self.iwinfo = dev and sys.wifi.getiwinfo(dev) or { } end function wifidev.get(self, opt) return _get("wireless", self.sid, opt) end function wifidev.set(self, opt, val) return _set("wireless", self.sid, opt, val) end function wifidev.name(self) return self.sid end function wifidev.hwmodes(self) local l = self.iwinfo.hwmodelist if l and next(l) then return l else return { b = true, g = true } end end function wifidev.get_i18n(self) local t = "Generic" if self.iwinfo.type == "wl" then t = "Broadcom" elseif self.iwinfo.type == "madwifi" then t = "Atheros" end local m = "" local l = self:hwmodes() if l.a then m = m .. "a" end if l.b then m = m .. "b" end if l.g then m = m .. "g" end if l.n then m = m .. "n" end return "%s 802.11%s Wireless Controller (%s)" %{ t, m, self:name() } end function wifidev.is_up(self) if _ubuswificache[self.sid] then return (_ubuswificache[self.sid].up == true) end local up = false _uci_state:foreach("wireless", "wifi-iface", function(s) if s.device == self.sid then if s.up == "1" then up = true return false end end end) return up end function wifidev.get_wifinet(self, net) if _uci_real:get("wireless", net) == "wifi-iface" then return wifinet(net) else local wnet = _wifi_lookup(net) if wnet then return wifinet(wnet) end end end function wifidev.get_wifinets(self) local nets = { } _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device == self.sid then nets[#nets+1] = wifinet(s['.name']) end end) return nets end function wifidev.add_wifinet(self, options) options = options or { } options.device = self.sid local wnet = _uci_real:section("wireless", "wifi-iface", nil, options) if wnet then return wifinet(wnet, options) end end function wifidev.del_wifinet(self, net) if utl.instanceof(net, wifinet) then net = net.sid elseif _uci_real:get("wireless", net) ~= "wifi-iface" then net = _wifi_lookup(net) end if net and _uci_real:get("wireless", net, "device") == self.sid then _uci_real:delete("wireless", net) return true end return false end wifinet = utl.class() function wifinet.__init__(self, net, data) self.sid = net local num = { } local netid _uci_real:foreach("wireless", "wifi-iface", function(s) if s.device then num[s.device] = num[s.device] and num[s.device] + 1 or 1 if s['.name'] == self.sid then netid = "%s.network%d" %{ s.device, num[s.device] } return false end end end) local dev = _wifi_state("section", self.sid, "ifname") or netid self.netid = netid self.wdev = dev self.iwinfo = dev and sys.wifi.getiwinfo(dev) or { } self.iwdata = data or _uci_state:get_all("wireless", self.sid) or _uci_real:get_all("wireless", self.sid) or { } end function wifinet.get(self, opt) return _get("wireless", self.sid, opt) end function wifinet.set(self, opt, val) return _set("wireless", self.sid, opt, val) end function wifinet.mode(self) return _uci_state:get("wireless", self.sid, "mode") or "ap" end function wifinet.ssid(self) return _uci_state:get("wireless", self.sid, "ssid") end function wifinet.bssid(self) return _uci_state:get("wireless", self.sid, "bssid") end function wifinet.network(self) return _uci_state:get("wifinet", self.sid, "network") end function wifinet.id(self) return self.netid end function wifinet.name(self) return self.sid end function wifinet.ifname(self) local ifname = self.iwinfo.ifname if not ifname or ifname:match("^wifi%d") or ifname:match("^radio%d") then ifname = self.wdev end return ifname end function wifinet.get_device(self) if self.iwdata.device then return wifidev(self.iwdata.device) end end function wifinet.is_up(self) local ifc = self:get_interface() return (ifc and ifc:is_up() or false) end function wifinet.active_mode(self) local m = _stror(self.iwinfo.mode, self.iwdata.mode) or "ap" if m == "ap" then m = "Master" elseif m == "sta" then m = "Client" elseif m == "adhoc" then m = "Ad-Hoc" elseif m == "mesh" then m = "Mesh" elseif m == "monitor" then m = "Monitor" end return m end function wifinet.active_mode_i18n(self) return lng.translate(self:active_mode()) end function wifinet.active_ssid(self) return _stror(self.iwinfo.ssid, self.iwdata.ssid) end function wifinet.active_bssid(self) return _stror(self.iwinfo.bssid, self.iwdata.bssid) or "00:00:00:00:00:00" end function wifinet.active_encryption(self) local enc = self.iwinfo and self.iwinfo.encryption return enc and enc.description or "-" end function wifinet.assoclist(self) return self.iwinfo.assoclist or { } end function wifinet.frequency(self) local freq = self.iwinfo.frequency if freq and freq > 0 then return "%.03f" % (freq / 1000) end end function wifinet.bitrate(self) local rate = self.iwinfo.bitrate if rate and rate > 0 then return (rate / 1000) end end function wifinet.channel(self) return self.iwinfo.channel or tonumber(_uci_state:get("wireless", self.iwdata.device, "channel")) end function wifinet.signal(self) return self.iwinfo.signal or 0 end function wifinet.noise(self) return self.iwinfo.noise or 0 end function wifinet.country(self) return self.iwinfo.country or "00" end function wifinet.txpower(self) local pwr = (self.iwinfo.txpower or 0) return pwr + self:txpower_offset() end function wifinet.txpower_offset(self) return self.iwinfo.txpower_offset or 0 end function wifinet.signal_level(self, s, n) if self:active_bssid() ~= "00:00:00:00:00:00" then local signal = s or self:signal() local noise = n or self:noise() if signal < 0 and noise < 0 then local snr = -1 * (noise - signal) return math.floor(snr / 5) else return 0 end else return -1 end end function wifinet.signal_percent(self) local qc = self.iwinfo.quality or 0 local qm = self.iwinfo.quality_max or 0 if qc > 0 and qm > 0 then return math.floor((100 / qm) * qc) else return 0 end end function wifinet.shortname(self) return "%s %q" %{ lng.translate(self:active_mode()), self:active_ssid() or self:active_bssid() } end function wifinet.get_i18n(self) return "%s: %s %q (%s)" %{ lng.translate("Wireless Network"), lng.translate(self:active_mode()), self:active_ssid() or self:active_bssid(), self:ifname() } end function wifinet.adminlink(self) return dsp.build_url("admin", "network", "wireless", self.netid) end function wifinet.get_network(self) return self:get_networks()[1] end function wifinet.get_networks(self) local nets = { } local net for net in utl.imatch(tostring(self.iwdata.network)) do if _uci_real:get("network", net) == "interface" then nets[#nets+1] = network(net) end end table.sort(nets, function(a, b) return a.sid < b.sid end) return nets end function wifinet.get_interface(self) return interface(self:ifname()) end -- setup base protocols _M:register_protocol("static") _M:register_protocol("dhcp") _M:register_protocol("none") -- load protocol extensions local exts = nfs.dir(utl.libpath() .. "/model/network") if exts then local ext for ext in exts do if ext:match("%.lua$") then require("luci.model.network." .. ext:gsub("%.lua$", "")) end end end
gpl-2.0
pakoito/ToME---t-engine4
game/modules/tome/data/gfx/particles/ball_lightning_beam.lua
3
2385
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org local points = {} local basesize = radius * (engine.Map.tile_w + engine.Map.tile_h) / 2 for fork_i = 0, 35 do local tx = math.cos(fork_i * math.pi * 2 / 35) * basesize local ty = math.sin(fork_i * math.pi * 2 / 35) * basesize local basedir = math.atan2(ty, tx) local bc = rng.float(0.8, 1) local c = 1 local a = 1 or rng.float(0.3, 0.6) local size = 2 local starta = basedir+math.pi/2 local starts = rng.range(-4, 4) points[#points+1] = {bc=bc, c=c, a=a, size=size, x=math.cos(starta) * starts, y=math.sin(starta) * starts, prev=-1} local nb = 5 for i = 0, nb - 1 do -- Split point in the segment local split = rng.range(0, basesize / nb) + i * (basesize / nb) local dev = math.rad(rng.range(-8, 8)) points[#points+1] = {bc=bc, c=c, a=a, movea=basedir+dev+math.pi/2, size=size + rng.range(-2, 2), x=math.cos(basedir+dev) * split, y=math.sin(basedir+dev) * split, prev=#points-1} end points[#points+1] = {bc=bc, c=c, a=a, size=size, x=tx, y=ty, prev=#points-1} end local nbp = #points -- Populate the lightning based on the forks return { engine=core.particles.ENGINE_LINES, generator = function() local p = table.remove(points, 1) return { life = 8, trail=p.prev, size = p.size, sizev = 0, sizea = 0, x = p.x, xv = 0, xa = 0, y = p.y, yv = 0, ya = 0, dir = p.movea, dirv = 0, dira = 0, vel = rng.float(-1, 1), velv = 0, vela = 0, r = p.bc, rv = 0, ra = 0, g = p.bc, gv = 0, ga = 0, b = p.c, bv = 0, ba = 0, a = p.a, av = 0, aa = -0.06, } end, }, function(self) if nbp > 0 then self.ps:emit(nbp) nbp = 0 end end, nbp, "particles_images/beam"
gpl-3.0
knixeur/notion
contrib/styles/look_outback.lua
2
3927
-- Authors: Mark Tran <mark@nirv.net> -- License: Unknown -- Last Changed: Unknown -- -- look_outback.lua : Mark Tran <mark@nirv.net> -- This style looks best when the alternative style is applied to "full" -- workspace frames. You can enable it by applying: _:set_mode('tiled-alt') -- as Lua code. -- -- View http://modeemi.fi/~tuomov/ion/faq/entries/Hiding_the_tab-bar.html -- for further details. if not gr.select_engine("de") then return end de.reset() de.defstyle("*", { border_style = "elevated", background_colour = "#453832", foreground_colour = "#ffffff", highlight_pixels = 0, padding_pixels = 0, shadow_pixels = 0, highlight_colour = "#000000", padding_colour = "#453832", shadow_colour = "#000000", font = "-xos4-terminus-*-r-normal--12-120-*-*-c-*-iso8859-1", text_align = "center", }) de.defstyle("frame", { based_on = "*", border_style = "inlaid", spacing = 1, background_colour = "#f5deb3", foreground_colour = "#000000", padding_pixels = 1, padding_colour = "#453832", }) de.defstyle("frame-floating", { based_on = "*", bar = "inside", padding_pixels = 1, spacing = 0, }) de.defstyle("frame-tiled-alt", { based_on = "*", bar = "inside", spacing = 0, }) de.defstyle("frame-transient", { based_on = "*", spacing = 0, }) de.defstyle("tab", { based_on = "*", highlight_pixels = 1, padding_pixels = 1, shadow_pixels = 1, highlight_colour = "#352722", shadow_colour = "#352722", spacing = 1, de.substyle("active-selected", { background_colour = "#983008", foreground_colour = "#ffffff", highlight_colour = "#d04008", shadow_colour = "#d04008", }), de.substyle("active-unselected", { background_colour = "#453832", foreground_colour = "#ffffff", }), de.substyle("inactive-selected", { background_colour = "#453832", foreground_colour = "#ffffff", }), de.substyle("inactive-unselected", { background_colour = "#453832", foreground_colour = "#ffffff", }), }) de.defstyle("tab-frame-floating", { based_on = "tab", highlight_pixels = 0, shadow_pixels = 0, }) de.defstyle("tab-frame-tiled-alt", { based_on = "tab", highlight_pixels = 0, shadow_pixels = 0, }) de.defstyle("tab-menuentry", { based_on = "tab", highlight_pixels = 0, padding_pixels = 3, shadow_pixels = 0, text_align = "left", de.substyle("inactive-selected", { background_colour = "#983008", foreground_colour = "#ffffff", }), }) de.defstyle("tab-menuentry-big", { based_on = "*", padding_pixels = 5, }) de.defstyle("input", { based_on = "*", background_colour = "#352722", padding_pixels = 2, }) de.defstyle("input-edln", { based_on = "*", background_colour = "#453832", highlight_pixels = 1, shadow_pixels = 1, highlight_colour = "#473e3b", shadow_colour = "#473e3b", de.substyle("*-cursor", { background_colour = "#ffffff", foreground_colour = "#000000", }), de.substyle("*-selection", { background_colour = "#983008", foreground_colour = "#ffffff", }), }) de.defstyle("input-message", { based_on = "*", background_colour = "#453832", }) de.defstyle("stdisp-statusbar", { based_on = "*", de.substyle("important", { foreground_colour = "green", }), de.substyle("critical", { foreground_colour = "red", }), }) de.defstyle("actnotify", { based_on = "*", highlight_pixels = 1, padding_pixels = 1, shadow_pixels = 1, background_colour = "#983008", foreground_colour = "#ffffff", highlight_colour = "#d04008", shadow_colour = "#d04008", }) de.defstyle("moveres_display", { based_on = "*", based_on = "actnotify", }) gr.refresh()
lgpl-2.1
Laterus/Darkstar-Linux-Fork
scripts/globals/items/serving_of_green_curry.lua
1
1690
----------------------------------------- -- ID: 4296 -- Item: serving_of_green_curry -- Food Effect: 180Min, All Races ----------------------------------------- -- Agility 2 -- Vitality 1 -- Health Regen While Healing 2 -- Magic Regen While Healing 1 -- Defense % 9 -- Ranged ACC % 5 -- Ranged ACC Cap 25 -- Sleep Resist 5 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,0,4296); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_AGI, 2); target:addMod(MOD_VIT, 1); target:addMod(MOD_HPHEAL, 2); target:addMod(MOD_MPHEAL, 1); target:addMod(MOD_DEFP, 9); target:addMod(MOD_FOOD_RACCP, 5); target:addMod(MOD_FOOD_RACC_CAP, 25); target:addMod(MOD_SLEEPRES, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_AGI, 2); target:delMod(MOD_VIT, 1); target:delMod(MOD_HPHEAL, 2); target:delMod(MOD_MPHEAL, 1); target:delMod(MOD_DEFP, 9); target:delMod(MOD_FOOD_RACCP, 5); target:delMod(MOD_FOOD_RACC_CAP, 25); target:delMod(MOD_SLEEPRES, 5); end;
gpl-3.0
Grocel/wire-extras
lua/entities/gmod_wire_hud_indicator_2/expression_parser.lua
3
7102
include( "util/tables.lua" ) include( "expressions/expr_tokenizer.lua" ) include( "expressions/expr_stack.lua" ) funcTable = {} binaryFuncs = {} --Runtime Code EXPR_Parser = {} EXPR_Parser.binaryFuncs = {} EXPR_Parser.funcTable = {} include( "expressions/libs/mathlib.lua" ) include( "expressions/libs/stringlib.lua" ) include( "expressions/libs/logiclib.lua" ) include( "expressions/libs/corelib.lua" ) --Corelib must be loaded LAST so it overwrites any user mods! print( "[II]", "Loaded libraries..." ) function EXPR_Parser:new() local obj = {} setmetatable( obj, {__index = EXPR_Parser} ) obj.expr = EXPR_TOKENIZER:new() obj.opStack = EXPR_Stack:new() obj.andStack = EXPR_Stack:new() print("[II]", "Built a new expression parser!") return obj end function EXPR_Parser:DoOp( context ) local doOp = self.opStack:pop() -- Build a new context local newContext = context or {} newContext.min = 0 newContext.max = 100 if( context.x and context.y and context.w and context.h ) then if( doOp.depth == 0 ) then -- x -- newContext.min = context.x newContext.max = context.x+context.w elseif( doOp.depth == 1 ) then -- y -- newContext.min = context.y newContext.max = context.y+context.h end end if( self.binaryFuncs[doOp.value] ) then --Make an operation cost us something! HUD_System.opCount = HUD_System.opCount + 1 return self.binaryFuncs[doOp.value]( self.opStack, self.andStack, newContext ) elseif( doOp.value == "#" ) then return true end print("[EE] Unknown operator! --> ", "'"..tostring(doOp.value).."'" ) self.opStack:push( doOp ) return nil end function EXPR_Parser:DoFunc( context ) local doOp = self.opStack:pop() -- Build a new context local newContext = context or {} newContext.min = 0 newContext.max = 100 if( context.x and context.y and context.w and context.h ) then if( doOp.depth == 0 ) then -- x -- newContext.min = context.x newContext.max = context.x+context.w elseif( doOp.depth == 1 ) then -- y -- newContext.min = context.y newContext.max = context.y+context.h end end if( self.funcTable[doOp.value] ) then --Make a function cost us something! HUD_System.opCount = HUD_System.opCount + 1 return self.funcTable[doOp.value]( self.opStack, self.andStack, newContext ) end self.opStack:push( doOp ) return nil end function EXPR_Parser:Calc( input, context, expectedType ) local result = result or 0 local ops = {} context = context or {} input = tostring(input) or "" ops["%"] = 10 ops["^"] = 4 ops["/"] = 3 ops["*"] = 2 ops["+"] = 1 ops["-"] = 0 ops["{"] = -2 ops[","] = -3 ops["#"] = -4 self.expr:setInput( input ) math.randomseed( os.time() ) --Initial clear + sentinal self.opStack:clear() self.andStack:clear() self.opStack:push( {value="#", type="SENTINAL", depth=0 } ) while true do local tok = self.expr:getNextToken() if ( tok == nil ) then break end --print( "Read: ", tok.type ) -- PrintTitledTable( "Read: ", tok ) --Operand if( tok.type == "VALUE" or tok.type == "COLLECTION" ) then self.andStack:push( tok ) --Operator elseif( tok.type == "OP" ) then tok.depth = self.opStack:peekTop().depth --If we have operators in the stack... if( self.opStack:size() > 0 ) then local lastOp = self.opStack:peekTop() --If the operator has lower precidence than the last, do it! if( ops[tok.value] < ops[lastOp.value] ) then while( self.opStack:peekTop().value ~= "#" and self.opStack:peekTop().value ~= "," and self.opStack:peekTop().value ~= "{" ) do if( self:DoOp( context ) == nil ) then return nil end end end end self.opStack:push( tok ) --Push left-braces onto the stack as a sentinal... elseif( tok.type == "OPENBRACE" ) then self.opStack:push( {value="#", char=tok.value, type=tok.type} ) --Collapse the braces! elseif( tok.type == "CLOSEBRACE" ) then while( self.opStack:peekTop().value ~= "#" and self.opStack:peekTop().value ~= "{" ) do --Collapsing arrays costs! HUD_System.opCount = HUD_System.opCount + 1 if( self.opStack:peekTop().value == "," ) then self.opStack:pop() else if( self:DoOp( context ) == nil ) then return nil end end end self.opStack:pop() if( self.funcTable[self.opStack:peekTop().value] ) then self:DoFunc( context ) end --If its a function, just push it for now... elseif( tok.type == "FUNC" ) then tok.depth = self.opStack:peekTop().depth self.opStack:push( tok ) --Groups (vectors, mainly...) elseif( tok.type == "OPENGROUP" ) then tok.depth = 0 --Reset the depth count for this new group self.opStack:push( tok ) self.andStack:push( tok ) elseif( tok.type == "BREAK" ) then --Evaluate, we're at the end of a section! tok.depth = self.opStack:peekTop().depth + 1 while( self.opStack:peekTop().value ~= "#" and self.opStack:peekTop().value ~= "," and self.opStack:peekTop().value ~= "{" ) do if( self:DoOp( context ) == nil ) then return nil end end self.opStack:push( tok ) elseif( tok.type == "CLOSEGROUP" ) then --Compact the operands until we get a "{"... REMEMBER TO REMOVE "," AND "{" OPS AS WELL! local result = {} while( self.opStack:peekTop().value ~= "#" and self.opStack:peekTop().value ~= "," and self.opStack:peekTop().value ~= "{" ) do if( self:DoOp( context ) == nil ) then print("[EE]\tOperation failed to execute!") return nil end end while( self.andStack:peekTop().value ~= "{" and self.andStack:peekTop().value ~= "}" ) do if( self.andStack:size() == 0 ) then print("[EE]\tUnexpected EOL!") self.opStack:print("opStack") self.andStack:print("andStack") return nil end if( self.opStack:peekTop().value == "," ) then self.opStack:pop() --Discard the BREAK char. else table.insert( result, 1, self.andStack:pop() ) end end self.andStack:pop() --Removes the "{" on the AND stack! self.opStack:pop() --Removes the "{" on the OP stack! self.andStack:push( {value=result, type="COLLECTION"} ) --Unknown symbol! STOP! else print("[EE]\tUnknown (but tokenized) symbol!") print("[EE]\tTrace: ", tok.type, tok.value) self.opStack:print("opStack") self.andStack:print("andStack") print( "" ) print("[EE]\tLibrary mismatch?") return nil end --self.opStack:print("opStack") --self.andStack:print("andStack") end while self.opStack:size() > 1 do if( self:DoOp( context ) == nil ) then print( "[EE] More than one op in the stack, but no operands left!" ) return nil end end if( self.andStack:peekTop() ~= nil and self.andStack:peekTop().value ~= nil ) then if( expectedType and type(self.andStack:peekTop().value) != expectedType ) then return nil end local result = self.andStack:pop() if( type(result.value) == "table" ) then return result, table.maxn(result.value) else return result end end return nil end
apache-2.0
Laterus/Darkstar-Linux-Fork
scripts/zones/Upper_Jeuno/npcs/Chocobo.lua
1
5240
----------------------------------- -- Area: Upper Jeuno -- NPC: Chocobo -- Finishes Quest: Chocobo's Wounds ----------------------------------- package.loaded["scripts/zones/Upper_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Upper_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) ChocobosWounds = player:getQuestStatus(JEUNO,CHOCOBO_S_WOUNDS); if (ChocobosWounds == 0) then player:startEvent(0x003e); elseif (ChocobosWounds == 1) then count = trade:getItemCount(); gil = trade:getGil(); if (trade:hasItemQty(GYSAHL_GREENS,1)) then player:startEvent(0x004c); elseif (trade:hasItemQty(GAUSEBIT_GRASS,1) and gil == 0 and count == 1) then --Check feeding status. feed = player:getVar("ChocobosWounds_Event"); feedDay = player:getVar("ChocobosWounds_Day"); feedYear = player:getVar("ChocobosWounds_Year"); currentDay = VanadielDayOfTheYear(); feedReady = ((feedDay < currentDay) or (feedDay > currentDay and feedYear < VanadielYear())) if (feed == 1) then player:startEvent(0x0039); elseif (feedReady == true) then if (feed == 2) then player:startEvent(0x003a); elseif (feed == 3) then player:startEvent(0x003b); elseif (feed == 4) then player:startEvent(0x003c); elseif (feed == 5) then player:startEvent(0x003f); elseif (feed == 6) then player:startEvent(0x0040); end else if (feed > 2) then player:startEvent(0x0049); end end end else if (trade:hasItemQty(GYSAHL_GREENS,1)) then player:startEvent(0x0026); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) ChocobosWounds = player:getQuestStatus(JEUNO,CHOCOBO_S_WOUNDS); if (ChocobosWounds == 0) then player:startEvent(0x003e); elseif (ChocobosWounds == 1) then feed = player:getVar("ChocobosWounds_Event"); if (feed == 1) then player:startEvent(0x0067); elseif (feed == 2) then player:startEvent(0x0033); elseif (feed == 3) then player:startEvent(0x0034); elseif (feed == 4) then player:startEvent(0x003d); elseif (feed == 5) then player:startEvent(0x002e); elseif (feed == 6) then player:startEvent(0x0037); end elseif (ChocobosWounds == 2) then player:startEvent(0x0037); else player:startEvent(0x0036); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x0039) then player:setVar("ChocobosWounds_Event", 2); player:setVar("ChocobosWounds_Day",VanadielDayOfTheYear()); player:setVar("ChocobosWounds_Year",VanadielYear()); elseif (csid == 0x003a) then player:setVar("ChocobosWounds_Event", 3); player:setVar("ChocobosWounds_Day",VanadielDayOfTheYear()); player:setVar("ChocobosWounds_Year",VanadielYear()); elseif (csid == 0x003b) then player:setVar("ChocobosWounds_Event", 4); player:setVar("ChocobosWounds_Day",VanadielDayOfTheYear()); player:setVar("ChocobosWounds_Year",VanadielYear()); player:tradeComplete(); player:startEvent(0x0063); elseif (csid == 0x003c) then player:setVar("ChocobosWounds_Event", 5); player:setVar("ChocobosWounds_Day",VanadielDayOfTheYear()); player:setVar("ChocobosWounds_Year",VanadielYear()); player:tradeComplete(); elseif (csid == 0x003f) then player:setVar("ChocobosWounds_Event", 6); player:setVar("ChocobosWounds_Day",VanadielDayOfTheYear()); player:setVar("ChocobosWounds_Year",VanadielYear()); player:tradeComplete(); elseif (csid == 0x0040) then player:addKeyItem(CHOCOBO_LICENSE); player:messageSpecial(KEYITEM_OBTAINED, CHOCOBO_LICENSE); player:setTitle(CHOCOBO_TRAINER); player:setVar("ChocobosWounds_Event", 0); player:setVar("ChocobosWounds_Day", 0); player:setVar("ChocobosWounds_Year",0); player:addFame(JEUNO,30); player:tradeComplete(); player:completeQuest(JEUNO,CHOCOBO_S_WOUNDS); end end;
gpl-3.0
jsj2008/ValyriaTear
dat/maps/layna_forest/layna_forest_south_east_map.lua
4
92662
map_data = {} -- The number of rows, and columns that compose the map map_data.num_tile_cols = 64 map_data.num_tile_rows = 48 -- The tilesets definition files used. map_data.tileset_filenames = {} map_data.tileset_filenames[1] = "dat/tilesets/wood_tileset.lua" map_data.tileset_filenames[2] = "dat/tilesets/village_exterior.lua" map_data.tileset_filenames[3] = "dat/tilesets/castle_exterior_01.lua" map_data.tileset_filenames[4] = "dat/tilesets/mountain_landscape.lua" -- The map grid to indicate walkability. 0 is walkable, 1 is not. map_data.map_grid = {} map_data.map_grid[0] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } -- The tile layers. The numbers are indeces to the tile_mappings table. map_data.layers = {} map_data.layers[0] = {} map_data.layers[0].type = "ground" map_data.layers[0].name = "Background" map_data.layers[0][0] = { 0, 0, 0, 0, 0, 2, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][1] = { 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][2] = { 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][3] = { 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][4] = { 0, 0, 0, 0, 0, 34, 20, 0, 0, 0, 0, 0, 0, 0, 0, 802, 803, -1, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 22, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][5] = { 0, 0, 0, 0, 0, 2, 20, 0, 0, 0, 0, 0, 0, 0, 0, 802, 803, -1, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 37, 38, 39, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][6] = { 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0, 942, 943, -1, 0, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][7] = { 0, 0, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 958, 959, 17, 0, 0, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][8] = { 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 34, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][14] = { 0, 0, 0, 0, 2, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 36, 0, 34, 35, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][15] = { 0, 0, 0, 2, 20, 0, 802, 803, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 35, 3, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][16] = { 0, 0, 2, 19, 36, 0, 818, 819, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 35, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0 } map_data.layers[0][17] = { 3, 3, 35, 36, 0, 0, 942, 943, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][18] = { 35, 36, 0, 0, 0, 0, 958, 959, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 35, 35, 36, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][19] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 4, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][20] = { 49, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 19, 19, 3, 3, 19, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][21] = { 65, 65, 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 35, 35, 35, 36, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0 } map_data.layers[0][22] = { 65, 65, 65, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][23] = { 65, 65, 65, 65, 49, 49, 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 139, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][24] = { 65, 65, 65, 65, 65, 65, 65, 66, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 846, 847, 846, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][25] = { 81, 81, 65, 65, 65, 65, 65, 65, 49, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 846, 862, 863, 846, 846, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][26] = { 4, 80, 81, 81, 65, 65, 65, 65, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 863, 863, 779, 780, 781, 862, 862, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][27] = { 35, 3, 4, 80, 81, 65, 65, 65, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 138, 847, 863, 779, 878, 778, 879, 780, 780, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][28] = { 49, 34, 19, 4, 80, 81, 65, 81, 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 154, 846, 779, 878, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][29] = { 65, 66, 34, 19, 4, 80, 81, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 154, 0, 878, 794, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][30] = { 65, 65, 17, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 810, 794, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][31] = { 65, 65, 65, 66, 34, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 794, 778, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 19, 4, 0, 17, 0, 0, 0, 0 } map_data.layers[0][32] = { 65, 65, 65, 66, 0, 18, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0 } map_data.layers[0][33] = { 65, 65, 65, 66, 0, 18, 36, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0 } map_data.layers[0][34] = { 65, 65, 66, 82, 0, 18, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 36, 0, 0, 0, 0, 0, 0 } map_data.layers[0][35] = { 65, 65, 66, 50, 0, 18, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 36, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][36] = { 65, 65, 65, 66, 0, 18, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 36, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][37] = { 65, 65, 65, 0, 0, 34, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][38] = { 65, 65, 66, 82, 0, 17, 18, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][39] = { 65, 65, 66, 50, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 2, 19, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][40] = { 65, 65, 65, 66, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 19, 20, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0 } map_data.layers[0][41] = { 65, 65, 66, 82, 0, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 19, 19, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][42] = { 66, 81, 82, 0, 0, 0, 0, 0, 0, 34, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 19, 35, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][43] = { 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 19, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 3, 3, 4, 2, 3, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 19, 19, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][44] = { 66, 50, 0, 0, 0, 0, 0, 0, 0, 0, 34, 19, 19, 3, 4, 0, 2, 3, 4, 0, 0, 0, 0, 2, 3, 3, 36, 34, 35, 35, 35, 36, 34, 36, 34, 19, 3, 4, 0, 2, 4, 0, 2, 4, 0, 2, 3, 19, 35, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][45] = { 65, 66, 49, 50, 0, 0, 0, 0, 0, 0, 0, 34, 35, 35, 36, 0, 34, 35, 36, 0, 2, 3, 3, 19, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 19, 19, 3, 19, 20, 0, 34, 36, 0, 34, 35, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][46] = { 65, 65, 65, 66, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 0, 0, 34, 36, 34, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 35, 36, 34, 36, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[0][47] = { 65, 65, 65, 65, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } map_data.layers[1] = {} map_data.layers[1].type = "ground" map_data.layers[1].name = "Background 2" map_data.layers[1][0] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][1] = { -1, 310, -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, 310, -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, 310, -1, -1 } map_data.layers[1][2] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, 768, 769, 770, 772, 771, 771, 772, 773, 773, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][3] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 784, 785, 786, 788, 787, 787, 788, 789, -1, -1, -1, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1 } map_data.layers[1][4] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, 800, 801, 802, -1, -1, 803, 804, 805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, 610, -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 } map_data.layers[1][5] = { -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, 313, 816, 817, 818, -1, -1, 819, 820, 821, -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, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][6] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 832, 833, 834, -1, 310, 835, 836, 837, -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, 314, -1, -1, -1, -1, -1 } map_data.layers[1][7] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 848, 849, 850, -1, -1, 851, 852, 853, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][8] = { -1, 314, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, 864, 865, 866, 990, 991, 867, 868, 869, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][9] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][10] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -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 } map_data.layers[1][11] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, -1, -1 } map_data.layers[1][12] = { -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -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, 313, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][13] = { -1, -1, -1, 314, 768, 769, 770, 771, 772, 773, -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, -1, -1, -1, -1, -1 } map_data.layers[1][14] = { 313, -1, -1, -1, 784, 785, 786, 787, 788, 789, -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, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][15] = { -1, -1, -1, -1, 800, 801, -1, -1, 804, 805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -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, 310, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][16] = { -1, -1, -1, -1, 816, 817, -1, -1, 820, 821, -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, -1, -1, -1, -1, -1 } map_data.layers[1][17] = { -1, -1, -1, -1, 832, 833, -1, -1, 836, 837, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -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 } map_data.layers[1][18] = { -1, -1, -1, -1, 848, 849, -1, -1, 852, 853, 310, -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, -1, -1, 314, -1 } map_data.layers[1][19] = { -1, -1, -1, -1, 864, 865, 990, 991, 868, 869, -1, -1, -1, -1, 314, -1, 313, -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 } map_data.layers[1][20] = { -1, -1, 313, -1, -1, -1, -1, 972, -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, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][21] = { -1, -1, 31, -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, 313, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1 } map_data.layers[1][22] = { -1, -1, -1, 31, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -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 } map_data.layers[1][23] = { -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, 313, -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 } map_data.layers[1][24] = { -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, 313, -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, 769, 771, 772, 773, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1 } map_data.layers[1][25] = { -1, 29, -1, -1, -1, -1, -1, -1, 31, -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, 784, 785, 787, 788, 789, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, -1, -1 } map_data.layers[1][26] = { -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 800, 801, 803, 804, 805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][27] = { -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 816, 817, 819, 820, 821, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][28] = { -1, 15, -1, -1, -1, 29, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 768, 769, 770, 772, -1, 914, 915, 822, 823, 824, 825, 835, 836, 837, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1 } map_data.layers[1][29] = { -1, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, 784, 785, 786, 788, 789, 930, 931, 838, 839, 840, 841, 851, 852, 853, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][30] = { -1, -1, 31, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, 310, -1, -1, -1, 800, 801, 802, -1, -1, 946, 947, 854, 855, 856, 857, 867, 868, 869, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][31] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 816, 817, -1, -1, 819, 820, 821, 870, 871, 872, 873, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][32] = { -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, 832, 833, 942, 943, 835, 836, 837, -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 } map_data.layers[1][33] = { -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, 848, 849, 958, 959, 851, 852, 853, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1 } map_data.layers[1][34] = { -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, -1, -1, -1, -1, -1, 864, 865, 990, 991, 867, 868, 869, -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 } map_data.layers[1][35] = { -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -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 } map_data.layers[1][36] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -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, -1, -1, -1, -1, -1 } map_data.layers[1][37] = { -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][38] = { -1, -1, 46, -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, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][39] = { -1, -1, 14, -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, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1 } map_data.layers[1][40] = { -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, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1 } map_data.layers[1][41] = { -1, -1, 46, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][42] = { 46, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 310, -1, -1 } map_data.layers[1][43] = { -1, 314, -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, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1 } map_data.layers[1][44] = { 14, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[1][45] = { -1, 14, -1, -1, -1, 310, -1, -1, -1, 313, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -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, 314, -1 } map_data.layers[1][46] = { -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, 310, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1 } map_data.layers[1][47] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2] = {} map_data.layers[2].type = "ground" map_data.layers[2].name = "Background 3" map_data.layers[2][0] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[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, -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 } map_data.layers[2][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, -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 } map_data.layers[2][3] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][4] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][5] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][6] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][7] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][8] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][9] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][10] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][11] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][12] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][13] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][14] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][15] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][16] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][17] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][18] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][19] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][20] = { -1, -1, 15, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][21] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][22] = { -1, -1, -1, -1, 15, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][23] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][24] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][25] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][26] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][27] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][28] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][29] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][30] = { -1, -1, 14, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][31] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][32] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][33] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][34] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][35] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][36] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][37] = { -1, -1, -1, 31, -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][38] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][39] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][40] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][41] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][42] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][43] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][44] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][45] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][46] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[2][47] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3] = {} map_data.layers[3].type = "sky" map_data.layers[3].name = "Sky" map_data.layers[3][0] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][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, -1, -1, -1, -1, -1, -1, -1, -1, -1, 578, -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 } map_data.layers[3][3] = { -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, 594, -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 } map_data.layers[3][4] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][5] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][6] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][7] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][8] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][9] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][10] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][11] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][12] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][13] = { -1, -1, -1, -1, 768, -1, -1, -1, -1, 773, -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, -1, -1, -1, -1, -1 } map_data.layers[3][14] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][15] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][16] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][17] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][18] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][19] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][20] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][21] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][22] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][23] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][24] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][25] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][26] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][27] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][28] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][29] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][30] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][31] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][32] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][33] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][34] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][35] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][36] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][37] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][38] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][39] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][40] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][41] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][42] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][43] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][44] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][45] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][46] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 } map_data.layers[3][47] = { -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, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }
gpl-2.0
madpilot78/ntopng
scripts/lua/rest/v2/get/host/dscp/stats.lua
2
1469
-- -- (C) 2013-21 - ntop.org -- local dirs = ntop.getDirs() package.path = dirs.installdir .. "/scripts/lua/modules/?.lua;" .. package.path require "lua_utils" local stats_utils = require("stats_utils") local rest_utils = require("rest_utils") local dscp_consts = require "dscp_consts" -- -- Read DSCP statistics for a hsot -- Example: curl -u admin:admin -H "Content-Type: application/json" -d '{"ifid": "1", "host" : "192.168.56.103", "direction": "recv"}' http://localhost:3000/lua/rest/v2/get/host/dscp/stats.lua -- -- NOTE: in case of invalid login, no error is returned but redirected to login -- local rc = rest_utils.consts.success.ok local ifid = _GET["ifid"] local host_info = url2hostinfo(_GET) local direction = _GET["direction"] if isEmptyString(ifid) then rc = rest_utils.consts.err.invalid_interface rest_utils.answer(rc) return end local received_stats = false if direction == "recv" then received_stats = true end interface.select(ifid) local res = {} local tot = 0 local stats = interface.getHostInfo(host_info["host"], host_info["vlan"]) if stats == nil then rest_utils.answer(rest_utils.consts.err.not_found) return end for key, value in pairsByKeys(stats.dscp, asc) do res[#res + 1] = { label = dscp_consts.ds_class_descr(key), value = ternary(received_stats, value['packets.rcvd'], value['packets.sent']) } end local collapsed = stats_utils.collapse_stats(res, 1) rest_utils.answer(rc, collapsed)
gpl-3.0
pakoito/ToME---t-engine4
game/modules/tome/data/zones/illusory-castle/zone.lua
3
1910
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org return { name = "Illusory Castle", level_range = {25, 30}, level_scheme = "player", max_level = 5, decay = {300, 800}, actor_adjust_level = function(zone, level, e) return zone.base_level + e:getRankLevelAdjust() + level.level-1 + rng.range(-1,2) end, width = 120, height = 120, all_remembered = true, all_lited = true, -- persistent = "zone", generator = { map = { -- class = "engine.generator.map.Rooms", class = "engine.generator.map.TileSet", tileset = {"3x3/base", "3x3/tunnel", "3x3/windy_tunnel"}, tunnel_chance = 100, center_room = 1, ['.'] = "FLOOR", ['#'] = "WALL", ['+'] = "DOOR", ["'"] = "DOOR", up = "UP", down = "DOWN", door = "DOOR", }, actor = { class = "mod.class.generator.actor.Random", -- nb_npc = {20*5, 20*5}, nb_npc = {0, 0}, }, object = { class = "engine.generator.object.Random", -- nb_object = {6*5, 9*5}, nb_object = {0, 0}, }, trap = { class = "engine.generator.trap.Random", -- nb_trap = {6*8, 9*8}, nb_trap = {0, 0}, }, }, levels = { [1] = { generator = { map = { up = "UP_WILDERNESS", }, }, }, }, }
gpl-3.0
jkassman/wesnoth
data/ai/micro_ais/cas/ca_swarm_move.lua
26
2504
local H = wesnoth.require "lua/helper.lua" local AH = wesnoth.require "ai/lua/ai_helper.lua" local ca_swarm_move = {} function ca_swarm_move:evaluation(ai, cfg) local units = wesnoth.get_units { side = wesnoth.current.side } for _,unit in ipairs(units) do if (unit.moves > 0) then return cfg.ca_score end end return 0 end function ca_swarm_move:execution(ai, cfg) local enemy_distance = cfg.enemy_distance or 5 local vision_distance = cfg.vision_distance or 12 -- If no close enemies, swarm will move semi-randomly, staying close together, but away from enemies local all_units = wesnoth.get_units { side = wesnoth.current.side } local units, units_no_moves = {}, {} for _,unit in ipairs(all_units) do if (unit.moves > 0) then table.insert(units, unit) else table.insert(units_no_moves, unit) end end local enemies = wesnoth.get_units { { "filter_side", { { "enemy_of", {side = wesnoth.current.side } } } } } -- Pick one unit at random, swarm does not move systematically local unit = units[math.random(#units)] -- Find best place for that unit to move to local best_hex = AH.find_best_move(unit, function(x, y) local rating = 0 -- Only units within 'vision_distance' count for rejoining local close_units_no_moves = {} for _,unit_noMP in ipairs(units_no_moves) do if (H.distance_between(unit.x, unit.y, unit_noMP.x, unit_noMP.y) <= vision_distance) then table.insert(close_units_no_moves, unit_noMP) end end -- If all units on the side have moves left, simply go to a hex far away if (not close_units_no_moves[1]) then rating = rating + H.distance_between(x, y, unit.x, unit.y) else -- Otherwise, minimize distance from units that have already moved for _,close_unit in ipairs(close_units_no_moves) do rating = rating - H.distance_between(x, y, close_unit.x, close_unit.y) end end -- We also try to stay out of attack range of any enemy for _,enemy in ipairs(enemies) do local dist = H.distance_between(x, y, enemy.x, enemy.y) if (dist < enemy_distance) then rating = rating - (enemy_distance - dist) * 10. end end return rating end) AH.movefull_stopunit(ai, unit, best_hex) end return ca_swarm_move
gpl-2.0
SammyJames/LootDrop
Libs/LibAddonMenu-2.0/controls/panel.lua
2
5170
--[[panelData = { type = "panel", name = "Window Title", displayName = "My Longer Window Title", --(optional) (can be useful for long addon names or if you want to colorize it) author = "Seerah", --(optional) version = "2.0", --(optional) slashCommand = "/myaddon", --(optional) will register a keybind to open to this panel (don't forget to include the slash!) registerForRefresh = true, --boolean (optional) (will refresh all options controls when a setting is changed and when the panel is shown) registerForDefaults = true, --boolean (optional) (will set all options controls back to default values) resetFunc = function() print("defaults reset") end, --(optional) custom function to run after settings are reset to defaults } ]] local widgetVersion = 8 local LAM = LibStub("LibAddonMenu-2.0") if not LAM:RegisterWidget("panel", widgetVersion) then return end local wm = WINDOW_MANAGER local cm = CALLBACK_MANAGER local function RefreshPanel(control) local panel = control.panel or control --callback can be fired by a single control or by the panel showing local panelControls = panel.controlsToRefresh for i = 1, #panelControls do local updateControl = panelControls[i] if updateControl ~= control then if updateControl.UpdateValue then updateControl:UpdateValue() end if updateControl.UpdateDisabled then updateControl:UpdateDisabled() end end end end local function ForceDefaults(panel) local panelControls = panel.controlsToRefresh for i = 1, #panelControls do local updateControl = panelControls[i] if updateControl.UpdateValue and updateControl.data.default ~= nil then updateControl:UpdateValue(true) end end if panel.data.resetFunc then panel.data.resetFunc() end cm:FireCallbacks("LAM-RefreshPanel", panel) end ESO_Dialogs["LAM_DEFAULTS"] = { title = { text = SI_OPTIONS_RESET_TITLE, }, mainText = { text = SI_OPTIONS_RESET_PROMPT, align = TEXT_ALIGN_CENTER, }, buttons = { [1] = { text = SI_OPTIONS_RESET, callback = function(dialog) ForceDefaults(dialog.data[1]) end, }, [2] = { text = SI_DIALOG_CANCEL, }, }, } local callbackRegistered = false LAMCreateControl.scrollCount = LAMCreateControl.scrollCount or 1 function LAMCreateControl.panel(parent, panelData, controlName) local control = wm:CreateTopLevelWindow(controlName) control:SetParent(parent) control.bg = wm:CreateControl(nil, control, CT_BACKDROP) local bg = control.bg bg:SetAnchorFill() bg:SetEdgeTexture("EsoUI\\Art\\miscellaneous\\borderedinsettransparent_edgefile.dds", 128, 16) bg:SetCenterColor(0, 0, 0, 0) control.label = wm:CreateControlFromVirtual(nil, control, "ZO_Options_SectionTitleLabel") local label = control.label label:SetAnchor(TOPLEFT, control, TOPLEFT, 10, 10) label:SetText(panelData.displayName and panelData.displayName or panelData.name) if panelData.author or panelData.version then control.info = wm:CreateControl(nil, control, CT_LABEL) local info = control.info info:SetFont("$(CHAT_FONT)|14|soft-shadow-thin") info:SetColor(ZO_HIGHLIGHT_TEXT:UnpackRGBA()) info:SetHeight(13) info:SetAnchor(TOPRIGHT, control, BOTTOMRIGHT, -5, 2) if panelData.author and panelData.version then --info:SetText("Version: "..panelData.version.." - "..GetString(SI_ADDON_MANAGER_AUTHOR)..": "..panelData.author) info:SetText(string.format("Version: %s - %s: %s", panelData.version, GetString(SI_ADDON_MANAGER_AUTHOR), panelData.author)) elseif panelData.author then info:SetText(string.format("%s: %s", GetString(SI_ADDON_MANAGER_AUTHOR), panelData.author)) else info:SetText("Version: "..panelData.version) end end control.container = wm:CreateControlFromVirtual("LAMAddonPanelContainer"..LAMCreateControl.scrollCount, control, "ZO_ScrollContainer") LAMCreateControl.scrollCount = LAMCreateControl.scrollCount + 1 local container = control.container container:SetAnchor(TOPLEFT, label, BOTTOMLEFT, 0, 20) container:SetAnchor(BOTTOMRIGHT, control, BOTTOMRIGHT, -3, -3) control.scroll = GetControl(control.container, "ScrollChild") control.scroll:SetResizeToFitPadding(0, 20) if panelData.registerForDefaults then control.defaultButton = wm:CreateControlFromVirtual(nil, control, "ZO_DefaultTextButton") local defaultButton = control.defaultButton defaultButton:SetFont("ZoFontDialogKeybindDescription") defaultButton:SetHorizontalAlignment(TEXT_ALIGN_LEFT) --defaultButton:SetText("Reset To Defaults") defaultButton:SetText(GetString(SI_OPTIONS_RESET_TITLE)) defaultButton:SetDimensions(200, 30) defaultButton:SetAnchor(TOPLEFT, control, BOTTOMLEFT, 0, 2) defaultButton:SetHandler("OnClicked", function() ZO_Dialogs_ShowDialog("LAM_DEFAULTS", {control}) end) end if panelData.registerForRefresh and not callbackRegistered then --don't want to register our callback more than once cm:RegisterCallback("LAM-RefreshPanel", RefreshPanel) callbackRegistered = true end control.data = panelData control.controlsToRefresh = {} return control end
mit
eriche2016/nn
WeightedEuclidean.lua
43
8173
local WeightedEuclidean, parent = torch.class('nn.WeightedEuclidean', 'nn.Module') function WeightedEuclidean:__init(inputSize,outputSize) parent.__init(self) self.weight = torch.Tensor(inputSize,outputSize) self.gradWeight = torch.Tensor(inputSize,outputSize) -- each template (output dim) has its own diagonal covariance matrix self.diagCov = torch.Tensor(inputSize,outputSize) self.gradDiagCov = torch.Tensor(inputSize,outputSize) self:reset() end function WeightedEuclidean:reset(stdv) if stdv then stdv = stdv * math.sqrt(3) else stdv = 1./math.sqrt(self.weight:size(1)) end self.weight:uniform(-stdv, stdv) self.diagCov:fill(1) end local function view(res, src, ...) local args = {...} if src:isContiguous() then res:view(src, table.unpack(args)) else res:reshape(src, table.unpack(args)) end end function WeightedEuclidean:updateOutput(input) -- lazy-initialize self._diagCov = self._diagCov or self.output.new() self._input = self._input or input.new() self._weight = self._weight or self.weight.new() self._expand = self._expand or self.output.new() self._expand2 = self._expand or self.output.new() self._expand3 = self._expand3 or self.output.new() self._repeat = self._repeat or self.output.new() self._repeat2 = self._repeat2 or self.output.new() self._repeat3 = self._repeat3 or self.output.new() local inputSize, outputSize = self.weight:size(1), self.weight:size(2) -- y_j = || c_j * (w_j - x) || if input:dim() == 1 then view(self._input, input, inputSize, 1) self._expand:expandAs(self._input, self.weight) self._repeat:resizeAs(self._expand):copy(self._expand) self._repeat:add(-1, self.weight) self._repeat:cmul(self.diagCov) self.output:norm(self._repeat, 2, 1) self.output:resize(outputSize) elseif input:dim() == 2 then local batchSize = input:size(1) view(self._input, input, batchSize, inputSize, 1) self._expand:expand(self._input, batchSize, inputSize, outputSize) -- make the expanded tensor contiguous (requires lots of memory) self._repeat:resizeAs(self._expand):copy(self._expand) self._weight:view(self.weight, 1, inputSize, outputSize) self._expand2:expandAs(self._weight, self._repeat) self._diagCov:view(self.diagCov, 1, inputSize, outputSize) self._expand3:expandAs(self._diagCov, self._repeat) if torch.type(input) == 'torch.CudaTensor' then -- requires lots of memory, but minimizes cudaMallocs and loops self._repeat2:resizeAs(self._expand2):copy(self._expand2) self._repeat:add(-1, self._repeat2) self._repeat3:resizeAs(self._expand3):copy(self._expand3) self._repeat:cmul(self._repeat3) else self._repeat:add(-1, self._expand2) self._repeat:cmul(self._expand3) end self.output:norm(self._repeat, 2, 2) self.output:resize(batchSize, outputSize) else error"1D or 2D input expected" end return self.output end function WeightedEuclidean:updateGradInput(input, gradOutput) if not self.gradInput then return end self._div = self._div or input.new() self._output = self._output or self.output.new() self._expand4 = self._expand4 or input.new() self._gradOutput = self._gradOutput or input.new() if not self.fastBackward then self:updateOutput(input) end local inputSize, outputSize = self.weight:size(1), self.weight:size(2) --[[ dy_j -2 * c_j * c_j * (w_j - x) c_j * c_j * (x - w_j) ---- = -------------------------- = --------------------- dx 2 || c_j * (w_j - x) || y_j --]] -- to prevent div by zero (NaN) bugs self._output:resizeAs(self.output):copy(self.output):add(0.0000001) view(self._gradOutput, gradOutput, gradOutput:size()) self._div:cdiv(gradOutput, self._output) if input:dim() == 1 then self._div:resize(1, outputSize) self._expand4:expandAs(self._div, self.weight) if torch.type(input) == 'torch.CudaTensor' then self._repeat2:resizeAs(self._expand4):copy(self._expand4) self._repeat2:cmul(self._repeat) else self._repeat2:cmul(self._repeat, self._expand4) end self._repeat2:cmul(self.diagCov) self.gradInput:sum(self._repeat2, 2) self.gradInput:resizeAs(input) elseif input:dim() == 2 then local batchSize = input:size(1) self._div:resize(batchSize, 1, outputSize) self._expand4:expand(self._div, batchSize, inputSize, outputSize) if torch.type(input) == 'torch.CudaTensor' then self._repeat2:resizeAs(self._expand4):copy(self._expand4) self._repeat2:cmul(self._repeat) self._repeat2:cmul(self._repeat3) else self._repeat2:cmul(self._repeat, self._expand4) self._repeat2:cmul(self._expand3) end self.gradInput:sum(self._repeat2, 3) self.gradInput:resizeAs(input) else error"1D or 2D input expected" end return self.gradInput end function WeightedEuclidean:accGradParameters(input, gradOutput, scale) local inputSize, outputSize = self.weight:size(1), self.weight:size(2) scale = scale or 1 --[[ dy_j 2 * c_j * c_j * (w_j - x) c_j * c_j * (w_j - x) ---- = ------------------------- = --------------------- dw_j 2 || c_j * (w_j - x) || y_j dy_j 2 * c_j * (w_j - x)^2 c_j * (w_j - x)^2 ---- = ----------------------- = ----------------- dc_j 2 || c_j * (w_j - x) || y_j --]] -- assumes a preceding call to updateGradInput if input:dim() == 1 then self.gradWeight:add(-scale, self._repeat2) self._repeat:cdiv(self.diagCov) self._repeat:cmul(self._repeat) self._repeat:cmul(self.diagCov) if torch.type(input) == 'torch.CudaTensor' then self._repeat2:resizeAs(self._expand4):copy(self._expand4) self._repeat2:cmul(self._repeat) else self._repeat2:cmul(self._repeat, self._expand4) end self.gradDiagCov:add(self._repeat2) elseif input:dim() == 2 then self._sum = self._sum or input.new() self._sum:sum(self._repeat2, 1) self._sum:resize(inputSize, outputSize) self.gradWeight:add(-scale, self._sum) if torch.type(input) == 'torch.CudaTensor' then -- requires lots of memory, but minimizes cudaMallocs and loops self._repeat:cdiv(self._repeat3) self._repeat:cmul(self._repeat) self._repeat:cmul(self._repeat3) self._repeat2:resizeAs(self._expand4):copy(self._expand4) self._repeat:cmul(self._repeat2) else self._repeat:cdiv(self._expand3) self._repeat:cmul(self._repeat) self._repeat:cmul(self._expand3) self._repeat:cmul(self._expand4) end self._sum:sum(self._repeat, 1) self._sum:resize(inputSize, outputSize) self.gradDiagCov:add(scale, self._sum) else error"1D or 2D input expected" end end function WeightedEuclidean:type(type, tensorCache) if type then -- prevent premature memory allocations self._input = nil self._output = nil self._gradOutput = nil self._weight = nil self._div = nil self._sum = nil self._expand = nil self._expand2 = nil self._expand3 = nil self._expand4 = nil self._repeat = nil self._repeat2 = nil self._repeat3 = nil end return parent.type(self, type, tensorCache) end function WeightedEuclidean:parameters() return {self.weight, self.diagCov}, {self.gradWeight, self.gradDiagCov} end function WeightedEuclidean:accUpdateGradParameters(input, gradOutput, lr) local gradWeight = self.gradWeight local gradDiagCov = self.gradDiagCov self.gradWeight = self.weight self.gradDiagCov = self.diagCov self:accGradParameters(input, gradOutput, -lr) self.gradWeight = gradWeight self.gradDiagCov = gradDiagCov end
bsd-3-clause
purebn/ShadowBot
plugins/plugins.1.lua
325
6164
do -- Returns the key (index) in the config.enabled_plugins table local function plugin_enabled( name ) for k,v in pairs(_config.enabled_plugins) do if name == v then return k end end -- If not found return false end -- Returns true if file exists in plugins folder local function plugin_exists( name ) for k,v in pairs(plugins_names()) do if name..'.lua' == v then return true end end return false end local function list_all_plugins(only_enabled) local text = '' local nsum = 0 for k, v in pairs( plugins_names( )) do -- ✔ enabled, ❌ disabled local status = '❌' nsum = nsum+1 nact = 0 -- Check if is enabled for k2, v2 in pairs(_config.enabled_plugins) do if v == v2..'.lua' then status = '✔' end nact = nact+1 end if not only_enabled or status == '✔' then -- get the name v = string.match (v, "(.*)%.lua") text = text..nsum..'. '..v..' '..status..'\n' end end local text = text..'\nThere are '..nsum..' plugins installed.\n'..nact..' plugins enabled and '..nsum-nact..' disabled' return text end local function list_plugins(only_enabled) local text = '' local nsum = 0 for k, v in pairs( plugins_names( )) do -- ✔ enabled, ❌ disabled local status = '❌' nsum = nsum+1 nact = 0 -- Check if is enabled for k2, v2 in pairs(_config.enabled_plugins) do if v == v2..'.lua' then status = '✔' end nact = nact+1 end if not only_enabled or status == '✔' then -- get the name v = string.match (v, "(.*)%.lua") text = text..v..' '..status..'\n' end end local text = text..'\n'..nact..' plugins enabled from '..nsum..' plugins installed.' return text end local function reload_plugins( ) plugins = {} load_plugins() return list_plugins(true) end local function enable_plugin( plugin_name ) print('checking if '..plugin_name..' exists') -- Check if plugin is enabled if plugin_enabled(plugin_name) then return 'Plugin '..plugin_name..' is enabled' end -- Checks if plugin exists if plugin_exists(plugin_name) then -- Add to the config table table.insert(_config.enabled_plugins, plugin_name) print(plugin_name..' added to _config table') save_config() -- Reload the plugins return reload_plugins( ) else return 'Plugin '..plugin_name..' does not exists' end end local function disable_plugin( name, chat ) -- Check if plugins exists if not plugin_exists(name) then return 'Plugin '..name..' does not exists' end local k = plugin_enabled(name) -- Check if plugin is enabled if not k then return 'Plugin '..name..' not enabled' end -- Disable and reload table.remove(_config.enabled_plugins, k) save_config( ) return reload_plugins(true) end local function disable_plugin_on_chat(receiver, plugin) if not plugin_exists(plugin) then return "Plugin doesn't exists" end if not _config.disabled_plugin_on_chat then _config.disabled_plugin_on_chat = {} end if not _config.disabled_plugin_on_chat[receiver] then _config.disabled_plugin_on_chat[receiver] = {} end _config.disabled_plugin_on_chat[receiver][plugin] = true save_config() return 'Plugin '..plugin..' disabled on this chat' end local function reenable_plugin_on_chat(receiver, plugin) if not _config.disabled_plugin_on_chat then return 'There aren\'t any disabled plugins' end if not _config.disabled_plugin_on_chat[receiver] then return 'There aren\'t any disabled plugins for this chat' end if not _config.disabled_plugin_on_chat[receiver][plugin] then return 'This plugin is not disabled' end _config.disabled_plugin_on_chat[receiver][plugin] = false save_config() return 'Plugin '..plugin..' is enabled again' end local function run(msg, matches) -- Show the available plugins if matches[1] == '!plugins' and is_sudo(msg) then --after changed to moderator mode, set only sudo return list_all_plugins() end -- Re-enable a plugin for this chat if matches[1] == 'enable' and matches[3] == 'chat' then local receiver = get_receiver(msg) local plugin = matches[2] print("enable "..plugin..' on this chat') return reenable_plugin_on_chat(receiver, plugin) end -- Enable a plugin if matches[1] == 'enable' and is_sudo(msg) then --after changed to moderator mode, set only sudo local plugin_name = matches[2] print("enable: "..matches[2]) return enable_plugin(plugin_name) end -- Disable a plugin on a chat if matches[1] == 'disable' and matches[3] == 'chat' then local plugin = matches[2] local receiver = get_receiver(msg) print("disable "..plugin..' on this chat') return disable_plugin_on_chat(receiver, plugin) end -- Disable a plugin if matches[1] == 'disable' and is_sudo(msg) then --after changed to moderator mode, set only sudo if matches[2] == 'plugins' then return 'This plugin can\'t be disabled' end print("disable: "..matches[2]) return disable_plugin(matches[2]) end -- Reload all the plugins! if matches[1] == 'reload' and is_sudo(msg) then --after changed to moderator mode, set only sudo return reload_plugins(true) end end return { description = "Plugin to manage other plugins. Enable, disable or reload.", usage = { moderator = { "!plugins disable [plugin] chat : disable plugin only this chat.", "!plugins enable [plugin] chat : enable plugin only this chat.", }, sudo = { "!plugins : list all plugins.", "!plugins enable [plugin] : enable plugin.", "!plugins disable [plugin] : disable plugin.", "!plugins reload : reloads all plugins." }, }, patterns = { "^!plugins$", "^!plugins? (enable) ([%w_%.%-]+)$", "^!plugins? (disable) ([%w_%.%-]+)$", "^!plugins? (enable) ([%w_%.%-]+) (chat)", "^!plugins? (disable) ([%w_%.%-]+) (chat)", "^!plugins? (reload)$" }, run = run, moderated = true, -- set to moderator mode --privileged = true } end
gpl-2.0
pakoito/ToME---t-engine4
game/modules/tome/data/gfx/particles/iceflash.lua
3
1989
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org local nb = 0 return { generator = function() local radius = radius local sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2 local ad = rng.float(0, 360) local a = math.rad(ad) local r = rng.float(sradius - 5, sradius) local x = r * math.cos(a) local y = r * math.sin(a) local bx = math.floor(x / engine.Map.tile_w) local by = math.floor(y / engine.Map.tile_h) local static = rng.percent(40) return { trail = 1, life = 24, size = 3, sizev = static and 0.05 or 0.15, sizea = 0, x = x, xv = 0, xa = 0, y = y, yv = 0, ya = 0, dir = static and a + math.rad(90 - rng.range(10, 20)) or a, dirv = 0, dira = 0, vel = static and -2 or 0.5 * (-1-nb) * radius / 2.7, velv = 0, vela = static and -0.01 or rng.float(-0.3, -0.2) * 0.3, r = 0, rv = 0, ra = 0, g = rng.range(170, 210)/255, gv = 0, ga = 0, b = rng.range(200, 255)/255, gv = 0, ga = 0, a = rng.range(230, 225)/255, av = 0, aa = 0, } end, }, function(self) if nb < 5 then self.ps:emit(radius*266) nb = nb + 1 self.ps:emit(radius*266) nb = nb + 1 self.ps:emit(radius*266) nb = nb + 1 self.ps:emit(radius*266) nb = nb + 1 self.ps:emit(radius*266) nb = nb + 1 end end, 5*radius*266
gpl-3.0
osamaalbsraoy/osama_albsraoy1989
plugins/insta.lua
1
4158
local access_token = "3084249803.280d5d7.999310365c8248f8948ee0f6929c2f02" -- your api key local function instagramUser(msg, query) local receiver = get_receiver(msg) local url = "https://api.instagram.com/v1/users/search?q="..URL.escape(query).."&access_token="..access_token local jstr, res = https.request(url) if res ~= 200 then return "No Connection" end local jdat = json:decode(jstr) if #jdat.data == 0 then send_msg(receiver,"#Error\nUsername not found",ok_cb,false) end if jdat.meta.error_message then send_msg(receiver,"#Error\n"..jdat.meta.error_message,ok_cb,false) end local id = jdat.data[1].id local gurl = "https://api.instagram.com/v1/users/"..id.."/?access_token="..access_token local ress = https.request(gurl) local user = json:decode(ress) if user.meta.error_message then send_msg(receiver,"#Error\n"..user.meta.error_message,ok_cb,false) end local text = '' if user.data.bio ~= '' then text = text.."Username: "..user.data.username:upper().."\n\n" else text = text.."Username: "..user.data.username:upper().."\n" end if user.data.bio ~= '' then text = text..user.data.bio.."\n\n" end if user.data.full_name ~= '' then text = text.."Name: "..user.data.full_name.."\n" end text = text.."Media Count: "..user.data.counts.media.."\n" text = text.."Following: "..user.data.counts.follows.."\n" text = text.."Followers: "..user.data.counts.followed_by.."\n" if user.data.website ~= '' then text = text.."Website: "..user.data.website.."\n" end text = text.."\n@hunter18k" local file_path = download_to_file(user.data.profile_picture,"insta.png") -- disable this line if you want to send profile photo as sticker --local file_path = download_to_file(user.data.profile_picture,"insta.webp") -- enable this line if you want to send profile photo as sticker local cb_extra = {file_path=file_path} local mime_type = mimetype.get_content_type_no_sub(ext) send_photo(receiver, file_path, rmtmp_cb, cb_extra) -- disable this line if you want to send profile photo as sticker --send_document(receiver, file_path, rmtmp_cb, cb_extra) -- enable this line if you want to send profile photo as sticker send_msg(receiver,text,ok_cb,false) end local function instagramMedia(msg, query) local receiver = get_receiver(msg) local url = "https://api.instagram.com/v1/media/shortcode/"..URL.escape(query).."?access_token="..access_token local jstr, res = https.request(url) if res ~= 200 then return "No Connection" end local jdat = json:decode(jstr) if jdat.meta.error_message then send_msg(receiver,"#Error\n"..jdat.meta.error_type.."\n"..jdat.meta.error_message,ok_cb,false) end local text = '' local data = '' if jdat.data.caption then data = jdat.data.caption text = text.."Username: "..data.from.username:upper().."\n\n" text = text..data.from.full_name.."\n\n" text = text..data.text.."\n\n" text = text.."Like Count: "..jdat.data.likes.count.."\n" else text = text.."Username: "..jdat.data.user.username:upper().."\n" text = text.."Name: "..jdat.data.user.full_name.."\n" text = text.."Like Count: "..jdat.data.likes.count.."\n" end text = text.."\n@hunter18k" send_msg(receiver,text,ok_cb,false) end local function run(msg, matches) if matches[1] == "insta" and not matches[3] then return instagramUser(msg,matches[2]) end if matches[1] == "insta" and matches[3] then local media = matches[3] if string.match(media , '/') then media = media:gsub("/", "") end return instagramMedia(msg,media) end end return { patterns = { "^([Ii]nsta) ([Hh]ttps://www.instagram.com/p/)([^%s]+)$", "^([Ii]nsta) ([Hh]ttps://instagram.com/p/)([^%s]+)$", "^([Ii]nsta) ([Hh]ttp://www.instagram.com/p/)([^%s]+)$", "^([Ii]nsta) ([Hh]ttp://instagram.com/p/)([^%s]+)$", "^([Ii]nsta) ([^%s]+)$", "^(انستا) ([Hh]ttps://www.instagram.com/p/)([^%s]+)$", "^(انستا) ([Hh]ttps://instagram.com/p/)([^%s]+)$", "^(انستا) ([Hh]ttp://www.instagram.com/p/)([^%s]+)$", "^(انستا) ([Hh]ttp://instagram.com/p/)([^%s]+)$", "^(انستا) ([^%s]+)$", "^([ }, run = run }
gpl-2.0
NPLPackages/paracraft
script/apps/Aries/Creator/Game/Test/test_block_engine.lua
1
7626
--[[ Title: test block engine Author(s): LiXizhi Date: 2012/10/20 Desc: use the lib: ------------------------------------------------------------ NPL.load("(gl)script/apps/Aries/Creator/Game/Test/test_block_engine.lua"); local Test = commonlib.gettable("MyCompany.Aries.Game.BlockEngine.Test") Test.TestInit() ------------------------------------------------------- ]] NPL.load("(gl)script/apps/Aries/Creator/Game/block_engine.lua"); NPL.load("(gl)script/apps/Aries/Creator/Game/blocks/block_types.lua"); local block_types = commonlib.gettable("MyCompany.Aries.Game.block_types") local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local Test = commonlib.gettable("MyCompany.Aries.Game.BlockEngine.Test") ----------------------------------- -- a fake terrain engine just to emulate C++ ParaTerrain interface ----------------------------------- local Fake_ParaTerrain = commonlib.gettable("MyCompany.Aries.Game.Fake_ParaTerrain") Fake_ParaTerrain.Assets = { ["solid_block"] = "model/common/editor/scalebox.x", } -- get block type at the given real world coordinate -- @param x, y, z: real world coordinates. -- @return -1 means nil, 0 means empty, 1 means opaque block, etc. function Fake_ParaTerrain.GetBlockType(x, y, z) return BlockEngine:GetBlockTypeInCache(x, y, z); end -- similar to GetBlockType except that index is block coordinates is uint16 -- @param x, y, z: block index function Fake_ParaTerrain.GetBlockTypeIdx(x, y, z) return BlockEngine:GetBlockTypeInCacheIdx(x, y, z); end -- one can call this function to create or remove new block at the given index. function Fake_ParaTerrain.SetBlockType(x, y, z, type_id) if(not x) then log("error setting block type, because x is nil\n") end BlockEngine:SetBlockAttributeInCache(x,y,z, "type", type_id); local function RemoveIfExist_(x,y,z) local obj_id = BlockEngine:GetBlockAttributeInCache(x, y, z, "obj_id"); if(obj_id) then local obj = ParaScene.GetObject(obj_id); ParaScene.Delete(obj); end end local names = block_types.names; if(type_id == names.block) then RemoveIfExist_(x,y,z); -- use a real block to simulate it. local x, y, z = BlockEngine:GetBlockCenter(x,y,z) local _asset = ParaAsset.LoadStaticMesh("", Fake_ParaTerrain.Assets["solid_block"]); obj = ParaScene.CreateMeshPhysicsObject("block", _asset, 1,1,1,false, "5,0,0,0,8,0,0,0,5,0,0,0"); obj:SetFacing(0); obj:SetPosition(x, y, z); obj:GetAttributeObject():SetField("progress", 1); ParaScene.Attach(obj); BlockEngine:SetBlockAttributeInCache(x,y,z, "obj_id", obj:GetID()); elseif(type_id == nil or type_id == names.null or type_id == names.empty) then -- remove it RemoveIfExist_(x,y,z); elseif(type_id == names.torch) then -- TODO: more end end -- @param name: supported attributes are like "type", "texture", ... -- one can use this function to create or destroy a block. function Fake_ParaTerrain.GetBlockTemplateAtt(templateId, name,value) local params = block_types.create_get_type(templateId); return params[name]; end -- set the block template. usually this function is only called when a game world is first loaded -- when all block types are loaded before a game world start. function Fake_ParaTerrain.SetBlockTemplateAtt(templateId, name,value) local params = block_types.create_get_type(templateId); params[name] = value; end -- ray tracing from a given vector with length. -- return the block center position, hit side id(0-5), hit position, hit length. -- such as: {pos={1,0,1}, side=2, hitpos={1,0,1}, length=10} function Fake_ParaTerrain.BlockPicking(point, direction, length) end -- mouse picking the current location. function Fake_ParaTerrain.MousePick(fMaxDistance, sFilterFunc) end --get the highest block's y pos from x,z. -- @return float number function Fake_ParaTerrain.BlockGetElevation(x,z) end -- return a list of block positions that matches a search condition within a given radius of a point. -- @param search_name: -- "backtrace_nil": searching for the closest nil blocks. -- "portal": searching for the closest portal object. the portal object emit sky light in the column it stays. (It can penetrate all blocks) -- @param search_params: nil or a table of search params -- @return nil or an array of point {} function Fake_ParaTerrain.SearchBlocks(point, radius, search_name, search_params) end ------------------------------------- -- below are test cases ------------------------------------- -- test case: init function Test.TestInit() NPL.load("(gl)script/apps/Aries/Creator/Game/Test/test_block_engine.lua"); NPL.load("(gl)script/apps/Aries/Creator/Game/block_engine.lua"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local Fake_ParaTerrain = commonlib.gettable("MyCompany.Aries.Game.Fake_ParaTerrain") BlockEngine:Connect(); BlockEngine:UpdateEyePosition(20001, 0, 20002); BlockEngine:Dump(); echo("testing fake terrain"); echo({Fake_ParaTerrain.GetBlockType(20000, 0, 20000)}); Fake_ParaTerrain.SetBlockAttribute(20000, 0, 20000, "type", 1); Fake_ParaTerrain.SetBlockAttribute(20001.5, 0, 20000, "type", 0); echo({Fake_ParaTerrain.GetBlockType(20000, 0, 20000)}); echo({Fake_ParaTerrain.GetBlockType(20001.5, 0, 20000)}); BlockEngine:Disconnect(); end -- test coordinate positions function Test.TestConversion() NPL.load("(gl)script/apps/Aries/Creator/Game/Test/test_block_engine.lua"); NPL.load("(gl)script/apps/Aries/Creator/Game/block_engine.lua"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local Fake_ParaTerrain = commonlib.gettable("MyCompany.Aries.Game.Fake_ParaTerrain") BlockEngine:Connect(); echo({BlockEngine:block(20001, 0, 20002)}); echo({BlockEngine:GetBlockCenter(20001, 0, 20002)}); echo({BlockEngine:real(BlockEngine:block(20001, 0, 20002))}); BlockEngine:Disconnect(); end -- test coordinate positions function Test.TestObjectCreation() NPL.load("(gl)script/apps/Aries/Creator/Game/Test/test_block_engine.lua"); NPL.load("(gl)script/apps/Aries/Creator/Game/block_engine.lua"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") local Fake_ParaTerrain = commonlib.gettable("MyCompany.Aries.Game.Fake_ParaTerrain") BlockEngine:Connect(); NPL.load("(gl)script/apps/Aries/Creator/Game/game_logic.lua"); local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") GameLogic.Init(); GameLogic.CreateObject("random_block"); GameLogic.CreateObject("spawn_room"); BlockEngine:Disconnect(); end function Test.TestFrameMove() NPL.load("(gl)script/apps/Aries/Creator/Game/Test/test_block_engine.lua"); NPL.load("(gl)script/apps/Aries/Creator/Game/block_engine.lua"); local BlockEngine = commonlib.gettable("MyCompany.Aries.Game.BlockEngine") BlockEngine:Connect(); NPL.load("(gl)script/apps/Aries/Creator/Game/game_logic.lua"); local GameLogic = commonlib.gettable("MyCompany.Aries.Game.GameLogic") GameLogic.Init(); local last_func = BlockEngine.GetNextDynamicTypeInColumn; local offset_y = 0; BlockEngine.GetNextDynamicTypeInColumn = function(self, x, y, z) offset_y = offset_y +0.01; x, y, z = BlockEngine:real(x, 0, z); GameLogic.CreateObject("random_block", x, 5+offset_y, z); return 0; end local x, y, z = ParaScene.GetPlayer():GetPosition(); local eye_x, eye_y, eye_z = BlockEngine:block(x, y, z ); BlockEngine:FrameMoveRegion(eye_x, eye_y, eye_z, 2, 0); BlockEngine:FrameMoveRegion(eye_x, eye_y, eye_z, 4, 4); BlockEngine:FrameMoveRegion(eye_x, eye_y, eye_z, 7, 6); BlockEngine.GetNextDynamicTypeInColumn = last_func; BlockEngine:Disconnect(); end
gpl-2.0
gleachkr/luakit
doc/luadoc/widget.webview.lua
4
14061
--- WebKitGTK+ webview widget -- -- DOCMACRO(available:ui) -- -- # Creating a new webview widget -- -- To create a new webview widget, use the `widget` constructor: -- -- local view = widget{ type = "webview" } -- -- print(type(view)) -- Prints "widget" -- print(view.type) -- Prints "webview" -- -- # Destroying a webview widget -- -- view:destroy() -- -- @class widget:webview -- @prefix view -- @author Mason Larobina -- @copyright 2010 Mason Larobina <mason.larobina@gmail.com> --- @property inspector -- Whether the web inspector is open for the webview. -- @type boolean -- @readonly --- @method search -- Begin searching the contents of the webview. -- -- This will end any current search, as if `clear_search()` had been called. -- @tparam string text The text to search for. -- @tparam boolean case_sensitive Whether the search should be case-sensitive. -- @tparam boolean forwards Search direction; `true` for forwards, `false` for backwards. -- @tparam boolean wrap Whether searching should wrap at the beginning and end of the document. --- @method search_next -- Focus the next occurrence of the text in the webview. --- @method search_previous -- Focus the previous occurrence of the text in the webview. --- @method clear_search -- Finish searching the contents of the webview. -- This will cause all highlighted matches within the webview to be un-highlighted. --- @method go_back -- Load the previous item in the webview history. -- @treturn boolean Whether the history item was loaded. --- @method go_forward -- Load the next item in the webview history. -- @treturn boolean Whether the history item was loaded. --- @method can_go_back -- Determine whether the webview has a previous history item. -- @treturn boolean Whether the webview has a previous history item. --- @method can_go_forward -- Determine whether the webview has a subsequent history item. -- @treturn boolean Whether the webview has a subsequent history item. --- @method eval_js -- -- Asynchronously run a string of JavaScript code in the context of the -- webview. The JavaScript will run even if the `enable_javascript` -- property of the webview is `false`, as it is run within a separate -- JavaScript script world. -- -- To evaluate a string of JavaScript, provide a callback function within -- the `options` table: -- -- view:eval_js("document.body.clientHeight", { callback = function (ret, err) -- assert(not err, err) -- Check for any error -- msg.info("The document height is %d pixels", ret) -- end }) -- -- # Calling options -- -- The following keys can be set in the `options` argument: -- -- * `source` : A string to be used in error messages. -- * `no_return` : A boolean; if `false`, no result _or error_ will be returned. -- * `callback` : A callback function. -- -- @tparam string script The JavaScript string to evaluate. -- @tparam table options Additional arguments. --- @method load_string -- Load the given string `string` into the webview, and set the webview URI -- to `content_uri`. This replaces the existing contents of the webview. -- -- In order to display an error page, it's recommended to use the `error_page` -- module. This module automatically implements a number of features, such as -- preventing user styles or userscripts from interfering with error pages, and -- error pages using this module have a consistent theme. -- -- @tparam string string The string to load into the webview. -- @tparam string content_uri The URI to display. --- @method reload -- Reload the current contents of the webview. --- @method reload_bypass_cache -- Reload the current contents of the webview, without using any cached data. --- @method stop -- Stop any current load operation within the within the webview. If there is no -- such operation, this method does nothing. Otherwise, the `load-failed` signal -- will be emitted with `"cancelled"` as the failure reason. --- @method ssl_trusted -- Determine whether any problems have been found with the certificate associated -- with the contents of the webview. -- -- If the contents of the webview were not loaded over HTTPS, `nil` is returned. -- -- The return value is valid after `load-status` is emitted on the webview -- with the `"committed"` status. -- -- @treturn boolean? `false` if any problems have been found, `true` if no problems -- were found, and `nil` if the contents of the webview were not loaded over HTTPS. --- @method show_inspector -- Show the web inspector for the webview. --- @method close_inspector -- Close the web inspector for the webview. --- @method allow_certificate -- Allow a certificate. --- @property uri -- The URI of the current web page. -- @type string -- @readwrite -- @default "about:blank" --- @property hovered_uri -- The URI of the link the mouse cursor is currently hovering over, or -- `nil` if the mouse cursor is not currently hovering over a link. -- @type string? -- @readonly --- @property source -- The source of the current web page. -- @readonly --- @property session_state -- The session state of the current web page. -- @type string -- @readwrite --- @property stylesheets -- The stylesheets of the webview. -- @type table -- @readonly --- @property history -- The history of the webview. -- @type table -- @readonly --- @property scroll -- The scroll of the webview. -- @type table -- @readonly --- @property favicon -- The favicon of the webview. -- @type widget -- @readonly --- @property certificate -- The certificate of the webview. -- @type string -- @readonly --- @property allow_file_access_from_file_urls -- Whether `file://` access is allowed for `file://` URIs. -- @type boolean -- @default `false` -- @readwrite --- @property allow_universal_access_from_file_urls -- Whether Javascript running in the `file://` scheme is allowed to access -- content from any origin. -- @type boolean -- @default `false` -- @readwrite --- @property hardware_acceleration_policy -- The policy for using hardware acceleration. Can be one of -- `"on-demand"`, `"always"`, and `"never"`. -- @type string -- @readwrite --- @signal scheme-request::* -- -- Emitted when the webview attempts to load a URI on a custom URI scheme. -- The signal detail is always present and is equal to the URI scheme. -- -- # Example -- -- A signal `scheme-request::foo` will be emitted on a webview in -- response to a `foo://` load attempt. To display content for this request, -- return a string with the content to display, as well as (optionally) the -- content MIME type. -- -- The type of content to display isn't limited to HTML or other textual -- formats; images and other binary content types are acceptable, as long as the -- MIME type parameter is returned. -- -- @tparam string uri The URI that the webview is attempting to load. -- @treturn string The content to display. Embedded NUL bytes are handled -- correctly. -- @treturn string The MIME type of the content. Default: `text/html`. --- @signal property::* -- -- Emitted when the value of a webview property may have been updated. -- For example, the `"property::uri"` signal is emitted on a `webview` -- widget when its @ref{widget:webview/uri} property changes. --- @signal link-hover -- Emitted when the mouse cursor is moved over a link. -- @deprecated use `property::hovered_uri` signal instead. -- @tparam string uri The hovered URI. --- @signal link-unhover -- Emitted when the mouse cursor was over a link and is moved off. -- @deprecated use `property::hovered_uri` signal instead. -- @tparam string uri The just-unhovered URI. --- @signal button-press -- Emitted when a mouse button was pressed with the cursor inside the `webview` widget. -- -- @tparam table modifiers An array of strings, one for each modifier key held -- at the time of the event. -- @tparam integer button The number of the button pressed, beginning -- from `1`; i.e. `1` corresponds to the left mouse button. -- @tparam table hit_test A table representing the type of element under the -- cursor at the time of the event. -- @treturn boolean `true` if the event has been handled and should not be -- propagated further. --- @signal button-release -- Emitted when a mouse button was released with the cursor inside the `webview` widget. -- -- @tparam table modifiers An array of strings, one for each modifier key held -- at the time of the event. -- @tparam integer button The number of the button pressed, beginning -- from `1`; i.e. `1` corresponds to the left mouse button. -- @tparam table hit_test A table representing the type of element under the -- cursor at the time of the event. -- @treturn boolean `true` if the event has been handled and should not be -- propagated further. --- @signal button-double-click -- Emitted when a mouse button was double-clicked with the cursor inside the `webview` widget. -- -- @tparam table modifiers An array of strings, one for each modifier key held -- at the time of the event. -- @tparam integer button The number of the button pressed, beginning -- from `1`; i.e. `1` corresponds to the left mouse button. -- @tparam table hit_test A table representing the type of element under the -- cursor at the time of the event. -- @treturn boolean `true` if the event has been handled and should not be -- propagated further. --- @signal mouse-enter -- Emitted when the mouse cursor enters the `webview` widget. -- @tparam table modifiers An array of strings, one for each modifier key held. -- @treturn boolean `true` if the event has been handled and should not be -- propagated further. --- @signal mouse-leave -- Emitted when the mouse cursor leaves the `webview` widget. -- @tparam table modifiers An array of strings, one for each modifier key held. -- @treturn boolean `true` if the event has been handled and should not be -- propagated further. --- @signal populate-popup -- Emitted just before the context menu is shown, usually after a right-click. -- This signal allows Lua code to intercept and modify the menu before it is -- shown. -- @tparam table menu A table representing the context menu to be shown. --- @signal web-extension-loaded -- Emitted on a `webview` widget when its associated web process has finished -- initialization. --- @signal crashed -- Emitted on a `webview` widget when its associated web process has crashed. -- The `"web-extension-loaded"` signal will be emitted afterwards, once a -- replacement web process has finished initialization. --- @signal load-status -- Emitted on a `webview` widget when its load status changes. -- @tparam string status The current load status of the webview. Can be one of -- `"provisional"`, `"redirected"`, `"committed"`, `"finished"`, and `"failed"`. -- @tparam string|nil uri If the load status is `"failed"`, this will be the -- failing URI; otherwise, it will be `nil`. -- @tparam table|nil err If the load status is `"failed"`, this will be a table -- with an error code and a human-readable message; otherwise, it will be `nil`. --- @signal create-web-view -- Emitted on a `webview` widget when it requests creation of a new `webview` -- widget. -- @treturn widget[type=webview] The newly created `webview` widget. --- @signal navigation-request -- Emitted on a `webview` widget before a navigation request is made, in either -- the main frame or a sub-frame of the webpage. -- @tparam string uri The URI to which navigation is being requested. -- @tparam string reason The reason for the navigation request. Can -- be one of `"link-clicked"`, `"form-submitted"`, `"back-forward"`, -- `"reload"`, `"form-resubmitted"`, and `"other"`. -- @treturn boolean Return `false` to prevent the requested -- navigation from taking place. --- @signal new-window-decision -- -- Similar to the `"navigation-request"` signal, the -- `"new-window-decision"` signal is emitted on a `webview` widget when a -- request to open a new window is made. -- @tparam string uri The URI that will open in the new window, if the request -- is allowed. -- @tparam string reason The reason for the navigation request. Can -- be one of `"link-clicked"`, `"form-submitted"`, `"back-forward"`, -- `"reload"`, `"form-resubmitted"`, and `"other"`. -- @treturn boolean Return `false` to prevent the requested -- navigation from taking place. --- @signal mime-type-decision -- Similar to the `"navigation-request"` signal, the -- `"mime-type-decision"` signal is emitted on a `webview` widget after a -- response has been received for a request, but before loading begins. This -- signal is emitted for all sub-page resources, such as images and stylesheets. -- -- @tparam string uri The URI of the resource for which a response has been -- received. -- @tparam string mime The MIME type for the resource indicated by the response. -- @treturn boolean Return `false` to prevent the requested -- navigation from taking place. --- @signal favicon -- Emitted when the favicon for the currently loaded webpage becomes available. --- @signal expose -- Emitted when the `webview` widget is redrawn. --- @signal key-press -- Emitted when a key is pressed while the `webview` widget has the -- input focus. -- @tparam table modifiers An array of strings, one for each modifier key held. -- @tparam string key The key that was pressed, if printable, or a keysym -- otherwise. -- @treturn boolean `true` if the event has been handled and should not be -- propagated further. --- @signal permission-request -- Emitted when the webview is requesting user permisison to perform some -- action. -- @tparam string type The type of permission requested. Can be one of -- `"notification"`, `"geolocation"`, `"install-missing-media-plugins"`, and `"user-media"`. -- @param arg Additional information about the permission request. For -- `"user-media"` requests, this is a table with boolean `audio` and `video` -- fields. For `"install-missing-media-plugins"` requests, this is a string -- description. -- @treturn boolean `true` to grant the permission request, and `false` to deny -- it. If no value is returned, a default action is used. -- vim: et:sw=4:ts=8:sts=4:tw=80
gpl-3.0