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
mrbangi/telegram
plugins/all.lua
1321
4661
do data = load_data(_config.moderation.data) local function get_msgs_user_chat(user_id, chat_id) local user_info = {} local uhash = 'user:'..user_id local user = redis:hgetall(uhash) local um_hash = 'msgs:'..user_id..':'..chat_id user_info.msgs = tonumber(redis:get(um_hash) or 0) user_info.name = user_print_name(user)..' ['..user_id..']' return user_info end local function chat_stats(chat_id) local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'Chat stats:\n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end return text end local function get_group_type(target) local data = load_data(_config.moderation.data) local group_type = data[tostring(target)]['group_type'] if not group_type or group_type == nil then return 'No group type available.' end return group_type end local function show_group_settings(target) local data = load_data(_config.moderation.data) if data[tostring(target)] then if data[tostring(target)]['settings']['flood_msg_max'] then NUM_MSG_MAX = tonumber(data[tostring(target)]['settings']['flood_msg_max']) print('custom'..NUM_MSG_MAX) else NUM_MSG_MAX = 5 end end local settings = data[tostring(target)]['settings'] local text = "Lock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nflood sensitivity : "..NUM_MSG_MAX return text end local function get_description(target) local data = load_data(_config.moderation.data) local data_cat = 'description' if not data[tostring(target)][data_cat] then return 'No description available.' end local about = data[tostring(target)][data_cat] return about end local function get_rules(target) local data = load_data(_config.moderation.data) local data_cat = 'rules' if not data[tostring(target)][data_cat] then return 'No rules available.' end local rules = data[tostring(target)][data_cat] return rules end local function modlist(target) local data = load_data(_config.moderation.data) local groups = 'groups' if not data[tostring(groups)] or not data[tostring(groups)][tostring(target)] then return 'Group is not added or is Realm.' end if next(data[tostring(target)]['moderators']) == nil then return 'No moderator in this group.' end local i = 1 local message = '\nList of moderators :\n' for k,v in pairs(data[tostring(target)]['moderators']) do message = message ..i..' - @'..v..' [' ..k.. '] \n' i = i + 1 end return message end local function get_link(target) local data = load_data(_config.moderation.data) local group_link = data[tostring(target)]['settings']['set_link'] if not group_link or group_link == nil then return "No link" end return "Group link:\n"..group_link end local function all(target, receiver) local text = "All the things I know about this group\n\n" local group_type = get_group_type(target) text = text.."Group Type: \n"..group_type local settings = show_group_settings(target) text = text.."\n\nGroup settings: \n"..settings local rules = get_rules(target) text = text.."\n\nRules: \n"..rules local description = get_description(target) text = text.."\n\nAbout: \n"..description local modlist = modlist(target) text = text.."\n\nMods: \n"..modlist local link = get_link(target) text = text.."\n\nLink: \n"..link local stats = chat_stats(target) text = text.."\n\n"..stats local ban_list = ban_list(target) text = text.."\n\n"..ban_list local file = io.open("./groups/all/"..target.."all.txt", "w") file:write(text) file:flush() file:close() send_document(receiver,"./groups/all/"..target.."all.txt", ok_cb, false) return end function run(msg, matches) if matches[1] == "all" and matches[2] and is_owner2(msg.from.id, matches[2]) then local receiver = get_receiver(msg) local target = matches[2] return all(target, receiver) end if not is_owner(msg) then return end if matches[1] == "all" and not matches[2] then local receiver = get_receiver(msg) if not is_owner(msg) then return end return all(msg.to.id, receiver) end end return { patterns = { "^[!/](all)$", "^[!/](all) (%d+)$" }, run = run } end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c28297833.lua
2
1953
--ネクロフェイス function c28297833.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(28297833,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(c28297833.tdtg) e1:SetOperation(c28297833.tdop) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(28297833,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_REMOVE) e2:SetTarget(c28297833.rmtg) e2:SetOperation(c28297833.rmop) c:RegisterEffect(e2) end function c28297833.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,PLAYER_ALL,LOCATION_REMOVED) end function c28297833.tdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetFieldGroup(tp,LOCATION_REMOVED,LOCATION_REMOVED) Duel.SendtoDeck(g,nil,2,REASON_EFFECT) local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK) if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+0x1ff0000) e1:SetValue(ct*100) c:RegisterEffect(e1) end end function c28297833.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,5,PLAYER_ALL,LOCATION_DECK) end function c28297833.rmop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g1=Duel.GetDecktopGroup(tp,5) local g2=Duel.GetDecktopGroup(1-tp,5) g1:Merge(g2) Duel.DisableShuffleCheck() Duel.Remove(g1,POS_FACEUP,REASON_EFFECT) if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e1:SetValue(500) c:RegisterEffect(e1) end end
gpl-2.0
Turttle/darkstar
scripts/zones/Kazham/npcs/Toji_Mumosulah.lua
37
1558
----------------------------------- -- Area: Kazham -- NPC: Toji Mumosulah -- Standard Merchant NPC ----------------------------------- require("scripts/globals/shop"); package.loaded["scripts/zones/Kazham/TextIDs"] = nil; require("scripts/zones/Kazham/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,TOJIMUMOSULAH_SHOP_DIALOG); stock = {0x0070,456, -- Yellow Jar 0x338F,95, -- Blood Stone 0x3314,3510, -- Fang Necklace 0x3409,1667, -- Bone Earring 0x43C7,4747, -- Gemshorn 0x4261,69, -- Peeled Crayfish 0x4266,36, -- Insect Paste 0x45D4,165, -- Fish Broth 0x45D8,695, -- Seedbed Soil 0x03FD,450, -- Hatchet 0x137B,328, -- Scroll of Army's Paeon II 0x13d7,64528, -- Scroll of Foe Lullaby II 0x137C,3312, -- Scroll of Army's Paeon III 0x1364,8726} -- Scroll of Monomi: Ichi showShop(player, STATIC, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c14057297.lua
7
1593
--死なばもろとも function c14057297.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,14057297+EFFECT_COUNT_CODE_OATH) e1:SetCondition(c14057297.condition) e1:SetTarget(c14057297.target) e1:SetOperation(c14057297.activate) c:RegisterEffect(e1) end function c14057297.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>=3 and Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>=3 end function c14057297.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,5) and Duel.IsPlayerCanDraw(1-tp,5) end local g=Duel.GetFieldGroup(tp,LOCATION_HAND,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,5) end function c14057297.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_HAND,LOCATION_HAND)==0 then return end local p=tp local st=0 for i=1,2 do local sg=Duel.GetFieldGroup(p,LOCATION_HAND,0) Duel.SendtoDeck(sg,nil,0,REASON_EFFECT) local og=Duel.GetOperatedGroup() local ct=og:FilterCount(Card.IsLocation,nil,LOCATION_DECK) if ct>0 then st=st+ct Duel.SortDecktop(p,p,ct) for j=1,ct do local mg=Duel.GetDecktopGroup(p,1) Duel.MoveSequence(mg:GetFirst(),1) end end p=1-p end local lp=Duel.GetLP(tp) Duel.SetLP(tp,lp-st*300) if Duel.GetLP(tp)>0 then Duel.BreakEffect() Duel.Draw(tp,5,REASON_EFFECT) Duel.Draw(1-tp,5,REASON_EFFECT) end end
gpl-2.0
dickeyf/darkstar
scripts/globals/spells/bluemagic/foot_kick.lua
35
1687
----------------------------------------- -- Spell: Foot Kick -- Deals critical damage. Chance of critical hit varies with TP -- Spell cost: 5 MP -- Monster Type: Beasts -- Spell Type: Physical (Slashing) -- Blue Magic Points: 2 -- Stat Bonus: AGI+1 -- Level: 1 -- Casting Time: 0.5 seconds -- Recast Time: 6.5 seconds -- Skillchain Property: Detonation (can open Scission or Gravitation) -- Combos: Lizard Killer ----------------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); require("scripts/globals/bluemagic"); ----------------------------------------- -- OnMagicCastingCheck ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; ----------------------------------------- -- OnSpellCast ----------------------------------------- function onSpellCast(caster,target,spell) local params = {}; -- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage params.tpmod = TPMOD_CRITICAL; params.dmgtype = DMGTYPE_SLASH; params.scattr = SC_DETONATION; params.numhits = 1; params.multiplier = 1.0; params.tp150 = 1.0; params.tp300 = 1.0; params.azuretp = 1.0; params.duppercap = 9; params.str_wsc = 0.1; params.dex_wsc = 0.1; 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; damage = BluePhysicalSpell(caster, target, spell, params); damage = BlueFinalAdjustments(caster, target, spell, damage, params); return damage; end;
gpl-3.0
newbots/dark2
plugins/anti_ads.lua
61
1032
local function run(msg) local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)]['settings']['antilink'] == 'yes' then if not is_momod(msg) then chat_del_user('chat#id'..msg.to.id, 'user#id'..msg.from.id, ok_cb, true) local msgads = 'ForbiddenAdText' local receiver = msg.to.id send_large_msg('chat#id'..receiver, msg.."\n", ok_cb, false) end end end return {patterns = { "[Hh][Tt][Tt][Pp][Ss]://[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/[Jj][Oo][Ii][Nn][Cc][Hh][Aa][Tt]/", "[Hh][Tt][Tt][Pp][Ss]://[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/[Jj][Oo][Ii][Nn][Cc][Hh][Aa][Tt]", "[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/[Jj][Oo][Ii][Nn][Cc][Hh][Aa][Tt]/", "[Tt][Ee][Ll][Ee][Gg][Rr][Aa][Mm].[Mm][Ee]/[Jj][Oo][Ii][Nn][Cc][Hh][Aa][Tt]/", "[Hh][Tt][Tt][Pp]://", "[Ww][Ww][Ww]:", "عضویت", }, run = run} --Copyright and edit; @behroozyaghi --Persian Translate; @behroozyaghi --ch : @nod32team --کپی بدون ذکر منبع حرام است
gpl-2.0
dickeyf/darkstar
scripts/zones/Qufim_Island/npcs/Jiwon.lua
13
1889
----------------------------------- -- 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
c90239723.lua
5
2666
--D・リペアユニット function c90239723.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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCost(c90239723.cost) e1:SetTarget(c90239723.target) e1:SetOperation(c90239723.operation) c:RegisterEffect(e1) --Destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetOperation(c90239723.desop) c:RegisterEffect(e2) --Pos limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_CANNOT_CHANGE_POSITION) c:RegisterEffect(e3) end function c90239723.cfilter(c) return c:IsSetCard(0x26) and c:IsType(TYPE_MONSTER) and c:IsAbleToGraveAsCost() end function c90239723.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c90239723.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c90239723.cfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function c90239723.filter(c,e,tp) return c:IsSetCard(0x26) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c90239723.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c90239723.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c90239723.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c90239723.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function c90239723.eqlimit(e,c) return e:GetOwner()==c end function c90239723.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)==0 then return end Duel.Equip(tp,c,tc) --Add Equip limit e:SetLabelObject(tc) tc:CreateRelation(c,RESET_EVENT+0x1fe0000) local e1=Effect.CreateEffect(tc) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000) e1:SetValue(c90239723.eqlimit) c:RegisterEffect(e1) end end function c90239723.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
fgenesis/Aquaria_experimental
game_scripts/scripts/entities/bigmouth.lua
1
5350
-- 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 -- ================================================================================================ -- EEL -- ================================================================================================ -- ================================================================================================ -- FUNCTIONS -- ================================================================================================ v.dir = 0 v.switchDirDelay = 0 v.wiggleTime = 0 v.wiggleDir = 1 v.interestTimer = 0 v.colorRevertTimer = 0 v.collisionSegs = 50 v.avoidLerp = 0 v.avoidDir = 1 v.interest = false v.paraHits = 3 v.openTimer = 0 v.parasite = true -- initializes the entity function init(me) -- oldhealth : 40 setupBasicEntity( me, "", -- texture 50, -- health 1, -- manaballamount 1, -- exp 1, -- money 32, -- collideRadius (only used if hit entities is on) STATE_IDLE, -- initState 90, -- sprite width 90, -- sprite height 1, -- particle "explosion" type, maps to particleEffects.txt -1 = none 0, -- 0/1 hit other entities off/on (uses collideRadius) -1, -- updateCull -1: disabled, default: 4000 1 ) entity_setDropChance(me, 50) v.lungeDelay = 1.0 -- prevent the nautilus from attacking right away --entity_initHair(me, 80, 4, 32, "eel-0001") entity_initSkeletal(me, "BigMouth") v.switchDirDelay = math.random(800)/100.0 v.naija = getNaija() entity_setDeathParticleEffect(me, "TinyBlueExplode") entity_generateCollisionMask(me) entity_animate(me, "idle", -1) entity_setCullRadius(me, 256) end local function lunge(me) v.lungeDelay = 0 entity_setMaxSpeedLerp(me, 1.5) entity_setMaxSpeedLerp(me, 1, 1) entity_addVel(me, math.random(1000)-500, math.random(1000)-500) end -- the entity's main update function function update(me, dt) if isForm(FORM_BEAST) then entity_setActivationType(me, AT_CLICK) else entity_setActivationType(me, AT_NONE) end entity_handleShotCollisionsSkeletal(me) if entity_getState(me)==STATE_IDLE then v.lungeDelay = v.lungeDelay + dt if v.lungeDelay > 3 then lunge(me) end if not entity_hasTarget(me) then entity_findTarget(me, 1000) else v.openTimer = v.openTimer + dt entity_doEntityAvoidance(me, dt, 32, 0.1) entity_doCollisionAvoidance(me, dt, 8, 1.0) entity_flipToVel(me) entity_findTarget(me, 1200) if v.openTimer > 5 then if v.parasite then entity_setState(me, STATE_OPEN) end v.openTimer = 0 + math.random(3) end end entity_touchAvatarDamage(me, 64, 0, 800) elseif entity_isState(me, STATE_OPEN) then entity_doEntityAvoidance(me, dt, 32, 0.1) entity_doCollisionAvoidance(me, dt, 8, 1.0) if not entity_isAnimating(me) then entity_touchAvatarDamage(me, 64, 0.5, 800) entity_pullEntities(me, entity_x(me), entity_y(me), 1000, 1700, dt) local e = getFirstEntity() while e ~= 0 do if entity_getEntityType(e)==ET_ENEMY and e ~= me then if entity_isEntityInRange(me, e, 64 + entity_getCollideRadius(e)) then entity_damage(e, me, dt*20) end end e = getNextEntity() end else entity_touchAvatarDamage(me, 64, 0, 800) end end entity_updateMovement(me, dt) end function enterState(me) if entity_isState(me, STATE_IDLE) then entity_animate(me, "idle", -1) entity_setMaxSpeed(me, 300) lunge(me) elseif entity_isState(me, STATE_OPEN) then entity_animate(me, "open") entity_setMaxSpeedLerp(me, 0.2, 0.1) entity_setStateTime(me, 5) elseif entity_isState(me, STATE_DEAD) then if v.parasite then local e = createEntity("BigMouthParasite", "", entity_getPosition(me)) entity_setHealth(e, v.paraHits*2) end end end function exitState(me) if entity_isState(me, STATE_OPEN) then entity_setState(me, STATE_IDLE) end end function hitSurface(me) end function damage(me, attacker, bone, damageType, dmg) if v.parasite and bone_isName(bone,"Parasite") then bone_damageFlash(bone) v.paraHits = v.paraHits - dmg if v.paraHits <= 0 then bone_alpha(bone, 0) v.parasite = false -- die and kill parasite --entity_changeHealth(me, 0) --createEntity("BigMouthParasite", "", bone_getWorldPosition(bone)) --return true end return false end return true end function songNote(me, note) end function dieNormal(me) if chance(90) then spawnIngredient("ButterySeaLoaf", entity_x(me), entity_y(me)) end end
gpl-2.0
dickeyf/darkstar
scripts/zones/Bastok_Mines/npcs/Leonie.lua
13
1060
----------------------------------- -- Area: Bastok Mines -- NPC: Leonie -- Type: Room Renters -- @zone: 234 -- @pos 118.871 -0.004 -83.916 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0238); 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
c34968834.lua
2
2384
--暗黒界の鬼神 ケルト function c34968834.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(34968834,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(c34968834.spcon) e1:SetTarget(c34968834.sptg) e1:SetOperation(c34968834.spop) c:RegisterEffect(e1) end function c34968834.spcon(e,tp,eg,ep,ev,re,r,rp) e:SetLabel(e:GetHandler():GetPreviousControler()) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) and bit.band(r,0x4040)==0x4040 end function c34968834.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) if rp~=tp and tp==e:GetLabel() then Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end end function c34968834.filter(c,e,tp) return c:IsRace(RACE_FIEND) and ((Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)) or (Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp))) end function c34968834.spop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP)==0 then return end if rp~=tp and tp==e:GetLabel() and Duel.IsExistingMatchingCard(c34968834.filter,tp,LOCATION_DECK,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(34968834,1)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c34968834.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc then local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) local b2=Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp) local op=0 if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(34968834,2),aux.Stringid(34968834,3)) elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(34968834,2)) elseif b2 then op=Duel.SelectOption(tp,aux.Stringid(34968834,3))+1 else return end if op==0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) else Duel.SpecialSummon(tc,0,tp,1-tp,false,false,POS_FACEUP) end end end end
gpl-2.0
Turttle/darkstar
scripts/globals/weaponskills/tachi_ageha.lua
30
1716
----------------------------------- -- Tachi Ageha -- Great Katana weapon skill -- Skill Level: 300 -- Lowers target's defense. Chance of lowering target's defense varies with TP. -- 30% Defense Down -- Duration of effect is exactly 3 minutes. -- Aligned with the Shadow Gorget, Soil Gorget. -- Aligned with the Shadow Belt, Soil Belt. -- Element: None -- Skillchain Properties: Compression/Scission -- Modifiers: CHR:60% STR:40% -- 100%TP 200%TP 300%TP -- 2.625 2.625 2.625 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 1; params.ftp100 = 2.80; params.ftp200 = 2.80; params.ftp300 = 2.80; 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.50; 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.ftp100 = 2.625; params.ftp200 = 2.625; params.ftp300 = 2.625; params.str_wsc = 0.4; params.chr_wsc = 0.6; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); if damage > 0 and (target:hasStatusEffect(EFFECT_DEFENSE_DOWN) == false) then target:addStatusEffect(EFFECT_DEFENSE_DOWN, 25, 0, 180); end damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
Turttle/darkstar
scripts/zones/Western_Adoulin/npcs/HomePoint#1.lua
17
1240
----------------------------------- -- Area: Western_Adoulin -- NPC: HomePoint#1 -- @pos ----------------------------------- package.loaded["scripts/zones/Western_Adoulin/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Western_Adoulin/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fc, 44); 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 == 0x21fc) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
iskygame/skynet
lualib/sharedata/corelib.lua
5
3306
local core = require "sharedata.core" local type = type local rawset = rawset local conf = {} conf.host = { new = core.new, delete = core.delete, getref = core.getref, markdirty = core.markdirty, incref = core.incref, decref = core.decref, } local meta = {} local isdirty = core.isdirty local index = core.index local needupdate = core.needupdate local len = core.len local core_nextkey = core.nextkey local function findroot(self) while self.__parent do self = self.__parent end return self end local function update(root, cobj, gcobj) root.__obj = cobj root.__gcobj = gcobj local children = root.__cache if children then for k,v in pairs(children) do local pointer = index(cobj, k) if type(pointer) == "userdata" then update(v, pointer, gcobj) else children[k] = nil end end end end local function genkey(self) local key = tostring(self.__key) while self.__parent do self = self.__parent key = self.__key .. "." .. key end return key end local function getcobj(self) local obj = self.__obj if isdirty(obj) then local newobj, newtbl = needupdate(self.__gcobj) if newobj then local newgcobj = newtbl.__gcobj local root = findroot(self) update(root, newobj, newgcobj) if obj == self.__obj then error ("The key [" .. genkey(self) .. "] doesn't exist after update") end obj = self.__obj end end return obj end function meta:__newindex(key, value) error ("Error newindex, the key [" .. genkey(self) .. "]") end function meta:__index(key) local obj = getcobj(self) local v = index(obj, key) if type(v) == "userdata" then local children = self.__cache if children == nil then children = {} rawset(self, "__cache", children) end local r = children[key] if r then return r end r = setmetatable({ __obj = v, __gcobj = self.__gcobj, __parent = self, __key = key, }, meta) children[key] = r return r else return v end end function meta:__len() return len(getcobj(self)) end function meta:__pairs() return conf.next, self, nil end function conf.next(obj, key) local cobj = getcobj(obj) local nextkey = core_nextkey(cobj, key) if nextkey then return nextkey, obj[nextkey] end end function conf.box(obj) local gcobj = core.box(obj) return setmetatable({ __parent = false, __obj = obj, __gcobj = gcobj, __key = "", } , meta) end function conf.update(self, pointer) local cobj = self.__obj assert(isdirty(cobj), "Only dirty object can be update") core.update(self.__gcobj, pointer, { __gcobj = core.box(pointer) }) end function conf.flush(obj) getcobj(obj) end local function clone_table(cobj) local obj = {} local key while true do key = core_nextkey(cobj, key) if key == nil then break end local v = index(cobj, key) if type(v) == "userdata" then v = clone_table(v) end obj[key] = v end return obj end local function find_node(cobj, key, ...) if key == nil then return cobj end local cobj = index(cobj, key) if cobj == nil then return nil end if type(cobj) == "userdata" then return find_node(cobj, ...) end return cobj end function conf.copy(cobj, ...) cobj = find_node(cobj, ...) if cobj then if type(cobj) == "userdata" then return clone_table(cobj) else return cobj end end end return conf
mit
Turttle/darkstar
scripts/zones/Garlaige_Citadel/npcs/qm1.lua
17
1630
----------------------------------- -- Area: Garlaige Citadel -- NPC: qm1 (???) -- Involved In Quest: Altana's Sorrow -- @pos -282.339 0.001 261.707 200 ----------------------------------- package.loaded["scripts/zones/Garlaige_Citadel/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Garlaige_Citadel/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local AltanaSorrow = player:getQuestStatus(BASTOK,ALTANA_S_SORROW); local VirnageLetter = player:hasKeyItem(LETTER_FROM_VIRNAGE); local DivinePaint = player:hasKeyItem(BUCKET_OF_DIVINE_PAINT); if (AltanaSorrow == QUEST_ACCEPTED and VirnageLetter == false and DivinePaint == false) then player:addKeyItem(BUCKET_OF_DIVINE_PAINT); player:messageSpecial(KEYITEM_OBTAINED,BUCKET_OF_DIVINE_PAINT); else player:messageSpecial(YOU_FIND_NOTHING); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID2: %u",csid); --printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
dickeyf/darkstar
scripts/zones/Jugner_Forest_[S]/Zone.lua
12
1790
----------------------------------- -- -- Zone: Jugner_Forest_[S] (82) -- ----------------------------------- package.loaded["scripts/zones/Jugner_Forest_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Jugner_Forest_[S]/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(621.865,-6.665,300.264,149); end if (player:getQuestStatus(CRYSTAL_WAR,CLAWS_OF_THE_GRIFFON) == QUEST_ACCEPTED and player:getVar("ClawsOfGriffonProg") == 0) then cs = 0x00C8; elseif (player:getVar("roadToDivadomCS") == 1) then cs = 0x0069; end; return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x00C8) then player:setVar("ClawsOfGriffonProg",1); elseif (csid == 0x0069 ) then player:setVar("roadToDivadomCS", 2); end; end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c29876529.lua
2
1454
--闇の閃光 function c29876529.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,0x1e0) e1:SetCost(c29876529.cost) e1:SetTarget(c29876529.target) e1:SetOperation(c29876529.activate) c:RegisterEffect(e1) end function c29876529.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function c29876529.costfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAttackAbove(1500) and Duel.IsExistingMatchingCard(c29876529.dfilter,0,LOCATION_MZONE,LOCATION_MZONE,1,c) end function c29876529.dfilter(c) return c:IsStatus(STATUS_SPSUMMON_TURN) end function c29876529.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=0 then e:SetLabel(0) return Duel.CheckReleaseGroup(tp,c29876529.costfilter,1,nil) else return Duel.IsExistingMatchingCard(c29876529.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end end if e:GetLabel()==1 then e:SetLabel(0) local rg=Duel.SelectReleaseGroup(tp,c29876529.costfilter,1,1,nil) Duel.Release(rg,REASON_COST) end local g=Duel.GetMatchingGroup(c29876529.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c29876529.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c29876529.dfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
gpl-2.0
chrisliebert/quick-3d
ffi/Lua/quick3d.lua
1
12204
-- Copyright (C) 2016 Chris Liebert local wrapper = nil local ffi = nil function require_shared_library() wrapper = require "quick3dwrapper" end -- Determine whether platform is Windows function isWindows() if package.config:sub(1,1) == "\\" then return true end end -- Generate the wrapper source and compile the shared libarary function build_wrapper(target_build, sqlite3) -- Generate quick3d_wrapper.c -> quick3dwrapper local make_cmd = "cargo build" if sqlite3 then make_cmd = "cargo build --features sqlite" end if target_build == "release" then make_cmd = make_cmd .. " --release" end local make_result = os.execute(make_cmd) if not make_result == 0 then os.exit(2) end end function quick3d_relaunch_with_exported_unix_lib_path() -- Attempt to export the current directory to LD_LIBRARY_PATH on Unix systems local ld_lib_path_exported = os.getenv("QUICK3D_SHARED_LIBRARY_PATH_EXPORTED") if not (ld_lib_path_exported == nil) then if ld_lib_path_exported == "TRUE" then ld_lib_path_exported = true else ld_lib_path_exported = false end else ld_lib_path_exported = false end -- Generate command used to launch this file -- See https://www.lua.org/pil/1.4.html local i = 0 local rerun_command = "" while not (arg[i] == nil) do rerun_command = arg[i] .. " " .. rerun_command i = i - 1 end i=1 while not (arg[i] == nil) do rerun_command = rerun_command .. arg[i] .. " " i = i + 1 end -- Update LD_LIBRARY_PATH and QUICK3D_SHARED_LIBRARY_PATH_EXPORTED rerun_command = "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:`pwd` && " .. rerun_command rerun_command = "export QUICK3D_SHARED_LIBRARY_PATH_EXPORTED=TRUE && " .. rerun_command if not ld_lib_path_exported then print(rerun_command) if not os.execute(rerun_command) == 0 then print("Failed to set current directory in LD_LIBRARY_PATH") else os.exit(0) end end end -- Load the shared library function quick3d_init(target_build, sqlite3) if pcall(require_shared_library) then print "Loaded shared library" else print "Unable to load shared libraries" -- On Unix systems, attempt to set LD_LIBRARY_PATH in order to find .so files if not isWindows() then print("Attempting to export LD_LIBRARY_PATH") quick3d_relaunch_with_exported_unix_lib_path() if not pcall(require_shared_library) then print "Unable to find shared libraries" else return wrapper end end -- Unable to load shared libraries, try to build the wrapper print ("Building " .. target_build .. " shared libraries") build_wrapper(target_build, sqlite3) -- try to load the shared library again if not pcall(require_shared_library) then print "Unable to load quick3dwrapper shared libraries" os.exit(2) end end return wrapper end function get_quick3d_target_path(target) if isWindows() then return "../../target/" .. target .. "/quick3d.dll" else return "../../target/" .. target .. "/libquick3d.so" end end function quick3d_init_luajitffi(target_build, sqlite3) if ffi == nil then ffi = require("ffi") end print("Using " .. target_build .. " " .. jit.version .. " FFI module") local quick3d_interface_file = io.open("../../quick3d.h", "r") if not quick3d_interface_file then error("Unable to load ../../quick3d.h") end local quick3d_interface_file_contents = quick3d_interface_file:read("*a") quick3d_interface_file:close() ffi.cdef(quick3d_interface_file_contents) -- LuaJIT doesn't require an additional wrapper library to access the quick3d shared library -- however the LuaJIT FFI library needs to load the native declarations in ../../quick3d.i -- this file is also used to build the wrapper library (not used here) local quick3d_shared_lib_path = get_quick3d_target_path(target_build) local success success, wrapper = pcall(ffi.load, quick3d_shared_lib_path) if not success then local cargo_cmd = "cargo build" if sqlite3 then cargo_cmd = "cargo build --features sqlite" end if target_build == "release" then cargo_cmd = cargo_cmd .. " --release" end local make_cmd = "cd ../.. && cargo clean -p quick3d && " .. cargo_cmd .. " && cd ffi/Lua" print(make_cmd) if not os.execute(make_cmd) == 0 then error("Unable to execute " .. make_cmd) end success, wrapper = pcall(ffi.load, quick3d_shared_lib_path) if not success then error("Unable to load LuaJIT FFI module") end end print("Loaded " .. quick3d_shared_lib_path) return wrapper end function append_shared_lib_ext(filename) if isWindows() then return filename .. ".dll" else return filename .. ".so" end end function prepend_shared_lib_prefix(filename) if isWindows() then return filename else return "lib" .. filename end end -- Clean the shared library residual files function quick3d_clean(target_build) local quick3d_filename = append_shared_lib_ext("quick3d") -- filenames contains a list of files that will attempt to be deleted local filenames = { quick3d_filename, append_shared_lib_ext("quick3dwrapper"), append_shared_lib_ext("wrapper/quick3d"), "wrapper/quick3d.i", "wrapper/quick3d.h" } if isWindows() then table.insert(filenames, "wrapper/quick3d.lib") table.insert(filenames, "wrapper/sqlite3.lib") table.insert(filenames, "../../target/" .. target_build .. "/quick3d.lib") else quick3d_filename = prepend_shared_lib_prefix(quick3d_filename) table.insert(filenames, quick3d_filename) table.insert(filenames, "wrapper/" .. quick3d_filename) end if not os.execute("cargo clean") == 0 then print("Unable to run cargo clean") end local quick3d_clean_cmd = "cargo clean -p quick3d" if target_build == "release" then quick3d_clean_cmd = quick3d_clean_cmd .. " --release" end local make_result = os.execute("cd ../.. && " .. quick3d_clean_cmd .. " && cd ffi/Lua") if not make_result == 0 then print("Unable to clean quick3d build target") os.exit(3) else print("Executed " .. quick3d_clean_cmd .. " in ../..") end for i, filename in ipairs(filenames) do if os.remove(filename) then print("Removed "..filename) end end end function quick3d_read_console_buffer(console) local use_luajitffi = not(ffi == nil) local console_command = wrapper.read_console_buffer(console) -- The LuaJIT FFI api must wrap functions returning char* in ffi.string -- The Lua SWIG wrapper version does not require this if use_luajitffi then console_command = ffi.string(console_command) end return console_command end -- Load LUA code from a string function load_string(command) -- Load code in a way that supports multiple versions of LUA -- See http://stackoverflow.com/questions/9268954/lua-pass-context-into-loadstring if (setenv or setfenv) and loadstring then -- Lua 5.1/5.2 local context = {} setmetatable(context, { __index = _G }) context.string = string context.table = table local f = loadstring(command) if f == nil then return nil end -- The enviroment must be set in order to access the scripts global variables if setenv then setenv(f, context) elseif setfenv then setfenv(1, context) end return f else -- Lua >= 5.3 local f = load(command, "function() " ..command .. " end", "t", _ENV) return f end end -- Ensure stdout is captured in all threads -- This improves support on consoles such as msys io.stdout:setvbuf 'no' -- Evaluate an expression or function function eval(command) local f = load_string(command) if f == nil then -- If f is nill, it could still be an expression in which case we return it and print the value f = load_string("return " .. command) assert(f) result = f() print("Expression returned "..result) else -- Otherwise we just call the function local result = f() if not result == nil then -- If the function returns a value, print it print("Function returned ".. result) end end end -- Camera object wrapper Camera = {} Camera.__index = Camera function Camera.aim(self, x, y) self.struct = wrapper.camera_aim(self.struct, x, y) end function Camera.create(self, screen_width, screen_height) local camera = {} setmetatable(camera, Camera) self.struct = wrapper.create_camera(screen_width, screen_height) return camera end function Camera.move_forward(self, amount) self.struct = wrapper.camera_move_forward(self.struct, amount) end function Camera.move_backward(self, amount) self.struct = wrapper.camera_move_backward(self.struct, amount) end function Camera.move_left(self, amount) self.struct = wrapper.camera_move_left(self.struct, amount) end function Camera.move_right(self, amount) self.struct = wrapper.camera_move_right(self.struct, amount) end -- Display object wrapper Display = {} Display.__index = Display function Display.create(self, screen_width, screen_height, window_title) local display = {} setmetatable(display, Display) self.struct = wrapper.create_display(screen_width, screen_height, window_title) return display end function Display.hide(self) wrapper.window_hide(self.struct) end function Display.show(self) wrapper.window_show(self.struct) end -- Renderer object wrapper Renderer = {} Renderer.__index = Renderer function Renderer.create_from_binary(self, bin_filename, display) local renderer = {} setmetatable(renderer, Renderer) self.struct = wrapper.create_renderer_from_binary(bin_filename, display.struct) return renderer end function Renderer.create_from_compressed_binary(self, bin_filename, display) local renderer = {} setmetatable(renderer, Renderer) self.struct = wrapper.create_renderer_from_compressed_binary(bin_filename, display.struct) return renderer end function Renderer.create_from_database(self, db_filename, display) local renderer = {} setmetatable(renderer, Renderer) local dbloader = wrapper.create_db_loader(db_filename) self.struct = wrapper.create_renderer_from_db_loader(dbloader, display.struct) wrapper.free_db_loader(dbloader) return renderer end function Renderer.render(self, shader, camera, display) wrapper.render(self.struct, shader.struct, camera.struct, display.struct) end -- Shader object wrapper Shader = {} Shader.__index = Shader function Shader.create(self, name, db_filename, display) local shader = {} setmetatable(shader, Shader) local dbloader = wrapper.create_db_loader(db_filename) self.struct = wrapper.get_shader_from_dbloader(name, dbloader, display.struct) wrapper.free_db_loader(dbloader) return shader end function Shader.default(self, display) local shader = {} setmetatable(shader, Shader) self.struct = wrapper.shader_default(display.struct) return shader end -- Shader object wrapper EventBuffer = {} EventBuffer.__index = EventBuffer function EventBuffer.get(self, display) local events = {} setmetatable(events, EventBuffer) self.struct = wrapper.get_events(display.struct) return events end function EventBuffer.free(self) wrapper.free_events(self.struct) end function EventBuffer.display_closed(self) return wrapper.display_closed(self.struct) end function EventBuffer.empty(self) return wrapper.events_empty(self.struct) end function EventBuffer.print(self) wrapper.print_events(self.struct) end function EventBuffer.key_pressed(self, keycode) return wrapper.key_pressed(self.struct, keycode) end function EventBuffer.mouse_moved(self, keycode) local mouse = wrapper.mouse_moved(self.struct) local x, y = mouse.x, mouse.y wrapper.free_mouse(mouse) return x, y end function EventBuffer.mouse_pressed_left(self, keycode) return wrapper.mouse_pressed_left(self.struct) end function EventBuffer.mouse_pressed_right(self, keycode) return wrapper.mouse_pressed_right(self.struct) end function EventBuffer.mouse_released_left(self, keycode) return wrapper.mouse_released_left(self.struct) end function EventBuffer.mouse_released_right(self, keycode) return wrapper.mouse_released_right(self.struct) end
mit
Turttle/darkstar
scripts/globals/items/smilodon_liver.lua
18
1282
----------------------------------------- -- ID: 5668 -- Item: Smilodon Liver -- Food Effect: 5Min, Galka only ----------------------------------------- -- Strength 5 -- Intelligence -7 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) result = 0; if (target:getRace() ~= 8) then result = 247; end if (target:getMod(MOD_EAT_RAW_MEAT) == 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,5668); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 5); target:addMod(MOD_INT, -7); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 5); target:delMod(MOD_INT, -7); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c26842483.lua
5
1026
--ジャスティス・ブリンガー function c26842483.initial_effect(c) --negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(26842483,0)) e1:SetCategory(CATEGORY_NEGATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCode(EVENT_CHAINING) e1:SetCondition(c26842483.condition) e1:SetTarget(c26842483.target) e1:SetOperation(c26842483.operation) c:RegisterEffect(e1) end function c26842483.condition(e,tp,eg,ep,ev,re,r,rp,chk) local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION) return ep~=tp and loc==LOCATION_MZONE and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ev) and bit.band(re:GetHandler():GetSummonType(),SUMMON_TYPE_SPECIAL)~=0 end function c26842483.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function c26842483.operation(e,tp,eg,ep,ev,re,r,rp) Duel.NegateActivation(ev) end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c60990740.lua
2
2005
--絶対王 バック・ジャック function c60990740.initial_effect(c) --sset local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,60990740) e1:SetCondition(c60990740.condition) e1:SetCost(c60990740.cost) e1:SetTarget(c60990740.target) e1:SetOperation(c60990740.operation) c:RegisterEffect(e1) --sort local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,60990741) e2:SetTarget(c60990740.sdtg) e2:SetOperation(c60990740.sdop) c:RegisterEffect(e2) end function c60990740.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()~=tp end function c60990740.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function c60990740.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and not Duel.IsPlayerAffectedByEffect(tp,EFFECT_CANNOT_SSET) end end function c60990740.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,1) then return end Duel.ConfirmDecktop(tp,1) local tc=Duel.GetDecktopGroup(tp,1):GetFirst() Duel.DisableShuffleCheck() if tc:GetType()==TYPE_TRAP and tc:IsSSetable() then Duel.SSet(tp,tc) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1) else Duel.SendtoGrave(tc,REASON_EFFECT+REASON_REVEAL) end end function c60990740.sdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>2 end end function c60990740.sdop(e,tp,eg,ep,ev,re,r,rp) Duel.SortDecktop(tp,tp,3) end
gpl-2.0
dickeyf/darkstar
scripts/globals/items/bowl_of_riverfin_soup.lua
18
1891
----------------------------------------- -- ID: 6069 -- Item: Bowl of Riverfin Soup -- Food Effect: 3 Hrs, All Races ----------------------------------------- -- Accuracy % 14 Cap 90 -- Ranged Accuracy % 14 Cap 90 -- Attack % 18 Cap 80 -- Ranged Attack % 18 Cap 80 -- Amorph Killer 5 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,6069); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_FOOD_ACCP, 14); target:addMod(MOD_FOOD_ACC_CAP, 90); target:addMod(MOD_FOOD_RACCP, 14); target:addMod(MOD_FOOD_RACC_CAP, 90); target:addMod(MOD_FOOD_ATTP, 18); target:addMod(MOD_FOOD_ATT_CAP, 80); target:addMod(MOD_FOOD_RATTP, 18); target:addMod(MOD_FOOD_RATT_CAP, 80); target:addMod(MOD_AMORPH_KILLER, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_FOOD_ACCP, 14); target:delMod(MOD_FOOD_ACC_CAP, 90); target:delMod(MOD_FOOD_RACCP, 14); target:delMod(MOD_FOOD_RACC_CAP, 90); target:delMod(MOD_FOOD_ATTP, 18); target:delMod(MOD_FOOD_ATT_CAP, 80); target:delMod(MOD_FOOD_RATTP, 18); target:delMod(MOD_FOOD_RATT_CAP, 80); target:delMod(MOD_AMORPH_KILLER, 5); end;
gpl-3.0
dickeyf/darkstar
scripts/globals/effects/addendum_white.lua
14
2063
----------------------------------- -- -- -- ----------------------------------- ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:recalculateAbilitiesTable(); local bonus = effect:getPower(); local regen = effect:getSubPower(); target:addMod(MOD_WHITE_MAGIC_COST, -bonus); target:addMod(MOD_WHITE_MAGIC_CAST, -bonus); target:addMod(MOD_WHITE_MAGIC_RECAST, -bonus); if not (target:hasStatusEffect(EFFECT_TABULA_RASA)) then target:addMod(MOD_WHITE_MAGIC_COST, -10); target:addMod(MOD_WHITE_MAGIC_CAST, -10); target:addMod(MOD_WHITE_MAGIC_RECAST, -10); target:addMod(MOD_BLACK_MAGIC_COST, 20); target:addMod(MOD_BLACK_MAGIC_CAST, 20); target:addMod(MOD_BLACK_MAGIC_RECAST, 20); target:addMod(MOD_REGEN_EFFECT, regen); target:addMod(MOD_REGEN_DURATION, regen*2); end target:recalculateSkillsTable(); end; ----------------------------------- -- onEffectTick Action ----------------------------------- function onEffectTick(target,effect) end; ----------------------------------- -- onEffectLose Action ----------------------------------- function onEffectLose(target,effect) target:recalculateAbilitiesTable(); local bonus = effect:getPower(); local regen = effect:getSubPower(); target:delMod(MOD_WHITE_MAGIC_COST, -bonus); target:delMod(MOD_WHITE_MAGIC_CAST, -bonus); target:delMod(MOD_WHITE_MAGIC_RECAST, -bonus); if not (target:hasStatusEffect(EFFECT_TABULA_RASA)) then target:delMod(MOD_WHITE_MAGIC_COST, -10); target:delMod(MOD_WHITE_MAGIC_CAST, -10); target:delMod(MOD_WHITE_MAGIC_RECAST, -10); target:delMod(MOD_BLACK_MAGIC_COST, 20); target:delMod(MOD_BLACK_MAGIC_CAST, 20); target:delMod(MOD_BLACK_MAGIC_RECAST, 20); target:delMod(MOD_REGEN_EFFECT, regen); target:delMod(MOD_REGEN_DURATION, regen*2); end target:recalculateSkillsTable(); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c60681103.lua
2
2934
--巨神竜フェルグラント function c60681103.initial_effect(c) --remove local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCondition(c60681103.rmcon) e1:SetTarget(c60681103.rmtg) e1:SetOperation(c60681103.rmop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(aux.bdocon) e2:SetTarget(c60681103.sptg) e2:SetOperation(c60681103.spop) c:RegisterEffect(e2) end function c60681103.rmcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonLocation()==LOCATION_GRAVE end function c60681103.rmfilter(c) return c:IsType(TYPE_MONSTER) and c:IsAbleToRemove() end function c60681103.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE+LOCATION_GRAVE) and chkc:IsControler(1-tp) and c60681103.rmfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c60681103.rmfilter,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,c60681103.rmfilter,tp,0,LOCATION_MZONE+LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c60681103.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() local atk=0 if tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then if tc:IsType(TYPE_XYZ) then atk=tc:GetRank() else atk=tc:GetLevel() end if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(atk*100) e1:SetReset(RESET_EVENT+0x1ff0000) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end end end function c60681103.filter(c,e,tp) return c:IsRace(RACE_DRAGON) and (c:GetLevel()==7 or c:GetLevel()==8) and not c:IsCode(60681103) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c60681103.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and c60681103.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c60681103.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c60681103.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c60681103.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
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c49721904.lua
2
1198
--真六武衆-キザン function c49721904.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(c49721904.spcon) c:RegisterEffect(e1) --atk,def local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(c49721904.valcon) e2:SetValue(300) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) end function c49721904.spfilter(c) return c:IsFaceup() and c:IsSetCard(0x3d) and c:GetCode()~=49721904 end function c49721904.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c49721904.spfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) end function c49721904.vfilter(c) return c:IsFaceup() and c:IsSetCard(0x3d) end function c49721904.valcon(e) local c=e:GetHandler() return Duel.IsExistingMatchingCard(c49721904.vfilter,c:GetControler(),LOCATION_MZONE,0,2,c) end
gpl-2.0
Turttle/darkstar
scripts/globals/gear_sets.lua
3
26501
----------------------------------- -- Gear sets -- Allows the use of gear sets with modifiers ----------------------------------- require("scripts/globals/status"); ----------------------------------- local matchtype = { any = 0, earring_weapon = 1, weapon_weapon = 2 } -- placeholder for unknown mod types local MOD_UNKNOWN = 0; -- apparently these are static, so i'll leave them here local extraDamageChance = 35; local extraAttackChance = 25; local nullDamageChance = 15; local instantCastChance = 15; -- {id, {item, ids, in, no, particular, order}, minimum matches required, match type, mods{id, value, modvalue for each additional match, additional whole set bonus} local GearSets = { {id = 1, items = {16092,14554,14969,15633,15719}, matches = 5, matchType = matchtype.any, mods = {{MOD_HASTE_GEAR, 50, 0, 0}} }, -- Usukane's set (5% Haste) {id = 2, items = {16088,14550,14965,15629,15715}, matches = 5, matchType = matchtype.any, mods = {{MOD_CRITHITRATE, 5, 0, 0}} }, -- Skadi's set (5% critrate is guess) {id = 3, items = {16084,14546,14961,15625,15711}, matches = 5, matchType = matchtype.any, mods = {{MOD_DOUBLE_ATTACK, 5, 0, 0}} }, -- Ares's set (5% DA) {id = 4, items = {16107,14569,14984,15648,15734}, matches = 5, matchType = matchtype.any, mods = {{MOD_ACC, 20, 0, 0}} }, -- Denali Jacket Set (Increases Accuracy +20) {id = 5, items = {16106,14568,14983,15647,15733}, matches = 5, matchType = matchtype.any, mods = {{MOD_HPP, 10, 0, 0}} }, -- Askar Korazin Set (Max HP Boost %10) {id = 6, items = {16069,14530,14940,15609,15695}, matches = 5, matchType = matchtype.any, mods = {{MOD_SUBTLE_BLOW, 8, 0, 0}} }, -- Pahluwan Khazagand Set (8% is guess) {id = 7, items = {16100,14562,14977,15641,15727}, matches = 5, matchType = matchtype.any, mods = {{MOD_MATT, 5, 0, 0}} }, -- Morrigan's Robe Set (+5 Magic. Atk Bonus) {id = 8, items = {16096,14558,14973,15637,15723}, matches = 5, matchType = matchtype.any, mods = {{MOD_FASTCAST, 5, 0, 0}} }, -- Marduk's Jubbah Set (5% fastcast) {id = 9, items = {16108,14570,14985,15649,15735}, matches = 5, matchType = matchtype.any, mods = {{MOD_MDEF, 10, 0, 0}} }, -- Goliard Saio Set - Total Set Bonus +10% Magic Def. Bonus {id = 10, items = {16064,14527,14935,15606,15690}, matches = 5, matchType = matchtype.any, mods = {{MOD_REFRESH, 1, 0, 0}} }, -- Yigit Gomlek Set (1mp per tick) Adds "Refresh" effect {id = 11, items = {11503,13759,12745,14210,11413}, matches = 5, matchType = matchtype.any, mods = {{MOD_HASTE_GEAR, 50, 0, 0}} }, -- Perle Hauberk Set 5% haste {id = 12, items = {11504,13760,12746,14257,11414}, matches = 5, matchType = matchtype.any, mods = {{MOD_STORETP, 8, 0, 0}} }, -- Aurore Doublet Set store tp +8 {id = 13, items = {11505,13778,12747,14258,11415}, matches = 5, matchType = matchtype.any, mods = {{MOD_FASTCAST, 10, 0, 0}} }, -- Teal Saio Set fastcast 10% {id = 14, items = {10890,10462,10512,11980,10610}, matches = 5, matchType = matchtype.any, mods = {{MOD_HASTE_GEAR, 60, 0, 0}} }, -- Calma Armor Set haste%6 {id = 15, items = {10892,10464,10514,11982,10612}, matches = 5, matchType = matchtype.any, mods = {{MOD_MACC, 5, 0, 0}} }, -- Magavan Armor Set magic accuracy +5 {id = 16, items = {10891,10463,10513,11981,10611}, matches = 5, matchType = matchtype.any, mods = {{MOD_CRITHITRATE, 5, 0, 0}} }, -- Mustela Harness Set crit rate 5% {id = 17, items = {16126,15744}, matches = 2, matchType = matchtype.any, mods = {{MOD_RATT, 15, 0, 0}} }, -- Bowman's set: Ranged atk +15 {id = 18, items = {16147,14589,15010,16316,15756}, matches = 2, matchType = matchtype.any, mods = {{MOD_ATT, 1, 4.7, 0}} }, -- Fourth Division Brune Set {id = 19, items = {16148,14590,15011,16317,15757}, matches = 2, matchType = matchtype.any, mods = {{MOD_COUNTER, 1, 1, 0}} }, -- Cobra Unit Harness Set {id = 20, items = {16149,14591,15012,16318,15758}, matches = 2, matchType = matchtype.any, mods = {{MOD_MACC, 1, 1, 0}} }, -- Cobra Unit Robe Set {id = 21, items = { 6141,14581,15005,16312,15749}, matches = 2, matchType = matchtype.any, mods = {{MOD_ACC, 1, 1, 0}, {MOD_ATT, 1, 1, 0}} }, -- Iron Ram Chainmail Set. Double mod here! It is why it has 2 IDs. {id = 23, items = {16142,14582,15006,16313,15750} , matches = 2, matchType = matchtype.any, mods = {{MOD_HP, 10, 10, 0}} }, -- Fourth Division Cuirass Set {id = 24, items = {16143,14583,15007,16314,15751} , matches = 2, matchType = matchtype.any, mods = {{MOD_MP, 10, 10, 0}} }, -- Cobra Unit Coat Set {id = 25, items = {16062,14525,14933,15604,15688} , matches = 5, matchType = matchtype.any, mods = {{MOD_UDMGBREATH, -8, 0, 0}, {MOD_UDMGMAGIC, -8, 0, 0}} }, -- Amir Korazin Set - Double mod here! It is why it has 2 IDs. {id = 27, items = {11281,15015,16337,11364}, matches = 2, matchType = matchtype.any, mods = {{MOD_STORETP, 5, 5, 0}} }, -- Hachiryu Haramaki Set - Store tp {id = 28, items = {11064,11084,11104,11124,11144}, matches = 5, matchType = matchtype.any, mods = {{MOD_DA_DOUBLE_DAMAGE, 5, 0, 0}} }, -- Ravager's Armor +2 Set - Double attack double damage chance {id = 29, items = {11808,11824,11850,11857,11858}, matches = 2, matchType = matchtype.any, mods = {{MOD_DOUBLE_ATTACK, 5, 0, 0}} }, -- Fazheluo Mail Set. Set Bonus: "Double Attack"+5%. Active with any 2 pieces. {id = 30, items = {11809,11825,11851,11855,11859}, matches = 2, matchType = matchtype.any, mods = {{MOD_HASTE_GEAR, 80, 0, 0}} }, -- Cuauhtli Harness Set. Set Bonus: Haste+8%. Active with any 2 pieces. {id = 31, items = {11810,11826,11852,11856,11860}, matches = 2, matchType = matchtype.any, mods = {{MOD_MACC, 5, 0, 0}} }, -- Hyskos Robe Set. Set Bonus: Magic Accuracy+5. Active with any 2 pieces. {id = 32, items = {10876,10450,10500,11969,10600}, matches = 2, matchType = matchtype.any, mods = {{MOD_REFRESH, 1, 0.4, 0}} }, -- Ogier's Armor Set. Set Bonus: Adds "Refresh" Effect. Provides 1 mp/tick for 2-3 pieces worn, 2 mp/tick for 4-5 pieces worn. {id = 33, items = {10877,10451,10501,11970,10601}, matches = 2, matchType = matchtype.any, mods = {{MOD_CRITHITRATE, 1, 1, 0}} }, -- Athos's Armor Set. Set Bonus: Increases rate of critical hits. Gives +3% for the first 2 pieces and +1% for every additional piece. -- hipster set, stick it in HipsterSets below so we can handle it separately (still need to check if it's a set, though) {id = 34, items = {10878,10452,10502,11971,10602}, matches = 5, matchType = matchtype.any, mods = {{MOD_FASTCAST, 10, 0, 0}} }, -- Rubeus Armor Set. Set Bonus: Enhances "Fast Cast" Effect. 2 or 3 pieces equipped: Fast Cast +4, 4 or 5 pieces equipped: Fast Cast +10 {id = 35, items = {11080,11100,11120,11140,11160}, matches = 5, matchType = matchtype.any, mods = {{MOD_QUICK_DRAW_TRIPLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Navarch's Attire +2 Set. Set Bonus: Augments "Quick Draw". Quick Draw will occasionally deal triple damage. {id = 36, items = {11082,11102,11122,11142,11162}, matches = 2, matchType = matchtype.any, mods = {{MOD_SAMBA_DOUBLE_DAMAGE, 1, 1.8, 0}} }, -- Charis Attire +2 Set. Set Bonus: Augments "Samba". Occasionally doubles damage with Samba up. Adds approximately 1-2% per piece past the first. {id = 37, items = {11076,11096,11116,11136,11156}, matches = 5, matchType = matchtype.any, mods = {{MOD_EXTRA_DUAL_WIELD_ATTACK, extraAttackChance, 0, 0}} }, -- Iga Garb +2 Set. Set Bonus: Augments "Dual Wield". Attacks made while dual wielding occasionally add an extra attack {id = 38, items = {11074,11094,11114,11134,11154}, matches = 2, matchType = matchtype.any, mods = {{MOD_RAPID_SHOT_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Sylvan Attire +2 Set. Set Bonus: Augments "Rapid Shot". Rapid Shots occasionally deal double damage. {id = 39, items = {11070,11090,11110,11130,11150}, matches = 5, matchType = matchtype.any, mods = {{MOD_ABSORB_DMG_CHANCE, 1, 1, 0}} }, -- Creed Armor +2 Set. Set Bonus: Occasionally absorbs damage taken. Set proc believed to be somewhere around 5%, more testing needed. Verification Needed Absorb rate likely varies with # of set pieces. {id = 40, items = {11075,11095,11115,11135,11155}, matches = 5, matchType = matchtype.any, mods = {{MOD_ZANSHIN_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Unkai Domaru +2 Set. Set Bonus: Augments "Zanshin". Zanshin attacks will occasionally deal double damage. {id = 41, items = {11065,11085,11105,11125,11145}, matches = 5, matchType = matchtype.any, mods = {{MOD_EXTRA_KICK_ATTACK, extraAttackChance, 0, 0}} }, -- Tantra Attire +2 Set. Set Bonus: Augments "Kick Attacks". Occasionally allows a second Kick Attack during an attack round without the use of Footwork. {id = 42, items = {11069,11089,11109,11129,11149}, matches = 2, matchType = matchtype.any, mods = {{MOD_TA_TRIPLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Raider's Attire +2 Set. Set Bonus: Augments "Triple Attack". Occasionally causes the second and third hits of a Triple Attack to deal triple damage.Verification Needed Requires a minimum of two pieces. {id = 43, items = {11066,11086,11106,11126,11146}, matches = 5, matchType = matchtype.any, mods = {{MOD_BAR_ELEMENT_NULL_CHANCE, nullDamageChance, 0, 0}} }, -- Orison Attire +2 Set. Set Bonus: Augments elemental resistance spells. Bar Elemental spells will occasionally nullify damage of the same element. {id = 44, items = {11083,11103,11123,11143,11163}, matches = 5, matchType = matchtype.any, mods = {{MOD_GRIMOIRE_INSTANT_CAST, instantCastChance, 0, 0}} }, -- Savant's Attire +2 Set. Set Bonus: Augments Grimoire. Spells that match your current Arts will occasionally cast instantly, without recast. {id = 45, items = {16005, 17756, 17962, 18596, 18760, 19112, 19215, 19271, 19156}, matches = 2, matchType = matchtype.earring_weapon, mods = {{MOD_HP, 30, 0, 0}, {MOD_VIT, 6, 0, 0}, {MOD_ACC, 6, 0, 0}, {MOD_RACC, 6, 0, 0}} }, -- Paramount Earring Sets. Set Bonus: HP+30, VIT+6, Accuracy+6, Ranged Accuracy+6. Set Bonus is active with any 2 items(Earring+Weapon or Weapon+Weapon) {id = 45, items = {17756, 17962, 18596, 18760, 19112, 19215, 19271, 19156}, matches = 2, matchType = matchtype.weapon_weapon, mods = {{MOD_HP, 30, 0, 0}, {MOD_VIT, 6, 0, 0}, {MOD_ACC, 6, 0, 0}, {MOD_RACC, 6, 0, 0}} }, -- Paramount Earring Sets. Set Bonus: HP+30, VIT+6, Accuracy+6, Ranged Accuracy+6. Set Bonus is active with any 2 items(Earring+Weapon or Weapon+Weapon) {id = 49, items = {18761,18597,17757,19218,18128,18500,16004,18951}, matches = 2, matchType = matchtype.earring_weapon, mods = {{MOD_STR, 6, 0, 0}, {MOD_ATT, 4, 0, 0}, {MOD_RATT, 4, 0, 0}, {MOD_MATT, 2, 0, 0}} }, -- Supremacy Earring Sets. Set Bonus: STR+6, Attack+4, Ranged Attack+4, "Magic Atk. Bonus"+2. Active with any 2 items(Earring+Weapon) {id = 53, items = {16006,18450,18499,18861,18862,18952,19111,19217,19272}, matches = 2, matchType = matchtype.earring_weapon, mods = {{MOD_EVA, 10, 0, 0}, {MOD_HPHEAL, 10, 0, 0}, {MOD_ENMITY, -5, 0, 0}} }, -- Brilliant Earring Set. Set Bonus: Evasion, HP Recovered while healing, Reduces Emnity. Active with any 2 items(Earring+Weapon) {id = 56, items = {11798,11362}, matches = 2, matchType = matchtype.any, mods = {{MOD_RERAISE_III, 1, 0, 0}} }, -- Twilight Mail Set. Set Bonus: Auto-Reraise {id = 57, items = {18244,17595}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, -- Begin Jailer weapons: Set is weapon + Virtue stone, bonus 50% extra melee swing. {id = 58, items = {18244,17710}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, {id = 59, items = {18244,17948}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, {id = 60, items = {18244,18100}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, {id = 61, items = {18244,18222}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, {id = 62, items = {18244,18360}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, {id = 63, items = {18244,18397}, matches = 2, matchType = matchtype.any, mods = {{MOD_AMMO_SWING, 50, 0, 0}} }, -- End Jailer weapons {id = 71, items = {28520,28521}, matches = 2, matchType = matchtype.any, mods = {{MOD_DOUBLE_ATTACK, 7, 0, 0}} }, -- Bladeborn/Steelflash Earrings {id = 72, items = {28522,28523}, matches = 2, matchType = matchtype.any, mods = {{MOD_DUAL_WIELD, 7, 0, 0}} }, -- Dudgeon/Heartseeker Earrings {id = 73, items = {28524,28525}, matches = 2, matchType = matchtype.any, mods = {{MOD_MACC, 12, 0, 0}} }, -- Psystorm/Lifestorm Earrings {id = 74, items = {26920,26921,27434,27259,27260,26762,26763,27074,27075,27433}, matches = 2, matchType = matchtype.any, mods = {{MOD_ZANSHIN_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- Samurai 109/119 af3 {id = 75, items = {27414,27413,27240,27239,27055,27054,26901,26900,26743,26742}, matches = 2, matchType = matchtype.any, mods = {{MOD_EXTRA_KICK_ATTACK, extraAttackChance, 0, 0}} }, -- MNK 109/119 af3 {id = 76, items = {26740,26741,27411,27412,27238,27237,27053,27054,26899,26900}, matches = 2, matchType = matchtype.any, mods = {{MOD_DA_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- 109/119 WAR AF3 {id = 77, items = {26750,26751,27421,27422,27247,27248,27063,27062,26908,26909}, matches = 2, matchType = matchtype.any, mods = {{MOD_TA_TRIPLE_DAMAGE, extraDamageChance, 0, 0}} }, -- 109/119 THF AF3 {id = 78, items = {26918,26919,26761,26762,27431,27432,27257,27258,27072,27073}, matches = 2, matchType = matchtype.any, mods = {{MOD_RAPID_SHOT_DOUBLE_DAMAGE, extraDamageChance, 0, 0}} }, -- 109/119 RNG AF3 {id = 79, items = {26910,26911,26752,26753,27424,27423,27064,27065,27249,27250}, matches = 2, matchType = matchtype.any, mods = {{MOD_ABSORB_DMG_CHANCE, nullDamageChance, 0, 0}} }, -- 109/119 PLD AF3 {id = 80, items = {26922,26923,26764,26765,27076,27077,27261,27262,27435,27436}, matches = 2, matchType = matchtype.any, mods = {{MOD_EXTRA_DUAL_WIELD_ATTACK, extraAttackChance, 0, 0}} }, -- 109/119 NIN AF3 {id = 81, items = {27443,27444,26772,26773,26930,26931,27084,27085,27269,27270}, matches = 2, matchType = matchtype.any, mods = {{MOD_QUICK_DRAW_TRIPLE_DAMAGE, extraDamageChance, 0, 0}} }, -- 109/119 COR AF3 {id = 82, items = {27275,27276,27449,27450,26778,26779,26936,26937,27090,27091}, matches = 2, matchType = matchtype.any, mods = {{MOD_GRIMOIRE_INSTANT_CAST, instantCastChance, 0, 0}} }, -- 109/119 SCH AF3 {id = 83, items = {27241,27242,27415,27416,26744,26745,26902,26903,27056,27057}, matches = 2, matchType = matchtype.any, mods = {{MOD_BAR_ELEMENT_NULL_CHANCE, nullDamageChance, 0, 0}} }, -- 109/119 WHM AF3 {id = 84, items = {11867,10868,10865}, matches = 2, matchType = matchtype.any, mods = {{MOD_REFRESH, 3, 0, 0}} }, -- Heka's body + NQ or HQ Khat = 3 tick refresh {id = 85, items = {10868,11870,11864,10865}, matches = 2, matchType = matchtype.any, mods = {{MOD_REFRESH, 2, 0, 0}} }, -- Nefer body/head NQ/HQ combo gives Refresh +2 {id = 86, items = {15852,15853}, matches = 2, matchType = matchtype.any, mods = {{MOD_HP, 50, 0, 0},{MOD_MP, 50, 0, 0}} }, -- Dasra's/Nasatya's Ring set gives HP/MP +50 {id = 88, items = {16037,16038}, matches = 2, matchType = matchtype.any, mods = {{MOD_MATT, 5, 0, 0},{MOD_MACC, 5, 0, 0}} }, -- Helenus's/Cassandra's earring set: Mag atk bonus+5 and Mag acc +5 {id = 90, items = {15850,15851}, matches = 2, matchType = matchtype.any, mods = {{MOD_ATT, 6, 0, 0},{MOD_ACC, 12, 0, 0},{MOD_DEF, 6, 0, 0}} }, -- Lava's/Kusha's earring set: Atk+6/Acc+12 {id = 93, items = {16146,14588,15009,16315,15755}, matches = 2, matchType = matchtype.any, mods = {{MOD_FIRERES, 5, 5, 10},{MOD_ICERES, 5, 5, 10},{MOD_WINDRES, 5, 5, 10},{MOD_EARTHRES, 5, 5, 10},{MOD_THUNDERRES, 5, 5, 10},{MOD_WATERRES, 5, 5, 10},{MOD_LIGHTRES, 5, 5, 10},{MOD_DARKRES, 5, 5, 10}} }, -- Iron Ram Haubert Set {id = 101, items = {16035,16036}, matches = 2, matchType = matchtype.any, mods = {{MOD_AGI, 8, 0, 0}} } -- Altdorf's/Wilhelm's earring: AGI+8 } -- increment id by (number of mods in previous gearset - 1) -- {id, {item, ids, in, no, particular, order}, minimum matches required, match type, mods{id, value, modvalue for each additional match, additional whole set bonus} local HipsterSets = { -- stick the ids of sets that need their own handling here e.g. Rubeus {id = 34, hipster = true} } ------------------------------------------ -- Checks for gear sets present on a player ------------------------------------------- function checkForGearSet(player) -- print("---Removed existing gear set mods!---\n"); player:clearGearSetMods(); -- cause we dont want hundreds of function calls local equip = {}; for slot = 0, MAX_SLOTID do equip[slot+1] = player:getEquipID(slot); end for index, gearset in pairs(GearSets) do local matches = 0; if (player:hasGearSetMod(gearset.id) == false) then local slot = 0; local gearMatch = {}; for _, id in pairs(gearset.items) do for slot = 1, MAX_SLOTID do local equipId = equip[slot]; -- check the item matches if (equipId == id) then matches = matches + 1; gearMatch[slot] = equipId; break; end end; end -- doesnt count as a match if the same item is in both slots if (gearMatch[SLOT_EAR1+1] == gearMatch[SLOT_EAR2+1] and gearMatch[SLOT_EAR1+1] ~= nil) then matches = matches - 1; end; if (gearMatch[SLOT_RING1+1] == gearMatch[SLOT_RING2+1] and gearMatch[SLOT_RING1+1] ~= nil) then matches = matches - 1; end; if (gearMatch[SLOT_MAIN+1] == gearMatch[SLOT_SUB+1] and gearMatch[SLOT_MAIN+1] ~= nil) then matches = matches - 1; end; if (matches >= gearset.matches) then if (FindMatchByType(gearset, gearMatch) == true) then ApplyMod(player, gearset, matches) end end end end end; function FindMatchByType(gearset, gearMatch) if (gearset.matchType == matchtype.any) then return true; end for _, id in ipairs(gearMatch) do if (gearset.matchType == matchtype.earring_weapon and (gearMatch[SLOT_MAIN+1] ~= nil or gearMatch[SLOT_SUB+1] ~= nil) and (gearMatch[SLOT_EAR1+1] ~= nil or gearMatch[SLOT_EAR2+1] ~= nil)) then return true; elseif (gearset.matchType == matchtype.weapon_weapon and (gearMatch[SLOT_MAIN+1] ~= nil and gearMatch[SLOT_SUB+1] ~= nil)) then return true; end end return false; end; --------------------------------------- -- Applys a gear set mod --------------------------------------- function ApplyMod(player, gearset, matches) for _, set in pairs(HipsterSets) do if (set.id == gearset.id) then HandleHipsterSet(player, gearset, matches); return; end end -- find any additional matches local addMatches = matches - gearset.matches; -- just in case some d00d decides to custom shit up and complain the script is b0rked if (addMatches < 0) then printf("shitbag check your code | gearset: %u", gearset.id); return; end; local i = 0; for _, mod in pairs(gearset.mods) do local modId = mod[1]; local modValue = mod[2]; -- value/multiplier for additional pieces local addMatchValue = mod[3]; -- additional bonus for complete set local addSetBonus = 0; -- cause we need all pieces to form a complete set if (matches == #gearset.items) then addSetBonus = mod[4]; end; -- add bonus mods per piece if (addMatches ~= 0 and addMatchValue ~= 0) then modValue = modValue + (addMatchValue * addMatches); end -- printf("gearset: %u, mod: %u, value %u", gearset.id, modId, modValue + addSetBonus); player:addGearSetMod(gearset.id + i, modId, modValue + addSetBonus); i = i + 1; end -- print("Gear set! Mod applied: ModNameId:" .. modNameId .. " ModId:" .. modId .. " Value:" .. modValue .. "\n"); end; -- fkin hipsters function HandleHipsterSet(player, gearset, matches) -- Rubeus Armor Set if (gearset.id == 34) then local modValue = 0; if (matches > 1 and matches < 4) then modValue = 4; -- 2 or 3 pieces elseif (matches > 3) then modValue = 10; -- 4 or 5 pieces end; -- printf("we have a special snowflake | gearset: %u | mod %u %u", gearset.id, MOD_FASTCAST, modValue); player:addGearSetMod(gearset.id, MOD_FASTCAST, modValue); return; end end --[[ Unimplemented sets below ======= Stronghold NM(WOTG) ======= -- Molione's Sickle Set ------------- 18947 -- Molione's Sickle 15818 -- Molione's Ring -- Set Bonus: +5 Accuracy -- Set Bonus: Enhances "Souleater" Effect ======= Empyrean +2 ======= --Aoidos' Attire +2 Set ------------- 11073 -- Aoidos' Calot+2 11093 -- Aoidos' Hongreline +2 11113 -- Aoidos' Manchettes +2 11133 -- Aoidos' Rhingrave +2 11153 -- Aoidos' Cothurnes +2 -- Set Bonus: Augments Songs -- Enhancing songs add an attribute bonus that corresponds to the element of the song (i.e. Thunder-based songs add +DEX). The attribute bonus begins at +1 for 2 pieces, increases by 1 for each additional piece, up to +5 for the whole set. For Dark-based songs, there is a bonus of +10 MP for 2 pieces, and increases by 10 for each additional piece. --Ferine' Attire +2 Set ------------- 11072 -- Ferine Cabasset+2 11092 -- Ferine Gausape+2 11112 -- Ferine Manoplas+2 11132 -- Ferine Quijotes+2 11152 -- Ferine Ocreae+2 -- Set Bonus: Attack occ. varies with pet's HP -- Occasionally increases damage in direct proportion to the percentage of pet's current HP. At 100% HP, damage is doubled when triggered, at 50% HP, damage increases by 50%, and so on. -- 5% Proc Rate --Goetia Attire +2 Set ------------- 11067 -- Goetia Petasos+2 11087 -- Goetia Coat+2 11107 -- Goetia Gloves+2 11127 -- Goetia Chausses+2 11147 -- Goetia Sabots+2 -- Set Bonus: Augments "Conserve MP" -- Occasionally increases damage of elemental spells when Conserve MP is triggered. Increased amount is proportional to twice the ratio of MP conserved. --Mavi Attire +2 Set ------------- 11079 -- Mavi Kavuk+2 11099 -- Mavi Mintan+2 11119 -- Mavi Bazubands+2 11139 -- Mavi Tayt+2 11159 -- Mavi Basmak+2 -- Set Bonus: Occ. augments blue magic spells. -- no damn clue! --Bale Armor +2 Set ------------- 11071 -- Bale Burgeonet+2 11091 -- Bale Cuirass+2 11111 -- Bale Gauntlets+2 11131 -- Bale Flanchard+2 11151 -- Bale Sollerets+2 -- Set Bonus: Attack occasionally varies with HP -- Occasionally increases damage in direct proportion to the percentage of current HP. At 100% HP, damage is doubled when triggered, at 50% HP, damage increases by 50%, and so on. --Lancer's Armor +2 Set ------------- 11077 -- Lancer's Mezail+2 11097 -- Lancer's Plackart+2 11117 -- Lancer's Vambrace+2 11137 -- Lancer's Cuissots+2 11157 -- Lancer's Schynbalds+2 -- Set Bonus: Attack occasionally varies with wyvern's HP. -- Damage increases proportionate to Wyvern's HP, at 100%, damage is doubled. 2+ pieces required, more pieces increase proc rate. Full +2 set is about a 10% proc rate. (Confirmation needed) --Cirque Attire +2 Set ------------- 11081 -- Cirque Capello+2 11101 -- Cirque Farsetto+2 11121 -- Cirque Gaunti+2 11141 -- Cirque Pantaloni+2 11161 -- Cirque Scarpe+2 -- Set Bonus: Attack occasionally varies with automaton's HP. -- Occasionally increases damage in direct proportion to the percentage of Automaton's current HP. At 100% HP, damage is doubled when triggered, at 50% HP, damage increases by 50%, and so on. --Estoqueur's Attire +2 Set ------------- 11068 -- Estoqueur's Chappel+2 11088 -- Estoqueur's Sayon+2 11108 -- Estoqueur's Gantherots+2 11128 -- Estoqueur's Fuseau+2 11148 -- Estoqueur's Houseaux+2 -- Set Bonus: Augments "Composure" -- Enhances duration of Enhancing Magic cast on OTHERS while under the effect of Composure by 10% for the first 2 pieces, and 15% for any additional pieces thereafter, up to 35% increase for 4 pieces and 50% for all 5 pieces. The "Increases enhancing magic effect duration" of the Estoqueur's Cape, Estoqueur's Houseaux +1 and Estoqueur's Houseaux +2 is multiplicative to this total. --Caller's Attire +2 Set ------------- 11078 -- Caller's Horn+2 11098 -- Caller's Doublet+2 11118 -- Caller's Bracers+2 11138 -- Caller's Spats+2 11158 -- Caller's Pigaches+2 -- Set Bonus: Augments "Blood Boon" -- Occasionally increases damage of Blood Pacts when Blood Boon is triggered. Increased amount is proportional to the ratio of MP conserved. ]]--
gpl-3.0
Turttle/darkstar
scripts/zones/Windurst_Waters_[S]/npcs/Cattah_Pamjah.lua
38
1050
----------------------------------- -- Area: Windurst Waters (S) -- NPC: Cattah Pamjah -- Type: Title Changer -- @zone: 94 -- @pos -13.564 -2 10.673 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0089); 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
c9596126.lua
5
2678
--カオス・ソーサラー function c9596126.initial_effect(c) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(9596126,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c9596126.spcon) e1:SetOperation(c9596126.spop) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(9596126,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetCost(c9596126.rmcost) e2:SetTarget(c9596126.rmtg) e2:SetOperation(c9596126.rmop) c:RegisterEffect(e2) end function c9596126.spfilter(c,att) return c:IsAttribute(att) and c:IsAbleToRemoveAsCost() end function c9596126.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c9596126.spfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_LIGHT) and Duel.IsExistingMatchingCard(c9596126.spfilter,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_DARK) end function c9596126.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g1=Duel.SelectMatchingCard(tp,c9596126.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_LIGHT) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g2=Duel.SelectMatchingCard(tp,c9596126.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_DARK) g1:Merge(g2) Duel.Remove(g1,POS_FACEUP,REASON_COST) end function c9596126.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e:GetHandler():RegisterEffect(e1,true) end function c9596126.tgfilter(c) return c:IsFaceup() and c:IsAbleToRemove() end function c9596126.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and c9596126.tgfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c9596126.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,c9596126.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c9596126.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
gpl-2.0
fgenesis/Aquaria_experimental
game_scripts/scripts/maps/node_miasecretend.lua
1
3207
-- 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 v.bone_body = 0 v.match = false v.mia = 0 v.n = 0 function init(me) v.n = getNaija() end function update(me, dt) if v.match then -- float with if v.bone_body == 0 then v.bone_body = entity_getBoneByName(v.mia, "Body") end local bx, by = bone_getWorldPosition(v.bone_body) entity_setPosition(v.n, entity_x(v.n), by) end if not v.done and node_isEntityIn(me, getNaija()) then if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end v.done = true local cam = getNode("cam") local cam2 = getNode("cam2") local naija2 = getNode("naija2") entity_idle(v.n) changeForm(FORM_NORMAL) watch(0.5) entity_idle(v.n) fade2(1, 0.5) watch(0.5) overrideZoom(0.9) -- do the secret ending! local thir = createEntity("13_progression") v.mia = createEntity("mia") entity_offset(thir, 0, 40) entity_warpToNode(v.n, getNode("naija")) entity_warpToNode(thir, getNode("mia")) entity_warpToNode(v.mia, getNode("mia")) entity_flipToEntity(v.mia, v.n) entity_flipToEntity(thir, v.n) entity_flipToEntity(v.n, v.mia) entity_alpha(v.mia, 0) fadeIn(1) fade2(0, 1, 0, 0, 0) watch(1) watch(1) watch(0.5) --cam_toEntity(v.mia) cam_toNode(cam) watch(0.5) playSfx("spirit-beacon") spawnParticleEffect("SpiritBeacon", entity_x(v.mia), entity_y(v.mia)) fade2(1,0.2,1,1,1) watch(0.2) fade2(0,0.2,1,1,1) watch(0.2) playSfx("mia-appear") entity_alpha(thir, 0.1, 3) entity_alpha(v.mia, 1, 3) watch(2.8) fade2(1,0.2,1,1,1) watch(0.2) fade2(0,0.8,1,1,1) entity_setPosition(thir, 0, 0) voice("mia-and-naija") watch(22) --22 fade2(1, 0.5) --cam_toNode(cam) watch(0.5) entity_setPosition(v.n, node_x(naija2), node_y(naija2)) overrideZoom(1.2) entity_animate(v.mia, "hug", -1, 1) entity_animate(v.n, "hugLi", -1, 3) v.match = true cam_toNode(cam2) watch(0.5) --23 fade2(0, 0.5) watch(1) --24 watch(7) -- 31 "I..." watch(1) -- 32 "I killed him.." watch(2) -- 34 "but he was just a little boy" -- 33 watch(27) -- 01:00 watch(60+12) -- (02:14) fade(1, 4) watchForVoice() fade2(1, 1, 1, 1, 1) watch(1) --goToTitle() loadMap("lucien") end end
gpl-2.0
dickeyf/darkstar
scripts/globals/weaponskills/sturmwind.lua
11
1526
----------------------------------- -- Sturmwind -- Great Axe weapon skill -- Skill level: 70 -- Delivers a two-hit attack. Attack varies with TP. -- Will stack with Sneak Attack, but only the first hit. -- Aligned with the Soil Gorget & Aqua Gorget. -- Aligned with the Soil Belt & Aqua Belt. -- Element: None -- Modifiers: STR:60% -- 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 = 2; params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1; params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.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 is supposed to vary with TP, however it is unknown what the multiplier is so I am going to leave it at 1. http://www.bg-wiki.com/bg/Sturmwind params.atkmulti = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.6; end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, primary); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
mimetic/DIG-corona-library
examples/slideviewer+textrender+accordion/scripts/accordian/examples/scripts/textrender/entities.lua
4
7515
-- convert numeric html entities to utf8 -- converts from stdin to stdout -- example: &#8364; -> € -- from http://www.hpelbers.org/lua/utf8 --- Functions for dealing with HTML/XML entities. local M = {} local char = string.char local function tail(n, k) local u, r='' for i=1,k do n,r = math.floor(n/0x40), n%0x40 u = char(r+0x80) .. u end return u, n end local function to_utf8(a) if not a then return nil end local n, r, u = tonumber(a) if n<0x80 then -- 1 byte return char(n) elseif n<0x800 then -- 2 byte u, n = tail(n, 1) return char(n+0xc0) .. u elseif n<0x10000 then -- 3 byte u, n = tail(n, 2) return char(n+0xe0) .. u elseif n<0x200000 then -- 4 byte u, n = tail(n, 3) return char(n+0xf0) .. u elseif n<0x4000000 then -- 5 byte u, n = tail(n, 4) return char(n+0xf8) .. u else -- 6 byte u, n = tail(n, 5) return char(n+0xfc) .. u end end local character_entities = { ["quot"] = 0x0022, ["amp"] = 0x0026, ["apos"] = 0x0027, ["lt"] = 0x003C, ["gt"] = 0x003E, ["nbsp"] = 160, ["iexcl"] = 0x00A1, ["cent"] = 0x00A2, ["pound"] = 0x00A3, ["curren"] = 0x00A4, ["yen"] = 0x00A5, ["brvbar"] = 0x00A6, ["sect"] = 0x00A7, ["uml"] = 0x00A8, ["copy"] = 0x00A9, ["ordf"] = 0x00AA, ["laquo"] = 0x00AB, ["not"] = 0x00AC, ["shy"] = 173, ["reg"] = 0x00AE, ["macr"] = 0x00AF, ["deg"] = 0x00B0, ["plusmn"] = 0x00B1, ["sup2"] = 0x00B2, ["sup3"] = 0x00B3, ["acute"] = 0x00B4, ["micro"] = 0x00B5, ["para"] = 0x00B6, ["middot"] = 0x00B7, ["cedil"] = 0x00B8, ["sup1"] = 0x00B9, ["ordm"] = 0x00BA, ["raquo"] = 0x00BB, ["frac14"] = 0x00BC, ["frac12"] = 0x00BD, ["frac34"] = 0x00BE, ["iquest"] = 0x00BF, ["Agrave"] = 0x00C0, ["Aacute"] = 0x00C1, ["Acirc"] = 0x00C2, ["Atilde"] = 0x00C3, ["Auml"] = 0x00C4, ["Aring"] = 0x00C5, ["AElig"] = 0x00C6, ["Ccedil"] = 0x00C7, ["Egrave"] = 0x00C8, ["Eacute"] = 0x00C9, ["Ecirc"] = 0x00CA, ["Euml"] = 0x00CB, ["Igrave"] = 0x00CC, ["Iacute"] = 0x00CD, ["Icirc"] = 0x00CE, ["Iuml"] = 0x00CF, ["ETH"] = 0x00D0, ["Ntilde"] = 0x00D1, ["Ograve"] = 0x00D2, ["Oacute"] = 0x00D3, ["Ocirc"] = 0x00D4, ["Otilde"] = 0x00D5, ["Ouml"] = 0x00D6, ["times"] = 0x00D7, ["Oslash"] = 0x00D8, ["Ugrave"] = 0x00D9, ["Uacute"] = 0x00DA, ["Ucirc"] = 0x00DB, ["Uuml"] = 0x00DC, ["Yacute"] = 0x00DD, ["THORN"] = 0x00DE, ["szlig"] = 0x00DF, ["agrave"] = 0x00E0, ["aacute"] = 0x00E1, ["acirc"] = 0x00E2, ["atilde"] = 0x00E3, ["auml"] = 0x00E4, ["aring"] = 0x00E5, ["aelig"] = 0x00E6, ["ccedil"] = 0x00E7, ["egrave"] = 0x00E8, ["eacute"] = 0x00E9, ["ecirc"] = 0x00EA, ["euml"] = 0x00EB, ["igrave"] = 0x00EC, ["iacute"] = 0x00ED, ["icirc"] = 0x00EE, ["iuml"] = 0x00EF, ["eth"] = 0x00F0, ["ntilde"] = 0x00F1, ["ograve"] = 0x00F2, ["oacute"] = 0x00F3, ["ocirc"] = 0x00F4, ["otilde"] = 0x00F5, ["ouml"] = 0x00F6, ["divide"] = 0x00F7, ["oslash"] = 0x00F8, ["ugrave"] = 0x00F9, ["uacute"] = 0x00FA, ["ucirc"] = 0x00FB, ["uuml"] = 0x00FC, ["yacute"] = 0x00FD, ["thorn"] = 0x00FE, ["yuml"] = 0x00FF, ["OElig"] = 0x0152, ["oelig"] = 0x0153, ["Scaron"] = 0x0160, ["scaron"] = 0x0161, ["Yuml"] = 0x0178, ["fnof"] = 0x0192, ["circ"] = 0x02C6, ["tilde"] = 0x02DC, ["Alpha"] = 0x0391, ["Beta"] = 0x0392, ["Gamma"] = 0x0393, ["Delta"] = 0x0394, ["Epsilon"] = 0x0395, ["Zeta"] = 0x0396, ["Eta"] = 0x0397, ["Theta"] = 0x0398, ["Iota"] = 0x0399, ["Kappa"] = 0x039A, ["Lambda"] = 0x039B, ["Mu"] = 0x039C, ["Nu"] = 0x039D, ["Xi"] = 0x039E, ["Omicron"] = 0x039F, ["Pi"] = 0x03A0, ["Rho"] = 0x03A1, ["Sigma"] = 0x03A3, ["Tau"] = 0x03A4, ["Upsilon"] = 0x03A5, ["Phi"] = 0x03A6, ["Chi"] = 0x03A7, ["Psi"] = 0x03A8, ["Omega"] = 0x03A9, ["alpha"] = 0x03B1, ["beta"] = 0x03B2, ["gamma"] = 0x03B3, ["delta"] = 0x03B4, ["epsilon"] = 0x03B5, ["zeta"] = 0x03B6, ["eta"] = 0x03B7, ["theta"] = 0x03B8, ["iota"] = 0x03B9, ["kappa"] = 0x03BA, ["lambda"] = 0x03BB, ["mu"] = 0x03BC, ["nu"] = 0x03BD, ["xi"] = 0x03BE, ["omicron"] = 0x03BF, ["pi"] = 0x03C0, ["rho"] = 0x03C1, ["sigmaf"] = 0x03C2, ["sigma"] = 0x03C3, ["tau"] = 0x03C4, ["upsilon"] = 0x03C5, ["phi"] = 0x03C6, ["chi"] = 0x03C7, ["psi"] = 0x03C8, ["omega"] = 0x03C9, ["thetasym"] = 0x03D1, ["upsih"] = 0x03D2, ["piv"] = 0x03D6, ["ensp"] = 0x2002, ["emsp"] = 0x2003, ["thinsp"] = 0x2009, ["ndash"] = 0x2013, ["mdash"] = 0x2014, ["lsquo"] = 0x2018, ["rsquo"] = 0x2019, ["sbquo"] = 0x201A, ["ldquo"] = 0x201C, ["rdquo"] = 0x201D, ["bdquo"] = 0x201E, ["dagger"] = 0x2020, ["Dagger"] = 0x2021, ["bull"] = 0x2022, ["hellip"] = 0x2026, ["permil"] = 0x2030, ["prime"] = 0x2032, ["Prime"] = 0x2033, ["lsaquo"] = 0x2039, ["rsaquo"] = 0x203A, ["oline"] = 0x203E, ["frasl"] = 0x2044, ["euro"] = 0x20AC, ["image"] = 0x2111, ["weierp"] = 0x2118, ["real"] = 0x211C, ["trade"] = 0x2122, ["alefsym"] = 0x2135, ["larr"] = 0x2190, ["uarr"] = 0x2191, ["rarr"] = 0x2192, ["darr"] = 0x2193, ["harr"] = 0x2194, ["crarr"] = 0x21B5, ["lArr"] = 0x21D0, ["uArr"] = 0x21D1, ["rArr"] = 0x21D2, ["dArr"] = 0x21D3, ["hArr"] = 0x21D4, ["forall"] = 0x2200, ["part"] = 0x2202, ["exist"] = 0x2203, ["empty"] = 0x2205, ["nabla"] = 0x2207, ["isin"] = 0x2208, ["notin"] = 0x2209, ["ni"] = 0x220B, ["prod"] = 0x220F, ["sum"] = 0x2211, ["minus"] = 0x2212, ["lowast"] = 0x2217, ["radic"] = 0x221A, ["prop"] = 0x221D, ["infin"] = 0x221E, ["ang"] = 0x2220, ["and"] = 0x2227, ["or"] = 0x2228, ["cap"] = 0x2229, ["cup"] = 0x222A, ["int"] = 0x222B, ["there4"] = 0x2234, ["sim"] = 0x223C, ["cong"] = 0x2245, ["asymp"] = 0x2248, ["ne"] = 0x2260, ["equiv"] = 0x2261, ["le"] = 0x2264, ["ge"] = 0x2265, ["sub"] = 0x2282, ["sup"] = 0x2283, ["nsub"] = 0x2284, ["sube"] = 0x2286, ["supe"] = 0x2287, ["oplus"] = 0x2295, ["otimes"] = 0x2297, ["perp"] = 0x22A5, ["sdot"] = 0x22C5, ["lceil"] = 0x2308, ["rceil"] = 0x2309, ["lfloor"] = 0x230A, ["rfloor"] = 0x230B, ["lang"] = 0x27E8, ["rang"] = 0x27E9, ["loz"] = 0x25CA, ["spades"] = 0x2660, ["clubs"] = 0x2663, ["hearts"] = 0x2665, ["diams"] = 0x2666, } --- Given a string of decimal digits, returns a UTF-8 encoded -- string encoding a unicode character. function M.dec_entity(s) local out = string.gsub(s, '&#(%d+);', to_utf8) return out end --- Given a character entity name (like `ouml`), returns a UTF-8 encoded -- string encoding a unicode character. -- NOT WORKING: REQUIRES UNICODE. --[[function M.char_entity(s) local i = s:match('&(%a+);') local n = character_entities[i] local s if (n) then s = char(n) end return s end --]] function M.convert(s) if (s) then return M.dec_entity(s) else return s end end -- UNUSED -- Find the entity, get the character, OR return NIL --[[ local function get_character_entity(s) local c = character_entities[s] print ("C",c) if ( c ) then return char(c) end return nil end --]] local gsub, char = string.gsub, string.char local entitySwap = function(orig,n,s) local ss = to_utf8(tonumber(character_entities[s])) --print ("entitySwap: orig,n,s,ss",orig,ss,n,s) return ss or n=="#" and to_utf8(s) or orig end function M.unescape(str) return gsub( str, '(&(#?)([%d%a]+);)', entitySwap ) end --&amp;#039; return M
mit
SalvationDevelopment/Salvation-Scripts-TCG
c55410871.lua
2
1529
--ブルーアイズ・カオス・MAX・ドラゴン function c55410871.initial_effect(c) c:EnableReviveLimit() --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.ritlimit) c:RegisterEffect(e1) --cannot target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --indes local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetValue(c55410871.indval) c:RegisterEffect(e3) --pierce local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_PIERCE) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e5:SetCode(EVENT_PRE_BATTLE_DAMAGE) e5:SetCondition(c55410871.damcon) e5:SetOperation(c55410871.damop) c:RegisterEffect(e5) end function c55410871.indval(e,re,tp) return tp~=e:GetHandlerPlayer() end function c55410871.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return ep~=tp and c==Duel.GetAttacker() and Duel.GetAttackTarget() and Duel.GetAttackTarget():IsDefensePos() end function c55410871.damop(e,tp,eg,ep,ev,re,r,rp) Duel.ChangeBattleDamage(ep,ev*2) end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c85893201.lua
2
1523
--連鎖誘爆 function c85893201.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(85893201,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCondition(c85893201.descon) e2:SetTarget(c85893201.destg) e2:SetOperation(c85893201.desop) c:RegisterEffect(e2) end function c85893201.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_EFFECT) and c:GetPreviousControler()==tp end function c85893201.descon(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and eg:IsExists(c85893201.cfilter,1,nil,1-tp) end function c85893201.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return e:GetHandler():IsRelateToEffect(e) and Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c85893201.desop(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.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
dabo123148/WarlightMod
WiningConditions/Client_SaveConfigureUI.lua
1
2918
function Client_SaveConfigureUI(alert) Alert = alert; Mod.Settings.Conditionsrequiredforwin = inputConditionsrequiredforwin.GetValue(); InRange(Mod.Settings.Conditionsrequiredforwin); TakenSettings = 0; Mod.Settings.Capturedterritories = inputCapturedterritories.GetValue(); InRange(Mod.Settings.Capturedterritories); Mod.Settings.Lostterritories = inputLostterritories.GetValue(); InRange(Mod.Settings.Lostterritories); Mod.Settings.Ownedterritories = inputOwnedterritories.GetValue(); InRange(Mod.Settings.Ownedterritories); Mod.Settings.Capturedbonuses = inputCapturedbonuses.GetValue(); InRange(Mod.Settings.Capturedbonuses); Mod.Settings.Lostbonuses = inputLostbonuses.GetValue(); InRange(Mod.Settings.Lostbonuses); Mod.Settings.Ownedbonuses = inputOwnedbonuses.GetValue(); InRange(Mod.Settings.Ownedbonuses); Mod.Settings.Killedarmies = inputKilledarmies.GetValue(); InRange(Mod.Settings.Killedarmies); Mod.Settings.Lostarmies = inputLostarmies.GetValue(); InRange(Mod.Settings.Lostarmies); Mod.Settings.Ownedarmies = inputOwnedarmies.GetValue(); InRange(Mod.Settings.Ownedarmies); Mod.Settings.Eleminateais = inputEleminateais.GetValue(); InRange(Mod.Settings.Eleminateais); Mod.Settings.Eleminateplayers = inputEleminateplayers.GetValue(); InRange(Mod.Settings.Eleminateplayers); Mod.Settings.Eleminateaisandplayers = inputEleminateaisandplayers.GetValue(); InRange(Mod.Settings.Eleminateaisandplayers); Mod.Settings.terrcondition = {}; local num = 1; for _,terrcondition in pairs(inputterrcondition)do if(terrcondition.Terrname ~= nil and terrcondition.Terrname.GetText() ~= "")then Mod.Settings.terrcondition[num] = {}; Mod.Settings.terrcondition[num].Terrname = terrcondition.Terrname.GetText(); Mod.Settings.terrcondition[num].Turnnum = terrcondition.Turnnum.GetValue(); if(Mod.Settings.terrcondition[num].Turnnum>10)then alert("The number of turns per territory can't be higher than 10 to prevent the game from stucking"); end if(Mod.Settings.terrcondition[num].Turnnum<0)then alert("Numbers can't be negative"); end TakenSettings = TakenSettings + 1; num = num + 1; end end if(Mod.Settings.Eleminateaisandplayers > 39 or Mod.Settings.Eleminateplayers > 39 or Mod.Settings.Eleminateais > 39)then alert("this many players can't be in a game"); end if(TakenSettings < Mod.Settings.Conditionsrequiredforwin)then alert("there are more conditions required to win than conditions set"); end if(Mod.Settings.Conditionsrequiredforwin == 0)then alert("You need at least one wining condition"); end end function InRange(setting) if(setting>100000)then Alert("Numbers can't be higher then 100000"); end if(setting<0)then Alert("Numbers can't be negative"); end if(setting ~= 0 and TakenSettings ~= nil)then TakenSettings = TakenSettings + 1; end end
mit
Metastruct/pac3
lua/pac3/editor/client/panels/mat_browser.lua
3
20118
pace.Materials = {} pace.Materials.materials = { "models/weapons/v_crowbar/crowbar_cyl", "models/weapons/v_crowbar/head_uvw", "models/weapons/v_bugbait/bugbait_sheet", "models/combine_advisor/arm", "models/combine_advisor/hose", "models/combine_advisor/face5", "models/combine_advisor/body9", "models/barnacle/barnacle_sheet", "models/headcrab_black/blackcrab_sheet", "models/headcrab/allinonebacup2", "models/headcrab_classic/headcrabsheet", "models/stalker/stalker_sheet", "models/zombie_poison/poisonzombie_sheet", "models/zombie_fast/fast_zombie_sheet", "models/gunship/gunshipsheet", "models/shield_scanner/minelayer_sheet", "models/roller/rollermine_sheet", "models/dog/dog_sheet", "models/gibs/combine_helicopter_gibs/combine_helicopter01", "models/synth/mainbody", "models/combine_room/combine_monitor001", "models/items/combinerifle_ammo", "models/shadertest/shader2", "models/props_combine/combine_train001", "models/props_combine/combinethumper001", "models/props_combine/health_charger001", "models/props_combine/masterinterface01", "models/props_combine/introomarea_sheet", "models/props_combine/combine_bunker01", "models/props_combine/weaponstripper_sheet", "models/props_combine/tpcontroller_sheet", "models/props_combine/combine_tower01a", "models/combine_mine/combine_mine03", "models/magnusson_teleporter/magnusson_teleporter", "models/combine_strider/strider_brain", "models/combine_advisor_pod/combine_advisor_pod", "models/magnusson_device/magnusson_device_basecolor", "models/antlion_grub/antlion_grub", "models/antlion/antlion_worker_wing", "models/antlion/antlion_worker", "models/ministrider/mini_skin_basecolor", "models/ministrider/mini_armor_basecolor", "models/spitball/spitball", "models/mossman/mossman_hair", "models/alyx/hairbits", "models/brokenglass/glassbroken_piece1", "models/props_halloween/flask", "models/props_halloween/flask_liquid", "models/props_halloween/flask_glass", "models/props_halloween/pumpkin", "models/props_mining/dustbowl_roof01", "models/props_mvm/mvm_museum_coal", "models/effects/partyhat", "models/props_gameplay/ball001", "models/props_gameplay/orange_cone001", "models/player/items/soldier/dappertopper", "models/weapons/c_items/c_candy_cane_red", "models/props_halloween/halloween_blk", "models/props_halloween/halloween_demoeye_glass_2", "models/props_halloween/halloween_demoeye_glass", "models/weapons/c_items/c_saxxy", "models/props_halloween/scary_ghost", "models/weapons/c_items/c_urinejar_urine", "models/weapons/c_items/c_xms_cold_shoulder", "models/props_wasteland/rockcliff02c", "models/props_lakeside/flat_wall_02", "models/props_manor/table_01b", "models/props_manor/volume_light_01", "models/props_medieval/stone_base001", "models/props_medieval/fort_wall", "models/props_mining/quarryrock02", "models/props_nature/rock_worn001", "models/props_swamp/tallgrass_01", "models/props_swamp/shrub_03", "models/props_viaduct_event/fog_plane03", "models/weapons/v_baseball/baseball_sheet", "hunter/myplastic", "models/player/items/all_class/all_class_ring_diamond", "models/effects/invulnfx_blue", "models/effects/invulnfx_red", "models/effects/goldenwrench", "models/effects/cappoint_beam_neutral", "models/effects/cappoint_beam_blue", "models/effects/cappoint_beam_red", "models/effects/medicyell", "models/effects/pyro/pilotlight", "models/effects/pyro/pilotlight_cloak", "models/effects/pyro/pilotlight_motion", "models/effects/invulnerability/invulnerability_red", "models/effects/invulnerability/invulnerability_blue", "models/effects/muzzleflash/blurmuzzle", "models/effects/muzzleflash/brightmuzzle", "models/lilchewchew/embers", "models/pl_hoodoo/metaldoor001", "models/thundermountain_fx/ibeam002_vert", "models/thundermountain_fx/wall025_vert", "models/thundermountain_fx/wood_beam03_vert", "models/thundermountain_fx/wood_bridge001_vert", "models/thundermountain_fx/wood_wall002_vert", "models/shadertest/envball_1", "models/shadertest/envball_2", "models/shadertest/envball_3", "models/shadertest/envball_4", "models/shadertest/envball_5", "models/shadertest/envball_6", "models/shadertest/glassbrick", "models/shadertest/point_camera", "models/shadertest/shader1", "models/shadertest/shader1_dudv", "models/shadertest/shield", "models/shadertest/unlitgenericmodel", "models/shadertest/vertexlitalphatestedtexture", "models/ihvtest/arm", "models/ihvtest/boot", "models/ihvtest/eyeball_l", -- zpankr's material list -- http://www.garrysmod.org/downloads/?a=view&id=18470 "models/wireframe", "debug/env_cubemap_model", "models/shadertest/shader3", "models/shadertest/shader4", "models/shadertest/shader5", "models/shiny", "models/debug/debugwhite", "Models/effects/comball_sphere", "Models/effects/comball_tape", "Models/effects/splodearc_sheet", "Models/effects/vol_light001", "models/props_combine/stasisshield_sheet", "models/props_combine/portalball001_sheet", "models/props_combine/com_shield001a", "models/props_c17/frostedglass_01a", "models/props_lab/Tank_Glass001", "models/props_combine/tprings_globe", "models/rendertarget", "models/screenspace", "brick/brick_model", "models/props_pipes/GutterMetal01a", "models/props_pipes/Pipesystem01a_skin3", "models/props_wasteland/wood_fence01a", "models/props_c17/FurnitureFabric003a", "models/props_c17/FurnitureMetal001a", "models/props_c17/paper01", "models/flesh", "models/airboat/airboat_blur02", "models/alyx/emptool_glow", "models/antlion/antlion_innards", "models/barnacle/roots", "models/combine_advisor/body9", "models/combine_advisor/mask", "models/combine_scanner/scanner_eye", "models/debug/debugwhite", "models/dog/eyeglass", "models/effects/comball_glow1", "models/effects/comball_glow2", "models/effects/portalrift_sheet", "models/effects/slimebubble_sheet", "models/effects/splode1_sheet", "models/effects/splodearc_sheet", "models/effects/splode_sheet", "models/effects/vol_light001", "models/gibs/woodgibs/woodgibs01", "models/gibs/woodgibs/woodgibs02", "models/gibs/woodgibs/woodgibs03", "models/gibs/metalgibs/metal_gibs", "models/items/boxsniperrounds", "models/player/player_chrome1", "models/props_animated_breakable/smokestack/brickwall002a", "models/props_building_details/courtyard_template001c_bars", "models/props_building_details/courtyard_template001c_bars", "models/props_buildings/destroyedbuilldingwall01a", "models/props_buildings/plasterwall021a", "models/props_c17/frostedglass_01a", "models/props_c17/furniturefabric001a", "models/props_c17/furniturefabric002a", "models/props_c17/furnituremetal001a", "models/props_c17/gate_door02a", "models/props_c17/metalladder001", "models/props_c17/metalladder002", "models/props_c17/metalladder003", "models/props_canal/canalmap_sheet", "models/props_canal/canal_bridge_railing_01a", "models/props_canal/canal_bridge_railing_01b", "models/props_canal/canal_bridge_railing_01c", "models/props_canal/coastmap_sheet", "models/props_canal/metalcrate001d", "models/props_canal/metalwall005b", "models/props_canal/rock_riverbed01a", "models/props_combine/citadel_cable", "models/props_combine/combine_interface_disp", "models/props_combine/combine_monitorbay_disp", "models/props_combine/com_shield001a", "models/props_combine/health_charger_glass", "models/props_combine/metal_combinebridge001", "models/props_combine/pipes01", "models/props_combine/pipes03", "models/props_combine/prtl_sky_sheet", "models/props_combine/stasisfield_beam", "models/props_debris/building_template010a", "models/props_debris/building_template022j", "models/props_debris/composite_debris", "models/props_debris/concretefloor013a", "models/props_debris/concretefloor020a", "models/props_debris/concretewall019a", "models/props_debris/metalwall001a", "models/props_debris/plasterceiling008a", "models/props_debris/plasterwall009d", "models/props_debris/plasterwall021a", "models/props_debris/plasterwall034a", "models/props_debris/plasterwall034d", "models/props_debris/plasterwall039c", "models/props_debris/plasterwall040c", "models/props_debris/tilefloor001c", "models/props_foliage/driftwood_01a", "models/props_foliage/oak_tree01", "models/props_interiors/metalfence007a", "models/props_junk/plasticcrate01a", "models/props_junk/plasticcrate01b", "models/props_junk/plasticcrate01c", "models/props_junk/plasticcrate01d", "models/props_junk/plasticcrate01e", "models/props_lab/cornerunit_cloud", "models/props_lab/door_klab01", "models/props_lab/security_screens", "models/props_lab/security_screens2", "models/props_lab/Tank_Glass001", "models/props_lab/warp_sheet", "models/props_lab/xencrystal_sheet", "models/props_pipes/destroyedpipes01a", "models/props_pipes/GutterMetal01a", "models/props_pipes/pipeset_metal02", "models/props_pipes/pipesystem01a_skin1", "models/props_pipes/pipesystem01a_skin2", "models/props_vents/borealis_vent001", "models/props_vents/borealis_vent001b", "models/props_vents/borealis_vent001c", "models/props_wasteland/concretefloor010a", "models/props_wasteland/concretewall064b", "models/props_wasteland/concretewall066a", "models/props_wasteland/dirtwall001a", "models/props_wasteland/metal_tram001a", "models/props_wasteland/quarryobjects01", "models/props_wasteland/rockcliff02a", "models/props_wasteland/rockcliff02b", "models/props_wasteland/rockcliff02c", "models/props_wasteland/rockcliff04a", "models/props_wasteland/rockgranite02a", "models/props_wasteland/tugboat01", "models/props_wasteland/tugboat02", "models/props_wasteland/wood_fence01a", "models/props_wasteland/wood_fence01a_skin2", "models/roller/rollermine_glow", "models/weapons/v_crossbow/rebar_glow", "models/weapons/v_crowbar/crowbar_cyl", "models/weapons/v_grenade/grenade body", "models/weapons/v_smg1/texture5", "models/weapons/w_smg1/smg_crosshair", "models/weapons/v_slam/new light2", "models/weapons/v_slam/new light1", "models/props/cs_assault/dollar", "models/props/cs_assault/fireescapefloor", "models/props/cs_assault/metal_stairs1", "models/props/cs_assault/moneywrap", "models/props/cs_assault/moneywrap02", "models/props/cs_assault/moneytop", "models/props/cs_assault/pylon", "models/props/CS_militia/boulder01", "models/props/CS_militia/milceil001", "models/props/CS_militia/militiarock", "models/props/CS_militia/militiarockb", "models/props/CS_militia/milwall006", "models/props/CS_militia/rocks01", "models/props/CS_militia/roofbeams01", "models/props/CS_militia/roofbeams02", "models/props/CS_militia/roofbeams03", "models/props/CS_militia/RoofEdges", "models/props/cs_office/clouds", "models/props/cs_office/file_cabinet2", "models/props/cs_office/file_cabinet3", "models/props/cs_office/screen", "models/props/cs_office/snowmana", "models/props/de_inferno/de_inferno_boulder_03", "models/props/de_inferno/infflra", "models/props/de_inferno/infflrd", "models/props/de_inferno/inftowertop", "models/props/de_inferno/offwndwb_break", "models/props/de_inferno/roofbits", "models/props/de_inferno/tileroof01", "models/props/de_inferno/woodfloor008a", "models/props/de_nuke/nukconcretewalla", "models/props/de_nuke/nukecardboard", "models/props/de_nuke/pipeset_metal", "models/shadertest/predator", } pace.Materials.trails = { "trails/plasma", "trails/tube", "trails/electric", "trails/smoke", "trails/laser", "trails/physbeam", "trails/love", "trails/lol", "sprites/rollermine_shock_yellow", "sprites/yellowlaser1", "particle/beam_smoke_01", "particle/beam_smoke_02", "particle/bendibeam_nofog", "sprites/physbeam", "sprites/physbeama", "sprites/rollermine_shock", "sprites/hydraspinalcord", "particle/Particle_Square_Gradient", "particle/Particle_Square_Gradient_NoFog", } pace.Materials.sprites = { "sprites/glow04_noz", "sprites/grip", "sprites/key_0", "sprites/key_1", "sprites/key_10", "sprites/key_11", "sprites/key_12", "sprites/key_13", "sprites/key_14", "sprites/key_15", "sprites/key_2", "sprites/key_3", "sprites/key_4", "sprites/key_5", "sprites/key_6", "sprites/key_7", "sprites/key_8", "sprites/key_9", "sprites/light_ignorez", "sprites/muzzleflash4", "sprites/orangecore1", "sprites/orangecore2", "sprites/orangeflare1", "sprites/physg_glow1", "sprites/physg_glow2", "sprites/physgbeamb", "sprites/redglow1", "sprites/animglow02", "sprites/ar2_muzzle1", "sprites/ar2_muzzle3", "sprites/ar2_muzzle4", "sprites/arrow", "sprites/blueglow2", "sprites/bluelaser1", "sprites/dot", "sprites/flamelet1", "sprites/flamelet2", "sprites/flamelet3", "sprites/flamelet4", "sprites/flamelet5", "sprites/heatwave", "sprites/heatwavedx70", "sprites/hydragutbeam", "sprites/hydragutbeamcap", "sprites/light_glow02_add", "sprites/light_glow02_add_noz", "sprites/plasmaember", "sprites/predator", "sprites/qi_center", "sprites/reticle", "sprites/reticle1", "sprites/reticle2", "sprites/rico1", "sprites/rico1_noz", "sprites/scanner", "sprites/scanner_bottom", "sprites/scanner_dots1", "sprites/scanner_dots2", "sprites/strider_blackball", "sprites/strider_bluebeam", "sprites/tp_beam001", "sprites/bucket_bat_blue", "sprites/bucket_bat_red", "sprites/bucket_bonesaw", "sprites/bucket_bottle_blue", "sprites/bucket_bottle_red", "sprites/bucket_fireaxe", "sprites/bucket_fists_blue", "sprites/bucket_fists_red", "sprites/bucket_flamethrower_blue", "sprites/bucket_flamethrower_red", "sprites/bucket_grenlaunch", "sprites/bucket_knife", "sprites/bucket_machete", "sprites/bucket_medigun_blue", "sprites/bucket_medigun_red", "sprites/bucket_minigun", "sprites/bucket_nailgun", "sprites/bucket_pda", "sprites/bucket_pda_build", "sprites/bucket_pda_destroy", "sprites/bucket_pipelaunch", "sprites/bucket_pistol", "sprites/bucket_revolver", "sprites/bucket_rl", "sprites/bucket_sapper", "sprites/bucket_scatgun", "sprites/bucket_shotgun", "sprites/bucket_shovel", "sprites/bucket_smg", "sprites/bucket_sniper", "sprites/bucket_syrgun_blue", "sprites/bucket_syrgun_red", "sprites/bucket_tranq", "sprites/bucket_wrench", "sprites/healbeam", "sprites/healbeam_blue", "sprites/healbeam_red", "sprites/640_pain_down", "sprites/640_pain_left", "sprites/640_pain_right", "sprites/640_pain_up", "sprites/bomb_carried", "sprites/bomb_carried_ring", "sprites/bomb_carried_ring_offscreen", "sprites/bomb_dropped", "sprites/bomb_dropped_ring", "sprites/bomb_planted", "sprites/bomb_planted_ring", "sprites/c4", "sprites/defuser", "sprites/hostage_following", "sprites/hostage_following_offscreen", "sprites/hostage_rescue", "sprites/numbers", "sprites/objective_rescue", "sprites/objective_site_a", "sprites/objective_site_b", "sprites/player_blue_dead", "sprites/player_blue_dead_offscreen", "sprites/player_blue_offscreen", "sprites/player_blue_self", "sprites/player_blue_small", "sprites/player_hostage_dead", "sprites/player_hostage_dead_offscreen", "sprites/player_hostage_offscreen", "sprites/player_hostage_small", "sprites/player_radio_ring", "sprites/player_radio_ring_offscreen", "sprites/player_red_dead", "sprites/player_red_dead_offscreen", "sprites/player_red_offscreen", "sprites/player_red_self", "sprites/player_red_small", "sprites/player_tick", "sprites/radar", "sprites/radar_trans", "sprites/radio", "sprites/scope_arc", "sprites/shopping_cart", "sprites/spectator_3rdcam", "sprites/spectator_eye", "sprites/spectator_freecam", "sprites/cloudglow1_nofog", "sprites/core_beam1", "sprites/bluelight", "sprites/grav_flare", "sprites/grav_light", "sprites/orangelight", "sprites/portalgun_effects", "sprites/sphere_silhouette", "sprites/redglow_mp1", "sprites/sent_ball", "particle/fire", "particle/particle_composite", "particle/Particle_Crescent", "particle/Particle_Crescent_Additive", "particle/Particle_Glow_02", "particle/Particle_Glow_03", "particle/Particle_Glow_03_Additive", "particle/Particle_Glow_04", "particle/Particle_Glow_04_Additive", "particle/Particle_Glow_05", "particle/particle_noisesphere", "particle/Particle_Ring_Blur", "particle/particle_ring_refract_01", "particle/Particle_Ring_Sharp", "particle/Particle_Ring_Sharp_Additive", "particle/Particle_Ring_Wave_8", "particle/Particle_Ring_Wave_8_15OB_NoFog", "particle/Particle_Ring_Wave_Additive", "particle/Particle_Ring_Wave_AddNoFog", "particle/particle_smokegrenade", "particle/particle_smokegrenade1", "particle/particle_sphere", "particle/rain", "particle/smokesprites_0001", "particle/smokesprites_0002", "particle/smokesprites_0003", "particle/smokesprites_0004", "particle/smokesprites_0005", "particle/smokesprites_0006", "particle/smokesprites_0007", "particle/smokesprites_0008", "particle/smokesprites_0009", "particle/smokesprites_0010", "particle/smokesprites_0011", "particle/smokesprites_0012", "particle/smokesprites_0013", "particle/smokesprites_0014", "particle/smokesprites_0015", "particle/smokesprites_0016", "particle/SmokeStack", "particle/snow", "particle/sparkles", "particle/warp1_warp", "particle/warp2_warp", "particle/warp3_warp_NoZ", "particle/warp4_warp", "particle/warp4_warp_NoZ", "particle/warp5_warp", "particle/warp_ripple", "particle/glow_haze_nofog", "particle/smoke_black_smokestack000", "particle/smoke_black_smokestack001", "particle/smoke_black_smokestack_all", "particle/smokestack_nofog", "particle/particle_rockettrail2", "particles/balloon_bit", "particles/fire1", "particles/fire_glow", "particles/flamelet1", "particles/flamelet2", "particles/flamelet3", "particles/flamelet4", "particles/flamelet5", "particles/smokey", } local PANEL = {} PANEL.ClassName = "mat_browser_sheet" PANEL.Base = "DPanel" AccessorFunc(PANEL, "m_Selected", "Selected") function PANEL:Init() local list = vgui.Create("DPanelList", self) list:SetPadding(2) list:SetSpacing(2) list:EnableVerticalScrollbar(true) list:EnableHorizontal(true) list:Dock(FILL) self.MatList = list end function PANEL:Paint(w, h) surface.SetDrawColor(0,0,0, 255) surface.DrawRect(0, 0, w, h) end local cache = {} local function IsError(path) if cache[path] then return true end if Material(path):IsError() then cache[path] = truer return true end end function PANEL:SetMaterialList(tbl) self:SetSelected() self.MaterialList = tbl self.MatList:Clear(true) for i, material in pairs(self.MaterialList) do -- if IsError(material) then continue end local image = vgui.Create("DImageButton") image.m_Image.LoadMaterial = function(s) s:DoLoadMaterial() end image:SetOnViewMaterial(material, material) image:SetSize(64, 64) image.Value = material self.MatList:AddItem(image) image.DoClick = function(image) self:SetSelected(image.Value) end if self:GetSelected() then image.PaintOver = HighlightedButtonPaint self:SetSelected(material) end end self:InvalidateLayout(true) end pace.RegisterPanel(PANEL) local PANEL = {} PANEL.Base = "DFrame" PANEL.ClassName = "mat_browser" function PANEL:Init() self:SetTitle("materials") local list = { {key = "default", val = table.Merge(list.Get("OverrideMaterials"), pace.Materials.materials)}, {key = "sprites", val = pace.Materials.sprites}, {key = "trails", val = pace.Materials.trails}, } local sheet = vgui.Create("DPropertySheet", self) sheet:Dock(FILL) for _, data in pairs(list) do local name, tbl = data.key, data.val local pnl = pace.CreatePanel("mat_browser_sheet", self) pnl:SetMaterialList(tbl) pnl.SetSelected = function(_, path) self:SetSelected(path) end sheet:AddSheet(name, pnl) end local entry = vgui.Create("DTextEntry", self) entry.OnEnter = function() self:SetSelected(self.Entry:GetValue()) end entry:Dock(BOTTOM) entry:SetTall(20) self.Entry = entry self:SetDrawOnTop(true) self:SetSize(300, 300) self:SetSizable(true) self:Center() end function PANEL:SetSelected(value) self.Entry:SetText(value or "") self.m_Selected = value self:MaterialSelected(value) end function PANEL:MaterialSelected(path) end pace.RegisterPanel(PANEL)
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c95169481.lua
6
1601
--恐牙狼 ダイヤウルフ function c95169481.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,nil,4,2) c:EnableReviveLimit() --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(95169481,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(c95169481.descost) e1:SetTarget(c95169481.destg) e1:SetOperation(c95169481.desop) c:RegisterEffect(e1) end function c95169481.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function c95169481.desfilter(c) return c:IsFaceup() and c:IsRace(RACE_BEAST+RACE_WINDBEAST+RACE_BEASTWARRIOR) and Duel.IsExistingTarget(aux.TRUE,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end function c95169481.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c95169481.desfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectTarget(tp,c95169481.desfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst()) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,g1:GetCount(),0,0) end function c95169481.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) Duel.Destroy(g,REASON_EFFECT) end
gpl-2.0
Turttle/darkstar
scripts/globals/weaponskills/ukkos_fury.lua
30
1805
----------------------------------- -- Ukko's Fury -- Great Axe Weapon Skill -- Skill Level: N/A -- Description: Delivers a twofold attack that slows target. Chance of params.critical hit varies with TP. Ukonvasara: Aftermath. -- Available only when equipped with Ukonvasara (85), Ukonvasara (90), Ukonvasara (95), Maschu +1, Maschu +2. -- Aligned with the Light Gorget, Breeze Gorget & Thunder Gorget. -- Aligned with the Light Belt, Breeze Belt & Thunder Belt. -- Element: None -- Skillchain Properties: Light/Fragmentation -- Modifiers: STR:80% -- Damage Multipliers by TP: -- 100%TP 200%TP 300%TP -- 2.0 2.0 2.0 -- params.critical Chance added with TP: -- 100%TP 200%TP 300%TP -- 20% 35% 55% ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 2; params.ftp100 = 2; params.ftp200 = 2; params.ftp300 = 2; params.str_wsc = 0.6; 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.20; params.crit200 = 0.35; params.crit300 = 0.55; params.canCrit = true; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.8; end if damage > 0 and (target:hasStatusEffect(EFFECT_SLOW) == false) then target:addStatusEffect(EFFECT_SLOW, 150, 0, 60); end damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
dickeyf/darkstar
scripts/zones/Misareaux_Coast/npcs/HomePoint#1.lua
18
1271
----------------------------------- -- Area: Misareaux Coast -- NPC: HomePoint#1 -- @pos -65 -17.5 563 25 ----------------------------------- package.loaded["scripts/zones/Misareaux_Coast/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Misareaux_Coast/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fd, 25); 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 == 0x21fd) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c37781520.lua
3
3580
--水精鱗-リードアビス function c37781520.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(37781520,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(c37781520.spcost) e1:SetTarget(c37781520.sptg) e1:SetOperation(c37781520.spop) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(37781520,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(c37781520.thcon) e2:SetTarget(c37781520.thtg) e2:SetOperation(c37781520.thop) c:RegisterEffect(e2) --handes local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(37781520,2)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,37781520) e3:SetCost(c37781520.hdcost) e3:SetTarget(c37781520.hdtg) e3:SetOperation(c37781520.hdop) c:RegisterEffect(e3) end function c37781520.cfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsDiscardable() and c:IsAbleToGraveAsCost() end function c37781520.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c37781520.cfilter,tp,LOCATION_HAND,0,3,e:GetHandler()) end Duel.DiscardHand(tp,c37781520.cfilter,3,3,REASON_COST+REASON_DISCARD,e:GetHandler()) end function c37781520.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c37781520.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP) end function c37781520.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1 end function c37781520.thfilter(c) return c:IsSetCard(0x75) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsAbleToHand() end function c37781520.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c37781520.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c37781520.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,c37781520.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c37781520.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end function c37781520.costfilter(c) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsSetCard(0x74) end function c37781520.hdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroup(tp,c37781520.costfilter,1,e:GetHandler()) end local sg=Duel.SelectReleaseGroup(tp,c37781520.costfilter,1,1,e:GetHandler()) Duel.Release(sg,REASON_COST) end function c37781520.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)~=0 end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_HAND) end function c37781520.hdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(1-tp,LOCATION_HAND,0) if g:GetCount()==0 then return end local sg=g:RandomSelect(1-tp,1) Duel.SendtoGrave(sg,REASON_EFFECT) end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c91754175.lua
2
1537
--犬タウルス function c91754175.initial_effect(c) --atk up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(91754175,0)) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(c91754175.condition) e1:SetTarget(c91754175.target) e1:SetOperation(c91754175.operation) c:RegisterEffect(e1) end function c91754175.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetBattleTarget() end function c91754175.tgfilter(c) return c:IsRace(RACE_BEAST+RACE_BEASTWARRIOR+RACE_WINDBEAST) and c:IsAbleToGrave() end function c91754175.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c91754175.tgfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND+LOCATION_DECK) end function c91754175.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c91754175.tgfilter,tp,LOCATION_HAND+LOCATION_DECK,0,1,1,nil) local c=e:GetHandler() local tc=g:GetFirst() if tc and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) and c:IsRelateToBattle() and c:IsFaceup() then local lv=tc:GetLevel() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(lv*100) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_BATTLE) c:RegisterEffect(e1) end end
gpl-2.0
huwpascoe/OpenRA
mods/ra/maps/allies-05a/allies05a-AI.lua
34
6702
IdlingUnits = { } AttackGroupSize = 6 Barracks = { Barracks2, Barracks3 } Rallypoints = { VehicleRallypoint1, VehicleRallypoint2, VehicleRallypoint3, VehicleRallypoint4, VehicleRallypoint5 } WaterLZs = { WaterLZ1, WaterLZ2 } Airfields = { Airfield1, Airfield2 } Yaks = { } SovietInfantryTypes = { "e1", "e1", "e2", "e4" } SovietVehicleTypes = { "3tnk", "3tnk", "3tnk", "v2rl", "v2rl", "apc" } SovietAircraftType = { "yak" } HoldProduction = true BuildVehicles = true TrainInfantry = true IdleHunt = function(unit) if not unit.IsDead then Trigger.OnIdle(unit, unit.Hunt) end end SetupAttackGroup = function() local units = { } for i = 0, AttackGroupSize, 1 do if #IdlingUnits == 0 then return units end local number = Utils.RandomInteger(1, #IdlingUnits) if IdlingUnits[number] and not IdlingUnits[number].IsDead then units[i] = IdlingUnits[number] table.remove(IdlingUnits, number) end end return units end SendAttack = function() if Attacking then return end Attacking = true HoldProduction = true local units = { } if SendWaterTransports and Utils.RandomInteger(0,2) == 1 then units = WaterAttack() Utils.Do(units, function(unit) Trigger.OnAddedToWorld(unit, function() Trigger.OnIdle(unit, unit.Hunt) end) end) Trigger.AfterDelay(DateTime.Seconds(20), function() Attacking = false HoldProduction = false end) else units = SetupAttackGroup() Utils.Do(units, function(unit) IdleHunt(unit) end) Trigger.AfterDelay(DateTime.Minutes(1), function() Attacking = false end) Trigger.AfterDelay(DateTime.Minutes(2), function() HoldProduction = false end) end end WaterAttack = function() local types = { } for i = 1, 5, 1 do types[i] = Utils.Random(SovietInfantryTypes) end return Reinforcements.ReinforceWithTransport(ussr, InsertionTransport, types, { WaterTransportSpawn.Location, Utils.Random(WaterLZs).Location }, { WaterTransportSpawn.Location })[2] end ProtectHarvester = function(unit) Trigger.OnDamaged(unit, function(self, attacker) -- TODO: Send the Harvester to the service depo if AttackOnGoing then return end AttackOnGoing = true local Guards = SetupAttackGroup() Utils.Do(Guards, function(unit) if not self.IsDead then unit.AttackMove(self.Location) end IdleHunt(unit) end) Trigger.OnAllRemovedFromWorld(Guards, function() AttackOnGoing = false end) end) Trigger.OnKilled(unit, function() HarvesterKilled = true end) end InitAIUnits = function() IdlingUnits = Map.ActorsInBox(MainBaseTopLeft.CenterPosition, Map.BottomRight, function(self) return self.Owner == ussr and self.HasProperty("Hunt") end) local buildings = Map.ActorsInBox(MainBaseTopLeft.CenterPosition, Map.BottomRight, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end) Utils.Do(buildings, function(actor) Trigger.OnDamaged(actor, function(building) if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then building.StartBuildingRepairs() end end) end) end InitAIEconomy = function() ussr.Cash = 6000 if not Harvester.IsDead then Harvester.FindResources() ProtectHarvester(Harvester) end end InitProductionBuildings = function() if not Warfactory2.IsDead then Warfactory2.IsPrimaryBuilding = true Trigger.OnKilled(Warfactory2, function() BuildVehicles = false end) else BuildVehicles = false end if not Barracks2.IsDead then Barracks2.IsPrimaryBuilding = true Trigger.OnKilled(Barracks2, function() if not Barracks3.IsDead then Barracks3.IsPrimaryBuilding = true else TrainInfantry = false end end) elseif not Barracks3.IsDead then Barracks3.IsPrimaryBuilding = true else TrainInfantry = false end if not Barracks3.IsDead then Trigger.OnKilled(Barracks3, function() if Barracks2.IsDead then TrainInfantry = false end end) end if Map.Difficulty ~= "Easy" then if not Airfield1.IsDead then Trigger.OnKilled(Airfield1, function() if Airfield2.IsDead then AirAttacks = false else Airfield2.IsPrimaryBuilding = true Trigger.OnKilled(Airfield2, function() AirAttacks = false end) end end) Airfield1.IsPrimaryBuilding = true AirAttacks = true elseif not Airfield2.IsDead then Trigger.OnKilled(Airfield2, function() AirAttacks = false end) Airfield2.IsPrimaryBuilding = true AirAttacks = true end end end ProduceInfantry = function() if not TrainInfantry then return end if HoldProduction then Trigger.AfterDelay(DateTime.Minutes(1), ProduceInfantry) return end local delay = Utils.RandomInteger(DateTime.Seconds(3), DateTime.Seconds(9)) local toBuild = { Utils.Random(SovietInfantryTypes) } ussr.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] Trigger.AfterDelay(delay, ProduceInfantry) if #IdlingUnits >= (AttackGroupSize * 2.5) then SendAttack() end end) end ProduceVehicles = function() if not BuildVehicles then return end if HoldProduction then Trigger.AfterDelay(DateTime.Minutes(1), ProduceVehicles) return end local delay = Utils.RandomInteger(DateTime.Seconds(5), DateTime.Seconds(9)) if HarvesterKilled then HarvesterKilled = false ussr.Build({ "harv" }, function(harv) harv[1].FindResources() ProtectHarvester(harv[1]) Trigger.AfterDelay(delay, ProduceVehicles) end) return end Warfactory2.RallyPoint = Utils.Random(Rallypoints).Location local toBuild = { Utils.Random(SovietVehicleTypes) } ussr.Build(toBuild, function(unit) IdlingUnits[#IdlingUnits + 1] = unit[1] Trigger.AfterDelay(delay, ProduceVehicles) if #IdlingUnits >= (AttackGroupSize * 2.5) then SendAttack() end end) end ProduceAircraft = function() if not AirAttacks then return end ussr.Build(SovietAircraftType, function(units) Yaks[#Yaks + 1] = units[1] if #Yaks == 2 then Trigger.OnKilled(units[1], ProduceAircraft) else Trigger.AfterDelay(DateTime.Minutes(1), ProduceAircraft) end local target = nil Trigger.OnIdle(units[1], function() if not target or target.IsDead or (not target.IsInWorld) then local enemies = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == greece and self.HasProperty("Health") end) if #enemies > 0 then target = Utils.Random(enemies) units[1].Attack(target) end else units[1].Attack(target) end end) end) end ActivateAI = function() InitAIUnits() InitAIEconomy() InitProductionBuildings() Trigger.AfterDelay(DateTime.Minutes(5), function() ProduceInfantry() ProduceVehicles() if AirAttacks then Trigger.AfterDelay(DateTime.Minutes(3), ProduceAircraft) end end) end
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c17032740.lua
2
5660
--E・HERO カオス・ネオス function c17032740.initial_effect(c) --fusion material c:EnableReviveLimit() aux.AddFusionProcCode3(c,89943723,43237273,17732278,false,false) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(c17032740.splimit) c:RegisterEffect(e1) --special summon rule local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_EXTRA) e2:SetCondition(c17032740.spcon) e2:SetOperation(c17032740.spop) c:RegisterEffect(e2) --return local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(17032740,0)) e3:SetCategory(CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(c17032740.retcon1) e3:SetTarget(c17032740.rettg) e3:SetOperation(c17032740.retop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(0) e4:SetCondition(c17032740.retcon2) c:RegisterEffect(e4) --coin local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(17032740,1)) e5:SetCategory(CATEGORY_COIN+CATEGORY_DESTROY+CATEGORY_TOHAND) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1) e5:SetCondition(c17032740.coincon) e5:SetTarget(c17032740.cointg) e5:SetOperation(c17032740.coinop) c:RegisterEffect(e5) end c17032740.material_setcode=0x8 function c17032740.splimit(e,se,sp,st) return not e:GetHandler():IsLocation(LOCATION_EXTRA) end function c17032740.spfilter(c,code1,code2,code3) return c:IsAbleToDeckOrExtraAsCost() and (c:IsFusionCode(code1) or c:IsFusionCode(code2) or c:IsFusionCode(code3)) end function c17032740.spfilter1(c,mg,ft) local mg2=mg:Clone() mg2:RemoveCard(c) if c:IsLocation(LOCATION_MZONE) then ft=ft+1 end return ft>=-1 and c:IsFusionCode(89943723) and c:IsAbleToDeckOrExtraAsCost() and c:IsCanBeFusionMaterial() and mg2:IsExists(c17032740.spfilter2,1,nil,mg2,ft) end function c17032740.spfilter2(c,mg,ft) local mg2=mg:Clone() mg2:RemoveCard(c) if c:IsLocation(LOCATION_MZONE) then ft=ft+1 end return ft>=0 and c:IsFusionCode(43237273) and c:IsAbleToDeckOrExtraAsCost() and c:IsCanBeFusionMaterial() and mg2:IsExists(c17032740.spfilter3,1,nil,ft) end function c17032740.spfilter3(c,ft) if c:IsLocation(LOCATION_MZONE) then ft=ft+1 end return ft>=1 and c:IsFusionCode(17732278) and c:IsAbleToDeckOrExtraAsCost() and c:IsCanBeFusionMaterial() end function c17032740.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<-2 then return false end local mg=Duel.GetMatchingGroup(c17032740.spfilter,tp,LOCATION_ONFIELD,0,nil,89943723,43237273,17732278) return mg:IsExists(c17032740.spfilter1,1,nil,mg,ft) end function c17032740.spop(e,tp,eg,ep,ev,re,r,rp,c) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local mg=Duel.GetMatchingGroup(c17032740.spfilter,tp,LOCATION_ONFIELD,0,nil,89943723,43237273,17732278) local g=Group.CreateGroup() local tc=nil for i=1,3 do Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) if i==1 then tc=mg:FilterSelect(tp,c17032740.spfilter1,1,1,nil,mg,ft):GetFirst() end if i==2 then tc=mg:FilterSelect(tp,c17032740.spfilter2,1,1,nil,mg,ft):GetFirst() end if i==3 then tc=mg:FilterSelect(tp,c17032740.spfilter3,1,1,nil,ft):GetFirst() end g:AddCard(tc) mg:RemoveCard(tc) if tc:IsLocation(LOCATION_MZONE) then ft=ft+1 end end local cg=g:Filter(Card.IsFacedown,nil) if cg:GetCount()>0 then Duel.ConfirmCards(1-tp,cg) end Duel.SendtoDeck(g,nil,2,REASON_COST) end function c17032740.retcon1(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsHasEffect(42015635) end function c17032740.retcon2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsHasEffect(42015635) end function c17032740.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToExtra() end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) end function c17032740.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end Duel.SendtoDeck(c,nil,2,REASON_EFFECT) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE) end function c17032740.coincon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()==PHASE_MAIN1 end function c17032740.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,3) end function c17032740.coinop(e,tp,eg,ep,ev,re,r,rp) local c1,c2,c3=Duel.TossCoin(tp,3) if c1+c2+c3==3 then local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) elseif c1+c2+c3==2 then local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) local c=e:GetHandler() local tc=g:GetFirst() while tc do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e2) tc=g:GetNext() end elseif c1+c2+c3==1 then local g=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,LOCATION_MZONE,0,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c47457347.lua
2
2059
--魔法名-「大いなる獣」 function c47457347.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetTarget(c47457347.target) e1:SetOperation(c47457347.activate) c:RegisterEffect(e1) end function c47457347.filter(c,e,tp) return c:IsFaceup() and c:IsSetCard(0xf4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c47457347.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and c47457347.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c47457347.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if Duel.IsPlayerAffectedByEffect(tp,59822133) then ft=1 end local g=Duel.GetMatchingGroup(c47457347.filter,tp,LOCATION_REMOVED,0,nil,e,tp):Filter(Card.IsCanBeEffectTarget,nil,e) local tg=Group.CreateGroup() repeat Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) tg:Merge(sg) g:Remove(Card.IsCode,nil,sg:GetFirst():GetCode()) ft=ft-1 until g:GetCount()==0 or ft==0 or not Duel.SelectYesNo(tp,aux.Stringid(47457347,0)) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,tg:GetCount(),0,0) end function c47457347.activate(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) if ft<=0 or g:GetCount()==0 or (g:GetCount()>1 and Duel.IsPlayerAffectedByEffect(tp,59822133)) then return end if g:GetCount()<=ft then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,ft,ft,nil) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENSE) g:Sub(sg) Duel.SendtoGrave(g,REASON_RULE) end end
gpl-2.0
Turttle/darkstar
scripts/zones/Port_San_dOria/npcs/Leonora.lua
17
1498
----------------------------------- -- Area: Port San d'Oria -- NPC: Leonora -- Involved in Quest: -- @zone 232 -- @pos -24 -8 15 ----------------------------------- package.loaded["scripts/zones/Port_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); 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) if (player:getZPos() >= 12) then player:startEvent(0x0206); 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/zones/Hazhalm_Testing_Grounds/Zone.lua
28
1351
----------------------------------- -- -- Zone: Hazhalm_Testing_Grounds (78) -- ----------------------------------- package.loaded["scripts/zones/Hazhalm_Testing_Grounds/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Hazhalm_Testing_Grounds/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(652.174,-272.632,-104.92,148); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c93379652.lua
6
2120
--ジェムナイト・プリズムオーラ function c93379652.initial_effect(c) --fusion material c:EnableReviveLimit() aux.AddFusionProcFun2(c,aux.FilterBoolFunction(Card.IsFusionSetCard,0x1047),aux.FilterBoolFunction(Card.IsRace,RACE_THUNDER),true) --spsummon condition local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) e2:SetValue(c93379652.splimit) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(93379652,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCost(c93379652.cost) e3:SetTarget(c93379652.target) e3:SetOperation(c93379652.operation) c:RegisterEffect(e3) end function c93379652.splimit(e,se,sp,st) return not e:GetHandler():IsLocation(LOCATION_EXTRA) or bit.band(st,SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION end function c93379652.costfilter(c) return c:IsSetCard(0x1047) and c:IsAbleToGraveAsCost() end function c93379652.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c93379652.costfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,c93379652.costfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function c93379652.filter(c) return c:IsFaceup() end function c93379652.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and c93379652.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c93379652.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c93379652.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c93379652.operation(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
dickeyf/darkstar
scripts/zones/Port_Jeuno/npcs/Sugandhi.lua
13
1545
----------------------------------- -- Area: Port Bastok -- NPC: Sugandhi -- Standard Merchant NPC ----------------------------------- require("scripts/globals/shop"); package.loaded["scripts/zones/Port_Bastok/TextIDs"] = nil; require("scripts/zones/Port_Bastok/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,SUGANDHI_SHOP_DIALOG); stock = {0x4059,5589,1, -- Kukri 0x40A1,21067,1, -- Broadsword 0x4081,11588,1, -- Tuck 0x40AE,61200,1, -- Falchion 0x4052,2181,2, -- Knife 0x4099,30960,2, -- Mythril Sword 0x40A8,4072,2, -- Scimitar 0x4051,147,3, -- Bronze Knife 0x4015,104,3, -- Cat Baghnakhs 0x4097,241,3, -- Bronze Sword 0x4098,7128,3, -- Iron Sword 0x4085,9201,3, -- Degen 0x40A7,698,3} -- Sapara showNationShop(player, BASTOK, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
Death15/Mega-Tauch
plugins/meme.lua
637
5791
local helpers = require "OAuth.helpers" local _file_memes = './data/memes.lua' local _cache = {} local function post_petition(url, arguments) local response_body = {} local request_constructor = { url = url, method = "POST", sink = ltn12.sink.table(response_body), headers = {}, redirect = false } local source = arguments if type(arguments) == "table" then local source = helpers.url_encode_arguments(arguments) end request_constructor.headers["Content-Type"] = "application/x-www-form-urlencoded" request_constructor.headers["Content-Length"] = tostring(#source) request_constructor.source = ltn12.source.string(source) local ok, response_code, response_headers, response_status_line = http.request(request_constructor) if not ok then return nil end response_body = json:decode(table.concat(response_body)) return response_body end local function upload_memes(memes) local base = "http://hastebin.com/" local pet = post_petition(base .. "documents", memes) if pet == nil then return '', '' end local key = pet.key return base .. key, base .. 'raw/' .. key end local function analyze_meme_list() local function get_m(res, n) local r = "<option.*>(.*)</option>.*" local start = string.find(res, "<option.*>", n) if start == nil then return nil, nil end local final = string.find(res, "</option>", n) + #"</option>" local sub = string.sub(res, start, final) local f = string.match(sub, r) return f, final end local res, code = http.request('http://apimeme.com/') local r = "<option.*>(.*)</option>.*" local n = 0 local f, n = get_m(res, n) local ult = {} while f ~= nil do print(f) table.insert(ult, f) f, n = get_m(res, n) end return ult end local function get_memes() local memes = analyze_meme_list() return { last_time = os.time(), memes = memes } end local function load_data() local data = load_from_file(_file_memes) if not next(data) or data.memes == {} or os.time() - data.last_time > 86400 then data = get_memes() -- Upload only if changed? link, rawlink = upload_memes(table.concat(data.memes, '\n')) data.link = link data.rawlink = rawlink serialize_to_file(data, _file_memes) end return data end local function match_n_word(list1, list2) local n = 0 for k,v in pairs(list1) do for k2, v2 in pairs(list2) do if v2:find(v) then n = n + 1 end end end return n end local function match_meme(name) local _memes = load_data() local name = name:lower():split(' ') local max = 0 local id = nil for k,v in pairs(_memes.memes) do local n = match_n_word(name, v:lower():split(' ')) if n > 0 and n > max then max = n id = v end end return id end local function generate_meme(id, textup, textdown) local base = "http://apimeme.com/meme" local arguments = { meme=id, top=textup, bottom=textdown } return base .. "?" .. helpers.url_encode_arguments(arguments) end local function get_all_memes_names() local _memes = load_data() local text = 'Last time: ' .. _memes.last_time .. '\n-----------\n' for k, v in pairs(_memes.memes) do text = text .. '- ' .. v .. '\n' end text = text .. '--------------\n' .. 'You can see the images here: http://apimeme.com/' return text end local function callback_send(cb_extra, success, data) if success == 0 then send_msg(cb_extra.receiver, "Something wrong happened, probably that meme had been removed from server: " .. cb_extra.url, ok_cb, false) end end local function run(msg, matches) local receiver = get_receiver(msg) if matches[1] == 'list' then local _memes = load_data() return 'I have ' .. #_memes.memes .. ' meme names.\nCheck this link to see all :)\n' .. _memes.link elseif matches[1] == 'listall' then if not is_sudo(msg) then return "You can't list this way, use \"!meme list\"" else return get_all_memes_names() end elseif matches[1] == "search" then local meme_id = match_meme(matches[2]) if meme_id == nil then return "I can't match that search with any meme." end return "With that search your meme is " .. meme_id end local searchterm = string.gsub(matches[1]:lower(), ' ', '') local meme_id = _cache[searchterm] or match_meme(matches[1]) if not meme_id then return 'I don\'t understand the meme name "' .. matches[1] .. '"' end _cache[searchterm] = meme_id print("Generating meme: " .. meme_id .. " with texts " .. matches[2] .. ' and ' .. matches[3]) local url_gen = generate_meme(meme_id, matches[2], matches[3]) send_photo_from_url(receiver, url_gen, callback_send, {receiver=receiver, url=url_gen}) return nil end return { description = "Generate a meme image with up and bottom texts.", usage = { "!meme search (name): Return the name of the meme that match.", "!meme list: Return the link where you can see the memes.", "!meme listall: Return the list of all memes. Only admin can call it.", '!meme [name] - [text_up] - [text_down]: Generate a meme with the picture that match with that name with the texts provided.', '!meme [name] "[text_up]" "[text_down]": Generate a meme with the picture that match with that name with the texts provided.', }, patterns = { "^!meme (search) (.+)$", '^!meme (list)$', '^!meme (listall)$', '^!meme (.+) "(.*)" "(.*)"$', '^!meme "(.+)" "(.*)" "(.*)"$', "^!meme (.+) %- (.*) %- (.*)$" }, run = run }
gpl-2.0
dabo123148/WarlightMod
SimpleDiploMod/Client_PresentSettingsUI.lua
1
6447
function Client_PresentSettingsUI(rootParent) root = rootParent; UI.CreateLabel(rootParent).SetText('AI Settings'); CreateLine('AIs are allowed to declare war on player : ', Mod.Settings.AllowAIDeclaration,true,true); CreateLine('AIs are allowed to declare war on AIs : ', Mod.Settings.AIsdeclearAIs,true,true); UI.CreateLabel(rootParent).SetText(' '); UI.CreateLabel(rootParent).SetText('Tradement System'); if(Mod.Settings.StartMoney ~= 0 or Mod.Settings.MoneyPerTurn ~= 0 or Mod.Settings.MoneyPerKilledArmy ~= 0 or Mod.Settings.MoneyPerCapturedTerritory ~= 0 or Mod.Settings.MoneyPerCapturedBonus ~= 0)then CreateLine('Player starting money : ', Mod.Settings.StartMoney,100,false); CreateLine('Extra money per turn : ', Mod.Settings.MoneyPerTurn,5,false); CreateLine('Extra money per killed army : ', Mod.Settings.MoneyPerKilledArmy,1,false); CreateLine('Extra money per captured territory : ', Mod.Settings.MoneyPerCapturedTerritory,5,false); CreateLine('Extra money per captured bonus(disabled(see discription)) : ', Mod.Settings.MoneyPerCapturedBonus,10,false); CreateLine('Price per army : ', Mod.Settings.MoneyPerBoughtArmy,2,false); else UI.CreateLabel(rootParent).SetText('The Trading System has been disabled').SetColor('#FF0000'); end UI.CreateLabel(rootParent).SetText(' '); UI.CreateLabel(rootParent).SetText('Card Settings'); UI.CreateLabel(rootParent).SetText('Sanction Card'); if(AlwaysPlayable(Mod.Settings.SanctionCardRequireWar,Mod.Settings.SanctionCardRequirePeace,Mod.Settings.SanctionCardRequireAlly))then UI.CreateLabel(rootParent).SetText('You can play a Sanction Card on everybody').SetColor('#FF0000'); else if(NeverPlayable(Mod.Settings.SanctionCardRequireWar,Mod.Settings.SanctionCardRequirePeace,Mod.Settings.SanctionCardRequireAlly))then UI.CreateLabel(rootParent).SetText('Sanction Cards are unplayable').SetColor('#FF0000'); else CreateLine('Sanction Cards can be played on players you are in war with : ', Mod.Settings.SanctionCardRequireWar,true,false); CreateLine('Sanction Cards can be played on players you are in peace with : ', Mod.Settings.SanctionCardRequirePeace,false,false); CreateLine('Sanction Cards can be played on players you are allied with : ', Mod.Settings.SanctionCardRequireAlly,false,false); end end UI.CreateLabel(rootParent).SetText('Bomb Card'); if(AlwaysPlayable(Mod.Settings.BombCardRequireWar,Mod.Settings.BombCardRequirePeace,Mod.Settings.BombCardRequireAlly))then UI.CreateLabel(rootParent).SetText('You can play a Bomb Card on everybody').SetColor('#FF0000'); else if(NeverPlayable(Mod.Settings.BombCardRequireWar,Mod.Settings.BombCardRequirePeace,Mod.Settings.BombCardRequireAlly))then UI.CreateLabel(rootParent).SetText('Bomb Cards are unplayable').SetColor('#FF0000'); else CreateLine('Bomb Cards can be played on players you are in war with : ', Mod.Settings.BombCardRequireWar,true,false); CreateLine('Bomb Cards can be played on players you are in peace with : ', Mod.Settings.BombCardRequirePeace,false,false); CreateLine('Bomb Cards can be played on players you are allied with : ', Mod.Settings.BombCardRequireAlly,false,false); end end UI.CreateLabel(rootParent).SetText('Spy Card'); if(AlwaysPlayable(Mod.Settings.SpyCardRequireWar,Mod.Settings.SpyCardRequirePeace,Mod.Settings.SpyCardRequireAlly))then UI.CreateLabel(rootParent).SetText('You can play a Spy Card on everybody').SetColor('#FF0000'); else if(NeverPlayable(Mod.Settings.SpyCardRequireWar,Mod.Settings.SpyCardRequirePeace,Mod.Settings.SpyCardRequireAlly))then UI.CreateLabel(rootParent).SetText('Spy Cards are unplayable').SetColor('#FF0000'); else CreateLine('Spy Cards can be played on players you are in war with : ', Mod.Settings.SpyCardRequireWar,true,false); CreateLine('Spy Cards can be played on players you are in peace with : ', Mod.Settings.SpyCardRequirePeace,false,false); CreateLine('Spy Cards can be played on players you are allied with : ', Mod.Settings.SpyCardRequireAlly,false,false); end end UI.CreateLabel(rootParent).SetText('Gift Card'); if(AlwaysPlayable(Mod.Settings.GiftCardRequireWar,Mod.Settings.GiftCardRequirePeace,Mod.Settings.GiftCardRequireAlly))then UI.CreateLabel(rootParent).SetText('You can play a Gift Card on everybody').SetColor('#FF0000'); else if(NeverPlayable(Mod.Settings.GiftCardRequireWar,Mod.Settings.GiftCardRequirePeace,Mod.Settings.GiftCardRequireAlly))then UI.CreateLabel(rootParent).SetText('Gift Cards are unplayable').SetColor('#FF0000'); else CreateLine('Gift Cards can be played on players you are in war with : ', Mod.Settings.GiftCardRequireWar,false,false); CreateLine('Gift Cards can be played on players you are in peace with : ', Mod.Settings.GiftCardRequirePeace,false,false); CreateLine('Gift Cards can be played on players you are allied with : ', Mod.Settings.GiftCardRequireAlly,true,false); end end UI.CreateLabel(rootParent).SetText(' '); UI.CreateLabel(rootParent).SetText('Other Settings'); CreateLine('dabo1 has access to all data for fixing bugs and other diagnostic functions runtime : ', Mod.Settings.AdminAccess,false,true); end function CreateLine(settingname,variable,default,important) local lab = UI.CreateLabel(root); if(default == true or default == false)then lab.SetText(settingname .. booltostring(variable,default)); else if(variable == nil)then lab.SetText(settingname .. default); else lab.SetText(settingname .. variable); end end if(variable ~= nil and variable ~= default)then if(important == true)then lab.SetColor('#FF0000'); else lab.SetColor('#FFFF00'); end end end function booltostring(variable,default) if(variable == nil)then if(default)then return "Yes"; else return "No"; end end if(variable)then return "Yes"; else return "No"; end end function AlwaysPlayable(warsetting,peacesetting,allysetting) if(peacesetting == nil and allysetting == nil)then if(warsetting == nil)then return true; else if(warsetting)then return false; else return true; end end end if(peacesetting and allysetting and warsetting)then return true; end return false; end function NeverPlayable(warsetting,peacesetting,allysetting) if(peacesetting == nil and allysetting == nil)then return false; end if(peacesetting == false and allysetting == false and warsetting == false)then return true; end return false; end
mit
dickeyf/darkstar
scripts/zones/Southern_San_dOria_[S]/npcs/Mainchelite.lua
29
5404
----------------------------------- -- Area: Southern SandOria [S] -- NPC: Mainchelite -- @zone 80 -- @pos -16 1 -30 -- CS IDs: -- 0x005 = Generic Greeting for Iron Ram members -- 0x006 = Mid Initiation of other nation -- 0x007 = Ask player to Join Iron Rams -- 0x008 = Ask if changed mind about joining Iron rams (after player has declined) -- 0x009 = Mid Initiation of other nation -- 0x00A = Player works for another nation, offer to switch +give quest -- 0x00B = Player works for another nation, offer to switch +give quest -- 0x00C = Complete investigation -- 0x00D = "How fares the search, <player>?" -- 0x00E = "How fares the search, <player>?" -- 0x00F = No Red Recommendation Letter and has no nation affiliation -- Todo: medal loss from nation switching. Since there is no rank-up yet, this isn't so important for now. ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/titles"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/zones/Southern_San_dOria_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local Allegiance = player:getCampaignAllegiance(); -- 0 = none, 1 = San d'Oria Iron Rams, 2 = Bastok Fighting Fourth, 3 = Windurst Cobras local TheFightingFourth = player:getQuestStatus(CRYSTAL_WAR,THE_FIGHTING_FOURTH); local SnakeOnThePlains = player:getQuestStatus(CRYSTAL_WAR,SNAKE_ON_THE_PLAINS); local SteamedRams = player:getQuestStatus(CRYSTAL_WAR,STEAMED_RAMS); local RedLetter = player:hasKeyItem(RED_RECOMMENDATION_LETTER); local CharredPropeller = player:hasKeyItem(CHARRED_PROPELLER); local OxidizedPlate = player:hasKeyItem(OXIDIZED_PLATE); local ShatteredLumber = player:hasKeyItem(PIECE_OF_SHATTERED_LUMBER); if (TheFightingFourth == QUEST_ACCEPTED or SnakeOnThePlains == QUEST_ACCEPTED) then player:startEvent(0x009); elseif (SteamedRams == QUEST_AVAILABLE and RedLetter == true) then player:startEvent(0x007); elseif (SteamedRams == QUEST_AVAILABLE and player:getVar("RED_R_LETTER_USED") == 1) then player:startEvent(0x008); elseif (SteamedRams == QUEST_ACCEPTED and CharredPropeller == true and OxidizedPlate == true and ShatteredLumber == true) then player:startEvent(0x00C); elseif (SteamedRams == QUEST_ACCEPTED) then player:startEvent(0x00D); elseif (SteamedRams == QUEST_COMPLETED and Allegiance == 1) then player:startEvent(0x005); else player:startEvent(0x00F); 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 == 0x007 and option == 0) then player:addQuest(CRYSTAL_WAR,STEAMED_RAMS); player:setVar("RED_R_LETTER_USED",1); player:delKeyItem(RED_RECOMMENDATION_LETTER); elseif (csid == 0x007 and option == 1) then player:setVar("RED_R_LETTER_USED",1); player:delKeyItem(RED_RECOMMENDATION_LETTER); elseif (csid == 0x008 and option == 0) then player:addQuest(CRYSTAL_WAR, STEAMED_RAMS); elseif (csid == 0x00A and option == 0) then player:addQuest(CRYSTAL_WAR, STEAMED_RAMS); elseif (csid == 0x00B and option == 0) then player:addQuest(CRYSTAL_WAR, STEAMED_RAMS); elseif (csid == 0x00C and option == 0) then -- Is first join, so add Sprinter's Shoes and bronze medal if (player:getVar("Campaign_Nation") == 0) then if (player:getFreeSlotsCount() >= 1) then player:setCampaignAllegiance(1); player:setVar("RED_R_LETTER_USED",0); player:addTitle(KNIGHT_OF_THE_IRON_RAM); player:addKeyItem(BRONZE_RIBBON_OF_SERVICE); player:addItem(15754); player:completeQuest(CRYSTAL_WAR,STEAMED_RAMS); player:delKeyItem(CHARRED_PROPELLER); player:delKeyItem(OXIDIZED_PLATE); player:delKeyItem(PIECE_OF_SHATTERED_LUMBER); player:messageSpecial(KEYITEM_OBTAINED, BRONZE_RIBBON_OF_SERVICE); player:messageSpecial(ITEM_OBTAINED, 15754); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 15754); end else player:setCampaignAllegiance(1); player:setVar("RED_R_LETTER_USED",0); player:addTitle(KNIGHT_OF_THE_IRON_RAM); player:completeQuest(CRYSTAL_WAR,STEAMED_RAMS); player:delKeyItem(CHARRED_PROPELLER); player:delKeyItem(OXIDIZED_PLATE); player:delKeyItem(PIECE_OF_SHATTERED_LUMBER); end elseif (csid == 0x00D and option == 1) then player:delQuest(CRYSTAL_WAR,STEAMED_RAMS); end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c87798440.lua
3
4093
--アーマー・ブレイカー function c87798440.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(87798440,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetTarget(c87798440.eqtg) e1:SetOperation(c87798440.eqop) c:RegisterEffect(e1) --unequip local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(87798440,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCondition(aux.IsUnionState) e2:SetTarget(c87798440.sptg) e2:SetOperation(c87798440.spop) c:RegisterEffect(e2) --destroy sub local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCode(EFFECT_DESTROY_SUBSTITUTE) e3:SetCondition(aux.IsUnionState) e3:SetValue(c87798440.repval) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(87798440,2)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_BATTLE_DAMAGE) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_SZONE) e4:SetCondition(c87798440.descon) e4:SetTarget(c87798440.destg) e4:SetOperation(c87798440.desop) c:RegisterEffect(e4) --eqlimit local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_EQUIP_LIMIT) e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e5:SetValue(c87798440.eqlimit) c:RegisterEffect(e5) end c87798440.old_union=true function c87798440.repval(e,re,r,rp) return bit.band(r,REASON_BATTLE)~=0 end function c87798440.eqlimit(e,c) return c:IsRace(RACE_WARRIOR) end function c87798440.filter(c) return c:IsFaceup() and c:IsRace(RACE_WARRIOR) and c:GetUnionCount()==0 end function c87798440.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c87798440.filter(chkc) end if chk==0 then return e:GetHandler():GetFlagEffect(87798440)==0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(c87798440.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,c87798440.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) e:GetHandler():RegisterFlagEffect(87798440,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1) end function c87798440.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end if not tc:IsRelateToEffect(e) or not c87798440.filter(tc) then Duel.SendtoGrave(c,REASON_EFFECT) return end if not Duel.Equip(tp,c,tc,false) then return end aux.SetUnionState(c) end function c87798440.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(87798440)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) e:GetHandler():RegisterFlagEffect(87798440,RESET_EVENT+0x7e0000+RESET_PHASE+PHASE_END,0,1) end function c87798440.spop(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,true,false,POS_FACEUP_ATTACK) end function c87798440.descon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp and e:GetHandler():GetEquipTarget()==eg:GetFirst() and aux.IsUnionState(e) end function c87798440.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c87798440.desop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c95905259.lua
5
1434
--予言僧 チョウレン function c95905259.initial_effect(c) --confirm local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(95905259,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c95905259.target) e1:SetOperation(c95905259.operation) c:RegisterEffect(e1) end function c95905259.filter(c) return c:GetSequence()~=5 and c:IsFacedown() end function c95905259.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_SZONE) and c95905259.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c95905259.filter,tp,0,LOCATION_SZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(95905259,1)) Duel.SelectTarget(tp,c95905259.filter,tp,0,LOCATION_SZONE,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE) local res=Duel.SelectOption(tp,71,72) e:SetLabel(res) end function c95905259.operation(e,tp,eg,ep,ev,re,r,rp) local res=e:GetLabel() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFacedown() then Duel.ConfirmCards(tp,tc) if (res==0 and tc:IsType(TYPE_SPELL)) or (res==1 and tc:IsType(TYPE_TRAP)) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) end end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c54266211.lua
5
1525
--エヴォルダー・ウルカノドン function c54266211.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(54266211,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(c54266211.spcon) e1:SetTarget(c54266211.sptg) e1:SetOperation(c54266211.spop) c:RegisterEffect(e1) end function c54266211.spcon(e,tp,eg,ep,ev,re,r,rp) local st=e:GetHandler():GetSummonType() return st>=(SUMMON_TYPE_SPECIAL+150) and st<(SUMMON_TYPE_SPECIAL+180) end function c54266211.filter(c,e,tp) return c:IsSetCard(0x604e) and c:IsCanBeSpecialSummoned(e,180,tp,false,false) end function c54266211.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c54266211.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c54266211.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c54266211.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,180,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1) end end
gpl-2.0
Turttle/darkstar
scripts/zones/PsoXja/TextIDs.lua
7
1673
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item> come back again after sorting your inventory ITEM_OBTAINED = 6383; -- Obtained: <item> GIL_OBTAINED = 6384; -- Obtained <number> gil KEYITEM_OBTAINED = 6386; -- Obtained key item: <keyitem> NOTHING_OUT_OF_ORDINARY = 6397; -- There is nothing out of the ordinary here. DEVICE_IN_OPERATION = 7221; -- The device appears to be in operation... DOOR_LOCKED = 7224; -- The door is locked. ARCH_GLOW_BLUE = 7225; -- The arch above the door is glowing blue... ARCH_GLOW_GREEN = 7226; -- The arch above the door is glowing green... CANNOT_OPEN_SIDE = 7229; -- The door cannot be opened from this side. TRAP_ACTIVATED = 7231; -- A trap connected to it has been activated! TRAP_FAILS = 7232; -- The trap connected to it fails to activate. HOMEPOINT_SET = 7466; -- Home point set! -- Treasure Coffer/Chest Dialog CHEST_UNLOCKED = 7453; -- You unlock the chest! CHEST_FAIL = 7454; -- Fails to open the chest. CHEST_TRAP = 7455; -- The chest was trapped! CHEST_WEAK = 7456; -- You cannot open the chest when you are in a weakened state. CHEST_MIMIC = 7457; -- The chest was a mimic! CHEST_MOOGLE = 7458; -- You cannot open the chest while participating in the moogle event. CHEST_ILLUSION = 7459; -- The chest was but an illusion... CHEST_LOCKED = 7460; -- The chest appears to be locked. -- Other BROKEN_KNIFE = 7461; -- A broken knife blade can be seen among the rubble... -- conquest Base CONQUEST_BASE = 7062; -- Tallying conquest results...
gpl-3.0
Turttle/darkstar
scripts/globals/items/loaf_of_pumpernickel.lua
35
1202
----------------------------------------- -- ID: 4591 -- Item: loaf_of_pumpernickel -- Food Effect: 60Min, All Races ----------------------------------------- -- Health 10 -- Vitality 2 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,3600,4591); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 10); target:addMod(MOD_VIT, 2); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 10); target:delMod(MOD_VIT, 2); end;
gpl-3.0
dickeyf/darkstar
scripts/zones/Al_Zahbi/npcs/Gajaad.lua
18
2556
----------------------------------- -- Area: Al Zahbi -- NPC: Gajaad -- Type: Donation Taker -- @pos 40.781 -1.398 116.261 48 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local walahraCoinCount = player:getVar("walahraCoinCount"); local TradeCount = trade:getItemQty(2184); if (TradeCount > 0 and TradeCount == trade:getItemCount()) then if (walahraCoinCount + TradeCount > 1000) then -- give player turban, donated over 1000 if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,15270); else player:addItem(15270); player:messageSpecial(ITEM_OBTAINED,15270); player:setVar("walahraCoinCount", walahraCoinCount - (1000 - TradeCount)); player:tradeComplete(); player:startEvent(0x0066, 2184, 0, TradeCount); end else -- turning in less than the amount needed to finish the quest if (TradeCount >= 100) then -- give bonus walahra water - only one water per trade, regardless of the amount. player:tradeComplete(); player:setVar("walahraCoinCount", walahraCoinCount + TradeCount); player:addItem(5354); player:messageSpecial(ITEM_OBTAINED,5354); player:startEvent(0x0066, 2184, 0, TradeCount); else player:tradeComplete(); player:setVar("walahraCoinCount", walahraCoinCount + TradeCount); player:startEvent(0x0066, 2184, 0, TradeCount); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) -- TODO beseige result can effect if this npc will accept trades player:startEvent(0x0066, 2184); 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
dickeyf/darkstar
scripts/zones/Bastok_Mines/npcs/Neigepance.lua
16
1571
----------------------------------- -- Area: Bastok Mines -- NPC: Neigepance -- Standard Merchant NPC ----------------------------------- require("scripts/globals/shop"); package.loaded["scripts/zones/Bastok_Mines/TextIDs"] = nil; require("scripts/zones/Bastok_Mines/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,NEIGEPANCE_SHOP_DIALOG); stock = { 0x439B, 9,1, --Dart 0x034D, 1150,1, --Black Chocobo Feather 0x11C1, 62,3, --Gysahl Greens 0x0348, 7,3, --Chocobo Feather 0x4278, 11,3, --Pet Food Alpha Biscuit 0x4279, 82,3, --Pet Food Beta Biscuit 0x45C4, 82,3, --Carrot Broth 0x45C6, 695,3, --Bug Broth 0x45C8, 126,3, --Herbal Broth 0x45CA, 695,3, --Carrion Broth 0x13D1, 50784,3 --Scroll of Chocobo Mazurka } showNationShop(player, BASTOK, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
adib1380/anit-spam-2
plugins/search_youtube.lua
674
1270
do local google_config = load_from_file('data/google.lua') local function httpsRequest(url) print(url) local res,code = https.request(url) if code ~= 200 then return nil end return json:decode(res) end local function searchYoutubeVideos(text) local url = 'https://www.googleapis.com/youtube/v3/search?' url = url..'part=snippet'..'&maxResults=4'..'&type=video' url = url..'&q='..URL.escape(text) if google_config.api_keys then local i = math.random(#google_config.api_keys) local api_key = google_config.api_keys[i] if api_key then url = url.."&key="..api_key end end local data = httpsRequest(url) if not data then print("HTTP Error") return nil elseif not data.items then return nil end return data.items end local function run(msg, matches) local text = '' local items = searchYoutubeVideos(matches[1]) if not items then return "Error!" end for k,item in pairs(items) do text = text..'http://youtu.be/'..item.id.videoId..' '.. item.snippet.title..'\n\n' end return text end return { description = "Search video on youtube and send it.", usage = "!youtube [term]: Search for a youtube video and send it.", patterns = { "^!youtube (.*)" }, run = run } end
gpl-2.0
Shayan123456/botttttt6
plugins/search_youtube.lua
674
1270
do local google_config = load_from_file('data/google.lua') local function httpsRequest(url) print(url) local res,code = https.request(url) if code ~= 200 then return nil end return json:decode(res) end local function searchYoutubeVideos(text) local url = 'https://www.googleapis.com/youtube/v3/search?' url = url..'part=snippet'..'&maxResults=4'..'&type=video' url = url..'&q='..URL.escape(text) if google_config.api_keys then local i = math.random(#google_config.api_keys) local api_key = google_config.api_keys[i] if api_key then url = url.."&key="..api_key end end local data = httpsRequest(url) if not data then print("HTTP Error") return nil elseif not data.items then return nil end return data.items end local function run(msg, matches) local text = '' local items = searchYoutubeVideos(matches[1]) if not items then return "Error!" end for k,item in pairs(items) do text = text..'http://youtu.be/'..item.id.videoId..' '.. item.snippet.title..'\n\n' end return text end return { description = "Search video on youtube and send it.", usage = "!youtube [term]: Search for a youtube video and send it.", patterns = { "^!youtube (.*)" }, run = run } end
gpl-2.0
dickeyf/darkstar
scripts/zones/Mount_Zhayolm/npcs/qm3.lua
30
1334
----------------------------------- -- Area: Mount Zhayolm -- NPC: ??? (Spawn Anantaboga(ZNM T2)) -- @pos -368 -13 366 61 ----------------------------------- package.loaded["scripts/zones/Mount_Zhayolm/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Mount_Zhayolm/TextIDs"); require("scripts/globals/status"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local mobID = 17027473; if (trade:hasItemQty(2587,1) and trade:getItemCount() == 1) then -- Trade Raw Buffalo if (GetMobAction(mobID) == ACTION_NONE) then player:tradeComplete(); SpawnMob(mobID):updateClaim(player); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_HAPPENS); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
dickeyf/darkstar
scripts/zones/Windurst_Waters/npcs/Yung_Yaam.lua
1
1765
----------------------------------- -- Area: Windurst Waters -- NPC: Yung Yaam -- Involved In Quest: Wondering Minstrel -- Working 100% -- @zone = 238 -- @pos = -63 -4 27 ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/zones/Windurst_Waters/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) --player:addFame(WINDURST,WIN_FAME*100) wonderingstatus = player:getQuestStatus(WINDURST,WONDERING_MINSTREL); fame = player:getFameLevel(WINDURST) if (wonderingstatus <= 1 and fame >= 5) then player:startEvent(0x027d); -- WONDERING_MINSTREL: Quest Available / Quest Accepted elseif (wonderingstatus == QUEST_COMPLETED and player:needToZone()) then player:startEvent(0x0283); -- WONDERING_MINSTREL: Quest After else player:startEvent(0x0261); -- Standard Conversation end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
dickeyf/darkstar
scripts/zones/Southern_San_dOria/npcs/Aravoge_TK.lua
13
5604
----------------------------------- -- Area: Southern San d'Oria -- NPC: Aravoge, T.K. -- X Grant Signet -- X Recharge Emperor Band, Empress Band, or Chariot Band -- X Accepts traded Crystals to fill up the Rank bar to open new Missions. -- X Sells items in exchange for Conquest Points -- X Start Supply Run Missions and offers a list of already-delivered supplies. -- Start an Expeditionary Force by giving an E.F. region insignia to you. ------------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ------------------------------------- require("scripts/globals/conquest"); require("scripts/globals/common"); require("scripts/zones/Southern_San_dOria/TextIDs"); local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, JEUNO local guardtype = 1; -- 1: city, 2: foreign, 3: outpost, 4: border local size = table.getn(SandInv); local inventory = SandInv; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getNation() == guardnation and player:getVar("supplyQuest_started") > 0 and supplyRunFresh(player) == 0) then player:showText(npc,CONQUEST + 40); -- "We will dispose of those unusable supplies." local region = player:getVar("supplyQuest_region"); player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1,getSupplyKey(region)); player:setVar("supplyQuest_started",0); player:setVar("supplyQuest_region",0); player:setVar("supplyQuest_fresh",0); else local Menu1 = getArg1(guardnation,player); local Menu2 = getExForceAvailable(guardnation,player); local Menu3 = conquestRanking(); local Menu4 = getSupplyAvailable(guardnation,player); local Menu5 = player:getNationTeleport(guardnation); local Menu6 = getArg6(player); local Menu7 = player:getCP(); local Menu8 = getRewardExForce(guardnation,player); player:startEvent(0x7ffa,Menu1,Menu2,Menu3,Menu4,Menu5,Menu6,Menu7,Menu8); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("onUpdateCSID: %u",csid); -- printf("onUpdateOPTION: %u",option); if (option >= 32768 and option <= 32944) then for Item = 1,size,3 do if (option == inventory[Item]) then CPVerify = 1; if (player:getCP() >= inventory[Item + 1]) then CPVerify = 0; end; player:updateEvent(2,CPVerify,inventory[Item + 2]); break; end; end; end; end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("onFinishCSID: %u",csid); -- printf("onFinishOPTION: %u",option); if (option == 1) then 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 >= 32768 and option <= 32944) then for Item = 1,size,3 do if (option == inventory[Item]) then if (player:getFreeSlotsCount() >= 1) then -- Logic to impose limits on exp bands if (option >= 32933 and option <= 32935) then if (checkConquestRing(player) > 0) then player:messageSpecial(CONQUEST+60,0,0,inventory[Item+2]); break; else player:setVar("CONQUEST_RING_TIMER",getConquestTally()); end end if (player:getNation() == guardnation) then itemCP = inventory[Item + 1]; else if (inventory[Item + 1] <= 8000) then itemCP = inventory[Item + 1] * 2; else itemCP = inventory[Item + 1] + 8000; end; end; if (player:hasItem(inventory[Item + 2]) == false) then player:delCP(itemCP); player:addItem(inventory[Item + 2],1); player:messageSpecial(ITEM_OBTAINED,inventory[Item + 2]); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,inventory[Item + 2]); end; else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,inventory[Item + 2]); end; break; end; end; elseif (option >= 65541 and option <= 65565) then -- player chose supply quest. local region = option - 65541; player:addKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED,getSupplyKey(region)); player:setVar("supplyQuest_started",vanaDay()); player:setVar("supplyQuest_region",region); player:setVar("supplyQuest_fresh",getConquestTally()); end; end;
gpl-3.0
fgenesis/Aquaria_experimental
game_scripts/scripts/maps/node_seelibody.lua
6
1474
-- 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 not hasSong(SONG_DUALFORM) and not v.done and not hasLi() and node_isEntityIn(me, getNaija()) then v.done = true local li = getEntity("li") if li ~= 0 then entity_idle(getNaija()) entity_flipToEntity(getNaija(), li) watch(0.5) overrideZoom(0.3) setCameraLerpDelay(0.0001) overrideZoom(1.2, 16) screenFadeGo(0.5) playSfx("ping") cam_toEntity(li) watch(4) cam_toEntity(getNaija()) screenFadeGo(3) watch(0.5) setCameraLerpDelay(0) overrideZoom(0) end end end
gpl-2.0
Turttle/darkstar
scripts/zones/Southern_San_dOria/npcs/Alaune.lua
32
1490
----------------------------------- -- Area: Southern San d`Oria -- NPC: Alaune -- Type: Tutorial NPC -- @zone: 230 -- @pos -90 1 -56 ----------------------------------- 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) -- "Flyers for Regine" conditional script local FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then local count = trade:getItemCount(); local 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) player:showText(npc,TUTORIAL_NPC); 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
deepmind/meltingpot
meltingpot/lua/levels/gift_refinements/init.lua
1
1406
--[[ Copyright 2022 DeepMind Technologies Limited. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ]] -- Entry point lua file for the gift_refinements substrate. local meltingpot = 'meltingpot.lua.modules.' local api_factory = require(meltingpot .. 'api_factory') local simulation = require(meltingpot .. 'base_simulation') -- Required to be able to use the components in the level local component_library = require(meltingpot .. 'component_library') local avatar_library = require(meltingpot .. 'avatar_library') local components = require 'components' return api_factory.apiFactory{ Simulation = simulation.BaseSimulation, settings = { -- Scale each sprite to a square of size `spriteSize` X `spriteSize`. spriteSize = 8, -- Terminate the episode after this many frames. maxEpisodeLengthFrames = 1000, -- Settings to pass to simulation.lua. simulation = {}, } }
apache-2.0
fgenesis/Aquaria_experimental
game_scripts/scripts/maps/node_enter_theveil.lua
6
1105
-- 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 function init(me) v.n = getNaija() end function update(me, dt) if isFlag(FLAG_ENTER_VEIL, 0) and node_isEntityIn(me, v.n) then setFlag(FLAG_ENTER_VEIL, 1) centerText(getStringBank(1014)) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c33737664.lua
7
1285
--墓荒らしの報い function c33737664.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_STANDBY_PHASE,0) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(33737664,0)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE+PHASE_STANDBY) e2:SetCondition(c33737664.damcon) e2:SetTarget(c33737664.damtg) e2:SetOperation(c33737664.damop) c:RegisterEffect(e2) end function c33737664.damcon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function c33737664.filter(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) end function c33737664.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end function c33737664.damop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local d=Duel.GetMatchingGroupCount(c33737664.filter,tp,0,LOCATION_REMOVED,nil)*100 Duel.Damage(p,d,REASON_EFFECT) end
gpl-2.0
Turttle/darkstar
scripts/globals/items/serving_of_mille_feuille.lua
36
1426
----------------------------------------- -- ID: 5559 -- Item: Serving of Mille Feuille -- Food Effect: 3 Hrs, All Races ----------------------------------------- -- TODO: Group Effect -- HP +8 -- MP +15 -- Intelligence +1 -- HP Recoverd while healing 1 -- MP Recovered while healing 1 ----------------------------------------- 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,5559); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 8); target:addMod(MOD_MP, 15); target:addMod(MOD_INT, 1); target:addMod(MOD_HPHEAL, 1); target:addMod(MOD_MPHEAL, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 8); target:delMod(MOD_MP, 15); target:delMod(MOD_INT, 1); target:delMod(MOD_HPHEAL, 1); target:delMod(MOD_MPHEAL, 1); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c46461247.lua
9
1138
--トラップ・マスター function c46461247.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(46461247,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(c46461247.target) e1:SetOperation(c46461247.operation) c:RegisterEffect(e1) end function c46461247.filter(c) return c:IsFacedown() or c:IsType(TYPE_TRAP) end function c46461247.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_SZONE) and c46461247.filter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c46461247.filter,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,e:GetHandler()) if g:GetCount()>0 and g:GetFirst():IsFaceup() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end end function c46461247.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then if tc:IsFacedown() then Duel.ConfirmCards(tp,tc) end if tc:IsType(TYPE_TRAP) then Duel.Destroy(tc,REASON_EFFECT) end end end
gpl-2.0
Andrey2470T/Advanced-Trains-Optinal-Additional-
advtrains_itrainmap/init.lua
2
4544
local map_def={ example = { p1x=168, p1z=530, p2x=780, p2z=1016, background="itm_example.png", }, } local itm_cache={} local itm_pdata={} local itm_conf_mindia=0.1 minetest.register_privilege("itm", { description = "Allows to display train map", give_to_singleplayer = true, default = false }) local function create_map_form_with_bg(d) local minx, minz, maxx, maxz = math.min(d.p1x, d.p2x), math.min(d.p1z, d.p2z), math.max(d.p1x, d.p2x), math.max(d.p1z, d.p2z) local form_x, form_z=10,10 local edge_x, edge_z = form_x/(maxx-minx), form_z/(maxz-minz) local len_x, len_z=math.max(edge_x, itm_conf_mindia), math.max(edge_z, itm_conf_mindia) local form="size["..(form_x+edge_x)..","..(form_z+edge_z).."] background[0,0;0,0;"..d.background..";true] " local lbl={} for pts, tid in pairs(advtrains.detector.on_node) do local pos=minetest.string_to_pos(pts) form=form.."box["..(edge_x*(pos.x-minx))..","..(form_z-(edge_z*(pos.z-minz)))..";"..len_x..","..len_z..";red]" lbl[sid(tid)]=pos end for t_id, xz in pairs(lbl) do form=form.."label["..(edge_x*(xz.x-minx))..","..(form_x-(edge_z*(xz.z-minz)))..";"..t_id.."]" end return form end local function create_map_form(d) if d.background then return create_map_form_with_bg(d) end local minx, minz, maxx, maxz = math.min(d.p1x, d.p2x), math.min(d.p1z, d.p2z), math.max(d.p1x, d.p2x), math.max(d.p1z, d.p2z) local form_x, form_z=10,10 local edge_x, edge_z = form_x/(maxx-minx), form_z/(maxz-minz) local len_x, len_z=math.max(edge_x, itm_conf_mindia), math.max(edge_z, itm_conf_mindia) local form="size["..(form_x+edge_x)..","..(form_z+edge_z).."]" local lbl={} for x,itx in pairs(itm_cache) do if x>=minx and x<=maxx then for z,y in pairs(itx) do if z>=minz and z<=maxz then local adn=advtrains.detector.on_node[minetest.pos_to_string({x=x, y=y, z=z})] local color="gray" if adn then color="red" lbl[sid(adn)]={x=x, z=z} end form=form.."box["..(edge_x*(x-minx))..","..(form_z-(edge_z*(z-minz)))..";"..len_x..","..len_z..";"..color.."]" end end end end for t_id, xz in pairs(lbl) do form=form.."label["..(edge_x*(xz.x-minx))..","..(form_x-(edge_z*(xz.z-minz)))..";"..t_id.."]" end return form end local function cache_ndb() itm_cache={} local ndb_nodes=advtrains.ndb.get_nodes() for y, xzt in pairs(ndb_nodes) do for x, zt in pairs(xzt) do for z, _ in pairs(zt) do if not itm_cache[x] then itm_cache[x]={} end itm_cache[x][z]=y end end end end minetest.register_chatcommand("itm", { params="[x1 z1 x2 z2] or [mdef]", description="Display advtrains train map of given area.\nFirst form:[x1 z1 x2 z2] - specify area directly.\nSecond form:[mdef] - Use a predefined map background(see init.lua)\nThird form: No parameters - use WorldEdit position markers.", privs={itm=true}, func = function(name, param) local mdef=string.match(param, "^(%S+)$") if mdef then local d=map_def[mdef] if not d then return false, "Map definiton not found: "..mdef end itm_pdata[name]=map_def[mdef] minetest.show_formspec(name, "itrainmap", create_map_form(d)) return true, "Showing train map: "..mdef end local x1, z1, x2, z2=string.match(param, "^(%S+) (%S+) (%S+) (%S+)$") if not (x1 and z1 and x2 and z2) then if worldedit then local wep1, wep2=worldedit.pos1[name], worldedit.pos2[name] if wep1 and wep2 then x1, z1, x2, z2=wep1.x, wep1.z, wep2.x, wep2.z end end end if not (x1 and z1 and x2 and z2) then return false, "Invalid parameters and no WE positions set" end local d={p1x=x1, p1z=z1, p2x=x2, p2z=z2} itm_pdata[name]=d minetest.show_formspec(name, "itrainmap", create_map_form(d)) return true, "Showing ("..x1..","..z1..")-("..x2..","..z2..")" end, }) minetest.register_chatcommand("itm_cache_ndb", { params="", description="Cache advtrains node database again. Run when tracks changed.", privs={itm=true}, func = function(name, param) cache_ndb() return true, "Done caching node database." end, }) local timer=0 minetest.register_globalstep(function(dtime) timer=timer-math.min(dtime, 0.1) if timer<=0 then for pname,d in pairs(itm_pdata) do minetest.show_formspec(pname, "itrainmap", create_map_form(d)) end timer=2 end end) minetest.register_on_player_receive_fields(function(player, formname, fields) if formname=="itrainmap" and fields.quit then itm_pdata[player:get_player_name()]=nil end end) --automatically run itm_cache_ndb minetest.after(2, cache_ndb)
lgpl-2.1
Turttle/darkstar
scripts/zones/Bastok_Markets/npcs/Wulfnoth.lua
53
1818
----------------------------------- -- Area: Bastok Markets -- NPC: Wulfnoth -- Type: Goldsmithing Synthesis Image Support -- @pos -211.937 -7.814 -56.292 235 ----------------------------------- package.loaded["scripts/zones/Bastok_Markets/TextIDs"] = nil; ----------------------------------- require("scripts/globals/status"); require("scripts/globals/crafting"); require("scripts/zones/Bastok_Markets/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local guildMember = isGuildMember(player,6); local SkillCap = getCraftSkillCap(player, SKILL_GOLDSMITHING); local SkillLevel = player:getSkillLevel(SKILL_GOLDSMITHING); if (guildMember == 1) then if (player:hasStatusEffect(EFFECT_GOLDSMITHING_IMAGERY) == false) then player:startEvent(0x012F,SkillCap,SkillLevel,1,201,player:getGil(),0,3,0); else player:startEvent(0x012F,SkillCap,SkillLevel,1,201,player:getGil(),7054,3,0); end else player:startEvent(0x012F); 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 == 0x012F and option == 1) then player:messageSpecial(GOLDSMITHING_SUPPORT,0,3,1); player:addStatusEffect(EFFECT_GOLDSMITHING_IMAGERY,1,0,120); end end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c84653834.lua
2
1759
--超能力増幅器 function c84653834.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(c84653834.condition) e1:SetTarget(c84653834.target) e1:SetOperation(c84653834.activate) c:RegisterEffect(e1) end function c84653834.condition(e,tp,eg,ep,ev,re,r,rp) if Duel.GetCurrentPhase()==PHASE_DAMAGE and Duel.IsDamageCalculated() then return false end return true end function c84653834.filter(c) return c:IsFaceup() and c:IsRace(RACE_PSYCHO) end function c84653834.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c84653834.filter,tp,LOCATION_MZONE,0,1,nil) end end function c84653834.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(c84653834.filter,tp,LOCATION_MZONE,0,nil) local c=e:GetHandler() local tc=sg:GetFirst() local atk=Duel.GetMatchingGroupCount(c84653834.filter,tp,LOCATION_REMOVED,0,nil)*300 while tc do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e1:SetValue(atk) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_MZONE) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetOperation(c84653834.rmop) tc:RegisterEffect(e2) tc=sg:GetNext() end end function c84653834.rmop(e,tp,eg,ep,ev,re,r,rp) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT) end
gpl-2.0
Turttle/darkstar
scripts/zones/Windurst_Woods/npcs/Spare_Five.lua
17
1507
----------------------------------- -- Area: Windurst Woods -- NPC: Spare Five -- Working 100% -- Involved in quest: A Greeting Cardian ----------------------------------- require("scripts/globals/settings"); package.loaded["scripts/globals/quests"] = nil; require("scripts/globals/quests"); package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; require("scripts/zones/Windurst_Woods/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) AGreetingCardian = player:getQuestStatus(WINDURST,A_GREETING_CARDIAN); local AGCcs = player:getVar("AGreetingCardian_Event"); if (AGreetingCardian == QUEST_ACCEPTED and AGCcs == 2) then player:startEvent(0x0127); -- A Greeting Cardian step two else player:startEvent(0x11a); -- standard 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 (csid == 0x0127) then player:setVar("AGreetingCardian_Event",3); end end;
gpl-3.0
ld-test/cqueues
src/cqueues.lua
1
3754
local loader = function(loader, ...) local core = require"_cqueues" local errno = require"_cqueues.errno" local monotime = core.monotime local running = core.running local strerror = errno.strerror local unpack = assert(table.unpack or unpack) -- 5.1 compat -- lazily load auxlib to prevent circular or unused dependencies local auxlib = setmetatable({}, { __index = function (t, k) local v = require"cqueues.auxlib"[k] rawset(t, k, v) return v end }) -- load deprecated APIs into shadow table to keep hidden unless used local notsupp = {} setmetatable(core, { __index = notsupp }) -- -- core.poll -- -- Wrap the cqueues yield protocol to support polling across -- multilevel resume/yield. Requires explicit or implicit use -- (through monkey patching of coroutine.resume and coroutine.wrap) -- of auxlib.resume or auxlib.wrap. -- -- Also supports polling from outside of a running event loop using -- a cheap hack. NOT RECOMMENDED. -- local _POLL = core._POLL local yield = coroutine.yield local poller function core.poll(...) local yes, main = running() if yes then if main then return yield(...) else return yield(_POLL, ...) end else local tuple poller = poller or auxlib.assert3(core.new()) poller:wrap(function (...) tuple = { core.poll(...) } end, ...) -- NOTE: must step twice, once to call poll and -- again to wake up auxlib.assert3(poller:step()) auxlib.assert3(poller:step()) return unpack(tuple or {}) end end -- core.poll -- -- core.sleep -- -- Sleep primitive. -- function core.sleep(timeout) core.poll(timeout) end -- core.sleep -- -- core:step -- -- Wrap the low-level :step interface to make managing event loops -- slightly easier. -- local step; step = core.interpose("step", function (self, timeout) if core.running() then core.poll(self, timeout) return step(self, 0.0) else return step(self, timeout) end end) -- core:step -- -- core:loop -- -- Step until an error is encountered. -- local function todeadline(timeout) -- special case 0 timeout to avoid monotime call in totimeout return timeout and (timeout > 0 and monotime() + timeout or 0) or nil end -- todeadline local function totimeout(deadline) if not deadline then return nil, false elseif deadline == 0 then return 0, true else local curtime = monotime() if curtime < deadline then return deadline - curtime, false else return 0, true end end end -- totimeout core.interpose("loop", function (self, timeout) local function checkstep(self, deadline, ok, ...) local timeout, expired = totimeout(deadline) if not ok then return false, ... elseif expired or self:empty() then return true else return checkstep(self, deadline, self:step(timeout)) end end local deadline = todeadline(timeout) return checkstep(self, deadline, self:step(timeout)) end) -- core:loop -- -- core:errors -- -- Return iterator over core:loop. -- core.interpose("errors", function (self, timeout) local deadline = todeadline(timeout) return function () local timeout = totimeout(deadline) return select(2, self:loop(timeout)) end end) -- core:errors -- -- core.assert -- -- DEPRECATED. See auxlib.assert. -- function notsupp.assert(...) return auxlib.assert(...) end -- notsupp.assert -- -- core.resume -- -- DEPRECATED. See auxlib.resume. -- function notsupp.resume(...) return auxlib.resume(...) end -- notsupp.resume -- -- core.wrap -- -- DEPRECATED. See auxlib.wrap. -- function notsupp.wrap(...) return auxlib.wrap(...) end -- notsupp.wrap core.loader = loader return core end -- loader return loader(loader, ...)
mit
dickeyf/darkstar
scripts/zones/Temenos/bcnms/Temenos_Northern_Tower.lua
35
1173
----------------------------------- -- Area: Temenos -- Name: ----------------------------------- require("scripts/globals/limbus"); require("scripts/globals/keyitems"); -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) SetServerVariable("[Temenos_N_Tower]UniqueID",GenerateLimbusKey()); HideArmouryCrates(GetInstanceRegion(1299),TEMENOS); HideTemenosDoor(GetInstanceRegion(1299)); end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) player:setVar("limbusbitmap",0); player:setVar("characterLimbusKey",GetServerVariable("[Temenos_N_Tower]UniqueID")); player:setVar("LimbusID",1299); player:delKeyItem(COSMOCLEANSE); player:delKeyItem(WHITE_CARD); end; -- Leaving the Dynamis by every mean possible, given by the LeaveCode -- 3=Disconnected or warped out (if dyna is empty: launch 4 after 3) -- 4=Finish he dynamis function onBcnmLeave(player,instance,leavecode) --print("leave code "..leavecode); if (leavecode == 4) then player:setPos(580,-1.5,4.452,192); ResetPlayerLimbusVariable(player) end end;
gpl-3.0
dickeyf/darkstar
scripts/zones/Crawlers_Nest/npcs/Treasure_Coffer.lua
13
4680
----------------------------------- -- Area: Crawler Nest -- NPC: Treasure Coffer -- @zone 197 -- @pos -94 0 207 ----------------------------------- package.loaded["scripts/zones/Crawlers_Nest/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/treasure"); require("scripts/globals/quests"); require("scripts/zones/Crawlers_Nest/TextIDs"); local TreasureType = "Coffer"; local TreasureLvL = 53; local TreasureMinLvL = 43; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- trade:hasItemQty(1045,1); -- Treasure Key -- trade:hasItemQty(1115,1); -- Skeleton Key -- trade:hasItemQty(1023,1); -- Living Key -- trade:hasItemQty(1022,1); -- Thief's Tools local questItemNeeded = 0; -- Player traded a key. if ((trade:hasItemQty(1045,1) or trade:hasItemQty(1115,1) or trade:hasItemQty(1023,1) or trade:hasItemQty(1022,1)) and trade:getItemCount() == 1) then -- IMPORTANT ITEM: AF Keyitems, AF Items, & Map ----------- local mJob = player:getMainJob(); local zone = player:getZoneID(); local AFHandsActivated = player:getVar("BorghertzAlreadyActiveWithJob"); local listAF = getAFbyZone(zone); if ((AFHandsActivated == 2 or AFHandsActivated == 9) and player:hasKeyItem(OLD_GAUNTLETS) == false) then questItemNeeded = 1; else for nb = 1,table.getn(listAF),3 do if (player:getQuestStatus(JEUNO,listAF[nb + 1]) ~= QUEST_AVAILABLE and mJob == listAF[nb] and player:hasItem(listAF[nb + 2]) == false) then questItemNeeded = 2; break end end end -------------------------------------- local pack = openChance(player,npc,trade,TreasureType,TreasureLvL,TreasureMinLvL,questItemNeeded); local success = 0; if (pack[2] ~= nil) then player:messageSpecial(pack[2]); end success = pack[1]; if (success ~= -2) then player:tradeComplete(); if (math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); if (questItemNeeded == 1) then player:addKeyItem(OLD_GAUNTLETS); player:messageSpecial(KEYITEM_OBTAINED,OLD_GAUNTLETS); -- Old Gauntlets (KI) elseif (questItemNeeded == 2) then for nb = 1,table.getn(listAF),3 do if (mJob == listAF[nb]) then player:addItem(listAF[nb + 2]); player:messageSpecial(ITEM_OBTAINED,listAF[nb + 2]); break end end else player:setVar("["..zone.."]".."Treasure_"..TreasureType,os.time() + math.random(CHEST_MIN_ILLUSION_TIME,CHEST_MAX_ILLUSION_TIME)); local loot = cofferLoot(zone,npc); -- print("loot array: "); -- debug -- print("[1]", loot[1]); -- debug -- print("[2]", loot[2]); -- debug if (loot[1]=="gil") then player:addGil(loot[2]*GIL_RATE); player:messageSpecial(GIL_OBTAINED,loot[2]*GIL_RATE); else -- Item player:addItem(loot[2]); player:messageSpecial(ITEM_OBTAINED,loot[2]); end end UpdateTreasureSpawnPoint(npc:getID()); else player:messageSpecial(CHEST_MIMIC); spawnMimic(zone,npc,player); UpdateTreasureSpawnPoint(npc:getID(), true); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(CHEST_LOCKED,1045); 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
dickeyf/darkstar
scripts/zones/Southern_San_dOria_[S]/npcs/Kilhwch1.lua
19
1082
----------------------------------- -- Area: Southern SandOria [S] -- NPC: Kilhwch -- @zone 80 -- @pos -63 2 -50 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria_[S]/TextIDs"] = nil; require("scripts/zones/Southern_San_dOria_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, 11143) -- I advise you distance yourself from Lady Ulla. I know not your intentions, but am inclined to believe they are crooked 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
robo-crc/scoreboard
extern/premake/base/os.lua
7
6207
-- -- os.lua -- Additions to the OS namespace. -- Copyright (c) 2002-2011 Jason Perkins and the Premake project -- -- -- Same as os.execute(), but accepts string formatting arguments. -- function os.executef(cmd, ...) cmd = string.format(cmd, unpack(arg)) return os.execute(cmd) end -- -- Scan the well-known system locations for a particular library. -- local function parse_ld_so_conf(conf_file) -- Linux ldconfig file parser to find system library locations local first, last local dirs = { } for line in io.lines(conf_file) do -- ignore comments first = line:find("#", 1, true) if first ~= nil then line = line:sub(1, first - 1) end if line ~= "" then -- check for include files first, last = line:find("include%s+") if first ~= nil then -- found include glob local include_glob = line:sub(last + 1) local includes = os.matchfiles(include_glob) for _, v in ipairs(includes) do dirs = table.join(dirs, parse_ld_so_conf(v)) end else -- found an actual ld path entry table.insert(dirs, line) end end end return dirs end function os.findlib(libname) local path, formats -- assemble a search path, depending on the platform if os.is("windows") then formats = { "%s.dll", "%s" } path = os.getenv("PATH") elseif os.is("haiku") then formats = { "lib%s.so", "%s.so" } path = os.getenv("LIBRARY_PATH") else if os.is("macosx") then formats = { "lib%s.dylib", "%s.dylib" } path = os.getenv("DYLD_LIBRARY_PATH") else formats = { "lib%s.so", "%s.so" } path = os.getenv("LD_LIBRARY_PATH") or "" for _, v in ipairs(parse_ld_so_conf("/etc/ld.so.conf")) do path = path .. ":" .. v end end table.insert(formats, "%s") path = path or "" if os.is64bit() then path = path .. ":/lib64:/usr/lib64/:usr/local/lib64" end path = path .. ":/lib:/usr/lib:/usr/local/lib" end for _, fmt in ipairs(formats) do local name = string.format(fmt, libname) local result = os.pathsearch(name, path) if result then return result end end end -- -- Retrieve the current operating system ID string. -- function os.get() return _OPTIONS.os or _OS end -- -- Check the current operating system; may be set with the /os command line flag. -- function os.is(id) return (os.get():lower() == id:lower()) end -- -- Determine if the current system is running a 64-bit architecture -- local _64BitHostTypes = { "x86_64", "ia64", "amd64", "ppc64", "powerpc64", "sparc64" } function os.is64bit() -- Call the native code implementation. If this returns true then -- we're 64-bit, otherwise do more checking locally if (os._is64bit()) then return true end -- Identify the system local arch if _OS == "windows" then arch = os.getenv("PROCESSOR_ARCHITECTURE") elseif _OS == "macosx" then arch = os.outputof("echo $HOSTTYPE") else arch = os.outputof("uname -m") end -- Check our known 64-bit identifiers arch = arch:lower() for _, hosttype in ipairs(_64BitHostTypes) do if arch:find(hosttype) then return true end end return false end -- -- The os.matchdirs() and os.matchfiles() functions -- local function domatch(result, mask, wantfiles) -- need to remove extraneous path info from the mask to ensure a match -- against the paths returned by the OS. Haven't come up with a good -- way to do it yet, so will handle cases as they come up if mask:startswith("./") then mask = mask:sub(3) end -- strip off any leading directory information to find out -- where the search should take place local basedir = mask local starpos = mask:find("%*") if starpos then basedir = basedir:sub(1, starpos - 1) end basedir = path.getdirectory(basedir) if (basedir == ".") then basedir = "" end -- recurse into subdirectories? local recurse = mask:find("**", nil, true) -- convert mask to a Lua pattern mask = path.wildcards(mask) local function matchwalker(basedir) local wildcard = path.join(basedir, "*") -- retrieve files from OS and test against mask local m = os.matchstart(wildcard) while (os.matchnext(m)) do local isfile = os.matchisfile(m) if ((wantfiles and isfile) or (not wantfiles and not isfile)) then local fname = path.join(basedir, os.matchname(m)) if fname:match(mask) == fname then table.insert(result, fname) end end end os.matchdone(m) -- check subdirectories if recurse then m = os.matchstart(wildcard) while (os.matchnext(m)) do if not os.matchisfile(m) then local dirname = os.matchname(m) matchwalker(path.join(basedir, dirname)) end end os.matchdone(m) end end matchwalker(basedir) end function os.matchdirs(...) local result = { } for _, mask in ipairs(arg) do domatch(result, mask, false) end return result end function os.matchfiles(...) local result = { } for _, mask in ipairs(arg) do domatch(result, mask, true) end return result end -- -- An overload of the os.mkdir() function, which will create any missing -- subdirectories along the path. -- local builtin_mkdir = os.mkdir function os.mkdir(p) local dir = iif(p:startswith("/"), "/", "") for part in p:gmatch("[^/]+") do dir = dir .. part if (part ~= "" and not path.isabsolute(part) and not os.isdir(dir)) then local ok, err = builtin_mkdir(dir) if (not ok) then return nil, err end end dir = dir .. "/" end return true end -- -- Run a shell command and return the output. -- function os.outputof(cmd) local pipe = io.popen(cmd) local result = pipe:read('*a') pipe:close() return result end -- -- Remove a directory, along with any contained files or subdirectories. -- local builtin_rmdir = os.rmdir function os.rmdir(p) -- recursively remove subdirectories local dirs = os.matchdirs(p .. "/*") for _, dname in ipairs(dirs) do os.rmdir(dname) end -- remove any files local files = os.matchfiles(p .. "/*") for _, fname in ipairs(files) do os.remove(fname) end -- remove this directory builtin_rmdir(p) end
mit
SalvationDevelopment/Salvation-Scripts-TCG
c52430902.lua
5
1940
--サイコジャンパー function c52430902.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(52430902,0)) e1:SetCategory(CATEGORY_CONTROL) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(c52430902.cost) e1:SetTarget(c52430902.target) e1:SetOperation(c52430902.operation) c:RegisterEffect(e1) end function c52430902.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLPCost(tp,1000) end Duel.PayLPCost(tp,1000) end function c52430902.filter1(c) return c:IsFaceup() and c:IsRace(RACE_PSYCHO) and c:GetCode()~=52430902 and c:IsAbleToChangeControler() end function c52430902.filter2(c) return c:IsFaceup() and c:IsAbleToChangeControler() end function c52430902.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c52430902.filter2,tp,0,LOCATION_MZONE,1,nil) and Duel.IsExistingTarget(c52430902.filter1,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g1=Duel.SelectTarget(tp,c52430902.filter1,tp,LOCATION_MZONE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g2=Duel.SelectTarget(tp,c52430902.filter2,tp,0,LOCATION_MZONE,1,1,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g1,2,0,0) end function c52430902.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tc1=g:GetFirst() local tc2=g:GetNext() if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc2:IsFaceup() and tc2:IsRelateToEffect(e) then if Duel.SwapControl(tc1,tc2) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc1:RegisterEffect(e1) local e2=e1:Clone() tc2:RegisterEffect(e2) end end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c100912058.lua
2
3318
--幻煌龍の螺旋絞 --Spiral Hold of the Mythic Radiance Dragon --Script by dest function c100912058.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c100912058.target) e1:SetOperation(c100912058.operation) c:RegisterEffect(e1) --equip limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_EQUIP_LIMIT) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetValue(c100912058.eqlimit) c:RegisterEffect(e2) --Atk up local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(500) c:RegisterEffect(e3) --spsummon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(100912058,0)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DAMAGE) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_BATTLE_DESTROYING) e4:SetRange(LOCATION_SZONE) e4:SetCountLimit(1,100912058) e4:SetCondition(c100912058.spcon) e4:SetTarget(c100912058.sptg) e4:SetOperation(c100912058.spop) c:RegisterEffect(e4) end function c100912058.eqlimit(e,c) return c:IsType(TYPE_NORMAL) end function c100912058.filter(c) return c:IsFaceup() and c:IsType(TYPE_NORMAL) end function c100912058.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and c100912058.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c100912058.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,c100912058.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function c100912058.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) end end function c100912058.spcon(e,tp,eg,ep,ev,re,r,rp) local ec=e:GetHandler():GetEquipTarget() return ec and eg:IsContains(ec) end function c100912058.spfilter(c,e,tp) return c:IsCode(100912028) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c100912058.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c100912058.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) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) end function c100912058.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(c100912058.spfilter),tp,LOCATION_HAND+LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp) if g:GetCount()>0 then local tc=g:GetFirst() if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then Duel.Equip(tp,c,tc) Duel.SpecialSummonComplete() Duel.BreakEffect() Duel.Damage(1-tp,1000,REASON_EFFECT) end end end
gpl-2.0
d-stephane/tpa
command.lua
1
2959
local S = tpa.intllib local P = "" -- Copied from Celeron-55's /teleport command. Thanks Celeron! local function find_free_position_near(pos) local tries = { {x=1,y=0,z=0}, {x=-1,y=0,z=0}, {x=0,y=0,z=1}, {x=0,y=0,z=-1}, } for _,d in pairs(tries) do local p = vector.add(pos, d) if not minetest.registered_nodes[minetest.get_node(p).name].walkable then return p, true end end return pos, false end minetest.register_chatcommand("tpa", { privs = { interact = true }, func = function(name, param) if param == "" then -- Nom du joueur non saisie minetest.show_formspec(name, "tpa:error_empty_player_name", "size[7,2]" .. "label[0,0;" .. S("Attention, please enter the name of the player you wish you teleporter") .. "]" .. "button_exit[0,1;2,1;exit;" .. S("Close") .. "]") return false, "" else -- Verification de la présence du joueur auquel on veut se téléporter local player = minetest.get_player_by_name(param) if not player then -- Joeuur non présent minetest.show_formspec(name, "tpa:error_player_not_connected", "size[7,2]" .. "label[0,0;" .. S("Note that the player you are trying to teleport you is not connected") .. "]" .. "button_exit[0,1;2,1;exit;" .. S("Close") .. "]") return false, "" end -- Le joueur est présent, on affiche une demande de TP minetest.show_formspec(param, "tpa:ok_ask_player", "size[7,2]" .. "label[0,0;\"" .. name .. "\" " .. S("wants to teleport to you") .. "]" .. "button_exit[0,1;2,1;button_yes;" .. S("Yes") .. "]" .. "button_exit[2,1;2,1;button_no;" .. S("No") .. "]") P = name; end return true, "" end }) minetest.register_on_player_receive_fields(function(player, formname, fields) if formname ~= "tpa:ok_ask_player" then -- Le nom du formulaire n'est pas tpa:ok_ask_player, exit return false end local receiver = player:get_player_name() if fields.button_yes then -- Acceptation du TP local sender = minetest.get_player_by_name(P) local pos = player:getpos() sender:setpos(find_free_position_near(pos)) minetest.log("action", "[tpa] Joueur " .. P .. " téléporté vers " .. receiver .. " à la position " .. minetest.serialize(pos)) else -- Refus du TP minetest.show_formspec(P, "tpa:no_tp_cancelled", "size[7,2]" .. "label[0,0;\"" .. receiver .. "\" " .. S("do not want you to teleport to him") .. "]" .. "button_exit[0,1;2,1;exit;" .. S("Close") .. "]") end return true end)
gpl-3.0
Turttle/darkstar
scripts/globals/items/holy_maul_+1.lua
41
1077
----------------------------------------- -- ID: 17114 -- Item: Holy Maul +1 -- Additional Effect: Light Damage ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------- -- onAdditionalEffect Action ----------------------------------- function onAdditionalEffect(player,target,damage) local chance = 10; if (math.random(0,99) >= chance) then return 0,0,0; else local dmg = math.random(7,21); local params = {}; params.bonusmab = 0; params.includemab = false; dmg = addBonusesAbility(player, ELE_LIGHT, target, dmg, params); dmg = dmg * applyResistanceAddEffect(player,target,ELE_LIGHT,0); dmg = adjustForTarget(target,dmg,ELE_LIGHT); dmg = finalMagicNonSpellAdjustments(player,target,ELE_LIGHT,dmg); local message = MSGBASIC_ADD_EFFECT_DMG; if (dmg < 0) then message = MSGBASIC_ADD_EFFECT_HEAL; end return SUBEFFECT_LIGHT_DAMAGE,message,dmg; end end;
gpl-3.0
tdzl2003/luaqt
modules/path/path/impl_posix.lua
1
1189
-- NOTICE: -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. -- -- read COPYRIGHT.md for more informations. local impl = {} local ffi = require("ffi") local C = ffi.C ffi.cdef[[ void* malloc(size_t size); void free(void* data); char* getcwd(char* buffer, int maxlen); ]] function impl.current() local buff = C.malloc(256) local ret = ffi.string(C.getcwd(buff, 256)) C.free(buff) return ret end return impl
bsd-3-clause
kidanger/danimate
danimate/editor.lua
1
8071
local drystal = require 'drystal' local filename = arg[1] if not filename then error 'No filename specified in command line. Aborting.' end package.path = package.path .. ';danimate/?.lua' local Sprite = require 'danimate.Sprite' local Animation = require 'danimate.Animation' local sprite local mouse_drag local zoom = 4 local run = false local font local spritesheet function drystal.init() drystal.resize(300, 300) spritesheet = assert(drystal.load_surface 'spritesheet.png') spritesheet:set_filter(drystal.filters.nearest) font = assert(drystal.load_font('arial.ttf', 14)) local data = dofile(filename) sprite = Sprite.new(0, 0, data.sprite.w, data.sprite.h) sprite:add_parts(data.parts) sprite:add_animations(data.animations) sprite.x = 150 - sprite.w / 2 sprite.y = 150 - sprite.h / 2 if sprite.animations[1] then sprite:set_animation(sprite.animations[1].name) end end local timecontrol = false local timecontrolfrom local paused = false local mx = 0 local my = 0 function drystal.update(dt) if timecontrol then local dt = math.log(1 + (mx - timecontrolfrom) / 900.) / 20. sprite:update(dt) return end if not paused then sprite:update(dt) end if mouse_drag then local mx, my = mousepos() if mouse_drag.master then mouse_drag.part.x = mx - mouse_drag.sprite.x mouse_drag.part.y = my - mouse_drag.sprite.y else local angle = math.atan2(my - mouse_drag.sprite.y - mouse_drag.part.y, mx - mouse_drag.sprite.x - mouse_drag.part.x) mouse_drag.part.angle = angle end sprite.animation:reset_keyframe() end end function drystal.draw() drystal.set_color 'black' drystal.draw_background() drystal.camera.zoom = zoom spritesheet:draw_from() drystal.set_color 'white' sprite:draw() sprite:draw2() drystal.camera.reset() local y = 0 local i = 1 for _, anim in pairs(sprite.animations) do local y = (i - 1) * 14 if anim == sprite.animation then drystal.set_color 'green' local key = sprite.animation.keyframe font:draw(('%d - %s %d'):format(i, anim.name, #anim), 0, y) drystal.set_color 'white' font:draw(('Keyframe %d - %.2f sec'):format(anim.curkey, key.duration), drystal.screen.w-2, 0, drystal.aligns.right) font:draw(key.method, drystal.screen.w-2, 14, drystal.aligns.right) if anim.loop then font:draw('loop', drystal.screen.w-2, 14*2, drystal.aligns.right) end else drystal.set_color 'white' font:draw(('%d - %s %d'):format(i, anim.name, #anim), 0, y) end i = i + 1 end if timecontrol then drystal.set_color 'orange' drystal.set_line_width(5) drystal.draw_line(mx, my, timecontrolfrom, my) end drystal.camera.zoom = zoom end function drystal.mouse_motion(x, y, dx, dy) mx = x my = y end function drystal.mouse_release(_, _, b) mouse_drag = nil if b == drystal.buttons.right then timecontrol = false paused = true end end function drystal.mouse_press(x, y, b) if b == drystal.buttons.wheel_down then zoom = zoom * 0.9 elseif b == drystal.buttons.wheel_up then zoom = zoom * 1.1 elseif b == drystal.buttons.right then run = false timecontrol = true timecontrolfrom = x pause = true else local s = sprite for _, p in ipairs(s.parts) do local p1 = {x=p.x, y=p.y} local p2 = { x=p.x + math.cos(p.angle) * p.dist, y=p.y + math.sin(p.angle) * p.dist, } if point_hovered(s.x + p1.x, s.y + p1.y, p.radius) then mouse_drag = {master=true, part=p, sprite=s} elseif point_hovered(s.x + p2.x, s.y + p2.y, p.radius) then mouse_drag = {slave=true, part=p, sprite=s} end local key = sprite.animation.keyframe.key[p.name] or {x=0,y=0,angle=0} local p1b = {x=key.x, y=key.y} local p2b = { x=key.x + math.cos(key.angle) * p.dist, y=key.y + math.sin(key.angle) * p.dist, } if point_hovered(s.x + p1b.x, s.y + p1b.y, p.radius) then mouse_drag = {master=true, part=key, sprite=s} elseif point_hovered(s.x + p2b.x, s.y + p2b.y, p.radius) then mouse_drag = {slave=true, part=key, sprite=s} end end end end local function save() sprite:set_dir(1) local file = io.open(filename, 'w') local function w(line, ...) file:write(line:format(...)) file:write('\n') end w('local parts={') for _, part in ipairs(sprite.parts) do w('\t{') w('\t\tname=%q,', part.name) w('\t\tsprite={x=%d, y=%d, w=%d, h=%d},', part.sprite.x, part.sprite.y, part.sprite.w, part.sprite.h) if part.swapwith then w('\t\tswapwith=%q,', part.swapwith) end w('\t},') end w('}') w('local animations = {') local n = 0 for _, anim in pairs(sprite.animations) do w('\t%s,', anim) n = n + 1 end w('}') w('return {') w('\tsprite={w=%d, h=%d},', sprite.w, sprite.h) w('\tparts=parts,') w('\tanimations=animations') w('}') file:close() print(('%d animations saved to %s'):format(n, filename)) end local function get_name() local name repeat io.write("Animation name: ") io.flush() name = io.read() until #name > 0 and not sprite.indexes[name] return name end local function get_name_of_animation() local name repeat for _, anim in ipairs(sprite.animations) do io.write(anim.name) io.write(', ') end io.write("\nCopy of: ") io.flush() name = io.read() until sprite.indexes[name] return name end print([[ Commands: s - save right - next frame left - previous frame down - next animation up - previous animation c - new keyframe from current one b - new empty animation n - new animation from an existing one d - delete keyframe space - toggle run -/+ - modify keyframe duration m - change tweening method l - toggle animation loop f - toggle direction ]]) function drystal.key_press(k) if k == 's' then save() elseif k == 'right' then sprite.animation:next_keyframe() sprite.animation:reset_keyframe() run = false elseif k == 'left' then sprite.animation:previous_keyframe() sprite.animation:reset_keyframe() run = false elseif k == 'up' then local index = (sprite.indexes[sprite.animation.name] - 2) % #sprite.animations + 1 sprite:set_animation(sprite.animations[index].name) paused = false elseif k == 'down' then local index = sprite.indexes[sprite.animation.name] % #sprite.animations + 1 sprite:set_animation(sprite.animations[index].name) paused = false elseif k == 'c' then sprite.animation:copy_keyframe() elseif k == 'b' then local name = get_name() local a = Animation.new_from_sprite(sprite) a.name = name sprite:add_animation(a) sprite:set_animation(name) elseif k == 'n' then local name = get_name() local a = sprite.animations[sprite.indexes[get_name_of_animation()]]:copy() a.name = name sprite:add_animation(a) sprite:set_animation(name) elseif k == 'd' then sprite.animation:delete_keyframe() elseif k == 'space' then paused = false run = not run if not run then sprite:stop_animation() else sprite:start_animation() end elseif k == 'm' then local methods = {linear=1, inOutCubic=1, outInCubic=1, inBack=1} local oldmeth = sprite.animation.keyframe.method local nextmeth = table.next(methods, oldmeth) sprite.animation.keyframe.method = nextmeth elseif k == 'l' then sprite.animation.loop = not sprite.animation.loop elseif k == 'f' then sprite:set_dir(sprite.dir * -1) elseif k == '[+]' then sprite.animation.keyframe.duration = sprite.animation.keyframe.duration + 0.05 elseif k == '[-]' then sprite.animation.keyframe.duration = sprite.animation.keyframe.duration - 0.01 if sprite.animation.keyframe.duration <= 0 then sprite.animation.keyframe.duration = 0.1 end elseif k == 'escape' then drystal.stop() else --print(k, 'unknown command') end end function drystal.key_text(k) local i = tonumber(k) if i and sprite.animations[i] then sprite:set_animation(sprite.animations[i].name) run = true end end function point_hovered(x, y, radius) local mx, my = mousepos() local d = math.sqrt((x - mx) ^ 2 + (y - my) ^ 2) return d <= radius end function mousepos() return drystal.screen2scene(mx, my) end
mit
SalvationDevelopment/Salvation-Scripts-TCG
c42737833.lua
5
1346
--XX-セイバー エマーズブレイド function c42737833.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(42737833,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(c42737833.condition) e1:SetTarget(c42737833.target) e1:SetOperation(c42737833.operation) c:RegisterEffect(e1) end function c42737833.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function c42737833.filter(c,e,tp) return c:GetLevel()<=4 and c:IsSetCard(0x100d) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c42737833.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c42737833.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c42737833.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,c42737833.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
c97219708.lua
2
4306
--RR-ラスト・ストリクス function c97219708.initial_effect(c) --recover local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(97219708,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetRange(LOCATION_HAND) e1:SetCondition(c97219708.reccon) e1:SetTarget(c97219708.rectg) e1:SetOperation(c97219708.recop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(97219708,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,97219708) e2:SetCost(c97219708.spcost) e2:SetTarget(c97219708.sptg) e2:SetOperation(c97219708.spop) c:RegisterEffect(e2) end function c97219708.reccon(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() local at=Duel.GetAttackTarget() return (tc:IsControler(tp) and tc:IsSetCard(0xba)) or (at and at:IsControler(tp) and at:IsSetCard(0xba)) end function c97219708.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and not e:GetHandler():IsStatus(STATUS_CHAINING) and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,1,nil,TYPE_SPELL+TYPE_TRAP) end local ct=Duel.GetMatchingGroupCount(Card.IsType,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,TYPE_SPELL+TYPE_TRAP) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,ct*100) end function c97219708.recop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then local ct=Duel.GetMatchingGroupCount(Card.IsType,tp,LOCATION_ONFIELD+LOCATION_GRAVE,0,nil,TYPE_SPELL+TYPE_TRAP) if ct>0 then Duel.BreakEffect() Duel.Recover(tp,ct*100,REASON_EFFECT) end end end function c97219708.spfilter(c,e,tp) return c:IsType(TYPE_XYZ) and c:IsSetCard(0xba) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c97219708.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsReleasable() end Duel.Release(e:GetHandler(),REASON_COST) end function c97219708.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingMatchingCard(c97219708.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function c97219708.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,c97219708.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e2) local fid=c:GetFieldID() tc:RegisterFlagEffect(97219708,RESET_EVENT+0x1fe0000,0,1,fid) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCountLimit(1) e3:SetLabel(fid) e3:SetLabelObject(tc) e3:SetCondition(c97219708.tdcon) e3:SetOperation(c97219708.tdop) Duel.RegisterEffect(e3,tp) Duel.SpecialSummonComplete() end end local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetTargetRange(0,1) e4:SetValue(1) e4:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e4,tp) end function c97219708.tdcon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:GetFlagEffectLabel(97219708)==e:GetLabel() then return true else e:Reset() return false end end function c97219708.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.SendtoDeck(tc,nil,2,REASON_EFFECT) end
gpl-2.0
dickeyf/darkstar
scripts/zones/Bastok_Markets_[S]/npcs/Adelbrecht.lua
53
4980
----------------------------------- -- Area: Bastok Markets (S) -- NPC: Adelbrecht -- Starts Quests: The Fighting Fourth -- Involved in Missions: Back to the Beginning -- CS IDs: -- 139 = 0x008B = Greetings, civilian. The Seventh Cohors of the Republican Legion's Fourth Division is currently recruiting new troops. -- 140 = 0x008C = I thought you didn't have any questions...throw in the towel yes/no -- 141 = 0x008D = Mid quest, after first npc in N Gust -- 142 = 0x008E = Mid quest, after second npc in N Gust -- 143 = 0x008F = Complete quest, get bronze ribbon -- 162 = 0x00A2 = After cs143, before heading over to talk to next person -- 359 = 0x0167 = A CS where player is looking for Lilisette, with flashback of Lilisette asking about player -- 361 = 0x0169 = After asking in CS 359 -- Todo: medal loss from nation switching. Since there is no rank-up yet, this isn't so important for now. ----------------------------------- package.loaded["scripts/zones/Bastok_Markets_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/titles"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/zones/Bastok_Markets_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local Allegiance = player:getCampaignAllegiance(); -- 0 = none, 1 = San d'Oria Iron Rams, 2 = Bastok Fighting Fourth, 3 = Windurst Cobras local TheFightingFourth = player:getQuestStatus(CRYSTAL_WAR,THE_FIGHTING_FOURTH); local SnakeOnThePlains = player:getQuestStatus(CRYSTAL_WAR,SNAKE_ON_THE_PLAINS); local SteamedRams = player:getQuestStatus(CRYSTAL_WAR,STEAMED_RAMS); local BlueLetter = player:hasKeyItem(BLUE_RECOMMENDATION_LETTER); local BattleRations = player:hasKeyItem(BATTLE_RATIONS); if (TheFightingFourth == QUEST_AVAILABLE and BlueLetter == true) then player:startEvent(0x008B); elseif (TheFightingFourth == QUEST_AVAILABLE and player:getVar("BLUE_R_LETTER_USED") == 1) then player:startEvent(0x008B); elseif (TheFightingFourth == QUEST_ACCEPTED and BattleRations == true) then player:startEvent(0x008C); elseif (TheFightingFourth == QUEST_ACCEPTED and player:getVar("THE_FIGHTING_FOURTH") == 1) then player:startEvent(0x008D); elseif (TheFightingFourth == QUEST_ACCEPTED and player:getVar("THE_FIGHTING_FOURTH") == 2) then player:startEvent(0x008E); elseif (TheFightingFourth == QUEST_ACCEPTED and player:getVar("THE_FIGHTING_FOURTH") == 3) then player:startEvent(0x008F); elseif (TheFightingFourth == QUEST_COMPLETED and Allegiance == 1) then player:startEvent(0x00A2); 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 == 0x008B and option == 1) then player:addKeyItem(BATTLE_RATIONS); player:messageSpecial(KEYITEM_OBTAINED,BATTLE_RATIONS); player:addQuest(CRYSTAL_WAR,THE_FIGHTING_FOURTH); player:setVar("BLUE_R_LETTER_USED",1); player:delKeyItem(BLUE_RECOMMENDATION_LETTER); elseif (csid == 0x008C and option == 1) then player:delKeyItem(BATTLE_RATIONS); player:delQuest(CRYSTAL_WAR, THE_FIGHTING_FOURTH); elseif (csid == 0x008D or csid == 0x008E and option == 1) then player:delQuest(CRYSTAL_WAR, THE_FIGHTING_FOURTH); elseif (csid == 0x008F) then -- Is first join, so add Sprinter's Shoes and bronze medal if (player:getVar("Campaign_Nation") == 0) then if (player:getFreeSlotsCount() >= 1) then player:setCampaignAllegiance(2); player:setVar("BLUE_R_LETTER_USED",0); player:addTitle(FOURTH_DIVISION_SOLDIER); player:addKeyItem(BRONZE_RIBBON_OF_SERVICE); player:addItem(15754); player:completeQuest(CRYSTAL_WAR,THE_FIGHTING_FOURTH); player:messageSpecial(KEYITEM_OBTAINED, BRONZE_RIBBON_OF_SERVICE); player:messageSpecial(ITEM_OBTAINED, 15754); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 15754); end else player:setCampaignAllegiance(2); player:setVar("BLUE_R_LETTER_USED",0); player:addTitle(FOURTH_DIVISION_SOLDIER); player:completeQuest(CRYSTAL_WAR,THE_FIGHTING_FOURTH); end end end;
gpl-3.0
dickeyf/darkstar
scripts/globals/items/serving_of_herb_quus.lua
18
1383
----------------------------------------- -- ID: 4559 -- Item: serving_of_herb_quus -- Food Effect: 180Min, All Races ----------------------------------------- -- Dexterity 1 -- Mind -1 -- Ranged ACC % 7 -- Ranged ACC Cap 10 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,4559); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 1); target:addMod(MOD_MND, -1); target:addMod(MOD_FOOD_RACCP, 7); target:addMod(MOD_FOOD_RACC_CAP, 10); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 1); target:delMod(MOD_MND, -1); target:delMod(MOD_FOOD_RACCP, 7); target:delMod(MOD_FOOD_RACC_CAP, 10); end;
gpl-3.0
Lestrigon17/zombieplague
framework/sh_round.lua
1
10765
zm.round = zm.round or {} zm.round.EndTimeScale = 15 -- Don't touch ROUND_STATE = ROUND_STATE or 1 ROUND_NEW = 0 ROUND_PREPARE = 1 ROUND_ACTIVE = 2 ROUND_END = 3 ROUND_EXIT = 4 ROUND_FREE = 5 -- Only 1 active player ROUND_HOLD = 6 -- No active players ROUND_HOLD_TiME = {{"Initial", 20}} ROUND_VARS = ROUND_VARS or {} ROUND_VARS["StartRoundTime"] = ROUND_VARS["StartRoundTime"] or 0 ROUND_VARS["EndRoundTime"] = ROUND_VARS["EndRoundTime"] or 0 ROUND_VARS["RoundLenght"] = zm.cfg.roundlength ROUND_VARS["RoundNum"] = ROUND_VARS["RoundNum"] or 0 ROUND_VARS["ShouldShowTime"] = ROUND_VARS["ShouldShowTime"] or false -- Always shows 00:00 remaning ROUND_VARS["HumansWins"] = ROUND_VARS["HumansWins"] or 0; ROUND_VARS["ZombiesWins"] = ROUND_VARS["ZombiesWins"] or 0; if SERVER then function zm.round:AddHoldTime(hookName, time) table.insert(ROUND_HOLD_TiME, {hookName, tonumber(time)}) end function zm.round:StartRound(STATE) STATE = STATE or ROUND_NEW game.CleanUpMap() ROUND_VARS["StartRoundTime"] = 0 ROUND_VARS["EndRoundTime"] = 0 if STATE == ROUND_NEW then ROUND_VARS["RoundNum"] = ROUND_VARS["RoundNum"] + 1 end --MSG of round State local msg = STATE == ROUND_NEW and zm.language[zm.cfg.lang].round.new or STATE == ROUND_HOLD and zm.language[zm.cfg.lang].round.startH or zm.language[zm.cfg.lang].round.startF zm:SendMessage(_, {msg}, 7) --MSG of round State msg = zm.language[zm.cfg.lang].round.remaning msg = string.Replace(msg,"%a",ROUND_VARS["RoundNum"]) msg = string.Replace(msg,"%b","9999") zm:SendMessage(_, {msg}, 3) ROUND_STATE = STATE netstream.Start(_, "zm:round:stream", STATE) hook.Call("zm:round:change", zm, STATE) end function zm.round:PrepareRound() for k,v in pairs(zm:playerGetAll()) do if (v:Team() != TEAM_HUMAN) then v:MakeHuman(); end v.CanRespawn = true; end; for k,v in pairs(zm:playerGetAll()) do if (v:Alive()) then v:Spawn(); continue; end; v:Spawn(); GAMEMODE:PlayerLoadout(v); end netstream.Start(_, "zm:hud:notification", "%brown%T-Virus %twhite% был выпущен в воздух"); for k, v in pairs(zm:playerGetAll()) do zm.weapon:OpenWeaponMenu(v); v:MakeHumansVars(); end; --MSG of round State local msg = zm.language[zm.cfg.lang].round.begin zm:SendMessage(_, {msg}, 1) ROUND_STATE = ROUND_PREPARE netstream.Start(_, "zm:round:stream", ROUND_PREPARE) hook.Call("zm:round:change", zm, ROUND_PREPARE) end function zm.round:GoRound() for k,v in pairs(zm:playerGetAll()) do if v:Alive() then v:MakeHumansVars(); v:UnLock(); continue; end; if !v.CanRespawn then continue; end; v:Spawn(); end; death = table.Random(zm:playerGetAll(true)); death:MakeZombie(true); netstream.Start(_, "zm:hud:notification", "%brown%T-Virus %twhite%поглотил мозги %brown%"..death:Name()..""); for k,v in pairs(zm:playerGetAll()) do v.DeathBlock = math.Clamp((v.DeathBlock or 0) - 1, 0, 10); end; death.DeathBlock = (death.DeathBlock or 0) + 1; ROUND_VARS["StartRoundTime"] = CurTime(); ROUND_VARS["ShouldShowTime"] = true; --MSG of round State local msg = zm.language[zm.cfg.lang].round.start; zm:SendMessage(_, {msg}, 1); ROUND_STATE = ROUND_ACTIVE; netstream.Start(_, "zm:round:stream", ROUND_ACTIVE); hook.Call("zm:round:change", zm, ROUND_ACTIVE); end; function zm.round:EndRound(winTeam) winTeam = winTeam or TEAM_SPECTATOR ROUND_VARS["ShouldShowTime"] = false --MSG of round State local msg = "" if winTeam == TEAM_SPECTATOR then msg = zm.language[zm.cfg.lang].round.none else if (winTeam == TEAM_ZOMBIE) then msg = "zombie win" ROUND_VARS["ZombiesWins"] = ROUND_VARS["ZombiesWins"] + 1; else for k, v in pairs(zm:playerGetAll()) do if (v:Team() == TEAM_ZOMBIE and v:Alive()) then v:Kill(); end; end; msg = "humans win" ROUND_VARS["HumansWins"] = ROUND_VARS["HumansWins"] + 1; end end zm:SendMessage(_, (istable(msg) and {unpack(msg)} or {msg}), 2) msg = zm.language[zm.cfg.lang].round.out zm:SendMessage(_, {msg}, 5) game.SetTimeScale(1) timer.Simple(zm.round.EndTimeScale/1, function() game.SetTimeScale(1) end) ROUND_STATE = ROUND_END netstream.Start(_, "zm:round:stream", {ROUND_END, {winTeam}}) hook.Call("zm:round:change", zm, ROUND_END, {winTeam}) end function zm.round:ExitRound() for k,v in pairs(zm:playerGetAll()) do v:SetHealth(100); end ROUND_VARS["ShouldShowTime"] = false ROUND_STATE = ROUND_EXIT netstream.Start(_, "zm:round:stream", ROUND_EXIT) hook.Call("zm:round:change", zm, ROUND_EXIT) end function zm.round:GetState() return ROUND_STATE end concommand.Add("zm_GetRoundState", function(ply,cmd,args) if IsValid(ply) then return end print(zm.round:GetState()) end) concommand.Add("zm_GetRoundActivePlayers", function(ply,cmd,args) if IsValid(ply) then return end print(#zm:playerGetAll()) end) function zm.round:Controller() local plyForFree = (#zm:playerGetAll() > 0 and #zm:playerGetAll() < 2) and true or false local plyForStart = #zm:playerGetAll() >= 2 and true or false /*--------------------------------------------------------------------------- FreeRound ---------------------------------------------------------------------------*/ if ROUND_STATE == ROUND_FREE then for k,v in pairs(zm:playerGetAll()) do if v:Alive() then continue end v:Spawn() game.CleanUpMap() end end /*--------------------------------------------------------------------------- Round Game Controller ---------------------------------------------------------------------------*/ if ROUND_STATE == ROUND_ACTIVE and CurTime() > (ROUND_VARS["StartRoundTime"] + ROUND_VARS["RoundLenght"]) then self:EndRound(TEAM_HUMAN); ROUND_VARS["EndRoundTime"] = CurTime(); --MSG of round State local msg = zm.language[zm.cfg.lang].round.outtime; zm:SendMessage(_, {msg}, 1); end if ROUND_STATE == ROUND_END and (CurTime() - zm.round.EndTimeScale/1) > ROUND_VARS["EndRoundTime"] then self:ExitRound(); if not plyForStart then if not plyForFree then self:StartRound(ROUND_HOLD); else self:StartRound(ROUND_FREE); end; else self:StartRound(ROUND_NEW); end; end; local AZombie = 0; local AHuman = 0; for k,v in pairs(zm:playerGetAll()) do if v:Team() == TEAM_ZOMBIE and v:Alive() then AZombie = AZombie + 1; elseif v:Team() == TEAM_HUMAN and v:Alive() then AHuman = AHuman + 1; end; end; if AZombie == 0 and AHuman == 0 and ROUND_STATE == ROUND_ACTIVE then ROUND_VARS["EndRoundTime"] = CurTime() self:EndRound(TEAM_SPECTATOR) end; if AZombie == 0 and ROUND_STATE == ROUND_ACTIVE then ROUND_VARS["EndRoundTime"] = CurTime() self:EndRound(TEAM_HUMAN) end; if AHuman == 0 and ROUND_STATE == ROUND_ACTIVE then ROUND_VARS["EndRoundTime"] = CurTime() self:EndRound(TEAM_ZOMBIE) end; /*--------------------------------------------------------------------------- Round Prepare Controller ---------------------------------------------------------------------------*/ if ROUND_STATE == ROUND_NEW then for k,v in pairs(player.GetAll()) do if v:Team() != TEAM_SPECTATOR and v.ChangeToNormal != true then continue end v:SetTeam(TEAM_HUMAN) end self:PrepareRound() if timer.Exists("zm:round:PrepareTimer") then timer.Remove("zm:round:PrepareTimer") end local maxTime = 0 for k,v in pairs(ROUND_HOLD_TiME) do timer.Simple(v[2], function() hook.Call("zm:round:preapreState:"..v[1], zm) netstream.Start(_,"zm:round:preapreState", v[1]) end) maxTime = maxTime + v[2] end netstream.Start(_,"zm:round:PrepareTimer", maxTime) hook.Call("zm:round:PrepareTimer", zm, data) timer.Create("zm:round:PrepareTimer", maxTime+1, 1, function() if ROUND_STATE != ROUND_PREPARE then return end for k,v in pairs(zm:playerGetAll()) do if v:Alive() then continue end if !v.CanRespawn then continue end v:Spawn() end self:GoRound() end) end /*--------------------------------------------------------------------------- Round Hold Controller ---------------------------------------------------------------------------*/ if ROUND_STATE > ROUND_NEW and ROUND_STATE < ROUND_EXIT then if not plyForStart then self:ExitRound() if not plyForFree then self:StartRound(ROUND_HOLD) else self:StartRound(ROUND_FREE) end end elseif ROUND_STATE == ROUND_HOLD and plyForFree then self:ExitRound() self:StartRound(ROUND_FREE) elseif ROUND_STATE == ROUND_FREE and plyForStart then self:ExitRound() self:StartRound(ROUND_NEW) end end hook.Add("Think", "zm:round:controller", function() zm.round:Controller() end) netstream.Hook("zm:GetRoundInfo", function(ply, data) netstream.Start(ply, "zm:ReciveRoundInfo", {ROUND_VARS, ROUND_STATE}) end) else /*--------------------------------------------------------------------------- Prepare hooks ---------------------------------------------------------------------------*/ netstream.Hook("zm:round:preapreState", function(name) if !isstring(name) then zm:PrintMessage({zm.language[zm.cfg.lang]["round"].ErrorTimerInitialize}, 5) return end hook.Call("zm:round:preapreState:"..name, zm) end) /*--------------------------------------------------------------------------- Round Info ---------------------------------------------------------------------------*/ netstream.Hook("zm:ReciveRoundInfo", function(data) ROUND_VARS = data[1] ROUND_STATE = data[2] end) netstream.Hook("zm:round:stream", function(data) if istable(data) then ROUND_STATE = data[1] hook.Call("zm:round:change", zm, data[1], data[2]) else ROUND_STATE = data hook.Call("zm:round:change", zm, data) end netstream.Start("zm:GetRoundInfo") end) netstream.Hook("zm:round:PrepareTimer", function(data) hook.Call("zm:round:PrepareTimer", zm, data) end) /*--------------------------------------------------------------------------- Controller ---------------------------------------------------------------------------*/ ROUND_INFO_LOADED = ROUND_INFO_LOADED or false function zm.round:Controller() --[[------------------------------------------------------------------------- First Load ---------------------------------------------------------------------------]] if not ROUND_INFO_LOADED then -- Request to get info netstream.Start("zm:GetRoundInfo") ROUND_INFO_LOADED = true end end hook.Add("Think", "zm:round:controller", function() zm.round:Controller() end) end hook.Call("zm:module:rounds", zm) -- Says that round module is initialized (for func[AddHoldTime])
gpl-3.0
dickeyf/darkstar
scripts/zones/Konschtat_Highlands/npcs/qm2.lua
13
1465
----------------------------------- -- Area: Konschtat Highlands -- NPC: qm2 (???) -- Involved in Quest: Forge Your Destiny -- @pos -709 2 102 108 ----------------------------------- package.loaded["scripts/zones/Konschtat_Highlands/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Konschtat_Highlands/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(OUTLANDS,FORGE_YOUR_DESTINY) == QUEST_ACCEPTED) then if (trade:getItemCount() == 1 and trade:hasItemQty(1151,1) and GetMobAction(17219999) == 0) then -- Oriental Steel SpawnMob(17219999, 300):updateClaim(player); -- Spawn Forger, Despawn after inactive for 5 minutes player:tradeComplete(); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID2: %u",csid); --printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c42216237.lua
2
1801
--ゼラの天使 function c42216237.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1) c:EnableReviveLimit() -- local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(c42216237.atkval) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_REMOVE) e2:SetOperation(c42216237.spreg) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(42216237,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetRange(LOCATION_REMOVED) e3:SetCode(EVENT_PHASE+PHASE_STANDBY) e3:SetCountLimit(1,42216237) e3:SetCondition(c42216237.spcon) e3:SetTarget(c42216237.sptg) e3:SetOperation(c42216237.spop) e3:SetLabelObject(e2) c:RegisterEffect(e3) end function c42216237.atkval(e,c) return Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_REMOVED)*100 end function c42216237.spreg(e,tp,eg,ep,ev,re,r,rp) e:SetLabel(Duel.GetTurnCount()) e:GetHandler():RegisterFlagEffect(42216237,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,2) end function c42216237.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return e:GetLabelObject():GetLabel()~=Duel.GetTurnCount() and c:GetFlagEffect(42216237)>0 end function c42216237.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) c:ResetFlagEffect(42216237) end function c42216237.spop(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
gpl-2.0
Turttle/darkstar
scripts/zones/Balgas_Dais/npcs/Armoury_Crate.lua
36
1024
----------------------------------- -- Area: Balgas Dais -- NPC: Armoury Crate -- Balgas Dais Burning Cicrcle Armoury Crate ----------------------------------- package.loaded["scripts/zones/Balgas_Dais/TextIDs"] = nil; ------------------------------------- require("scripts/globals/titles"); require("scripts/globals/quests"); require("scripts/zones/Balgas_Dais/TextIDs"); ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:getBCNMloot(); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) end;
gpl-3.0
dickeyf/darkstar
scripts/globals/spells/paralyga.lua
21
1694
----------------------------------------- -- Spell: Paralyze -- Spell accuracy is most highly affected by Enfeebling Magic Skill, Magic Accuracy, and MND. ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) if (target:hasStatusEffect(EFFECT_PARALYSIS)) then --effect already on, do nothing spell:setMsg(75); else -- Calculate duration. local duration = math.random(20,120); -- Grabbing variables for paralyze potency local pMND = caster:getStat(MOD_MND); local mMND = target:getStat(MOD_MND); local dMND = (pMND - mMND); -- Calculate potency. local potency = (pMND + dMND)/5; --simplified from (2 * (pMND + dMND)) / 10 if potency > 30 then potency = 30; end --printf("Duration : %u",duration); --printf("Potency : %u",potency); local resist = applyResistanceEffect(caster,spell,target,dMND,35,0,EFFECT_PARALYSIS); if (resist >= 0.5) then --there are no quarter or less hits, if target resists more than .5 spell is resisted completely if (target:addStatusEffect(EFFECT_PARALYSIS,potency,0,duration*resist)) then spell:setMsg(236); else -- no effect spell:setMsg(75); end else -- resist spell:setMsg(85); end end return EFFECT_PARALYSIS; end;
gpl-3.0
Turttle/darkstar
scripts/globals/items/plate_of_salmon_sushi_+1.lua
35
1480
----------------------------------------- -- ID: 5664 -- Item: plate_of_salmon_sushi_+1 -- Food Effect: 60Min, All Races ----------------------------------------- -- Strength 2 -- Accuracy % 15 -- Ranged ACC % 15 ----------------------------------------- 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,3600,5663); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, 2); target:addMod(MOD_FOOD_ACCP, 15); target:addMod(MOD_FOOD_ACC_CAP, 999); target:addMod(MOD_FOOD_RACCP, 15); target:addMod(MOD_FOOD_RACC_CAP, 999); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, 1); target:delMod(MOD_FOOD_ACCP, 15); target:delMod(MOD_FOOD_ACC_CAP, 999); target:delMod(MOD_FOOD_RACCP, 15); target:delMod(MOD_FOOD_RACC_CAP, 999); end;
gpl-3.0
alobaidy98/ahmed..alobaidy
plugins/ar-robot.lua
1
2578
--[[ ▀▄ ▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀▄▀▄▄▀▀▄▄▀▀▄▄▀▀▄▄▀▀ ▀▄ ▄▀ ▀▄ ▄▀ ▀▄ ▄▀ BY AHMED ALOBAIDY ▀▄ ▄▀ ▀▄ ▄▀ BY AHMED ALOBAIDY (@A7mEd_B98) ▀▄ ▄▀ ▀▄ ▄▀ JUST WRITED BY AHMED ALOBAIDY ▀▄ ▄▀ ▀▄ ▄▀disable chat: تعطيل تفعيل دردشه محدد ▀▄ ▄▀ ▀▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀▄▄▀▀▄▄▀▄▄▀▀ --]] local function is_channel_disabled( receiver ) if not _config.disabled_channels then return false end if _config.disabled_channels[receiver] == nil then return false end return _config.disabled_channels[receiver] end local function enable_channel(receiver) if not _config.disabled_channels then _config.disabled_channels = {} end if _config.disabled_channels[receiver] == nil then return '😊 اَلـبـِوتَ بأَلتأكيَدَ تمَ تشَغيِلهَ ب أَلمجموعـهِ ✔️👍🏻' end _config.disabled_channels[receiver] = false save_config() return "تَمِ ✔️ تشغـيَل البوَتَ في المَجمَوعـهَ 👍" end local function disable_channel( receiver ) if not _config.disabled_channels then _config.disabled_channels = {} end _config.disabled_channels[receiver] = true save_config() return "تَمِ ✔️ أطـفأءَ الـبوَتَ فـي أَلمجـموَعـهَ 👍🏻❌" end local function pre_process(msg) local receiver = get_receiver(msg) -- If sender is moderator then re-enable the channel --if is_sudo(msg) then if is_momod(msg) then if msg.text == "تشغيل البوت" then enable_channel(receiver) end end if is_channel_disabled(receiver) then msg.text = "" end return msg end local function run(msg, matches) local receiver = get_receiver(msg) -- Enable a channel if matches[1] == 'تشغيل البوت' then return enable_channel(receiver) end -- Disable a channel if matches[1] == 'اطفاء البوت' then return disable_channel(receiver) end end return { description = "Plugin to manage Bot.", usage = { "Bot on: enable BOT In a Group", "Bot off: disable Bot In a Group" }, patterns = { "^(تشغيل البوت)", "^(اطفاء البوت)" }, run = run, privileged = true, --moderated = true, pre_process = pre_process }
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c76067258.lua
2
2678
--No.66 覇鍵甲虫マスター・キー・ビートル function c76067258.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),4,2) c:EnableReviveLimit() --target local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(76067258,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(c76067258.cost) e1:SetTarget(c76067258.target) e1:SetOperation(c76067258.operation) c:RegisterEffect(e1) --desrep local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_DESTROY_REPLACE) e3:SetRange(LOCATION_MZONE) e3:SetTarget(c76067258.reptg) c:RegisterEffect(e3) end c76067258.xyz_number=66 function c76067258.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function c76067258.filter(c,ec) return not ec:IsHasCardTarget(c) end function c76067258.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc~=c and c76067258.filter(chkc,c) end if chk==0 then return Duel.IsExistingTarget(c76067258.filter,tp,LOCATION_ONFIELD,0,1,c,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,c76067258.filter,tp,LOCATION_ONFIELD,0,1,1,c,c) end function c76067258.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then c:SetCardTarget(tc) tc:RegisterFlagEffect(76067258,RESET_EVENT+0x1fe0000,0,0) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_OWNER_RELATE) e2:SetCondition(c76067258.indcon) e2:SetValue(1) e2:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e2) end end function c76067258.indcon(e) return e:GetOwner():IsHasCardTarget(e:GetHandler()) end function c76067258.repfilter(c,tp) return c:IsControler(tp) and c:GetFlagEffect(76067258)~=0 end function c76067258.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetCardTarget():IsExists(c76067258.repfilter,1,nil,tp) end if Duel.SelectYesNo(tp,aux.Stringid(76067258,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=e:GetHandler():GetCardTarget():FilterSelect(tp,c76067258.repfilter,1,1,nil,tp) Duel.SendtoGrave(g,REASON_EFFECT) return true else return false end end
gpl-2.0
Turttle/darkstar
scripts/commands/addallmaps.lua
24
1550
--------------------------------------------------------------------------------------------------- -- func: addallmaps -- desc: Adds all maps to the given player. --------------------------------------------------------------------------------------------------- cmdprops = { permission = 1, parameters = "s" }; function onTrigger(player, target) local keyIds = { 383, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1898, 1899, 1900, 1901, 1902, 1903, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, 2302, 2303, 2304, 2305 }; if (target == nil) then target = player:getName(); end local targ = GetPlayerByName( target ); if (targ ~= nil) then for _, v in ipairs( keyIds ) do targ:addKeyItem( v ); end else for _, v in ipairs( keyIds ) do player:addKeyItem( v ); end end end
gpl-3.0
SalvationDevelopment/Salvation-Scripts-TCG
c30643162.lua
5
1111
--ストライク・ショット function c30643162.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetTarget(c30643162.target) e1:SetOperation(c30643162.activate) c:RegisterEffect(e1) end function c30643162.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tg=Duel.GetAttacker() if chkc then return chkc==tg end if chk==0 then return tg:IsControler(tp) and tg:IsOnField() and tg:IsCanBeEffectTarget(e) end Duel.SetTargetCard(tg) end function c30643162.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() 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:SetValue(700) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_PIERCE) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e2) end end
gpl-2.0
SalvationDevelopment/Salvation-Scripts-TCG
c15305240.lua
6
1347
--鹵獲装置 function c15305240.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_CONTROL) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c15305240.target) e1:SetOperation(c15305240.activate) c:RegisterEffect(e1) end function c15305240.filter(c) return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsAbleToChangeControler() end function c15305240.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c15305240.filter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,nil) end Duel.SetOperationInfo(0,CATEGORY_CONTROL,nil,0,0,0) end function c15305240.activate(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsExistingMatchingCard(c15305240.filter,tp,LOCATION_MZONE,0,1,nil) or not Duel.IsExistingMatchingCard(Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,nil) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g1=Duel.SelectMatchingCard(tp,c15305240.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.HintSelection(g1) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONTROL) local g2=Duel.SelectMatchingCard(1-tp,Card.IsAbleToChangeControler,1-tp,LOCATION_MZONE,0,1,1,nil) Duel.HintSelection(g2) local c1=g1:GetFirst() local c2=g2:GetFirst() Duel.SwapControl(c1,c2,0,0) end
gpl-2.0
dickeyf/darkstar
scripts/zones/Southern_San_dOria/npcs/Ullasa.lua
13
1686
----------------------------------- -- Area: Southern San d'Oria -- NPC: Ullasa -- General Info NPC ------------------------------------- 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) -- "Flyers for Regine" conditional script local FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then local count = trade:getItemCount(); local 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) if player:getVar("UnderOathCS") == 2 then -- Quest: Under Oath - PLD AF3 player:startEvent(0x028); else player:startEvent(0x027); 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 == 0x028) then player:setVar("UnderOathCS", 3) -- Quest: Under Oath - PLD AF3 end end;
gpl-3.0