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
dickeyf/darkstar
scripts/zones/Quicksand_Caves/npcs/_5s8.lua
13
1253
----------------------------------- -- Area: Quicksand Caves -- NPC: Ornate Door -- Door blocked by Weight system -- @pos -334 0 659 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()-(-326); local difZ = player:getZPos()-(660); 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
Turttle/darkstar
scripts/zones/Southern_San_dOria/npcs/Ailevia.lua
30
1902
----------------------------------- -- Area: Southern San d'Oria -- NPC: Ailevia -- Adventurer's Assistant -- Only recieving Adv.Coupon and simple talk event are scripted -- This NPC participates in Quests and Missions -- @zone 230 -- @pos -8 1 1 ------------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) --Adventurer coupon if (trade:getItemCount() == 1 and trade:hasItemQty(0x218,1) == true) then player:startEvent(0x028f); end -- "Flyers for Regine" conditional script count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0267); -- i know a thing or 2 about these streets 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 == 0x028f) then player:addGil(GIL_RATE*50); player:tradeComplete(); player:messageSpecial(GIL_OBTAINED,GIL_RATE*50); end end;
gpl-3.0
Turttle/darkstar
scripts/zones/Port_Bastok/npcs/Hilda.lua
20
5066
----------------------------------- -- Area: Port Bastok -- NPC: Hilda -- Involved in Quest: Cid's Secret, Riding on the Clouds -- Starts & Finishes: The Usual -- @pos -163 -8 13 236 ----------------------------------- package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; package.loaded["scripts/globals/settings"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:getGil() == 0 and trade:getItemCount() == 1) then if (trade:hasItemQty(4530,1) and player:getVar("CidsSecret_Event") == 1 and player:hasKeyItem(UNFINISHED_LETTER) == false) then -- Trade Rollanberry player:startEvent(0x0085); elseif (trade:hasItemQty(4386,1) and player:getQuestStatus(BASTOK,THE_USUAL) == QUEST_ACCEPTED) then -- Trade King Truffle player:startEvent(0x0087); end end if (player:getQuestStatus(JEUNO,RIDING_ON_THE_CLOUDS) == QUEST_ACCEPTED and player:getVar("ridingOnTheClouds_2") == 5) then if (trade:hasItemQty(1127,1) and trade:getItemCount() == 1) then -- Trade Kindred seal player:setVar("ridingOnTheClouds_2",0); player:tradeComplete(); player:addKeyItem(SMILING_STONE); player:messageSpecial(KEYITEM_OBTAINED,SMILING_STONE); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local WildcatBastok = player:getVar("WildcatBastok"); if (player:getCurrentMission(BASTOK) == ON_MY_WAY) and (player:getVar("MissionStatus") == 1) then player:startEvent(0x00ff); elseif (player:getQuestStatus(BASTOK,LURE_OF_THE_WILDCAT_BASTOK) == QUEST_ACCEPTED and player:getMaskBit(WildcatBastok,3) == false) then player:startEvent(0x0164); elseif (player:getQuestStatus(BASTOK,THE_USUAL) ~= QUEST_COMPLETED) then if (player:getQuestStatus(BASTOK,CID_S_SECRET) == QUEST_ACCEPTED) then player:startEvent(0x0084); if (player:getVar("CidsSecret_Event") ~= 1) then player:setVar("CidsSecret_Event",1); end elseif (player:getFameLevel(BASTOK) >= 5 and player:getQuestStatus(BASTOK,CID_S_SECRET) == QUEST_COMPLETED) then if (player:getVar("TheUsual_Event") == 1) then player:startEvent(0x0088); elseif (player:getQuestStatus(BASTOK,THE_USUAL) == QUEST_ACCEPTED) then player:startEvent(0x0031); --Hilda thanks the player for all the help; there is no reminder dialogue for this quest else player:startEvent(0x0086); end else player:startEvent(0x0030); --Standard dialogue if fame isn't high enough to start The Usual and Cid's Secret is not active end elseif (player:getQuestStatus(BASTOK,THE_USUAL) == QUEST_COMPLETED and player:getQuestStatus(BASTOK,CID_S_SECRET) == QUEST_COMPLETED) then player:startEvent(0x0031); --Hilda thanks the player for all the help else player:startEvent(0x0030); --Standard dialogue if no quests are active or available 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 == 0x0085) then player:tradeComplete(); player:addKeyItem(UNFINISHED_LETTER); player:messageSpecial(KEYITEM_OBTAINED,UNFINISHED_LETTER); elseif (csid == 0x0086 and option == 0) then if (player:getQuestStatus(BASTOK,THE_USUAL) == QUEST_AVAILABLE) then player:addQuest(BASTOK,THE_USUAL); end elseif (csid == 0x0087) then player:tradeComplete(); player:addKeyItem(STEAMING_SHEEP_INVITATION); player:messageSpecial(KEYITEM_OBTAINED,STEAMING_SHEEP_INVITATION); elseif (csid == 0x0088) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,17170); else player:addTitle(STEAMING_SHEEP_REGULAR); player:delKeyItem(STEAMING_SHEEP_INVITATION); player:setVar("TheUsual_Event",0); player:addItem(17170); player:messageSpecial(ITEM_OBTAINED,17170); -- Speed Bow player:addFame(BASTOK,BAS_FAME*30); player:completeQuest(BASTOK,THE_USUAL); end elseif (csid == 0x00ff) then player:setVar("MissionStatus",2); elseif (csid == 0x0164) then player:setMaskBit(player:getVar("WildcatBastok"),"WildcatBastok",3,true); end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c41722932.lua
9
1352
--ダーク・ジェノサイド・カッター function c41722932.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(c41722932.condition) e1:SetTarget(c41722932.target) e1:SetOperation(c41722932.activate) c:RegisterEffect(e1) end function c41722932.cfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) end function c41722932.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(c41722932.cfilter,tp,LOCATION_MZONE,0,3,nil) end function c41722932.filter(c) return c:IsFaceup() and c:IsAbleToRemove() end function c41722932.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and c41722932.filter(chkc) and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(c41722932.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,c41722932.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c41722932.activate(e) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c1154611.lua
2
2804
--バージェストマ・レアンコイリア function c1154611.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c1154611.target) e1:SetOperation(c1154611.activate) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(1154611,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(c1154611.spcon) e2:SetTarget(c1154611.sptg) e2:SetOperation(c1154611.spop) c:RegisterEffect(e2) end function c1154611.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) end function c1154611.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoGrave(tc,REASON_EFFECT+REASON_RETURN) end end function c1154611.spcon(e,tp,eg,ep,ev,re,r,rp) return re:IsActiveType(TYPE_TRAP) and re:IsHasType(EFFECT_TYPE_ACTIVATE) end function c1154611.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetFlagEffect(1154611)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,1154611,0xd4,0x11,1200,0,2,RACE_AQUA,ATTRIBUTE_WATER) end c:RegisterFlagEffect(1154611,RESET_CHAIN,0,1) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function c1154611.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.IsPlayerCanSpecialSummonMonster(tp,1154611,0xd4,0x11,1200,0,2,RACE_AQUA,ATTRIBUTE_WATER) then c:AddMonsterAttribute(TYPE_NORMAL) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) c:AddMonsterAttributeComplete() local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(c1154611.efilter) e2:SetReset(RESET_EVENT+0x1fe0000) c:RegisterEffect(e2,true) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetReset(RESET_EVENT+0x47e0000) e3:SetValue(LOCATION_REMOVED) c:RegisterEffect(e3,true) Duel.SpecialSummonComplete() end end function c1154611.efilter(e,re) return re:IsActiveType(TYPE_MONSTER) end
gpl-2.0
eugeneia/snabb
lib/luajit/testsuite/test/opt/fold/kfold.lua
6
3717
do --- operators local y = 0 for i=1,100 do local a, b = 23, 11; y = a+b end; assert(y == 23+11) for i=1,100 do local a, b = 23, 11; y = a-b end; assert(y == 23-11) for i=1,100 do local a, b = 23, 11; y = a*b end; assert(y == 23*11) for i=1,100 do local a, b = 23, 11; y = a/b end; assert(y == 23/11) for i=1,100 do local a, b = 23, 11; y = a%b end; assert(y == 23%11) for i=1,100 do local a, b = 23, 11; y = a^b end; assert(y == 23^11) for i=1,100 do local a, b = 23.5, 11.5; y = a+b end; assert(y == 23.5+11.5) for i=1,100 do local a, b = 23.5, 11.5; y = a-b end; assert(y == 23.5-11.5) for i=1,100 do local a, b = 23.5, 11.5; y = a*b end; assert(y == 23.5*11.5) for i=1,100 do local a, b = 23.5, 11.5; y = a/b end; assert(y == 23.5/11.5) for i=1,100 do local a, b = 23.5, 11.5; y = a%b end; assert(y == 23.5%11.5) end do --- abs local y = 0 for i=1,100 do local a=23; y = math.abs(a) end; assert(y == math.abs(23)) for i=1,100 do local a=-23; y = math.abs(a) end; assert(y == math.abs(-23)) for i=1,100 do local a=23.5; y = math.abs(a) end; assert(y == math.abs(23.5)) for i=1,100 do local a=-23.5; y = math.abs(a) end; assert(y==math.abs(-23.5)) for i=1,100 do local a=-2^31; y = math.abs(a) end; assert(y==math.abs(-2^31)) end do --- atan2 ldexp local y = 0 for i=1,100 do local a, b = 23, 11; y = math.atan2(a, b) end assert(y == math.atan2(23, 11)) for i=1,100 do local a, b = 23, 11; y = math.ldexp(a, b) end assert(y == math.ldexp(23, 11)) end do --- minmax local y = 0 for i=1,100 do local a, b = 23, 11; y = math.min(a, b) end assert(y == math.min(23, 11)) for i=1,100 do local a, b = 23, 11; y = math.max(a, b) end assert(y == math.max(23, 11)) for i=1,100 do local a, b = 23.5, 11.5; y = math.min(a, b) end assert(y == math.min(23.5, 11.5)) for i=1,100 do local a, b = 23.5, 11.5; y = math.max(a, b) end assert(y == math.max(23.5, 11.5)) for i=1,100 do local a, b = 11, 23; y = math.min(a, b) end assert(y == math.min(11, 23)) for i=1,100 do local a, b = 11, 23; y = math.max(a, b) end assert(y == math.max(11, 23)) for i=1,100 do local a, b = 11.5, 23.5; y = math.min(a, b) end assert(y == math.min(11.5, 23.5)) for i=1,100 do local a, b = 11.5, 23.5; y = math.max(a, b) end assert(y == math.max(11.5, 23.5)) end do --- floorceil local y = 0 for i=1,100 do local a=23; y=math.floor(a) end assert(y==math.floor(23)) for i=1,100 do local a=23.5; y=math.floor(a) end assert(y==math.floor(23.5)) for i=1,100 do local a=-23; y=math.floor(a) end assert(y==math.floor(-23)) for i=1,100 do local a=-23.5; y=math.floor(a) end assert(y==math.floor(-23.5)) for i=1,100 do local a=-0; y=math.floor(a) end assert(y==math.floor(-0)) for i=1,100 do local a=23; y=math.ceil(a) end assert(y==math.ceil(23)) for i=1,100 do local a=23.5; y=math.ceil(a) end assert(y==math.ceil(23.5)) for i=1,100 do local a=-23; y=math.ceil(a) end assert(y==math.ceil(-23)) for i=1,100 do local a=-23.5; y=math.ceil(a) end assert(y==math.ceil(-23.5)) for i=1,100 do local a=-0; y=math.ceil(a) end assert(y==math.ceil(-0)) end do --- sqrt exp log trig local y = 0 for i=1,100 do local a=23; y=math.sqrt(a) end assert(y==math.sqrt(23)) for i=1,100 do local a=23; y=math.exp(a) end assert(y==math.exp(23)) for i=1,100 do local a=23; y=math.log(a) end assert(y==math.log(23)) for i=1,100 do local a=23; y=math.log10(a) end assert(y==math.log10(23)) for i=1,100 do local a=23; y=math.sin(a) end assert(y==math.sin(23)) for i=1,100 do local a=23; y=math.cos(a) end assert(y==math.cos(23)) for i=1,100 do local a=23; y=math.tan(a) end assert(y==math.tan(23)) end do --- exp -luajit==2.0 assert((10^-2 - 0.01) == 0) end
apache-2.0
fgenesis/Aquaria_experimental
game_scripts/scripts/entities/creatorform2.lua
1
7889
-- Copyright (C) 2007, 2010 - Bit-Blot -- -- This file is part of Aquaria. -- -- Aquaria is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if not v then v = {} end if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end v.n = 0 local STATE_START = 1000 local STATE_GRABATTACK = 1001 local STATE_HOLDING = 1002 local STATE_INHAND = 1003 local STATE_BEAM = 1004 v.bone_head = 0 v.bone_body = 0 v.grabPoint = 0 v.inHand = false v.breakFreeTimer = 0 v.grabDelay = 3 v.hits = 200 * 1.3 v.grabRange = 0 v.shotDelay = 0 v.shotDelayTime = 0 v.prepDelay = 8 v.beam = 0 function init(me) setupEntity(me) entity_setEntityType(me, ET_ENEMY) entity_initSkeletal(me, "CreatorForm2") --entity_setAllDamageTargets(me, false) entity_generateCollisionMask(me) entity_setState(me, STATE_IDLE) v.grabPoint = entity_getBoneByName(me, "Hand") v.bone_head = entity_getBoneByName(me, "Head") v.bone_body = entity_getBoneByName(me, "Body") v.grabRange = entity_getBoneByName(me, "GrabRange") entity_setMaxSpeed(me, 800) entity_setDamageTarget(me, DT_ENEMY_BEAM, false) entity_setCull(me, false) playMusic("Worship2") loadSound("creatorform2-shot") entity_setDamageTarget(me, DT_AVATAR_PET, false) end function postInit(me) v.n = getNaija() entity_setTarget(me, v.n) end function update(me, dt) --debugLog(string.format("hits %d", hits)) if entity_isState(me, STATE_TRANSITION) or entity_isState(me, STATE_WAIT) then return end entity_doFriction(me, dt, 800) entity_doCollisionAvoidance(me, dt, 15, 0.5) entity_updateMovement(me, dt) if v.grabDelay > 0 then v.grabDelay = v.grabDelay - dt if v.grabDelay < 0 then v.grabDelay = 0 end end entity_handleShotCollisionsSkeletal(me) local bone = entity_collideSkeletalVsCircle(me, v.n) if bone ~= 0 then if not v.inHand and v.grabDelay == 0 and bone == v.grabPoint then if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end v.inHand = true avatar_fallOffWall() end if not v.inHand and avatar_isBursting() and bone == v.bone_body and entity_setBoneLock(v.n, me, bone) then if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end else local bx, by = bone_getWorldPosition(bone) local x, y = entity_getPosition(v.n) bx = x - bx by = y - by bx, by = vector_setLength(bx, by, 800) entity_addVel(v.n, bx, by) end if bone == v.grabPoint then entity_damage(v.n, me, 0.5) end end if v.inHand then entity_setPosition(v.n, bone_getWorldPosition(v.grabPoint)) entity_rotate(v.n, bone_getWorldRotation(v.grabPoint)-90) if avatar_isRolling() then v.breakFreeTimer = v.breakFreeTimer + dt if v.breakFreeTimer > 2 then v.inHand = false v.breakFreeTimer = 0 v.grabDelay = 4 local x, y = entity_x(v.n), entity_y(v.n) if isObstructed(x, y) then -- Trapped in the floor! Warp out. while y > 4500 and isObstructed(x, y) do y = y-20 end entity_setPosition(v.n, x, y) end end end end if not v.inHand and math.abs(entity_x(me) - entity_x(v.n)) > 256 then if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end entity_flipToEntity(me, v.n) end entity_clearTargetPoints(me) entity_addTargetPoint(me, bone_getWorldPosition(v.bone_head)) if entity_isState(me, STATE_IDLE) then v.prepDelay = v.prepDelay - dt if v.prepDelay < 0 then local bx, by = bone_getWorldPosition(v.grabRange) if (entity_getBoneLockEntity(v.n) == me) or (entity_isPositionInRange(v.n, bx, by, 512) and chance(30)) then entity_setState(me, STATE_GRABATTACK) else if chance(50) then entity_setState(me, STATE_PREP) elseif chance(50) then entity_setState(me, STATE_BEAM) end end end end if entity_isState(me, STATE_ATTACK) then v.shotDelay = v.shotDelay - dt if v.shotDelay <= 0 then local s = createShot("CreatorForm2", me, v.n, bone_getWorldPosition(v.bone_head)) v.shotDelayTime = v.shotDelayTime - 0.01 v.shotDelay = v.shotDelayTime end end if entity_isState(me, STATE_BEAM) then if v.beam ~= 0 then if entity_isfh(me) then beam_setAngle(v.beam, bone_getWorldRotation(v.bone_head)+90) else beam_setAngle(v.beam, bone_getWorldRotation(v.bone_head)-90) end beam_setPosition(v.beam, bone_getWorldPosition(v.bone_head)) end end end function enterState(me) if entity_isState(me, STATE_IDLE) then entity_animate(me, "start", -1) elseif entity_isState(me, STATE_START) then entity_setStateTime(me, entity_animate(me, "start", 2)) elseif entity_isState(me, STATE_TRANSITION) then v.inHand = false clearShots() entity_setAllDamageTargets(me, false) entity_idle(v.n) disableInput() entity_setInvincible(v.n, true) cam_toEntity(me) local node = entity_getNearestNode(me, "CENTER") entity_setPosition(me, node_x(node), node_y(node), 3, 0, 0, 1) local t = entity_animate(me, "die") entity_setStateTime(me, t + 2) local node = getNode("HASTYEXIT") local door = node_getNearestEntity(node, "FinalDoor") entity_setState(door, STATE_OPEN) elseif entity_isState(me, STATE_PREP) then entity_setStateTime(me, entity_animate(me, "prep")) elseif entity_isState(me, STATE_ATTACK) then entity_animate(me, "attack", -1) entity_setStateTime(me, 6) v.shotDelayTime = 1 elseif entity_isState(me, STATE_GRABATTACK) then entity_setStateTime(me, entity_animate(me, "grabAttack")) shakeCamera(10, 1) avatar_fallOffWall() elseif entity_isState(me, STATE_BEAM) then entity_setStateTime(me, entity_animate(me, "beam")) shakeCamera(10, 3) avatar_fallOffWall() v.beam = 0 voice("Laugh3") end end function exitState(me) if entity_isState(me, STATE_START) then entity_setState(me, STATE_IDLE) elseif entity_isState(me, STATE_TRANSITION) then local bx, by = bone_getWorldPosition(v.bone_head) createEntity("CreatorForm4", "", bx, by) entity_setState(me, STATE_WAIT, 2) elseif entity_isState(me, STATE_WAIT) then entity_delete(me) enableInput() entity_setInvincible(v.n, false) cam_toEntity(v.n) elseif entity_isState(me, STATE_PREP) then entity_setState(me, STATE_ATTACK) elseif entity_isState(me, STATE_ATTACK) or entity_isState(me, STATE_GRABATTACK) or entity_isState(me, STATE_BEAM) then if v.beam ~= 0 then beam_delete(v.beam) v.beam = 0 end v.prepDelay = math.random(3)+4 entity_setState(me, STATE_IDLE) end end function damage(me, attacker, bone, damageType, dmg) if bone == v.bone_head then bone_damageFlash(bone) v.hits = v.hits - dmg if v.hits <= 0 then entity_setState(me, STATE_TRANSITION) end return false end return false end function animationKey(me, key) if entity_isState(me, STATE_IDLE) and (key == 2 or key == 3) then entity_moveTowards(me, entity_x(v.n), entity_y(v.n), 1, 1000) elseif entity_isState(me, STATE_BEAM) and key == 1 then v.beam = createBeam() beam_setTexture(v.beam, "particles/Beam") beam_setDamage(v.beam, 3) playSfx("PowerUp") playSfx("FizzleBarrier") end end function hitSurface(me) end function songNote(me, note) end function songNoteDone(me, note) end function song(me, song) end function activate(me) end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c70046172.lua
2
1285
--突進 function c70046172.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(c70046172.condition) e1:SetTarget(c70046172.target) e1:SetOperation(c70046172.activate) c:RegisterEffect(e1) end function c70046172.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()~=PHASE_DAMAGE or not Duel.IsDamageCalculated() end function c70046172.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function c70046172.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e1:SetValue(700) tc:RegisterEffect(e1) end end
gpl-2.0
dickeyf/darkstar
scripts/globals/items/winterflower.lua
18
1364
----------------------------------------- -- ID: 5907 -- Item: Winterflower -- Food Effect: 5Min, All Races ----------------------------------------- -- Agility +3 -- Intelligence +5 -- Charisma -5 -- Resist Virus +20 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) 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,300,5907); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_AGI, 3); target:addMod(MOD_INT, 5); target:addMod(MOD_CHR, -5); target:addMod(MOD_VIRUSRES, 20); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_AGI, 3); target:delMod(MOD_INT, 5); target:delMod(MOD_CHR, -5); target:delMod(MOD_VIRUSRES, 20); end;
gpl-3.0
Turttle/darkstar
scripts/zones/Qufim_Island/npcs/Jiwon.lua
17
1862
----------------------------------- -- Area: Qufim Island -- NPC: Jiwon -- Type: Outpost Vendor -- @pos -249 -19 300 126 ----------------------------------- package.loaded["scripts/zones/Qufim_Island/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); require("scripts/zones/Qufim_Island/TextIDs"); local region = QUFIMISLAND; local csid = 0x7ff4; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local owner = GetRegionOwner(region); local arg1 = getArg1(owner,player); if (owner == player:getNation()) then nation = 1; elseif (arg1 < 1792) then nation = 2; else nation = 0; end player:startEvent(csid,nation,OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP(),0,0,0); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("OPTION: %u",option); player:updateEvent(player:getGil(),OP_TeleFee(player,region),0,OP_TeleFee(player,region),player:getCP()); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("OPTION: %u",option); if (option == 1) then ShowOPVendorShop(player); elseif (option == 2) then if (player:delGil(OP_TeleFee(player,region))) then toHomeNation(player); end elseif (option == 6) then player:delCP(OP_TeleFee(player,region)); toHomeNation(player); end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c14763299.lua
6
1779
--幻奏の歌姫ソロ function c14763299.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c14763299.spcon) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(14763299,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetCondition(c14763299.condition) e2:SetTarget(c14763299.target) e2:SetOperation(c14763299.operation) c:RegisterEffect(e2) end function c14763299.spcon(e,c) if c==nil then return true end return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0 and Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE)>0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function c14763299.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) end function c14763299.filter(c,e,tp) return c:IsSetCard(0x9b) and not c:IsCode(14763299) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c14763299.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c14763299.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c14763299.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c14763299.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
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c73018302.lua
6
1731
--黒羽を狩る者 function c73018302.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(73018302,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCondition(c73018302.descon) e1:SetCost(c73018302.descost) e1:SetTarget(c73018302.destg) e1:SetOperation(c73018302.desop) c:RegisterEffect(e1) end function c73018302.check(tp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) if g:GetCount()<2 then return false end local rac=g:GetFirst():GetRace() local tc=g:GetNext() while tc do if tc:GetRace()~=rac then return false end tc=g:GetNext() end return true end function c73018302.descon(e,tp,eg,ep,ev,re,r,rp) return c73018302.check(tp) end function c73018302.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsAbleToGraveAsCost,1,1,REASON_COST) end function c73018302.filter(c) return c:IsFaceup() end function c73018302.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and c73018302.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c73018302.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c73018302.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c73018302.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and c73018302.check(tp) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
tasdomas/nodemcu-build
fw/nodemcu-firmware/app/cjson/lua/cjson/util.lua
170
6837
local json = require "cjson" -- Various common routines used by the Lua CJSON package -- -- Mark Pulford <mark@kyne.com.au> -- Determine with a Lua table can be treated as an array. -- Explicitly returns "not an array" for very sparse arrays. -- Returns: -- -1 Not an array -- 0 Empty table -- >0 Highest index in the array local function is_array(table) local max = 0 local count = 0 for k, v in pairs(table) do if type(k) == "number" then if k > max then max = k end count = count + 1 else return -1 end end if max > count * 2 then return -1 end return max end local serialise_value local function serialise_table(value, indent, depth) local spacing, spacing2, indent2 if indent then spacing = "\n" .. indent spacing2 = spacing .. " " indent2 = indent .. " " else spacing, spacing2, indent2 = " ", " ", false end depth = depth + 1 if depth > 50 then return "Cannot serialise any further: too many nested tables" end local max = is_array(value) local comma = false local fragment = { "{" .. spacing2 } if max > 0 then -- Serialise array for i = 1, max do if comma then table.insert(fragment, "," .. spacing2) end table.insert(fragment, serialise_value(value[i], indent2, depth)) comma = true end elseif max < 0 then -- Serialise table for k, v in pairs(value) do if comma then table.insert(fragment, "," .. spacing2) end table.insert(fragment, ("[%s] = %s"):format(serialise_value(k, indent2, depth), serialise_value(v, indent2, depth))) comma = true end end table.insert(fragment, spacing .. "}") return table.concat(fragment) end function serialise_value(value, indent, depth) if indent == nil then indent = "" end if depth == nil then depth = 0 end if value == json.null then return "json.null" elseif type(value) == "string" then return ("%q"):format(value) elseif type(value) == "nil" or type(value) == "number" or type(value) == "boolean" then return tostring(value) elseif type(value) == "table" then return serialise_table(value, indent, depth) else return "\"<" .. type(value) .. ">\"" end end local function file_load(filename) local file if filename == nil then file = io.stdin else local err file, err = io.open(filename, "rb") if file == nil then error(("Unable to read '%s': %s"):format(filename, err)) end end local data = file:read("*a") if filename ~= nil then file:close() end if data == nil then error("Failed to read " .. filename) end return data end local function file_save(filename, data) local file if filename == nil then file = io.stdout else local err file, err = io.open(filename, "wb") if file == nil then error(("Unable to write '%s': %s"):format(filename, err)) end end file:write(data) if filename ~= nil then file:close() end end local function compare_values(val1, val2) local type1 = type(val1) local type2 = type(val2) if type1 ~= type2 then return false end -- Check for NaN if type1 == "number" and val1 ~= val1 and val2 ~= val2 then return true end if type1 ~= "table" then return val1 == val2 end -- check_keys stores all the keys that must be checked in val2 local check_keys = {} for k, _ in pairs(val1) do check_keys[k] = true end for k, v in pairs(val2) do if not check_keys[k] then return false end if not compare_values(val1[k], val2[k]) then return false end check_keys[k] = nil end for k, _ in pairs(check_keys) do -- Not the same if any keys from val1 were not found in val2 return false end return true end local test_count_pass = 0 local test_count_total = 0 local function run_test_summary() return test_count_pass, test_count_total end local function run_test(testname, func, input, should_work, output) local function status_line(name, status, value) local statusmap = { [true] = ":success", [false] = ":error" } if status ~= nil then name = name .. statusmap[status] end print(("[%s] %s"):format(name, serialise_value(value, false))) end local result = { pcall(func, unpack(input)) } local success = table.remove(result, 1) local correct = false if success == should_work and compare_values(result, output) then correct = true test_count_pass = test_count_pass + 1 end test_count_total = test_count_total + 1 local teststatus = { [true] = "PASS", [false] = "FAIL" } print(("==> Test [%d] %s: %s"):format(test_count_total, testname, teststatus[correct])) status_line("Input", nil, input) if not correct then status_line("Expected", should_work, output) end status_line("Received", success, result) print() return correct, result end local function run_test_group(tests) local function run_helper(name, func, input) if type(name) == "string" and #name > 0 then print("==> " .. name) end -- Not a protected call, these functions should never generate errors. func(unpack(input or {})) print() end for _, v in ipairs(tests) do -- Run the helper if "should_work" is missing if v[4] == nil then run_helper(unpack(v)) else run_test(unpack(v)) end end end -- Run a Lua script in a separate environment local function run_script(script, env) local env = env or {} local func -- Use setfenv() if it exists, otherwise assume Lua 5.2 load() exists if _G.setfenv then func = loadstring(script) if func then setfenv(func, env) end else func = load(script, nil, nil, env) end if func == nil then error("Invalid syntax.") end func() return env end -- Export functions return { serialise_value = serialise_value, file_load = file_load, file_save = file_save, compare_values = compare_values, run_test_summary = run_test_summary, run_test = run_test, run_test_group = run_test_group, run_script = run_script } -- vi:ai et sw=4 ts=4:
mit
SalvationDevelopment/Salvation-Scripts-TCG
c71703785.lua
2
3012
--守護神官マハード function c71703785.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(71703785,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_DRAW) e1:SetRange(LOCATION_HAND) e1:SetCondition(c71703785.spcon1) e1:SetCost(c71703785.spcost) e1:SetTarget(c71703785.sptg1) e1:SetOperation(c71703785.spop1) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_SET_ATTACK_FINAL) e2:SetCondition(c71703785.atkcon) e2:SetValue(c71703785.atkval) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(71703785,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCondition(c71703785.spcon2) e3:SetTarget(c71703785.sptg2) e3:SetOperation(c71703785.spop2) c:RegisterEffect(e3) end function c71703785.spcon1(e,tp,eg,ep,ev,re,r,rp) return eg:IsContains(e:GetHandler()) end function c71703785.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsPublic() end end function c71703785.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function c71703785.spop1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function c71703785.atkcon(e) local ph=Duel.GetCurrentPhase() local bc=e:GetHandler():GetBattleTarget() return (ph==PHASE_DAMAGE or ph==PHASE_DAMAGE_CAL) and bc and bc:IsAttribute(ATTRIBUTE_DARK) end function c71703785.atkval(e,c) return e:GetHandler():GetAttack()*2 end function c71703785.spcon2(e,tp,eg,ep,ev,re,r,rp) return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 end function c71703785.spfilter(c,e,tp) return c:IsCode(46986414) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c71703785.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c71703785.spfilter,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE) end function c71703785.spop2(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c71703785.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp) if g:GetCount()>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c56399890.lua
6
1176
--魔轟神獣キャシー function c56399890.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(56399890,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(c56399890.descon) e1:SetTarget(c56399890.destg) e1:SetOperation(c56399890.desop) c:RegisterEffect(e1) end function c56399890.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) and bit.band(r,REASON_DISCARD)~=0 end function c56399890.filter(c) return c:IsFaceup() end function c56399890.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and c56399890.filter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c56399890.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c56399890.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c60577362.lua
5
1126
--威圧する魔眼 function c60577362.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c60577362.target) e1:SetOperation(c60577362.activate) c:RegisterEffect(e1) end function c60577362.filter(c) return c:IsFaceup() and c:IsAttackBelow(2000) and c:IsRace(RACE_ZOMBIE) end function c60577362.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c60577362.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c60577362.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,c60577362.filter,tp,LOCATION_MZONE,0,1,1,nil) end function c60577362.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) end end
gpl-2.0
dickeyf/darkstar
scripts/globals/spells/bluemagic/mp_drainkiss.lua
3
1895
----------------------------------------- -- Spell: MP Drainkiss -- Steals an enemy's MP. Ineffective against undead -- Spell cost: 20 MP -- Monster Type: Amorphs -- Spell Type: Magical (Dark) -- Blue Magic Points: 4 -- Stat Bonus: MP+5 -- Level: 42 -- Casting Time: 4 seconds -- Recast Time: 90 seconds -- Magic Bursts on: Compression, Gravitation, Darkness -- Combos: None ----------------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); ----------------------------------------- -- OnMagicCastingCheck ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; ----------------------------------------- -- OnSpellCast ----------------------------------------- function onSpellCast(caster,target,spell) -- also have small constant to account for 0 dark skill local dmg = 5 + 0.375 * (caster:getSkillLevel(BLUE_SKILL) + caster:getMod(79 + BLUE_SKILL)); --get resist multiplier (1x if no resist) local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT)-target:getStat(MOD_INT),BLUE_SKILL,1.0); --get the resisted damage dmg = dmg*resist; --add on bonuses (staff/day/weather/jas/mab/etc all go in this function) dmg = addBonuses(caster,spell,target,dmg); --add in target adjustment dmg = adjustForTarget(target,dmg,spell:getElement()); --add in final adjustments if (dmg < 0) then dmg = 0 end if (target:isUndead()) then spell:setMsg(75); -- No effect return dmg; end if (target:getMP() > dmg) then caster:addMP(dmg); target:delMP(dmg); else dmg = target:getMP(); caster:addMP(dmg); target:delMP(dmg); end spell:setMsg(228); --change msg to 'xxx mp drained from the yyyy.' return dmg; end;
gpl-3.0
JackS9/iot
lua_examples/irsend.lua
88
1803
------------------------------------------------------------------------------ -- IR send module -- -- LICENCE: http://opensource.org/licenses/MIT -- Vladimir Dronnikov <dronnikov@gmail.com> -- -- Example: -- dofile("irsend.lua").nec(4, 0x00ff00ff) ------------------------------------------------------------------------------ local M do -- const local NEC_PULSE_US = 1000000 / 38000 local NEC_HDR_MARK = 9000 local NEC_HDR_SPACE = 4500 local NEC_BIT_MARK = 560 local NEC_ONE_SPACE = 1600 local NEC_ZERO_SPACE = 560 local NEC_RPT_SPACE = 2250 -- cache local gpio, bit = gpio, bit local mode, write = gpio.mode, gpio.write local waitus = tmr.delay local isset = bit.isset -- NB: poorman 38kHz PWM with 1/3 duty. Touch with care! ) local carrier = function(pin, c) c = c / NEC_PULSE_US while c > 0 do write(pin, 1) write(pin, 0) c = c + 0 c = c + 0 c = c + 0 c = c + 0 c = c + 0 c = c + 0 c = c * 1 c = c * 1 c = c * 1 c = c - 1 end end -- tsop signal simulator local pull = function(pin, c) write(pin, 0) waitus(c) write(pin, 1) end -- NB: tsop mode allows to directly connect pin -- inplace of TSOP input local nec = function(pin, code, tsop) local pulse = tsop and pull or carrier -- setup transmitter mode(pin, 1) write(pin, tsop and 1 or 0) -- header pulse(pin, NEC_HDR_MARK) waitus(NEC_HDR_SPACE) -- sequence, lsb first for i = 31, 0, -1 do pulse(pin, NEC_BIT_MARK) waitus(isset(code, i) and NEC_ONE_SPACE or NEC_ZERO_SPACE) end -- trailer pulse(pin, NEC_BIT_MARK) -- done transmitter --mode(pin, 0, tsop and 1 or 0) end -- expose M = { nec = nec, } end return M
gpl-2.0
dickeyf/darkstar
scripts/globals/items/chocolate_cake.lua
18
1213
----------------------------------------- -- ID: 5633 -- Item: Chocolate Cake -- Food Effect: 3 Hrs, All Races ----------------------------------------- -- TODO: Group Effect -- MP +3% -- MP Recovered while healing +6 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) 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,5633); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MPP, 3); target:addMod(MOD_MPHEAL, 6); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MPP, 3); target:delMod(MOD_MPHEAL, 6); end;
gpl-3.0
Turttle/darkstar
scripts/zones/Aht_Urhgan_Whitegate/npcs/Zarfhid.lua
34
1034
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Zarfhid -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x00DC); 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
SalvationDevelopment/Salvation-Scripts-TCG
c43530283.lua
2
1398
--勇気の砂時計 function c43530283.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(43530283,0)) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetOperation(c43530283.adop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) end function c43530283.adop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(c43530283.atkval) e1:SetReset(RESET_EVENT+0x1ff0000) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_DEFENSE) e2:SetValue(c43530283.defval) c:RegisterEffect(e2) if Duel.GetTurnPlayer()==tp then c:RegisterFlagEffect(43530283,RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,2) else c:RegisterFlagEffect(43530283,RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END+RESET_SELF_TURN,0,1) end end end function c43530283.atkval(e,c) if c:GetFlagEffect(43530283)==0 then return c:GetBaseAttack()*2 else return c:GetBaseAttack()/2 end end function c43530283.defval(e,c) if c:GetFlagEffect(43530283)==0 then return c:GetBaseDefense()*2 else return c:GetBaseDefense()/2 end end
gpl-2.0
Turttle/darkstar
scripts/zones/Port_San_dOria/npcs/Apstaule.lua
36
1764
----------------------------------- -- Area: Port San d'Oria -- NPC: Apstaule -- Not used cutscenes: 541 ----------------------------------- package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Port_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(532,1); AuctionParcel = trade:hasItemQty(0x0252,1); if (MagicFlyer == true and count == 1) then FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then player:messageSpecial(FLYER_REFUSED); end elseif (AuctionParcel == true and count == 1) then TheBrugaireConsortium = player:getQuestStatus(SANDORIA,THE_BRUGAIRE_CONSORTIUM); if (TheBrugaireConsortium == 1) then player:tradeComplete(); player:startEvent(0x021c); player:setVar("TheBrugaireConsortium-Parcels", 21); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x21e); 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
jitsi/jitsi-meet
resources/prosody-plugins/mod_muc_call.lua
2
4126
local ext_events = module:require "ext_events" local jid = require "util.jid" local extract_subdomain = module:require "util".extract_subdomain; -- Options and configuration local poltergeist_component = module:get_option_string( "poltergeist_component", module.host ); local muc_domain_base = module:get_option_string("muc_mapper_domain_base"); if not muc_domain_base then module:log( "warn", "No 'muc_domain_base' option set, unable to send call events." ); return end -- Status strings that trigger call events. local calling_status = "calling" local busy_status = "busy" local rejected_status = "rejected" local connected_status = "connected" local expired_status = "expired" -- url_from_room_jid will determine the url for a conference -- provided a room jid. It is required that muc domain mapping -- is enabled and configured. There are two url formats that are supported. -- The following urls are examples of the supported formats. -- https://meet.jit.si/jitsi/ProductiveMeeting -- https://meet.jit.si/MoreProductiveMeeting -- The urls are derived from portions of the room jid. local function url_from_room_jid(room_jid) local node, _, _ = jid.split(room_jid) if not node then return nil end local target_subdomain, target_node = extract_subdomain(node); if not(target_node or target_subdomain) then return "https://"..muc_domain_base.."/"..node else return "https://"..muc_domain_base.."/"..target_subdomain.."/"..target_node end end -- Listening for all muc presences stanza events. If a presence stanza is from -- a poltergeist then it will be further processed to determine if a call -- event should be triggered. Call events are triggered by status strings -- the status strings supported are: -- ------------------------- -- Status | Event Type -- _________________________ -- "calling" | INVITE -- "busy" | CANCEL -- "rejected" | CANCEL -- "connected" | CANCEL module:hook( "muc-broadcast-presence", function (event) -- Detect if the presence is for a poltergeist or not. if not (jid.bare(event.occupant.jid) == poltergeist_component) then return end -- A presence stanza is needed in order to trigger any calls. if not event.stanza then return end local call_id = event.stanza:get_child_text("call_id") if not call_id then module:log("info", "A call id was not provided in the status.") return end local invite = function() local url = assert(url_from_room_jid(event.stanza.attr.from)) ext_events.invite(event.stanza, url, call_id) end local cancel = function() local url = assert(url_from_room_jid(event.stanza.attr.from)) local status = event.stanza:get_child_text("status") ext_events.cancel(event.stanza, url, string.lower(status), call_id) end -- If for any reason call_cancel is set to true then a cancel -- is sent regardless of the rest of the presence info. local should_cancel = event.stanza:get_child_text("call_cancel") if should_cancel == "true" then cancel() return end local missed = function() cancel() ext_events.missed(event.stanza, call_id) end -- All other call flow actions will require a status. if event.stanza:get_child_text("status") == nil then return end local switch = function(status) case = { [calling_status] = function() invite() end, [busy_status] = function() cancel() end, [rejected_status] = function() missed() end, [expired_status] = function() missed() end, [connected_status] = function() cancel() end } if case[status] then case[status]() end end switch(event.stanza:get_child_text("status")) end, -101 );
apache-2.0
Turttle/darkstar
scripts/zones/Spire_of_Holla/npcs/_0h0.lua
17
1469
----------------------------------- -- Area: Spire of Holla -- NPC: Web of Recollection ----------------------------------- package.loaded["scripts/zones/Spire_of_Holla/TextIDs"] = nil; ----------------------------------- require("scripts/globals/bcnm"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/zones/Spire_of_Holla/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (TradeBCNM(player,player:getZoneID(),trade,npc)) then return; end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (EventTriggerBCNM(player,npc)) then return 1; else player:messageSpecial(FAINT_SCRAPING); return 1; end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("onUpdate CSID: %u",csid); --printf("onUpdate RESULT: %u",option); if (EventUpdateBCNM(player,csid,option)) then return; end end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --printf("onFinish CSID: %u",csid); --printf("onFinish RESULT: %u",option); if (EventFinishBCNM(player,csid,option)) then return; end end;
gpl-3.0
Metastruct/pac3
lua/pac3/core/client/parts/effect.lua
2
5307
local CurTime = CurTime local ParticleEffect = ParticleEffect local PART = {} PART.ClassName = "effect" PART.Groups = {'effects', 'model', 'entity'} PART.Icon = 'icon16/wand.png' pac.StartStorableVars() pac.GetSet(PART, "Effect", "default", {enums = function() return pac.particle_list end}) pac.GetSet(PART, "Loop", true) pac.GetSet(PART, "Follow", true) pac.GetSet(PART, "Rate", 1, {editor_sensitivity = 0.1}) pac.GetSet(PART, "UseParticleTracer", false) pac.SetupPartName(PART, "PointA") pac.SetupPartName(PART, "PointB") pac.SetupPartName(PART, "PointC") pac.SetupPartName(PART, "PointD") pac.EndStorableVars() pac.RemoveProperty(PART, "Translucent") function PART:GetNiceName() return pac.PrettifyName(self:GetEffect()) end function PART:Initialize() self:SetEffect(self.Effect) if not pac.particle_list then local found = {} for file_name in pairs(pac_loaded_particle_effects) do local ok, err = pcall(function() local data = file.Read("particles/"..file_name, "GAME", "b") if data then for str in data:gmatch("\3%c([%a_]+)%c") do if #str > 1 then found[str] = str end end end end) if not ok then pac.Message(Color(255, 50, 50), "unable to parse particle file " .. file_name .. ": " .. err) end end pac.particle_list = found end end function PART:GetOwner() local parent = self:GetParent() if parent:IsValid() and parent.is_model_part and parent.Entity:IsValid() then return parent.Entity end return self.BaseClass.GetOwner(self) end PART.last_spew = 0 if not pac_loaded_particle_effects then pac_loaded_particle_effects = {} for _, file_name in pairs(file.Find("particles/*.pcf", "GAME")) do if not pac_loaded_particle_effects[file_name] and not pac.BlacklistedParticleSystems[file_name:lower()] then game.AddParticles("particles/" .. file_name) end pac_loaded_particle_effects[file_name] = true end end local already = {} local alreadyServer = {} local function pac_request_precache(name) if already[name] then return end already[name] = true PrecacheParticleSystem(name) net.Start("pac_request_precache") net.WriteString(name) net.SendToServer() end function PART:SetEffect(name) self.waitingForServer = true self.Effect = name self.Ready = alreadyServer[name] or false if not alreadyServer[name] then pac_request_precache(name) else self.waitingForServer = false end end pac.AddHook("pac_EffectPrecached", "pac_Effects", function(name) if alreadyServer[name] then return end alreadyServer[name] = true pac.dprint("effect %q precached!", name) pac.CallPartEvent("effect_precached", name) end) function PART:OnEvent(typ, name) if typ == "effect_precached" then if self.Effect == name then self.Ready = true self.waitingForServer = false end end end function PART:OnDraw(owner, pos, ang) if not self.Ready then if not self.waitingForServer then self:SetEffect(self.Effect) end return end local ent = self:GetOwner() if ent:IsValid() and self.Loop then local time = CurTime() if self.last_spew < time then ent:StopParticles() ent:StopParticleEmission() self:Emit(pos, ang) self.last_spew = time + math.max(self.Rate, 0.1) end end end function PART:OnHide() local ent = self:GetOwner() if ent:IsValid() then ent:StopParticles() ent:StopParticleEmission() end end function PART:OnShow(from_rendering) if from_rendering then self:Emit(self:GetDrawPosition()) end end function PART:Emit(pos, ang) local ent = self:GetOwner() if ent:IsValid() then if not self.Effect then ent:StopParticles() ent:StopParticleEmission() return end if self.UseParticleTracer and self.PointA:IsValid() then local ent2 = self.PointA.Entity and self.PointA.Entity or self.PointA:GetOwner() util.ParticleTracerEx( self.Effect, ent:GetPos(), ent2:GetPos(), true, ent:EntIndex(), 0 ) return end if self.PointA:IsValid() then local points = {} table.insert(points, { entity = self.PointA.Entity and self.PointA.Entity or self.PointA:GetOwner(), attachtype = PATTACH_ABSORIGIN_FOLLOW, }) if self.PointB:IsValid() then table.insert(points, { entity = self.PointB.Entity and self.PointB.Entity or self.PointB:GetOwner(), attachtype = PATTACH_ABSORIGIN_FOLLOW, }) end if self.PointC:IsValid() then table.insert(points, { entity = self.PointC.Entity and self.PointC.Entity or self.PointC:GetOwner(), attachtype = PATTACH_ABSORIGIN_FOLLOW, }) end if self.PointD:IsValid() then table.insert(points, { entity = self.PointD.Entity and self.PointD.Entity or self.PointD:GetOwner(), attachtype = PATTACH_ABSORIGIN_FOLLOW, }) end ent:CreateParticleEffect(self.Effect, points) elseif self.Follow then ent:StopParticles() ent:StopParticleEmission() CreateParticleSystem(ent, self.Effect, PATTACH_ABSORIGIN_FOLLOW, 0) else ent:StopParticles() ent:StopParticleEmission() ParticleEffect(self.Effect, pos, ang, ent) end end end pac.RegisterPart(PART)
gpl-3.0
dickeyf/darkstar
scripts/zones/West_Sarutabaruta/npcs/Signpost.lua
13
1933
----------------------------------- -- Area: West Sarutabaruta -- NPC: Signpost (18 total) ----------------------------------- package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil; ----------------------------------- require("scripts/zones/West_Sarutabaruta/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (npc:getID() == 17248823) or (npc:getID() == 17248824) then player:messageSpecial(SIGN_1); elseif (npc:getID() == 17248825) or (npc:getID() == 17248826) then player:messageSpecial(SIGN_3); elseif (npc:getID() == 17248827) or (npc:getID() == 17248828) then player:messageSpecial(SIGN_5); elseif (npc:getID() == 17248829) or (npc:getID() == 17248830) then player:messageSpecial(SIGN_7); elseif (npc:getID() == 17248831) or (npc:getID() == 17248832) then player:messageSpecial(SIGN_9); elseif (npc:getID() == 17248833) or (npc:getID() == 17248834) then player:messageSpecial(SIGN_11); elseif (npc:getID() == 17248835) or (npc:getID() == 17248836) then player:messageSpecial(SIGN_13); elseif (npc:getID() == 17248837) or (npc:getID() == 17248838) then player:messageSpecial(SIGN_15); elseif (npc:getID() == 17248839) or (npc:getID() == 17248840) then player:messageSpecial(SIGN_17); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --print("CSID: %u",csid); --print("RESULT: %u",option); end;
gpl-3.0
Turttle/darkstar
scripts/zones/North_Gustaberg/npcs/Heavy_Fog_IM.lua
30
3055
----------------------------------- -- Area: North Gustaberg -- NPC: Heavy Fog, I.M. -- Type: Border Conquest Guards -- @pos -520.704 38.75 560.258 106 ----------------------------------- package.loaded["scripts/zones/North_Gustaberg/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/North_Gustaberg/TextIDs"); local guardnation = BASTOK; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border local region = GUSTABERG; local csid = 0x7ff8; ----------------------------------- -- 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
Turttle/darkstar
scripts/globals/spells/bluemagic/filamented_hold.lua
18
1471
----------------------------------------- -- Spell: Filamented Hold -- Reduces the attack speed of enemies within a fan-shaped area originating from the caster -- Spell cost: 38 MP -- Monster Type: Vermin -- Spell Type: Magical (Earth) -- Blue Magic Points: 3 -- Stat Bonus: VIT+1 -- Level: 52 -- Casting Time: 2 seconds -- Recast Time: 20 seconds -- Magic Bursts on: Scission, Gravitation, and Darkness -- Combos: Clear Mind ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); require("scripts/globals/bluemagic"); ----------------------------------------- -- OnMagicCastingCheck ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; ----------------------------------------- -- OnSpellCast ----------------------------------------- function onSpellCast(caster,target,spell) local typeEffect = EFFECT_SLOW local dINT = caster:getStat(MOD_MND) - target:getStat(MOD_MND); local resist = applyResistanceEffect(caster,spell,target,dINT,BLUE_SKILL,0,typeEffect); local duration = 90 * resist; local power = 25; if (resist > 0.5) then -- Do it! if (target:addStatusEffect(typeEffect,power,0,duration)) then spell:setMsg(236); else spell:setMsg(75); end else spell:setMsg(85); end; return typeEffect; end;
gpl-3.0
fgenesis/Aquaria_experimental
game_scripts/scripts/include/collectiblecostumetemplate.lua
6
2658
-- Copyright (C) 2007, 2010 - Bit-Blot -- -- This file is part of Aquaria. -- -- Aquaria is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if not v then v = {} end -- generic collectible costume dofile("scripts/include/collectibletemplate.lua") v.on = false v.cname = "" function v.commonInit2(me, gfx, flag, costumeName) v.commonInit(me, gfx, flag, true) v.cname = costumeName entity_setEntityLayer(me, -1) -- cached now loadSound("ChangeClothes1") loadSound("ChangeClothes2") end function update(me, dt) v.commonUpdate(me, dt) if entity_isState(me, STATE_COLLECTEDINHOUSE) then if getCostume() == v.cname then if v.on then entity_alpha(me, 0.5) v.on = false end else if not v.on then entity_alpha(me, 1) v.on = true end end end end function enterState(me, state) v.commonEnterState(me, state) if entity_isState(me, STATE_COLLECTEDINHOUSE) then entity_setActivation(me, AT_CLICK, 32, 700) end end function activate(me) if entity_isState(me, STATE_COLLECTEDINHOUSE) then -- go to changing area if not isForm(FORM_NORMAL) then changeForm(FORM_NORMAL) end local node = getNode("CHANGE") avatar_fallOffWall() watch(0.5) entity_swimToNode(getNaija(), node) entity_watchForPath(getNaija()) entity_idle(getNaija()) entity_setColor(getNaija(), 0.01, 0.01, 0.01, 1) watch(0.5) entity_animate(getNaija(), "changeCostume") watch(1) playSfx("ChangeClothes1") watch(1) playSfx("ChangeClothes2") watch(1.2) watch(0.6) playSfx("ChangeClothes1") if getCostume() == v.cname then setCostume("") else setCostume(v.cname) end while entity_isAnimating(getNaija()) do watch(FRAME_TIME) end watch(0.5) -- change --watch(0.5) entity_setColor(getNaija(), 1, 1, 1, 0.5) entity_swimToNode(getNaija(), getNode("CHANGEEXIT")) entity_watchForPath(getNaija()) if chance(50) then emote(EMOTE_NAIJAGIGGLE) end end end function exitState(me, state) v.commonExitState(me, state) end
gpl-2.0
iskygame/skynet
service/sharedatad.lua
11
3325
local skynet = require "skynet" local sharedata = require "sharedata.corelib" local table = table local cache = require "skynet.codecache" cache.mode "OFF" -- turn off codecache, because CMD.new may load data file local NORET = {} local pool = {} local pool_count = {} local objmap = {} local collect_tick = 600 local function newobj(name, tbl) assert(pool[name] == nil) local cobj = sharedata.host.new(tbl) sharedata.host.incref(cobj) local v = { value = tbl , obj = cobj, watch = {} } objmap[cobj] = v pool[name] = v pool_count[name] = { n = 0, threshold = 16 } end local function collect10sec() if collect_tick > 10 then collect_tick = 10 end end local function collectobj() while true do skynet.sleep(100) -- sleep 1s if collect_tick <= 0 then collect_tick = 600 -- reset tick count to 600 sec collectgarbage() for obj, v in pairs(objmap) do if v == true then if sharedata.host.getref(obj) <= 0 then objmap[obj] = nil sharedata.host.delete(obj) end end end else collect_tick = collect_tick - 1 end end end local CMD = {} local env_mt = { __index = _ENV } function CMD.new(name, t, ...) local dt = type(t) local value if dt == "table" then value = t elseif dt == "string" then value = setmetatable({}, env_mt) local f if t:sub(1,1) == "@" then f = assert(loadfile(t:sub(2),"bt",value)) else f = assert(load(t, "=" .. name, "bt", value)) end local _, ret = assert(skynet.pcall(f, ...)) setmetatable(value, nil) if type(ret) == "table" then value = ret end elseif dt == "nil" then value = {} else error ("Unknown data type " .. dt) end newobj(name, value) end function CMD.delete(name) local v = assert(pool[name]) pool[name] = nil pool_count[name] = nil assert(objmap[v.obj]) objmap[v.obj] = true sharedata.host.decref(v.obj) for _,response in pairs(v.watch) do response(true) end end function CMD.query(name) local v = assert(pool[name]) local obj = v.obj sharedata.host.incref(obj) return v.obj end function CMD.confirm(cobj) if objmap[cobj] then sharedata.host.decref(cobj) end return NORET end function CMD.update(name, t, ...) local v = pool[name] local watch, oldcobj if v then watch = v.watch oldcobj = v.obj objmap[oldcobj] = true sharedata.host.decref(oldcobj) pool[name] = nil pool_count[name] = nil end CMD.new(name, t, ...) local newobj = pool[name].obj if watch then sharedata.host.markdirty(oldcobj) for _,response in pairs(watch) do response(true, newobj) end end collect10sec() -- collect in 10 sec end local function check_watch(queue) local n = 0 for k,response in pairs(queue) do if not response "TEST" then queue[k] = nil n = n + 1 end end return n end function CMD.monitor(name, obj) local v = assert(pool[name]) if obj ~= v.obj then return v.obj end local n = pool_count[name].n + 1 if n > pool_count[name].threshold then n = n - check_watch(v.watch) pool_count[name].threshold = n * 2 end pool_count[name].n = n table.insert(v.watch, skynet.response()) return NORET end skynet.start(function() skynet.fork(collectobj) skynet.dispatch("lua", function (session, source ,cmd, ...) local f = assert(CMD[cmd]) local r = f(...) if r ~= NORET then skynet.ret(skynet.pack(r)) end end) end)
mit
SalvationDevelopment/Salvation-Scripts-TCG
c86137485.lua
5
1970
--ヘル・ツイン・コップ function c86137485.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_FIEND),aux.NonTuner(nil),1) c:EnableReviveLimit() --chain attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(86137485,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetCondition(c86137485.atcon1) e1:SetOperation(c86137485.atop1) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(86137485,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(c86137485.atcon2) e2:SetOperation(c86137485.atop2) c:RegisterEffect(e2) end function c86137485.atcon1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return Duel.GetTurnPlayer()==tp and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER) and c:IsChainAttackable() and c:IsStatus(STATUS_OPPO_BATTLE) end function c86137485.atop1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(800) e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END) c:RegisterEffect(e1) Duel.ChainAttack() end function c86137485.atcon2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return Duel.GetTurnPlayer()~=tp and c:IsRelateToBattle() and c:IsStatus(STATUS_OPPO_BATTLE) and bc:IsLocation(LOCATION_GRAVE) and bc:IsType(TYPE_MONSTER) end function c86137485.atop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(800) e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END) c:RegisterEffect(e1) end
gpl-2.0
alfred-bot/zacbot
plugins/Help.lua
1
4645
do function pairsByKeys(t, f) local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 local iter = function () i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter end local function has_usage_data(dict) if (dict.usage == nil or dict.usage == '') then return false end return true end local function plugin_help(name,number,requester) local plugin = "" if number then local i = 0 for name in pairsByKeys(plugins) do if plugins[name].hidden then name = nil else i = i + 1 if i == tonumber(number) then plugin = plugins[name] end end end else plugin = plugins[name] if not plugin then return nil end end local text = "" if (type(plugin.usage) == "table") then for ku,usage in pairs(plugin.usage) do if ku == 'user' then if (type(plugin.usage.user) == "table") then for k,v in pairs(plugin.usage.user) do text = text..v..'\n' end elseif has_usage_data(plugin) then text = text..plugin.usage.user..'\n' end elseif ku == 'moderator' then if requester == 'moderator' or requester == 'admin' or requester == 'sudo' then if (type(plugin.usage.moderator) == "table") then for k,v in pairs(plugin.usage.moderator) do text = text..v..'\n' end elseif has_usage_data(plugin) then text = text..plugin.usage.moderator..'\n' end end elseif ku == 'admin' then if requester == 'admin' or requester == 'sudo' then if (type(plugin.usage.admin) == "table") then for k,v in pairs(plugin.usage.admin) do text = text..v..'\n' end elseif has_usage_data(plugin) then text = text..plugin.usage.admin..'\n' end end elseif ku == 'sudo' then if requester == 'sudo' then if (type(plugin.usage.sudo) == "table") then for k,v in pairs(plugin.usage.sudo) do text = text..v..'\n' end elseif has_usage_data(plugin) then text = text..plugin.usage.sudo..'\n' end end else text = text..usage..'\n' end end text = text..'_________________________\n' elseif has_usage_data(plugin) then text = text..plugin.usage..'\n_________________________\n' end return text end local function telegram_help() local i = 0 local text = "ZAC Team Robot Tools List:\n\n" for name in pairsByKeys(plugins) do if plugins[name].hidden then name = nil else i = i + 1 text = text..i..'. '..name..'\n' end end text = text..'\n'..'Send !help <Name> or !help <Num> For See More Info' text = text..'\n'..'Send !helps For See More Info For All Tools' text = text..'\n'..'Send !ver For See ZAC Robot Info' text = text..'\n'..'Channel: @ZACteam - Sudo: @shayansoft' return text end local function help_all(requester) local ret = "" for name in pairsByKeys(plugins) do if plugins[name].hidden then name = nil else ret = ret .. plugin_help(name, nil, requester) end end return ret end local function run(msg, matches) if is_sudo(msg) then requester = "sudo" elseif is_admin(msg) then requester = "admin" elseif is_momod(msg) then requester = "moderator" else requester = "user" end if matches[1] == "!help" then return telegram_help() elseif matches[1] == "!helps" then return help_all(requester) else local text = "" if tonumber(matches[1]) then text = plugin_help(nil, matches[1], requester) else text = plugin_help(matches[1], nil, requester) end if not text then text = telegram_help() end return text end end return { description = "ZAC Team Robot Help", usage = { "!help : ZAC Bot Tools Help", "!helps : See More Info For All Tools", "!help <Name> : See More Info For Item", "!help <Num>: See More Info For Item" }, patterns = { "^!help$", "^!helps", "^!help (.+)" }, run = run } end
gpl-2.0
eugeneia/snabb
src/lib/tsc.lua
6
3275
-- Use of this source code is governed by the Apache 2.0 license; see COPYING. -- Provide a time stamp counter suitable for measuring time intervals. module(...,package.seeall) local lib = require("core.lib") local C = require("ffi").C require("core.lib_h") default_source = 'rdtsc' local calibration_interval = 5e8 -- Return the value of the CPU's TSC register local rdtsc_code rdtsc = require('dynasm').loadstring [[ local ffi = require('ffi') local dasm = require('dasm') |.arch x64 |.actionlist actions local Dst = dasm.new(actions) | rdtsc | shl rdx, 32 | or rax, rdx | ret rdtsc_code = Dst:build() return ffi.cast('uint64_t (*)()', rdtsc_code) ]]() local cpuinfo = lib.readfile("/proc/cpuinfo", "*a") assert(cpuinfo, "failed to read /proc/cpuinfo for tsc check") local have_usable_rdtsc = (cpuinfo:match("constant_tsc") and cpuinfo:match("nonstop_tsc")) local rdtsc_tps local time_sources = { rdtsc = { time_fn = rdtsc, calibrate_fn = function () if not rdtsc_tps then local start_ns = C.get_time_ns() local start_ticks = rdtsc() for _ = 1, calibration_interval do end local end_ticks = rdtsc() local end_ns = C.get_time_ns() rdtsc_tps = tonumber(end_ticks - start_ticks)/tonumber(end_ns - start_ns) * 1000000000 + 0ULL end return rdtsc_tps end }, system = { time_fn = C.get_time_ns, calibrate_fn = function () return 1000000000ULL end } } local tsc = {} function new (arg) local config = lib.parse(arg, { source = { default = default_source } }) local o = {} if config.source == 'rdtsc' and not have_usable_rdtsc then print("tsc: rdtsc is unusable on this system, " .. "falling back to system time source") config.source = 'system' end o._source = config.source local source = assert(time_sources[o._source], "tsc: unknown time source '" .. o._source .."'") o._time_fn = source.time_fn -- Ticks per second (uint64) o._tps = source.calibrate_fn() -- Nanoseconds per tick (Lua number) o._nspt = 1/tonumber(o._tps) * 1000000000 return setmetatable( o, { __index = tsc }) end function tsc:source () return self._source end function tsc:time_fn () return self._time_fn end function tsc:stamp () return self._time_fn() end function tsc:tps () return self._tps end function tsc:to_ns (ticks) if self._source == 'system' then return ticks else return tonumber(ticks) * self._nspt + 0ULL end end function selftest() local function check(tsc) for _ = 1, 10 do local start_ns = C.get_time_ns() local start_tsc = tsc:stamp() for _ = 1, calibration_interval do end local end_ns = C.get_time_ns() local end_tsc = tsc:stamp() local diff_ns = tonumber(end_ns - start_ns) local diff_tsc = tonumber(tsc:to_ns(end_tsc) - tsc:to_ns(start_tsc)) local diff = diff_ns - diff_tsc assert(math.abs(diff/diff_ns) < 1e-3, tsc:source()) end end check(new({ source = 'rdtsc' })) check(new({ source = 'system' })) end
apache-2.0
Turttle/darkstar
scripts/zones/Windurst_Woods/npcs/Ponono.lua
44
2111
----------------------------------- -- Area: Windurst Woods -- NPC: Ponono -- Type: Clothcraft Guild Master -- @pos -38.243 -2.25 -120.954 241 ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; ----------------------------------- require("scripts/globals/status"); require("scripts/globals/crafting"); require("scripts/zones/Windurst_Woods/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local newRank = tradeTestItem(player,npc,trade,SKILL_CLOTHCRAFT); if (newRank ~= 0) then player:setSkillRank(SKILL_CLOTHCRAFT,newRank); player:startEvent(0x271c,0,0,0,0,newRank); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local getNewRank = 0; local craftSkill = player:getSkillLevel(SKILL_CLOTHCRAFT); local testItem = getTestItem(player,npc,SKILL_CLOTHCRAFT); local guildMember = isGuildMember(player,3); if (guildMember == 1) then guildMember = 10000; end if (canGetNewRank(player,craftSkill,SKILL_CLOTHCRAFT) == 1) then getNewRank = 100; end player:startEvent(0x271b,testItem,getNewRank,30,guildMember,44,0,0,0); end; -- 0x271b 0x271c 0x02bc 0x02bd 0x02be 0x02bf 0x02c0 0x02c1 0x0340 0x02fd ----------------------------------- -- 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 == 0x271b and option == 1) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,4099); else player:addItem(4099); player:messageSpecial(ITEM_OBTAINED,4099); signupGuild(player,8); end end end;
gpl-3.0
dickeyf/darkstar
scripts/zones/Windurst_Woods/npcs/Ponono.lua
44
2111
----------------------------------- -- Area: Windurst Woods -- NPC: Ponono -- Type: Clothcraft Guild Master -- @pos -38.243 -2.25 -120.954 241 ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; ----------------------------------- require("scripts/globals/status"); require("scripts/globals/crafting"); require("scripts/zones/Windurst_Woods/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local newRank = tradeTestItem(player,npc,trade,SKILL_CLOTHCRAFT); if (newRank ~= 0) then player:setSkillRank(SKILL_CLOTHCRAFT,newRank); player:startEvent(0x271c,0,0,0,0,newRank); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local getNewRank = 0; local craftSkill = player:getSkillLevel(SKILL_CLOTHCRAFT); local testItem = getTestItem(player,npc,SKILL_CLOTHCRAFT); local guildMember = isGuildMember(player,3); if (guildMember == 1) then guildMember = 10000; end if (canGetNewRank(player,craftSkill,SKILL_CLOTHCRAFT) == 1) then getNewRank = 100; end player:startEvent(0x271b,testItem,getNewRank,30,guildMember,44,0,0,0); end; -- 0x271b 0x271c 0x02bc 0x02bd 0x02be 0x02bf 0x02c0 0x02c1 0x0340 0x02fd ----------------------------------- -- 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 == 0x271b and option == 1) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,4099); else player:addItem(4099); player:messageSpecial(ITEM_OBTAINED,4099); signupGuild(player,8); end end end;
gpl-3.0
dickeyf/darkstar
scripts/globals/mobskills/Polar_Blast.lua
33
1412
--------------------------------------------- -- Polar Blast -- -- Description: Deals Ice damage to enemies within a fan-shaped area. Additional effect: Paralyze -- Type: Breath -- Ignores Shadows -- Range: Unknown Cone --------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------- function onMobSkillCheck(target,mob,skill) if(mob:getFamily() == 316) then local mobSkin = mob:getModelId(); if (mobSkin == 1796) then return 0; else return 1; end end if (mob:AnimationSub() <= 1) then return 0; else return 1; end end; function onMobWeaponSkill(target, mob, skill) local dmgmod = MobBreathMove(mob, target, 0.01, 0.1, ELE_ICE, 700); local dmg = MobFinalAdjustments(dmgmod,mob,skill,target,MOBSKILL_BREATH,MOBPARAM_ICE,MOBPARAM_IGNORE_SHADOWS); MobStatusEffectMove(mob, target, EFFECT_PARALYSIS, 15, 0, 60); target:delHP(dmg); if (mob:getFamily() == 313 and bit.band(mob:getBehaviour(),BEHAVIOUR_NO_TURN) == 0 and mob:AnimationSub() == 1) then -- re-enable no turn if third head is dead (Tinnin), else it's re-enabled after the upcoming Pyric Blast mob:setBehaviour(bit.bor(mob:getBehaviour(), BEHAVIOUR_NO_TURN)) end return dmg; end;
gpl-3.0
kreukle/MemNN
MemN2N-lang-model/data.lua
18
1101
-- Copyright (c) 2015-present, Facebook, Inc. -- All rights reserved. -- -- This source code is licensed under the BSD-style license found in the -- LICENSE file in the root directory of this source tree. An additional grant -- of patent rights can be found in the PATENTS file in the same directory. require('paths') local stringx = require('pl.stringx') local file = require('pl.file') function g_read_words(fname, vocab, ivocab) local data = file.read(fname) local lines = stringx.splitlines(data) local c = 0 for n = 1,#lines do local w = stringx.split(lines[n]) c = c + #w + 1 end local words = torch.Tensor(c, 1) c = 0 for n = 1,#lines do local w = stringx.split(lines[n]) for i = 1,#w do c = c + 1 if not vocab[w[i]] then ivocab[#vocab+1] = w[i] vocab[w[i]] = #vocab+1 end words[c][1] = vocab[w[i]] end c = c + 1 words[c][1] = vocab['<eos>'] end print('Read ' .. c .. ' words from ' .. fname) return words end
bsd-3-clause
Turttle/darkstar
scripts/globals/weaponskills/burning_blade.lua
30
1294
----------------------------------- -- Burning Blade -- Sword weapon skill -- Skill Level: 30 -- Desription: Deals Fire elemental damage to enemy. Damage varies with TP. -- Aligned with the Flame Gorget. -- Aligned with the Flame Belt. -- Element: Fire -- Modifiers: STR:20% ; INT:20% -- 100%TP 200%TP 300%TP -- 1.00 2.00 2.50 ----------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; 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.ele = ELE_FIRE; params.skill = SKILL_SWD; params.includemab = true; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp200 = 2.1; params.ftp300 = 3.4; params.str_wsc = 0.4; params.int_wsc = 0.4; end local damage, criticalHit, tpHits, extraHits = doMagicWeaponskill(player, target, params); damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
fgenesis/Aquaria_experimental
game_scripts/scripts/maps/node_openenergydoor.lua
12
1262
-- Copyright (C) 2007, 2010 - Bit-Blot -- -- This file is part of Aquaria. -- -- Aquaria is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if not v then v = {} end if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end function init(me) node_setCursorActivation(me, false) end function activate(me) local energyOrb = node_getNearestEntity(me, "EnergyOrb") if energyOrb ~= 0 and entity_isState(energyOrb, STATE_CHARGED) then local door = node_getNearestEntity(me, "EnergyDoor") if door ~= 0 then entity_setState(door, STATE_OPEN) end end end function update(me, dt) end
gpl-2.0
Metastruct/pac3
lua/pac3/libraries/sh_boneanimlib.lua
1
6602
--[[ Bone Animations Library Created by William "JetBoom" Moodhe (williammoodhe@gmail.com / www.noxiousnet.com) Because I wanted custom, dynamic animations. Give credit or reference if used in your creations. ]] local _G = _G module("boneanimlib",package.seeall) TYPE_GESTURE = 0 -- Gestures are keyframed animations that use the current position and angles of the bones. They play once and then stop automatically. TYPE_POSTURE = 1 -- Postures are static animations that use the current position and angles of the bones. They stay that way until manually stopped. Use TimeToArrive if you want to have a posture lerp. TYPE_STANCE = 2 -- Stances are keyframed animations that use the current position and angles of the bones. They play forever until manually stopped. Use RestartFrame to specify a frame to go to if the animation ends (instead of frame 1). TYPE_SEQUENCE = 3 -- Sequences are keyframed animations that use the reference pose. They play forever until manually stopped. Use RestartFrame to specify a frame to go to if the animation ends (instead of frame 1). -- You can also use StartFrame to specify a starting frame for the first loop. INTERP_LINEAR = 0 -- Straight linear interp. INTERP_COSINE = 1 -- Best compatability / quality balance. INTERP_CUBIC = 2 -- Overall best quality blending but may cause animation frames to go 'over the top'. INTERP_DEFAULT = INTERP_COSINE local Animations = {} function GetLuaAnimations() return Animations end function RegisterLuaAnimation(sName, tInfo) if tInfo and tInfo.FrameData then local BonesUsed = {} for iFrame, tFrame in ipairs(tInfo.FrameData) do for iBoneID, tBoneTable in pairs(tFrame.BoneInfo) do BonesUsed[iBoneID] = (BonesUsed[iBoneID] or 0) + 1 tBoneTable.MU = tBoneTable.MU or 0 tBoneTable.MF = tBoneTable.MF or 0 tBoneTable.MR = tBoneTable.MR or 0 tBoneTable.RU = tBoneTable.RU or 0 tBoneTable.RF = tBoneTable.RF or 0 tBoneTable.RR = tBoneTable.RR or 0 end end if #tInfo.FrameData > 1 then for iBoneUsed, iTimesUsed in pairs(BonesUsed) do for iFrame, tFrame in ipairs(tInfo.FrameData) do if not tFrame.BoneInfo[iBoneUsed] then tFrame.BoneInfo[iBoneUsed] = {MU = 0, MF = 0, MR = 0, RU = 0, RF = 0, RR = 0} end end end end end Animations[sName] = tInfo end ----------------------------- -- Deserialize / Serialize -- ----------------------------- function Deserialize(str) error"unsafe" end _G.GetLuaAnimations=GetLuaAnimations _G.RegisterLuaAnimation=RegisterLuaAnimation local allowedtypes = {} allowedtypes["string"] = true allowedtypes["number"] = true allowedtypes["table"] = true allowedtypes["Vector"] = true allowedtypes["Angle"] = true allowedtypes["boolean"] = true local function MakeTable(tab, done) local str = "" local done = done or {} local sequential = table.IsSequential(tab) for key, value in pairs(tab) do local keytype = type(key) local valuetype = type(value) if allowedtypes[keytype] and allowedtypes[valuetype] then if sequential then key = "" else if keytype == "number" or keytype == "boolean" then key ="["..tostring(key).."]=" else key = "["..string.format("%q", tostring(key)).."]=" end end if valuetype == "table" and not done[value] then done[value] = true if type(value._serialize) == "function" then str = str..key..value:_serialize().."," else str = str..key.."{"..MakeTable(value, done).."}," end else if valuetype == "string" then value = string.format("%q", value) elseif valuetype == "Vector" then value = "Vector("..value.x..","..value.y..","..value.z..")" elseif valuetype == "Angle" then value = "Angle("..value.pitch..","..value.yaw..","..value.roll..")" else value = tostring(value) end str = str .. key .. value .. "," end end end if string.sub(str, -1) == "," then return string.sub(str, 1, #str - 1) else return str end end function Serialize(tIn, bRaw) if bRaw then return "{"..MakeTable(tIn).."}" end return "SRL={"..MakeTable(tIn).."}" end --------------------------------- -- End Deserialize / Serialize -- --------------------------------- -- If your animation is only used on one model, use numbers instead of bone names (cache the lookup). -- If it's being used on a wide array of models (including default player models) then you should use bone names. -- You can use Callback as a function instead of MU, RR, etc. which will allow you to do some interesting things. -- See cl_boneanimlib.lua for the full format. -- STANCE: stancetest -- A simple looping stance that stretches the model's spine up and down until stopped. RegisterLuaAnimation("stancetest", { FrameData = { { BoneInfo = { ["ValveBiped.Bip01_Spine"] = { MU = 64 } }, FrameRate = 0.25 }, { BoneInfo = { ["ValveBiped.Bip01_Spine"] = { MU = -32 } }, FrameRate = 1.5 }, { BoneInfo = { ["ValveBiped.Bip01_Spine"] = { MU = 32 } }, FrameRate = 4 } }, RestartFrame = 2, Type = TYPE_STANCE }) --[[ STANCE: staffholdspell To be used with the ACT_HL2MP_IDLE_MELEE2 animation. Player holds the staff so that their left hand is over the top of it. ]] RegisterLuaAnimation("staffholdspell", { FrameData = { { BoneInfo = { ["ValveBiped.Bip01_R_Forearm"] = { RU = 40, RF = -40 }, ["ValveBiped.Bip01_R_Upperarm"] = { RU = 40 }, ["ValveBiped.Bip01_R_Hand"] = { RU = -40 }, ["ValveBiped.Bip01_L_Forearm"] = { RU = 40 }, ["ValveBiped.Bip01_L_Hand"] = { RU = -40 } }, FrameRate = 6 }, { BoneInfo = { ["ValveBiped.Bip01_R_Forearm"] = { RU = 2, }, ["ValveBiped.Bip01_R_Upperarm"] = { RU = 1 }, ["ValveBiped.Bip01_R_Hand"] = { RU = -10 }, ["ValveBiped.Bip01_L_Forearm"] = { RU = 8 }, ["ValveBiped.Bip01_L_Hand"] = { RU = -12 } }, FrameRate = 0.4 }, { BoneInfo = { ["ValveBiped.Bip01_R_Forearm"] = { RU = -2, }, ["ValveBiped.Bip01_R_Upperarm"] = { RU = -1 }, ["ValveBiped.Bip01_R_Hand"] = { RU = 10 }, ["ValveBiped.Bip01_L_Forearm"] = { RU = -8 }, ["ValveBiped.Bip01_L_Hand"] = { RU = 12 } }, FrameRate = 0.1 } }, RestartFrame = 2, Type = TYPE_STANCE, ShouldPlay = function(pl, sGestureName, tGestureTable, iCurFrame, tFrameData) local wepstatus = pl.WeaponStatus return wepstatus and wepstatus:IsValid() and wepstatus:GetSkin() == 1 and wepstatus.IsStaff end })
gpl-3.0
dickeyf/darkstar
scripts/globals/items/bowl_of_witch_stew.lua
18
1449
----------------------------------------- -- ID: 4344 -- Item: witch_stew -- Food Effect: 4hours, All Races ----------------------------------------- -- Magic Points 45 -- Strength -1 -- Mind 4 -- MP Recovered While Healing 4 -- Enmity -4 ----------------------------------------- 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,4344); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MP, 45); target:addMod(MOD_STR, -1); target:addMod(MOD_MND, 4); target:addMod(MOD_MPHEAL, 4); target:addMod(MOD_ENMITY, -4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MP, 45); target:delMod(MOD_STR, -1); target:delMod(MOD_MND, 4); target:delMod(MOD_MPHEAL, 4); target:delMod(MOD_ENMITY, -4); end;
gpl-3.0
fgenesis/Aquaria_experimental
game_scripts/scripts/entities/wisp.lua
6
3458
-- Copyright (C) 2007, 2010 - Bit-Blot -- -- This file is part of Aquaria. -- -- Aquaria is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if not v then v = {} end if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end v.n = 0 v.mld = 0.2 v.ld = v.mld v.note = -1 v.excited = 0 v.glow = 0 function init(me) setupEntity(me) entity_setEntityType(me, ET_ENEMY) entity_setTexture(me, "Wisp") entity_setAllDamageTargets(me, true) entity_setDamageTarget(me, DT_AVATAR_LIZAP, false) entity_setCollideRadius(me, 20) entity_setState(me, STATE_IDLE) entity_addRandomVel(me, 500) v.glow = createQuad("Naija/LightFormGlow", 13) quad_scale(v.glow, 2, 2) entity_setHealth(me, 6) entity_setDeathParticleEffect(me, "TinyRedExplode") entity_setUpdateCull(me, 3000) entity_setDamageTarget(me, DT_AVATAR_PET, false) end function dieNormal(me) if chance(5) then spawnIngredient("GlowingEgg", entity_x(me), entity_y(me)) end end function postInit(me) v.n = getNaija() entity_setTarget(me, v.n) end function update(me, dt) v.ld = v.ld - dt if v.ld < 0 then v.ld = v.mld local l = createQuad("Naija/LightFormGlow", 13) local r = 1 local g = 1 local b = 1 if v.note ~= -1 then r, g, b = getNoteColor(v.note) r = r*0.5 + 0.5 g = g*0.5 + 0.5 b = b*0.5 + 0.5 end quad_setPosition(l, entity_getPosition(me)) quad_scale(l, 1.5, 1.5) quad_alpha(l, 0) quad_alpha(l, 1, 0.5) quad_color(l, r, g, b) quad_delete(l, 4) quad_color(v.glow, r, g, b, 0.5) end --entity_doCollisionAvoidance(me, dt, 8, 0.2) entity_doCollisionAvoidance(me, dt, 4, 0.8) entity_updateMovement(me, dt) entity_handleShotCollisions(me) --entity_touchAvatarDamage(me, entity_getCollideRadius(me), 1, 500) if v.excited > 0 then v.excited = v.excited - dt if v.excited < 0 then entity_addRandomVel(me, 500) end if entity_isTargetInRange(me, 256) then entity_moveAroundTarget(me, dt, 1000) else entity_moveTowardsTarget(me, dt, 400) end end if not entity_isRotating(me) then entity_rotateToVel(me, 0.2) end quad_setPosition(v.glow, entity_getPosition(me)) end function enterState(me) if entity_isState(me, STATE_IDLE) then elseif entity_isState(me, STATE_DEAD) then quad_delete(v.glow, 1) end end function exitState(me) end function damage(me, attacker, bone, damageType, dmg) return true end function animationKey(me, key) end function hitSurface(me) end function songNote(me, n) v.note = n v.excited = 10 --entity_rotate(me, entity_getRotation(me)+360, 0.5, 0, 0, 1) quad_scale(v.glow, 2, 2) quad_scale(v.glow, 4, 4, 0.5, 1, 1, 1) entity_setMaxSpeedLerp(me, 1.25) entity_setMaxSpeedLerp(me, 1, 3) end function songNoteDone(me, note) v.excited = 3 end function song(me, song) end function activate(me) end
gpl-2.0
dickeyf/darkstar
scripts/globals/items/pot_of_honey.lua
18
1119
----------------------------------------- -- ID: 4370 -- Item: pot_of_honey -- Food Effect: 5Min, All Races ----------------------------------------- -- Magic Regen While Healing 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,300,4370); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MPHEAL, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MPHEAL, 1); end;
gpl-3.0
Turttle/darkstar
scripts/zones/Jugner_Forest/npcs/Pure_Heart_IM.lua
30
3050
----------------------------------- -- Area: Jugner Forest -- NPC: Pure Heart, I.M. -- Type: Border Conquest Guards -- @pos 570.732 -2.637 553.508 104 ----------------------------------- package.loaded["scripts/zones/Jugner_Forest/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Jugner_Forest/TextIDs"); local guardnation = BASTOK; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border local region = NORVALLEN; local csid = 0x7ff8; ----------------------------------- -- 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
dickeyf/darkstar
scripts/zones/Riverne-Site_A01/mobs/Carmine_Dobsonfly.lua
7
1800
----------------------------------- -- Area: Riverne Site A01 -- MOB: Carmine Dobsonfly ----------------------------------- ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) mob:setMobMod(MOBMOD_SUPERLINK, 16900230); -- mobID of the first one mob:SetMagicCastingEnabled(false); -- does not cast spells while idle end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) mob:SetMagicCastingEnabled(true); end; ----------------------------------- -- onMobDisengage ----------------------------------- function onMobDisengage(mob) mob:SetMagicCastingEnabled(false); end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, killer, ally) local firstDobsonfly = 16900230; local mobID = mob:getID(); local carminesKilled = GetServerVariable("[NM]Carmine_Dobsonflies_Killed"); if (bit.band(carminesKilled, bit.lshift(1, (mobID - firstDobsonfly))) == 0) then carminesKilled = bit.bor(carminesKilled, bit.lshift(1, (mobID - firstDobsonfly))); if (carminesKilled == 1023) then -- all have been defeated, allow for them to respawn while setting their respawn time to be all the same local respawnTime = math.random(75600,86400); for i = firstDobsonfly, firstDobsonfly + 9, 1 do DeterMob(i, false); GetMobByID(i):setRespawnTime(respawnTime); end carminesKilled = 0; -- clear the server var else -- prevent them from respawning DeterMob(mobID, true); end SetServerVariable("[NM]Carmine_Dobsonflies_Killed", carminesKilled); end end;
gpl-3.0
Turttle/darkstar
scripts/zones/North_Gustaberg_[S]/npcs/Gebhardt.lua
19
1206
----------------------------------- -- Area: North Gustaberg (S) (I-6) -- NPC: Gebhardt -- Involved in Quests: The Fighting Fourth ----------------------------------- package.loaded["scripts/zones/North_Gustaberg_[S]/TextIDs"] = nil; package.loaded["scripts/globals/quests"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/North_Gustaberg_[S]/TextIDs"); require("scripts/globals/keyitems"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(CRYSTAL_WAR,THE_FIGHTING_FOURTH) == QUEST_ACCEPTED and player:hasKeyItem(917)) == true then player:startEvent(0x0066) else player:startEvent(0x006E) end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x0066) then player:delKeyItem(BATTLE_RATIONS); player:setVar("THE_FIGHTING_FOURTH",1); end end;
gpl-3.0
Turttle/darkstar
scripts/zones/Aht_Urhgan_Whitegate/npcs/Bhoy_Yhupplo.lua
30
3598
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Bhoy Yhupplo -- Type: Assault Mission Giver -- @pos 127.474 0.161 -30.418 50 ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); require("scripts/globals/besieged"); require("scripts/globals/missions"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local rank = getMercenaryRank(player); local haveimperialIDtag; local assaultPoints = player:getAssaultPoint(ILRUSI_ASSAULT_POINT); if (player:hasKeyItem(IMPERIAL_ARMY_ID_TAG)) then haveimperialIDtag = 1; else haveimperialIDtag = 0; end if (rank > 0) then player:startEvent(277,rank,haveimperialIDtag,assaultPoints,player:getCurrentAssault()); else player:startEvent(283); -- no rank 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 == 277) then local selectiontype = bit.band(option, 0xF); if (selectiontype == 1) then -- taken assault mission player:addAssault(bit.rshift(option,4)); player:delKeyItem(IMPERIAL_ARMY_ID_TAG); player:addKeyItem(ILRUSI_ASSAULT_ORDERS); player:messageSpecial(KEYITEM_OBTAINED,ILRUSI_ASSAULT_ORDERS); elseif (selectiontype == 2) then -- purchased an item local item = bit.rshift(option,14); local itemID = 0; local price = 0; -- Copy/pasted from Famad, TODO: fill in the actual IDs/prices for Bhoy Yhupplo --[[if (item == 1) then itemID = 15972; price = 3000; elseif (item == 2) then itemID = 15777; price = 5000; elseif (item == 3) then itemID = 15523; price = 8000; elseif (item == 4) then itemID = 15886; price = 10000; elseif (item == 5) then itemID = 15492; price = 10000; elseif (item == 6) then itemID = 18583; price = 10000; elseif (item == 7) then itemID = 18388; price = 15000; elseif (item == 8) then itemID = 18417; price = 15000; elseif (item == 9) then itemID = 14940; price = 15000; elseif (item == 10) then itemID = 15690; price = 20000; elseif (item == 11) then itemID = 14525; price = 20000; else return; end player:addItem(itemID); player:messageSpecial(ITEM_OBTAINED,itemID); player:delAssaultPoint(LEBROS_ASSAULT_POINT,price);]] end end end;
gpl-3.0
dickeyf/darkstar
scripts/zones/QuBia_Arena/npcs/Burning_Circle.lua
27
2594
----------------------------------- -- Area: Qu'Bia Arena -- NPC: Burning Circle -- @pos -221 -24 19 206 ------------------------------------- package.loaded["scripts/zones/QuBia_Arena/TextIDs"] = nil; ------------------------------------- require("scripts/globals/bcnm"); require("scripts/globals/missions"); require("scripts/globals/keyitems"); require("scripts/zones/QuBia_Arena/TextIDs"); ------------------------------------- -- 0: The Ruins of Fei'Yin, Darkness Rising, The Final Seal (Rank 5 Mission) -- 1: Come Into My Parlor -- 2: E-vase-ive Action -- 3: Infernal Swarm -- 4: The Heir to the Light -- 5: Shattering Stars (Paladin) -- 6: Shattering Stars (Dark Knight) -- 7: Shattering Stars (Bard) -- 8: Demolition Squad -- 9: Die By the Sword -- 10: Let Sleeping Dogs Die -- 11: Brothers D'Aurphe -- 12: Undying Promise -- 13: Factory Rejects -- 14: Idol Thoughts -- 15: An Awful Autopsy -- 16: Celery -- 17: Mirror Images -- 18: A Furious Finale (Dancer) -- 19: Clash of the Comrades -- 20: Those Who Lurk in the Shadows (III) -- 21: Beyond Infinity ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (TradeBCNM(player,player:getZoneID(),trade,npc)) then return; end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) -- if (player:hasKeyItem(MARK_OF_SEED) and player:getCurrentMission(ACP) == THOSE_WHO_LURK_IN_SHADOWS_II) then --player:startEvent(0x005); --elseif (EventTriggerBCNM(player,npc)) then -- Temp disabled pending fixes for the BCNM mobs. if (EventTriggerBCNM(player,npc)) then return; end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("onUpdate CSID: %u",csid); -- printf("onUpdate RESULT: %u",option); if (EventUpdateBCNM(player,csid,option)) then return; end end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- printf("onFinish CSID: %u",csid); -- printf("onFinish RESULT: %u",option); if (csid == 0x005) then player:completeMission(ACP,THOSE_WHO_LURK_IN_SHADOWS_II); player:addMission(ACP,THOSE_WHO_LURK_IN_SHADOWS_III); elseif (EventFinishBCNM(player,csid,option)) then return; end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c61068510.lua
6
1269
--トルネード function c61068510.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(c61068510.condition) e1:SetTarget(c61068510.target) e1:SetOperation(c61068510.activate) c:RegisterEffect(e1) end function c61068510.cfilter(c) return c:GetSequence()<5 end function c61068510.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(c61068510.cfilter,tp,0,LOCATION_SZONE,3,nil) end function c61068510.filter(c) return c:GetSequence()<5 end function c61068510.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(1-tp) and c61068510.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c61068510.filter,tp,0,LOCATION_SZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c61068510.filter,tp,0,LOCATION_SZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c61068510.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
Turttle/darkstar
scripts/globals/spells/wind_carol.lua
18
1502
----------------------------------------- -- Spell: Wind Carol -- Increases wind 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_WIND, 1)) then spell:setMsg(75); end return EFFECT_CAROL; end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c66938505.lua
2
2985
--水晶機巧-リオン function c66938505.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(66938505,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END+TIMING_BATTLE_START+TIMING_BATTLE_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,66938505) e1:SetCondition(c66938505.sccon) e1:SetTarget(c66938505.sctg) e1:SetOperation(c66938505.scop) c:RegisterEffect(e1) end function c66938505.sccon(e,tp,eg,ep,ev,re,r,rp) local ph=Duel.GetCurrentPhase() return not e:GetHandler():IsStatus(STATUS_CHAINING) and Duel.GetTurnPlayer()~=tp and (ph==PHASE_MAIN1 or (ph>=PHASE_BATTLE_START and ph<=PHASE_BATTLE) or ph==PHASE_MAIN2) end function c66938505.scfilter1(c,e,tp,mc) local mg=Group.FromCards(c,mc) return not c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(c66938505.scfilter2,tp,LOCATION_EXTRA,0,1,nil,mg) end function c66938505.scfilter2(c,mg) return c:IsRace(RACE_MACHINE) and c:IsSynchroSummonable(nil,mg) end function c66938505.sctg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c66938505.scfilter1(chkc,e,tp,e:GetHandler()) end if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c66938505.scfilter1,tp,LOCATION_REMOVED,0,1,nil,e,tp,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c66938505.scfilter1,tp,LOCATION_REMOVED,0,1,1,nil,e,tp,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c66938505.scop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or not Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) tc:RegisterEffect(e2) Duel.SpecialSummonComplete() if not c:IsRelateToEffect(e) then return end local mg=Group.FromCards(c,tc) local g=Duel.GetMatchingGroup(c66938505.scfilter2,tp,LOCATION_EXTRA,0,nil,mg) if g:GetCount()>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_DECK) e1:SetReset(RESET_EVENT+0x47e0000) c:RegisterEffect(e1,true) local e2=e1:Clone() tc:RegisterEffect(e2,true) Duel.SynchroSummon(tp,sg:GetFirst(),nil,mg) Duel.ShuffleDeck(tp) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c14730606.lua
2
1413
--アイヴィ・シャックル function c14730606.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --race local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetCode(EFFECT_CHANGE_RACE) e2:SetCondition(c14730606.raccon) e2:SetValue(RACE_PLANT) c:RegisterEffect(e2) --draw local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(14730606,0)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(c14730606.drcon) e3:SetTarget(c14730606.drtg) e3:SetOperation(c14730606.drop) c:RegisterEffect(e3) end function c14730606.raccon(e) return Duel.GetTurnPlayer()==e:GetHandlerPlayer() end function c14730606.drcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousControler()==tp and c:IsReason(REASON_DESTROY) and rp~=tp end function c14730606.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c14730606.drop(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-2.0
Turttle/darkstar
scripts/zones/Southern_San_dOria/npcs/Ambrotien.lua
19
5909
----------------------------------- -- Area: Southern San d'Oria -- NPC: Ambrotien -- @pos 93.419 -0.001 -57.347 230 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) CurrentMission = player:getCurrentMission(SANDORIA); OrcishScoutCompleted = player:hasCompletedMission(SANDORIA,SMASH_THE_ORCISH_SCOUTS); BatHuntCompleted = player:hasCompletedMission(SANDORIA,BAT_HUNT); TheCSpringCompleted = player:hasCompletedMission(SANDORIA,THE_CRYSTAL_SPRING); MissionStatus = player:getVar("MissionStatus"); Count = trade:getItemCount(); if (CurrentMission ~= 255) then if (CurrentMission == SMASH_THE_ORCISH_SCOUTS and trade:hasItemQty(16656,1) and Count == 1 and OrcishScoutCompleted == false) then -- Trade Orcish Axe player:startEvent(0x07e4); -- Finish Mission "Smash the Orcish scouts" (First Time) elseif (CurrentMission == SMASH_THE_ORCISH_SCOUTS and trade:hasItemQty(16656,1) and Count == 1) then -- Trade Orcish Axe player:startEvent(0x07d2); -- Finish Mission "Smash the Orcish scouts" (Repeat) elseif (CurrentMission == BAT_HUNT and trade:hasItemQty(1112,1) and Count == 1 and BatHuntCompleted == false and MissionStatus == 2) then -- Trade Orcish Mail Scales player:startEvent(0x07e7); -- Finish Mission "Bat Hunt" elseif (CurrentMission == BAT_HUNT and trade:hasItemQty(891,1) and Count == 1 and BatHuntCompleted and MissionStatus == 2) then -- Trade Bat Fang player:startEvent(0x07d3); -- Finish Mission "Bat Hunt" (repeat) elseif (CurrentMission == THE_CRYSTAL_SPRING and trade:hasItemQty(4528,1) and Count == 1 and TheCSpringCompleted == false) then -- Trade Crystal Bass player:startEvent(0x07ee); -- Dialog During Mission "The Crystal Spring" elseif (CurrentMission == THE_CRYSTAL_SPRING and trade:hasItemQty(4528,1) and Count == 1 and TheCSpringCompleted) then -- Trade Crystal Bass player:startEvent(0x07dd); -- Finish Mission "The Crystal Spring" (repeat) else player:startEvent(0x07d8); -- Wrong Item end else player:startEvent(0x07da); -- Mission not activated end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local PresOfPapsqueCompleted = player:hasCompletedMission(SANDORIA,PRESTIGE_OF_THE_PAPSQUE); if (player:getNation() ~= SANDORIA) then player:startEvent(0x07db); -- for Non-San d'Orians else CurrentMission = player:getCurrentMission(SANDORIA); MissionStatus = player:getVar("MissionStatus"); pRank = player:getRank(); cs, p, offset = getMissionOffset(player,2,CurrentMission,MissionStatus); if (CurrentMission <= 15 and (cs ~= 0 or offset ~= 0 or (CurrentMission == 0 and offset == 0))) then if (cs == 0) then player:showText(npc,ORIGINAL_MISSION_OFFSET + offset); -- dialog after accepting mission else player:startEvent(cs,p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8]); end elseif (pRank == 1 and player:hasCompletedMission(SANDORIA,SMASH_THE_ORCISH_SCOUTS) == false) then player:startEvent(0x07d0); -- Start First Mission "Smash the Orcish scouts" elseif (player:hasKeyItem(ANCIENT_SANDORIAN_BOOK)) then player:startEvent(0x040c); elseif (CurrentMission == RANPERRE_S_FINAL_REST and player:getVar("MissionStatus",4) and tonumber(os.date("%j")) == player:getVar("Wait1DayForRanperre_date")) then -- Not ready yet player:startEvent(0x040e); elseif (CurrentMission == RANPERRE_S_FINAL_REST and player:getVar("MissionStatus") == 4 and tonumber(os.date("%j")) ~= player:getVar("Wait1DayForRanperre_date")) then -- Ready now. player:startEvent(0x0410); elseif (CurrentMission == RANPERRE_S_FINAL_REST and player:getVar("MissionStatus") == 6) then player:startEvent(0x0410); elseif (CurrentMission == RANPERRE_S_FINAL_REST and player:getVar("MissionStatus") == 9) then player:startEvent(0x040a); elseif (CurrentMission ~= THE_SECRET_WEAPON and pRank == 7 and PresOfPapsqueCompleted == true and getMissionRankPoints(player,19) == 1 and player:getVar("SecretWeaponStatus") == 0) then player:startEvent(0x003e); elseif (CurrentMission == THE_SECRET_WEAPON and player:getVar("SecretWeaponStatus") == 3) then player:startEvent(0x0414); elseif (CurrentMission ~= 255) then player:startEvent(0x07d1); -- Have mission already activated else mission_mask, repeat_mask = getMissionMask(player); player:startEvent(0x07d9,mission_mask, 0, 0 ,0 ,0 ,repeat_mask); -- Mission List end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("onUpdateCSID: %u",csid); --printf("onUpdateOPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("onFinishCSID: %u",csid); --printf("onFinishOPTION: %u",option); finishMissionTimeline(player,2,csid,option); if (csid == 0x040c) then player:setVar("MissionStatus",4); player:delKeyItem(ANCIENT_SANDORIAN_BOOK); player:setVar("Wait1DayForRanperre_date", os.date("%j")); elseif (csid == 0x040e) then player:setVar("MissionStatus",6); elseif (csid == 0x0410) then player:setVar("MissionStatus",7); player:setVar("Wait1DayForRanperre_date",0); elseif (csid == 0x040a) then finishMissionTimeline(player,1,csid,option); elseif (csid == 0x003e) then player:setVar("SecretWeaponStatus",1); elseif (csid == 0x0414) then finishMissionTimeline(player,1,csid,option); end end;
gpl-3.0
Turttle/darkstar
scripts/zones/Crawlers_Nest_[S]/npcs/Tucker.lua
17
3232
---------------------------------- -- Area: Crawlers' Nest [S] -- NPC: Tucker ----------------------------------- package.loaded["scripts/zones/Crawlers_Nest_[S]/TextIDs"] = nil; require("scripts/zones/Crawlers_Nest_[S]/TextIDs"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local ALittleKnowledge = player:getQuestStatus(CRYSTAL_WAR, A_LITTLE_KNOWLEDGE); local ALittleKnowledgeProgress = player:getVar("ALittleKnowledge"); local SheetsofVellumProgress = player:getVar("SheetsofVellum"); if (ALittleKnowledge == QUEST_ACCEPTED and ALittleKnowledgeProgress == 1 and SheetsofVellumProgress > 0 and SheetsofVellumProgress < 4) then if (trade:hasItemQty(4365, 48) and trade:getGil() == 0 and trade:getItemCount() == 48) then if (SheetsofVellumProgress == 1) then player:startEvent(8); elseif (SheetsofVellumProgress == 2) then player:startEvent(10); elseif (SheetsofVellumProgress == 3) then player:startEvent(11); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local ALittleKnowledge = player:getQuestStatus(CRYSTAL_WAR, A_LITTLE_KNOWLEDGE); local ALittleKnowledgeProgress = player:getVar("ALittleKnowledge"); local SheetsofVellumProgress = player:getVar("SheetsofVellum"); if (ALittleKnowledge == QUEST_ACCEPTED and ALittleKnowledgeProgress == 1) then if (SheetsofVellumProgress == 1) then player:startEvent(7); elseif (SheetsofVellumProgress == 2 or SheetsofVellumProgress == 3) then player:startEvent(9); elseif (SheetsofVellumProgress == 4) then player:startEvent(12); else player:startEvent(6); end 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 == 6) then player:setVar("SheetsofVellum", 1); elseif (csid == 8) then if (player:getFreeSlotsCount() > 0) then player:tradeComplete(); player:addItem(2550, 4); player:messageSpecial(ITEM_OBTAINED + 9, 2550, 4); player:setVar("SheetsofVellum", 2); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 2550); end elseif (csid == 10) then if (player:getFreeSlotsCount() > 0) then player:tradeComplete(); player:addItem(2550, 4); player:messageSpecial(ITEM_OBTAINED + 9, 2550, 4); player:setVar("SheetsofVellum", 3); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 2550); end elseif (csid == 11) then if (player:getFreeSlotsCount() > 0) then player:tradeComplete(); player:addItem(2550, 4); player:messageSpecial(ITEM_OBTAINED + 9, 2550, 4); player:setVar("SheetsofVellum", 4); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 2550); end end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c75525309.lua
5
1292
--六武派二刀流 function c75525309.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,0x1e0) e1:SetCondition(c75525309.condition) e1:SetTarget(c75525309.target) e1:SetOperation(c75525309.activate) c:RegisterEffect(e1) end function c75525309.condition(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) local ct=g:GetCount() local tg=g:GetFirst() return ct==1 and tg:IsFaceup() and tg:IsAttackPos() and tg:IsSetCard(0x3d) end function c75525309.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:GetControler()~=tp and chkc:IsOnField() and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,g:GetCount(),0,0) end function c75525309.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) if sg:GetCount()>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c24040093.lua
7
1372
--魔轟神グリムロ function c24040093.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(24040093,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCondition(c24040093.con) e1:SetCost(c24040093.cost) e1:SetTarget(c24040093.tg) e1:SetOperation(c24040093.op) c:RegisterEffect(e1) end function c24040093.cfilter(c) return c:IsFaceup() and c:IsSetCard(0x35) end function c24040093.con(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(c24040093.cfilter,tp,LOCATION_MZONE,0,1,nil) end function c24040093.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function c24040093.filter(c) return c:IsSetCard(0x35) and c:GetCode()~=24040093 and c:IsAbleToHand() end function c24040093.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c24040093.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c24040093.op(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c24040093.filter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c3701074.lua
5
2051
--ダーク・キュア function c3701074.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Activate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(3701074,0)) e2:SetCategory(CATEGORY_RECOVER) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(c3701074.rectg1) e2:SetOperation(c3701074.recop1) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(3701074,0)) e4:SetCategory(CATEGORY_RECOVER) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_SPSUMMON_SUCCESS) e4:SetTarget(c3701074.rectg2) e4:SetOperation(c3701074.recop2) c:RegisterEffect(e4) end function c3701074.rectg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return rp~=tp end Duel.SetTargetCard(eg) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,1-tp,0) end function c3701074.recop1(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=eg:GetFirst() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local rec=tc:GetAttack()/2 Duel.Recover(1-tp,rec,REASON_EFFECT) end end function c3701074.filter(c,e,tp) return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:GetSummonPlayer()==1-tp and (not e or c:IsRelateToEffect(e)) end function c3701074.rectg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(c3701074.filter,1,nil,nil,tp) end Duel.SetTargetCard(eg) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,1-tp,0) end function c3701074.recop2(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=eg:Filter(c3701074.filter,nil,e,tp) if g:GetCount()>0 then if g:GetCount()>1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) g=g:Select(tp,1,1,nil) end Duel.Recover(1-tp,g:GetFirst():GetAttack()/2,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c5255013.lua
2
2442
--セフィラの輝跡 function c5255013.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(c5255013.condition) e1:SetOperation(c5255013.activate) c:RegisterEffect(e1) --splimit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) e2:SetTarget(c5255013.splimit) c:RegisterEffect(e2) --cannot be target local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_SZONE) e3:SetCondition(c5255013.tgcon) e3:SetValue(1) c:RegisterEffect(e3) --self destroy local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_DESTROY) e4:SetCondition(c5255013.descon) e4:SetOperation(c5255013.desop) c:RegisterEffect(e4) end function c5255013.condition(e,tp,eg,ep,ev,re,r,rp) local tc1=Duel.GetFieldCard(tp,LOCATION_SZONE,6) local tc2=Duel.GetFieldCard(tp,LOCATION_SZONE,7) if not tc1 or not tc2 or not tc1:IsSetCard(0xc4) or not tc2:IsSetCard(0xc4) then return false end local scl1=tc1:GetLeftScale() local scl2=tc2:GetRightScale() if scl1>scl2 then scl1,scl2=scl2,scl1 end return scl1==1 and scl2==7 end function c5255013.filter(c) return (c:IsFacedown() or not c:IsSetCard(0xc4)) and c:IsAbleToDeck() end function c5255013.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(c5255013.filter,tp,LOCATION_MZONE,0,nil) if g:GetCount()>0 then Duel.SendtoDeck(g,nil,2,REASON_EFFECT) end end function c5255013.splimit(e,c,sump,sumtype,sumpos,targetp) return not c:IsLocation(LOCATION_HAND+LOCATION_EXTRA) end function c5255013.tgcon(e) local tp=e:GetHandlerPlayer() return Duel.GetFieldCard(tp,LOCATION_SZONE,6) or Duel.GetFieldCard(tp,LOCATION_SZONE,7) end function c5255013.desfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_SZONE) and (c:GetSequence()==6 or c:GetSequence()==7) end function c5255013.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(c5255013.desfilter,1,nil,tp) end function c5255013.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
gpl-2.0
dabo123148/WarlightMod
OneWayConnections/Client_PresentConfigureUI.lua
1
2423
function Client_PresentConfigureUI(rootParent) parent = rootParent; local num = 1; local RCstring = Mod.Settings.RemovedConnections; if(RCstring == nil or RCstring == ",")then RCstring = ",,"; end local RC = stringtotable(RCstring); RemovedConnectionsFields = {}; while(num <tablelength(RC))do local enteredtext = RC[num]; if(enteredtext == nil)then enteredtext = ""; end enteredtext2 = RC[num+1]; if(enteredtext2 == nil)then enteredtext2 = ""; end if(enteredtext == "" and enteredtext2 == "")then if(num == 1)then addnewline(enteredtext,enteredtext2); end else addnewline(enteredtext,enteredtext2); end num = num+2; end addnewbutton(); end function stringtotable(variable) chartable = {}; while(string.len(variable)>0)do chartable[tablelength(chartable)] = string.sub(variable, 1 , 1); variable = string.sub(variable, 2); end local newtable = {}; local tablepos = 0; local executed = false; for _, elem in pairs(chartable)do if(elem == ",")then tablepos = tablepos + 1; newtable[tablepos] = ""; executed = true; else if(executed == false)then tablepos = tablepos + 1; newtable[tablepos] = ""; executed = true; end if(newtable[tablepos] == nil)then newtable[tablepos] = elem; else newtable[tablepos] = newtable[tablepos] .. elem; end end end return newtable; end function buttonnewline() if(buttonlayer ~= nil)then UI.Destroy(buttonlayer); end addnewline("",""); addnewbutton(); end function addnewline(content1,content2) local removedconn1 = UI.CreateHorizontalLayoutGroup(parent); UI.CreateLabel(removedconn1).SetText('From '); RemovedConnectionsFields[tablelength(RemovedConnectionsFields)+1] = UI.CreateTextInputField(removedconn1).SetPlaceholderText('Enter territory name').SetText(content1).SetPreferredWidth(200).SetPreferredHeight(30); UI.CreateLabel(removedconn1).SetText('To '); RemovedConnectionsFields[tablelength(RemovedConnectionsFields)+1] = UI.CreateTextInputField(removedconn1).SetPlaceholderText('Enter territory name').SetText(content2).SetPreferredWidth(200).SetPreferredHeight(30); end function addnewbutton() buttonlayer = UI.CreateHorizontalLayoutGroup(parent); local newlinebutton = UI.CreateButton(buttonlayer).SetText('new Line').SetOnClick(buttonnewline); end function tablelength(T) local count = 0 for _ in pairs(T) do count = count + 1 end return count end
mit
dickeyf/darkstar
scripts/globals/items/plate_of_bream_sushi.lua
1
1455
----------------------------------------- -- ID: 5176 -- Item: plate_of_bream_sushi -- Food Effect: 30Min, All Races ----------------------------------------- -- Dexterity 6 -- Vitality 5 -- Accuracy % 16 -- Ranged ACC % 16 -- Sleep Resist 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,1800,5176); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 6); target:addMod(MOD_VIT, 5); target:addMod(MOD_ACCP, 16); target:addMod(MOD_RACCP, 16); target:addMod(MOD_SLEEPRES, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 6); target:delMod(MOD_VIT, 5); target:delMod(MOD_ACCP, 16); target:delMod(MOD_RACCP, 16); target:delMod(MOD_SLEEPRES, 5); end;
gpl-3.0
jitsi/jitsi-meet
resources/prosody-plugins/mod_client_proxy.lua
2
5214
if module:get_host_type() ~= "component" then error("proxy_component should be loaded as component", 0); end local jid_split = require "util.jid".split; local jid_bare = require "util.jid".bare; local jid_prep = require "util.jid".prep; local st = require "util.stanza"; local array = require "util.array"; local target_address = module:get_option_string("target_address"); sessions = array{}; local sessions = sessions; local function handle_target_presence(stanza) local type = stanza.attr.type; module:log("debug", "received presence from destination: %s", type) local _, _, resource = jid_split(stanza.attr.from); if type == "error" then -- drop all known sessions for k in pairs(sessions) do sessions[k] = nil end module:log( "debug", "received error presence, dropping all target sessions", resource ) elseif type == "unavailable" then for k in pairs(sessions) do if sessions[k] == resource then sessions[k] = nil module:log( "debug", "dropped target session: %s", resource ) break end end elseif not type then -- available local found = false; for k in pairs(sessions) do if sessions[k] == resource then found = true; break end end if not found then module:log( "debug", "registered new target session: %s", resource ) sessions:push(resource) end end end local function handle_from_target(stanza) local type = stanza.attr.type module:log( "debug", "non-presence stanza from target: name = %s, type = %s", stanza.name, type ) if stanza.name == "iq" then if type == "error" or type == "result" then -- de-NAT message local _, _, denatted_to_unprepped = jid_split(stanza.attr.to); local denatted_to = jid_prep(denatted_to_unprepped); if not denatted_to then module:log( "debug", "cannot de-NAT stanza, invalid to: %s", denatted_to_unprepped ) return end local denatted_from = module:get_host(); module:log( "debug", "de-NAT-ed stanza: from: %s -> %s, to: %s -> %s", stanza.attr.from, denatted_from, stanza.attr.to, denatted_to ) stanza.attr.from = denatted_from stanza.attr.to = denatted_to module:send(stanza) else -- FIXME: we don’t support NATing outbund requests atm. module:send(st.error_reply(stanza, "cancel", "feature-not-implemented")) end elseif stanza.name == "message" then -- not implemented yet, we need a way to ensure that routing doesn’t -- break module:send(st.error_reply(stanza, "cancel", "feature-not-implemented")) end end local function handle_to_target(stanza) local type = stanza.attr.type; module:log( "debug", "stanza to target: name = %s, type = %s", stanza.name, type ) if stanza.name == "presence" then if type ~= "error" then module:send(st.error_reply(stanza, "cancel", "bad-request")) return end elseif stanza.name == "iq" then if type == "get" or type == "set" then if #sessions == 0 then -- no sessions available to send to module:log("debug", "no sessions to send to!") module:send(st.error_reply(stanza, "cancel", "service-unavailable")) return end -- find a target session local target_session = sessions:random() local target = target_address .. "/" .. target_session -- encode sender JID in resource local natted_from = module:get_host() .. "/" .. stanza.attr.from; module:log( "debug", "NAT-ed stanza: from: %s -> %s, to: %s -> %s", stanza.attr.from, natted_from, stanza.attr.to, target ) stanza.attr.from = natted_from stanza.attr.to = target module:send(stanza) end -- FIXME: handle and forward result/error correctly elseif stanza.name == "message" then -- not implemented yet, we need a way to ensure that routing doesn’t -- break module:send(st.error_reply(stanza, "cancel", "feature-not-implemented")) end end local function stanza_handler(event) local origin, stanza = event.origin, event.stanza module:log("debug", "received stanza from %s session", origin.type) local bare_from = jid_bare(stanza.attr.from); local _, _, to = jid_split(stanza.attr.to); if bare_from == target_address then -- from our target, to whom? if not to then -- directly to component if stanza.name == "presence" then handle_target_presence(stanza) else module:send(st.error_reply(stanza, "cancel", "bad-request")) return true end else -- to someone else handle_from_target(stanza) end else handle_to_target(stanza) end return true end module:hook("iq/bare", stanza_handler, -1); module:hook("message/bare", stanza_handler, -1); module:hook("presence/bare", stanza_handler, -1); module:hook("iq/full", stanza_handler, -1); module:hook("message/full", stanza_handler, -1); module:hook("presence/full", stanza_handler, -1); module:hook("iq/host", stanza_handler, -1); module:hook("message/host", stanza_handler, -1); module:hook("presence/host", stanza_handler, -1); module:log("debug", "loaded proxy on %s", module:get_host()) subscription_request = st.presence({ type = "subscribe", to = target_address, from = module:get_host()} ) module:send(subscription_request)
apache-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c43237273.lua
2
2146
--N・ブラック・パンサー function c43237273.initial_effect(c) --copy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(43237273,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(c43237273.target) e1:SetOperation(c43237273.operation) c:RegisterEffect(e1) end function c43237273.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function c43237273.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsType(TYPE_TOKEN) then local code=tc:GetOriginalCodeRule() local cid=0 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetValue(code) c:RegisterEffect(e1) if not tc:IsType(TYPE_TRAPMONSTER) then cid=c:CopyEffect(code, RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END, 1) end local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(43237273,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e2:SetLabelObject(e1) e2:SetLabel(cid) e2:SetOperation(c43237273.rstop) c:RegisterEffect(e2) end end function c43237273.rstop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local cid=e:GetLabel() if cid~=0 then c:ResetEffect(cid,RESET_COPY) end local e1=e:GetLabelObject() e1:Reset() Duel.HintSelection(Group.FromCards(c)) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) end
gpl-2.0
Metastruct/pac3
lua/pac3/editor/client/language.lua
1
3579
pace.KnownGUIStrings = pace.KnownGUIStrings or {} pace.CurrentTranslation = {} local cvar = CreateClientConVar("pac_language", "english", true) function pace.LanguageString(val) local key = val:Trim():lower() pace.KnownGUIStrings[key] = val return pace.CurrentTranslation[key] or val end local L = pace.LanguageString function pace.AddLanguagesToMenu(menu) local menu, pnl = menu:AddSubMenu(L"language") pnl:SetImage("icon16/world_edit.png") menu.GetDeleteSelf = function() return false end menu:AddOption("english", function() pace.SetLanguage("english") end) for key, val in pairs(file.Find("pac3/editor/client/translations/*", "LUA")) do val = val:gsub("%.lua", "") menu:AddOption(val, function() pace.SetLanguage(val) end) end menu:AddSpacer() menu:AddOption("edit", function() pace.ShowLanguageEditor() end) end function pace.ShowLanguageEditor() local lang = cvar:GetString() local frame = vgui.Create("DFrame") frame:SetSize(512, 512) frame:Center() frame:MakePopup() frame:SetTitle(L"translation editor") local list = vgui.Create("DListView", frame) list:Dock(FILL) list:AddColumn("english") list:AddColumn(lang) local strings = {} for k,v in pairs(pace.KnownGUIStrings) do strings[k] = v:Trim():lower() end table.Merge(strings, pace.CurrentTranslation) for english, other in pairs(strings) do local line = list:AddLine(english, other) line.OnRightClick = function() local menu = DermaMenu() menu:SetPos(gui.MousePos()) menu:AddOption(L"edit", function() local window = Derma_StringRequest( L"translate", english, other, function(new) pace.CurrentTranslation[english] = new line:SetValue(2, new) pace.SaveCurrentTranslation() end ) for _, pnl in pairs(window:GetChildren()) do if pnl.ClassName == "DPanel" then for key, pnl in pairs(pnl:GetChildren()) do if pnl.ClassName == "DTextEntry" then pnl:SetAllowNonAsciiCharacters(true) end end end end end):SetImage(pace.MiscIcons.edit) menu:AddOption(L"revert", function() local new = CompileFile("pac3/editor/client/translations/"..lang..".lua")()[english] pace.CurrentTranslation[english] = new line:SetValue(2, new or english) pace.SaveCurrentTranslation() end):SetImage(pace.MiscIcons.revert) menu:MakePopup() end end list:SizeToContents() end function pace.SaveCurrentTranslation() local str = {} table.insert(str, "return {") for key, val in pairs(pace.CurrentTranslation) do table.insert(str, string.format("[%q] = %q,", key, val)) end table.insert(str, "}") file.CreateDir("pac3_editor", "DATA") file.Write("pac3_editor/" .. cvar:GetString() .. ".txt", table.concat(str, "\n"), "DATA") end function pace.GetOutputForTranslation() local str = "" for key, val in pairs(pace.KnownGUIStrings) do str = str .. ("%s = %s\n"):format(key:gsub("(.)","_%1_"), val) end return str end function pace.SetLanguage(lang) lang = lang or cvar:GetString() RunConsoleCommand("pac_language", lang) pace.CurrentTranslation = {} if lang ~= "english" then if file.Exists("pac3_editor/" .. lang .. ".txt", "DATA") then table.Merge(pace.CurrentTranslation, CompileString(file.Read("pac3_editor/" .. lang .. ".txt", "DATA"), "pac3_lang")()) else table.Merge(pace.CurrentTranslation, CompileFile("pac3/editor/client/translations/"..lang..".lua")()) end end if pace.Editor and pace.Editor:IsValid() then pace.CloseEditor() timer.Simple(0.1, function() pace.OpenEditor() end) end end
gpl-3.0
fgenesis/Aquaria_experimental
game_scripts/scripts/entities/krill.lua
6
7082
-- Copyright (C) 2007, 2010 - Bit-Blot -- -- This file is part of Aquaria. -- -- Aquaria is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if not v then v = {} end if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end -- ================================================================================================ -- Krill -- ================================================================================================ -- specific local STATE_JUMP = 1000 local STATE_TRANSITION = 1001 local STATE_RETURNTOWALL = 1002 local STATE_SURFACE = 1003 local STATE_LAYEGGS = 1004 local STATE_RECOVER = 1005 local STATE_PASSON = 1006 -- ================================================================================================ -- L O C A L V A R I A B L E S -- ================================================================================================ v.moveTimer = 0 v.moveDir = 0 v.avoidCollisionsTimer = 0 v.eggTimer = 0 v.lifeSpan = 0 v.eggTime = 2 -- ================================================================================================ -- FUNCTIONS -- ================================================================================================ function init(me) setupBasicEntity( me, "Krill/Krill", -- texture 3, -- health 2, -- manaballamount 2, -- exp 10, -- money 16, -- collideRadius (for hitting entities + spells) STATE_IDLE, -- initState 64, -- sprite width 64, -- sprite height 1, -- particle "explosion" type, 0 = none 0, -- 0/1 hit other entities off/on (uses collideRadius) 3000, -- updateCull -1: disabled, default: 4000 1 ) entity_setEatType(me, EAT_FILE, "SmallFood") entity_setMaxSpeed(me, 500) entity_setDropChance(me, 0) entity_setDeathParticleEffect(me, "TinyRedExplode") esetv(me, EV_WALLOUT, 8) v.lifeSpan = 18 + math.random(8) --v.lifeSpan = 8 entity_setState(me, STATE_IDLE) entity_setDamageTarget(me, DT_AVATAR_LIZAP, false) --entity_setDamageTarget(me, DT_AVATAR_PET, false) end function postInit(me) entity_ensureLimit(me, 128, STATE_PASSON) end function update(me, dt) if entity_isState(me, STATE_IDLE) then v.lifeSpan = v.lifeSpan - dt if v.lifeSpan < 2 then entity_setMaxSpeedLerp(me, 0.1, 0.1) entity_color(me, 0.2,0.4,0.4,100*dt) elseif v.lifeSpan < 4 then entity_setMaxSpeedLerp(me, 0.4, 0.1) entity_setColor(me, 0.6, 0.9, 0.9, 100*dt) end if v.lifeSpan < 0 then entity_setState(me, STATE_PASSON) end v.avoidCollisionsTimer = v.avoidCollisionsTimer + dt if v.avoidCollisionsTimer > 5 then v.avoidCollisionsTimer = 0 end v.moveTimer = v.moveTimer + dt if v.moveTimer < 1.5 then -- move local amount = 2000*dt if v.moveDir == 0 then entity_addVel(me, -amount, 0) if entity_isFlippedHorizontal(me) then entity_flipHorizontal(me) end elseif v.moveDir == 1 then entity_addVel(me, 0, amount) elseif v.moveDir == 2 then entity_addVel(me, amount, 0) if not entity_isFlippedHorizontal(me) then entity_flipHorizontal(me) end elseif v.moveDir == 3 then entity_addVel(me, 0, amount) end elseif v.moveTimer > 3 then -- stop --entity_clearVel(me) v.moveTimer = 0 v.moveDir = v.moveDir +1 if v.moveDir >= 4 then v.moveDir = 0 end elseif v.moveTimer > 2.5 then local factor = 5*dt entity_addVel(me, -entity_velx(me)*factor, -entity_vely(me)*factor) end if v.avoidCollisionsTimer < 3 then entity_doCollisionAvoidance(me, dt, 4, 1.0) end entity_updateMovement(me, dt) elseif entity_isState(me, STATE_SURFACE) then entity_moveAlongSurface(me, dt, 20, 2) entity_rotateToSurfaceNormal(me, 0.1) if not entity_isFlippedHorizontal(me) then entity_flipHorizontal(me) end v.eggTimer = v.eggTimer + dt if v.eggTimer > v.eggTime then v.eggTimer = 0 entity_setState(me, STATE_LAYEGGS) end elseif entity_isState(me, STATE_LAYEGGS) or entity_isState(me, STATE_RECOVER) then entity_rotateToSurfaceNormal(me, 0.1) elseif entity_isState(me, STATE_PASSON) then entity_addVel(me, 0, -800*dt) entity_updateMovement(me, dt) end if not entity_isState(me, STATE_GROW) then entity_handleShotCollisions(me) end end function hitSurface(me) entity_clampToSurface(me) entity_setState(me, STATE_SURFACE, 3+math.random(2)) end function enterState(me) if entity_isState(me, STATE_IDLE) then v.avoidCollisionsTimer = 0 elseif entity_isState(me, STATE_SURFACE) then entity_clearVel(me) if chance(50) then entity_switchSurfaceDirection(me, 1) if entity_isFlippedHorizontal(me) then entity_flipHorizontal(me) end else entity_switchSurfaceDirection(me, 0) if not entity_isFlippedHorizontal(me) then entity_flipHorizontal(me) end end elseif entity_isState(me, STATE_GROW) then entity_scale(me) entity_scale(me, 1, 1, 1) entity_setStateTime(me, 1) v.eggTimer = -7 elseif entity_isState(me, STATE_LAYEGGS) then entity_setInternalOffset(me, 0, 0) entity_setInternalOffset(me, 10, 0, 0.1, -1, 1) entity_setStateTime(me, 2) v.lifeSpan = v.lifeSpan - 2 elseif entity_isState(me, STATE_RECOVER) then local eggs = createEntity("KrillEggs", "", entity_getPosition(me)) entity_alpha(eggs, 0) entity_alpha(eggs, 1, 0.5) entity_scale(eggs, 1) entity_scale(eggs, 1, 1, 0.5) entity_setInternalOffset(eggs) entity_setInternalOffset(eggs, 0, -16, 0.5) entity_rotate(eggs, entity_getRotation(me)) entity_setInternalOffset(me, 0, 0, 0.5) entity_setStateTime(me, 2) elseif entity_isState(me, STATE_PASSON) then local t = 2 entity_setStateTime(me, t) entity_alpha(me, 1) entity_alpha(me, 0, t) entity_rotate(me, -180, t*1.2) end end function damage(me, attacker, bone, damageType, dmg) if damageType == DT_AVATAR_BITE then entity_changeHealth(me, -100) end return true end function exitState(me) if entity_isState(me, STATE_SURFACE) then entity_setState(me, STATE_IDLE) entity_rotate(me, 0, 1) elseif entity_isState(me, STATE_LAYEGGS) then entity_setState(me, STATE_RECOVER) elseif entity_isState(me, STATE_RECOVER) then entity_setState(me, STATE_IDLE) entity_rotate(me, 0, 1) elseif entity_isState(me, STATE_GROW) then entity_rotate(me, 0, 1) entity_setState(me, STATE_IDLE) elseif entity_isState(me, STATE_PASSON) then entity_delete(me) end end
gpl-2.0
Turttle/darkstar
scripts/globals/items/quus.lua
18
1314
----------------------------------------- -- ID: 5793 -- Item: quus -- Food Effect: 5Min, Mithra only ----------------------------------------- -- Dexterity 2 -- Mind -4 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:getRace() ~= 7) then result = 247; end if (target:getMod(MOD_EAT_RAW_FISH) == 1) then result = 0; end 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,300,5793); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 2); target:addMod(MOD_MND, -4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 2); target:delMod(MOD_MND, -4); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c7582066.lua
5
1327
--サイコ・デビル function c7582066.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,nil,aux.NonTuner(Card.IsRace,RACE_PSYCHO),1) c:EnableReviveLimit() --atk local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(7582066,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(c7582066.atkcon) e1:SetOperation(c7582066.atkop) c:RegisterEffect(e1) end function c7582066.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)~=0 end function c7582066.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() or Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)==0 then return end local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,1,nil) local tc=g:GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE) local op=Duel.SelectOption(tp,70,71,72) Duel.ConfirmCards(tp,tc) Duel.ShuffleHand(1-tp) 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 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_END,2) c:RegisterEffect(e1) end end
gpl-2.0
pzduniak/openframe_ancient
client/gui/tabpanel_class.lua
1
3199
----------------------------------------------------------- --- /client/gui/tabpanel_class.lua --- --- Part of openFrame project --- --- Written by 50p. Additional changes by Orange. --- --- Lately edited in revision number 13 by Orange --- --- Licensed under BSD licence --- ----------------------------------------------------------- -- Class: TabPanel Class -- Class which allows to easily create tabpanels. TabPanel = { }; TabPanel.__index = TabPanel; -- Function: TabPanel:Create -- Creates a tabpanel -- -- Required Arguments: -- x - (float/integer) Space from left side of screen/window -- y - (float/integer) Space from top side of screen/window -- width - (float/integer) Width of the tabpanel -- height - (float/integer) Height of the tabpanel -- -- Optional arguments: -- relative - (bool) Are the x/y/width/height values relative? -- parent - (GUI) Parent of the image -- -- Returns: -- The result is a tab panel. function TabPanel:Create( x, y, width, height, relative, parent ) local tabpanel = { gui = false, tabs = { } }; for i, f in pairs( GUISharedFuncs ) do if ( ( i ~= "__index" ) and ( i ~= "Dragable" ) and ( i ~= "Text" ) and ( i ~= "Font" ) --( i ~= "" ) ) then tabpanel[ i ] = f; end end tabpanel.gui = guiCreateTabPanel( x, y, width, height, ( type( relative ) == "boolean" ) and relative or false, parent ); if( tabpanel.gui ) then setmetatable( tabpanel, self ); self.__index = self; return tabpanel; end return false; end -- Function: TabPanel:AddTab -- Adds a new tab to the tabpanel -- -- Required arguments: -- text - (string) Name of the tab to load -- -- Returns: -- A tab object, or false if failed to add. function TabPanel:AddTab( text ) if ( type( self ) ~= "table" ) then outputDebugString( "calling method incorrectly ( object.method() )! use object:method()", 1 ); return false end if ( type( text ) == "string" ) then local tempTab = Tab:Create( text, self.gui ); if( tempTab ) then table.insert( self.tabs, tempTab ); return tempTab; end end return false; end -- Function: TabPanel:DeleteTab -- Deletes a tab from the tabpanel -- -- Required arguments: -- tab (GUI) - a tab to remove -- -- Returns: -- True if removed, false if not. function TabPanel:DeleteTab( tab ) if ( type( self ) ~= "table" ) then outputDebugString( "calling method incorrectly ( object.method() )! use object:method()", 1 ); return false end if type( tab ) == "table" then tab = tab.gui; end if( type( tab ) == "userdata" ) then if ( destroyElement( tab ) ) then for k, v in pairs( self.tabs ) do if v == tab then table.remove( self.tabs, k ); break; end end return true; end end return false; end -- Function: TabPanel:GetTabs -- Gets all tabs and returns them -- -- Returns: -- Table with all tabs function TabPanel:GetTabs( ) if ( type( self ) ~= "table" ) then outputDebugString( "calling method incorrectly ( object.method() )! use object:method()", 1 ); return false end return self.tabs; end
mit
Turttle/darkstar
scripts/zones/Bastok_Mines/npcs/Azette.lua
28
2058
----------------------------------- -- Area: Bastok Mines -- NPC: Azette -- Type: Chocobo Renter ----------------------------------- require("scripts/globals/chocobo"); require("scripts/globals/keyitems"); require("scripts/globals/settings"); require("scripts/globals/status"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local level = player:getMainLvl(); local gil = player:getGil(); if (player:hasKeyItem(CHOCOBO_LICENSE) and level >= 15) then local price = getChocoboPrice(player); player:setLocalVar("chocoboPriceOffer",price); if (level >= 20) then level = 0; end player:startEvent(0x003D,price,gil,level); else player:startEvent(0x0040); 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); local price = player:getLocalVar("chocoboPriceOffer"); if (csid == 0x003D and option == 0) then if (player:delGil(price)) then updateChocoboPrice(player, price); if (player:getMainLvl() >= 20) then local duration = 1800 + (player:getMod(MOD_CHOCOBO_RIDING_TIME) * 60) player:addStatusEffectEx(EFFECT_CHOCOBO,EFFECT_CHOCOBO,1,0,duration,true); else player:addStatusEffectEx(EFFECT_CHOCOBO,EFFECT_CHOCOBO,1,0,900,true); end player:setPos(580,0,-305,0x40,0x6B); end end end;
gpl-3.0
dickeyf/darkstar
scripts/zones/Port_San_dOria/npcs/Fiva.lua
12
1856
----------------------------------- -- Area: Port San d'Oria -- NPC: Fiva -- Only sells when San d'Oria controls Kolshushu ----------------------------------- 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(KOLSHUSHU); if (RegionOwner ~= SANDORIA) then player:showText(npc,FIVA_CLOSED_DIALOG); else player:showText(npc,FIVA_OPEN_DIALOG); stock = {0x1197,184, --Buburimu Grape 0x0460,1620, --Casablanca 0x1107,220, --Dhalmel Meat 0x0266,72, --Mhaura Garlic 0x115d,40} --Yagudo Cherry 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
Turttle/darkstar
scripts/globals/spells/armys_paeon_ii.lua
31
1390
----------------------------------------- -- Spell: Army's Paeon II -- Gradually restores target's HP. ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- 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 = 2; if (sLvl+iLvl > 150) then power = power + 1; end local iBoost = caster:getMod(MOD_PAEON_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_PAEON,power,0,duration,caster:getID(), 0, 2)) then spell:setMsg(75); end return EFFECT_PAEON; end;
gpl-3.0
Turttle/darkstar
scripts/zones/Metalworks/npcs/Fariel.lua
34
2197
----------------------------------- -- Area: Metalworks -- NPC: Fariel -- Type: Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Metalworks/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Metalworks/TextIDs"); require("scripts/globals/pathfind"); local path = { 53.551208, -14.000000, -7.162227, 54.111534, -14.000000, -6.227105, 54.075279, -14.000000, -5.139729, 53.565350, -14.000000, 6.000605, 52.636345, -14.000000, 6.521872, 51.561535, -14.000000, 6.710593, 50.436523, -14.000000, 6.835652, 41.754219, -14.000000, 7.686310, 41.409531, -14.000000, 6.635177, 41.351002, -14.000000, 5.549131, 41.341057, -14.000000, 4.461191, 41.338020, -14.000000, -9.138797, 42.356136, -14.000000, -9.449953, 43.442558, -14.000000, -9.409095, 44.524868, -14.000000, -9.298069, 53.718494, -14.000000, -8.260445, 54.082706, -14.000000, -7.257769, 54.110283, -14.000000, -6.170790, 54.073116, -14.000000, -5.083439, 53.556625, -14.000000, 6.192736, 52.545383, -14.000000, 6.570893, 51.441212, -14.000000, 6.730487, 50.430820, -14.000000, 6.836911, 41.680725, -14.000000, 7.693455, 41.396103, -14.000000, 6.599321, 41.349224, -14.000000, 5.512603, 41.340771, -14.000000, 4.424644 }; function onSpawn(npc) npc:initNpcAi(); npc:setPos(pathfind.first(path)); onPath(npc); end; function onPath(npc) pathfind.patrol(npc, path); end; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x02C2); npc:wait(-1); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option,npc) --printf("CSID: %u",csid); --printf("RESULT: %u",option); npc:wait(0); end;
gpl-3.0
stupid-/tdm
gamemodes/tdm/entities/weapons/weapon_zm_improvised.lua
2
7861
AddCSLuaFile() SWEP.HoldType = "melee" if CLIENT then SWEP.PrintName = "Crowbar" SWEP.ViewModelFOV = 54 end SWEP.Slot = 0 SWEP.SlotPos = 1 SWEP.Weight = 3 SWEP.AutoSwitchTo = false SWEP.AutoSwitchFrom = false SWEP.UseHands = true SWEP.Base = "weapon_tttbase" SWEP.ViewModel = "models/weapons/c_crowbar.mdl" SWEP.WorldModel = "models/weapons/w_crowbar.mdl" SWEP.Weight = 5 SWEP.DrawCrosshair = false SWEP.ViewModelFlip = false SWEP.Primary.Damage = 24 SWEP.Primary.ClipSize = -1 SWEP.Primary.DefaultClip = -1 SWEP.Primary.Automatic = true SWEP.Primary.Delay = 0.5 SWEP.Primary.Ammo = "none" SWEP.Secondary.ClipSize = -1 SWEP.Secondary.DefaultClip = -1 SWEP.Secondary.Automatic = true SWEP.Secondary.Ammo = "none" SWEP.Secondary.Delay = 5 SWEP.Kind = WEAPON_MELEE SWEP.WeaponID = AMMO_CROWBAR SWEP.NoSights = true SWEP.IsSilent = true SWEP.AutoSpawnable = false SWEP.AllowDelete = false -- never removed for weapon reduction SWEP.AllowDrop = false local sound_single = Sound("Weapon_Crowbar.Single") local sound_open = Sound("DoorHandles.Unlocked3") if SERVER then CreateConVar("ttt_crowbar_unlocks", "1", FCVAR_ARCHIVE) CreateConVar("ttt_crowbar_pushforce", "395", FCVAR_NOTIFY) end -- only open things that have a name (and are therefore likely to be meant to -- open) and are the right class. Opening behaviour also differs per class, so -- return one of the OPEN_ values local function OpenableEnt(ent) local cls = ent:GetClass() if ent:GetName() == "" then return OPEN_NO elseif cls == "prop_door_rotating" then return OPEN_ROT elseif cls == "func_door" or cls == "func_door_rotating" then return OPEN_DOOR elseif cls == "func_button" then return OPEN_BUT elseif cls == "func_movelinear" then return OPEN_NOTOGGLE else return OPEN_NO end end local function CrowbarCanUnlock(t) return not GAMEMODE.crowbar_unlocks or GAMEMODE.crowbar_unlocks[t] end -- will open door AND return what it did function SWEP:OpenEnt(hitEnt) -- Get ready for some prototype-quality code, all ye who read this if SERVER and GetConVar("ttt_crowbar_unlocks"):GetBool() then local openable = OpenableEnt(hitEnt) if openable == OPEN_DOOR or openable == OPEN_ROT then local unlock = CrowbarCanUnlock(openable) if unlock then hitEnt:Fire("Unlock", nil, 0) end if unlock or hitEnt:HasSpawnFlags(256) then if openable == OPEN_ROT then hitEnt:Fire("OpenAwayFrom", self.Owner, 0) end hitEnt:Fire("Toggle", nil, 0) else return OPEN_NO end elseif openable == OPEN_BUT then if CrowbarCanUnlock(openable) then hitEnt:Fire("Unlock", nil, 0) hitEnt:Fire("Press", nil, 0) else return OPEN_NO end elseif openable == OPEN_NOTOGGLE then if CrowbarCanUnlock(openable) then hitEnt:Fire("Open", nil, 0) else return OPEN_NO end end return openable else return OPEN_NO end end function SWEP:PrimaryAttack() self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) if not IsValid(self.Owner) then return end if self.Owner.LagCompensation then -- for some reason not always true self.Owner:LagCompensation(true) end local spos = self.Owner:GetShootPos() local sdest = spos + (self.Owner:GetAimVector() * 70) local tr_main = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner, mask=MASK_SHOT_HULL}) local hitEnt = tr_main.Entity self.Weapon:EmitSound(sound_single) if IsValid(hitEnt) or tr_main.HitWorld then self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) if not (CLIENT and (not IsFirstTimePredicted())) then local edata = EffectData() edata:SetStart(spos) edata:SetOrigin(tr_main.HitPos) edata:SetNormal(tr_main.Normal) --edata:SetSurfaceProp(tr_main.MatType) --edata:SetDamageType(DMG_CLUB) edata:SetEntity(hitEnt) if hitEnt:IsPlayer() or hitEnt:GetClass() == "prop_ragdoll" then util.Effect("BloodImpact", edata) -- does not work on players rah --util.Decal("Blood", tr_main.HitPos + tr_main.HitNormal, tr_main.HitPos - tr_main.HitNormal) -- do a bullet just to make blood decals work sanely -- need to disable lagcomp because firebullets does its own self.Owner:LagCompensation(false) self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=0}) else util.Effect("Impact", edata) end end else self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) end if CLIENT then -- used to be some shit here else -- SERVER -- Do another trace that sees nodraw stuff like func_button local tr_all = nil tr_all = util.TraceLine({start=spos, endpos=sdest, filter=self.Owner}) self.Owner:SetAnimation( PLAYER_ATTACK1 ) if hitEnt and hitEnt:IsValid() then if self:OpenEnt(hitEnt) == OPEN_NO and tr_all.Entity and tr_all.Entity:IsValid() then -- See if there's a nodraw thing we should open self:OpenEnt(tr_all.Entity) end local dmg = DamageInfo() dmg:SetDamage(self.Primary.Damage) dmg:SetAttacker(self.Owner) dmg:SetInflictor(self.Weapon) dmg:SetDamageForce(self.Owner:GetAimVector() * 1500) dmg:SetDamagePosition(self.Owner:GetPos()) dmg:SetDamageType(DMG_CLUB) hitEnt:DispatchTraceAttack(dmg, spos + (self.Owner:GetAimVector() * 3), sdest) -- self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) -- self.Owner:TraceHullAttack(spos, sdest, Vector(-16,-16,-16), Vector(16,16,16), 30, DMG_CLUB, 11, true) -- self.Owner:FireBullets({Num=1, Src=spos, Dir=self.Owner:GetAimVector(), Spread=Vector(0,0,0), Tracer=0, Force=1, Damage=20}) else -- if tr_main.HitWorld then -- self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) -- else -- self.Weapon:SendWeaponAnim( ACT_VM_MISSCENTER ) -- end -- See if our nodraw trace got the goods if tr_all.Entity and tr_all.Entity:IsValid() then self:OpenEnt(tr_all.Entity) end end end if self.Owner.LagCompensation then self.Owner:LagCompensation(false) end end function SWEP:SecondaryAttack() self.Weapon:SetNextPrimaryFire( CurTime() + self.Primary.Delay ) self.Weapon:SetNextSecondaryFire( CurTime() + 0.1 ) if self.Owner.LagCompensation then self.Owner:LagCompensation(true) end local tr = self.Owner:GetEyeTrace(MASK_SHOT) if tr.Hit and IsValid(tr.Entity) and tr.Entity:IsPlayer() and (self.Owner:EyePos() - tr.HitPos):Length() < 100 then local ply = tr.Entity if SERVER and (not ply:IsFrozen()) then local pushvel = tr.Normal * GetConVar("ttt_crowbar_pushforce"):GetFloat() -- limit the upward force to prevent launching pushvel.z = math.Clamp(pushvel.z, 50, 100) ply:SetVelocity(ply:GetVelocity() + pushvel) self.Owner:SetAnimation( PLAYER_ATTACK1 ) ply.was_pushed = {att=self.Owner, t=CurTime()} --, infl=self} end self.Weapon:EmitSound(sound_single) self.Weapon:SendWeaponAnim( ACT_VM_HITCENTER ) self.Weapon:SetNextSecondaryFire( CurTime() + self.Secondary.Delay ) end if self.Owner.LagCompensation then self.Owner:LagCompensation(false) end end function SWEP:GetClass() return "weapon_zm_improvised" end function SWEP:OnDrop() self:Remove() end
mit
Turttle/darkstar
scripts/zones/The_Eldieme_Necropolis/TextIDs.lua
7
2300
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6538; -- You cannot obtain the item <item> come back again after sorting your inventory ITEM_OBTAINED = 6542; -- Obtained: <item> GIL_OBTAINED = 6543; -- Obtained <number> gil KEYITEM_OBTAINED = 6545; -- Obtained key item: <keyitem> SOLID_STONE = 7365; -- This door is made of solid stone. -- Treasure Coffer/Chest Dialog CHEST_UNLOCKED = 7384; -- You unlock the chest! CHEST_FAIL = 7385; -- Fails to open the chest. CHEST_TRAP = 7386; -- The chest was trapped! CHEST_WEAK = 7387; -- You cannot open the chest when you are in a weakened state. CHEST_MIMIC = 7388; -- The chest was a mimic! CHEST_MOOGLE = 7389; -- You cannot open the chest while participating in the moogle event. CHEST_ILLUSION = 7390; -- The chest was but an illusion... CHEST_LOCKED = 7391; -- The chest appears to be locked. -- Quests NOTHING_OUT_OF_ORDINARY = 6556; -- There is nothing out of the ordinary here. SENSE_OF_FOREBODING = 6557; -- You are suddenly overcome with a sense of foreboding... NOTHING_HAPPENED = 7325; -- Nothing happened... RETURN_RIBBON_TO_HER = 7338; -- You can hear a voice from somewhere. (...return...ribbon to...her...) THE_BRAZIER_IS_LIT = 7352; -- The brazier is lit. REFUSE_TO_LIGHT = 7353; -- Unexpectedly, therefuses to light. LANTERN_GOES_OUT = 7354; -- For some strange reason, the light of thegoes out... THE_LIGHT_DIMLY = 7355; -- lights dimly. It doesn't look like this will be effective yet.?Prompt? THE_LIGHT_HAS_INTENSIFIED = 7356; -- The light of thehas intensified. THE_LIGHT_IS_FULLY_LIT = 7357; -- is fully lit! SPIRIT_INCENSE_EMITS_PUTRID_ODOR = 7394; -- emits a putrid odor and burns up. Your attempt this time has failed...?Prompt? SARCOPHAGUS_CANNOT_BE_OPENED = 7411; -- It is a stone sarcophagus with the lid sealed tight. It cannot be opened. -- conquest Base CONQUEST_BASE = 0; -- Strange Apparatus DEVICE_NOT_WORKING = 7301; -- The device is not working. SYS_OVERLOAD = 7310; -- arning! Sys...verload! Enterin...fety mode. ID eras...d YOU_LOST_THE = 7315; -- You lost the #.
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c90434926.lua
2
1833
--漆黒のトバリ function c90434926.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(90434926,0)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW) e2:SetRange(LOCATION_SZONE) e2:SetType(CATEGORY_TOGRAVE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DRAW) e2:SetCondition(c90434926.drcon) e2:SetCost(c90434926.drcost) e2:SetTarget(c90434926.drtg) e2:SetOperation(c90434926.drop) c:RegisterEffect(e2) end function c90434926.drcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()==tp and Duel.GetCurrentPhase()==PHASE_DRAW end function c90434926.filter(c) return c:IsAttribute(ATTRIBUTE_DARK) and not c:IsPublic() end function c90434926.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return ep==tp and eg:IsExists(c90434926.filter,1,nil) end local g=eg:Filter(c90434926.filter,nil) if g:GetCount()==1 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) e:SetLabelObject(g:GetFirst()) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local sg=g:Select(tp,1,1,nil) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) e:SetLabelObject(sg:GetFirst()) end end function c90434926.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local tc=e:GetLabelObject() tc:CreateEffectRelation(e) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,tc,1,0,0) end function c90434926.drop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if not e:GetHandler():IsRelateToEffect(e) or not tc:IsRelateToEffect(e) then return end Duel.SendtoGrave(tc,REASON_EFFECT) if tc:IsLocation(LOCATION_GRAVE) and Duel.IsPlayerCanDraw(tp,1) and Duel.SelectYesNo(tp,aux.Stringid(90434926,1)) then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c100000105.lua
2
1696
--アルカナフォースVIII-STRENGTH function c100000105.initial_effect(c) --coin local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(100000105,0)) e1:SetCategory(CATEGORY_COIN) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(c100000105.cointg) e1:SetOperation(c100000105.coinop) 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 c100000105.cointg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1) end function c100000105.coinop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or not c:IsFaceup() then return end local res=0 if c:IsHasEffect(73206827) then res=1-Duel.SelectOption(tp,60,61) else res=Duel.TossCoin(tp,1) end if res==0 then if Duel.IsExistingTarget(Card.IsControlerCanBeChanged,tp,LOCATION_MZONE,0,1,nil) then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(1-tp,Card.IsControlerCanBeChanged,1-tp,0,LOCATION_MZONE,1,1,e:GetHandler()) Duel.HintSelection(g) Duel.BreakEffect() if g then Duel.GetControl(g:GetFirst(),1-tp) end end else if Duel.IsExistingTarget(Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,nil) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,1,nil) Duel.HintSelection(g) Duel.BreakEffect() if g then Duel.GetControl(g:GetFirst(),tp) end end end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c58268433.lua
4
1136
--ブレードラビット function c58268433.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(58268433,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_CHANGE_POS) e1:SetCondition(c58268433.condition) e1:SetTarget(c58268433.target) e1:SetOperation(c58268433.operation) c:RegisterEffect(e1) end function c58268433.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return bit.band(c:GetPreviousPosition(),POS_ATTACK)~=0 and c:IsFaceup() and c:IsDefensePos() end function c58268433.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c58268433.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
fgenesis/Aquaria_experimental
game_scripts/scripts/maps/_unused/node_foundsecret03.lua
6
1100
-- Copyright (C) 2007, 2010 - Bit-Blot -- -- This file is part of Aquaria. -- -- Aquaria is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if not v then v = {} end if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end v.done = false function init(me) end function update(me, dt) if v.done then return end if node_isEntityIn(me, getNaija()) then if foundLostMemory(FLAG_SECRET03) then v.done = true end end end
gpl-2.0
Turttle/darkstar
scripts/globals/items/mercanbaligi.lua
18
1262
----------------------------------------- -- ID: 5454 -- Item: Mercanbaligi -- Food Effect: 5Min, Mithra only ----------------------------------------- -- Dexterity 4 -- Mind -6 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) result = 0 if (target:getRace() ~= 7) then result = 247; end if (target:getMod(MOD_EAT_RAW_FISH) == 1) then result = 0; end 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,300,5454); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 4); target:addMod(MOD_MND, -6); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 4); target:delMod(MOD_MND, -6); end;
gpl-3.0
iskygame/skynet
lualib/http/internal.lua
95
2613
local table = table local type = type local M = {} local LIMIT = 8192 local function chunksize(readbytes, body) while true do local f,e = body:find("\r\n",1,true) if f then return tonumber(body:sub(1,f-1),16), body:sub(e+1) end if #body > 128 then -- pervent the attacker send very long stream without \r\n return end body = body .. readbytes() end end local function readcrln(readbytes, body) if #body >= 2 then if body:sub(1,2) ~= "\r\n" then return end return body:sub(3) else body = body .. readbytes(2-#body) if body ~= "\r\n" then return end return "" end end function M.recvheader(readbytes, lines, header) if #header >= 2 then if header:find "^\r\n" then return header:sub(3) end end local result local e = header:find("\r\n\r\n", 1, true) if e then result = header:sub(e+4) else while true do local bytes = readbytes() header = header .. bytes if #header > LIMIT then return end e = header:find("\r\n\r\n", -#bytes-3, true) if e then result = header:sub(e+4) break end if header:find "^\r\n" then return header:sub(3) end end end for v in header:gmatch("(.-)\r\n") do if v == "" then break end table.insert(lines, v) end return result end function M.parseheader(lines, from, header) local name, value for i=from,#lines do local line = lines[i] if line:byte(1) == 9 then -- tab, append last line if name == nil then return end header[name] = header[name] .. line:sub(2) else name, value = line:match "^(.-):%s*(.*)" if name == nil or value == nil then return end name = name:lower() if header[name] then local v = header[name] if type(v) == "table" then table.insert(v, value) else header[name] = { v , value } end else header[name] = value end end end return header end function M.recvchunkedbody(readbytes, bodylimit, header, body) local result = "" local size = 0 while true do local sz sz , body = chunksize(readbytes, body) if not sz then return end if sz == 0 then break end size = size + sz if bodylimit and size > bodylimit then return end if #body >= sz then result = result .. body:sub(1,sz) body = body:sub(sz+1) else result = result .. body .. readbytes(sz - #body) body = "" end body = readcrln(readbytes, body) if not body then return end end local tmpline = {} body = M.recvheader(readbytes, tmpline, body) if not body then return end header = M.parseheader(tmpline,1,header) return result, header end return M
mit
dickeyf/darkstar
scripts/globals/weaponskills/wasp_sting.lua
1
1573
----------------------------------- -- Wasp Sting -- Dagger weapon skill -- Skill level: 5 -- Poisons target. Duration of effect varies with TP. -- Will stack with Sneak Attack. -- Aligned with the Soil Gorget. -- Aligned with the Soil Belt. -- Element: None -- Modifiers: : DEX:100% -- 100%TP 200%TP 300%TP -- 1.00 1.00 1.00 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary) local params = {}; params.numHits = 1; params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1; params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; 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; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.dex_wsc = 1.0; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary); if (damage > 0) then local tp = player:getTP(); local duration = (tp/100 * 15) + 75; if (target:hasStatusEffect(EFFECT_POISON) == false) then target:addStatusEffect(EFFECT_POISON, 1, 0, duration); end end return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c9348522.lua
5
2319
--浮鵺城 function c9348522.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(9348522,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c9348522.spcon) e1:SetTarget(c9348522.sptg) e1:SetOperation(c9348522.spop) c:RegisterEffect(e1) --cannot attack local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(c9348522.limtg) c:RegisterEffect(e2) if not c9348522.global_check then c9348522.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_SUMMON_SUCCESS) ge1:SetOperation(c9348522.checkop) Duel.RegisterEffect(ge1,0) local ge2=ge1:Clone() ge2:SetCode(EVENT_SPSUMMON_SUCCESS) Duel.RegisterEffect(ge2,0) end end function c9348522.checkop(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() while tc do tc:RegisterFlagEffect(9348522,RESET_EVENT+0x1ec0000+RESET_PHASE+PHASE_END,0,1) tc=eg:GetNext() end end function c9348522.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SYNCHRO end function c9348522.spfilter(c,e,tp) return c:GetLevel()==9 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c9348522.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c9348522.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c9348522.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c9348522.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c9348522.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function c9348522.limtg(e,c) return c:IsLevelBelow(8) and c:GetFlagEffect(9348522)~=0 end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c95658967.lua
2
3706
--祝福の教会-リチューアル・チャーチ function c95658967.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(95658967,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,95658967) e2:SetCost(c95658967.thcost) e2:SetTarget(c95658967.thtg) e2:SetOperation(c95658967.thop) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(95658967,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_SZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1,95658968) e3:SetCost(c95658967.spcost) e3:SetTarget(c95658967.sptg) e3:SetOperation(c95658967.spop) c:RegisterEffect(e3) end function c95658967.cfilter(c) return c:IsType(TYPE_SPELL) and c:IsDiscardable() end function c95658967.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c95658967.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,c95658967.cfilter,1,1,REASON_COST+REASON_DISCARD) end function c95658967.thfilter(c) return ((c:IsType(TYPE_MONSTER) and c:IsAttribute(ATTRIBUTE_LIGHT)) or c:IsType(TYPE_SPELL)) and c:IsType(TYPE_RITUAL) and c:IsAbleToHand() end function c95658967.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c95658967.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c95658967.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c95658967.thfilter,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function c95658967.spfilter(c,e,tp) local lv=c:GetLevel() return lv>0 and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FAIRY) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(c95658967.cfilter2,tp,LOCATION_GRAVE,0,lv,nil) end function c95658967.cfilter2(c) return c:IsType(TYPE_SPELL) and c:IsAbleToDeckAsCost() end function c95658967.spcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(100) if chk==0 then return true end end function c95658967.spfilter2(c,e,tp,lv) return c:GetLevel()==lv and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FAIRY) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c95658967.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c95658967.spfilter2(chkc,e,tp,e:GetLabel()) end if chk==0 then if e:GetLabel()~=100 then return false end e:SetLabel(0) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c95658967.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end e:SetLabel(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c95658967.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) local lv=g:GetFirst():GetLevel() e:SetLabel(lv) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local tg=Duel.SelectMatchingCard(tp,c95658967.cfilter2,tp,LOCATION_GRAVE,0,lv,lv,nil) Duel.SendtoDeck(tg,nil,2,REASON_COST) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c95658967.spop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
gpl-2.0
Riverlance/kingdom-age-game-windows
modules/game_battlelist/battlelist.lua
1
19763
_G.GameBattleList = { } battleTopMenuButton = nil battleWindow = nil battleHeader = nil sortMenuButton = nil arrowMenuButton = nil filterPlayersButton = nil filterNPCsButton = nil filterMonstersButton = nil filterSkullsButton = nil filterPartyButton = nil battlePanel = nil mouseWidget = nil lastButtonSwitched = nil -- Sorting BATTLE_SORT_APPEAR = 1 BATTLE_SORT_DISTANCE = 2 BATTLE_SORT_HEALTH = 3 BATTLE_SORT_NAME = 4 BATTLE_ORDER_ASCENDING = 1 BATTLE_ORDER_DESCENDING = 2 BATTLE_SORT_STR = { [BATTLE_SORT_APPEAR] = 'Display Time', [BATTLE_SORT_DISTANCE] = 'Distance', [BATTLE_SORT_HEALTH] = 'Hitpoints', [BATTLE_SORT_NAME] = 'Name', } BATTLE_ORDER_STR = { [BATTLE_ORDER_ASCENDING] = 'Ascending', [BATTLE_ORDER_DESCENDING] = 'Descending' } local defaultValues = { filterPanel = true, filterPlayers = true, filterNPCs = true, filterMonsters = true, filterSkulls = true, filterParty = true, sortType = BATTLE_SORT_DISTANCE, sortOrder = BATTLE_ORDER_ASCENDING } -- Position checking local lastPosCheck = g_clock.millis() BATTLELIST_POS_UPDATE_DELAY = 1000 function GameBattleList.init() -- Alias GameBattleList.m = modules.game_battlelist battleList = {} battleListByIndex = {} g_ui.importStyle('battlelistbutton') g_keyboard.bindKeyDown('Ctrl+B', GameBattleList.toggle) battleWindow = g_ui.loadUI('battlelist') battleTopMenuButton = ClientTopMenu.addRightGameToggleButton('battleTopMenuButton', tr('Battle List') .. ' (Ctrl+B)', '/images/ui/top_menu/battle_list', GameBattleList.toggle) battleWindow.topMenuButton = battleTopMenuButton battleHeader = battleWindow:getChildById('miniWindowHeader') -- This disables scrollbar auto hiding local scrollbar = battleWindow:getChildById('miniwindowScrollBar') scrollbar:mergeStyle({ ['$!on'] = {} }) sortMenuButton = battleWindow:getChildById('sortMenuButton') GameBattleList.setSortType(GameBattleList.getSortType()) GameBattleList.setSortOrder(GameBattleList.getSortOrder()) arrowMenuButton = battleWindow:getChildById('arrowMenuButton') arrowMenuButton:setOn(not g_settings.getValue('BattleList', 'filterPanel', defaultValues.filterPanel)) GameBattleList.onClickArrowMenuButton(arrowMenuButton) local _filterPanel = battleHeader:getChildById('filterPanel') filterPlayersButton = _filterPanel:getChildById('filterPlayers') filterNPCsButton = _filterPanel:getChildById('filterNPCs') filterMonstersButton = _filterPanel:getChildById('filterMonsters') filterSkullsButton = _filterPanel:getChildById('filterSkulls') filterPartyButton = _filterPanel:getChildById('filterParty') filterPlayersButton:setOn(not g_settings.getValue('BattleList', 'filterPlayers', defaultValues.filterPlayers)) filterNPCsButton:setOn(not g_settings.getValue('BattleList', 'filterNPCs', defaultValues.filterNPCs)) filterMonstersButton:setOn(not g_settings.getValue('BattleList', 'filterMonsters', defaultValues.filterMonsters)) filterSkullsButton:setOn(not g_settings.getValue('BattleList', 'filterSkulls', defaultValues.filterSkulls)) filterPartyButton:setOn(not g_settings.getValue('BattleList', 'filterParty', defaultValues.filterParty)) GameBattleList.onClickFilterPlayers(filterPlayersButton) GameBattleList.onClickFilterNPCs(filterNPCsButton) GameBattleList.onClickFilterMonsters(filterMonstersButton) GameBattleList.onClickFilterSkulls(filterSkullsButton) GameBattleList.onClickFilterParty(filterPartyButton) battlePanel = battleWindow:getChildById('contentsPanel'):getChildById('battlePanel') mouseWidget = g_ui.createWidget('UIButton') mouseWidget:setVisible(false) mouseWidget:setFocusable(false) mouseWidget.cancelNextRelease = false connect(Creature, { onAppear = GameBattleList.onAppear, onDisappear = GameBattleList.onDisappear, onPositionChange = GameBattleList.onPositionChange, onTypeChange = GameBattleList.onTypeChange, onShieldChange = GameBattleList.onShieldChange, onSkullChange = GameBattleList.onSkullChange, onEmblemChange = GameBattleList.onEmblemChange, onSpecialIconChange = GameBattleList.onSpecialIconChange, onHealthPercentChange = GameBattleList.onHealthPercentChange, onNicknameChange = GameBattleList.onNicknameChange }) connect(LocalPlayer, { onPositionChange = GameBattleList.onPositionChange }) connect(g_game, { onAttackingCreatureChange = GameBattleList.onAttackingCreatureChange, onFollowingCreatureChange = GameBattleList.onFollowingCreatureChange, onGameStart = GameBattleList.online, onGameEnd = GameBattleList.offline }) GameBattleList.refreshList() GameInterface.setupMiniWindow(battleWindow, battleTopMenuButton) end function GameBattleList.terminate() battleList = {} battleListByIndex = {} disconnect(g_game, { onAttackingCreatureChange = GameBattleList.onAttackingCreatureChange, onFollowingCreatureChange = GameBattleList.onFollowingCreatureChange, onGameStart = GameBattleList.online, onGameEnd = GameBattleList.offline }) disconnect(LocalPlayer, { onPositionChange = GameBattleList.onPositionChange }) disconnect(Creature, { onAppear = GameBattleList.onAppear, onDisappear = GameBattleList.onDisappear, onPositionChange = GameBattleList.onPositionChange, onTypeChange = GameBattleList.onTypeChange, onShieldChange = GameBattleList.onShieldChange, onSkullChange = GameBattleList.onSkullChange, onEmblemChange = GameBattleList.onEmblemChange, onSpecialIconChange = GameBattleList.onSpecialIconChange, onHealthPercentChange = GameBattleList.onHealthPercentChange, onNicknameChange = GameBattleList.onNicknameChange }) mouseWidget:destroy() battleTopMenuButton:destroy() battleWindow:destroy() g_keyboard.unbindKeyDown('Ctrl+B') _G.GameBattleList = nil end function GameBattleList.online() GameInterface.setupMiniWindow(battleWindow, battleTopMenuButton) end function GameBattleList.offline() GameBattleList.clearList() end function GameBattleList.toggle() GameInterface.toggleMiniWindow(battleWindow) end -- Button function GameBattleList.getButtonIndex(cid) for k, button in pairs(battleListByIndex) do if cid == button.creature:getId() then return k end end return nil end function GameBattleList.add(creature) local localPlayer = g_game.getLocalPlayer() if creature == localPlayer then return end local cid = creature:getId() local button = battleList[cid] -- Register first time creature adding if not button then button = g_ui.createWidget('BattleButton') button:setup(creature) button.onHoverChange = GameBattleList.onBattleButtonHoverChange button.onMouseRelease = GameBattleList.onBattleButtonMouseRelease battleList[cid] = button table.insert(battleListByIndex, battleList[cid]) if creature == g_game.getAttackingCreature() then GameBattleList.onAttackingCreatureChange(creature) end if creature == g_game.getFollowingCreature() then GameBattleList.onFollowingCreatureChange(creature) end battlePanel:addChild(button) GameBattleList.updateList() end end function GameBattleList.remove(creature) local cid = creature:getId() local index = GameBattleList.getButtonIndex(cid) if index then if battleList[cid] then if battleList[cid] == lastButtonSwitched then lastButtonSwitched = nil end battleList[cid]:destroy() battleList[cid] = nil end table.remove(battleListByIndex, index) -- else -- print("Trying to remove invalid battleButton") end end function GameBattleList.updateBattleButton(self) self:update() if self.isTarget or self.isFollowed then if lastButtonSwitched and lastButtonSwitched ~= self then lastButtonSwitched.isTarget = false lastButtonSwitched.isFollowed = false GameBattleList.updateBattleButton(lastButtonSwitched) end lastButtonSwitched = self end end function GameBattleList.updateBattleButtons() for _, button in ipairs(battleListByIndex) do GameBattleList.updateBattleButton(button) end end function GameBattleList.onBattleButtonHoverChange(self, hovered) if self.isBattleButton then self.isHovered = hovered GameBattleList.updateBattleButton(self) end end function GameBattleList.onBattleButtonMouseRelease(self, mousePosition, mouseButton) if mouseWidget.cancelNextRelease then mouseWidget.cancelNextRelease = false return false end if mouseButton == MouseLeftButton and g_keyboard.isCtrlPressed() and g_keyboard.isShiftPressed() then g_game.follow(self.creature) elseif g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton or g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton then mouseWidget.cancelNextRelease = true g_game.look(self.creature, true) return true elseif mouseButton == MouseLeftButton and g_keyboard.isShiftPressed() then g_game.look(self.creature, true) return true elseif mouseButton == MouseRightButton and not g_mouse.isPressed(MouseLeftButton) then GameInterface.createThingMenu(mousePosition, nil, nil, self.creature) return true elseif mouseButton == MouseLeftButton and not g_mouse.isPressed(MouseRightButton) then if self.isTarget then g_game.cancelAttack() else g_game.attack(self.creature) end return true end return false end function GameBattleList.updateStaticSquare() for _, button in pairs(battleList) do if button.isTarget then button:update() end end end -- Filtering function GameBattleList.onClickArrowMenuButton(self) local newState = not self:isOn() arrowMenuButton:setOn(newState) battleHeader:setOn(not newState) g_settings.setValue('BattleList', 'filterPanel', newState) end function GameBattleList.buttonFilter(button) local filterPlayers = not filterPlayersButton:isOn() local filterNPCs = not filterNPCsButton:isOn() local filterMonsters = not filterMonstersButton:isOn() local filterSkulls = not filterSkullsButton:isOn() local filterParty = not filterPartyButton:isOn() local creature = button.creature return filterPlayers and creature:isPlayer() or filterNPCs and creature:isNpc() or filterMonsters and creature:isMonster() or filterSkulls and (creature:getSkull() == SkullNone or creature:getSkull() == SkullProtected) or filterParty and creature:getShield() > ShieldWhiteBlue or false end function GameBattleList.filterButtons() for _, _button in pairs(battleList) do local on = not GameBattleList.buttonFilter(_button) local localPlayer = g_game.getLocalPlayer() if localPlayer and localPlayer:getPosition().z ~= _button.creature:getPosition().z then on = false end _button:setOn(on) end end function GameBattleList.onClickFilterPlayers(self) local newState = not self:isOn() filterPlayersButton:setOn(newState) g_settings.setValue('BattleList', 'filterPlayers', newState) GameBattleList.filterButtons() end function GameBattleList.onClickFilterNPCs(self) local newState = not self:isOn() filterNPCsButton:setOn(newState) g_settings.setValue('BattleList', 'filterNPCs', newState) GameBattleList.filterButtons() end function GameBattleList.onClickFilterMonsters(self) local newState = not self:isOn() filterMonstersButton:setOn(newState) g_settings.setValue('BattleList', 'filterMonsters', newState) GameBattleList.filterButtons() end function GameBattleList.onClickFilterSkulls(self) local newState = not self:isOn() filterSkullsButton:setOn(newState) g_settings.setValue('BattleList', 'filterSkulls', newState) GameBattleList.filterButtons() end function GameBattleList.onClickFilterParty(self) local newState = not self:isOn() filterPartyButton:setOn(newState) g_settings.setValue('BattleList', 'filterParty', newState) GameBattleList.filterButtons() end -- Sorting function GameBattleList.getSortType() return g_settings.getValue('BattleList', 'sortType', defaultValues.sortType) end function GameBattleList.setSortType(state) g_settings.setValue('BattleList', 'sortType', state) sortMenuButton:setTooltip(tr('Sort by: %s (%s)', BATTLE_SORT_STR[state] or '', BATTLE_ORDER_STR[GameBattleList.getSortOrder()] or '')) GameBattleList.updateList() end function GameBattleList.getSortOrder() return g_settings.getValue('BattleList', 'sortOrder', defaultValues.sortOrder) end function GameBattleList.setSortOrder(state) g_settings.setValue('BattleList', 'sortOrder', state) sortMenuButton:setTooltip(tr('Sort by: %s (%s)', BATTLE_SORT_STR[GameBattleList.getSortType()] or '', BATTLE_ORDER_STR[state] or '')) GameBattleList.updateList() end function GameBattleList.createSortMenu() local menu = g_ui.createWidget('PopupMenu') local sortOrder = GameBattleList.getSortOrder() local sortType = GameBattleList.getSortType() if sortOrder == BATTLE_ORDER_ASCENDING then menu:addOption(tr('%s Order', BATTLE_ORDER_STR[BATTLE_ORDER_DESCENDING]), function() GameBattleList.setSortOrder(BATTLE_ORDER_DESCENDING) end) elseif sortOrder == BATTLE_ORDER_DESCENDING then menu:addOption(tr('%s Order', BATTLE_ORDER_STR[BATTLE_ORDER_ASCENDING]), function() GameBattleList.setSortOrder(BATTLE_ORDER_ASCENDING) end) end menu:addSeparator() if sortType ~= BATTLE_SORT_APPEAR then menu:addOption(tr('Sort by %s', BATTLE_SORT_STR[BATTLE_SORT_APPEAR]), function() GameBattleList.setSortType(BATTLE_SORT_APPEAR) end) end if sortType ~= BATTLE_SORT_DISTANCE then menu:addOption(tr('Sort by %s', BATTLE_SORT_STR[BATTLE_SORT_DISTANCE]), function() GameBattleList.setSortType(BATTLE_SORT_DISTANCE) end) end if sortType ~= BATTLE_SORT_HEALTH then menu:addOption(tr('Sort by %s', BATTLE_SORT_STR[BATTLE_SORT_HEALTH]), function() GameBattleList.setSortType(BATTLE_SORT_HEALTH) end) end if sortType ~= BATTLE_SORT_NAME then menu:addOption(tr('Sort by %s', BATTLE_SORT_STR[BATTLE_SORT_NAME]), function() GameBattleList.setSortType(BATTLE_SORT_NAME) end) end menu:display() end function GameBattleList.sortList() local sortFunction local sortOrder = GameBattleList.getSortOrder() local sortType = GameBattleList.getSortType() if sortOrder == BATTLE_ORDER_ASCENDING then -- Ascending - Appear if sortType == BATTLE_SORT_APPEAR then sortFunction = function(a,b) return a.lastAppear < b.lastAppear end -- Ascending - Distance elseif sortType == BATTLE_SORT_DISTANCE then local localPlayer = g_game.getLocalPlayer() if localPlayer then local localPlayerPos = localPlayer:getPosition() sortFunction = function(a,b) return getDistanceTo(localPlayerPos, a.creature:getPosition()) < getDistanceTo(localPlayerPos, b.creature:getPosition()) end end -- Ascending - Health elseif sortType == BATTLE_SORT_HEALTH then sortFunction = function(a,b) return a.creature:getHealthPercent() < b.creature:getHealthPercent() end -- Ascending - Name elseif sortType == BATTLE_SORT_NAME then sortFunction = function(a,b) return a.creature:getName() < b.creature:getName() end end elseif sortOrder == BATTLE_ORDER_DESCENDING then -- Descending - Appear if sortType == BATTLE_SORT_APPEAR then sortFunction = function(a,b) return a.lastAppear > b.lastAppear end -- Descending - Distance elseif sortType == BATTLE_SORT_DISTANCE then local localPlayer = g_game.getLocalPlayer() if localPlayer then local localPlayerPos = localPlayer:getPosition() sortFunction = function(a,b) return getDistanceTo(localPlayerPos, a.creature:getPosition()) > getDistanceTo(localPlayerPos, b.creature:getPosition()) end end -- Descending - Health elseif sortType == BATTLE_SORT_HEALTH then sortFunction = function(a,b) return a.creature:getHealthPercent() > b.creature:getHealthPercent() end -- Descending - Name elseif sortType == BATTLE_SORT_NAME then sortFunction = function(a,b) return a.creature:getName() > b.creature:getName() end end end if sortFunction then table.sort(battleListByIndex, sortFunction) end end function GameBattleList.updateList() GameBattleList.sortList() for i = 1, #battleListByIndex do battlePanel:moveChildToIndex(battleListByIndex[i], i) end GameBattleList.filterButtons() end function GameBattleList.clearList() lastButtonSwitched = nil battleList = { } battleListByIndex = { } battlePanel:destroyChildren() end function GameBattleList.refreshList() local localPlayer = g_game.getLocalPlayer() if not localPlayer then return end GameBattleList.clearList() for _, creature in pairs(g_map.getSpectators(localPlayer:getPosition(), true)) do GameBattleList.add(creature) end end -- Events function GameBattleList.onAttackingCreatureChange(creature) local button = creature and battleList[creature:getId()] or lastButtonSwitched if button then button.isTarget = creature and true or false GameBattleList.updateBattleButton(button) end end function GameBattleList.onFollowingCreatureChange(creature) local button = creature and battleList[creature:getId()] or lastButtonSwitched if button then button.isFollowed = creature and true or false GameBattleList.updateBattleButton(button) end end function GameBattleList.onAppear(creature) if creature:isLocalPlayer() then addEvent(function() GameBattleList.updateStaticSquare() end) end GameBattleList.add(creature) end function GameBattleList.onDisappear(creature) GameBattleList.remove(creature) end function GameBattleList.onPositionChange(creature, pos, oldPos) local posCheck = g_clock.millis() local diffTime = posCheck - lastPosCheck if creature == g_game.getLocalPlayer() and pos and oldPos and pos.z ~= oldPos.z or GameBattleList.getSortType() == BATTLE_SORT_DISTANCE and diffTime > BATTLELIST_POS_UPDATE_DELAY then GameBattleList.updateList() lastPosCheck = posCheck end end function GameBattleList.onTypeChange(creature, typeId, oldTypeId) local button = battleList[creature:getId()] if button then button:updateCreatureType(typeId) end end function GameBattleList.onShieldChange(creature, shieldId) local button = battleList[creature:getId()] if button then button:updateShield(shieldId) end end function GameBattleList.onSkullChange(creature, skullId, oldSkullId) local button = battleList[creature:getId()] if button then button:updateSkull(skullId) end end function GameBattleList.onEmblemChange(creature, emblemId) local button = battleList[creature:getId()] if button then button:updateEmblem(emblemId) end end function GameBattleList.onSpecialIconChange(creature, specialIconId) local button = battleList[creature:getId()] if button then button:updateSpecialIcon(specialIconId) end end function GameBattleList.onHealthPercentChange(creature, healthPercent) local button = battleList[creature:getId()] if button then button:updateHealthPercent(healthPercent) if GameBattleList.getSortType() == BATTLE_SORT_HEALTH then GameBattleList.updateList() end end end function GameBattleList.onNicknameChange(creature, nickname) local button = battleList[creature:getId()] if button then button:updateLabelText(nickname) if GameBattleList.getSortType() == BATTLE_SORT_NAME then GameBattleList.updateList() end end end
mit
crazyhamedboy/telegrambot
plugins/bugzilla.lua
611
3983
do local BASE_URL = "https://bugzilla.mozilla.org/rest/" local function bugzilla_login() local url = BASE_URL.."login?login=" .. _config.bugzilla.username .. "&password=" .. _config.bugzilla.password print("accessing " .. url) local res,code = https.request( url ) local data = json:decode(res) return data end local function bugzilla_check(id) -- data = bugzilla_login() local url = BASE_URL.."bug/" .. id .. "?api_key=" .. _config.bugzilla.apikey -- print(url) local res,code = https.request( url ) local data = json:decode(res) return data end local function bugzilla_listopened(email) local url = BASE_URL.."bug?include_fields=id,summary,status,whiteboard,resolution&email1=" .. email .. "&email2=" .. email .. "&emailassigned_to2=1&emailreporter1=1&emailtype1=substring&emailtype2=substring&f1=bug_status&f2=bug_status&n1=1&n2=1&o1=equals&o2=equals&resolution=---&v1=closed&v2=resolved&api_key=" .. _config.bugzilla.apikey local res,code = https.request( url ) print(res) local data = json:decode(res) return data end local function run(msg, matches) local response = "" if matches[1] == "status" then local data = bugzilla_check(matches[2]) vardump(data) if data.error == true then return "Sorry, API failed with message: " .. data.message else response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator response = response .. "\n Last update: "..data.bugs[1].last_change_time response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1] print(response) end elseif matches[1] == "list" then local data = bugzilla_listopened(matches[2]) vardump(data) if data.error == true then return "Sorry, API failed with message: " .. data.message else -- response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator -- response = response .. "\n Last update: "..data.bugs[1].last_change_time -- response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution -- response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard -- response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1] local total = table.map_length(data.bugs) print("total bugs: " .. total) local response = "There are " .. total .. " number of bug(s) assigned/reported by " .. matches[2] if total > 0 then response = response .. ": " for tableKey, bug in pairs(data.bugs) do response = response .. "\n #" .. bug.id response = response .. "\n Status: " .. bug.status .. " " .. bug.resolution response = response .. "\n Whiteboard: " .. bug.whiteboard response = response .. "\n Summary: " .. bug.summary end end end end return response end -- (table) -- [bugs] = (table) -- [1] = (table) -- [status] = (string) ASSIGNED -- [id] = (number) 927704 -- [whiteboard] = (string) [approved][full processed] -- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/mozilla-summit-2013/ -- [2] = (table) -- [status] = (string) ASSIGNED -- [id] = (number) 1049337 -- [whiteboard] = (string) [approved][full processed][waiting receipts][waiting report and photos] -- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/workshop-firefox-os-pada-workshop-media-sosial-untuk-perubahan-1/ -- total bugs: 2 return { description = "Lookup bugzilla status update", usage = "/bot bugzilla [bug number]", patterns = { "^/bugzilla (status) (.*)$", "^/bugzilla (list) (.*)$" }, run = run } end
gpl-2.0
adib1380/anit-spam-2
plugins/bugzilla.lua
611
3983
do local BASE_URL = "https://bugzilla.mozilla.org/rest/" local function bugzilla_login() local url = BASE_URL.."login?login=" .. _config.bugzilla.username .. "&password=" .. _config.bugzilla.password print("accessing " .. url) local res,code = https.request( url ) local data = json:decode(res) return data end local function bugzilla_check(id) -- data = bugzilla_login() local url = BASE_URL.."bug/" .. id .. "?api_key=" .. _config.bugzilla.apikey -- print(url) local res,code = https.request( url ) local data = json:decode(res) return data end local function bugzilla_listopened(email) local url = BASE_URL.."bug?include_fields=id,summary,status,whiteboard,resolution&email1=" .. email .. "&email2=" .. email .. "&emailassigned_to2=1&emailreporter1=1&emailtype1=substring&emailtype2=substring&f1=bug_status&f2=bug_status&n1=1&n2=1&o1=equals&o2=equals&resolution=---&v1=closed&v2=resolved&api_key=" .. _config.bugzilla.apikey local res,code = https.request( url ) print(res) local data = json:decode(res) return data end local function run(msg, matches) local response = "" if matches[1] == "status" then local data = bugzilla_check(matches[2]) vardump(data) if data.error == true then return "Sorry, API failed with message: " .. data.message else response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator response = response .. "\n Last update: "..data.bugs[1].last_change_time response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1] print(response) end elseif matches[1] == "list" then local data = bugzilla_listopened(matches[2]) vardump(data) if data.error == true then return "Sorry, API failed with message: " .. data.message else -- response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator -- response = response .. "\n Last update: "..data.bugs[1].last_change_time -- response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution -- response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard -- response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1] local total = table.map_length(data.bugs) print("total bugs: " .. total) local response = "There are " .. total .. " number of bug(s) assigned/reported by " .. matches[2] if total > 0 then response = response .. ": " for tableKey, bug in pairs(data.bugs) do response = response .. "\n #" .. bug.id response = response .. "\n Status: " .. bug.status .. " " .. bug.resolution response = response .. "\n Whiteboard: " .. bug.whiteboard response = response .. "\n Summary: " .. bug.summary end end end end return response end -- (table) -- [bugs] = (table) -- [1] = (table) -- [status] = (string) ASSIGNED -- [id] = (number) 927704 -- [whiteboard] = (string) [approved][full processed] -- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/mozilla-summit-2013/ -- [2] = (table) -- [status] = (string) ASSIGNED -- [id] = (number) 1049337 -- [whiteboard] = (string) [approved][full processed][waiting receipts][waiting report and photos] -- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/workshop-firefox-os-pada-workshop-media-sosial-untuk-perubahan-1/ -- total bugs: 2 return { description = "Lookup bugzilla status update", usage = "/bot bugzilla [bug number]", patterns = { "^/bugzilla (status) (.*)$", "^/bugzilla (list) (.*)$" }, run = run } end
gpl-2.0
dickeyf/darkstar
scripts/globals/mobskills/Lethe_Arrows.lua
29
1094
--------------------------------------------- -- Lethe Arrows -- -- Description: Deals a ranged attack to target. Additional effect: Knockback, Bind, and Amnesia -- Type: Ranged -- Utsusemi/Blink absorb: Ignores Utsusemi -- Range: Unknown -- Notes: --------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0; end; function onMobWeaponSkill(target, mob, skill) local typeEffect = EFFECT_BIND; MobStatusEffectMove(mob, target, typeEffect, 1, 0, 120); typeEffect = EFFECT_AMNESIA; MobStatusEffectMove(mob, target, typeEffect, 1, 0, 120); local numhits = 1; local accmod = 3; local dmgmod = 4; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_DMG_VARIES,1,2,3); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_RANGED,MOBPARAM_PIERCE,MOBPARAM_IGNORE_SHADOWS); target:delHP(dmg); return dmg; end;
gpl-3.0
dickeyf/darkstar
scripts/zones/Yuhtunga_Jungle/npcs/Zorchorevi_RK.lua
13
3332
----------------------------------- -- Area: Yuhtunga Jungle -- NPC: Zorchorevi, R.K. -- Outpost Conquest Guards -- @pos -242.487 -1 -402.772 123 ----------------------------------- package.loaded["scripts/zones/Yuhtunga_Jungle/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Yuhtunga_Jungle/TextIDs"); local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border local region = ELSHIMOLOWLANDS; 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
erictheredsu/eric_git
MGCN/wow/WTF/Account/ERIC/Mangoscn/Erica/SavedVariables/dct_spellAlert.lua
8
5270
DCTSA_PERCONFIG = { ["DCTSA_SHOW_BUFFGET_FOCUS"] = { ["color"] = { 0.35, -- [1] 0.35, -- [2] 1, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1◇#ce获得了#c2#sn#ce", -- [1] }, }, ["DCTSA_SSC_Spell"] = 1, ["DCTSA_SHOW_CASTSTART_YOURTARGET"] = { ["show"] = { "#c1★#ce施放 #c2#sn#ce", -- [1] }, ["fEff"] = 2, ["color"] = { 1, -- [1] 0, -- [2] 0, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 0, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, }, ["DCTSA_SHOW_CASTSTART"] = { ["color"] = { 1, -- [1] 0, -- [2] 0, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1#oi#ce施放 #c2#sn#ce", -- [1] }, }, ["DCTSA_SAVEDATA_VER"] = 2001, ["DCTSA_SHOW_CASTSUCCESS"] = { ["color"] = { 1, -- [1] 0, -- [2] 0, -- [3] }, ["frame"] = 0, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1#oi 对[#di]#ce施放了 #c2#sn#ce", -- [1] }, }, ["DCTSA_ENABLE_ONCOMBAT"] = 0, ["DCTSA_ENABLE_ONPVP"] = 1, ["DCTSA_SHOW_DISPELLED_YOURTARGET"] = { ["show"] = { "#c1★#ce#c2#sn#ce被驱散", -- [1] }, ["fEff"] = 2, ["color"] = { 0, -- [1] 1, -- [2] 0, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 0, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, }, ["DCTSA_SHOW_BUFFFADE"] = { ["color"] = { 0, -- [1] 0.8, -- [2] 1, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1#oi#ce #c2#sn#ce消失了", -- [1] }, }, ["DCTSA_FILTER_ENABLE"] = 1, ["DCTSA_SHOW_CASTSUCCESS_FOCUS"] = { ["color"] = { 1, -- [1] 0, -- [2] 0, -- [3] }, ["frame"] = 0, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1◇ 对[#di]#ce施放了 #c2#sn#ce", -- [1] }, }, ["DCTSA_FILTER_MODE"] = 0, ["DCTSA_SHOW_BUFFGET_YOURTARGET"] = { ["show"] = { "#c1★#ce获得了#c2#sn#ce", -- [1] }, ["fEff"] = 2, ["color"] = { 0.35, -- [1] 0.35, -- [2] 1, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 0, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, }, ["DCTSA_CASTTIME"] = 1, ["DCTSA_SHOW_CASTSTART_FOCUS"] = { ["color"] = { 1, -- [1] 0, -- [2] 0, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1◇#ce施放 #c2#sn#ce", -- [1] }, }, ["DCTSA_SHOW_CASTSUCCESS_YOURTARGET"] = { ["show"] = { "#c1★对[#di]#ce施放了 #c2#sn#ce", -- [1] }, ["fEff"] = 2, ["color"] = { 1, -- [1] 0, -- [2] 0, -- [3] }, ["frame"] = 0, ["colorEx"] = { { 1, -- [1] 0, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, }, ["DCTSA_SHOW_DISPELLED"] = { ["color"] = { 0, -- [1] 1, -- [2] 0, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1#oi#ce #c2#sn#ce被驱散", -- [1] }, }, ["DCTSA_CASTSUCCESS_ONLYTOYOU"] = 1, ["DCTSA_SHOW_DISPELLED_FOCUS"] = { ["color"] = { 0, -- [1] 1, -- [2] 0, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1◇#ce #c2#sn#ce被驱散", -- [1] }, }, ["DCTSA_MERGE_CASTSUCCESS_AND_BUFFGET"] = 1, ["DCTSA_SHOW_BUFFFADE_YOURTARGET"] = { ["show"] = { "#c1★#ce#c2#sn#ce消失了", -- [1] }, ["fEff"] = 2, ["color"] = { 0, -- [1] 0.8, -- [2] 1, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 0, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, }, ["DCTSA_ENABLE"] = 0, ["DCTSA_SHOW_BUFFFADE_FOCUS"] = { ["color"] = { 0, -- [1] 0.8, -- [2] 1, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1◇#ce #c2#sn#ce消失了", -- [1] }, }, ["DCTSA_SHOW_BUFFGET"] = { ["color"] = { 0.35, -- [1] 0.35, -- [2] 1, -- [3] }, ["frame"] = 6, ["colorEx"] = { { 1, -- [1] 1, -- [2] 1, -- [3] }, -- [1] { 1, -- [1] 1, -- [2] 0, -- [3] }, -- [2] }, ["show"] = { "#c1#oi#ce获得了#c2#sn#ce", -- [1] }, }, }
gpl-3.0
omidtarh/fbot
plugins/qr.lua
637
1730
--[[ * qr plugin uses: * - http://goqr.me/api/doc/create-qr-code/ * psykomantis ]] local function get_hex(str) local colors = { red = "f00", blue = "00f", green = "0f0", yellow = "ff0", purple = "f0f", white = "fff", black = "000", gray = "ccc" } for color, value in pairs(colors) do if color == str then return value end end return str end local function qr(receiver, text, color, bgcolor) local url = "http://api.qrserver.com/v1/create-qr-code/?" .."size=600x600" --fixed size otherways it's low detailed .."&data="..URL.escape(text:trim()) if color then url = url.."&color="..get_hex(color) end if bgcolor then url = url.."&bgcolor="..get_hex(bgcolor) end local response, code, headers = http.request(url) if code ~= 200 then return "Oops! Error: " .. code end if #response > 0 then send_photo_from_url(receiver, url) return end return "Oops! Something strange happened :(" end local function run(msg, matches) local receiver = get_receiver(msg) local text = matches[1] local color local back if #matches > 1 then text = matches[3] color = matches[2] back = matches[1] end return qr(receiver, text, color, back) end return { description = {"qr code plugin for telegram, given a text it returns the qr code"}, usage = { "!qr [text]", '!qr "[background color]" "[data color]" [text]\n' .."Color through text: red|green|blue|purple|black|white|gray\n" .."Colors through hex notation: (\"a56729\" is brown)\n" .."Or colors through decimals: (\"255-192-203\" is pink)" }, patterns = { '^!qr "(%w+)" "(%w+)" (.+)$', "^!qr (.+)$" }, run = run }
gpl-2.0
mamaddeveloper/hhw
plugins/qr.lua
637
1730
--[[ * qr plugin uses: * - http://goqr.me/api/doc/create-qr-code/ * psykomantis ]] local function get_hex(str) local colors = { red = "f00", blue = "00f", green = "0f0", yellow = "ff0", purple = "f0f", white = "fff", black = "000", gray = "ccc" } for color, value in pairs(colors) do if color == str then return value end end return str end local function qr(receiver, text, color, bgcolor) local url = "http://api.qrserver.com/v1/create-qr-code/?" .."size=600x600" --fixed size otherways it's low detailed .."&data="..URL.escape(text:trim()) if color then url = url.."&color="..get_hex(color) end if bgcolor then url = url.."&bgcolor="..get_hex(bgcolor) end local response, code, headers = http.request(url) if code ~= 200 then return "Oops! Error: " .. code end if #response > 0 then send_photo_from_url(receiver, url) return end return "Oops! Something strange happened :(" end local function run(msg, matches) local receiver = get_receiver(msg) local text = matches[1] local color local back if #matches > 1 then text = matches[3] color = matches[2] back = matches[1] end return qr(receiver, text, color, back) end return { description = {"qr code plugin for telegram, given a text it returns the qr code"}, usage = { "!qr [text]", '!qr "[background color]" "[data color]" [text]\n' .."Color through text: red|green|blue|purple|black|white|gray\n" .."Colors through hex notation: (\"a56729\" is brown)\n" .."Or colors through decimals: (\"255-192-203\" is pink)" }, patterns = { '^!qr "(%w+)" "(%w+)" (.+)$', "^!qr (.+)$" }, run = run }
gpl-2.0
dickeyf/darkstar
scripts/zones/Dangruf_Wadi/npcs/Grounds_Tome.lua
30
1091
----------------------------------- -- Area: Dangruf Wadi -- NPC: Grounds Tome ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/groundsofvalor"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) startGov(GOV_EVENT_DANGRUF_WADI,player); end; ----------------------------------- -- onEventSelection ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); updateGov(player,csid,option,639,640,641,642,643,644,645,646,0,0); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); finishGov(player,csid,option,639,640,641,642,643,644,645,646,0,0,GOV_MSG_DANGRUF_WADI); end;
gpl-3.0
Turttle/darkstar
scripts/zones/Nashmau/npcs/Leleroon.lua
17
3000
----------------------------------- -- Area: Nashmau -- NPC: Leleroon -- Standard Info NPC -- Corsair SideQuests -- @pos -14.687 0.000 25.114 53 ----------------------------------- package.loaded["scripts/zones/Nashmau/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Nashmau/TextIDs"); require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/globals/keyitems"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(AHT_URHGAN,NAVIGATING_THE_UNFRIENDLY_SEAS) == QUEST_ACCEPTED and player:getVar("NavigatingtheUnfriendlySeas") <= 2) then if (trade:hasItemQty(2341,1) and trade:getItemCount() == 1) then -- Trade Hydrogauage player:startEvent(0x11B); player:setVar("NavigatingtheUnfriendlySeas",2); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local mJob = player:getMainJob(); local mLvl = player:getMainLvl(); if (player:getVar("AgainstAllOddsSideQuests") == 1 and mJob == 17 and mLvl >= AF3_QUEST_LEVEL) then player:startEvent(0x11A); -- CS with 3 Options else player:startEvent(0x0108); -- Basic Dialog 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 (option == 0) then elseif (option == 1) then if (player:hasKeyItem(LELEROONS_LETTER_RED) or player:hasKeyItem(LELEROONS_LETTER_BLUE) or player:hasKeyItem(LELEROONS_LETTER_GREEN) == false) then -- player:addKeyItem(LELEROONS_LETTER_GREEN); player:messageSpecial(KEYITEM_OBTAINED,LELEROONS_LETTER_GREEN) player:setVar("LeleroonsLetterGreen",1); player:setVar("AgainstAllOddsSideQuests",2); end elseif (option == 2) then if (player:hasKeyItem(LELEROONS_LETTER_RED) or player:hasKeyItem(LELEROONS_LETTER_BLUE) or player:hasKeyItem(LELEROONS_LETTER_GREEN) == false) then -- player:addKeyItem(LELEROONS_LETTER_BLUE); player:messageSpecial(KEYITEM_OBTAINED,LELEROONS_LETTER_BLUE) player:setVar("LeleroonsLetterBlue",1); player:setVar("AgainstAllOddsSideQuests",2); end elseif (option == 3) then if (player:hasKeyItem(LELEROONS_LETTER_RED) or player:hasKeyItem(LELEROONS_LETTER_BLUE) or player:hasKeyItem(LELEROONS_LETTER_GREEN) == false) then -- player:addKeyItem(LELEROONS_LETTER_RED); player:messageSpecial(KEYITEM_OBTAINED,LELEROONS_LETTER_RED) player:setVar("LeleroonsLetterRed",1); player:setVar("AgainstAllOddsSideQuests",2); end end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c14733538.lua
2
2141
--竜呼相打つ function c14733538.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,14733538+EFFECT_COUNT_CODE_OATH) e1:SetTarget(c14733538.target) e1:SetOperation(c14733538.activate) c:RegisterEffect(e1) end function c14733538.filter(c,e,tp,b1,setcode) return c:IsSetCard(setcode) and c:IsType(TYPE_PENDULUM) and not c:IsForbidden() and (b1 or c:IsCanBeSpecialSummoned(e,0,tp,false,false)) end function c14733538.target(e,tp,eg,ep,ev,re,r,rp,chk) local b1=Duel.CheckLocation(tp,LOCATION_SZONE,6) or Duel.CheckLocation(tp,LOCATION_SZONE,7) local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return (b1 or b2) and Duel.IsExistingMatchingCard(c14733538.filter,tp,LOCATION_DECK,0,1,nil,e,tp,b1,0xc7) and Duel.IsExistingMatchingCard(c14733538.filter,tp,LOCATION_DECK,0,1,nil,e,tp,b1,0xda) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_DECK) end function c14733538.activate(e,tp,eg,ep,ev,re,r,rp) local b1=Duel.CheckLocation(tp,LOCATION_SZONE,6) or Duel.CheckLocation(tp,LOCATION_SZONE,7) local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if not b1 and not b2 then return end local g1=Duel.GetMatchingGroup(c14733538.filter,tp,LOCATION_DECK,0,nil,e,tp,b1,0xc7) local g2=Duel.GetMatchingGroup(c14733538.filter,tp,LOCATION_DECK,0,nil,e,tp,b1,0xda) if g1:GetCount()==0 or g2:GetCount()==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local sg1=g1:Select(tp,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local sg2=g2:Select(tp,1,1,nil) sg1:Merge(sg2) Duel.ConfirmCards(1-tp,sg1) Duel.ShuffleDeck(tp) local cg=sg1:Select(1-tp,1,1,nil) local tc=cg:GetFirst() Duel.Hint(HINT_CARD,0,tc:GetCode()) if b1 and (not b2 or not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) or Duel.SelectYesNo(tp,aux.Stringid(14733538,0))) then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) else Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end sg1:RemoveCard(tc) Duel.SendtoExtraP(sg1,nil,REASON_EFFECT) end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c83274244.lua
5
1597
--ドドドウォリアー function c83274244.initial_effect(c) --summon with no tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(83274244,0)) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(c83274244.ntcon) e1:SetOperation(c83274244.ntop) c:RegisterEffect(e1) --negate local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetOperation(c83274244.atop) c:RegisterEffect(e2) end function c83274244.ntcon(e,c,minc) if c==nil then return true end return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function c83274244.ntop(e,tp,eg,ep,ev,re,r,rp,c) --change base attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT+0xff0000) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(1800) c:RegisterEffect(e1) end function c83274244.atop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_CHAIN_SOLVING) e1:SetRange(LOCATION_MZONE) e1:SetOperation(c83274244.negop) e1:SetReset(RESET_EVENT+0x1ff0000+RESET_PHASE+PHASE_DAMAGE) e:GetHandler():RegisterEffect(e1) end function c83274244.negop(e,tp,eg,ep,ev,re,r,rp) local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION) if ep~=tp and loc==LOCATION_GRAVE then Duel.NegateEffect(ev) end end
gpl-2.0
Turttle/darkstar
scripts/zones/Norg/npcs/Muzaffar.lua
14
3298
----------------------------------- -- Area: Norg -- NPC: Muzaffar -- Standard Info NPC -- Quests: Black Market -- @zone 252 -- @pos 16.678, -2.044, -14.600 ----------------------------------- require("scripts/zones/Norg/TextIDs"); require("scripts/globals/titles"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local count = trade:getItemCount(); local NorthernFurs = trade:hasItemQty(1199,4); local EasternPottery = trade:hasItemQty(1200,4); local SouthernMummies = trade:hasItemQty(1201,4); if (player:getQuestStatus(NORG,BLACK_MARKET) == QUEST_ACCEPTED or player:getQuestStatus(NORG,BLACK_MARKET) == QUEST_COMPLETED) then if (NorthernFurs == true and count == 4) then player:tradeComplete(); player:startEvent(0x0011, 1199, 1199); elseif (EasternPottery == true and count == 4) then player:tradeComplete(); player:startEvent(0x0012, 1200, 1200); elseif (SouthernMummies == true and count == 4) then player:tradeComplete(); player:startEvent(0x0013, 1201, 1201); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(NORG,BLACK_MARKET) == QUEST_ACCEPTED or player:getQuestStatus(NORG,BLACK_MARKET) == QUEST_COMPLETED) then player:startEvent(0x0010); else player:startEvent(0x000F); 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 == 0x000F and option == 1) then player:addQuest(NORG,BLACK_MARKET); elseif (csid == 0x0011) then player:addGil(GIL_RATE*1500); player:messageSpecial(GIL_OBTAINED,GIL_RATE*1500); if (player:getQuestStatus(NORG,BLACK_MARKET) == QUEST_ACCEPTED) then player:completeQuest(NORG,BLACK_MARKET); end player:addFame(NORG,40*NORG_FAME); player:addTitle(BLACK_MARKETEER); player:startEvent(0x0014); elseif (csid == 0x0012) then player:addGil(GIL_RATE*2000); player:messageSpecial(GIL_OBTAINED,GIL_RATE*2000); if (player:getQuestStatus(NORG,BLACK_MARKET) == QUEST_ACCEPTED) then player:completeQuest(NORG,BLACK_MARKET); end player:addFame(NORG,50*NORG_FAME); player:addTitle(BLACK_MARKETEER); player:startEvent(0x0014); elseif (csid == 0x0013) then player:addGil(GIL_RATE*3000); player:messageSpecial(GIL_OBTAINED,GIL_RATE*3000); if (player:getQuestStatus(NORG,BLACK_MARKET) == QUEST_ACCEPTED) then player:completeQuest(NORG,BLACK_MARKET); end player:addFame(NORG,80*NORG_FAME); player:addTitle(BLACK_MARKETEER); player:startEvent(0x0014); end end;
gpl-3.0
dickeyf/darkstar
scripts/zones/RuLude_Gardens/npcs/Magian_Moogle_Orange.lua
48
2326
----------------------------------- -- Area: Ru'Lude Gardens -- NPC: Magian Moogle (Orange Bobble) -- Type: Magian Trials NPC (Weapon/Empyrean Armor) -- @pos -11 2.453 118 64 ----------------------------------- package.loaded["scripts/zones/RuLude_Gardens/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/RuLude_Gardens/TextIDs"); require("scripts/globals/magiantrials"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (trade:getItemCount() == 1) then local ItemID = trade:getItem(); local TrialInfo = getTrialInfo(ItemID); local invalid = 0; if (TrialInfo.t1 == 0 and TrialInfo.t2 == 0 and TrialInfo.t3 == 0 and TrialInfo.t4 == 0) then invalid = 1; end player:startEvent(10124, TrialInfo.t1, TrialInfo.t2, TrialInfo.t3, TrialInfo.t4, 0, ItemID, 0, invalid); else -- placeholder for multi item trades such as geode etc. end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getMainLvl() < 75) then player:startEvent(10121); elseif (player:hasKeyItem(MAGIAN_TRIAL_LOG) == false) then player:startEvent(10122); else player:startEvent(10123); -- parameters unknown end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) printf("CSID: %u",csid); printf("RESULT: %u",option); if (csid == 10124) then local ItemID =0 ; if (option == 4456449) then ItemID = 19327; elseif (option == 4456449) then ItemID = 19327; end magianOrangeEventUpdate(player,ItemID,csid,option); end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) printf("CSID: %u",csid); printf("RESULT: %u",option); if (csid == 10122 and option == 1) then player:messageSpecial(KEYITEM_OBTAINED,MAGIAN_TRIAL_LOG); player:addKeyItem(MAGIAN_TRIAL_LOG); --elseif -- end end;
gpl-3.0
dickeyf/darkstar
scripts/globals/abilities/steal.lua
7
3218
----------------------------------- -- Ability: Steal -- Steal items from enemy. -- Obtained: Thief Level 5 -- Recast Time: 5:00 -- Duration: Instant ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); -- these are the quadavs that the thf af1 item can be stolen from -- bronze quadav groupid = 7949 -- garnet quadav groupid = 7960 -- silver quadav groupid = 7977 -- zircorn quadav groupid = 7985 validThfQuestMobs = {17379367,17379368,17379459,17379470,17379477,17379489,17379493,17379495,17379501,17379505,17379509, 17379513,17379517,17379521,17379525,17379529,17379533,17379538,17379543,17379547,17379552,17379556, 17379560,17379565,17379569,17379573,17379577,17379581,17379585,17379597,17379363,17379364,17379462, 17379473,17379480,17379496,17379498,17379500,17379504,17379508,17379512,17379516,17379520,17379524, 17379528,17379532,17379536,17379541,17379546,17379550,17379555,17379559,17379563,17379568,17379572, 17379576,17379580,17379584,17379588,17379600,17379361,17379362,17379460,17379471,17379478,17379490, 17379491,17379497,17379502,17379506,17379510,17379514,17379518,17379522,17379526,17379530,17379534, 17379539,17379544,17379548,17379553,17379557,17379561,17379566,17379570,17379574,17379578,17379582, 17379586,17379598,17379365,17379366,17379461,17379472,17379479,17379492,17379494,17379499,17379503, 17379507,17379511,17379515,17379519,17379523,17379527,17379531,17379535,17379540,17379545,17379549, 17379554,17379558,17379562,17379567,17379571,17379575,17379579,17379583,17379587,17379599}; ----------------------------------- -- onAbilityCheck ----------------------------------- function onAbilityCheck(player,target,ability) if (player:getFreeSlotsCount() == 0) then return MSGBASIC_FULL_INVENTORY,0; else return 0,0; end end; ----------------------------------- -- onUseAbility ----------------------------------- function onUseAbility(player,target,ability) local thfLevel; local stolen = 0; if (player:getMainJob() == JOB_THF) then thfLevel = player:getMainLvl(); else thfLevel = player:getSubLvl(); end local stealMod = player:getMod(MOD_STEAL); local stealChance = 50 + stealMod * 2 + thfLevel - target:getMainLvl(); stolen = target:getStealItem(); if (target:isMob() and math.random(100) < stealChance and stolen ~= 0) then if (checkThfAfQuest(player, target) == true) then stolen = 4569; end player:addItem(stolen); target:itemStolen(); ability:setMsg(125); -- Item stolen successfully else ability:setMsg(153); -- Failed to steal end return stolen; end; function checkThfAfQuest(player, target) local targid = target:getID(); if (player:getVar("theTenshodoShowdownCS") == 3) then for key, value in pairs(validThfQuestMobs) do if value == targid then return true end end return false end end;
gpl-3.0
LuaDist/oil
lua/socket.lua
146
4061
----------------------------------------------------------------------------- -- LuaSocket helper module -- Author: Diego Nehab -- RCS ID: $Id: socket.lua,v 1.22 2005/11/22 08:33:29 diego Exp $ ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- -- Declare module and import dependencies ----------------------------------------------------------------------------- local base = _G local string = require("string") local math = require("math") local socket = require("socket.core") module("socket") ----------------------------------------------------------------------------- -- Exported auxiliar functions ----------------------------------------------------------------------------- function connect(address, port, laddress, lport) local sock, err = socket.tcp() if not sock then return nil, err end if laddress then local res, err = sock:bind(laddress, lport, -1) if not res then return nil, err end end local res, err = sock:connect(address, port) if not res then return nil, err end return sock end function bind(host, port, backlog) local sock, err = socket.tcp() if not sock then return nil, err end sock:setoption("reuseaddr", true) local res, err = sock:bind(host, port) if not res then return nil, err end res, err = sock:listen(backlog) if not res then return nil, err end return sock end try = newtry() function choose(table) return function(name, opt1, opt2) if base.type(name) ~= "string" then name, opt1, opt2 = "default", name, opt1 end local f = table[name or "nil"] if not f then base.error("unknown key (".. base.tostring(name) ..")", 3) else return f(opt1, opt2) end end end ----------------------------------------------------------------------------- -- Socket sources and sinks, conforming to LTN12 ----------------------------------------------------------------------------- -- create namespaces inside LuaSocket namespace sourcet = {} sinkt = {} BLOCKSIZE = 2048 sinkt["close-when-done"] = function(sock) return base.setmetatable({ getfd = function() return sock:getfd() end, dirty = function() return sock:dirty() end }, { __call = function(self, chunk, err) if not chunk then sock:close() return 1 else return sock:send(chunk) end end }) end sinkt["keep-open"] = function(sock) return base.setmetatable({ getfd = function() return sock:getfd() end, dirty = function() return sock:dirty() end }, { __call = function(self, chunk, err) if chunk then return sock:send(chunk) else return 1 end end }) end sinkt["default"] = sinkt["keep-open"] sink = choose(sinkt) sourcet["by-length"] = function(sock, length) return base.setmetatable({ getfd = function() return sock:getfd() end, dirty = function() return sock:dirty() end }, { __call = function() if length <= 0 then return nil end local size = math.min(socket.BLOCKSIZE, length) local chunk, err = sock:receive(size) if err then return nil, err end length = length - string.len(chunk) return chunk end }) end sourcet["until-closed"] = function(sock) local done return base.setmetatable({ getfd = function() return sock:getfd() end, dirty = function() return sock:dirty() end }, { __call = function() if done then return nil end local chunk, err, partial = sock:receive(socket.BLOCKSIZE) if not err then return chunk elseif err == "closed" then sock:close() done = 1 return partial else return nil, err end end }) end sourcet["default"] = sourcet["until-closed"] source = choose(sourcet)
mit
Turttle/darkstar
scripts/globals/weaponskills/sniper_shot.lua
30
1451
----------------------------------- -- Sniper Shot -- Marksmanship weapon skill -- Skill Level: 80 -- Lowers enemy's INT. Chance of params.critical varies with TP. -- Aligned with the Flame Gorget & Light Gorget. -- Aligned with the Flame Belt & Light Belt. -- Element: None -- Modifiers: AGI:70% -- 100%TP 200%TP 300%TP -- 1.00 1.00 1.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; params.ftp300 = 1; params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.3; params.int_wsc = 0.0; 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; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.agi_wsc = 0.7; end local damage, tpHits, extraHits = doRangedWeaponskill(player, target, params); if damage > 0 and (target:hasStatusEffect(EFFECT_INT_DOWN) == false) then target:addStatusEffect(EFFECT_INT_DOWN, 10, 0, 140); end damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c19302550.lua
2
2639
--DD魔導賢者ニュートン function c19302550.initial_effect(c) --pendulum summon aux.EnablePendulumAttribute(c) --splimit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_PZONE) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE) e1:SetTargetRange(1,0) e1:SetTarget(c19302550.splimit) c:RegisterEffect(e1) --disable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetRange(LOCATION_PZONE) e2:SetCode(EVENT_CHAIN_SOLVING) e2:SetCondition(c19302550.discon) e2:SetOperation(c19302550.disop) c:RegisterEffect(e2) --tohand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(19302550,0)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_HAND) e3:SetCountLimit(1,19302550) e3:SetCost(c19302550.thcost) e3:SetTarget(c19302550.thtg) e3:SetOperation(c19302550.thop) c:RegisterEffect(e3) end function c19302550.splimit(e,c,sump,sumtype,sumpos,targetp) return not c:IsSetCard(0xaf) and bit.band(sumtype,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end function c19302550.discon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsChainDisablable(ev) and re:IsActiveType(TYPE_TRAP) and aux.damcon1(e,tp,eg,ep,ev,re,r,rp) and e:GetHandler():GetFlagEffect(19302550)==0 end function c19302550.disop(e,tp,eg,ep,ev,re,r,rp) if not Duel.SelectYesNo(tp,aux.Stringid(19302550,1)) then return end e:GetHandler():RegisterFlagEffect(19302550,RESET_EVENT+0x1fe0000,0,1) if not Duel.NegateEffect(ev) then return end Duel.BreakEffect() Duel.Destroy(e:GetHandler(),REASON_EFFECT) end function c19302550.thcost(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 c19302550.thfilter(c) return (c:IsSetCard(0xaf) or c:IsSetCard(0xae)) and not c:IsCode(19302550) and c:IsAbleToHand() end function c19302550.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c19302550.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c19302550.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c19302550.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c19302550.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
gpl-2.0