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
waytim/darkstar
scripts/zones/The_Shrouded_Maw/npcs/MementoCircle.lua
13
1441
----------------------------------- -- Area: The_Shrouded_Maw -- NPC: MementoCircle ----------------------------------- package.loaded["scripts/zones/The_Shrouded_Maw/TextIDs"] = nil; ----------------------------------- require("scripts/globals/bcnm"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/zones/The_Shrouded_Maw/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (TradeBCNM(player,player:getZoneID(),trade,npc)) then return; end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (EventTriggerBCNM(player,npc)) then return 1; else return 1; end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("onUpdate CSID: %u",csid); --printf("onUpdate RESULT: %u",option); if (EventUpdateBCNM(player,csid,option)) then return; end end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --printf("onFinish CSID: %u",csid); --printf("onFinish RESULT: %u",option); if (EventFinishBCNM(player,csid,option)) then return; end end;
gpl-3.0
thisishmed/butler
plugins/getplug.lua
13
2392
local function run(msg, matches) if matches[1] == "getplug" then local file = matches[2] if is_sudo(msg) then --sudo only ! local receiver = get_receiver(msg) send_document(receiver, "./plugins/"..file..".lua", ok_cb, false) else return nil end end end return { patterns = { "^[!/](getplug) (.*)$" }, run = run } -- -_-_-_-_-_-_-_-_-_- ||-_-_-_-_-_ || ||-_-_-_-_-_ -- || || || || -- || || || || -- || || || || -- || ||-_-_-_-_-_ || ||-_-_-_-_-_ -- || || || || -- || || || || -- || || || || -- || ||-_-_-_-_-_ ||-_-_-_-_-_ ||-_-_-_-_-_ -- -- -- /\ /\ /-_-_-_-_-_ ||-_-_-_-_-_ ||-_-_-_-_-_ -- ||\\ //|| //\\ || //|| //\\ // || || // -- || \\ // || // \\ || // || // \\ // || || // -- || \\ // || // \\ || // || // \\ || || || // -- || \\ // || //______\\ || // || //______\\ || -_-_-_- ||-_-_-_-_-_ || // -- || \\ // || // \\ || // || // \\ || || || || \\ -- || \\ // || // \\ || // || // \\ \\ || || || \\ -- || \\// || // \\ ||// || // \\ \\-_-_-_-_-|| ||-_-_-_-_-_ || \\ -- -- -- ||-_-_-_- || || || //-_-_-_-_-_- -- || || || || || // -- ||_-_-_|| || || || // -- || || || || \\ -- || || \\ // \\ -- || || \\ // // -- || ||-_-_-_-_ \\-_-_-_-// -_-_-_-_-_-// -- --By @ali_ghoghnoos --@telemanager_ch
gpl-2.0
waytim/darkstar
scripts/zones/Northern_San_dOria/npcs/Excenmille.lua
13
1072
----------------------------------- -- Area: Northern San d'Oria -- NPC: Excenmille -- Type: Ballista Pursuivant -- @zone: 231 -- @pos -229.344 6.999 22.976 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x001d); 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
waytim/darkstar
scripts/zones/Tavnazian_Safehold/npcs/Gennoue.lua
30
1060
----------------------------------- -- Area: Tavnazian Safehold -- NPC: Gennoue -- Type: Weather Reporter ----------------------------------- package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Tavnazian_Safehold/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x01FD,0,0,0,0,0,0,0,VanadielTime()); 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
MinFu/luci
applications/luci-app-statistics/luasrc/statistics/rrdtool/definitions/iwinfo.lua
31
1569
-- Copyright 2011 Jo-Philipp Wich <jow@openwrt.org> -- Licensed to the public under the Apache License 2.0. module("luci.statistics.rrdtool.definitions.iwinfo", package.seeall) function rrdargs( graph, plugin, plugin_instance ) -- -- signal/noise diagram -- local snr = { title = "%H: Signal and noise on %pi", vlabel = "dBm", number_format = "%5.1lf dBm", data = { types = { "signal_noise", "signal_power" }, options = { signal_power = { title = "Signal", overlay = true, color = "0000ff" }, signal_noise = { title = "Noise", overlay = true, color = "ff0000" } } } } -- -- signal quality diagram -- local quality = { title = "%H: Signal quality on %pi", vlabel = "Quality", number_format = "%3.0lf", data = { types = { "signal_quality" }, options = { signal_quality = { title = "Quality", noarea = true, color = "0000ff" } } } } -- -- phy rate diagram -- local bitrate = { title = "%H: Average phy rate on %pi", vlabel = "MBit/s", number_format = "%5.1lf%sBit/s", data = { types = { "bitrate" }, options = { bitrate = { title = "Rate", color = "00ff00" } } } } -- -- associated stations -- local stations = { title = "%H: Associated stations on %pi", vlabel = "Stations", number_format = "%3.0lf", data = { types = { "stations" }, options = { stations = { title = "Stations", color = "0000ff" } } } } return { snr, quality, bitrate, stations } end
apache-2.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c6666675.lua
2
2144
--Nyx, Shaderune of the Night function c6666675.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK),6,3) c:EnableReviveLimit() --shuffle local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetDescription(aux.Stringid(6666675,1)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(c6666675.cost) e1:SetCondition(c6666675.condition) e1:SetTarget(c6666675.target) e1:SetOperation(c6666675.operation) c:RegisterEffect(e1) --Immune to Traps local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetCondition(c6666675.imcon) e2:SetValue(c6666675.efilter) c:RegisterEffect(e2) end function c6666675.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 c6666675.filter(c) return c:IsSetCard(0x900) and c:IsType(TYPE_MONSTER) end function c6666675.condition(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end local g=Duel.GetMatchingGroup(c6666675.filter,tp,LOCATION_REMOVED,0,nil) local ct=g:GetClassCount(Card.GetCode) return ct>3 end function c6666675.shfilter(c) return c:IsAbleToDeck() and not c:IsCode(6666675) end function c6666675.target(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(c6666675.shfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end local sg=Duel.GetMatchingGroup(c6666675.shfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,sg,sg:GetCount(),0,0) end function c6666675.operation(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(c6666675.shfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SendtoDeck(sg,nil,2,REASON_EFFECT) end function c6666675.ofilter(c) return c:IsCode(6666670) end function c6666675.imcon(e) local g=e:GetHandler():GetOverlayGroup() return g:IsExists(c6666675.ofilter,1,nil) end function c6666675.efilter(e,te) return te:IsActiveType(TYPE_TRAP) end
gpl-3.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c59821046.lua
1
7888
--CXyz Idol Master of Alegri Constellation Aoi Kiriya function c59821046.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,nil,5,3) c:EnableReviveLimit() --pendulum summon aux.EnablePendulumAttribute(c) --atk up local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_PZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(c59821046.atktg) e1:SetValue(300) c:RegisterEffect(e1) --place pcard local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1) e2:SetCondition(c59821046.pencon) e2:SetTarget(c59821046.pentg) e2:SetOperation(c59821046.penop) c:RegisterEffect(e2) --destroy replace local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_DESTROY_REPLACE) e3:SetRange(LOCATION_PZONE) e3:SetTarget(c59821046.reptg) e3:SetValue(c59821046.repval) e3:SetOperation(c59821046.repop) c:RegisterEffect(e3) --immune spell local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_IMMUNE_EFFECT) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetRange(LOCATION_MZONE) e4:SetCondition(c59821046.imcon) e4:SetValue(c59821046.efilter) c:RegisterEffect(e4) --battle indestructable local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e5:SetValue(c59821046.indes) c:RegisterEffect(e5) --chain attack local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(59821046,1)) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetCode(EVENT_BATTLED) e6:SetProperty(0,EFFECT_FLAG2_XMDETACH) e6:SetCountLimit(1,59821046) e6:SetCondition(c59821046.atcon) e6:SetCost(c59821046.atcost) e6:SetOperation(c59821046.atop) c:RegisterEffect(e6) --to pzone local e7=Effect.CreateEffect(c) e7:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e7:SetCategory(CATEGORY_DESTROY) e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e7:SetCode(EVENT_DESTROYED) e7:SetCondition(c59821046.con) e7:SetOperation(c59821046.op) c:RegisterEffect(e7) --destroy and draw local e8=Effect.CreateEffect(c) e8:SetDescription(aux.Stringid(59821046,2)) e8:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW) e8:SetType(EFFECT_TYPE_QUICK_O) e8:SetCode(EVENT_FREE_CHAIN) e8:SetProperty(EFFECT_FLAG_CARD_TARGET) e8:SetRange(LOCATION_MZONE) e8:SetCountLimit(1) e8:SetCondition(c59821046.descon) e8:SetCost(c59821046.descost) e8:SetTarget(c59821046.destg) e8:SetOperation(c59821046.desop) e8:SetHintTiming(0,0x1e0) c:RegisterEffect(e8) --add setcode local e9=Effect.CreateEffect(c) e9:SetType(EFFECT_TYPE_SINGLE) e9:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e9:SetCode(EFFECT_ADD_SETCODE) e9:SetValue(0x1073) c:RegisterEffect(e9) end function c59821046.atktg(e,c) return c:IsSetCard(0xa1a2) or c:IsCode(59821039) or c:IsCode(59821040) or c:IsCode(59821041) or c:IsCode(59821042) or c:IsCode(59821043) or c:IsCode(59821044) or c:IsCode(59821045) or c:IsCode(59821046) or c:IsCode(59821048) or c:IsCode(59821049) end function c59821046.penfilter4(c) return c:IsSetCard(0xa1a2) end function c59821046.pencon(e,tp,eg,ep,ev,re,r,rp) local seq=e:GetHandler():GetSequence() return Duel.GetFieldCard(tp,LOCATION_SZONE,13-seq)==nil end function c59821046.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c59821046.penfilter4,tp,LOCATION_EXTRA,0,1,nil) end end function c59821046.penop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectMatchingCard(tp,c59821046.penfilter4,tp,LOCATION_EXTRA,0,1,1,nil) if g:GetCount()>0 then local tc=g:GetFirst() Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end end function c59821046.replacefilter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0xa1a2) or c:IsCode(59821039) or c:IsCode(59821040) or c:IsCode(59821041) or c:IsCode(59821042) or c:IsCode(59821043) or c:IsCode(59821044) or c:IsCode(59821045) or c:IsCode(59821046) or c:IsCode(59821048) or c:IsCode(59821049) and not c:IsReason(REASON_REPLACE) end function c59821046.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(c59821046.replacefilter,1,nil,tp) and not e:GetHandler():IsStatus(STATUS_DESTROY_CONFIRMED) end return Duel.SelectYesNo(tp,aux.Stringid(59821046,0)) end function c59821046.repval(e,c) return c59821046.replacefilter(c,e:GetHandlerPlayer()) end function c59821046.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT+REASON_REPLACE) end function c59821046.imcon(e) return e:GetHandler():GetOverlayCount()>0 end function c59821046.efilter(e,te) return e:GetHandlerPlayer()~=te:GetHandlerPlayer() and te:IsActiveType(TYPE_SPELL) end function c59821046.indes(e,c) return not c:IsRace(RACE_AQUA) end function c59821046.atcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc and bc:IsStatus(STATUS_BATTLE_DESTROYED) and c:GetFlagEffect(59821046)==0 and c:IsChainAttackable() and c:IsStatus(STATUS_OPPO_BATTLE) end function c59821046.atcost(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 c59821046.atop(e,tp,eg,ep,ev,re,r,rp) Duel.ChainAttack() end function c59821046.penfilter1(c) return c:IsDestructable() and c:GetSequence()==6 end function c59821046.penfilter2(c) return c:IsDestructable() and c:GetSequence()==7 end function c59821046.con(e,tp,eg,ep,ev,re,r,rp) local p1=Duel.GetFieldCard(tp,LOCATION_SZONE,6) local p2=Duel.GetFieldCard(tp,LOCATION_SZONE,7) if not p1 and not p2 then return false end return (e:GetHandler():IsReason(REASON_EFFECT) or e:GetHandler():IsReason(REASON_BATTLE)) and (p1 and p1:IsDestructable()) or (p2 and p2:IsDestructable()) and e:GetHandler():GetPreviousLocation()==LOCATION_MZONE end function c59821046.op(e,tp,eg,ep,ev,re,r,rp) local p1=Duel.GetFieldCard(tp,LOCATION_SZONE,6) local p2=Duel.GetFieldCard(tp,LOCATION_SZONE,7) local g1=nil local g2=nil if p1 then g1=Duel.GetMatchingGroup(c59821046.penfilter1,tp,LOCATION_SZONE,0,nil) end if p2 then g2=Duel.GetMatchingGroup(c59821046.penfilter2,tp,LOCATION_SZONE,0,nil) if g1 then g1:Merge(g2) else g1=g2 end end if g1 and Duel.Destroy(g1,REASON_EFFECT)~=0 then local c=e:GetHandler() Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end end function c59821046.overlayfilter(c) return c:IsCode(59821007) or c:IsHasEffect(59821167) end function c59821046.descon(e) return e:GetHandler():GetOverlayGroup():IsExists(c59821046.overlayfilter,1,nil) end function c59821046.descost(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 c59821046.desfilter(c) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsAbleToChangeControler() and not c:IsType(TYPE_TOKEN) and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL end function c59821046.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and c59821046.desfilter(chkc) end if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(c59821046.desfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c59821046.desfilter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function c59821046.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then Duel.Draw(tp,1,REASON_EFFECT) end end
gpl-3.0
waytim/darkstar
scripts/zones/AlTaieu/npcs/_0x0.lua
15
2200
----------------------------------- -- Area: Al'Taieu -- NPC: Crystalline Field -- @pos .1 -10 -464 33 ----------------------------------- package.loaded["scripts/zones/AlTaieu/TextIDs"] = nil; ----------------------------------- require("scripts/zones/AlTaieu/TextIDs"); require("scripts/globals/missions"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) -- Set the PromathiaStatus to 3 if they did all 3 towers for GARDEN_OF_ANTIQUITY if (player:getVar("[SEA][AlTieu]SouthTowerCS") == 1 and player:getVar("[SEA][AlTieu]WestTowerCS") == 1 and player:getVar("[SEA][AlTieu]EastTowerCS") == 1 and player:getVar("PromathiaStatus") == 2) then player:setVar("[SEA][AlTieu]SouthTowerCS", 0); player:setVar("[SEA][AlTieu]WestTowerCS", 0); player:setVar("[SEA][AlTieu]EastTowerCS", 0); player:setVar("PromathiaStatus", 3); end if (player:getCurrentMission(COP) == GARDEN_OF_ANTIQUITY and player:getVar("PromathiaStatus") == 1) then player:startEvent(0x00A4); elseif (player:getCurrentMission(COP) > GARDEN_OF_ANTIQUITY or (player:getCurrentMission(COP) == GARDEN_OF_ANTIQUITY and player:getVar("PromathiaStatus") == 3)) then player:startEvent(0x0064); -- Teleport inside else player:messageSpecial(NOTHING_OUT_OF_ORDINARY); -- Access should be restricted if below requirements. Message is probably wrong, though. 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 == 0x0064 and option == 1) then player:setPos(-20,0.624,-355,191,34); -- {R} elseif (csid == 0x00A4) then player:setVar("PromathiaStatus", 2); end end;
gpl-3.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Windurst_Waters/npcs/Gantineux.lua
4
2371
----------------------------------- -- Area: Windurst Waters -- NPC: Gantineux -- Starts Quest: Acting in Good Faith -- @zone 238 -- @pos -83 -9 3 ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Windurst_Waters/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) ActingInGoodFaith = player:getQuestStatus(WINDURST,ACTING_IN_GOOD_FAITH); if(ActingInGoodFaith == QUEST_AVAILABLE and player:getFameLevel(WINDURST) >= 4 and player:getMainLvl() >= 10) then player:startEvent(0x2723); -- Start quest "Acting in Good Faith" elseif(ActingInGoodFaith == QUEST_ACCEPTED) then if(player:hasKeyItem(SPIRIT_INCENSE) == true) then player:startEvent(0x2724); -- During quest "Acting in Good Faith" (with Spirit Incense KI) elseif(player:hasKeyItem(GANTINEUXS_LETTER) == true) then player:startEvent(0x2726); -- During quest "Acting in Good Faith" (with Gantineux's Letter) else player:startEvent(0x2725); -- During quest "Acting in Good Faith" (before Gantineux's Letter) end elseif(ActingInGoodFaith == QUEST_COMPLETED) then player:startEvent(0x2727); -- New standard dialog after "Acting in Good Faith" else player:startEvent(0x2722); -- 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 == 0x2723 and option == 0) then player:addQuest(WINDURST,ACTING_IN_GOOD_FAITH); player:addKeyItem(SPIRIT_INCENSE); player:messageSpecial(KEYITEM_OBTAINED,SPIRIT_INCENSE); elseif(csid == 0x2725) then player:addKeyItem(GANTINEUXS_LETTER); player:messageSpecial(KEYITEM_OBTAINED,GANTINEUXS_LETTER); end end;
gpl-3.0
Timendainum/Wintermute
opt/lib/txt.lua
1
1955
--- opt/lib/txt -- Created by Timendainum --------------------------------------------------- --Text tools to help making writing to monitors --easier. --------------------------------------------------- --centerWrite function centerWrite(o, t) --Get Term size local x,y = o.getSize() local halfX = math.ceil(x/2) print("x: " .. tostring(x) .. " y: " .. tostring(y) .. " halfX: " .. halfX) --get cursor local cX, cY = o.getCursorPos() --calc center local halfLength = math.ceil(string.len(t)/2) print("halfLenth: " .. halfLength) --Set pos and write local newX = halfX - halfLength print("newX: " .. newX) print("x: " .. newX .. " y: " .. y .. " Text: " .. t) o.setCursorPos(newX, cY) o.write(t) end function numberString(num) local nNumber = tonumber(num) local billion = 1000000000 local million = 1000000 local thousand = 1000 local postfix = "" -- billon if nNumber > billion then nNumber = nNumber / billion postfix = "B" -- million elseif nNumber > million then nNumber = nNumber / million postfix = "M" elseif nNumber > thousand then nNumber = nNumber / thousand postfix = "K" end nNumber = nNumber * 100 nNumber = math.ceil(nNumber) nNumber = nNumber / 100 return tostring(nNumber) .. postfix end function sPrint(...) local tArgs = {...} result = "" for k,v in ipairs(tArgs) do result = result .. tostring(v) end print(result) end function split (s, delim) assert (type(delim) == "string" and string.len(delim) > 0, "bad delimiter") local start = 1 local t = {} -- results table -- find each instance of a string followed by the delimiter while true do local pos = string.find (s, delim, start, true) -- plain find if not pos then break end table.insert (t, string.sub (s, start, pos - 1)) start = pos + string.len (delim) end -- while -- insert final one (after last delimiter) table.insert (t, string.sub (s, start)) return t end
mit
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Newton_Movalpolos/TextIDs.lua
4
1343
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6375; -- You cannot obtain the item <item> come back again after sorting your inventory ITEM_OBTAINED = 6378; -- Obtained: <item> GIL_OBTAINED = 6379; -- Obtained <number> gil KEYITEM_OBTAINED = 6381; -- Obtained key item: <keyitem> -- Treasure Coffer/Chest Dialog CHEST_UNLOCKED = 7207; -- You unlock the chest! CHEST_FAIL = 7208; -- Fails to open the chest. CHEST_TRAP = 7209; -- The chest was trapped! CHEST_WEAK = 7210; -- You cannot open the chest when you are in a weakened state. CHEST_MIMIC = 7211; -- The chest was a mimic! CHEST_MOOGLE = 7212; -- You cannot open the chest while participating in the moogle event. CHEST_ILLUSION = 7213; -- The chest was but an illusion... CHEST_LOCKED = 7214; -- The chest appears to be locked. -- Mining MINING_IS_POSSIBLE_HERE = 7193; -- Mining is possible here if you have <item> -- Moblin Showman SHOWMAN_TRIGGER = 7219; -- Hey, you there! Muscles nice. You want fight strong one? It cost you. Give me nice item. SHOWMAN_DECLINE = 7218; -- ...Me no want that. Thing me want not here! It not being here!!! SHOWMAN_ACCEPT = 7220; -- Fhungaaa!!! The freshyness, the flavoryness! This very nice item! Good luck, then. Try not die.One...two...four...FIIIIIIGHT!!!
gpl-3.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c20912290.lua
2
1743
--Sword Art Champion Hrist function c20912290.initial_effect(c) c:EnableReviveLimit() --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(20912290,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(c20912290.spcon) e1:SetTarget(c20912290.sptg) e1:SetOperation(c20912290.spop) c:RegisterEffect(e1) --cannot xyz material local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetValue(c20912290.xyzlimit) c:RegisterEffect(e2) end function c20912290.spcon(e,tp,eg,ep,ev,re,r,rp) local ec=eg:GetFirst() return ec:IsControler(tp) and ec:IsSetCard(0xd0a2) and ec:IsRace(RACE_WARRIOR) end function c20912290.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,true,false) end local t={} local i=1 for i=1,4 do t[i]=i end Duel.Hint(HINT_SELECTMSG,tp,567) local lv=Duel.AnnounceNumber(tp,table.unpack(t)) e:SetLabel(lv) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c20912290.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP_DEFENSE)~=0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(e:GetLabel()) e1:SetReset(RESET_EVENT+0x1ff0000) c:RegisterEffect(e1) end end function c20912290.xyzlimit(e,c) if not c then return false end return not c:IsRace(RACE_WARRIOR) end
gpl-3.0
waytim/darkstar
scripts/zones/Abyssea-Konschtat/npcs/Atma_Fabricant.lua
33
1061
----------------------------------- -- Zone: Abyssea - Konschtat -- NPC: Atma Fabricant -- ----------------------------------- package.loaded["scripts/zones/Abyssea-Konschtat/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/abyssea"); require("scripts/zones/Abyssea-Konschtat/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0886); 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
waytim/darkstar
scripts/zones/Tavnazian_Safehold/npcs/Pradiulot.lua
13
2380
----------------------------------- -- Area: Tavnazian Safehold -- NPC: Pradiulot -- Involved in Quest: Unforgiven -- @zone 26 -- @pos -20.814 -22 8.399 ----------------------------------- package.loaded["scripts/zones/Tavnazian_Safehold/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Tavnazian_Safehold/TextIDs"); require("scripts/globals/quests"); ----------------------------------- -- For those who don't know -- at the end of if (player:getQuestStatus(REGION,QUEST_NAME) -- == 0 means QUEST_AVAILABLE -- == 1 means QUEST_ACCEPTED -- == 2 means QUEST_COMPLETED -- e.g. if (player:getQuestStatus(OTHER_AREAS,UNFORGIVEN) == 0 -- means if (player:getQuestStatus(OTHER_AREAS,UNFORGIVEN) == QUEST AVAILABLE ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(OTHER_AREAS,UNFORGIVEN) == 2 and trade:getGil() == 1 == true) then player:startEvent(0x00CE); -- Dialogue after completing quest (optional) end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local Unforgiven = player:getQuestStatus(OTHER_AREAS,UNFORGIVEN); if (Unforgiven == 1 and player:getVar("UnforgivenVar") == 1) then player:startEvent(0x00CC); -- Dialogue for final stage of Unforgiven Quest elseif (player:getQuestStatus(OTHER_AREAS,UNFORGIVEN) == 2 and player:getVar("UnforgivenVar") == 2) then player:startEvent(0x00CE); -- Dialogue after completing quest (optional) else player:startEvent(0x0173); -- Default Dialogue end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if (csid == 0x00CC) then player:setVar("UnforgivenVar",2); player:addKeyItem(440) player:messageSpecial(KEYITEM_OBTAINED,440); -- Map of Tavnazia player:completeQuest(OTHER_AREAS,UNFORGIVEN); player:addFame(OTHER_AREAS,30); elseif (csid == 0x00CE) then player:setVar("UnforgivenVar",0); end end;
gpl-3.0
siktirmirza/uzz
plugins/get.lua
613
1067
local function get_variables_hash(msg) if msg.to.type == 'chat' then return 'chat:'..msg.to.id..':variables' end if msg.to.type == 'user' then return 'user:'..msg.from.id..':variables' end end local function list_variables(msg) local hash = get_variables_hash(msg) if hash then local names = redis:hkeys(hash) local text = '' for i=1, #names do text = text..names[i]..'\n' end return text end end local function get_value(msg, var_name) local hash = get_variables_hash(msg) if hash then local value = redis:hget(hash, var_name) if not value then return'Not found, use "!get" to list variables' else return var_name..' => '..value end end end local function run(msg, matches) if matches[2] then return get_value(msg, matches[2]) else return list_variables(msg) end end return { description = "Retrieves variables saved with !set", usage = "!get (value_name): Returns the value_name value.", patterns = { "^(!get) (.+)$", "^!get$" }, run = run }
gpl-2.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/items/witch_kabob.lua
3
1269
----------------------------------------- -- ID: 4343 -- Item: witch_kabob -- Food Effect: 1hour, All Races ----------------------------------------- -- Magic Points 15 -- Mind 4 -- Enmity -1 -- MP Recovered While Healing 3 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,3600,4343); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MP, 15); target:addMod(MOD_MND, 4); target:addMod(MOD_ENMITY, -1); target:addMod(MOD_MPHEAL, 3); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MP, 15); target:delMod(MOD_MND, 4); target:delMod(MOD_ENMITY, -1); target:delMod(MOD_MPHEAL, 3); end;
gpl-3.0
waytim/darkstar
scripts/globals/items/serving_of_bavarois.lua
18
1192
----------------------------------------- -- ID: 5729 -- Item: serving_of_bavarois -- Food Effect: 3Hrs, All Races ----------------------------------------- -- HP 20 -- Intelligence 3 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,5729); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 20); target:addMod(MOD_INT, 3); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 20); target:delMod(MOD_INT, 3); end;
gpl-3.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/RuLude_Gardens/npcs/Albiona.lua
2
1219
----------------------------------- -- Area: Ru'Lud Gardens -- NPC: Albiona -- Standard Info NPC ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local WildcatJeuno = player:getVar("WildcatJeuno"); if (player:getQuestStatus(JEUNO,LURE_OF_THE_WILDCAT_JEUNO) == QUEST_ACCEPTED and player:getMaskBit(WildcatJeuno,0) == false) then player:startEvent(10089); else player:startEvent(0x0092); 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 == 10089) then player:setMaskBit(player:getVar("WildcatJeuno"),"WildcatJeuno",0,true) end end;
gpl-3.0
waytim/darkstar
scripts/zones/Monastic_Cavern/Zone.lua
17
1771
----------------------------------- -- -- Zone: Monastic_Cavern (150) -- ----------------------------------- package.loaded["scripts/zones/Monastic_Cavern/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Monastic_Cavern/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) UpdateTreasureSpawnPoint(17391845); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(261.354,-8.792,23.124,175); end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/weaponskills/evisceration.lua
4
1342
----------------------------------- -- Evisceration -- Dagger weapon skill -- Skill level: 230 -- In order to obtain Evisceration, the quest Cloak and Dagger must be completed. -- Delivers a fivefold attack. Chance of params.critical hit varies with TP. -- Will stack with Sneak Attack. -- Aligned with the Shadow Gorget, Soil Gorget & Light Gorget. -- Aligned with the Shadow Belt, Soil Belt & Light Belt. -- Element: None -- Modifiers: DEX:30% -- 100%TP 200%TP 300%TP -- 1.00 1.00 1.00 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function OnUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 5; params.ftp100 = 1; params.ftp200 = 1; params.ftp300 = 1; params.str_wsc = 0.0; params.dex_wsc = 0.3; 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.1; params.crit200 = 0.3; params.crit300 = 0.5; 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); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c999918.lua
2
1623
--Red Dragon Imposter function c999918.initial_effect(c) --copy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(999918,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(c999918.copytg) e1:SetOperation(c999918.copyop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetCondition(c999918.condtion) e2:SetValue(1500) c:RegisterEffect(e2) end function c999918.filter(c) return (c:IsSetCard(0x1045)) and c:IsType(TYPE_MONSTER) and not c:IsHasEffect(EFFECT_FORBIDDEN) and c:IsAbleToRemove() end function c999918.copytg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and c999918.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c999918.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,c999918.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c999918.copyop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and c:IsFaceup() and tc and tc:IsRelateToEffect(e) then if Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=1 then return end local code=tc:GetOriginalCode() c:CopyEffect(code,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,1) end end function c999918.condtion(e) local ph=Duel.GetCurrentPhase() return (ph==PHASE_DAMAGE or ph==PHASE_DAMAGE_CAL) and Duel.GetAttacker()==e:GetHandler() end
gpl-3.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/items/wizard_cookie.lua
3
1233
----------------------------------------- -- ID: 4576 -- Item: wizard_cookie -- Food Effect: 5Min, All Races ----------------------------------------- -- MP Recovered While Healing 7 -- Plantoid Killer 7 -- Slow Resist 7 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,4576); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MPHEAL, 7); target:addMod(MOD_PLANTOID_KILLER, 7); target:addMod(MOD_SLOWRES, 7); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MPHEAL, 7); target:delMod(MOD_PLANTOID_KILLER, 7); target:delMod(MOD_SLOWRES, 7); end;
gpl-3.0
waytim/darkstar
scripts/zones/Den_of_Rancor/TextIDs.lua
15
1121
-- 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 = 6384; -- Obtained: <item> GIL_OBTAINED = 6385; -- Obtained <number> gil KEYITEM_OBTAINED = 6387; -- Obtained key item: <keyitem> FISHING_MESSAGE_OFFSET = 7232; -- You can't fish here HOMEPOINT_SET = 10527; -- Home point set! -- Treasure Coffer/Chest Dialog CHEST_UNLOCKED = 7334; -- You unlock the chest! CHEST_FAIL = 7335; -- Fails to open the chest. CHEST_TRAP = 7336; -- The chest was trapped! CHEST_WEAK = 7337; -- You cannot open the chest when you are in a weakened state. CHEST_MIMIC = 7338; -- The chest was a mimic! CHEST_MOOGLE = 7339; -- You cannot open the chest while participating in the moogle event. CHEST_ILLUSION = 7340; -- The chest was but an illusion... CHEST_LOCKED = 7341; -- The chest appears to be locked. -- Other dialog LANTERN_OFFSET = 7204; -- The grating will not budge. -- conquest Base CONQUEST_BASE = 7045; -- Tallying conquest results...
gpl-3.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c77790021.lua
2
1951
--Little Fat Cat, Corazon function c77790021.initial_effect(c) --pendulum summon aux.EnablePendulumAttribute(c) --counter local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1,77790021+EFFECT_COUNT_CODE_DUEL) e2:SetTarget(c77790021.cttg) e2:SetOperation(c77790021.ctop) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SPSUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) e3:SetRange(LOCATION_MZONE) e3:SetTarget(c77790021.sptg) e3:SetOperation(c77790021.spop) c:RegisterEffect(e3) end function c77790021.cttg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end end function c77790021.ctop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) if g:GetCount()>0 then local tc=g:GetFirst() while tc do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+0xfe0000) e1:SetValue(0) tc:RegisterEffect(e1) tc=g:GetNext() Duel.BreakEffect() end end end function c77790021.filter(c,e,tp) return c:IsType(TYPE_TUNER) and c:GetLevel()<=5 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c77790021.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function c77790021.spop(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,c77790021.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_DEFENSE) end end
gpl-3.0
m2q1n9/flappycoco
src/Atlas.lua
1
2456
-- Atlas.lua, created by mzq. -*- mode: lua -*- Atlas = Atlas or {} function Atlas.createSprite(rect) return cc.Sprite:createWithTexture(atlas, rect) end function Atlas.createAnimation(rects) local frames = {} for i, rect in ipairs(rects) do table.insert(frames, cc.SpriteFrame:createWithTexture(atlas, rect)) end return cc.Animation:createWithSpriteFrames(frames, 0.1) end function Atlas.init() local t = {} local s = ccFileUtils:getStringFromFile("atlas_text.txt") local p = "([%w_]+)%s+(%d+)%s+(%d+)%s+([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)%s+([%d%.]+)" local size = atlas:getContentSize() for name, width, height, x, y, w, h in s:gmatch(p) do t[name] = cc.rect(x*size.width, y*size.height, w*size.width, h*size.height) cclog("%s = %s", name, dump1(t[name])) end local date = os.date("*t", os.time()) cclog("date = %s", dump1(date)) local hour = date.hour Atlas.bg = (hour >= 6 and hour < 18) and t.bg or t.bg_night Atlas.ground = t.ground Atlas.play = t.play Atlas.select = t.button_enable Atlas.tutorial = t.tutorial Atlas.ready = t.ready Atlas.gameover = t.gameover Atlas.pipe = { t.pipe_up, t.pipe_down, } Atlas.ghost = { t.ghost_0, t.ghost_1, } Atlas.bird = { { t.bird0_0, t.bird0_1, t.bird0_2, }, { t.bird1_0, t.bird1_1, t.bird1_2, }, { t.bird2_0, t.bird2_1, t.bird2_2, }, } Atlas.number = { { t.font_048, t.font_049, t.font_050, t.font_051, t.font_052, t.font_053, t.font_054, t.font_055, t.font_056, t.font_057, }, { t.number_score_00, t.number_score_01, t.number_score_02, t.number_score_03, t.number_score_04, t.number_score_05, t.number_score_06, t.number_score_07, t.number_score_08, t.number_score_09, }, } end
mit
TheOnePharaoh/YGOPro-Custom-Cards
script/c99980980.lua
1
4510
--HN - MAGES. function c99980980.initial_effect(c) aux.EnablePendulumAttribute(c) --Destroy Replace local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DESTROY_REPLACE) e1:SetRange(LOCATION_PZONE) e1:SetTarget(c99980980.reptg) e1:SetValue(c99980980.repval) e1:SetOperation(c99980980.repop) c:RegisterEffect(e1) --Damage local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_PZONE) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(c99980980.damcon) e2:SetTarget(c99980980.damtg) e2:SetOperation(c99980980.damop) c:RegisterEffect(e2) --Immune Spell/Trap local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_IMMUNE_EFFECT) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetValue(c99980980.imfilter) c:RegisterEffect(e3) --Special Summon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(99980980,0)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,99980980) e4:SetCondition(c99980980.spcon) e4:SetTarget(c99980980.sptg) e4:SetOperation(c99980980.spop) c:RegisterEffect(e4) if not c99980980.global_check then c99980980.global_check=true local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_SUMMON_SUCCESS) ge1:SetLabel(99980980) ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) ge1:SetOperation(aux.sumreg) Duel.RegisterEffect(ge1,0) local ge2=ge1:Clone() ge2:SetCode(EVENT_SPSUMMON_SUCCESS) ge2:SetLabel(99980980) Duel.RegisterEffect(ge2,0) end end function c99980980.repfilter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(0x998) and c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()~=tp end function c99980980.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(c99980980.repfilter,1,nil,tp) and not e:GetHandler():IsStatus(STATUS_DESTROY_CONFIRMED) end return Duel.SelectYesNo(tp,aux.Stringid(99980980,1)) end function c99980980.repval(e,c) return c99980980.repfilter(c,e:GetHandlerPlayer()) end function c99980980.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT+REASON_REPLACE) end function c99980980.damfilter1(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsSetCard(0x998) end function c99980980.damcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(c99980980.damfilter1,1,nil,tp) and rp==tp end function c99980980.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(300) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,300) end function c99980980.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function c99980980.imfilter(e,te) return te:IsActiveType(TYPE_TRAP+TYPE_SPELL) and te:GetOwnerPlayer()~=e:GetHandlerPlayer() end function c99980980.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(99980980)>0 end function c99980980.spfilter(c,e,tp) return c:IsSetCard(0x998) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsHasEffect(EFFECT_NECRO_VALLEY) end function c99980980.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:GetControler()==tp and chkc:GetLocation()==LOCATION_DECK+LOCATION_GRAVE and c99980980.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c99980980.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c99980980.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,g:GetCount(),0,0) end function c99980980.damfilter2(c) return c:IsFaceup() and c:IsSetCard(0x998) end function c99980980.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then local sg=Duel.GetMatchingGroup(c99980980.damfilter2,tp,LOCATION_MZONE,0,nil) local dam=sg:GetCount()*300 Duel.Damage(1-tp,dam,REASON_EFFECT) end end
gpl-3.0
TienHP/Aquaria
files/scripts/entities/_unused/cc_lostincave.lua
5
3902
-- Copyright (C) 2007, 2010 - Bit-Blot -- -- This file is part of Aquaria. -- -- Aquaria is free software; you can redistribute it and/or -- modify it under the terms of the GNU General Public License -- as published by the Free Software Foundation; either version 2 -- of the License, or (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -- -- See the GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program; if not, write to the Free Software -- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. if not v then v = {} end if not AQUARIA_VERSION then dofile("scripts/entities/entityinclude.lua") end v.n = 0 v.ix,v.iy = 0,0 v.escapeNode = 0 function init(me) setupEntity(me) entity_setEntityType(me, ET_NEUTRAL) entity_initSkeletal(me, "CC") entity_setAllDamageTargets(me, false) entity_scale(me, 0.6, 0.6) entity_setBlendType(me, BLEND_ADD) entity_alpha(me, 0.5) entity_alpha(me, 1, 1, -1, 1, 1) end function postInit(me) v.n = getNaija() entity_setTarget(me, v.n) v.ix,v.iy = entity_getPosition(me) v.escapeNode = getNode("CAVEEXIT") if isFlag(FLAG_SUNKENCITY_BOSS, 1) then entity_delete(me) elseif getFlag(FLAG_SUNKENCITY_PUZZLE) > 0 then local node = getNode("MOTHER") entity_setPosition(me, node_x(node), node_y(node)) local node2 = getNode("MOTHERSPAWN") local mother = createEntity("CC_Mother", "", node_x(node2), node_y(node2)) entity_setState(me, STATE_DONE) entity_animate(me, "float", -1) else entity_setState(me, STATE_IDLE) end entity_rotate(me, 0) end v.done = false v.inScene = false local function cutScene(me) if v.inScene then return end v.done = true v.inScene = true -- mother arrives, sings song in loop entity_idle(v.n) cam_toEntity(me) --node_getPosition(getNode("MOTHER")) local node = getNode("MOTHER") entity_setPosition(me, node_x(node), node_y(node), 3, 0, 0, 1) watch(3) watch(1) -- mother fades in local node2 = getNode("MOTHERSPAWN") local mother = createEntity("CC_Mother", "", node_x(node2), node_y(node2)) entity_alpha(mother, 0) entity_alpha(mother, 1, 2) watch(1) entity_setState(me, STATE_DONE) watch(1) setFlag(FLAG_SUNKENCITY_PUZZLE, 1) cam_toEntity(v.n) v.inScene = false end function update(me, dt) if entity_isState(me, STATE_IDLE) then if entity_isEntityInRange(me, v.n, 256) and getForm() == FORM_LIGHT then entity_setState(me, STATE_FOLLOW) end elseif entity_isState(me, STATE_FOLLOW) then if not v.done then if node_isEntityIn(v.escapeNode, me) then cutScene(me) else if getForm() ~= FORM_LIGHT or not entity_isEntityInRange(me, v.n, 512) then entity_setPosition(me, v.ix, v.iy, 3, 0, 0, 1) entity_setState(me, STATE_IDLE) else if entity_isEntityInRange(me, v.n, 128) then entity_moveTowardsTarget(me, dt, -500) else entity_moveTowardsTarget(me, dt, 500) end entity_doCollisionAvoidance(me, dt, 2, 1) entity_updateMovement(me, dt) entity_flipToEntity(me, v.n) end end end elseif entity_isState(me, STATE_DONE) then end end function enterState(me) if entity_isState(me, STATE_IDLE) then entity_animate(me, "cry", -1) entity_setPosition(me, entity_getPosition(me)) elseif entity_isState(me, STATE_FOLLOW) then entity_animate(me, "float", -1) elseif entity_isState(me, STATE_DONE) then end end function exitState(me) end function damage(me, attacker, bone, damageType, dmg) return false end function animationKey(me, key) end function hitSurface(me) end function songNote(me, note) end function songNoteDone(me, note) end function song(me, song) end function activate(me) end
gpl-2.0
ld-test/lua-resty-validation
lib/resty/validation/ngx.lua
1
2089
local validation = require "resty.validation" local escapeuri = ngx.escape_uri local unescapeuri = ngx.unescape_uri local base64enc = ngx.encode_base64 local base64dec = ngx.decode_base64 local crc32short = ngx.crc32_short local crc32long = ngx.crc32_long local match = ngx.re.match local validators = validation.validators local factory = getmetatable(validators) function factory.escapeuri() return function(value) return true, escapeuri(value) end end function factory.unescapeuri() return function(value) return true, unescapeuri(value) end end function factory.base64enc() return function(value) return true, base64enc(value) end end function factory.base64dec() return function(value) local decoded = base64dec(value) if decoded == nil then return false end return true, decoded end end function factory.crc32short() return function(value) return true, crc32short(value) end end function factory.crc32long() return function(value) return true, crc32long(value) end end function factory.crc32() return function(value) if #value < 61 then return true, crc32short(value) end return true, crc32long(value) end end function factory.regex(regex, options) return function(value) return (match(value, regex, options)) ~= nil end end validators.escapeuri = factory.escapeuri() validators.unescapeuri = factory.unescapeuri() validators.base64enc = factory.base64enc() validators.base64dec = factory.base64dec() validators.crc32short = factory.crc32short() validators.crc32long = factory.crc32long() validators.crc32 = factory.crc32() return { escapeuri = validators.escapeuri, unescapeuri = validators.unescapeuri, base64enc = validators.base64enc, base64dec = validators.base64dec, crc32short = validators.crc32short, crc32long = validators.crc32long, crc32 = validators.crc32, regex = factory.regex }
bsd-2-clause
TheOnePharaoh/YGOPro-Custom-Cards
script/c103950036.lua
2
2550
--Knowledge Mirror function c103950036.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(103950036,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(c103950036.activatecon) e1:SetCost(c103950036.activatecost) e1:SetOperation(c103950036.activate) c:RegisterEffect(e1) end --Activate condition function c103950036.activatecon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(tp,48256875) == 0 and Duel.GetFlagEffect(1-tp,48256875) == 0 end --Activate cost function c103950036.activatecost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.RegisterFlagEffect(tp,48256875,RESET_PHASE+PHASE_END,0,1) end --Activate operation function c103950036.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(103950036,1)) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_CHAIN_SOLVING) e1:SetCondition(c103950036.negcon) e1:SetOperation(c103950036.negop) e1:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e1,tp) --Draw cards local e2=Effect.CreateEffect(e:GetHandler()) e2:SetDescription(aux.Stringid(103950036,2)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCategory(CATEGORY_DRAW) e2:SetCountLimit(1) e2:SetCondition(c103950036.drawcon) e2:SetOperation(c103950036.drawop) e2:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e2,tp) end --Negate match function c103950036.negmatch(ev) local ex1,cg1,cc1,cp1,cv1=Duel.GetOperationInfo(ev,CATEGORY_DRAW) if ex1 and ((cg1 and cg1:GetCount()>0) or (cv1 and cv1>0)) then return true end local ex2,cg2,cc2,cp2,cv2=Duel.GetOperationInfo(ev,CATEGORY_TOHAND) if ex2 and ((cg2 and cg2:GetCount()>0) or (cv2 and cv2>0)) then return true end return false end --Negate condition function c103950036.negcon(e,tp,eg,ep,ev,re,r,rp) return not re:GetHandler():IsCode(103950036) and c103950036.negmatch(ev) end --Negate operation function c103950036.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsChainDisablable(ev) then Duel.NegateEffect(ev) Duel.RegisterFlagEffect(tp,103950036,RESET_PHASE+PHASE_END,0,Duel.GetFlagEffect(tp,103950036)+1) end end --Negate condition function c103950036.drawcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(tp,103950036) > 0 end --Draw operation function c103950036.drawop(e,tp,eg,ep,ev,re,r,rp) local ct = Duel.GetFlagEffect(tp,103950036) Duel.Draw(tp,ct,REASON_EFFECT) Duel.Draw(1-tp,ct,REASON_EFFECT) end
gpl-3.0
sofianugraha/neural-style
loadcaffe_wrapper.lua
58
2411
local ffi = require 'ffi' require 'loadcaffe' local C = loadcaffe.C --[[ Most of this function is copied from https://github.com/szagoruyko/loadcaffe/blob/master/loadcaffe.lua with some horrible horrible hacks added by Justin Johnson to make it possible to load VGG-19 without any CUDA dependency. --]] local function loadcaffe_load(prototxt_name, binary_name, backend) local backend = backend or 'nn' local handle = ffi.new('void*[1]') -- loads caffe model in memory and keeps handle to it in ffi local old_val = handle[1] C.loadBinary(handle, prototxt_name, binary_name) if old_val == handle[1] then return end -- transforms caffe prototxt to torch lua file model description and -- writes to a script file local lua_name = prototxt_name..'.lua' -- C.loadBinary creates a .lua source file that builds up a table -- containing the layers of the network. As a horrible dirty hack, -- we'll modify this file when backend "nn-cpu" is requested by -- doing the following: -- -- (1) Delete the lines that import cunn and inn, which are always -- at lines 2 and 4 local model = nil if backend == 'nn-cpu' then C.convertProtoToLua(handle, lua_name, 'nn') local lua_name_cpu = prototxt_name..'.cpu.lua' local fin = assert(io.open(lua_name), 'r') local fout = assert(io.open(lua_name_cpu, 'w')) local line_num = 1 while true do local line = fin:read('*line') if line == nil then break end if line_num ~= 2 and line_num ~= 4 then fout:write(line, '\n') end line_num = line_num + 1 end fin:close() fout:close() model = dofile(lua_name_cpu) else C.convertProtoToLua(handle, lua_name, backend) model = dofile(lua_name) end -- goes over the list, copying weights from caffe blobs to torch tensor local net = nn.Sequential() local list_modules = model for i,item in ipairs(list_modules) do if item[2].weight then local w = torch.FloatTensor() local bias = torch.FloatTensor() C.loadModule(handle, item[1], w:cdata(), bias:cdata()) if backend == 'ccn2' then w = w:permute(2,3,4,1) end item[2].weight:copy(w) item[2].bias:copy(bias) end net:add(item[2]) end C.destroyBinary(handle) if backend == 'cudnn' or backend == 'ccn2' then net:cuda() end return net end return { load = loadcaffe_load }
mit
TienHP/Aquaria
files/scripts/entities/cc_father.lua
6
1655
-- 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) setupEntity(me) --entity_setEntityLayer(me, 1) entity_setEntityType(me, ET_NEUTRAL) entity_initSkeletal(me, "cc_father") entity_setAllDamageTargets(me, false) entity_setState(me, STATE_IDLE) entity_scale(me, 0.5, 0.5) end function postInit(me) v.n = getNaija() entity_setTarget(me, v.n) end function update(me, dt) end function enterState(me) if entity_isState(me, STATE_IDLE) then entity_animate(me, "idle", -1) end end function exitState(me) end function damage(me, attacker, bone, damageType, dmg) return false end function animationKey(me, key) end function hitSurface(me) end function songNote(me, note) end function songNoteDone(me, note) end function song(me, song) end function activate(me) end
gpl-2.0
lusiankaitz/koreader-master
frontend/device/kindle/device.lua
1
9141
local Generic = require("device/generic/device") local DEBUG = require("dbg") local function yes() return true end local Kindle = Generic:new{ model = "Kindle", isKindle = yes, } local Kindle2 = Kindle:new{ model = "Kindle2", hasKeyboard = yes, hasKeys = yes, } local KindleDXG = Kindle:new{ model = "KindleDXG", hasKeyboard = yes, hasKeys = yes, } local Kindle3 = Kindle2:new{ model = "Kindle3", hasKeyboard = yes, hasKeys = yes, } local Kindle4 = Kindle:new{ model = "Kindle4", hasKeys = yes, } local KindleTouch = Kindle:new{ model = "KindleTouch", isTouchDevice = yes, touch_dev = "/dev/input/event3", } local KindlePaperWhite = Kindle:new{ model = "KindlePaperWhite", isTouchDevice = yes, hasFrontlight = yes, display_dpi = 212, touch_dev = "/dev/input/event0", } local KindlePaperWhite2 = Kindle:new{ model = "KindlePaperWhite2", isTouchDevice = yes, hasFrontlight = yes, display_dpi = 212, touch_dev = "/dev/input/event1", } local KindleBasic = Kindle:new{ model = "KindleBasic", isTouchDevice = yes, -- FIXME! touch_dev = "/dev/input/event0", } local KindleVoyage = Kindle:new{ model = "KindleVoyage", isTouchDevice = yes, hasFrontlight = yes, display_dpi = 300, touch_dev = "/dev/input/event1", } function Kindle2:init() self.screen = require("ffi/framebuffer_einkfb"):new{device = self, debug = DEBUG} self.input = require("device/input"):new{ device = self, event_map = require("device/kindle/event_map_keyboard"), } self.input.open("/dev/input/event1") Kindle.init(self) end function KindleDXG:init() self.screen = require("ffi/framebuffer_einkfb"):new{device = self, debug = DEBUG} self.input = require("device/input"):new{ device = self, event_map = require("device/kindle/event_map_keyboard"), } self.input.open("/dev/input/event0") self.input.open("/dev/input/event1") Kindle.init(self) end function Kindle3:init() self.screen = require("ffi/framebuffer_einkfb"):new{device = self, debug = DEBUG} self.input = require("device/input"):new{ device = self, event_map = require("device/kindle/event_map_keyboard"), } self.input.open("/dev/input/event1") self.input.open("/dev/input/event2") Kindle.init(self) end function Kindle4:init() self.screen = require("ffi/framebuffer_einkfb"):new{device = self, debug = DEBUG} self.input = require("device/input"):new{ device = self, event_map = require("device/kindle/event_map_kindle4"), } self.input.event_map = require("device/kindle/event_map_kindle4") self.input.open("/dev/input/event1") Kindle.init(self) end local ABS_MT_POSITION_X = 53 local ABS_MT_POSITION_Y = 54 function KindleTouch:init() self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = DEBUG} self.powerd = require("device/kindle/powerd"):new{ device = self, batt_capacity_file = "/sys/devices/system/yoshi_battery/yoshi_battery0/battery_capacity", is_charging_file = "/sys/devices/platform/fsl-usb2-udc/charging", } self.input = require("device/input"):new{ device = self, -- Kindle Touch has a single button event_map = { [102] = "Home" }, } -- Kindle Touch needs event modification for proper coordinates self.input:registerEventAdjustHook(self.input.adjustTouchScale, {x=600/4095, y=800/4095}) -- event0 in KindleTouch is "WM8962 Beep Generator" (useless) -- event1 in KindleTouch is "imx-yoshi Headset" (useless) self.input.open("/dev/input/event2") -- Home button self.input.open("/dev/input/event3") -- touchscreen self.input.open("fake_events") Kindle.init(self) end function KindlePaperWhite:init() self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = DEBUG} self.powerd = require("device/kindle/powerd"):new{ device = self, fl_intensity_file = "/sys/devices/system/fl_tps6116x/fl_tps6116x0/fl_intensity", batt_capacity_file = "/sys/devices/system/yoshi_battery/yoshi_battery0/battery_capacity", is_charging_file = "/sys/devices/platform/aplite_charger.0/charging", } Kindle.init(self) self.input.open("/dev/input/event0") self.input.open("fake_events") end function KindlePaperWhite2:init() self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = DEBUG} self.powerd = require("device/kindle/powerd"):new{ device = self, fl_intensity_file = "/sys/class/backlight/max77696-bl/brightness", batt_capacity_file = "/sys/devices/system/wario_battery/wario_battery0/battery_capacity", is_charging_file = "/sys/devices/system/wario_charger/wario_charger0/charging", } Kindle.init(self) self.input.open("/dev/input/event1") self.input.open("fake_events") end function KindleBasic:init() self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = DEBUG} self.powerd = require("device/kindle/powerd"):new{ device = self, batt_capacity_file = "/sys/devices/system/wario_battery/wario_battery0/battery_capacity", is_charging_file = "/sys/devices/system/wario_charger/wario_charger0/charging", } Kindle.init(self) -- FIXME! self.input.open("/dev/input/event0") self.input.open("fake_events") end function KindleVoyage:init() self.screen = require("ffi/framebuffer_mxcfb"):new{device = self, debug = DEBUG} self.powerd = require("device/kindle/powerd"):new{ device = self, fl_intensity_file = "/sys/class/backlight/max77696-bl/brightness", batt_capacity_file = "/sys/devices/system/wario_battery/wario_battery0/battery_capacity", is_charging_file = "/sys/devices/system/wario_charger/wario_charger0/charging", } Kindle.init(self) self.input.open("/dev/input/event1") -- TODO: Handle the page turn 'buttons'! (/dev/input/event2) self.input.open("fake_events") end --[[ Test if a kindle device has Special Offers --]] local function isSpecialOffers() -- Look at the current blanket modules to see if the SO screensavers are enabled... local lipc = require("liblipclua") if not lipc then DEBUG("could not load liblibclua") return false end local lipc_handle = lipc.init("com.github.koreader.device") if not lipc_handle then DEBUG("could not get lipc handle") return false end local so = false local loaded_blanket_modules = lipc_handle:get_string_property("com.lab126.blanket", "load") if string.find(loaded_blanket_modules, "ad_screensaver") then so = true end lipc_handle:close() return so end function KindleTouch:exit() if isSpecialOffers() then -- fake a touch event if self.touch_dev then local width, height = self.screen:getScreenWidth(), self.screen:getScreenHeight() require("ffi/input").fakeTapInput(self.touch_dev, math.min(width, height)/2, math.max(width, height)-30 ) end end Generic.exit(self) end KindlePaperWhite.exit = KindleTouch.exit KindlePaperWhite2.exit = KindleTouch.exit KindleBasic.exit = KindleTouch.exit KindleVoyage.exit = KindleTouch.exit function Kindle3:exit() -- send double menu key press events to trigger screen refresh os.execute("echo 'send 139' > /proc/keypad;echo 'send 139' > /proc/keypad") Generic.exit(self) end KindleDXG.exit = Kindle3.exit ----------------- device recognition: ------------------- local function Set(list) local set = {} for _, l in ipairs(list) do set[l] = true end return set end local kindle_sn = io.open("/proc/usid", "r") if not kindle_sn then return end local kindle_devcode = string.sub(kindle_sn:read(),3,4) kindle_sn:close() -- NOTE: Update me when new devices come out :) local k2_set = Set { "02", "03" } local dx_set = Set { "04", "05" } local dxg_set = Set { "09" } local k3_set = Set { "08", "06", "0A" } local k4_set = Set { "0E", "23" } local touch_set = Set { "0F", "11", "10", "12" } local pw_set = Set { "24", "1B", "1D", "1F", "1C", "20" } local pw2_set = Set { "D4", "5A", "D5", "D6", "D7", "D8", "F2", "17", "60", "F4", "F9", "62", "61", "5F" } local kt2_set = Set { "C6", "DD" } local kv_set = Set { "13", "54", "2A", "4F", "52", "53" } if k2_set[kindle_devcode] then return Kindle2 elseif dx_set[kindle_devcode] then return Kindle2 elseif dxg_set[kindle_devcode] then return KindleDXG elseif k3_set[kindle_devcode] then return Kindle3 elseif k4_set[kindle_devcode] then return Kindle4 elseif touch_set[kindle_devcode] then return KindleTouch elseif pw_set[kindle_devcode] then return KindlePaperWhite elseif pw2_set[kindle_devcode] then return KindlePaperWhite2 elseif kt2_set[kindle_devcode] then return KindleBasic elseif kv_set[kindle_devcode] then return KindleVoyage end error("unknown Kindle model "..kindle_devcode)
agpl-3.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/La_Theine_Plateau/npcs/Telepoint.lua
2
1564
----------------------------------- -- Area: La Theine Plateau -- NPC: Telepoint ----------------------------------- package.loaded["scripts/zones/La_Theine_Plateau/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/La_Theine_Plateau/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) item = trade:getItem(); if(trade:getItemCount() == 1 and item > 4095 and item < 4104) then if(player:getFreeSlotsCount() > 0 and player:hasItem(613) == false) then player:tradeComplete(); player:addItem(613); player:messageSpecial(ITEM_OBTAINED,613); -- Faded Crystal else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,613); -- Faded Crystal end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(player:hasKeyItem(HOLLA_GATE_CRYSTAL) == false) then player:addKeyItem(HOLLA_GATE_CRYSTAL); player:messageSpecial(KEYITEM_OBTAINED,HOLLA_GATE_CRYSTAL); else player:messageSpecial(ALREADY_OBTAINED_TELE); 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
TheOnePharaoh/YGOPro-Custom-Cards
script/c6666677.lua
2
2604
--Shila, Shaderune Scout function c6666677.initial_effect(c) c:EnableUnsummonable() --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(6666677,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_REMOVE) e1:SetCondition(c6666677.condtion) e1:SetTarget(c6666677.target) e1:SetOperation(c6666677.operation) c:RegisterEffect(e1) --banish local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(6666677,1)) e2:SetCategory(CATEGORY_REMOVE+CATEGORY_DECKDES) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCost(c6666677.descost) e2:SetTarget(c6666677.destg) e2:SetOperation(c6666677.desop) c:RegisterEffect(e2) --splimit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_SPSUMMON_CONDITION) e3:SetValue(c6666677.splimit) c:RegisterEffect(e3) end function c6666677.splimit(e,se,sp,st) return se:IsHasType(EFFECT_TYPE_ACTIONS) end function c6666677.condtion(e,tp,eg,ep,ev,re,r,rp) return bit.band(r,REASON_EFFECT)~=0 and re:IsActiveType(TYPE_MONSTER) and e:GetHandler():IsPreviousLocation(LOCATION_DECK) end function c6666677.target(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) end function c6666677.operation(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP) end end function c6666677.descost(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 c6666677.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:GetLocation()==LOCATION_MZONE and chkc:IsAbleToRemove() end if chk==0 then return Duel.GetDecktopGroup(tp,3) and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DECKDES,0,0,tp,3) end function c6666677.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then Duel.BreakEffect() local g=Duel.GetDecktopGroup(tp,3) Duel.DisableShuffleCheck() Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end
gpl-3.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Southern_San_dOria_[S]/npcs/Rholont.lua
4
2217
----------------------------------- -- Area: Southern SandOria [S] -- NPC: Rholont -- @zone 80 -- @pos -168 -2 56 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria_[S]/TextIDs"] = nil; require("scripts/zones/Southern_San_dOria_[S]/TextIDs"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(player:getQuestStatus(CRYSTAL_WAR,GIFTS_OF_THE_GRIFFON) == QUEST_ACCEPTED and player:getVar("GiftsOfGriffonProg") == 1) then player:startEvent(0x017); -- Gifts of Griffon Start elseif (player:getQuestStatus(CRYSTAL_WAR,GIFTS_OF_THE_GRIFFON) == QUEST_ACCEPTED and player:getVar("GiftsOfGriffonProg") == 9) then player:startEvent(0x018); -- Gifts of Griffon Quest Complete elseif(player:getQuestStatus(CRYSTAL_WAR,CLAWS_OF_THE_GRIFFON) == QUEST_AVAILABLE and player:getQuestStatus(CRYSTAL_WAR,GIFTS_OF_THE_GRIFFON) == QUEST_COMPLETED and player:getMainLvl() >= 15) then player:startEvent(0x02F) -- Claws of Griffon Start else player:startEvent(0x020); -- Default Dialogue end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x02F) then player:addQuest(CRYSTAL_WAR,CLAWS_OF_THE_GRIFFON); elseif (csid == 0x017) then if(player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,2528); else player:setVar("GiftsOfGriffonProg",2); player:addItem(2528,7); -- Plume d'or player:messageSpecial(ITEM_OBTAINED,2528); end elseif (csid == 0x018) then player:addItem(812,1) player:messageSpecial(ITEM_OBTAINED,812); player:setVar("GiftsOfGriffonProg",0); player:completeQuest(CRYSTAL_WAR,GIFTS_OF_THE_GRIFFON); end end;
gpl-3.0
pedrohenriquerls/cocos2d_ruby_binding
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/Armature.lua
10
5702
-------------------------------- -- @module Armature -- @extend Node,BlendProtocol -- @parent_module ccs -------------------------------- -- Get a bone with the specified name<br> -- param name The bone's name you want to get -- @function [parent=#Armature] getBone -- @param self -- @param #string name -- @return Bone#Bone ret (return value: ccs.Bone) -------------------------------- -- Change a bone's parent with the specified parent name.<br> -- param bone The bone you want to change parent<br> -- param parentName The new parent's name. -- @function [parent=#Armature] changeBoneParent -- @param self -- @param #ccs.Bone bone -- @param #string parentName -------------------------------- -- -- @function [parent=#Armature] setAnimation -- @param self -- @param #ccs.ArmatureAnimation animation -------------------------------- -- -- @function [parent=#Armature] getBoneAtPoint -- @param self -- @param #float x -- @param #float y -- @return Bone#Bone ret (return value: ccs.Bone) -------------------------------- -- -- @function [parent=#Armature] getArmatureTransformDirty -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- -- @function [parent=#Armature] setVersion -- @param self -- @param #float version -------------------------------- -- Set contentsize and Calculate anchor point. -- @function [parent=#Armature] updateOffsetPoint -- @param self -------------------------------- -- -- @function [parent=#Armature] getParentBone -- @param self -- @return Bone#Bone ret (return value: ccs.Bone) -------------------------------- -- Remove a bone with the specified name. If recursion it will also remove child Bone recursionly.<br> -- param bone The bone you want to remove<br> -- param recursion Determine whether remove the bone's child recursion. -- @function [parent=#Armature] removeBone -- @param self -- @param #ccs.Bone bone -- @param #bool recursion -------------------------------- -- -- @function [parent=#Armature] getBatchNode -- @param self -- @return BatchNode#BatchNode ret (return value: ccs.BatchNode) -------------------------------- -- @overload self, string -- @overload self -- @overload self, string, ccs.Bone -- @function [parent=#Armature] init -- @param self -- @param #string name -- @param #ccs.Bone parentBone -- @return bool#bool ret (return value: bool) -------------------------------- -- -- @function [parent=#Armature] setParentBone -- @param self -- @param #ccs.Bone parentBone -------------------------------- -- -- @function [parent=#Armature] setBatchNode -- @param self -- @param #ccs.BatchNode batchNode -------------------------------- -- -- @function [parent=#Armature] setArmatureData -- @param self -- @param #ccs.ArmatureData armatureData -------------------------------- -- Add a Bone to this Armature,<br> -- param bone The Bone you want to add to Armature<br> -- param parentName The parent Bone's name you want to add to . If it's nullptr, then set Armature to its parent -- @function [parent=#Armature] addBone -- @param self -- @param #ccs.Bone bone -- @param #string parentName -------------------------------- -- -- @function [parent=#Armature] getArmatureData -- @param self -- @return ArmatureData#ArmatureData ret (return value: ccs.ArmatureData) -------------------------------- -- -- @function [parent=#Armature] getVersion -- @param self -- @return float#float ret (return value: float) -------------------------------- -- -- @function [parent=#Armature] getAnimation -- @param self -- @return ArmatureAnimation#ArmatureAnimation ret (return value: ccs.ArmatureAnimation) -------------------------------- -- -- @function [parent=#Armature] getOffsetPoints -- @param self -- @return vec2_table#vec2_table ret (return value: vec2_table) -------------------------------- -- Get Armature's bone dictionary<br> -- return Armature's bone dictionary -- @function [parent=#Armature] getBoneDic -- @param self -- @return map_table#map_table ret (return value: map_table) -------------------------------- -- @overload self, string -- @overload self -- @overload self, string, ccs.Bone -- @function [parent=#Armature] create -- @param self -- @param #string name -- @param #ccs.Bone parentBone -- @return Armature#Armature ret (return value: ccs.Armature) -------------------------------- -- -- @function [parent=#Armature] setAnchorPoint -- @param self -- @param #vec2_table point -------------------------------- -- -- @function [parent=#Armature] draw -- @param self -- @param #cc.Renderer renderer -- @param #mat4_table transform -- @param #unsigned int flags -------------------------------- -- -- @function [parent=#Armature] getAnchorPointInPoints -- @param self -- @return vec2_table#vec2_table ret (return value: vec2_table) -------------------------------- -- -- @function [parent=#Armature] update -- @param self -- @param #float dt -------------------------------- -- -- @function [parent=#Armature] getNodeToParentTransform -- @param self -- @return mat4_table#mat4_table ret (return value: mat4_table) -------------------------------- -- This boundingBox will calculate all bones' boundingBox every time -- @function [parent=#Armature] getBoundingBox -- @param self -- @return rect_table#rect_table ret (return value: rect_table) -------------------------------- -- js ctor -- @function [parent=#Armature] Armature -- @param self return nil
mit
X-Raym/REAPER-ReaScripts
Track Properties/X-Raym_Unselect tracks with certain words in their SWS notes.lua
1
2026
--[[ * ReaScript Name: Unselect tracks with certain words in their SWS notes * Author: X-Raym * Author URI: https://www.extremraym.com * Repository: https://github.com/X-Raym/REAPER-Scripts * Licence: GPL v3 * REAPER: 5.0 * Version: 1.0.2 --]] --[[ * Changelog: * v1.0.1 (2022-01-28) # Micro optimization * v1.0 (2021-02-27) + Initial release --]] -- USER CONFIG AREA ----------------------------------------------------------- console = true -- true/false: display debug messages in the console words = {"Unselect", "None"} full_word = true ------------------------------------------------------- END OF USER CONFIG AREA -- UTILITIES ------------------------------------------------------------- local reaper = reaper -- Display a message in the console for debugging function Msg(value) if console then reaper.ShowConsoleMsg(tostring(value) .. "\n") end end --------------------------------------------------------- END OF UTILITIES -- Main function function Main() for i = count_sel_tracks - 1, 0, - 1 do local track = reaper.GetSelectedTrack(0,i) local notes = reaper.NF_GetSWSTrackNotes(track) if notes then for z, word in ipairs(words) do local find_word = notes:find( word ) if (not full_word and find_word ) or (full_word and find_word and not notes:find( word .. "%a" )) then reaper.SetTrackSelected(track, false) break end end end end end -- INIT function Init() -- See if there is items selected count_sel_tracks = reaper.CountSelectedTracks(0) if count_sel_tracks > 0 then reaper.PreventUIRefresh(1) reaper.Undo_BeginBlock() -- Begining of the undo block. Leave it at the top of your main function. Main() reaper.Undo_EndBlock("Unselect tracks with certain words in their SWS notes", -1) -- End of the undo block. Leave it at the bottom of your main function. reaper.UpdateArrange() reaper.PreventUIRefresh(-1) end end if not preset_file_init then Init() end
gpl-3.0
waytim/darkstar
scripts/zones/Valley_of_Sorrows/mobs/Adamantoise.lua
5
1529
----------------------------------- -- Area: Valley of Sorrows -- HNM: Adamantoise ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/status"); ----------------------------------- -- onMobInitialize ----------------------------------- function onMobInitialize(mob) end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, player, isKiller) player:addTitle(TORTOISE_TORTURER); end; ----------------------------------- -- onMobDespawn ----------------------------------- function onMobDespawn(mob) local Adamantoise = mob:getID(); local Aspidochelone = mob:getID()+1; local ToD = GetServerVariable("[POP]Aspidochelone"); local kills = GetServerVariable("[PH]Aspidochelone"); local popNow = (math.random(1,5) == 3 or kills > 6); if (LandKingSystem_HQ ~= 1 and ToD <= os.time(t) and popNow == true) then -- 0 = timed spawn, 1 = force pop only, 2 = BOTH if (LandKingSystem_NQ == 0) then DeterMob(Adamantoise, true); end DeterMob(Aspidochelone, false); UpdateNMSpawnPoint(Aspidochelone); GetMobByID(Aspidochelone):setRespawnTime(math.random(75600,86400)); else if (LandKingSystem_NQ ~= 1) then UpdateNMSpawnPoint(Adamantoise); mob:setRespawnTime(math.random(75600,86400)); SetServerVariable("[PH]Aspidochelone", kills + 1); end end end;
gpl-3.0
CaptainPRICE/wire
lua/wire/client/text_editor/modes/e2.lua
1
16764
local table_concat = table.concat local string_sub = string.sub local string_gmatch = string.gmatch local string_gsub = string.gsub local EDITOR = {} local function istype(tp) return wire_expression_types[tp:upper()] or tp == "number" end -- keywords[name][nextchar!="("] local keywords = { -- keywords that can be followed by a "(": ["if"] = { [true] = true, [false] = true }, ["elseif"] = { [true] = true, [false] = true }, ["while"] = { [true] = true, [false] = true }, ["for"] = { [true] = true, [false] = true }, ["foreach"] = { [true] = true, [false] = true }, ["switch"] = { [true] = true, [false] = true }, ["case"] = { [true] = true, [false] = true }, ["default"] = { [true] = true, [false] = true }, -- keywords that cannot be followed by a "(": ["else"] = { [true] = true }, ["break"] = { [true] = true }, ["continue"] = { [true] = true }, --["function"] = { [true] = true }, ["return"] = { [true] = true }, ["local"] = { [true] = true }, } -- fallback for nonexistant entries: setmetatable(keywords, { __index=function(tbl,index) return {} end }) local directives = { ["@name"] = 0, -- all yellow ["@model"] = 0, ["@inputs"] = 1, -- directive yellow, types orange, rest normal ["@outputs"] = 1, ["@persist"] = 1, ["@trigger"] = 2, -- like 1, except that all/none are yellow ["@autoupdate"] = 0, } local colors = { ["directive"] = { Color(240, 240, 160), false}, -- yellow ["number"] = { Color(240, 160, 160), false}, -- light red ["function"] = { Color(160, 160, 240), false}, -- blue ["notfound"] = { Color(240, 96, 96), false}, -- dark red ["variable"] = { Color(160, 240, 160), false}, -- light green ["string"] = { Color(128, 128, 128), false}, -- grey ["keyword"] = { Color(160, 240, 240), false}, -- turquoise ["operator"] = { Color(224, 224, 224), false}, -- white ["comment"] = { Color(128, 128, 128), false}, -- grey ["ppcommand"] = { Color(240, 96, 240), false}, -- purple ["typename"] = { Color(240, 160, 96), false}, -- orange ["constant"] = { Color(240, 160, 240), false}, -- pink ["userfunction"] = { Color(102, 122, 102), false}, -- dark grayish-green } function EDITOR:GetSyntaxColor(name) return colors[name][1] end function EDITOR:SetSyntaxColor( colorname, colr ) if not colors[colorname] then return end colors[colorname][1] = colr end -- cols[n] = { tokendata, color } local cols = {} local lastcol local function addToken(tokenname, tokendata) local color = colors[tokenname] if lastcol and color == lastcol[2] then lastcol[1] = lastcol[1] .. tokendata else cols[#cols + 1] = { tokendata, color, tokenname } lastcol = cols[#cols] end end function EDITOR:CommentSelection(removecomment) local sel_start, sel_caret = self:MakeSelection( self:Selection() ) local mode = self:GetParent().BlockCommentStyleConVar:GetInt() if mode == 0 then -- New (alt 1) local str = self:GetSelection() if removecomment then if str:find( "^#%[\n" ) and str:find( "\n%]#$" ) then self:SetSelection( str:gsub( "^#%[\n(.+)\n%]#$", "%1" ) ) sel_caret[1] = sel_caret[1] - 2 end else self:SetSelection( "#[\n" .. str .. "\n]#" ) sel_caret[1] = sel_caret[1] + 1 sel_caret[2] = 3 end elseif mode == 1 then -- New (alt 2) local str = self:GetSelection() if removecomment then if str:find( "^#%[" ) and str:find( "%]#$" ) then self:SetSelection( str:gsub( "^#%[(.+)%]#$", "%1" ) ) sel_caret[2] = sel_caret[2] - 4 end else self:SetSelection( "#[" .. self:GetSelection() .. "]#" ) end elseif mode == 2 then -- Old local comment_char = "#" if removecomment then -- shift-TAB with a selection -- local tmp = string_gsub("\n"..self:GetSelection(), "\n"..comment_char, "\n") -- makes sure that the first line is outdented self:SetSelection(tmp:sub(2)) else -- plain TAB with a selection -- self:SetSelection(comment_char .. self:GetSelection():gsub("\n", "\n"..comment_char)) end else ErrorNoHalt( "Invalid block comment style" ) end return { sel_start, sel_caret } end function EDITOR:BlockCommentSelection(removecomment) local sel_start, sel_caret = self:MakeSelection( self:Selection() ) local str = self:GetSelection() if removecomment then if str:find( "^#%[" ) and str:find( "%]#$" ) then self:SetSelection( str:gsub( "^#%[(.+)%]#$", "%1" ) ) if sel_caret[1] == sel_start[1] then sel_caret[2] = sel_caret[2] - 4 else sel_caret[2] = sel_caret[2] - 2 end end else self:SetSelection( "#[" .. str .."]#" ) if sel_caret[1] == sel_start[1] then sel_caret[2] = sel_caret[2] + 4 else sel_caret[2] = sel_caret[2] + 2 end end return { sel_start, sel_caret } end function EDITOR:ShowContextHelp(word) E2Helper.Show() E2Helper.UseE2(self:GetParent().EditorType) E2Helper.Show(word) end function EDITOR:ResetTokenizer(row) if row == self.Scroll[1] then -- This code checks if the visible code is inside a string or a block comment self.blockcomment = nil self.multilinestring = nil local singlelinecomment = false local str = string_gsub( table_concat( self.Rows, "\n", 1, self.Scroll[1]-1 ), "\r", "" ) for before, char, after in string_gmatch( str, '()([#"\n])()' ) do local before = string_sub( str, before-1, before-1 ) local after = string_sub( str, after, after ) if not self.blockcomment and not self.multilinestring and not singlelinecomment then if char == '"' then self.multilinestring = true elseif char == "#" and after == "[" then self.blockcomment = true elseif char == "#" then singlelinecomment = true end elseif self.multilinestring and char == '"' and before ~= "\\" then self.multilinestring = nil elseif self.blockcomment and char == "#" and before == "]" then self.blockcomment = nil elseif singlelinecomment and char == "\n" then singlelinecomment = false end end end for k,v in pairs( self.e2fs_functions ) do if v == row then self.e2fs_functions[k] = nil end end end function EDITOR:SyntaxColorLine(row) cols,lastcol = {}, nil self:ResetTokenizer(row) self:NextCharacter() -- 0=name 1=port 2=trigger 3=foreach local highlightmode = nil if self.blockcomment then if self:NextPattern(".-]#") then self.blockcomment = nil else self:NextPattern(".*") end addToken("comment", self.tokendata) elseif self.multilinestring then while self.character do -- Find the ending " if self.character == '"' then self.multilinestring = nil self:NextCharacter() break end if self.character == "\\" then self:NextCharacter() end self:NextCharacter() end addToken("string", self.tokendata) elseif self:NextPattern("^@[^ ]*") then highlightmode = directives[self.tokendata] -- check for unknown directives if not highlightmode then return { { "@", colors.directive }, { self.line:sub(2), colors.notfound } } end -- check for plain text directives if highlightmode == 0 then return {{ self.line, colors.directive }} end -- parse the rest like regular code cols = {{ self.tokendata, colors.directive }} end local found = self:SkipPattern( "( *function)" ) if found then addToken( "keyword", found ) -- Add "function" self.tokendata = "" -- Reset tokendata local spaces = self:SkipPattern( " *" ) if spaces then addToken( "comment", spaces ) end if self:NextPattern( "[a-z][a-zA-Z0-9]*%s%s*[a-z][a-zA-Z0-9]*:[a-z][a-zA-Z0-9_]*" ) then -- Everything specified (returntype typeindex:funcname) local returntype, spaces, typeindex, funcname = self.tokendata:match( "([a-z][a-zA-Z0-9]*)(%s%s*)([a-z][a-zA-Z0-9]*):([a-z][a-zA-Z0-9_]*)" ) if istype( returntype ) or returntype == "void" then addToken( "typename", returntype ) else addToken( "notfound", returntype ) end addToken( "comment", spaces ) if istype( typeindex ) then addToken( "typename", typeindex ) else addToken( "notfound", typeindex ) end addToken( "operator", ":" ) addToken( "userfunction", funcname ) if not wire_expression2_funclist[funcname] then self.e2fs_functions[funcname] = row end self.tokendata = "" elseif self:NextPattern( "[a-z][a-zA-Z0-9]*%s%s*[a-z][a-zA-Z0-9_]*" ) then -- returntype funcname local returntype, spaces, funcname = self.tokendata:match( "([a-z][a-zA-Z0-9]*)(%s%s*)([a-z][a-zA-Z0-9_]*)" ) if istype( returntype ) or returntype == "void" then addToken( "typename", returntype ) else addToken( "notfound", returntype ) end addToken( "comment", spaces ) if istype( funcname ) then -- Hey... this isn't a function name! :O addToken( "typename", funcname ) else addToken( "userfunction", funcname ) end if not wire_expression2_funclist[funcname] then self.e2fs_functions[funcname] = row end self.tokendata = "" elseif self:NextPattern( "[a-z][a-zA-Z0-9]*:[a-z][a-zA-Z0-9_]*" ) then -- typeindex:funcname local typeindex, funcname = self.tokendata:match( "([a-z][a-zA-Z0-9]*):([a-z][a-zA-Z0-9_]*)" ) if istype( typeindex ) then addToken( "typename", typeindex ) else addToken( "notfound", typeindex ) end addToken( "operator", ":" ) addToken( "userfunction", funcname ) if not wire_expression2_funclist[funcname] then self.e2fs_functions[funcname] = row end self.tokendata = "" elseif self:NextPattern( "[a-z][a-zA-Z0-9_]*" ) then -- funcname local funcname = self.tokendata:match( "[a-z][a-zA-Z0-9_]*" ) if istype( funcname ) or funcname == "void" then -- Hey... this isn't a function name! :O addToken( "typename", funcname ) else addToken( "userfunction", funcname ) if not wire_expression2_funclist[funcname] then self.e2fs_functions[funcname] = row end end self.tokendata = "" end if self:NextPattern( "%(" ) then -- We found a bracket -- Color the bracket addToken( "operator", self.tokendata ) while self.character and self.character ~= ")" do -- Loop until the ending bracket self.tokendata = "" local spaces = self:SkipPattern( " *" ) if spaces then addToken( "comment", spaces ) end if self:NextPattern( "%[" ) then -- Found a [ -- Color the bracket addToken( "operator", self.tokendata ) self.tokendata = "" while self:NextPattern( "[A-Z][a-zA-Z0-9_]*" ) do -- If we found a variable addToken( "variable", self.tokendata ) self.tokendata = "" local spaces = self:SkipPattern( " *" ) if spaces then addToken( "comment", spaces ) end end if self:NextPattern( "%]" ) then addToken( "operator", "]" ) self.tokendata = "" end elseif self:NextPattern( "[A-Z][a-zA-Z0-9_]*" ) then -- If we found a variable -- Color the variable addToken( "variable", self.tokendata ) self.tokendata = "" end if self:NextPattern( ":" ) then -- Check for the colon addToken( "operator", ":" ) self.tokendata = "" end -- Find the type if self:NextPattern( "[a-z][a-zA-Z0-9_]*" ) then if istype( self.tokendata ) or self.tokendata == "void" then -- If it's a type addToken( "typename", self.tokendata ) else -- aww addToken( "notfound", self.tokendata ) end else break end local spaces = self:SkipPattern( " *" ) if spaces then addToken( "comment", spaces ) end -- If we found a comma, skip it if self.character == "," then addToken( "operator", "," ) self:NextCharacter() end end end self.tokendata = "" if self:NextPattern( "%) *{?" ) then -- check for ending bracket (and perhaps an ending {?) addToken( "operator", self.tokendata ) end end while self.character do local tokenname = "" self.tokendata = "" -- eat all spaces local spaces = self:SkipPattern(" *") if spaces then addToken("operator", spaces) end if not self.character then break end -- eat next token if self:NextPattern("^_[A-Z][A-Z_0-9]*") then local word = self.tokendata for k,_ in pairs( wire_expression2_constants ) do if k == word then tokenname = "constant" end end if tokenname == "" then tokenname = "notfound" end elseif self:NextPattern("^0[xb][0-9A-F]+") then tokenname = "number" elseif self:NextPattern("^[0-9][0-9.e]*") then tokenname = "number" elseif self:NextPattern("^[a-z][a-zA-Z0-9_]*") then local sstr = self.tokendata if highlightmode then if highlightmode == 1 and istype(sstr) then tokenname = "typename" elseif highlightmode == 2 and (sstr == "all" or sstr == "none") then tokenname = "directive" elseif highlightmode == 3 and istype(sstr) then tokenname = "typename" highlightmode = nil else tokenname = "notfound" end else -- is this a keyword or a function? local char = self.character or "" local keyword = char ~= "(" local spaces = self:SkipPattern(" *") or "" if self.character == "]" then -- X[Y,typename] tokenname = istype(sstr) and "typename" or "notfound" elseif keywords[sstr][keyword] then tokenname = "keyword" if sstr == "foreach" then highlightmode = 3 elseif sstr == "return" and self:NextPattern( "void" ) then addToken( "keyword", "return" ) tokenname = "typename" self.tokendata = spaces .. "void" spaces = "" end elseif wire_expression2_funclist[sstr] then tokenname = "function" elseif self.e2fs_functions[sstr] then tokenname = "userfunction" else tokenname = "notfound" local correctName = wire_expression2_funclist_lowercase[sstr:lower()] if correctName then self.tokendata = "" for i = 1,#sstr do local c = sstr:sub(i,i) if correctName:sub(i,i) == c then tokenname = "function" else tokenname = "notfound" end if i == #sstr then self.tokendata = c else addToken(tokenname, c) end end end end addToken(tokenname, self.tokendata) tokenname = "operator" self.tokendata = spaces end elseif self:NextPattern("^[A-Z][a-zA-Z0-9_]*") then tokenname = "variable" elseif self.character == '"' then self:NextCharacter() while self.character do -- Find the ending " if self.character == '"' then tokenname = "string" break end if self.character == "\\" then self:NextCharacter() end self:NextCharacter() end if tokenname == "" then -- If no ending " was found... self.multilinestring = true tokenname = "string" else self:NextCharacter() end elseif self.character == "#" then self:NextCharacter() if self.character == "[" then -- Check if there is a [ directly after the # while self.character do -- Find the ending ] if self.character == "]" then self:NextCharacter() if self.character == "#" then -- Check if there is a # directly after the ending ] tokenname = "comment" break end end if self.character == "\\" then self:NextCharacter() end self:NextCharacter() end if tokenname == "" then -- If no ending ]# was found... self.blockcomment = true tokenname = "comment" else self:NextCharacter() end end if tokenname == "" then self:NextPattern("[^ ]*") -- Find the whole word if PreProcessor["PP_"..self.tokendata:sub(2)] then -- there is a preprocessor command by that name => mark as such tokenname = "ppcommand" elseif self.tokendata == "#include" then tokenname = "keyword" else -- eat the rest and mark as a comment self:NextPattern(".*") tokenname = "comment" end end else self:NextCharacter() tokenname = "operator" end addToken(tokenname, self.tokendata) end return cols end WireTextEditor.Modes.E2 = EDITOR
apache-2.0
waytim/darkstar
scripts/zones/Southern_San_dOria/npcs/Varchet.lua
13
2813
----------------------------------- -- Area: Southern San d'Oria -- NPC: Varchet -- Type: NPC -- @pos 116.484 -1 91.554 230 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); local GAME_WON = 0; local GAME_LOST = 2; local GAME_TIE = 3; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (npcUtil.tradeHas(trade, nil, 5)) then player:tradeComplete(); local vdie1 = math.random(1,6); local vdie2 = math.random(1,6); local vtotal = vdie1 + vdie2; local pdie1 = math.random(1,6); local pdie2 = math.random(1,6); local ptotal = pdie1 + pdie2; if (ptotal > vtotal) then player:startEvent(0x0207,vdie1,vdie2,vtotal,pdie1,pdie2,ptotal,GAME_WON); elseif (vtotal > ptotal) then player:startEvent(0x0207,vdie1,vdie2,vtotal,pdie1,pdie2,ptotal,GAME_LOST); elseif (ptotal == vtotal) then player:startEvent(0x0207,vdie1,vdie2,vtotal,pdie1,pdie2,ptotal,GAME_TIE); else printf("Results Varchet's Roll : %u, Player's Roll : %u", vtotal, ptotal); end else player:startEvent(0x0260); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local exitTheGambler = player:getQuestStatus(SANDORIA,EXIT_THE_GAMBLER); if (exitTheGambler == QUEST_ACCEPTED) then player:startEvent(0x027e); else player:startEvent(0x020d); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("U CSID: %u",csid); -- printf("U RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("F CSID: %u",csid); --printf("F RESULT: %u",option); local exitTheGambler = player:getQuestStatus(SANDORIA,EXIT_THE_GAMBLER); local npc = player:getEventTarget(); if (csid == 519) then if (option == GAME_WON) then npc.giveGil(player, 10, {rate=false}); if (exitTheGambler == QUEST_ACCEPTED) then player:completeQuest(SANDORIA,EXIT_THE_GAMBLER); player:showText(npc,7629); end elseif (option == GAME_TIE) then npc.giveGil(player, 5, {rate=false}); player:showText(npc,7622); else player:showText(npc,7620); end end end;
gpl-3.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c11478419.lua
2
2675
--Divine Alternation function c11478419.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(11478419,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,11478419) e1:SetCondition(c11478419.condition) e1:SetTarget(c11478419.target) e1:SetOperation(c11478419.operation) c:RegisterEffect(e1) end function c11478419.condition(e,tp,eg,ep,ev,re,r,rp) return tp~=Duel.GetTurnPlayer() and (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE) end function c11478419.filter1(c,e,tp) return c:IsFaceup() and c:IsCode(11478402) and c:IsType(TYPE_TUNER) and c:IsAttribute(ATTRIBUTE_LIGHT) and Duel.IsExistingTarget(c11478419.filter2,tp,LOCATION_REMOVED,0,1,nil,e,tp,c:GetLevel()) end function c11478419.filter2(c,e,tp,lv) local clv=c:GetLevel() return clv>0 and c:IsFaceup() and c:IsSetCard(0xf2002) and c:IsType(TYPE_RITUAL) and c:IsAttribute(ATTRIBUTE_DEVINE) and Duel.IsExistingMatchingCard(c11478419.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,lv+clv) end function c11478419.spfilter(c,e,tp,lv) return c:IsCode(11478411) and c:IsType(TYPE_SYNCHRO) and c:GetLevel()==lv and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,true,false) end function c11478419.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(c11478419.filter1,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g1=Duel.SelectTarget(tp,c11478419.filter1,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g2=Duel.SelectTarget(tp,c11478419.filter2,tp,LOCATION_REMOVED,0,1,1,nil,e,tp,g1:GetFirst():GetLevel()) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g1,2,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function c11478419.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tc1=g:GetFirst() local tc2=g:GetNext() if not tc1:IsRelateToEffect(e) or not tc2:IsRelateToEffect(e) then return end local sg=Duel.GetMatchingGroup(c11478419.spfilter,tp,LOCATION_EXTRA,0,nil,e,tp,tc1:GetLevel()+tc2:GetLevel()) if sg:GetCount()==0 then return end Duel.SendtoGrave(g,REASON_EFFECT+REASON_RETURN) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local ssg=sg:Select(tp,1,1,nil) Duel.SpecialSummon(ssg,SUMMON_TYPE_SYNCHRO,tp,tp,true,false,POS_FACEUP) end
gpl-3.0
SEEDTEAM/TeleSeed
bot/utils.lua
473
24167
URL = require "socket.url" http = require "socket.http" https = require "ssl.https" ltn12 = require "ltn12" serpent = require "serpent" feedparser = require "feedparser" json = (loadfile "./libs/JSON.lua")() mimetype = (loadfile "./libs/mimetype.lua")() redis = (loadfile "./libs/redis.lua")() JSON = (loadfile "./libs/dkjson.lua")() http.TIMEOUT = 10 function get_receiver(msg) if msg.to.type == 'user' then return 'user#id'..msg.from.id end if msg.to.type == 'chat' then return 'chat#id'..msg.to.id end if msg.to.type == 'encr_chat' then return msg.to.print_name end end function is_chat_msg( msg ) if msg.to.type == 'chat' then return true end return false end function string.random(length) local str = ""; for i = 1, length do math.random(97, 122) str = str..string.char(math.random(97, 122)); end return str; end function string:split(sep) local sep, fields = sep or ":", {} local pattern = string.format("([^%s]+)", sep) self:gsub(pattern, function(c) fields[#fields+1] = c end) return fields end -- DEPRECATED function string.trim(s) print("string.trim(s) is DEPRECATED use string:trim() instead") return s:gsub("^%s*(.-)%s*$", "%1") end -- Removes spaces function string:trim() return self:gsub("^%s*(.-)%s*$", "%1") end function get_http_file_name(url, headers) -- Eg: foo.var local file_name = url:match("[^%w]+([%.%w]+)$") -- Any delimited alphanumeric on the url file_name = file_name or url:match("[^%w]+(%w+)[^%w]+$") -- Random name, hope content-type works file_name = file_name or str:random(5) local content_type = headers["content-type"] local extension = nil if content_type then extension = mimetype.get_mime_extension(content_type) end if extension then file_name = file_name.."."..extension end local disposition = headers["content-disposition"] if disposition then -- attachment; filename=CodeCogsEqn.png file_name = disposition:match('filename=([^;]+)') or file_name end return file_name end -- Saves file to /tmp/. If file_name isn't provided, -- will get the text after the last "/" for filename -- and content-type for extension function download_to_file(url, file_name) print("url to download: "..url) local respbody = {} local options = { url = url, sink = ltn12.sink.table(respbody), redirect = true } -- nil, code, headers, status local response = nil if url:starts('https') then options.redirect = false response = {https.request(options)} else response = {http.request(options)} end local code = response[2] local headers = response[3] local status = response[4] if code ~= 200 then return nil end file_name = file_name or get_http_file_name(url, headers) local file_path = "/tmp/"..file_name print("Saved to: "..file_path) file = io.open(file_path, "w+") file:write(table.concat(respbody)) file:close() return file_path end function vardump(value) print(serpent.block(value, {comment=false})) end -- taken from http://stackoverflow.com/a/11130774/3163199 function scandir(directory) local i, t, popen = 0, {}, io.popen for filename in popen('ls -a "'..directory..'"'):lines() do i = i + 1 t[i] = filename end return t end -- http://www.lua.org/manual/5.2/manual.html#pdf-io.popen function run_command(str) local cmd = io.popen(str) local result = cmd:read('*all') cmd:close() return result end -- User has privileges function is_sudo(msg) local var = false -- Check users id in config for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end -- Returns the name of the sender function get_name(msg) local name = msg.from.first_name if name == nil then name = msg.from.id end return name end -- Returns at table of lua files inside plugins function plugins_names( ) local files = {} for k, v in pairs(scandir("plugins")) do -- Ends with .lua if (v:match(".lua$")) then table.insert(files, v) end end return files end -- Function name explains what it does. function file_exists(name) local f = io.open(name,"r") if f ~= nil then io.close(f) return true else return false end end -- Save into file the data serialized for lua. -- Set uglify true to minify the file. function serialize_to_file(data, file, uglify) file = io.open(file, 'w+') local serialized if not uglify then serialized = serpent.block(data, { comment = false, name = '_' }) else serialized = serpent.dump(data) end file:write(serialized) file:close() end -- Returns true if the string is empty function string:isempty() return self == nil or self == '' end -- Returns true if the string is blank function string:isblank() self = self:trim() return self:isempty() end -- DEPRECATED!!!!! function string.starts(String, Start) print("string.starts(String, Start) is DEPRECATED use string:starts(text) instead") return Start == string.sub(String,1,string.len(Start)) end -- Returns true if String starts with Start function string:starts(text) return text == string.sub(self,1,string.len(text)) end -- Send image to user and delete it when finished. -- cb_function and cb_extra are optionals callback function _send_photo(receiver, file_path, cb_function, cb_extra) local cb_extra = { file_path = file_path, cb_function = cb_function, cb_extra = cb_extra } -- Call to remove with optional callback send_photo(receiver, file_path, cb_function, cb_extra) end -- Download the image and send to receiver, it will be deleted. -- cb_function and cb_extra are optionals callback function send_photo_from_url(receiver, url, cb_function, cb_extra) -- If callback not provided cb_function = cb_function or ok_cb cb_extra = cb_extra or false local file_path = download_to_file(url, false) if not file_path then -- Error local text = 'Error downloading the image' send_msg(receiver, text, cb_function, cb_extra) else print("File path: "..file_path) _send_photo(receiver, file_path, cb_function, cb_extra) end end -- Same as send_photo_from_url but as callback function function send_photo_from_url_callback(cb_extra, success, result) local receiver = cb_extra.receiver local url = cb_extra.url local file_path = download_to_file(url, false) if not file_path then -- Error local text = 'Error downloading the image' send_msg(receiver, text, ok_cb, false) else print("File path: "..file_path) _send_photo(receiver, file_path, ok_cb, false) end end -- Send multiple images asynchronous. -- param urls must be a table. function send_photos_from_url(receiver, urls) local cb_extra = { receiver = receiver, urls = urls, remove_path = nil } send_photos_from_url_callback(cb_extra) end -- Use send_photos_from_url. -- This function might be difficult to understand. function send_photos_from_url_callback(cb_extra, success, result) -- cb_extra is a table containing receiver, urls and remove_path local receiver = cb_extra.receiver local urls = cb_extra.urls local remove_path = cb_extra.remove_path -- The previously image to remove if remove_path ~= nil then os.remove(remove_path) print("Deleted: "..remove_path) end -- Nil or empty, exit case (no more urls) if urls == nil or #urls == 0 then return false end -- Take the head and remove from urls table local head = table.remove(urls, 1) local file_path = download_to_file(head, false) local cb_extra = { receiver = receiver, urls = urls, remove_path = file_path } -- Send first and postpone the others as callback send_photo(receiver, file_path, send_photos_from_url_callback, cb_extra) end -- Callback to remove a file function rmtmp_cb(cb_extra, success, result) local file_path = cb_extra.file_path local cb_function = cb_extra.cb_function or ok_cb local cb_extra = cb_extra.cb_extra if file_path ~= nil then os.remove(file_path) print("Deleted: "..file_path) end -- Finally call the callback cb_function(cb_extra, success, result) end -- Send document to user and delete it when finished. -- cb_function and cb_extra are optionals callback function _send_document(receiver, file_path, cb_function, cb_extra) local cb_extra = { file_path = file_path, cb_function = cb_function or ok_cb, cb_extra = cb_extra or false } -- Call to remove with optional callback send_document(receiver, file_path, rmtmp_cb, cb_extra) end -- Download the image and send to receiver, it will be deleted. -- cb_function and cb_extra are optionals callback function send_document_from_url(receiver, url, cb_function, cb_extra) local file_path = download_to_file(url, false) print("File path: "..file_path) _send_document(receiver, file_path, cb_function, cb_extra) end -- Parameters in ?a=1&b=2 style function format_http_params(params, is_get) local str = '' -- If is get add ? to the beginning if is_get then str = '?' end local first = true -- Frist param for k,v in pairs (params) do if v then -- nil value if first then first = false str = str..k.. "="..v else str = str.."&"..k.. "="..v end end end return str end -- Check if user can use the plugin and warns user -- Returns true if user was warned and false if not warned (is allowed) function warns_user_not_allowed(plugin, msg) if not user_allowed(plugin, msg) then local text = 'This plugin requires privileged user' local receiver = get_receiver(msg) send_msg(receiver, text, ok_cb, false) return true else return false end end -- Check if user can use the plugin function user_allowed(plugin, msg) if plugin.privileged and not is_sudo(msg) then return false end return true end function send_order_msg(destination, msgs) local cb_extra = { destination = destination, msgs = msgs } send_order_msg_callback(cb_extra, true) end function send_order_msg_callback(cb_extra, success, result) local destination = cb_extra.destination local msgs = cb_extra.msgs local file_path = cb_extra.file_path if file_path ~= nil then os.remove(file_path) print("Deleted: " .. file_path) end if type(msgs) == 'string' then send_large_msg(destination, msgs) elseif type(msgs) ~= 'table' then return end if #msgs < 1 then return end local msg = table.remove(msgs, 1) local new_cb_extra = { destination = destination, msgs = msgs } if type(msg) == 'string' then send_msg(destination, msg, send_order_msg_callback, new_cb_extra) elseif type(msg) == 'table' then local typ = msg[1] local nmsg = msg[2] new_cb_extra.file_path = nmsg if typ == 'document' then send_document(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'image' or typ == 'photo' then send_photo(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'audio' then send_audio(destination, nmsg, send_order_msg_callback, new_cb_extra) elseif typ == 'video' then send_video(destination, nmsg, send_order_msg_callback, new_cb_extra) else send_file(destination, nmsg, send_order_msg_callback, new_cb_extra) end end end -- Same as send_large_msg_callback but friendly params function send_large_msg(destination, text) local cb_extra = { destination = destination, text = text } send_large_msg_callback(cb_extra, true) end -- If text is longer than 4096 chars, send multiple msg. -- https://core.telegram.org/method/messages.sendMessage function send_large_msg_callback(cb_extra, success, result) local text_max = 4096 local destination = cb_extra.destination local text = cb_extra.text local text_len = string.len(text) local num_msg = math.ceil(text_len / text_max) if num_msg <= 1 then send_msg(destination, text, ok_cb, false) else local my_text = string.sub(text, 1, 4096) local rest = string.sub(text, 4096, text_len) local cb_extra = { destination = destination, text = rest } send_msg(destination, my_text, send_large_msg_callback, cb_extra) end end -- Returns a table with matches or nil function match_pattern(pattern, text, lower_case) if text then local matches = {} if lower_case then matches = { string.match(text:lower(), pattern) } else matches = { string.match(text, pattern) } end if next(matches) then return matches end end -- nil end -- Function to read data from files function load_from_file(file, default_data) local f = io.open(file, "r+") -- If file doesn't exists if f == nil then -- Create a new empty table default_data = default_data or {} serialize_to_file(default_data, file) print ('Created file', file) else print ('Data loaded from file', file) f:close() end return loadfile (file)() end -- See http://stackoverflow.com/a/14899740 function unescape_html(str) local map = { ["lt"] = "<", ["gt"] = ">", ["amp"] = "&", ["quot"] = '"', ["apos"] = "'" } new = string.gsub(str, '(&(#?x?)([%d%a]+);)', function(orig, n, s) var = map[s] or n == "#" and string.char(s) var = var or n == "#x" and string.char(tonumber(s,16)) var = var or orig return var end) return new end --Check if this chat is realm or not function is_realm(msg) local var = false local realms = 'realms' local data = load_data(_config.moderation.data) local chat = msg.to.id if data[tostring(realms)] then if data[tostring(realms)][tostring(msg.to.id)] then var = true end return var end end --Check if this chat is a group or not function is_group(msg) local var = false local groups = 'groups' local data = load_data(_config.moderation.data) local chat = msg.to.id if data[tostring(groups)] then if data[tostring(groups)][tostring(msg.to.id)] then var = true end return var end end function savelog(group, logtxt) local text = (os.date("[ %c ]=> "..logtxt.."\n \n")) local file = io.open("./groups/logs/"..group.."log.txt", "a") file:write(text) file:close() end function user_print_name(user) if user.print_name then return user.print_name end local text = '' if user.first_name then text = user.last_name..' ' end if user.lastname then text = text..user.last_name end return text end --Check if user is the owner of that group or not function is_owner(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['set_owner'] then if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then var = true end end end if data['admins'] then if data['admins'][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_owner2(user_id, group_id) local var = false local data = load_data(_config.moderation.data) if data[tostring(group_id)] then if data[tostring(group_id)]['set_owner'] then if data[tostring(group_id)]['set_owner'] == tostring(user_id) then var = true end end end if data['admins'] then if data['admins'][tostring(user_id)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == user_id then var = true end end return var end --Check if user is admin or not function is_admin(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id local admins = 'admins' if data[tostring(admins)] then if data[tostring(admins)][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_admin2(user_id) local var = false local data = load_data(_config.moderation.data) local user = user_id local admins = 'admins' if data[tostring(admins)] then if data[tostring(admins)][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == user_id then var = true end end return var end --Check if user is the mod of that group or not function is_momod(msg) local var = false local data = load_data(_config.moderation.data) local user = msg.from.id if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['moderators'] then if data[tostring(msg.to.id)]['moderators'][tostring(user)] then var = true end end end if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['set_owner'] then if data[tostring(msg.to.id)]['set_owner'] == tostring(user) then var = true end end end if data['admins'] then if data['admins'][tostring(user)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == msg.from.id then var = true end end return var end function is_momod2(user_id, group_id) local var = false local data = load_data(_config.moderation.data) local usert = user_id if data[tostring(group_id)] then if data[tostring(group_id)]['moderators'] then if data[tostring(group_id)]['moderators'][tostring(usert)] then var = true end end end if data[tostring(group_id)] then if data[tostring(group_id)]['set_owner'] then if data[tostring(group_id)]['set_owner'] == tostring(user_id) then var = true end end end if data['admins'] then if data['admins'][tostring(user_id)] then var = true end end for v,user in pairs(_config.sudo_users) do if user == usert then var = true end end return var end -- Returns the name of the sender function kick_user(user_id, chat_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_owner2(user_id, chat_id) then -- Ignore admins return end local chat = 'chat#id'..chat_id local user = 'user#id'..user_id chat_del_user(chat, user, ok_cb, true) end -- Ban function ban_user(user_id, chat_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_admin2(user_id) then -- Ignore admins return end -- Save to redis local hash = 'banned:'..chat_id redis:sadd(hash, user_id) -- Kick from chat kick_user(user_id, chat_id) end -- Global ban function banall_user(user_id) if tonumber(user_id) == tonumber(our_id) then -- Ignore bot return end if is_admin2(user_id) then -- Ignore admins return end -- Save to redis local hash = 'gbanned' redis:sadd(hash, user_id) end -- Global unban function unbanall_user(user_id) --Save on redis local hash = 'gbanned' redis:srem(hash, user_id) end -- Check if user_id is banned in chat_id or not function is_banned(user_id, chat_id) --Save on redis local hash = 'banned:'..chat_id local banned = redis:sismember(hash, user_id) return banned or false end -- Check if user_id is globally banned or not function is_gbanned(user_id) --Save on redis local hash = 'gbanned' local banned = redis:sismember(hash, user_id) return banned or false end -- Returns chat_id ban list function ban_list(chat_id) local hash = 'banned:'..chat_id local list = redis:smembers(hash) local text = "Ban list !\n\n" for k,v in pairs(list) do local user_info = redis:hgetall('user:'..v) -- vardump(user_info) if user_info then if user_info.username then user = '@'..user_info.username elseif user_info.print_name and not user_info.username then user = string.gsub(user_info.print_name, "_", " ") else user = '' end text = text..k.." - "..user.." ["..v.."]\n" end end return text end -- Returns globally ban list function banall_list() local hash = 'gbanned' local list = redis:smembers(hash) local text = "global bans !\n\n" for k,v in pairs(list) do local user_info = redis:hgetall('user:'..v) -- vardump(user_info) if user_info then if user_info.username then user = '@'..user_info.username elseif user_info.print_name and not user_info.username then user = string.gsub(user_info.print_name, "_", " ") else user = '' end text = text..k.." - "..user.." ["..v.."]\n" end end return text end -- /id by reply function get_message_callback_id(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id send_large_msg(chat, result.from.id) else return 'Use This in Your Groups' end end -- kick by reply for mods and owner function Kick_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't kick myself" end if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin return "you can't kick mods,owner and admins" end chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) else return 'Use This in Your Groups' end end -- Kick by reply for admins function Kick_by_reply_admins(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't kick myself" end if is_admin2(result.from.id) then -- Ignore admins return end chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) else return 'Use This in Your Groups' end end --Ban by reply for admins function ban_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't ban myself" end if is_momod2(result.from.id, result.to.id) then -- Ignore mods,owner,admin return "you can't kick mods,owner and admins" end ban_user(result.from.id, result.to.id) send_large_msg(chat, "User "..result.from.id.." Banned") else return 'Use This in Your Groups' end end -- Ban by reply for admins function ban_by_reply_admins(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't ban myself" end if is_admin2(result.from.id) then -- Ignore admins return end ban_user(result.from.id, result.to.id) send_large_msg(chat, "User "..result.from.id.." Banned") else return 'Use This in Your Groups' end end -- Unban by reply function unban_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't unban myself" end send_large_msg(chat, "User "..result.from.id.." Unbanned") -- Save on redis local hash = 'banned:'..result.to.id redis:srem(hash, result.from.id) else return 'Use This in Your Groups' end end function banall_by_reply(extra, success, result) if result.to.type == 'chat' then local chat = 'chat#id'..result.to.id if tonumber(result.from.id) == tonumber(our_id) then -- Ignore bot return "I won't banall myself" end if is_admin2(result.from.id) then -- Ignore admins return end local name = user_print_name(result.from) banall_user(result.from.id) chat_del_user(chat, 'user#id'..result.from.id, ok_cb, false) send_large_msg(chat, "User "..name.."["..result.from.id.."] hammered") else return 'Use This in Your Groups' end end
agpl-3.0
nlyan/pdns
pdns/powerdns-example-script.lua
2
3685
pdnslog("pdns-recursor Lua script starting!", pdns.loglevels.Warning) blockset = newDS() blockset:add{"powerdns.org", "xxx"} dropset = newDS(); dropset:add("123.cn") malwareset = newDS() malwareset:add("nl") magic2 = newDN("www.magic2.com") magicMetric = getMetric("magic") -- shows the various ways of blocking, dropping, changing questions -- return false to say you did not take over the question, but we'll still listen to 'variable' -- to selectively disable the cache function preresolve(dq) print("Got question for "..dq.qname:toString().." from "..dq.remoteaddr:toString().." to "..dq.localaddr:toString()) local a=dq:getEDNSOption(3) if(a) then print("There is an EDNS option 3 present: "..a) end loc = newCA("127.0.0.1") if(dq.remoteaddr:equal(loc)) then print("Query from loopback") end -- note that the comparisons below are CaSe InSensiTivE and you don't have to worry about trailing dots if(dq.qname:equal("magic.com")) then magicMetric:inc() print("Magic!") else print("not magic..") end if(dq.qname:__eq(magic2)) -- we hope to improve this syntax then print("Faster magic") -- compares against existing DNSName end -- sadly, dq.qname == magic2 won't work yet if blockset:check(dq.qname) then dq.variable = true -- disable packet cache in any case if dq.qtype == pdns.A then dq:addAnswer(pdns.A, "1.2.3.4") dq:addAnswer(pdns.TXT, "\"Hello!\"", 3601) -- ttl return true; end end if dropset:check(dq.qname) then dq.rcode = pdns.DROP return true; end if malwareset:check(dq.qname) then dq:addAnswer(pdns.CNAME, "xs.powerdns.com.") dq.rcode = 0 dq.followupFunction="followCNAMERecords" -- this makes PowerDNS lookup your CNAME return true; end return false; end -- this implements DNS64 function nodata(dq) if dq.qtype == pdns.AAAA then dq.followupFunction="getFakeAAAARecords" dq.followupName=dq.qname dq.followupPrefix="fe80::" return true end if dq.qtype == pdns.PTR then dq.followupFunction="getFakePTRRecords" dq.followupName=dq.qname dq.followupPrefix="fe80::" return true end return false end badips = newNMG() badips:addMask("127.1.0.0/16") -- this check is applied before any packet parsing is done function ipfilter(rem, loc, dh) print("ipfilter called, rem: ", rem:toStringWithPort(), "loc: ",loc:toStringWithPort(),"match:", badips:match(rem)) print("id: ",dh:getID(), "aa: ", dh:getAA(), "ad: ", dh:getAD(), "arcount: ", dh:getARCOUNT()) print("ports: ",rem:getPort(),loc:getPort()) return badips:match(rem) end -- postresolve runs after the packet has been answered, and can be used to change things -- or still drop function postresolve(dq) print("postresolve called for ",dq.qname:toString()) local records = dq:getRecords() for k,v in pairs(records) do print(k, v.name:toString(), v:getContent()) if v.type == pdns.A and v:getContent() == "185.31.17.73" then print("Changing content!") v:changeContent("130.161.252.29") v.ttl=1 end end dq:setRecords(records) return true end nxdomainsuffix=newDN("com") function nxdomain(dq) print("Hooking: ",dq.qname:toString()) if dq.qname:isPartOf(nxdomainsuffix) then dq.rcode=0 -- make it a normal answer dq:addAnswer(pdns.CNAME, "ourhelpfulservice.com") dq:addAnswer(pdns.A, "1.2.3.4", 60, "ourhelpfulservice.com") return true end return false end
gpl-2.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Southern_San_dOria_[S]/npcs/Geltpix.lua
19
1124
----------------------------------- -- Area: Southern SandOria [S] -- NPC: Geltpix -- @zone 80 -- @pos 154 -2 103 ----------------------------------- 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, 7043); -- Don't hurt poor Geltpix! Geltpix's just a merchant from Boodlix's Emporium in Jeuno. Kingdom vendors don't like gil, but Boodlix knows true value of new money. 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
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/RuAun_Gardens/npcs/qm4.lua
4
1394
----------------------------------- -- Area: Ru'Aun Gardens -- NPC: ??? (Suzaku's Spawn) -- Allows players to spawn the HNM Suzaku with a Gem of the South and a Summerstone. -- @pos -514 -70 -264 130 ----------------------------------- package.loaded["scripts/zones/RuAun_Gardens/TextIDs"] = nil; ----------------------------------- require("scripts/zones/RuAun_Gardens/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- Trade Gem of the South and Summerstone if(GetMobAction(17309983) == 0 and trade:hasItemQty(1420,1) and trade:hasItemQty(1421,1) and trade:getItemCount() == 2) then player:tradeComplete(); SpawnMob(17309983,300):updateEnmity(player); -- Spawn Suzaku player:showText(npc,SKY_GOD_OFFSET + 7); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(SKY_GOD_OFFSET + 3); 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
waytim/darkstar
scripts/globals/abilities/pets/heavenly_strike.lua
28
1332
--------------------------------------------------- -- Geocrush --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); require("scripts/globals/magic"); --------------------------------------------------- function onAbilityCheck(player, target, ability) return 0,0; end; function onPetAbility(target, pet, skill) local dINT = math.floor(pet:getStat(MOD_INT) - target:getStat(MOD_INT)); local tp = skill:getTP() / 10; local master = pet:getMaster(); local merits = 0; if (master ~= nil and master:isPC()) then merits = master:getMerit(MERIT_HEAVENLY_STRIKE); end tp = tp + (merits - 40); if (tp > 300) then tp = 300; end --note: this formula is only accurate for level 75 - 76+ may have a different intercept and/or slope local damage = math.floor(512 + 1.72*(tp+1)); damage = damage + (dINT * 1.5); damage = MobMagicalMove(pet,target,skill,damage,ELE_ICE,1,TP_NO_EFFECT,0); damage = mobAddBonuses(pet, nil, target, damage.dmg, ELE_ICE); damage = AvatarFinalAdjustments(damage,pet,skill,target,MOBSKILL_MAGICAL,MOBPARAM_NONE,1); target:delHP(damage); target:updateEnmityFromDamage(pet,damage); return damage; end
gpl-3.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/items/hellsteak_+1.lua
3
1601
----------------------------------------- -- ID: 5610 -- Item: hellsteak_+1 -- Food Effect: 240Min, All Races ----------------------------------------- -- Health 20 -- Strength 6 -- Intelligence -2 -- Health Regen While Healing 2 -- Attack % 19 -- Ranged ATT % 19 -- Dragon Killer 5 -- Demon Killer 5 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,14400,5610); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 20); target:addMod(MOD_STR, 6); target:addMod(MOD_INT, -2); target:addMod(MOD_HPHEAL, 2); target:addMod(MOD_ATTP, 19); target:addMod(MOD_RATTP, 19); target:addMod(MOD_DRAGON_KILLER, 5); target:addMod(MOD_DEMON_KILLER, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 20); target:delMod(MOD_STR, 6); target:delMod(MOD_INT, -2); target:delMod(MOD_HPHEAL, 2); target:delMod(MOD_ATTP, 19); target:delMod(MOD_RATTP, 19); target:delMod(MOD_DRAGON_KILLER, 5); target:delMod(MOD_DEMON_KILLER, 5); end;
gpl-3.0
shaunlebron/blinky
game/lua-scripts/lenses/cube.lua
2
2041
cols = 4 rows = 3 lens_width = cols lens_height = rows max_fov = 360 max_vfov = 180 onload = "f_contain" function col(x) local nx = x+cols/2 local i,f = math.modf(nx) if nx < 0 then return i-1, f+1 end return i,f end function row(y) local ny = -y+rows/2 local i,f = math.modf(ny) if ny < 0 then return i-1, f+1 end return i,f end function lens_inverse(x,y) x = x - 0.5 local r,v = row(y) local c,u = col(x) u = u - 0.5 v = v - 0.5 v = -v if r < 0 or r >= rows or c < -1 or c >= cols then return nil end if r == 0 or r == 2 then if not (c == 1) then return nil end end local plate if r == 0 then -- top return u,0.5,-v elseif r == 2 then -- bottom return u,-0.5,v elseif c == 0 then -- left return -0.5,v,u elseif c == 1 then -- front return u,v,0.5 elseif c == 2 then -- right return 0.5,v,-u elseif c == 3 or c == -1 then -- back return -u,v,-0.5 else return nil end end function lens_forward(x,y,z) -- only to be used for FOV local ax = abs(x) local ay = abs(y) local az = abs(z) local max = math.max(ax,ay,az) local u,v if max == ax then if x > 0 then -- right u = -z/x*0.5 v = y/x*0.5 return 1+u,v else -- left u = z/-x*0.5 v = y/-x*0.5 return -1+u,v end elseif max == ay then if y > 0 then -- top u = x/y*0.5 v = -z/y*0.5 return u,1+v else -- bottom u = x/-y*0.5 v = z/-y*0.5 return u,-1+v end elseif max == az then if z > 0 then -- front u = x/z*0.5 v = y/z*0.5 return u,v else -- back u = -x/-z*0.5 v = y/-z*0.5 if u > 0 then return -2+u,v else return 2+u,v end end end end
mit
TheOnePharaoh/YGOPro-Custom-Cards
script/c99971020.lua
1
2736
--DAL - Spirit Summon function c99971020.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(99971020,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,99971020+EFFECT_COUNT_CODE_OATH) e1:SetTarget(c99971020.target) e1:SetOperation(c99971020.operation) c:RegisterEffect(e1) end function c99971020.filter1(c) return c:IsSetCard(0x997) and c:GetLevel()==3 and c:IsDiscardable(REASON_EFFECT) end function c99971020.filter2(c,e,tp) return c:IsSetCard(0x997) and c:IsLevelAbove(5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function c99971020.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c99971020.filter1,tp,LOCATION_HAND,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(c99971020.filter2,tp,LOCATION_DECK+LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK+LOCATION_HAND) end function c99971020.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(c99971020.filter2,tp,LOCATION_DECK+LOCATION_HAND,0,nil,e,tp) local ct=g:GetClassCount(Card.GetCode) if ct>2 then ct=2 end local rt=Duel.GetLocationCount(tp,LOCATION_MZONE) if rt>2 then rt=2 end if ct==1 then rt=1 end if Duel.IsPlayerAffectedByEffect(tp,59822133) then rt=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local cg=Duel.SelectMatchingCard(tp,c99971020.filter1,tp,LOCATION_HAND,0,1,rt,nil) if Duel.SendtoGrave(cg,REASON_COST+REASON_DISCARD)~=0 then local ct1=cg:GetCount() if ct1==0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local g=Duel.GetMatchingGroup(c99971020.filter2,tp,LOCATION_DECK+LOCATION_HAND,0,nil,e,tp) if ct1>g:GetClassCount(Card.GetCode) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=g:Select(tp,1,1,nil) if ct1==2 then g:Remove(Card.IsCode,nil,g1:GetFirst():GetCode()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=g:Select(tp,1,1,nil) g1:Merge(g2) end local tc=g1:GetFirst() while tc do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) tc=g1:GetNext() end Duel.SpecialSummonComplete() end end
gpl-3.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c20912225.lua
1
3767
--The Ancient Sword Osafune Katana function c20912225.initial_effect(c) c:SetUniqueOnField(1,0,20912225) aux.AddEquipProcedure(c,0,aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR)) --Atk up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(500) c:RegisterEffect(e2) --Equip limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EQUIP_LIMIT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(c20912225.eqlimit) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(20912225,0)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_SZONE) e4:SetCountLimit(1) e4:SetTarget(c20912225.destg) e4:SetOperation(c20912225.desop) c:RegisterEffect(e4) --equip local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(20912225,1)) e5:SetCategory(CATEGORY_EQUIP) e5:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_TO_GRAVE) e5:SetCondition(c20912225.eqcon) e5:SetCost(c20912225.eqcost) e5:SetTarget(c20912225.eqtg) e5:SetOperation(c20912225.operation) c:RegisterEffect(e5) end function c20912225.eqlimit(e,c) return c:IsRace(RACE_WARRIOR) end function c20912225.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() and c:CheckUniqueOnField(tp) then Duel.Equip(tp,c,tc) end end function c20912225.desfilter(c) return c:IsType(TYPE_MONSTER) and c:IsDestructable() end function c20912225.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and c20912225.desfilter(chkc) end local eq=e:GetHandler():GetEquipTarget() if chk==0 then return eq and eq:IsAttackAbove(200) and Duel.IsExistingTarget(c20912225.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,c20912225.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c20912225.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() local eq=c:GetEquipTarget() if not c:IsRelateToEffect(e) or eq:IsImmuneToEffect(e) or not eq:IsAttackAbove(200) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-200) e1:SetReset(RESET_EVENT+0x1fe0000) eq:RegisterEffect(e1) if tc:IsRelateToEffect(e) and tc:IsControler(1-tp) and tc:IsType(TYPE_MONSTER) then Duel.Destroy(tc,REASON_EFFECT) end end function c20912225.eqcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP) and c:IsReason(REASON_DESTROY) and c:CheckUniqueOnField(tp) end function c20912225.eqcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLPCost(tp,500) end Duel.PayLPCost(tp,500) end function c20912225.eqfilter2(c) return c:IsFaceup() and c:IsSetCard(0xd0a2) end function c20912225.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c20912225.eqfilter2(chkc) end if chk==0 then return e:GetHandler():IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(c20912225.eqfilter2,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,c20912225.eqfilter2,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end
gpl-3.0
waytim/darkstar
scripts/zones/Eastern_Altepa_Desert/npcs/Laimeve_RK.lua
13
3340
----------------------------------- -- Area: Eastern Altepa Desert -- NPC: Laimeve, R.K. -- Border Conquest Guards -- @pos 226.493 -12.231 260.194 114 ----------------------------------- package.loaded["scripts/zones/Eastern_Altepa_Desert/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/Eastern_Altepa_Desert/TextIDs"); local guardnation = SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 4; -- 1: city, 2: foreign, 3: outpost, 4: border local region = KUZOTZ; local csid = 0x7ffa; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then if (supplyRunFresh(player) == 1) then player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies ! else player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use." player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region)); player:setVar("supplyQuest_region",0); end else local arg1 = getArg1(guardnation, player) - 1; if (arg1 >= 1792) then -- foreign, non-allied player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0); else -- citizen or allied player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option == 2) then player:delKeyItem(getSupplyKey(region)); player:addCP(supplyReward[region + 1]) player:messageSpecial(CONQUEST); -- "You've earned conquest points!" if (hasOutpost(player, region+5) == 0) then local supply_quests = 2^(region+5); player:addNationTeleport(guardnation,supply_quests); player:setVar("supplyQuest_region",0); end elseif (option == 4) then if (player:delGil(giltosetHP(guardnation,player))) then player:setHomePoint(); player:messageSpecial(CONQUEST + 94); -- "Your home point has been set." else player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here." end end end;
gpl-3.0
waytim/darkstar
scripts/zones/Cloister_of_Storms/mobs/Ramuh_Prime.lua
23
2201
----------------------------------- -- Area: Cloister of Storms -- MOB: Ramuh Prime -- Involved in Quest: Trial by Lightning -- Involved in Mission: ASA-4 Sugar Coated Directive ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/status"); ----------------------------------- -- OnMobFight Action ----------------------------------- function onMobFight(mob, target) local mobId = mob:getID(); -- ASA-4: Astral Flow Behavior - Guaranteed to Use At Least 5 times before killable, at specified intervals. if (mob:getBattlefield():getBcnmID() == 452 and GetMobAction(mobId) == ACTION_ATTACK) then local astralFlows = mob:getLocalVar("astralflows"); if ((astralFlows == 0 and mob:getHPP() <= 80) or (astralFlows == 1 and mob:getHPP() <= 60) or (astralFlows == 2 and mob:getHPP() <= 40) or (astralFlows == 3 and mob:getHPP() <= 20) or (astralFlows == 4 and mob:getHPP() <= 1)) then mob:setLocalVar("astralflows",astralFlows + 1); mob:useMobAbility(893); if (astralFlows >= 5) then mob:setUnkillable(false); end end end end; ----------------------------------- -- OnMobSpawn Action ----------------------------------- function onMobSpawn(mob) -- ASA-4: Avatar is Unkillable Until Its Used Astral Flow At Least 5 times At Specified Intervals if (mob:getBattlefield():getBcnmID() == 452) then mob:setLocalVar("astralflows","0"); mob:setUnkillable(true); end end; ----------------------------------- -- OnMobDeath Action ----------------------------------- function onMobDeath(mob, player, isKiller) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("onUpdate CSID: %u",csid); -- printf("onUpdate RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("onFinish CSID: %u",csid); -- printf("onFinish RESULT: %u",option); end;
gpl-3.0
adminerror/66666666
plugins/ingroup.lua
202
31524
do local function check_member(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.id if member_id ~= our_id then -- Group configuration data[tostring(msg.to.id)] = { moderators = {}, set_owner = member_id , settings = { set_name = string.gsub(msg.to.print_name, '_', ' '), lock_name = 'yes', lock_photo = 'no', lock_member = 'no', flood = 'yes' } } save_data(_config.moderation.data, data) local groups = 'groups' if not data[tostring(groups)] then data[tostring(groups)] = {} save_data(_config.moderation.data, data) end data[tostring(groups)][tostring(msg.to.id)] = msg.to.id save_data(_config.moderation.data, data) return send_large_msg(receiver, 'You have been promoted as the owner.') end end end local function check_member_modadd(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.id if member_id ~= our_id then -- Group configuration data[tostring(msg.to.id)] = { moderators = {}, set_owner = member_id , settings = { set_name = string.gsub(msg.to.print_name, '_', ' '), lock_name = 'yes', lock_photo = 'no', lock_member = 'no', flood = 'yes' } } save_data(_config.moderation.data, data) local groups = 'groups' if not data[tostring(groups)] then data[tostring(groups)] = {} save_data(_config.moderation.data, data) end data[tostring(groups)][tostring(msg.to.id)] = msg.to.id save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Group is added and you have been promoted as the owner ') end end end local function automodadd(msg) local data = load_data(_config.moderation.data) if msg.action.type == 'chat_created' then receiver = get_receiver(msg) chat_info(receiver, check_member,{receiver=receiver, data=data, msg = msg}) end end local function check_member_modrem(cb_extra, success, result) local receiver = cb_extra.receiver local data = cb_extra.data local msg = cb_extra.msg for k,v in pairs(result.members) do local member_id = v.id if member_id ~= our_id then -- Group configuration removal data[tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) local groups = 'groups' if not data[tostring(groups)] then data[tostring(groups)] = nil save_data(_config.moderation.data, data) end data[tostring(groups)][tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Group has been removed') end end end local function show_group_settingsmod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['settings']['flood_msg_max'] then NUM_MSG_MAX = tonumber(data[tostring(msg.to.id)]['settings']['flood_msg_max']) print('custom'..NUM_MSG_MAX) else NUM_MSG_MAX = 5 end end local bots_protection = "Yes" if data[tostring(msg.to.id)]['settings']['lock_bots'] then bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots'] end local settings = data[tostring(target)]['settings'] local text = "Group settings:\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nflood sensitivity : "..NUM_MSG_MAX.."\nBot protection : "..bots_protection return text end local function set_descriptionmod(msg, data, target, about) if not is_momod(msg) then return "For moderators only!" end local data_cat = 'description' data[tostring(target)][data_cat] = about save_data(_config.moderation.data, data) return 'Set group description to:\n'..about end local function get_description(msg, data) local data_cat = 'description' if not data[tostring(msg.to.id)][data_cat] then return 'No description available.' end local about = data[tostring(msg.to.id)][data_cat] local about = string.gsub(msg.to.print_name, "_", " ")..':\n\n'..about return 'About '..about end local function lock_group_arabic(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic'] if group_arabic_lock == 'yes' then return 'Arabic is already locked' else data[tostring(target)]['settings']['lock_arabic'] = 'yes' save_data(_config.moderation.data, data) return 'Arabic has been locked' end end local function unlock_group_arabic(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic'] if group_arabic_lock == 'no' then return 'Arabic is already unlocked' else data[tostring(target)]['settings']['lock_arabic'] = 'no' save_data(_config.moderation.data, data) return 'Arabic has been unlocked' end end local function lock_group_bots(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_bots_lock = data[tostring(target)]['settings']['lock_bots'] if group_bots_lock == 'yes' then return 'Bots protection is already enabled' else data[tostring(target)]['settings']['lock_bots'] = 'yes' save_data(_config.moderation.data, data) return 'Bots protection has been enabled' end end local function unlock_group_bots(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_bots_lock = data[tostring(target)]['settings']['lock_bots'] if group_bots_lock == 'no' then return 'Bots protection is already disabled' else data[tostring(target)]['settings']['lock_bots'] = 'no' save_data(_config.moderation.data, data) return 'Bots protection has been disabled' end end local function lock_group_namemod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_name_set = data[tostring(target)]['settings']['set_name'] local group_name_lock = data[tostring(target)]['settings']['lock_name'] if group_name_lock == 'yes' then return 'Group name is already locked' else data[tostring(target)]['settings']['lock_name'] = 'yes' save_data(_config.moderation.data, data) rename_chat('chat#id'..target, group_name_set, ok_cb, false) return 'Group name has been locked' end end local function unlock_group_namemod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_name_set = data[tostring(target)]['settings']['set_name'] local group_name_lock = data[tostring(target)]['settings']['lock_name'] if group_name_lock == 'no' then return 'Group name is already unlocked' else data[tostring(target)]['settings']['lock_name'] = 'no' save_data(_config.moderation.data, data) return 'Group name has been unlocked' end end local function lock_group_floodmod(msg, data, target) if not is_owner(msg) then return "Only admins can do it for now" end local group_flood_lock = data[tostring(target)]['settings']['flood'] if group_flood_lock == 'yes' then return 'Group flood is locked' else data[tostring(target)]['settings']['flood'] = 'yes' save_data(_config.moderation.data, data) return 'Group flood has been locked' end end local function unlock_group_floodmod(msg, data, target) if not is_owner(msg) then return "Only admins can do it for now" end local group_flood_lock = data[tostring(target)]['settings']['flood'] if group_flood_lock == 'no' then return 'Group flood is not locked' else data[tostring(target)]['settings']['flood'] = 'no' save_data(_config.moderation.data, data) return 'Group flood has been unlocked' end end local function lock_group_membermod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_member_lock = data[tostring(target)]['settings']['lock_member'] if group_member_lock == 'yes' then return 'Group members are already locked' else data[tostring(target)]['settings']['lock_member'] = 'yes' save_data(_config.moderation.data, data) end return 'Group members has been locked' end local function unlock_group_membermod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_member_lock = data[tostring(target)]['settings']['lock_member'] if group_member_lock == 'no' then return 'Group members are not locked' else data[tostring(target)]['settings']['lock_member'] = 'no' save_data(_config.moderation.data, data) return 'Group members has been unlocked' end end local function unlock_group_photomod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_photo_lock = data[tostring(target)]['settings']['lock_photo'] if group_photo_lock == 'no' then return 'Group photo is not locked' else data[tostring(target)]['settings']['lock_photo'] = 'no' save_data(_config.moderation.data, data) return 'Group photo has been unlocked' end end local function set_rulesmod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local data_cat = 'rules' data[tostring(target)][data_cat] = rules save_data(_config.moderation.data, data) return 'Set group rules to:\n'..rules end local function modadd(msg) -- superuser and admins only (because sudo are always has privilege) if not is_admin(msg) then return "You're not admin" end local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then return 'Group is already added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_modadd,{receiver=receiver, data=data, msg = msg}) end local function modrem(msg) -- superuser and admins only (because sudo are always has privilege) if not is_admin(msg) then return "You're not admin" end local data = load_data(_config.moderation.data) if not data[tostring(msg.to.id)] then return 'Group is not added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_modrem,{receiver=receiver, data=data, msg = msg}) end local function get_rules(msg, data) local data_cat = 'rules' if not data[tostring(msg.to.id)][data_cat] then return 'No rules available.' end local rules = data[tostring(msg.to.id)][data_cat] local rules = 'Chat rules:\n'..rules return rules end local function set_group_photo(msg, success, result) local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) if success then local file = 'data/photos/chat_photo_'..msg.to.id..'.jpg' print('File downloaded to:', result) os.rename(result, file) print('File moved to:', file) chat_set_photo (receiver, file, ok_cb, false) data[tostring(msg.to.id)]['settings']['set_photo'] = file save_data(_config.moderation.data, data) data[tostring(msg.to.id)]['settings']['lock_photo'] = 'yes' save_data(_config.moderation.data, data) send_large_msg(receiver, 'Photo saved!', ok_cb, false) else print('Error downloading: '..msg.id) send_large_msg(receiver, 'Failed, please try again!', ok_cb, false) end end local function promote(receiver, member_username, member_id) local data = load_data(_config.moderation.data) local group = string.gsub(receiver, 'chat#id', '') if not data[group] then return send_large_msg(receiver, 'Group is not added.') end if data[group]['moderators'][tostring(member_id)] then return send_large_msg(receiver, member_username..' is already a moderator.') end data[group]['moderators'][tostring(member_id)] = member_username save_data(_config.moderation.data, data) return send_large_msg(receiver, '@'..member_username..' has been promoted.') end local function demote(receiver, member_username, member_id) local data = load_data(_config.moderation.data) local group = string.gsub(receiver, 'chat#id', '') if not data[group] then return send_large_msg(receiver, 'Group is not added.') end if not data[group]['moderators'][tostring(member_id)] then return send_large_msg(receiver, member_username..' is not a moderator.') end data[group]['moderators'][tostring(member_id)] = nil save_data(_config.moderation.data, data) return send_large_msg(receiver, '@'..member_username..' has been demoted.') end local function username_id(cb_extra, success, result) local mod_cmd = cb_extra.mod_cmd local receiver = cb_extra.receiver local member = cb_extra.member local text = 'No user @'..member..' in this group.' for k,v in pairs(result.members) do vusername = v.username if vusername == member then member_username = member member_id = v.id if mod_cmd == 'promote' then return promote(receiver, member_username, member_id) elseif mod_cmd == 'demote' then return demote(receiver, member_username, member_id) end end end send_large_msg(receiver, text) end local function modlist(msg) local data = load_data(_config.moderation.data) if not data[tostring(msg.to.id)] then return 'Group is not added.' end -- determine if table is empty if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way return 'No moderator in this group.' end local i = 1 local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n' for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do message = message ..i..' - @'..v..' [' ..k.. '] \n' i = i + 1 end return message end local function callbackres(extra, success, result) local user = result.id local name = string.gsub(result.print_name, "_", " ") local chat = 'chat#id'..extra.chatid send_large_msg(chat, user..'\n'..name) return user end local function help() local help_text = tostring(_config.help_text) return help_text end local function cleanmember(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.id local chatname = result.print_name if success == -1 then return send_large_msg(receiver, '*Error: Invite link failed* \nReason: Not creator.') end for k,v in pairs(result.members) do kick_user(v.id, result.id) end end local function run(msg, matches) local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) local name_log = user_print_name(msg.from) local group = msg.to.id if msg.media then if msg.media.type == 'photo' and data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' and is_chat_msg(msg) and is_momod(msg) then load_photo(msg.id, set_group_photo, msg) end end if matches[1] == 'add' then print("group "..msg.to.print_name.."("..msg.to.id..") added") return modadd(msg) end if matches[1] == 'rem' then print("group "..msg.to.print_name.."("..msg.to.id..") removed") return modrem(msg) end if matches[1] == 'chat_created' and msg.from.id == 0 then return automodadd(msg) end if msg.to.id and data[tostring(msg.to.id)] then local settings = data[tostring(msg.to.id)]['settings'] if matches[1] == 'chat_add_user' then if not msg.service then return "Are you trying to troll me?" end local group_member_lock = settings.lock_member local user = 'user#id'..msg.action.user.id local chat = 'chat#id'..msg.to.id if group_member_lock == 'yes' and not is_owner2(msg.action.user.id, msg.to.id) then chat_del_user(chat, user, ok_cb, true) elseif group_member_lock == 'yes' and tonumber(msg.from.id) == tonumber(our_id) then return nil elseif group_member_lock == 'no' then return nil end end if matches[1] == 'chat_add_user' then if not msg.service then return "Are you trying to troll me?" end local receiver = 'user#id'..msg.action.user.id local data_cat = 'rules' if not data[tostring(msg.to.id)][data_cat] then return false end local rules = data[tostring(msg.to.id)][data_cat] local rules = 'Welcome to "' .. string.gsub(msg.to.print_name, '_', ' ') ..'" this group has rules that you should follow:\n'..rules savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted user "..msg.action.user.id) send_large_msg(receiver, rules) end if matches[1] == 'chat_del_user' then if not msg.service then return "Are you trying to troll me?" end local user = 'user#id'..msg.action.user.id local chat = 'chat#id'..msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] deleted user "..user) end if matches[1] == 'chat_delete_photo' then if not msg.service then return "Are you trying to troll me?" end local group_photo_lock = settings.lock_photo if group_photo_lock == 'yes' then local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id redis:incr(picturehash) --- local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id local picprotectionredis = redis:get(picturehash) if picprotectionredis then if tonumber(picprotectionredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id) end if tonumber(picprotectionredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id) local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id redis:set(picturehash, 0) end end savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to deleted picture but failed ") chat_set_photo(receiver, settings.set_photo, ok_cb, false) elseif group_photo_lock == 'no' then return nil end end if matches[1] == 'chat_change_photo' and msg.from.id ~= 0 then if not msg.service then return "Are you trying to troll me?" end local group_photo_lock = settings.lock_photo if group_photo_lock == 'yes' then local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id redis:incr(picturehash) --- local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id local picprotectionredis = redis:get(picturehash) if picprotectionredis then if tonumber(picprotectionredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id) end if tonumber(picprotectionredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id) local picturehash = 'picture:changed:'..msg.to.id..':'..msg.from.id redis:set(picturehash, 0) end end savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change picture but failed ") chat_set_photo(receiver, settings.set_photo, ok_cb, false) elseif group_photo_lock == 'no' then return nil end end if matches[1] == 'chat_rename' then if not msg.service then return "Are you trying to troll me?" end local group_name_set = settings.set_name local group_name_lock = settings.lock_name local to_rename = 'chat#id'..msg.to.id if group_name_lock == 'yes' then if group_name_set ~= tostring(msg.to.print_name) then local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id redis:incr(namehash) local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id local nameprotectionredis = redis:get(namehash) if nameprotectionredis then if tonumber(nameprotectionredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id) end if tonumber(nameprotectionredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id) local namehash = 'name:changed:'..msg.to.id..':'..msg.from.id redis:set(namehash, 0) end end savelog(msg.to.id, name_log.." ["..msg.from.id.."] tried to change name but failed ") rename_chat(to_rename, group_name_set, ok_cb, false) end elseif group_name_lock == 'no' then return nil end end if matches[1] == 'setname' and is_momod(msg) then local new_name = string.gsub(matches[2], '_', ' ') data[tostring(msg.to.id)]['settings']['set_name'] = new_name save_data(_config.moderation.data, data) local group_name_set = data[tostring(msg.to.id)]['settings']['set_name'] local to_rename = 'chat#id'..msg.to.id rename_chat(to_rename, group_name_set, ok_cb, false) savelog(msg.to.id, "Group { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]") end if matches[1] == 'setphoto' and is_momod(msg) then data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting' save_data(_config.moderation.data, data) return 'Please send me new group photo now' end if matches[1] == 'promote' and matches[2] then if not is_owner(msg) then return "Only owner can promote" end local member = string.gsub(matches[2], "@", "") local mod_cmd = 'promote' savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @".. member) chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member}) end if matches[1] == 'demote' and matches[2] then if not is_owner(msg) then return "Only owner can demote" end if string.gsub(matches[2], "@", "") == msg.from.username then return "You can't demote yourself" end local member = string.gsub(matches[2], "@", "") local mod_cmd = 'demote' savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @".. member) chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member}) end if matches[1] == 'modlist' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group modlist") return modlist(msg) end if matches[1] == 'about' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group description") return get_description(msg, data) end if matches[1] == 'rules' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group rules") return get_rules(msg, data) end if matches[1] == 'set' then if matches[2] == 'rules' then rules = matches[3] local target = msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group rules to ["..matches[3].."]") return set_rulesmod(msg, data, target) end if matches[2] == 'about' then local data = load_data(_config.moderation.data) local target = msg.to.id local about = matches[3] savelog(msg.to.id, name_log.." ["..msg.from.id.."] has changed group description to ["..matches[3].."]") return set_descriptionmod(msg, data, target, about) end end if matches[1] == 'lock' then local target = msg.to.id if matches[2] == 'name' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked name ") return lock_group_namemod(msg, data, target) end if matches[2] == 'member' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked member ") return lock_group_membermod(msg, data, target) end if matches[2] == 'flood' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked flood ") return lock_group_floodmod(msg, data, target) end if matches[2] == 'arabic' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked arabic ") return lock_group_arabic(msg, data, target) end if matches[2] == 'bots' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked bots ") return lock_group_bots(msg, data, target) end end if matches[1] == 'unlock' then local target = msg.to.id if matches[2] == 'name' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked name ") return unlock_group_namemod(msg, data, target) end if matches[2] == 'member' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked member ") return unlock_group_membermod(msg, data, target) end if matches[2] == 'photo' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked photo ") return unlock_group_photomod(msg, data, target) end if matches[2] == 'flood' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked flood ") return unlock_group_floodmod(msg, data, target) end if matches[2] == 'arabic' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked arabic ") return unlock_group_arabic(msg, data, target) end if matches[2] == 'bots' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked bots ") return unlock_group_bots(msg, data, target) end end if matches[1] == 'settings' then local target = msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group settings ") return show_group_settingsmod(msg, data, target) end if matches[1] == 'newlink' then if not is_momod(msg) then return "For moderators only!" end local function callback (extra , success, result) local receiver = 'chat#'..msg.to.id if success == 0 then return send_large_msg(receiver, '*Error: Invite link failed* \nReason: Not creator.') end send_large_msg(receiver, "Created a new link") data[tostring(msg.to.id)]['settings']['set_link'] = result save_data(_config.moderation.data, data) end local receiver = 'chat#'..msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] revoked group link ") return export_chat_link(receiver, callback, true) end if matches[1] == 'link' then if not is_momod(msg) then return "For moderators only!" end local group_link = data[tostring(msg.to.id)]['settings']['set_link'] if not group_link then return "Create a link using /newlink first !" end savelog(msg.to.id, name_log.." ["..msg.from.id.."] requested group link ["..group_link.."]") return "Group link:\n"..group_link end if matches[1] == 'setowner' then if not is_owner(msg) then return "For owner only!" end data[tostring(msg.to.id)]['set_owner'] = matches[2] save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] set ["..matches[2].."] as owner") local text = matches[2].." added as owner" return text end if matches[1] == 'owner' then local group_owner = data[tostring(msg.to.id)]['set_owner'] if not group_owner then return "no owner,ask admins in support groups to set owner for your group" end savelog(msg.to.id, name_log.." ["..msg.from.id.."] used /owner") return "Group owner is ["..group_owner..']' end if matches[1] == 'setgpowner' then local receiver = "chat#id"..matches[2] if not is_admin(msg) then return "For admins only!" end data[tostring(matches[2])]['set_owner'] = matches[3] save_data(_config.moderation.data, data) local text = matches[3].." added as owner" send_large_msg(receiver, text) return end if matches[1] == 'setflood' then if not is_momod(msg) then return "For moderators only!" end if tonumber(matches[2]) < 5 or tonumber(matches[2]) > 20 then return "Wrong number,range is [5-20]" end local flood_max = matches[2] data[tostring(msg.to.id)]['settings']['flood_msg_max'] = flood_max save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] set flood to ["..matches[2].."]") return 'Group flood has been set to '..matches[2] end if matches[1] == 'clean' then if not is_owner(msg) then return "Only owner can clean" end if matches[2] == 'member' then if not is_owner(msg) then return "Only admins can clean members" end local receiver = get_receiver(msg) chat_info(receiver, cleanmember, {receiver=receiver}) end if matches[2] == 'modlist' then if next(data[tostring(msg.to.id)]['moderators']) == nil then --fix way return 'No moderator in this group.' end local message = '\nList of moderators for ' .. string.gsub(msg.to.print_name, '_', ' ') .. ':\n' for k,v in pairs(data[tostring(msg.to.id)]['moderators']) do data[tostring(msg.to.id)]['moderators'][tostring(k)] = nil save_data(_config.moderation.data, data) end savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned modlist") end if matches[2] == 'rules' then local data_cat = 'rules' data[tostring(msg.to.id)][data_cat] = nil save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned rules") end if matches[2] == 'about' then local data_cat = 'description' data[tostring(msg.to.id)][data_cat] = nil save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] cleaned about") end end if matches[1] == 'help' then if not is_momod(msg) then return end savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help") return help() end if matches[1] == 'res' and is_momod(msg) then local cbres_extra = { chatid = msg.to.id } local username = matches[2] local username = username:gsub("@","") savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /res "..username) return res_user(username, callbackres, cbres_extra) end end end return { patterns = { "^[!/](add)$", "^[!/](rem)$", "^[!/](rules)$", "^[!/](about)$", "^[!/](setname) (.*)$", "^[!/](setphoto)$", "^[!/](promote) (.*)$", "^[!/](help)$", "^[!/](clean) (.*)$", "^[!/](demote) (.*)$", "^[!/](set) ([^%s]+) (.*)$", "^[!/](lock) (.*)$", "^[!/](setowner) (%d+)$", "^[!/](owner)$", "^[!/](res) (.*)$", "^[!/](setgpowner) (%d+) (%d+)$",-- (group id) (owner id) "^[!/](unlock) (.*)$", "^[!/](setflood) (%d+)$", "^[!/](settings)$", "^[!/](modlist)$", "^[!/](newlink)$", "^[!/](link)$", "%[(photo)%]", "^!!tgservice (.+)$", }, run = run } end
gpl-2.0
CaptainPRICE/wire
lua/wire/stools/eyepod.lua
9
6494
WireToolSetup.setCategory( "Vehicle Control" ) WireToolSetup.open( "eyepod", "Eye Pod", "gmod_wire_eyepod", nil, "Eye Pods" ) if ( CLIENT ) then //tool hud lang language.Add( "Tool.wire_eyepod.name", "Eye Pod Tool (Wire)" ) language.Add( "Tool.wire_eyepod.desc", "Spawns an Eye Pod Mouse Controller." ) language.Add( "Tool.wire_eyepod.0", "Primary: Create/Update Controller Secondary: Link controller Reload: Unlink EyePod/Cancel Current Link" ) language.Add( "Tool.wire_eyepod.1", "Now select the pod to link to.") //panel control lang language.Add( "WireEyePod_DefaultToZero", "Default Outputs To Zero When Inactive" ) language.Add( "WireEyePod_CumulativeOutput", "Output Cumulative Mouse Position" ) end WireToolSetup.BaseLang() WireToolSetup.SetupMax( 15 ) TOOL.ClientConVar[ "model" ] = "models/jaanus/wiretool/wiretool_siren.mdl" TOOL.ClientConVar[ "DefaultToZero" ] = "1" TOOL.ClientConVar[ "CumulativeOutput" ] = "0" TOOL.ClientConVar[ "XMin" ] = "0" TOOL.ClientConVar[ "XMax" ] = "0" TOOL.ClientConVar[ "YMin" ] = "0" TOOL.ClientConVar[ "YMax" ] = "0" if SERVER then function TOOL:GetConVars() local DefaultToZero = self:GetClientNumber("DefaultToZero") local CumulativeOutput = self:GetClientNumber("CumulativeOutput") local ShowRateOfChange = (CumulativeOutput ~= 0) and 0 or 1 //set the default to zero to one if you are showing the mouse position instead if (ShowRateOfChange == 1) then DefaultToZero = 1 end local ClampXMin = self:GetClientNumber("XMin") local ClampXMax = self:GetClientNumber("XMax") local ClampYMin = self:GetClientNumber("YMin") local ClampYMax = self:GetClientNumber("YMax") local ClampX = 0 local ClampY = 0 //test clamp if ( (ClampXMin != 0 or ClampXMax != 0) and (ClampYMin != 0 or ClampYMax != 0) and ClampXMin != ClampXMax and ClampYMin != ClampYMax and ClampXMin < ClampXMax and ClampYMin < ClampYMax ) then ClampX = 1 ClampY = 1 elseif( (ClampXMin == 0 and ClampXMax == 0) or (ClampYMin == 0 or ClampYMax == 0) )then if(ClampXMin == 0 and ClampXMax == 0 and (ClampYMin != 0 or ClampYMax != 0)) then ClampX = 0 ClampY = 1 elseif(ClampYMin == 0 and ClampYMax == 0 and (ClampXMin != 0 or ClampXMax != 0)) then ClampX = 1 ClampY = 0 else ClampX = 0 ClampY = 0 end else WireLib.AddNotify(ply, "Invalid Clamping of Wire EyePod Values!", NOTIFY_ERROR, 5, NOTIFYSOUND_DRIP1) return 1, 0, 0, 0, 0, 0, 0, 0 end return DefaultToZero, ShowRateOfChange, ClampXMin, ClampXMax, ClampYMin, ClampYMax, ClampX, ClampY end end //link the eyepod to the vehicle function TOOL:RightClick(trace) if ( CLIENT ) then return true end local entity = trace.Entity if self:GetStage() == 0 and entity:GetClass() == "gmod_wire_eyepod" then self.PodCont = entity if self.PodCont.pod and self.PodCont.pod:IsValid() and self.PodCont.pod.AttachedWireEyePod then self.PodCont.pod.AttachedWireEyePod = nil self.PodCont.pod = nil end self:SetStage(1) return true elseif self:GetStage() == 1 and entity.GetPassenger then if entity.AttachedWireEyePod then self:GetOwner():ChatPrint("Pod Already Has An EyePod Linked To It!") return false end local Success = self.PodCont:PodLink(entity) if (Success == false) then self:GetOwner():ChatPrint("Error: Cannot Link Eye Pod!") return false end self:SetStage(0) self.PodCont = nil self:GetOwner():ChatPrint("Wire Eye Pod Linked") return true else return false end end function TOOL:Reload(trace) if ( CLIENT ) then return true end if self:GetStage() == 1 then self:SetStage(0) self.PodCont = nil return false elseif self:GetStage() == 0 and trace.Entity and trace.Entity:GetClass() == "gmod_wire_eyepod" then self:SetStage(0) self.PodCont = nil trace.Entity:PodLink(nil) self:GetOwner():ChatPrint("Wire Eye Pod Unlinked") return true end end -------------------------------------- TOOL Menu --------------------------------------------------- //TODO: Figure out a way for dynamic panels to work with check boxes (check boxes that use concommands instead of convars default to 1 allways) //check for client if (CLIENT) then function Wire_EyePod_Menu(panel) panel:ClearControls() panel:AddControl("Header", { Text = "#Tool.wire_eyepod.name", Description = "#Tool.wire_eyepod.desc" }) //preset chooser panel:AddControl("ComboBox", { Label = "#Presets", MenuButton = "1", Folder = "wire_eyepod", Options = { Default = { wire_eyepod_DefaultToZero = "1", wire_eyepod_CumulativeOutput = "0", wire_eyepod_XMin = "0", wire_eyepod_XMax = "0", wire_eyepod_YMin = "0", wire_eyepod_YMax = "0" } }, CVars = { [0] = "wire_eyepod_DefaultToZero", [1] = "wire_eyepod_CumulativeOutput", [2] = "wire_eyepod_XMin", [3] = "wire_eyepod_XMax", [4] = "wire_eyepod_YMin", [5] = "wire_eyepod_YMax" } }) WireDermaExts.ModelSelect(panel, "wire_eyepod_model", list.Get( "Wire_Misc_Tools_Models" ), 1) panel:AddControl("CheckBox", { Label = "#WireEyePod_CumulativeOutput", Command = "wire_eyepod_CumulativeOutput" }) panel:AddControl("CheckBox", { Label = "#WireEyePod_DefaultToZero", Command = "wire_eyepod_DefaultToZero" }) //clamps panel:AddControl( "Label", { Text = "\nClamp the output of the EyePod. \nSet both sliders to 0 to remove the clamp in that axis.", Description = "Clamps the outputs of the EyePod. Set to 0 not to clamp in that axis"} ) panel:AddControl( "Slider", { Label = "X Min", Type = "Float", Min = -2000, Max = 2000, Command = "wire_eyepod_XMin", Description = "Clamps the output of the EyePod's X to this minimum"} ) panel:AddControl( "Slider", { Label = "X Max", Type = "Float", Min = -2000, Max = 2000, Command = "wire_eyepod_XMax", Description = "Clamps the output of the EyePod's X to this maximum"} ) panel:AddControl( "Slider", { Label = "Y Min", Type = "Float", Min = -2000, Max = 2000, Command = "wire_eyepod_YMin", Description = "Clamps the output of the EyePod's Y to this minimum"} ) panel:AddControl( "Slider", { Label = "Y Max", Type = "Float", Min = -2000, Max = 2000, Command = "wire_eyepod_YMax", Description = "Clamps the output of the EyePod's Y to this maximum"} ) end function TOOL.BuildCPanel( panel ) Wire_EyePod_Menu(panel) end end
apache-2.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c99950021.lua
2
7084
--MSMM - Kaname Madoka function c99950021.initial_effect(c) c:EnableReviveLimit() --Spell Zone local e1=Effect.CreateEffect(c) e1:SetCode(EFFECT_SEND_REPLACE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_MZONE) e1:SetTarget(c99950021.sztg) e1:SetOperation(c99950021.szop) c:RegisterEffect(e1) --Pay Lp local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EVENT_PHASE+PHASE_STANDBY) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(c99950021.paycon) e2:SetOperation(c99950021.payop) c:RegisterEffect(e2) --Atk up local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(c99950021.value) c:RegisterEffect(e3) --DMG/ATK Down local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(99950021,2)) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCountLimit(1) e4:SetRange(LOCATION_MZONE) e4:SetTarget(c99950021.damtg) e4:SetOperation(c99950021.damop) c:RegisterEffect(e4) --To Hand local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(99950021,3)) e5:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_HAND) e5:SetCost(c99950021.thcost) e5:SetTarget(c99950021.thtg) e5:SetOperation(c99950021.thop) c:RegisterEffect(e5) --Cannot Special Summon local e6=Effect.CreateEffect(c) e6:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetCode(EFFECT_SPSUMMON_CONDITION) e6:SetValue(c99950021.splimit) c:RegisterEffect(e6) --Banish local e7=Effect.CreateEffect(c) e7:SetCategory(CATEGORY_REMOVE) e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e7:SetCode(EVENT_TO_GRAVE) e7:SetCondition(c99950021.bancon) e7:SetTarget(c99950021.bantg) e7:SetOperation(c99950021.banop) c:RegisterEffect(e7) end function c99950021.splimit(e,se,sp,st) return se:GetHandler():IsSetCard(9995) end function c99950021.sztg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetDestination()==LOCATION_GRAVE and c:IsReason(REASON_DESTROY) end if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return false end return Duel.SelectYesNo(tp,aux.Stringid(99950021,0)) end function c99950021.szop(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,true) --Spell local e1=Effect.CreateEffect(c) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+0x1fc0000) e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS) c:RegisterEffect(e1) --Recover local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_REMOVE) e2:SetRange(LOCATION_SZONE) e2:SetCondition(c99950021.reccon) e2:SetTarget(c99950021.rectg) e2:SetOperation(c99950021.recop) e2:SetReset(RESET_EVENT+0x1fe0000) c:RegisterEffect(e2) Duel.RaiseEvent(c,99950280,e,0,tp,0,0) end function c99950021.filter1(c,tp) return c:IsType(TYPE_MONSTER) and c:GetPreviousControler()~=tp end function c99950021.filter2(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) end function c99950021.reccon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(c99950021.filter1,1,nil,tp) end function c99950021.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,500) end function c99950021.recop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end function c99950021.paycon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnPlayer()==tp end function c99950021.payop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLP(tp)>300 and Duel.SelectYesNo(tp,aux.Stringid(99950021,1)) then Duel.PayLPCost(tp,300) else Duel.Destroy(e:GetHandler(),REASON_EFFECT) end end function c99950021.damtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)~=0 end Duel.SetTargetPlayer(1-tp) local dam=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)*500 Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function c99950021.damop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local dam=Duel.GetFieldGroupCount(p,LOCATION_MZONE,0)*500 if Duel.Damage(p,dam,REASON_EFFECT)~=0 then local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) local tc=g:GetFirst() while tc do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-dam) e1:SetReset(RESET_EVENT+0x1fe0000) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) tc=g:GetNext() end end end function c99950021.thfilter(c) return c:GetCode()==99950000 and c:IsAbleToHand() end function c99950021.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() and c:IsDiscardable() end Duel.SendtoGrave(c,REASON_COST+REASON_DISCARD) end function c99950021.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingMatchingCard(c99950021.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c99950021.thop(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tg=Duel.GetFirstMatchingCard(c99950021.thfilter,tp,LOCATION_DECK,0,nil) if tg then Duel.SendtoHand(tg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tg) end end function c99950021.banfilter(c) return c:IsFaceup() and c:IsAbleToRemove() end function c99950021.bancon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetPreviousLocation()==LOCATION_DECK and e:GetHandler():IsReason(REASON_EFFECT) end function c99950021.bantg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and c99950021.banfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(c99950021.banfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,c99950021.banfilter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c99950021.banop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end function c99950021.atkfilter(c) return c:IsFaceup() and c:IsType(TYPE_MONSTER) end function c99950021.value(e,c) return Duel.GetMatchingGroupCount(c99950021.atkfilter,c:GetControler(),0,LOCATION_REMOVED,nil)*100 end
gpl-3.0
TienHP/Aquaria
files/scripts/entities/turtlenoshell.lua
6
1153
-- 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 -- ================================================================================================ -- TURTLE NO SHELL -- ================================================================================================ dofile("scripts/entities/turtlecommon.lua") function init(me) -- init without shell v.commonInit(me, false) end
gpl-2.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Rabao/npcs/Leodarion.lua
4
3302
----------------------------------- -- Area: Rabao -- NPC: Leodarion -- Involved in Quest: 20 in Pirate Years, I'll Take the Big Box, True Will -- @pos -50 8 40 247 ----------------------------------- package.loaded["scripts/zones/Rabao/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Rabao/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(player:getQuestStatus(OUTLANDS,I_LL_TAKE_THE_BIG_BOX) == QUEST_ACCEPTED and player:getVar("illTakeTheBigBoxCS") == 2) then if(trade:hasItemQty(17098,1) and trade:getItemCount() == 1) then -- Trade Oak Pole player:startEvent(0x005c); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(player:getQuestStatus(OUTLANDS,I_LL_TAKE_THE_BIG_BOX) == QUEST_ACCEPTED) then illTakeTheBigBoxCS = player:getVar("illTakeTheBigBoxCS"); if(illTakeTheBigBoxCS == 1) then player:startEvent(0x005a); elseif(illTakeTheBigBoxCS == 2) then player:startEvent(0x005b); elseif(illTakeTheBigBoxCS == 3 and VanadielDayOfTheYear() == player:getVar("illTakeTheBigBox_Timer")) then player:startEvent(0x005d); elseif(illTakeTheBigBoxCS == 3) then player:startEvent(0x005e); elseif(illTakeTheBigBoxCS == 4) then player:startEvent(0x005f); end elseif(player:getQuestStatus(OUTLANDS,TRUE_WILL) == QUEST_ACCEPTED) then trueWillCS = player:getVar("trueWillCS"); if(trueWillCS == 1) then player:startEvent(0x0061); elseif(trueWillCS == 2 and player:hasKeyItem(LARGE_TRICK_BOX) == false) then player:startEvent(0x0062); elseif(player:hasKeyItem(LARGE_TRICK_BOX)) then player:startEvent(0x0063); end else player:startEvent(0x0059); 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 == 0x005a) then player:setVar("illTakeTheBigBoxCS",2); elseif(csid == 0x005c) then player:tradeComplete(); player:setVar("illTakeTheBigBox_Timer",VanadielDayOfTheYear()); player:setVar("illTakeTheBigBoxCS",3); elseif(csid == 0x005e) then player:setVar("illTakeTheBigBox_Timer",0); player:setVar("illTakeTheBigBoxCS",4); player:addKeyItem(SEANCE_STAFF); player:messageSpecial(KEYITEM_OBTAINED,SEANCE_STAFF); elseif(csid == 0x0061) then player:delKeyItem(OLD_TRICK_BOX); player:setVar("trueWillCS",2); elseif(csid == 0x0063) then if(player:getFreeSlotsCount() < 1) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,13782); else player:delKeyItem(LARGE_TRICK_BOX); player:addItem(13782); player:messageSpecial(ITEM_OBTAINED,13782); -- Ninja Chainmail player:setVar("trueWillCS",0); player:addFame(OUTLANDS,NORG_FAME*30); player:completeQuest(OUTLANDS,TRUE_WILL); end end end;
gpl-3.0
MinFu/luci
applications/luci-app-openvpn/luasrc/model/cbi/openvpn-advanced.lua
17
19842
-- Copyright 2008 Steven Barth <steven@midlink.org> -- Licensed to the public under the Apache License 2.0. require("luci.ip") require("luci.model.uci") local knownParams = { -- -- Widget Name Default(s) Description Option(s) -- { "Service", { -- initialisation and daemon options { ListValue, "verb", { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, translate("Set output verbosity") }, { Flag, "mlock", 0, translate("Disable Paging") }, { Flag, "disable_occ", 0, translate("Disable options consistency check") }, -- { Value, "user", "root", translate("Set UID to user") }, -- { Value, "group", "root", translate("Set GID to group") }, { Value, "cd", "/etc/openvpn", translate("Change to directory before initialization") }, { Value, "chroot", "/var/run", translate("Chroot to directory after initialization") }, -- { Value, "daemon", "Instance-Name", translate("Daemonize after initialization") }, -- { Value, "syslog", "Instance-Name", translate("Output to syslog and do not daemonize") }, { Flag, "passtos", 0, translate("TOS passthrough (applies to IPv4 only)") }, -- { Value, "inetd", "nowait Instance-Name", translate("Run as an inetd or xinetd server") }, { Value, "log", "/var/log/openvpn.log", translate("Write log to file") }, { Value, "log_append", "/var/log/openvpn.log", translate("Append log to file") }, { Flag, "suppress_timestamps", 0, translate("Don't log timestamps") }, -- { Value, "writepid", "/var/run/openvpn.pid", translate("Write process ID to file") }, { Value, "nice", 0, translate("Change process priority") }, { Flag, "fast_io", 0, translate("Optimize TUN/TAP/UDP writes") }, { Value, "echo", "some params echoed to log", translate("Echo parameters to log") }, { ListValue, "remap_usr1", { "SIGHUP", "SIGTERM" }, translate("Remap SIGUSR1 signals") }, { Value, "status", "/var/run/openvpn.status 5", translate("Write status to file every n seconds") }, { Value, "status_version", { 1, 2 }, translate("Status file format version") }, -- status { Value, "mute", 5, translate("Limit repeated log messages") }, { Value, "up", "/usr/bin/ovpn-up", translate("Shell cmd to execute after tun device open") }, { Value, "up_delay", 5, translate("Delay tun/tap open and up script execution") }, { Value, "down", "/usr/bin/ovpn-down", translate("Shell cmd to run after tun device close") }, { Flag, "down_pre", 0, translate("Call down cmd/script before TUN/TAP close") }, { Flag, "up_restart", 0, translate("Run up/down scripts for all restarts") }, { Value, "route_up", "/usr/bin/ovpn-routeup", translate("Execute shell cmd after routes are added") }, { Value, "ipchange", "/usr/bin/ovpn-ipchange", translate("Execute shell command on remote ip change"), { mode="p2p" } }, { DynamicList, "setenv", { "VAR1 value1", "VAR2 value2" }, translate("Pass environment variables to script") }, { Value, "tls_verify", "/usr/bin/ovpn-tlsverify", translate("Shell command to verify X509 name") }, { Value, "client_connect", "/usr/bin/ovpn-clientconnect", translate("Run script cmd on client connection") }, { Flag, "client_disconnect", 0, translate("Run script cmd on client disconnection") }, { Value, "learn_address", "/usr/bin/ovpn-learnaddress", translate("Executed in server mode whenever an IPv4 address/route or MAC address is added to OpenVPN's internal routing table") }, { Value, "auth_user_pass_verify", "/usr/bin/ovpn-userpass via-env", translate("Executed in server mode on new client connections, when the client is still untrusted") }, { ListValue, "script_security", { 0, 1, 2, 3 }, translate("Policy level over usage of external programs and scripts") }, } }, { "Networking", { -- socket config { ListValue, "mode", { "p2p", "server" }, translate("Major mode") }, { Value, "local", "0.0.0.0", translate("Local host name or ip address") }, { Value, "port", 1194, translate("TCP/UDP port # for both local and remote") }, { Value, "lport", 1194, translate("TCP/UDP port # for local (default=1194)") }, { Value, "rport", 1194, translate("TCP/UDP port # for remote (default=1194)") }, { Flag, "float", 0, translate("Allow remote to change its IP or port") }, { Flag, "nobind", 0, translate("Do not bind to local address and port") }, { Value, "dev", "tun0", translate("tun/tap device") }, { ListValue, "dev_type", { "tun", "tap" }, translate("Type of used device") }, { Value, "dev_node", "/dev/net/tun", translate("Use tun/tap device node") }, { Flag, "tun_ipv6", 0, translate("Make tun device IPv6 capable") }, { Value, "ifconfig", "10.200.200.3 10.200.200.1", translate("Set tun/tap adapter parameters") }, { Flag, "ifconfig_noexec", 0, translate("Don't actually execute ifconfig") }, { Flag, "ifconfig_nowarn", 0, translate("Don't warn on ifconfig inconsistencies") }, { DynamicList, "route", "10.123.0.0 255.255.0.0", translate("Add route after establishing connection") }, { Value, "route_gateway", "10.234.1.1", translate("Specify a default gateway for routes") }, { Value, "route_delay", 0, translate("Delay n seconds after connection") }, { Flag, "route_noexec", 0, translate("Don't add routes automatically") }, { ListValue, "mtu_disc", { "yes", "maybe", "no" }, translate("Enable Path MTU discovery") }, { Flag, "mtu_test", 0, translate("Empirically measure MTU") }, { ListValue, "comp_lzo", { "yes", "no", "adaptive" }, translate("Use fast LZO compression") }, { Flag, "comp_noadapt", 0, translate("Don't use adaptive lzo compression"), { comp_lzo=1 } }, { Value, "link_mtu", 1500, translate("Set TCP/UDP MTU") }, { Value, "tun_mtu", 1500, translate("Set tun/tap device MTU") }, { Value, "tun_mtu_extra", 1500, translate("Set tun/tap device overhead") }, { Value, "fragment", 1500, translate("Enable internal datagram fragmentation"), { proto="udp" } }, { Value, "mssfix", 1500, translate("Set upper bound on TCP MSS"), { proto="udp" } }, { Value, "sndbuf", 65536, translate("Set the TCP/UDP send buffer size") }, { Value, "rcvbuf", 65536, translate("Set the TCP/UDP receive buffer size") }, { Value, "txqueuelen", 100, translate("Set tun/tap TX queue length") }, { Value, "shaper", 10240, translate("Shaping for peer bandwidth") }, { Value, "inactive", 240, translate("tun/tap inactivity timeout") }, { Value, "keepalive", "10 60", translate("Helper directive to simplify the expression of --ping and --ping-restart in server mode configurations") }, { Value, "ping", 30, translate("Ping remote every n seconds over TCP/UDP port") }, { Value, "ping_exit", 120, translate("Remote ping timeout") }, { Value, "ping_restart", 60, translate("Restart after remote ping timeout") }, { Flag, "ping_timer_rem", 0, translate("Only process ping timeouts if routes exist") }, { Flag, "persist_tun", 0, translate("Keep tun/tap device open on restart") }, { Flag, "persist_key", 0, translate("Don't re-read key on restart") }, { Flag, "persist_local_ip", 0, translate("Keep local IP address on restart") }, { Flag, "persist_remote_ip", 0, translate("Keep remote IP address on restart") }, -- management channel { Value, "management", "127.0.0.1 31194 /etc/openvpn/mngmt-pwds", translate("Enable management interface on <em>IP</em> <em>port</em>") }, { Flag, "management_query_passwords", 0, translate("Query management channel for private key") }, -- management { Flag, "management_hold", 0, translate("Start OpenVPN in a hibernating state") }, -- management { Value, "management_log_cache", 100, translate("Number of lines for log file history") }, -- management { ListValue, "topology", { "net30", "p2p", "subnet" }, translate("'net30', 'p2p', or 'subnet'"), {dev_type="tun" } }, } }, { "VPN", { { Value, "server", "10.200.200.0 255.255.255.0", translate("Configure server mode"), { server_mode="1" } }, { Value, "server_bridge", "10.200.200.1 255.255.255.0 10.200.200.200 10.200.200.250", translate("Configure server bridge"), { server_mode="1" } }, { DynamicList, "push", { "redirect-gateway", "comp-lzo" }, translate("Push options to peer"), { server_mode="1" } }, { Flag, "push_reset", 0, translate("Don't inherit global push options"), { server_mode="1" } }, { Flag, "disable", 0, translate("Client is disabled"), { server_mode="1" } }, { Value, "ifconfig_pool", "10.200.200.100 10.200.200.150 255.255.255.0", translate("Set aside a pool of subnets"), { server_mode="1" } }, { Value, "ifconfig_pool_persist", "/etc/openvpn/ipp.txt 600", translate("Persist/unpersist ifconfig-pool"), { server_mode="1" } }, -- { Flag, "ifconfig_pool_linear", 0, translate("Use individual addresses rather than /30 subnets"), { server_mode="1" } }, -- deprecated and replaced by --topology p2p { Value, "ifconfig_push", "10.200.200.1 255.255.255.255", translate("Push an ifconfig option to remote"), { server_mode="1" } }, { Value, "iroute", "10.200.200.0 255.255.255.0", translate("Route subnet to client"), { server_mode="1" } }, { Flag, "client_to_client", 0, translate("Allow client-to-client traffic"), { server_mode="1" } }, { Flag, "duplicate_cn", 0, translate("Allow multiple clients with same certificate"), { server_mode="1" } }, { Value, "client_config_dir", "/etc/openvpn/ccd", translate("Directory for custom client config files"), { server_mode="1" } }, { Flag, "ccd_exclusive", 0, translate("Refuse connection if no custom client config"), { server_mode="1" } }, { Value, "tmp_dir", "/var/run/openvpn", translate("Temporary directory for client-connect return file"), { server_mode="1" } }, { Value, "hash_size", "256 256", translate("Set size of real and virtual address hash tables"), { server_mode="1" } }, { Value, "bcast_buffers", 256, translate("Number of allocated broadcast buffers"), { server_mode="1" } }, { Value, "tcp_queue_limit", 64, translate("Maximum number of queued TCP output packets"), { server_mode="1" } }, { Value, "max_clients", 10, translate("Allowed maximum of connected clients"), { server_mode="1" } }, { Value, "max_routes_per_client", 256, translate("Allowed maximum of internal"), { server_mode="1" } }, { Value, "connect_freq", "3 10", translate("Allowed maximum of new connections"), { server_mode="1" } }, { Flag, "client_cert_not_required", 0, translate("Don't require client certificate"), { server_mode="1" } }, { Flag, "username_as_common_name", 0, translate("Use username as common name"), { server_mode="1" } }, { Flag, "client", 0, translate("Configure client mode"), { server_mode="0" }, { server_mode="" } }, { Flag, "pull", 0, translate("Accept options pushed from server"), { client="1" } }, { Value, "auth_user_pass", "/etc/openvpn/userpass.txt", translate("Authenticate using username/password"), { client="1" } }, { ListValue, "auth_retry", { "none", "nointeract", "interact" }, translate("Handling of authentication failures"), { client="1" } }, { Value, "explicit_exit_notify", 1, translate("Send notification to peer on disconnect"), { client="1" } }, { DynamicList, "remote", "1.2.3.4", translate("Remote host name or ip address"), { client="1" } }, { Flag, "remote_random", 1, translate("Randomly choose remote server"), { client="1" } }, { ListValue, "proto", { "udp", "tcp-client", "tcp-server" }, translate("Use protocol"), { client="1" } }, { Value, "connect_retry", 5, translate("Connection retry interval"), { proto="tcp-client" }, { client="1" } }, { Value, "http_proxy", "192.168.1.100 8080", translate("Connect to remote host through an HTTP proxy"), { client="1" } }, { Flag, "http_proxy_retry", 0, translate("Retry indefinitely on HTTP proxy errors"), { client="1" } }, { Value, "http_proxy_timeout", 5, translate("Proxy timeout in seconds"), { client="1" } }, { DynamicList, "http_proxy_option", { "VERSION 1.0", "AGENT OpenVPN/2.0.9" }, translate("Set extended HTTP proxy options"), { client="1" } }, { Value, "socks_proxy", "192.168.1.200 1080", translate("Connect through Socks5 proxy"), { client="1" } }, { Value, "socks_proxy_retry", 5, translate("Retry indefinitely on Socks proxy errors"), { client="1" } }, -- client && socks_proxy { Value, "resolv_retry", "infinite", translate("If hostname resolve fails, retry"), { client="1" } }, { ListValue, "redirect_gateway", { "", "local", "def1", "local def1" }, translate("Automatically redirect default route"), { client="1" } }, } }, { "Cryptography", { { Value, "secret", "/etc/openvpn/secret.key 1", translate("Enable Static Key encryption mode (non-TLS)") }, { Value, "auth", "SHA1", translate("HMAC authentication for packets") }, -- parse { Value, "cipher", "BF-CBC", translate("Encryption cipher for packets") }, -- parse { Value, "keysize", 1024, translate("Size of cipher key") }, -- parse { Value, "engine", "dynamic", translate("Enable OpenSSL hardware crypto engines") }, -- parse { Flag, "no_replay", 0, translate("Disable replay protection") }, { Value, "replay_window", "64 15", translate("Replay protection sliding window size") }, { Flag, "mute_replay_warnings", 0, translate("Silence the output of replay warnings") }, { Value, "replay_persist", "/var/run/openvpn-replay-state", translate("Persist replay-protection state") }, { Flag, "no_iv", 0, translate("Disable cipher initialisation vector") }, { Flag, "tls_server", 0, translate("Enable TLS and assume server role"), { tls_client="" }, { tls_client="0" } }, { Flag, "tls_client", 0, translate("Enable TLS and assume client role"), { tls_server="" }, { tls_server="0" } }, { FileUpload, "ca", "/etc/easy-rsa/keys/ca.crt", translate("Certificate authority") }, { FileUpload, "dh", "/etc/easy-rsa/keys/dh1024.pem", translate("Diffie Hellman parameters") }, { FileUpload, "cert", "/etc/easy-rsa/keys/some-client.crt", translate("Local certificate") }, { FileUpload, "key", "/etc/easy-rsa/keys/some-client.key", translate("Local private key") }, { FileUpload, "pkcs12", "/etc/easy-rsa/keys/some-client.pk12", translate("PKCS#12 file containing keys") }, { ListValue, "key_method", { 1, 2 }, translate("Enable TLS and assume client role") }, { Value, "tls_cipher", "DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:AES256-SHA:EDH-RSA-DES-CBC3-SHA:EDH-DSS-DES-CBC3-SHA:DES-CBC3-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA:AES128-SHA:RC4-SHA:RC4-MD5:EDH-RSA-DES-CBC-SHA:EDH-DSS-DES-CBC-SHA:DES-CBC-SHA:EXP-EDH-RSA-DES-CBC-SHA:EXP-EDH-DSS-DES-CBC-SHA:EXP-DES-CBC-SHA:EXP-RC2-CBC-MD5:EXP-RC4-MD5", translate("TLS cipher") }, { Value, "tls_timeout", 2, translate("Retransmit timeout on TLS control channel") }, { Value, "reneg_bytes", 1024, translate("Renegotiate data chan. key after bytes") }, { Value, "reneg_pkts", 100, translate("Renegotiate data chan. key after packets") }, { Value, "reneg_sec", 3600, translate("Renegotiate data chan. key after seconds") }, { Value, "hand_window", 60, translate("Timeframe for key exchange") }, { Value, "tran_window", 3600, translate("Key transition window") }, { Flag, "single_session", 0, translate("Allow only one session") }, { Flag, "tls_exit", 0, translate("Exit on TLS negotiation failure") }, { Value, "tls_auth", "/etc/openvpn/tlsauth.key 1", translate("Additional authentication over TLS") }, --{ Value, "askpass", "[file]", translate("Get PEM password from controlling tty before we daemonize") }, { Flag, "auth_nocache", 0, translate("Don't cache --askpass or --auth-user-pass passwords") }, { Value, "tls_remote", "remote_x509_name", translate("Only accept connections from given X509 name") }, { ListValue, "ns_cert_type", { "client", "server" }, translate("Require explicit designation on certificate") }, { ListValue, "remote_cert_tls", { "client", "server" }, translate("Require explicit key usage on certificate") }, { Value, "crl_verify", "/etc/easy-rsa/keys/crl.pem", translate("Check peer certificate against a CRL") }, } } } local cts = { } local params = { } local m = Map("openvpn") local p = m:section( SimpleSection ) p.template = "openvpn/pageswitch" p.mode = "advanced" p.instance = arg[1] p.category = arg[2] or "Service" for _, c in ipairs(knownParams) do cts[#cts+1] = c[1] if c[1] == p.category then params = c[2] end end p.categories = cts local s = m:section( NamedSection, arg[1], "openvpn", translate("%s" % arg[2]) ) s.title = translate("%s" % arg[2]) s.addremove = false s.anonymous = true for _, option in ipairs(params) do local o = s:option( option[1], option[2], option[2], option[4] ) if option[1] == DummyValue then o.value = option[3] else if option[1] == DynamicList then o.cast = nil function o.cfgvalue(...) local val = AbstractValue.cfgvalue(...) return ( val and type(val) ~= "table" ) and { val } or val end end o.optional = true if type(option[3]) == "table" then if o.optional then o:value("", "-- remove --") end for _, v in ipairs(option[3]) do v = tostring(v) o:value(v) end o.default = tostring(option[3][1]) else o.default = tostring(option[3]) end end for i=5,#option do if type(option[i]) == "table" then o:depends(option[i]) end end end return m
apache-2.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c66666620.lua
2
3810
--Aetherial Girl Tanashi function c66666620.initial_effect(c) --pendulum summon aux.EnablePendulumAttribute(c) --toHand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1,66666620) e2:SetCode(EVENT_FREE_CHAIN) e2:SetTarget(c66666620.pentarget) e2:SetOperation(c66666620.penactivate) c:RegisterEffect(e2) --fieldsearch local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(66666620,1)) e3:SetCountLimit(1,66666720) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetTarget(c66666620.tg) e3:SetOperation(c66666620.op) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) local e5=e3:Clone() e5:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e5) --tohand local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(66666620,2)) e6:SetCategory(CATEGORY_TOHAND) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetCode(EVENT_RELEASE) e6:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e6:SetTarget(c66666620.thtg) e6:SetOperation(c66666620.thop) c:RegisterEffect(e6) --splimit local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_FIELD) e7:SetRange(LOCATION_PZONE) e7:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e7:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e7:SetTargetRange(1,0) e7:SetTarget(c66666620.splimit) c:RegisterEffect(e7) end function c66666620.splimit(e,c,sump,sumtype,sumpos,targetp) return not c:IsRace(RACE_SPELLCASTER) and bit.band(sumtype,SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end function c66666620.filter2(c) return ((c:IsSetCard(0x144) and c:IsType(TYPE_MONSTER)) or c:IsCode(66666625) or c:IsCode(66666607) or c:IsCode(66666628)) and c:IsAbleToHand() end function c66666620.pentarget(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c66666620.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c66666620.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c66666620.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c66666620.penactivate(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 c66666620.filter(c) return c:IsSetCard(0x144) and c:IsAbleToHand() end function c66666620.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c66666620.filter2,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function c66666620.op(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,c66666620.filter2,tp,LOCATION_DECK,0,1,1,nil) if g:GetCount()>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function c66666620.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c66666620.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
gpl-3.0
waytim/darkstar
scripts/globals/items/coeurl_sub.lua
18
1832
----------------------------------------- -- ID: 5166 -- Item: coeurl_sub -- Food Effect: 30Min, All Races ----------------------------------------- -- Magic 10 -- Strength 5 -- Agility 1 -- Intelligence -2 -- Health Regen While Healing 1 -- Attack % 20 -- Attack Cap 75 -- Ranged ATT % 20 -- Ranged ATT Cap 75 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,1800,5166); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MP, 10); target:addMod(MOD_STR, 5); target:addMod(MOD_AGI, 1); target:addMod(MOD_INT, -2); target:addMod(MOD_HPHEAL, 1); target:addMod(MOD_FOOD_ATTP, 20); target:addMod(MOD_FOOD_ATT_CAP, 75); target:addMod(MOD_FOOD_RATTP, 20); target:addMod(MOD_FOOD_RATT_CAP, 75); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MP, 10); target:delMod(MOD_STR, 5); target:delMod(MOD_AGI, 1); target:delMod(MOD_INT, -2); target:delMod(MOD_HPHEAL, 1); target:delMod(MOD_FOOD_ATTP, 20); target:delMod(MOD_FOOD_ATT_CAP, 75); target:delMod(MOD_FOOD_RATTP, 20); target:delMod(MOD_FOOD_RATT_CAP, 75); end;
gpl-3.0
TheOnePharaoh/YGOPro-Custom-Cards
script/c160006319.lua
2
2586
--BlackMail Golem function c160006319.initial_effect(c) --Negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(160006319,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetRange(LOCATION_MZONE) e1:SetCondition(c160006319.condition) e1:SetCost(c160006319.cost) e1:SetTarget(c160006319.target) e1:SetOperation(c160006319.operation) c:RegisterEffect(e1) --Revive local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(160006319,1)) e2:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1) e2:SetTarget(c160006319.sumtg) e2:SetOperation(c160006319.sumop) c:RegisterEffect(e2) end function c160006319.confilter(c) return c:IsOnField() and c:IsType(TYPE_MONSTER) and c:IsSetCard(0xc81) and bit.band(c:GetSummonType(),SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL end function c160006319.condition(e,tp,eg,ep,ev,re,r,rp) if re:IsHasCategory(CATEGORY_NEGATE) and Duel.GetChainInfo(ev-1,CHAININFO_TRIGGERING_EFFECT):IsHasType(EFFECT_TYPE_ACTIVATE) then return false end local ex,tg,tc=Duel.GetOperationInfo(ev,CATEGORY_DESTROY) return ex and tg~=nil and tc+tg:FilterCount(c160006319.confilter,nil)-tg:GetCount()>0 end function c160006319.cost(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 c160006319.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) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function c160006319.operation(e,tp,eg,ep,ev,re,r,rp) Duel.NegateActivation(ev) if re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end e:GetHandler():RegisterFlagEffect(160006319,RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END,0,0) end function c160006319.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:GetFlagEffect(160006319)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function c160006319.sumop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP) end end
gpl-3.0
internetisalie/lua-for-idea
include/mobdebug/mobdebug.lua
1
76630
-- MobDebug -- Lua remote debugger -- Copyright 2011-15 Paul Kulchenko -- Based on RemDebug 1.0 Copyright Kepler Project 2005 --[[ MobDebug License ----------------------------------------------------- Copyright (C) 2011-2014 Paul Kulchenko Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- RemDebug License --------------------------------------------------- Copyright (c) 2006 The Kepler Project. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -- Serpent License ---------------------------------------------------- Copyright (c) 2011-2013 Paul Kulchenko (paul@kulchenko.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --]] -- use loaded modules or load explicitly on those systems that require that local require = require local io = io or require "io" local table = table or require "table" local string = string or require "string" local coroutine = coroutine or require "coroutine" local debug = require "debug" -- protect require "os" as it may fail on embedded systems without os module local os = os or (function(module) local ok, res = pcall(require, module) return ok and res or nil end)("os") --local global_print = print --function print(...) -- global_print(...) -- io.stdout:flush() --end local mobdebug = { _NAME = "mobdebug", _VERSION = 0.628, _COPYRIGHT = "Paul Kulchenko", _DESCRIPTION = "Mobile Remote Debugger for the Lua programming language", port = os and os.getenv and tonumber((os.getenv("MOBDEBUG_PORT"))) or 8171, envbasedir = os and os.getenv and (os.getenv("MOBDEBUG_BASEDIR")) or "", checkcount = 200, yieldtimeout = 0.02, -- yield timeout (s) connecttimeout = 2, -- connect timeout (s) } local error = error local getfenv = getfenv local setfenv = setfenv local loadstring = loadstring or load -- "load" replaced "loadstring" in Lua 5.2 local pairs = pairs local setmetatable = setmetatable local tonumber = tonumber local unpack = table.unpack or unpack local rawget = rawget local gsub, sub, find = string.gsub, string.sub, string.find -- if strict.lua is used, then need to avoid referencing some global -- variables, as they can be undefined; -- use rawget to avoid complaints from strict.lua at run-time. -- it's safe to do the initialization here as all these variables -- should get defined values (if any) before the debugging starts. -- there is also global 'wx' variable, which is checked as part of -- the debug loop as 'wx' can be loaded at any time during debugging. local genv = _G or _ENV local jit = rawget(genv, "jit") local MOAICoroutine = rawget(genv, "MOAICoroutine") -- ngx_lua debugging requires a special handling as its coroutine.* -- methods use a different mechanism that doesn't allow resume calls -- from debug hook handlers. -- Instead, the "original" coroutine.* methods are used. -- `rawget` needs to be used to protect against `strict` checks, but -- ngx_lua hides those in a metatable, so need to use that. local metagindex = getmetatable(genv) and getmetatable(genv).__index local ngx = type(metagindex) == "table" and metagindex.rawget and metagindex:rawget("ngx") or nil local corocreate = ngx and coroutine._create or coroutine.create local cororesume = ngx and coroutine._resume or coroutine.resume local coroyield = ngx and coroutine._yield or coroutine.yield local corostatus = ngx and coroutine._status or coroutine.status local corowrap = coroutine.wrap if not setfenv then -- Lua 5.2+ -- based on http://lua-users.org/lists/lua-l/2010-06/msg00314.html -- this assumes f is a function local function findenv(f) local level = 1 repeat local name, value = debug.getupvalue(f, level) if name == '_ENV' then return level, value end level = level + 1 until name == nil return nil end getfenv = function (f) return(select(2, findenv(f)) or _G) end setfenv = function (f, t) local level = findenv(f) if level then debug.setupvalue(f, level, t) end return f end end -- check for OS and convert file names to lower case on windows -- (its file system is case insensitive, but case preserving), as setting a -- breakpoint on x:\Foo.lua will not work if the file was loaded as X:\foo.lua. -- OSX and Windows behave the same way (case insensitive, but case preserving). -- OSX can be configured to be case-sensitive, so check for that. This doesn't -- handle the case of different partitions having different case-sensitivity. local win = os and os.getenv and (os.getenv('WINDIR') or (os.getenv('OS') or ''):match('[Ww]indows')) and true or false local mac = not win and (os and os.getenv and os.getenv('DYLD_LIBRARY_PATH') or not io.open("/proc")) and true or false local iscasepreserving = win or (mac and io.open('/library') ~= nil) -- turn jit off based on Mike Pall's comment in this discussion: -- http://www.freelists.org/post/luajit/Debug-hooks-and-JIT,2 -- "You need to turn it off at the start if you plan to receive -- reliable hook calls at any later point in time." if jit and jit.off then jit.off() end local socket = require "socket" local coro_debugger local coro_debugee local coroutines = {}; setmetatable(coroutines, {__mode = "k"}) -- "weak" keys local events = { BREAK = 1, WATCH = 2, RESTART = 3, STACK = 4 } local breakpoints = {} local watches = {} local curstack = {} local lastsource local lastfile local watchescnt = 0 local abort -- default value is nil; this is used in start/loop distinction local seen_hook = false local checkcount = 0 local step_into = false local step_over = false local step_level = 0 local stack_level = 0 local server local buf local outputs = {} local iobase = {print = print} local basedir = mobdebug.envbasedir local deferror = "execution aborted at default debugee" local debugee = function () local a = 1 for _ = 1, 10 do a = a + 1 end error(deferror) end local function q(s) return string.gsub(s, '([%(%)%.%%%+%-%*%?%[%^%$%]])','%%%1') end local serpent = (function() ---- include Serpent module for serialization local n, v = "serpent", 0.285 -- (C) 2012-15 Paul Kulchenko; MIT License local c, d = "Paul Kulchenko", "Lua serializer and pretty printer" local snum = {[tostring(1/0)]='1/0 --[[math.huge]]',[tostring(-1/0)]='-1/0 --[[-math.huge]]',[tostring(0/0)]='0/0'} local badtype = {thread = true, userdata = true, cdata = true} local getmetatable = debug and debug.getmetatable or getmetatable local keyword, globals, G = {}, {}, (_G or _ENV) for _,k in ipairs({'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while'}) do keyword[k] = true end for k,v in pairs(G) do globals[v] = k end -- build func to name mapping for _,g in ipairs({'coroutine', 'debug', 'io', 'math', 'string', 'table', 'os'}) do for k,v in pairs(type(G[g]) == 'table' and G[g] or {}) do globals[v] = g..'.'..k end end globals.utf8 = {} local function s(t, opts) local name, indent, fatal, maxnum = opts.name, opts.indent, opts.fatal, opts.maxnum local sparse, custom, huge = opts.sparse, opts.custom, not opts.nohuge local space, maxl = (opts.compact and '' or ' '), (opts.maxlevel or math.huge) local iname, comm = '_'..(name or ''), opts.comment and (tonumber(opts.comment) or math.huge) local numformat = opts.numformat or "%.17g" local seen, sref, syms, symn = {}, {'local '..iname..'={}'}, {}, 0 local function gensym(val) return '_'..(tostring(tostring(val)):gsub("[^%w]",""):gsub("(%d%w+)", -- tostring(val) is needed because __tostring may return a non-string value function(s) if not syms[s] then symn = symn+1; syms[s] = symn end return tostring(syms[s]) end)) end local function safestr(s) return type(s) == "number" and tostring(huge and snum[tostring(s)] or numformat:format(s)) or type(s) ~= "string" and tostring(s) -- escape NEWLINE/010 and EOF/026 or ("%q"):format(s):gsub("\010","n"):gsub("\026","\\026") end local function comment(s,l) return comm and (l or 0) < comm and ' --[['..select(2, pcall(tostring, s))..']]' or '' end local function globerr(s,l) return globals[s] and globals[s]..comment(s,l) or not fatal and safestr(select(2, pcall(tostring, s))) or error("Can't serialize "..tostring(s)) end local function safename(path, name) -- generates foo.bar, foo[3], or foo['b a r'] local n = name == nil and '' or name local plain = type(n) == "string" and n:match("^[%l%u_][%w_]*$") and not keyword[n] local safe = plain and n or '['..safestr(n)..']' return (path or '')..(plain and path and '.' or '')..safe, safe end local alphanumsort = type(opts.sortkeys) == 'function' and opts.sortkeys or function(k, o, n) -- k=keys, o=originaltable, n=padding local maxn, to = tonumber(n) or 12, {number = 'a', string = 'b'} local function padnum(d) return ("%0"..tostring(maxn).."d"):format(tonumber(d)) end table.sort(k, function(a,b) -- sort numeric keys first: k[key] is not nil for numerical keys return (k[a] ~= nil and 0 or to[type(a)] or 'z')..(tostring(a):gsub("%d+",padnum)) < (k[b] ~= nil and 0 or to[type(b)] or 'z')..(tostring(b):gsub("%d+",padnum)) end) end local function val2str(t, name, indent, insref, path, plainindex, level) local ttype, level, mt = type(t), (level or 0), getmetatable(t) local spath, sname = safename(path, name) local tag = plainindex and ((type(name) == "number") and '' or name..space..'='..space) or (name ~= nil and sname..space..'='..space or '') if seen[t] then -- already seen this element sref[#sref+1] = spath..space..'='..space..seen[t] return tag..'nil'..comment('ref', level) end -- protect from those cases where __tostring may fail if type(mt) == 'table' and pcall(function() return mt.__tostring and mt.__tostring(t) end) and (mt.__serialize or mt.__tostring) then -- knows how to serialize itself seen[t] = insref or spath if mt.__serialize then t = mt.__serialize(t) else t = tostring(t) end ttype = type(t) end -- new value falls through to be serialized if ttype == "table" then if level >= maxl then return tag..'{}'..comment('max', level) end seen[t] = insref or spath if next(t) == nil then return tag..'{[\"_____ID\"] = \"' .. tostring(t) .. '\"}'..comment(t, level) end -- table empty local maxn, o, out = math.min(#t, maxnum or #t), {}, {} for key = 1, maxn do o[key] = key end if not maxnum or #o < maxnum then local n = #o -- n = n + 1; o[n] is much faster than o[#o+1] on large tables for key in pairs(t) do if o[key] ~= key then n = n + 1; o[n] = key end end end if maxnum and #o > maxnum then o[maxnum+1] = nil end if opts.sortkeys and #o > maxn then alphanumsort(o, t, opts.sortkeys) end local sparse = sparse and #o > maxn -- disable sparsness if only numeric keys (shorter output) for n, key in ipairs(o) do local value, ktype, plainindex = t[key], type(key), n <= maxn and not sparse if opts.valignore and opts.valignore[value] -- skip ignored values; do nothing or opts.keyallow and not opts.keyallow[key] or opts.keyignore and opts.keyignore[key] or opts.valtypeignore and opts.valtypeignore[type(value)] -- skipping ignored value types or sparse and value == nil then -- skipping nils; do nothing elseif ktype == 'table' or ktype == 'function' or badtype[ktype] then if not seen[key] and not globals[key] then sref[#sref+1] = 'placeholder' local sname = safename(iname, gensym(key)) -- iname is table for local variables sref[#sref] = val2str(key,sname,indent,sname,iname,true) end sref[#sref+1] = 'placeholder' local path = seen[t]..'['..tostring(seen[key] or globals[key] or gensym(key))..']' sref[#sref] = path..space..'='..space..tostring(seen[value] or val2str(value,nil,indent,path)) else out[#out+1] = val2str(value,key,indent,insref,seen[t],plainindex,level+1) end end out[#out+1] = '[\"_____ID\"] = \"' .. tostring(t) .. '\"' local prefix = string.rep(indent or '', level) local head = indent and '{\n'..prefix..indent or '{' local body = table.concat(out, ','..(indent and '\n'..prefix..indent or space)) local tail = indent and "\n"..prefix..'}' or '}' return (custom and custom(tag,head,body,tail) or tag..head..body..tail)..comment(t, level) elseif badtype[ttype] then seen[t] = insref or spath return tag..globerr(t, level) elseif ttype == 'function' then seen[t] = insref or spath local ok, res = pcall(string.dump, t) local func = ok and ((opts.nocode and "function() return \"" .. tostring(t) .. "\" end" or "((loadstring or load)("..safestr(res)..",'@serialized'))")..comment(t, level)) return tag..(func or globerr(t, level)) else return tag..safestr(t) end -- handle all other types end local sepr = indent and "\n" or ";"..space local body = val2str(t, name, indent) -- this call also populates sref local tail = #sref>1 and table.concat(sref, sepr)..sepr or '' local warn = opts.comment and #sref>1 and space.."--[[incomplete output with shared/self-references skipped]]" or '' return not name and body..warn or "do local "..body..sepr..tail.."return "..name..sepr.."end" end local function deserialize(data, opts) local env = (opts and opts.safe == false) and G or setmetatable({}, { __index = function(t,k) return t end, __call = function(t,...) error("cannot call functions") end }) local f, res = (loadstring or load)('return '..data, nil, nil, env) if not f then f, res = (loadstring or load)(data, nil, nil, env) end if not f then return f, res end if setfenv then setfenv(f, env) end return pcall(f) end local function merge(a, b) if b then for k,v in pairs(b) do a[k] = v end end; return a; end return { _NAME = n, _COPYRIGHT = c, _DESCRIPTION = d, _VERSION = v, serialize = s, load = deserialize, dump = function(a, opts) return s(a, merge({name = '_', compact = true, sparse = true}, opts)) end, line = function(a, opts) return s(a, merge({sortkeys = true, comment = true}, opts)) end, block = function(a, opts) return s(a, merge({indent = ' ', sortkeys = true, comment = true}, opts)) end } end)() ---- end of Serpent module mobdebug.line = serpent.line mobdebug.dump = serpent.dump mobdebug.linemap = nil mobdebug.loadstring = loadstring local function removebasedir(path, basedir) if iscasepreserving then -- check if the lowercased path matches the basedir -- if so, return substring of the original path (to not lowercase it) return path:lower():find('^'..q(basedir:lower())) and path:sub(#basedir+1) or path else return string.gsub(path, '^'..q(basedir), '') end end local function addbasedir(path, basedir) return basedir .. removebasedir(path, basedir) end local function stack(start) local function vars(f) local func = debug.getinfo(f, "f").func local i = 1 local locals = {} -- get locals while true do local name, value = debug.getlocal(f, i) if not name then break end if string.sub(name, 1, 1) ~= '(' then locals[name] = {value, tostring(value)} end i = i + 1 end -- get varargs (these use negative indices) i = 1 local varargs = {} while true do local name, value = debug.getlocal(f, -i) if not name then break end table.insert(varargs, #varargs + 1, value) i = i + 1 end if i > 1 then locals["(...)"] = {varargs, tostring(varargs)}; end -- get upvalues i = 1 local ups = {} while func and true do -- check for func as it may be nil for tail calls local name, value = debug.getupvalue(func, i) if not name then break end ups[name] = {value, tostring(value)} i = i + 1 end return locals, ups end local stack = {} local linemap = mobdebug.linemap for i = (start or 0), 100 do local source = debug.getinfo(i, "Snl") if not source then break end local src = source.source if src:find("@") == 1 then src = src:sub(2):gsub("\\", "/") if src:find("%./") == 1 then src = src:sub(3) end end table.insert(stack, { -- add basedir to source {source.name, removebasedir(src, basedir), linemap and linemap(source.linedefined, source.source) or source.linedefined, linemap and linemap(source.currentline, source.source) or source.currentline, source.what, source.namewhat, source.short_src}, vars(i+1)}) if source.what == 'main' then break end end return stack end local function stack_message() local frames = {} local i=stack_level local __ = function(s) return string.gsub(tostring(s or ''), '([|#])', '\\%1') end -- escaped control characters local _ = function(s) return __(s) .. '|' end local join = function(t) local tt = {} for key, value in pairs(t) do table.insert(tt, __(key) .. "=" .. type(value) ) end return table.concat(tt, '|') end for i, frame in pairs(curstack) do if frame then local source = frame[1] local filename = source[2] table.insert(frames, 1, _(i) .. _(addbasedir(filename, basedir)) .. _(source[4]) .. _(source[1])) end end table.remove(frames, #frames) table.remove(frames, #frames) table.remove(frames, #frames) return table.concat(frames, '#') end local function set_breakpoint(file, line) if file == '-' and lastfile then file = lastfile elseif iscasepreserving then file = string.lower(file) end if not breakpoints[line] then breakpoints[line] = {} end breakpoints[line][file] = true end local function remove_breakpoint(file, line) if file == '-' and lastfile then file = lastfile elseif file == '*' and line == 0 then breakpoints = {} elseif iscasepreserving then file = string.lower(file) end if breakpoints[line] then breakpoints[line][file] = nil end end local function has_breakpoint(file, line) return breakpoints[line] and breakpoints[line][iscasepreserving and string.lower(file) or file] end local function restore_vars(vars) if type(vars) ~= 'table' then return end -- locals need to be processed in the reverse order, starting from -- the inner block out, to make sure that the localized variables -- are correctly updated with only the closest variable with -- the same name being changed -- first loop find how many local variables there is, while -- the second loop processes them from i to 1 local i = 1 while true do local name = debug.getlocal(3, i) if not name then break end i = i + 1 end i = i - 1 local written_vars = {} while i > 0 do local name = debug.getlocal(3, i) if not written_vars[name] then if string.sub(name, 1, 1) ~= '(' then debug.setlocal(3, i, rawget(vars, name)) end written_vars[name] = true end i = i - 1 end i = 1 local func = debug.getinfo(3, "f").func while true do local name = debug.getupvalue(func, i) if not name then break end if not written_vars[name] then if string.sub(name, 1, 1) ~= '(' then debug.setupvalue(func, i, rawget(vars, name)) end written_vars[name] = true end i = i + 1 end end local function capture_vars(level) local vars = {} local func = debug.getinfo(level or 3, "f").func local i = 1 while true do local name, value = debug.getupvalue(func, i) if not name then break end if string.sub(name, 1, 1) ~= '(' then vars[name] = value end i = i + 1 end i = 1 while true do local name, value = debug.getlocal(level or 3, i) if not name then break end if string.sub(name, 1, 1) ~= '(' then vars[name] = value end i = i + 1 end -- returned 'vars' table plays a dual role: (1) it captures local values -- and upvalues to be restored later (in case they are modified in "eval"), -- and (2) it provides an environment for evaluated chunks. -- getfenv(func) is needed to provide proper environment for functions, -- including access to globals, but this causes vars[name] to fail in -- restore_vars on local variables or upvalues with `nil` values when -- 'strict' is in effect. To avoid this `rawget` is used in restore_vars. setmetatable(vars, { __index = getfenv(func), __newindex = getfenv(func) }) return vars end local function stack_depth(start_depth) for i = start_depth, 0, -1 do if debug.getinfo(i, "l") then return i+1 end end return start_depth end local function is_safe(stack_level) -- the stack grows up: 0 is getinfo, 1 is is_safe, 2 is debug_hook, 3 is user function if stack_level == 3 then return true end for i = 3, stack_level do -- return if it is not safe to abort local info = debug.getinfo(i, "S") if not info then return true end if info.what == "C" then return false end end return true end local function in_debugger() local this = debug.getinfo(1, "S").source -- only need to check few frames as mobdebug frames should be close for i = 3, 7 do local info = debug.getinfo(i, "S") if not info then return false end if info.source == this then return true end end return false end local function is_pending(peer) -- if there is something already in the buffer, skip check if not buf and checkcount >= mobdebug.checkcount then peer:settimeout(0) -- non-blocking buf = peer:receive(1) peer:settimeout() -- back to blocking checkcount = 0 end return buf end local function readnext(peer, num) peer:settimeout(0) -- non-blocking local res, err, partial = peer:receive(num) peer:settimeout() -- back to blocking return res or partial or '', err end local function handle_breakpoint(peer) -- check if the buffer has the beginning of SETB/DELB command; -- this is to avoid reading the entire line for commands that -- don't need to be handled here. if not buf or not (buf:sub(1,1) == 'S' or buf:sub(1,1) == 'D') then return end -- check second character to avoid reading STEP or other S* and D* commands if #buf == 1 then buf = buf .. readnext(peer, 1) end if buf:sub(2,2) ~= 'E' then return end -- need to read few more characters buf = buf .. readnext(peer, 5-#buf) if buf ~= 'SETB ' and buf ~= 'DELB ' then return end local res, _, partial = peer:receive() -- get the rest of the line; blocking if not res then if partial then buf = buf .. partial end return end local _, _, cmd, file, line = (buf..res):find("^([A-Z]+)%s+(.-)%s+(%d+)%s*$") if cmd == 'SETB' then set_breakpoint(file, tonumber(line)) elseif cmd == 'DELB' then remove_breakpoint(file, tonumber(line)) else -- this looks like a breakpoint command, but something went wrong; -- return here to let the "normal" processing to handle, -- although this is likely to not go well. return end buf = nil end local function debug_hook(event, line) -- (1) LuaJIT needs special treatment. Because debug_hook is set for -- *all* coroutines, and not just the one being debugged as in regular Lua -- (http://lua-users.org/lists/lua-l/2011-06/msg00513.html), -- need to avoid debugging mobdebug's own code as LuaJIT doesn't -- always correctly generate call/return hook events (there are more -- calls than returns, which breaks stack depth calculation and -- 'step' and 'step over' commands stop working; possibly because -- 'tail return' events are not generated by LuaJIT). -- the next line checks if the debugger is run under LuaJIT and if -- one of debugger methods is present in the stack, it simply returns. if jit then -- when luajit is compiled with LUAJIT_ENABLE_LUA52COMPAT, -- coroutine.running() returns non-nil for the main thread. local coro, main = coroutine.running() if not coro or main then coro = 'main' end local disabled = coroutines[coro] == false or coroutines[coro] == nil and coro ~= (coro_debugee or 'main') if coro_debugee and disabled or not coro_debugee and (disabled or in_debugger()) then return end end -- (2) check if abort has been requested and it's safe to abort if abort and is_safe(stack_level) then error(abort) end -- (3) also check if this debug hook has not been visited for any reason. -- this check is needed to avoid stepping in too early -- (for example, when coroutine.resume() is executed inside start()). if not seen_hook and in_debugger() then return end if event == "call" then stack_level = stack_level + 1 elseif event == "return" or event == "tail return" then stack_level = stack_level - 1 elseif event == "line" then if mobdebug.linemap then local ok, mappedline = pcall(mobdebug.linemap, line, debug.getinfo(2, "S").source) if ok then line = mappedline end if not line then return end end -- may need to fall through because of the followaing: -- (1) step_into -- (2) step_over and stack_level <= step_level (need stack_level) -- (3) breakpoint; check for line first as it's known; then for file -- (4) socket call (only do every Xth check) -- (5) at least one watch is registered if not ( step_into or step_over or breakpoints[line] or watchescnt > 0 or is_pending(server) ) then checkcount = checkcount + 1; return end checkcount = mobdebug.checkcount -- force check on the next command -- this is needed to check if the stack got shorter or longer. -- unfortunately counting call/return calls is not reliable. -- the discrepancy may happen when "pcall(load, '')" call is made -- or when "error()" is called in a function. -- in either case there are more "call" than "return" events reported. -- this validation is done for every "line" event, but should be "cheap" -- as it checks for the stack to get shorter (or longer by one call). -- start from one level higher just in case we need to grow the stack. -- this may happen after coroutine.resume call to a function that doesn't -- have any other instructions to execute. it triggers three returns: -- "return, tail return, return", which needs to be accounted for. stack_level = stack_depth(stack_level+1) local caller = debug.getinfo(2, "S") -- grab the filename and fix it if needed local file = lastfile if (lastsource ~= caller.source) then file, lastsource = caller.source, caller.source -- technically, users can supply names that may not use '@', -- for example when they call loadstring('...', 'filename.lua'). -- Unfortunately, there is no reliable/quick way to figure out -- what is the filename and what is the source code. -- The following will work if the supplied filename uses Unix path. if find(file, "^@") then file = gsub(gsub(file, "^@", ""), "\\", "/") -- need this conversion to be applied to relative and absolute -- file names as you may write "require 'Foo'" to -- load "foo.lua" (on a case insensitive file system) and breakpoints -- set on foo.lua will not work if not converted to the same case. if iscasepreserving then file = string.lower(file) end if find(file, "%./") == 1 then file = sub(file, 3) else file = gsub(file, "^"..q(basedir), "") end -- some file systems allow newlines in file names; remove these. file = gsub(file, "\n", ' ') else -- this is either a file name coming from loadstring("chunk", "file"), -- or the actual source code that needs to be serialized (as it may -- include newlines); assume it's a file name if it's all on one line. if find(file, "[\r\n]") then file = mobdebug.line(file) else if iscasepreserving then file = string.lower(file) end file = gsub(gsub(file, "\\", "/"), find(file, "^%./") and "^%./" or "^"..q(basedir), "") end end -- set to true if we got here; this only needs to be done once per -- session, so do it here to at least avoid setting it for every line. seen_hook = true lastfile = file end if is_pending(server) then handle_breakpoint(server) end local vars, status, res if (watchescnt > 0) then vars = capture_vars() for index, value in pairs(watches) do setfenv(value, vars) local ok, fired = pcall(value) if ok and fired then status, res = cororesume(coro_debugger, events.WATCH, vars, file, line, index) break -- any one watch is enough; don't check multiple times end end end -- need to get into the "regular" debug handler, but only if there was -- no watch that was fired. If there was a watch, handle its result. local getin = (status == nil) and (step_into -- when coroutine.running() return `nil` (main thread in Lua 5.1), -- step_over will equal 'main', so need to check for that explicitly. or (step_over and step_over == (coroutine.running() or 'main') and stack_level <= step_level) or has_breakpoint(file, line) or is_pending(server)) if getin then vars = vars or capture_vars() step_into = false step_over = false curstack = stack() status, res = cororesume(coro_debugger, events.BREAK, vars, file, line) end -- handle 'stack' command that provides stack() information to the debugger if status and res == 'stack' then while status and res == 'stack' do -- resume with the stack trace and variables if vars then restore_vars(vars) end -- restore vars so they are reflected in stack values -- this may fail if __tostring method fails at run-time local ok, snapshot = pcall(stack, ngx and 5 or 4) status, res = cororesume(coro_debugger, ok and events.STACK or events.BREAK, snapshot, file, line) end end -- need to recheck once more as resume after 'stack' command may -- return something else (for example, 'exit'), which needs to be handled if status and res and res ~= 'stack' then if not abort and res == "exit" then mobdebug.onexit(1, true); return end if not abort and res == "done" then mobdebug.done(); return end abort = res -- only abort if safe; if not, there is another (earlier) check inside -- debug_hook, which will abort execution at the first safe opportunity if is_safe(stack_level) then error(abort) end elseif not status and res then error(res, 2) -- report any other (internal) errors back to the application end if vars then restore_vars(vars) end -- last command requested Step Over/Out; store the current thread if step_over == true then step_over = coroutine.running() or 'main' end end end local function stringify_results(status, ...) if not status then return status, ... end -- on error report as it local t = {...} -- for i,v in pairs(t) do -- stringify each of the returned values -- local ok, res = pcall(mobdebug.line, v, {nocode = true, comment = 1}) -- t[i] = ok and { type(res),res } or ("%q"):format(res):gsub("\010","n"):gsub("\026","\\026") -- end -- stringify table with all returned values -- this is done to allow each returned value to be used (serialized or not) -- intependently and to preserve "original" comments return pcall(mobdebug.dump, t, {sparse = false, nocode = true}) end local function isrunning() return coro_debugger and (corostatus(coro_debugger) == 'suspended' or corostatus(coro_debugger) == 'running') end -- this is a function that removes all hooks and closes the socket to -- report back to the controller that the debugging is done. -- the script that called `done` can still continue. local function done() if not (isrunning() and server) then return end if not jit then for co, debugged in pairs(coroutines) do if debugged then debug.sethook(co) end end end debug.sethook() server:close() coro_debugger = nil -- to make sure isrunning() returns `false` seen_hook = nil -- to make sure that the next start() call works abort = nil -- to make sure that callback calls use proper "abort" value end local function debugger_loop(sev, svars, sfile, sline) local command local app, osname local eval_env = svars or {} local function emptyWatch () return false end local loaded = {} for k in pairs(package.loaded) do loaded[k] = true end while true do local line, err local wx = rawget(genv, "wx") -- use rawread to make strict.lua happy if (wx or mobdebug.yield) and server.settimeout then server:settimeout(mobdebug.yieldtimeout) end while true do line, err = server:receive() if not line and err == "timeout" then -- yield for wx GUI applications if possible to avoid "busyness" app = app or (wx and wx.wxGetApp and wx.wxGetApp()) if app then local win = app:GetTopWindow() local inloop = app:IsMainLoopRunning() osname = osname or wx.wxPlatformInfo.Get():GetOperatingSystemFamilyName() if win and not inloop then -- process messages in a regular way -- and exit as soon as the event loop is idle if osname == 'Unix' then wx.wxTimer(app):Start(10, true) end local exitLoop = function() win:Disconnect(wx.wxID_ANY, wx.wxID_ANY, wx.wxEVT_IDLE) win:Disconnect(wx.wxID_ANY, wx.wxID_ANY, wx.wxEVT_TIMER) app:ExitMainLoop() end win:Connect(wx.wxEVT_IDLE, exitLoop) win:Connect(wx.wxEVT_TIMER, exitLoop) app:MainLoop() end elseif mobdebug.yield then mobdebug.yield() end elseif not line and err == "closed" then error("Debugger connection closed", 0) else -- if there is something in the pending buffer, prepend it to the line if buf then line = buf .. line; buf = nil end break end end if server.settimeout then server:settimeout() end -- back to blocking command = string.sub(line, string.find(line, "^[A-Z]+")) if command == "SETB" then local _, _, _, file, line = string.find(line, "^([A-Z]+)%s+(.-)%s+(%d+)%s*$") if file and line then set_breakpoint(removebasedir(file, basedir), tonumber(line)) server:send("200 OK\n") else server:send("400 Bad Request\n") end elseif command == "DELB" then local _, _, _, file, line = string.find(line, "^([A-Z]+)%s+(.-)%s+(%d+)%s*$") if file and line then remove_breakpoint(removebasedir(file, basedir), tonumber(line)) server:send("200 OK\n") else server:send("400 Bad Request\n") end elseif command == "EXEC" then local _, _, chunk = string.find(line, "^[A-Z]+%s+(.+)$") if chunk then local func, res = mobdebug.loadstring(chunk) local status if func then setfenv(func, eval_env) status, res = stringify_results(pcall(func)) end if status then server:send("200 OK " .. tostring(#res) .. "\n") server:send(res) else -- fix error if not set (for example, when loadstring is not present) if not res then res = "Unknown error" end server:send("401 Error in Expression " .. tostring(#res) .. "\n") server:send(res) end else server:send("400 Bad Request\n") end elseif command == "LOAD" then local _, _, size, name = string.find(line, "^[A-Z]+%s+(%d+)%s+(%S.-)%s*$") size = tonumber(size) if abort == nil then -- no LOAD/RELOAD allowed inside start() if size > 0 then server:receive(size) end if sfile and sline then server:send("201 Started " .. sfile .. " " .. tostring(sline) .. "\n") else server:send("200 OK 0\n") end else -- reset environment to allow required modules to load again -- remove those packages that weren't loaded when debugger started for k in pairs(package.loaded) do if not loaded[k] then package.loaded[k] = nil end end if size == 0 and name == '-' then -- RELOAD the current script being debugged server:send("200 OK 0\n") coroyield("load") else -- receiving 0 bytes blocks (at least in luasocket 2.0.2), so skip reading local chunk = size == 0 and "" or server:receive(size) if chunk then -- LOAD a new script for debugging local func, res = mobdebug.loadstring(chunk, "@"..name) if func then server:send("200 OK 0\n") debugee = func coroyield("load") else server:send("401 Error in Expression " .. tostring(#res) .. "\n") server:send(res) end else server:send("400 Bad Request\n") end end end elseif command == "SETW" then local _, _, exp = string.find(line, "^[A-Z]+%s+(.+)%s*$") if exp then local func, res = mobdebug.loadstring("return(" .. exp .. ")") if func then watchescnt = watchescnt + 1 local newidx = #watches + 1 watches[newidx] = func server:send("200 OK " .. tostring(newidx) .. "\n") else server:send("401 Error in Expression " .. tostring(#res) .. "\n") server:send(res) end else server:send("400 Bad Request\n") end elseif command == "DELW" then local _, _, index = string.find(line, "^[A-Z]+%s+(%d+)%s*$") index = tonumber(index) if index > 0 and index <= #watches then watchescnt = watchescnt - (watches[index] ~= emptyWatch and 1 or 0) watches[index] = emptyWatch server:send("200 OK\n") else server:send("400 Bad Request\n") end elseif command == "RUN" then server:send("200 OK\n") local ev, vars, file, line, idx_watch = coroyield() eval_env = vars if ev == events.BREAK then server:send("202 Paused " .. addbasedir(file, basedir) .. " " .. tostring(line) .. "\n" .. stack_message() .. "\n") elseif ev == events.WATCH then server:send("203 Paused " .. addbasedir(file, basedir) .. " " .. tostring(line) .. " " .. tostring(idx_watch) .. "\n" .. stack_message() .. "\n") elseif ev == events.RESTART then -- nothing to do else server:send("401 Error in Execution " .. tostring(#file) .. "\n") server:send(file) end elseif command == "STEP" then server:send("200 OK\n") step_into = true local ev, vars, file, line, idx_watch = coroyield() eval_env = vars if ev == events.BREAK then server:send("202 Paused " .. addbasedir(file, basedir) .. " " .. tostring(line) .. "\n" .. stack_message() .. "\n") elseif ev == events.WATCH then server:send("203 Paused " .. addbasedir(file, basedir) .. " " .. tostring(line) .. " " .. tostring(idx_watch) .. "\n" .. stack_message() .. "\n") elseif ev == events.RESTART then -- nothing to do else server:send("401 Error in Execution " .. tostring(#file) .. "\n") server:send(file) end elseif command == "OVER" or command == "OUT" then server:send("200 OK\n") step_over = true -- OVER and OUT are very similar except for -- the stack level value at which to stop if command == "OUT" then step_level = stack_level - 1 else step_level = stack_level end local ev, vars, file, line, idx_watch = coroyield() eval_env = vars if ev == events.BREAK then server:send("202 Paused " .. addbasedir(file, basedir) .. " " .. tostring(line) .. "\n" .. stack_message() .. "\n") elseif ev == events.WATCH then server:send("203 Paused " .. addbasedir(file, basedir) .. " " .. tostring(line) .. " " .. tostring(idx_watch) .. "\n" .. stack_message() .. "\n") elseif ev == events.RESTART then -- nothing to do else server:send("401 Error in Execution " .. tostring(#file) .. "\n") server:send(file) end elseif command == "BASEDIR" then local _, _, dir = string.find(line, "^[A-Z]+%s+(.+)%s*$") if dir then basedir = iscasepreserving and string.lower(dir) or dir -- reset cached source as it may change with basedir lastsource = nil server:send("200 OK\n") else server:send("400 Bad Request\n") end elseif command == "SUSPEND" then -- do nothing; it already fulfilled its role elseif command == "DONE" then coroyield("done") return -- done with all the debugging elseif command == "STACK" then -- first check if we can execute the stack command -- as it requires yielding back to debug_hook it cannot be executed -- if we have not seen the hook yet as happens after start(). -- in this case we simply return an empty result local vars, ev = {}, nil if seen_hook then ev, vars = coroyield("stack") end if ev and ev ~= events.STACK then server:send("401 Error in Execution " .. tostring(#vars) .. "\n") server:send(vars) else local ok, res = pcall(mobdebug.dump, vars, {nocode = true, sparse = false}) if ok then server:send("200 OK " .. tostring(res) .. "\n") else server:send("401 Error in Execution " .. tostring(#res) .. "\n") server:send(res) end end elseif command == "OUTPUT" then local _, _, stream, mode = string.find(line, "^[A-Z]+%s+(%w+)%s+([dcr])%s*$") if stream and mode and stream == "stdout" then -- assign "print" in the global environment local default = mode == 'd' genv.print = default and iobase.print or corowrap(function() -- wrapping into coroutine.wrap protects this function from -- being stepped through in the debugger. -- don't use vararg (...) as it adds a reference for its values, -- which may affect how they are garbage collected while true do local tbl = {coroutine.yield()} if mode == 'c' then iobase.print(unpack(tbl)) end for n = 1, #tbl do tbl[n] = select(2, pcall(mobdebug.line, tbl[n], {nocode = true, comment = false})) end local file = table.concat(tbl, "\t").."\n" server:send("204 Output " .. stream .. " " .. tostring(#file) .. "\n" .. file) end end) if not default then genv.print() end -- "fake" print to start printing loop server:send("200 OK\n") else server:send("400 Bad Request\n") end elseif command == "EXIT" then server:send("200 OK\n") coroyield("exit") else server:send("400 Bad Request\n") end end end local function connect(controller_host, controller_port) local sock, err = socket.tcp() if not sock then return nil, err end if sock.settimeout then sock:settimeout(mobdebug.connecttimeout) end local res, err = sock:connect(controller_host, tostring(controller_port)) if sock.settimeout then sock:settimeout() end if not res then return nil, err end return sock end local lasthost, lastport -- Starts a debug session by connecting to a controller local function start(controller_host, controller_port) -- only one debugging session can be run (as there is only one debug hook) if isrunning() then return end lasthost = controller_host or lasthost lastport = controller_port or lastport controller_host = lasthost or "localhost" controller_port = lastport or mobdebug.port local err server, err = mobdebug.connect(controller_host, controller_port) if server then -- correct stack depth which already has some calls on it -- so it doesn't go into negative when those calls return -- as this breaks subsequence checks in stack_depth(). -- start from 16th frame, which is sufficiently large for this check. stack_level = stack_depth(16) -- provide our own traceback function to report the error remotely do local dtraceback = debug.traceback debug.traceback = function (...) if select('#', ...) >= 1 then local err, lvl = ... if err and type(err) ~= 'thread' then local trace = dtraceback(err, (lvl or 2)+1) if genv.print == iobase.print then -- no remote redirect return trace else genv.print(trace) -- report the error remotely return -- don't report locally to avoid double reporting end end end -- direct call to debug.traceback: return the original. -- debug.traceback(nil, level) doesn't work in Lua 5.1 -- (http://lua-users.org/lists/lua-l/2011-06/msg00574.html), so -- simply remove first frame from the stack trace return (dtraceback(...):gsub("(stack traceback:\n)[^\n]*\n", "%1")) end end coro_debugger = corocreate(debugger_loop) debug.sethook(debug_hook, "lcr") seen_hook = nil -- reset in case the last start() call was refused step_into = nil -- start with step command cororesume(coro_debugger) return true else print(("Could not connect to %s:%s: %s") :format(controller_host, controller_port, err or "unknown error")) end end local function controller(controller_host, controller_port, scratchpad) -- only one debugging session can be run (as there is only one debug hook) if isrunning() then return end lasthost = controller_host or lasthost lastport = controller_port or lastport controller_host = lasthost or "localhost" controller_port = lastport or mobdebug.port local exitonerror = not scratchpad local err server, err = mobdebug.connect(controller_host, controller_port) if server then local function report(trace, err) local msg = err .. "\n" .. trace server:send("401 Error in Execution " .. tostring(#msg) .. "\n") server:send(msg) return err end seen_hook = true -- allow to accept all commands coro_debugger = corocreate(debugger_loop) while true do step_into = true -- start with step command abort = false -- reset abort flag from the previous loop if scratchpad then checkcount = mobdebug.checkcount end -- force suspend right away coro_debugee = corocreate(debugee) debug.sethook(coro_debugee, debug_hook, "lcr") local status, err = cororesume(coro_debugee) -- was there an error or is the script done? -- 'abort' state is allowed here; ignore it if abort then if tostring(abort) == 'exit' then break end else if status then -- normal execution is done break elseif err and not string.find(tostring(err), deferror) then -- report the error back -- err is not necessarily a string, so convert to string to report report(debug.traceback(coro_debugee), tostring(err)) if exitonerror then break end -- check if the debugging is done (coro_debugger is nil) if not coro_debugger then break end -- resume once more to clear the response the debugger wants to send -- need to use capture_vars(2) as three would be the level of -- the caller for controller(), but because of the tail call, -- the caller may not exist; -- This is not entirely safe as the user may see the local -- variable from console, but they will be reset anyway. -- This functionality is used when scratchpad is paused to -- gain access to remote console to modify global variables. local status, err = cororesume(coro_debugger, events.RESTART, capture_vars(2)) if not status or status and err == "exit" then break end end end end else print(("Could not connect to %s:%s: %s") :format(controller_host, controller_port, err or "unknown error")) return false end return true end local function scratchpad(controller_host, controller_port) return controller(controller_host, controller_port, true) end local function loop(controller_host, controller_port) return controller(controller_host, controller_port, false) end local function on() if not (isrunning() and server) then return end -- main is set to true under Lua5.2 for the "main" chunk. -- Lua5.1 returns co as `nil` in that case. local co, main = coroutine.running() if main then co = nil end if co then coroutines[co] = true debug.sethook(co, debug_hook, "lcr") else if jit then coroutines.main = true end debug.sethook(debug_hook, "lcr") end end local function off() if not (isrunning() and server) then return end -- main is set to true under Lua5.2 for the "main" chunk. -- Lua5.1 returns co as `nil` in that case. local co, main = coroutine.running() if main then co = nil end -- don't remove coroutine hook under LuaJIT as there is only one (global) hook if co then coroutines[co] = false if not jit then debug.sethook(co) end else if jit then coroutines.main = false end if not jit then debug.sethook() end end -- check if there is any thread that is still being debugged under LuaJIT; -- if not, turn the debugging off if jit then local remove = true for _, debugged in pairs(coroutines) do if debugged then remove = false; break end end if remove then debug.sethook() end end end -- Handles server debugging commands local function handle(params, client, options) local _, _, command = string.find(params, "^([a-z]+)") local file, line, watch_idx if command == "run" or command == "step" or command == "out" or command == "over" or command == "exit" then client:send(string.upper(command) .. "\n") client:receive() -- this should consume the first '200 OK' response while true do local done = true local breakpoint = client:receive() if not breakpoint then print("Program finished") return end local _, _, status = string.find(breakpoint, "^(%d+)") if status == "200" then -- don't need to do anything elseif status == "202" then _, _, file, line = string.find(breakpoint, "^202 Paused%s+(.-)%s+(%d+)%s*$") if file and line then print("Paused at file " .. file .. " line " .. line) end elseif status == "203" then _, _, file, line, watch_idx = string.find(breakpoint, "^203 Paused%s+(.-)%s+(%d+)%s+(%d+)%s*$") if file and line and watch_idx then print("Paused at file " .. file .. " line " .. line .. " (watch expression " .. watch_idx .. ": [" .. watches[watch_idx] .. "])") end elseif status == "204" then local _, _, stream, size = string.find(breakpoint, "^204 Output (%w+) (%d+)$") if stream and size then local msg = client:receive(tonumber(size)) print(msg) if outputs[stream] then outputs[stream](msg) end -- this was just the output, so go back reading the response done = false end elseif status == "401" then local _, _, size = string.find(breakpoint, "^401 Error in Execution (%d+)$") if size then local msg = client:receive(tonumber(size)) print("Error in remote application: " .. msg) return nil, nil, msg end else print("Unknown error") return nil, nil, "Debugger error: unexpected response '" .. breakpoint .. "'" end if done then break end end elseif command == "done" then client:send(string.upper(command) .. "\n") -- no response is expected elseif command == "setb" or command == "asetb" then _, _, _, file, line = string.find(params, "^([a-z]+)%s+(.-)%s+(%d+)%s*$") if file and line then -- if this is a file name, and not a file source if not file:find('^".*"$') then file = string.gsub(file, "\\", "/") -- convert slash file = removebasedir(file, basedir) end client:send("SETB " .. file .. " " .. line .. "\n") if command == "asetb" or client:receive() == "200 OK" then set_breakpoint(file, line) else print("Error: breakpoint not inserted") end else print("Invalid command") end elseif command == "setw" then local _, _, exp = string.find(params, "^[a-z]+%s+(.+)$") if exp then client:send("SETW " .. exp .. "\n") local answer = client:receive() local _, _, watch_idx = string.find(answer, "^200 OK (%d+)%s*$") if watch_idx then watches[watch_idx] = exp print("Inserted watch exp no. " .. watch_idx) else local _, _, size = string.find(answer, "^401 Error in Expression (%d+)$") if size then local err = client:receive(tonumber(size)):gsub(".-:%d+:%s*","") print("Error: watch expression not set: " .. err) else print("Error: watch expression not set") end end else print("Invalid command") end elseif command == "delb" or command == "adelb" then _, _, _, file, line = string.find(params, "^([a-z]+)%s+(.-)%s+(%d+)%s*$") if file and line then -- if this is a file name, and not a file source if not file:find('^".*"$') then file = string.gsub(file, "\\", "/") -- convert slash file = removebasedir(file, basedir) end client:send("DELB " .. file .. " " .. line .. "\n") if command == "adelb" or client:receive() == "200 OK" then remove_breakpoint(file, line) else print("Error: breakpoint not removed") end else print("Invalid command") end elseif command == "delallb" then local file, line = "*", 0 client:send("DELB " .. file .. " " .. tostring(line) .. "\n") if client:receive() == "200 OK" then remove_breakpoint(file, line) else print("Error: all breakpoints not removed") end elseif command == "delw" then local _, _, index = string.find(params, "^[a-z]+%s+(%d+)%s*$") if index then client:send("DELW " .. index .. "\n") if client:receive() == "200 OK" then watches[index] = nil else print("Error: watch expression not removed") end else print("Invalid command") end elseif command == "delallw" then for index, exp in pairs(watches) do client:send("DELW " .. index .. "\n") if client:receive() == "200 OK" then watches[index] = nil else print("Error: watch expression at index " .. index .. " [" .. exp .. "] not removed") end end elseif command == "eval" or command == "exec" or command == "load" or command == "loadstring" or command == "reload" then local _, _, exp = string.find(params, "^[a-z]+%s+(.+)$") if exp or (command == "reload") then if command == "eval" or command == "exec" then exp = (exp:gsub("%-%-%[(=*)%[.-%]%1%]", "") -- remove comments :gsub("%-%-.-\n", " ") -- remove line comments :gsub("\n", " ")) -- convert new lines if command == "eval" then exp = "return " .. exp end client:send("EXEC " .. exp .. "\n") elseif command == "reload" then client:send("LOAD 0 -\n") elseif command == "loadstring" then local _, _, _, file, lines = string.find(exp, "^([\"'])(.-)%1%s+(.+)") if not file then _, _, file, lines = string.find(exp, "^(%S+)%s+(.+)") end client:send("LOAD " .. tostring(#lines) .. " " .. file .. "\n") client:send(lines) else local file = io.open(exp, "r") if not file and pcall(require, "winapi") then -- if file is not open and winapi is there, try with a short path; -- this may be needed for unicode paths on windows winapi.set_encoding(winapi.CP_UTF8) local shortp = winapi.short_path(exp) file = shortp and io.open(shortp, "r") end if not file then return nil, nil, "Cannot open file " .. exp end -- read the file and remove the shebang line as it causes a compilation error local lines = file:read("*all"):gsub("^#!.-\n", "\n") file:close() local file = string.gsub(exp, "\\", "/") -- convert slash file = removebasedir(file, basedir) client:send("LOAD " .. tostring(#lines) .. " " .. file .. "\n") if #lines > 0 then client:send(lines) end end while true do local params, err = client:receive() if not params then return nil, nil, "Debugger connection " .. (err or "error") end local done = true local _, _, status, len = string.find(params, "^(%d+).-%s+(%d+)%s*$") if status == "200" then len = tonumber(len) if len > 0 then local status, res local str = client:receive(len) -- handle serialized table with results local func, err = loadstring(str) if func then status, res = pcall(func) if not status then err = res elseif type(res) ~= "table" then err = "received "..type(res).." instead of expected 'table'" end end if err then print("Error in processing results: " .. err) return nil, nil, "Error in processing results: " .. err end print(unpack(res)) return res[1], res end elseif status == "201" then _, _, file, line = string.find(params, "^201 Started%s+(.-)%s+(%d+)%s*$") elseif status == "202" or params == "200 OK" then -- do nothing; this only happens when RE/LOAD command gets the response -- that was for the original command that was aborted elseif status == "204" then local _, _, stream, size = string.find(params, "^204 Output (%w+) (%d+)$") if stream and size then local msg = client:receive(tonumber(size)) print(msg) if outputs[stream] then outputs[stream](msg) end -- this was just the output, so go back reading the response done = false end elseif status == "401" then len = tonumber(len) local res = client:receive(len) print("Error in expression: " .. res) return nil, nil, res else print("Unknown error") return nil, nil, "Debugger error: unexpected response after EXEC/LOAD '" .. params .. "'" end if done then break end end else print("Invalid command") end elseif command == "listb" then for l, v in pairs(breakpoints) do for f in pairs(v) do print(f .. ": " .. l) end end elseif command == "listw" then for i, v in pairs(watches) do print("Watch exp. " .. i .. ": " .. v) end elseif command == "suspend" then client:send("SUSPEND\n") elseif command == "stack" then client:send("STACK\n") local resp = client:receive() local _, _, status, res = string.find(resp, "^(%d+)%s+%w+%s+(.+)%s*$") if status == "200" then local func, err = loadstring(res) if func == nil then print("Error in stack information: " .. err) return nil, nil, err end local ok, stack = pcall(func) if not ok then print("Error in stack information: " .. stack) return nil, nil, stack end for _,frame in ipairs(stack) do print(mobdebug.line(frame[1], {comment = false})) end return stack elseif status == "401" then local _, _, len = string.find(resp, "%s+(%d+)%s*$") len = tonumber(len) local res = len > 0 and client:receive(len) or "Invalid stack information." print("Error in expression: " .. res) return nil, nil, res else print("Unknown error") return nil, nil, "Debugger error: unexpected response after STACK" end elseif command == "output" then local _, _, stream, mode = string.find(params, "^[a-z]+%s+(%w+)%s+([dcr])%s*$") if stream and mode then client:send("OUTPUT "..stream.." "..mode.."\n") local resp = client:receive() local _, _, status = string.find(resp, "^(%d+)%s+%w+%s*$") if status == "200" then print("Stream "..stream.." redirected") outputs[stream] = type(options) == 'table' and options.handler or nil else print("Unknown error") return nil, nil, "Debugger error: can't redirect "..stream end else print("Invalid command") end elseif command == "basedir" then local _, _, dir = string.find(params, "^[a-z]+%s+(.+)$") if dir then dir = string.gsub(dir, "\\", "/") -- convert slash if not string.find(dir, "/$") then dir = dir .. "/" end local remdir = dir:match("\t(.+)") if remdir then dir = dir:gsub("/?\t.+", "/") end basedir = dir client:send("BASEDIR "..(remdir or dir).."\n") local resp, err = client:receive() if not resp then print("Unknown error: "..err) return nil, nil, "Debugger connection closed" end local _, _, status = string.find(resp, "^(%d+)%s+%w+%s*$") if status == "200" then print("New base directory is " .. basedir) else print("Unknown error") return nil, nil, "Debugger error: unexpected response after BASEDIR" end else print(basedir) end elseif command == "help" then print("setb <file> <line> -- sets a breakpoint") print("delb <file> <line> -- removes a breakpoint") print("delallb -- removes all breakpoints") print("setw <exp> -- adds a new watch expression") print("delw <index> -- removes the watch expression at index") print("delallw -- removes all watch expressions") print("run -- runs until next breakpoint") print("step -- runs until next line, stepping into function calls") print("over -- runs until next line, stepping over function calls") print("out -- runs until line after returning from current function") print("listb -- lists breakpoints") print("listw -- lists watch expressions") print("eval <exp> -- evaluates expression on the current context and returns its value") print("exec <stmt> -- executes statement on the current context") print("load <file> -- loads a local file for debugging") print("reload -- restarts the current debugging session") print("stack -- reports stack trace") print("output stdout <d|c|r> -- capture and redirect io stream (default|copy|redirect)") print("basedir [<path>] -- sets the base path of the remote application, or shows the current one") print("done -- stops the debugger and continues application execution") print("exit -- exits debugger and the application") else local _, _, spaces = string.find(params, "^(%s*)$") if spaces then return nil, nil, "Empty command" else print("Invalid command") return nil, nil, "Invalid command" end end return file, line end -- Starts debugging server local function listen(host, port) host = host or "*" port = port or mobdebug.port local socket = require "socket" print("Lua Remote Debugger") print("Run the program you wish to debug") local server = socket.bind(host, port) local client = server:accept() client:send("STEP\n") client:receive() local breakpoint = client:receive() local _, _, file, line = string.find(breakpoint, "^202 Paused%s+(.-)%s+(%d+)%s*$") if file and line then print("Paused at file " .. file ) print("Type 'help' for commands") else local _, _, size = string.find(breakpoint, "^401 Error in Execution (%d+)%s*$") if size then print("Error in remote application: ") print(client:receive(size)) end end while true do io.write("> ") local file, line, err = handle(io.read("*line"), client) if not file and not err then break end -- completed debugging end client:close() end local cocreate local function coro() if cocreate then return end -- only set once cocreate = cocreate or coroutine.create coroutine.create = function(f, ...) return cocreate(function(...) mobdebug.on() return f(...) end, ...) end end local moconew local function moai() if moconew then return end -- only set once moconew = moconew or (MOAICoroutine and MOAICoroutine.new) if not moconew then return end MOAICoroutine.new = function(...) local thread = moconew(...) -- need to support both thread.run and getmetatable(thread).run, which -- was used in earlier MOAI versions local mt = thread.run and thread or getmetatable(thread) local patched = mt.run mt.run = function(self, f, ...) return patched(self, function(...) mobdebug.on() return f(...) end, ...) end return thread end end -- make public functions available mobdebug.setbreakpoint = set_breakpoint mobdebug.removebreakpoint = remove_breakpoint mobdebug.listen = listen mobdebug.loop = loop mobdebug.scratchpad = scratchpad mobdebug.handle = handle mobdebug.connect = connect mobdebug.start = start mobdebug.on = on mobdebug.off = off mobdebug.moai = moai mobdebug.coro = coro mobdebug.done = done mobdebug.pause = function() step_into = true end mobdebug.yield = nil -- callback mobdebug.onexit = os and os.exit or done mobdebug.basedir = function(b) if b then basedir = b end return basedir end return mobdebug
apache-2.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/mobskills/Binary_Tap.lua
10
1710
--------------------------------------------------- -- Binary Tap -- Attempts to absorb two buffs from a single target, or otherwise steals HP. -- Type: Magical -- Utsusemi/Blink absorb: Ignores Shadows -- Range: Melee -- Notes: Can be any (positive) buff, including food. Will drain about 100HP if it can't take any buffs --------------------------------------------------- require("/scripts/globals/settings"); require("/scripts/globals/status"); require("/scripts/globals/monstertpmoves"); --------------------------------------------------- function OnMobSkillCheck(target,mob,skill) return 0; end; function OnMobWeaponSkill(target, mob, skill) -- try to drain buff local effectFirst = target:stealStatusEffect(); local effectSecond = target:stealStatusEffect(); local dmg = 0; if(effectFirst ~= nil) then local count = 1; -- add to myself mob:addStatusEffect(effectFirst:getType(), effectFirst:getPower(), effectFirst:getTickCount(), effectFirst:getDuration()); if(effectSecond ~= nil) then count = count + 1; -- add to myself mob:addStatusEffect(effectSecond:getType(), effectSecond:getPower(), effectSecond:getTickCount(), effectSecond:getDuration()); end -- add buff to myself skill:setMsg(MSG_EFFECT_DRAINED); return count; else -- time to drain HP. 100-200 local power = math.random(0, 101) + 100; dmg = MobFinalAdjustments(power,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_DARK,MOBPARAM_IGNORE_SHADOWS); target:delHP(dmg); mob:addHP(dmg); skill:setMsg(MSG_DRAIN_HP); return dmg; end end;
gpl-3.0
waytim/darkstar
scripts/zones/East_Ronfaure_[S]/npcs/qm5.lua
29
1559
----------------------------------- -- Area: East Ronfaure [S] -- NPC: qm5 "???" -- Involved in Quests: Steamed Rams -- @pos 380.015 -26.5 -22.525 ----------------------------------- package.loaded["scripts/zones/East_Ronfaure_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/campaign"); require("scripts/zones/East_Ronfaure_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(CRYSTAL_WAR,STEAMED_RAMS) == QUEST_ACCEPTED) then if (player:hasKeyItem(OXIDIZED_PLATE)) then player:messageSpecial(NOTHING_OUT_OF_ORDINARY); else player:startEvent(0x0003); end else player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- print("CSID:",csid); -- print("RESULT:",option); if (csid == 0x0003) then player:addKeyItem(OXIDIZED_PLATE); player:messageSpecial(KEYITEM_OBTAINED,OXIDIZED_PLATE); end end;
gpl-3.0
Shayan123456/botttttt
plugins/img_google.lua
660
3196
do local mime = require("mime") local google_config = load_from_file('data/google.lua') local cache = {} --[[ local function send_request(url) local t = {} local options = { url = url, sink = ltn12.sink.table(t), method = "GET" } local a, code, headers, status = http.request(options) return table.concat(t), code, headers, status end]]-- local function get_google_data(text) local url = "http://ajax.googleapis.com/ajax/services/search/images?" url = url.."v=1.0&rsz=5" url = url.."&q="..URL.escape(text) url = url.."&imgsz=small|medium|large" 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 res, code = http.request(url) if code ~= 200 then print("HTTP Error code:", code) return nil end local google = json:decode(res) return google end -- Returns only the useful google data to save on cache local function simple_google_table(google) local new_table = {} new_table.responseData = {} new_table.responseDetails = google.responseDetails new_table.responseStatus = google.responseStatus new_table.responseData.results = {} local results = google.responseData.results for k,result in pairs(results) do new_table.responseData.results[k] = {} new_table.responseData.results[k].unescapedUrl = result.unescapedUrl new_table.responseData.results[k].url = result.url end return new_table end local function save_to_cache(query, data) -- Saves result on cache if string.len(query) <= 7 then local text_b64 = mime.b64(query) if not cache[text_b64] then local simple_google = simple_google_table(data) cache[text_b64] = simple_google end end end local function process_google_data(google, receiver, query) if google.responseStatus == 403 then local text = 'ERROR: Reached maximum searches per day' send_msg(receiver, text, ok_cb, false) elseif google.responseStatus == 200 then local data = google.responseData if not data or not data.results or #data.results == 0 then local text = 'Image not found.' send_msg(receiver, text, ok_cb, false) return false end -- Random image from table local i = math.random(#data.results) local url = data.results[i].unescapedUrl or data.results[i].url local old_timeout = http.TIMEOUT or 10 http.TIMEOUT = 5 send_photo_from_url(receiver, url) http.TIMEOUT = old_timeout save_to_cache(query, google) else local text = 'ERROR!' send_msg(receiver, text, ok_cb, false) end end function run(msg, matches) local receiver = get_receiver(msg) local text = matches[1] local text_b64 = mime.b64(text) local cached = cache[text_b64] if cached then process_google_data(cached, receiver, text) else local data = get_google_data(text) process_google_data(data, receiver, text) end end return { description = "Search image with Google API and sends it.", usage = "!img [term]: Random search an image with Google API.", patterns = { "^!img (.*)$" }, run = run } end
gpl-2.0
behnam98/SmartRobot
plugins/img_google.lua
660
3196
do local mime = require("mime") local google_config = load_from_file('data/google.lua') local cache = {} --[[ local function send_request(url) local t = {} local options = { url = url, sink = ltn12.sink.table(t), method = "GET" } local a, code, headers, status = http.request(options) return table.concat(t), code, headers, status end]]-- local function get_google_data(text) local url = "http://ajax.googleapis.com/ajax/services/search/images?" url = url.."v=1.0&rsz=5" url = url.."&q="..URL.escape(text) url = url.."&imgsz=small|medium|large" 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 res, code = http.request(url) if code ~= 200 then print("HTTP Error code:", code) return nil end local google = json:decode(res) return google end -- Returns only the useful google data to save on cache local function simple_google_table(google) local new_table = {} new_table.responseData = {} new_table.responseDetails = google.responseDetails new_table.responseStatus = google.responseStatus new_table.responseData.results = {} local results = google.responseData.results for k,result in pairs(results) do new_table.responseData.results[k] = {} new_table.responseData.results[k].unescapedUrl = result.unescapedUrl new_table.responseData.results[k].url = result.url end return new_table end local function save_to_cache(query, data) -- Saves result on cache if string.len(query) <= 7 then local text_b64 = mime.b64(query) if not cache[text_b64] then local simple_google = simple_google_table(data) cache[text_b64] = simple_google end end end local function process_google_data(google, receiver, query) if google.responseStatus == 403 then local text = 'ERROR: Reached maximum searches per day' send_msg(receiver, text, ok_cb, false) elseif google.responseStatus == 200 then local data = google.responseData if not data or not data.results or #data.results == 0 then local text = 'Image not found.' send_msg(receiver, text, ok_cb, false) return false end -- Random image from table local i = math.random(#data.results) local url = data.results[i].unescapedUrl or data.results[i].url local old_timeout = http.TIMEOUT or 10 http.TIMEOUT = 5 send_photo_from_url(receiver, url) http.TIMEOUT = old_timeout save_to_cache(query, google) else local text = 'ERROR!' send_msg(receiver, text, ok_cb, false) end end function run(msg, matches) local receiver = get_receiver(msg) local text = matches[1] local text_b64 = mime.b64(text) local cached = cache[text_b64] if cached then process_google_data(cached, receiver, text) else local data = get_google_data(text) process_google_data(data, receiver, text) end end return { description = "Search image with Google API and sends it.", usage = "!img [term]: Random search an image with Google API.", patterns = { "^!img (.*)$" }, run = run } end
gpl-2.0
mohammad9731/s_e_c_u_r_i_t_y
plugins/img_google.lua
660
3196
do local mime = require("mime") local google_config = load_from_file('data/google.lua') local cache = {} --[[ local function send_request(url) local t = {} local options = { url = url, sink = ltn12.sink.table(t), method = "GET" } local a, code, headers, status = http.request(options) return table.concat(t), code, headers, status end]]-- local function get_google_data(text) local url = "http://ajax.googleapis.com/ajax/services/search/images?" url = url.."v=1.0&rsz=5" url = url.."&q="..URL.escape(text) url = url.."&imgsz=small|medium|large" 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 res, code = http.request(url) if code ~= 200 then print("HTTP Error code:", code) return nil end local google = json:decode(res) return google end -- Returns only the useful google data to save on cache local function simple_google_table(google) local new_table = {} new_table.responseData = {} new_table.responseDetails = google.responseDetails new_table.responseStatus = google.responseStatus new_table.responseData.results = {} local results = google.responseData.results for k,result in pairs(results) do new_table.responseData.results[k] = {} new_table.responseData.results[k].unescapedUrl = result.unescapedUrl new_table.responseData.results[k].url = result.url end return new_table end local function save_to_cache(query, data) -- Saves result on cache if string.len(query) <= 7 then local text_b64 = mime.b64(query) if not cache[text_b64] then local simple_google = simple_google_table(data) cache[text_b64] = simple_google end end end local function process_google_data(google, receiver, query) if google.responseStatus == 403 then local text = 'ERROR: Reached maximum searches per day' send_msg(receiver, text, ok_cb, false) elseif google.responseStatus == 200 then local data = google.responseData if not data or not data.results or #data.results == 0 then local text = 'Image not found.' send_msg(receiver, text, ok_cb, false) return false end -- Random image from table local i = math.random(#data.results) local url = data.results[i].unescapedUrl or data.results[i].url local old_timeout = http.TIMEOUT or 10 http.TIMEOUT = 5 send_photo_from_url(receiver, url) http.TIMEOUT = old_timeout save_to_cache(query, google) else local text = 'ERROR!' send_msg(receiver, text, ok_cb, false) end end function run(msg, matches) local receiver = get_receiver(msg) local text = matches[1] local text_b64 = mime.b64(text) local cached = cache[text_b64] if cached then process_google_data(cached, receiver, text) else local data = get_google_data(text) process_google_data(data, receiver, text) end end return { description = "Search image with Google API and sends it.", usage = "!img [term]: Random search an image with Google API.", patterns = { "^!img (.*)$" }, run = run } end
gpl-2.0
siktirmirza/uzz
plugins/img_google.lua
660
3196
do local mime = require("mime") local google_config = load_from_file('data/google.lua') local cache = {} --[[ local function send_request(url) local t = {} local options = { url = url, sink = ltn12.sink.table(t), method = "GET" } local a, code, headers, status = http.request(options) return table.concat(t), code, headers, status end]]-- local function get_google_data(text) local url = "http://ajax.googleapis.com/ajax/services/search/images?" url = url.."v=1.0&rsz=5" url = url.."&q="..URL.escape(text) url = url.."&imgsz=small|medium|large" 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 res, code = http.request(url) if code ~= 200 then print("HTTP Error code:", code) return nil end local google = json:decode(res) return google end -- Returns only the useful google data to save on cache local function simple_google_table(google) local new_table = {} new_table.responseData = {} new_table.responseDetails = google.responseDetails new_table.responseStatus = google.responseStatus new_table.responseData.results = {} local results = google.responseData.results for k,result in pairs(results) do new_table.responseData.results[k] = {} new_table.responseData.results[k].unescapedUrl = result.unescapedUrl new_table.responseData.results[k].url = result.url end return new_table end local function save_to_cache(query, data) -- Saves result on cache if string.len(query) <= 7 then local text_b64 = mime.b64(query) if not cache[text_b64] then local simple_google = simple_google_table(data) cache[text_b64] = simple_google end end end local function process_google_data(google, receiver, query) if google.responseStatus == 403 then local text = 'ERROR: Reached maximum searches per day' send_msg(receiver, text, ok_cb, false) elseif google.responseStatus == 200 then local data = google.responseData if not data or not data.results or #data.results == 0 then local text = 'Image not found.' send_msg(receiver, text, ok_cb, false) return false end -- Random image from table local i = math.random(#data.results) local url = data.results[i].unescapedUrl or data.results[i].url local old_timeout = http.TIMEOUT or 10 http.TIMEOUT = 5 send_photo_from_url(receiver, url) http.TIMEOUT = old_timeout save_to_cache(query, google) else local text = 'ERROR!' send_msg(receiver, text, ok_cb, false) end end function run(msg, matches) local receiver = get_receiver(msg) local text = matches[1] local text_b64 = mime.b64(text) local cached = cache[text_b64] if cached then process_google_data(cached, receiver, text) else local data = get_google_data(text) process_google_data(data, receiver, text) end end return { description = "Search image with Google API and sends it.", usage = "!img [term]: Random search an image with Google API.", patterns = { "^!img (.*)$" }, run = run } end
gpl-2.0
amitshaked/resmatch
src/networks/mc-models/resmatch/hybrid.lua
1
2735
local network = require 'networks/network' require 'networks/mc-models/resmatch/acrt' require('networks/criterions/Margin2') require('networks/scores/DotProduct2') require('networks/modules/Normalize2') local ResmatchHybrid, parent = torch.class('ResmatchHybrid','ResmatchAcrt') function ResmatchHybrid:__init(self, opt, dataset) parent.__init(parent, self, opt, dataset) local bce = nn.BCECriterion2() local margin = nn.Margin2() -- parallel criterion with repeated target self.criterion = nn.ParallelCriterion(true) :add(bce, 0.8) :add(margin, 0.2) :cuda() self.params.arch= {{1,2},{1,2},{1,2},{1,2},{1,2}} end function ResmatchHybrid:getDecisionNetwork() local decision = nn.Sequential() decision:add(nn.Linear(2 * self.params.fm, self.params.nh2)) decision:add(Activation(self.alpha)) for i = 1,self.params.l2 do decision:add(nn.Linear(self.params.nh2, self.params.nh2)) decision:add(Activation()) end decision:add(nn.Linear(self.params.nh2, 1)) decision:add(nn.Sigmoid()) return nn.ConcatTable() :add(nn.Sequential() :add(nn.Reshape(self.params.bs, self.params.fm *2)) :add(decision) ) :add(nn.Sequential() :add(nn.Normalize2()) :add(nn.DotProduct2()) ) end function ResmatchHybrid:computeMatchingCost(x_batch, disp_max, directions) local desc_l, desc_r = self:getDescriptors(x_batch) -- Replace with fully convolutional network with the same weights local testDecision = network.getTestNetwork(self.decision) -- Initialize the output with the largest matching cost -- at each possible disparity ('1') local output = torch.CudaTensor(#directions, disp_max, desc_l:size(3), desc_l:size(4)):fill(1) -- (0 / 0) local x2= torch.CudaTensor() collectgarbage() for _, direction in ipairs(directions) do --print("calculate score in direction " .. direction) local index = direction == -1 and 1 or 2 for d = 1,disp_max do collectgarbage() -- Get the left and right images for this disparity local l = desc_l[{{1},{},{},{d,-1}}] local r = desc_r[{{1},{},{},{1,-d}}] x2:resize(2, r:size(2), r:size(3), r:size(4)) x2[{{1}}]:copy(l) x2[{{2}}]:copy(r) -- Compute the matching score local score = testDecision:forward(x2)[1] -- Copy to the right place in the output tensor output[{index,d,{},direction == -1 and {d,-1} or {1,-d}}]:copy(score[{1,1}]) end -- Fix the borders of the obtained map network.fixBorder(output[{{index}}], direction, self.params.ws) end collectgarbage() return output end return ResmatchHybrid
bsd-2-clause
TheOnePharaoh/YGOPro-Custom-Cards
script/c80106550.lua
2
3977
--The Fourth Panticle of Wrath function c80106550.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BE_BATTLE_TARGET) e1:SetCondition(c80106550.descon) e1:SetTarget(c80106550.destg) e1:SetOperation(c80106550.desop) c:RegisterEffect(e1) --self destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_SELF_DESTROY) e2:SetCondition(c80106550.sdcon) c:RegisterEffect(e2) --pierce local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_PIERCE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetCondition(c80106550.desrepcon) e3:SetTarget(c80106550.pietg) c:RegisterEffect(e3) --spsummon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(80106550,0)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_TO_GRAVE) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e4:SetCondition(c80106550.spcon) e4:SetTarget(c80106550.sptg) e4:SetOperation(c80106550.spop) c:RegisterEffect(e4) end function c80106550.descon(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() return tc:IsControler(tp) and tc:IsFaceup() and tc:IsSetCard(0xca00) end function c80106550.desfilter(c) return c:IsAttackPos() and c:IsDestructable() end function c80106550.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c80106550.desfilter,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(c80106550.desfilter,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,g:GetCount(),0,0) end function c80106550.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c80106550.desfilter,tp,0,LOCATION_MZONE,nil) if g:GetCount()>0 then Duel.Destroy(g,REASON_EFFECT) end end function c80106550.sdfilter(c) return not c:IsFaceup() or not c:IsSetCard(0xca00) end function c80106550.sdcon(e) return Duel.IsExistingMatchingCard(c80106550.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function c80106550.cfilter(c) return c:IsType(TYPE_MONSTER) end function c80106550.desrepcon(e) local tp=e:GetHandlerPlayer() return Duel.GetFieldGroupCount(tp,LOCATION_EXTRA,0)==0 and not Duel.IsExistingMatchingCard(c80106550.cfilter,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsExistingMatchingCard(c80106550.cfilter,tp,0,LOCATION_GRAVE,1,nil) end function c80106550.pietg(e,c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0xca00) end function c80106550.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) and e:GetHandler():IsPreviousLocation(LOCATION_HAND) and not e:GetHandler():IsReason(REASON_RETURN) end function c80106550.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,80106550,0,0xca00,8,2900,1000,RACE_WARRIOR,ATTRIBUTE_DARK) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function c80106550.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.IsPlayerCanSpecialSummonMonster(tp,80106550,0,0xca00,8,2900,1000,RACE_WARRIOR,ATTRIBUTE_DARK) then c:SetStatus(STATUS_NO_LEVEL,false) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(TYPE_EFFECT+TYPE_MONSTER) e1:SetReset(RESET_EVENT+0x47c0000) c:RegisterEffect(e1,true) Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP) local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_SINGLE) e7:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e7:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e7:SetReset(RESET_EVENT+0x47e0000) e7:SetValue(LOCATION_DECKBOT) c:RegisterEffect(e7,true) end end
gpl-3.0
mehrpouya81/gamerspm
plugins/domaintools.lua
359
1494
local ltn12 = require "ltn12" local https = require "ssl.https" -- Edit data/mashape.lua with your Mashape API key -- http://docs.mashape.com/api-keys local mashape = load_from_file('data/mashape.lua', { api_key = '' }) local function check(name) local api = "https://domainsearch.p.mashape.com/index.php?" local param = "name="..name local url = api..param local api_key = mashape.api_key if api_key:isempty() then return 'Configure your Mashape API Key' end local headers = { ["X-Mashape-Key"] = api_key, ["Accept"] = "application/json" } local respbody = {} local body, code = https.request{ url = url, method = "GET", headers = headers, sink = ltn12.sink.table(respbody), protocol = "tlsv1" } if code ~= 200 then return code end local body = table.concat(respbody) local body = json:decode(body) --vardump(body) local domains = "List of domains for '"..name.."':\n" for k,v in pairs(body) do print(k) local status = " ❌ " if v == "Available" then status = " ✔ " end domains = domains..k..status.."\n" end return domains end local function run(msg, matches) if matches[1] == "check" then local name = matches[2] return check(name) end end return { description = "Domain tools", usage = {"!domain check [domain] : Check domain name availability.", }, patterns = { "^!domain (check) (.*)$", }, run = run }
gpl-2.0
wanmaple/MWFrameworkForCocosLua
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/PhysicsContactPreSolve.lua
10
1438
-------------------------------- -- @module PhysicsContactPreSolve -- @parent_module cc -------------------------------- -- get friction between two bodies -- @function [parent=#PhysicsContactPreSolve] getFriction -- @param self -- @return float#float ret (return value: float) -------------------------------- -- get restitution between two bodies -- @function [parent=#PhysicsContactPreSolve] getRestitution -- @param self -- @return float#float ret (return value: float) -------------------------------- -- set the friction -- @function [parent=#PhysicsContactPreSolve] setFriction -- @param self -- @param #float friction -------------------------------- -- ignore the rest of the contact presolve and postsolve callbacks -- @function [parent=#PhysicsContactPreSolve] ignore -- @param self -------------------------------- -- get surface velocity between two bodies -- @function [parent=#PhysicsContactPreSolve] getSurfaceVelocity -- @param self -- @return vec2_table#vec2_table ret (return value: vec2_table) -------------------------------- -- set the surface velocity -- @function [parent=#PhysicsContactPreSolve] setSurfaceVelocity -- @param self -- @param #vec2_table velocity -------------------------------- -- set the restitution -- @function [parent=#PhysicsContactPreSolve] setRestitution -- @param self -- @param #float restitution return nil
apache-2.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/weaponskills/torcleaver.lua
4
1383
----------------------------------- -- Torcleaver -- Skill Level: N/A -- Description: Deals triple damage. Damage varies with TP. Caladbolg: Aftermath. -- Available only when equipped with Caladbolg (85)/(90)/(95) or Espafut +1/+2/+3. -- Aligned with the Light Gorget, Aqua Gorget & Snow Gorget. -- Aligned with the Light Belt, Aqua Belt & Snow Belt. -- Element: None -- Skillchain Properties: Light/Distortion -- Modifiers: VIT:60% -- Damage Multipliers by TP: -- 100%TP 200%TP 300%TP -- 4.75 5.75 6.5 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function OnUseWeaponSkill(player, target, wsID) local params = {}; params.numHits = 1; params.ftp100 = 4.75; params.ftp200 = 5.75; params.ftp300 = 6.5; params.str_wsc = 0.0; params.dex_wsc = 0.0; params.vit_wsc = 0.6; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; params.crit100 = 0.00; params.crit200 = 0.00; params.crit300 = 0.00; params.canCrit = false; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, params); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
TienHP/Aquaria
files/scripts/entities/icechunksmall.lua
6
1251
-- 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 -- ================================================================================================ -- S M A L L I C E C H U N K -- ================================================================================================ dofile("scripts/entities/icechunkcommon.lua") function init(me) v.commonInit(me, 2) end function dieNormal(me) if chance(10) then spawnIngredient("IceChunk", entity_x(me), entity_y(me)) end end
gpl-2.0
waytim/darkstar
scripts/zones/Temenos/mobs/Fire_Elemental.lua
28
1740
----------------------------------- -- Area: Temenos E T -- NPC: Fire_Elemental ----------------------------------- package.loaded["scripts/zones/Temenos/TextIDs"] = nil; ----------------------------------- require("scripts/globals/limbus"); require("scripts/zones/Temenos/TextIDs"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, player, isKiller) local mobID = mob:getID(); local mobX = mob:getXPos(); local mobY = mob:getYPos(); local mobZ = mob:getZPos(); switch (mobID): caseof { [16928840] = function (x) GetNPCByID(16928768+173):setPos(mobX,mobY,mobZ); GetNPCByID(16928768+173):setStatus(STATUS_NORMAL); end , [16928841] = function (x) GetNPCByID(16928768+215):setPos(mobX,mobY,mobZ); GetNPCByID(16928768+215):setStatus(STATUS_NORMAL); end , [16928842] = function (x) GetNPCByID(16928768+284):setPos(mobX,mobY,mobZ); GetNPCByID(16928768+284):setStatus(STATUS_NORMAL); end , [16928843] = function (x) GetNPCByID(16928768+40):setPos(mobX,mobY,mobZ); GetNPCByID(16928768+40):setStatus(STATUS_NORMAL); end , [16929033] = function (x) if (IsMobDead(16929034)==false) then -- ice DespawnMob(16929034); SpawnMob(16929040); end end , } end;
gpl-3.0
waytim/darkstar
scripts/zones/Sacrarium/Zone.lua
19
3611
----------------------------------- -- -- Zone: Sacrarium (28) -- ----------------------------------- package.loaded["scripts/zones/Sacrarium/TextIDs"] = nil; ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/zones/Sacrarium/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) -- Set random variable for determining Old Prof. Mariselle's spawn location local rand = math.random((2),(7)); SetServerVariable("Old_Prof_Spawn_Location", rand); UpdateTreasureSpawnPoint(16892179); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-219.996,-18.587,82.795,64); end -- ZONE LEVEL RESTRICTION if (ENABLE_COP_ZONE_CAP == 1) then player:addStatusEffect(EFFECT_LEVEL_RESTRICTION,50,0,0); end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onGameDay ----------------------------------- function onGameDay() -- Labyrinth local day = VanadielDayElement() ; local tbl; local SacrariumWallOffset = 16892109; if (day == 3 or day == 7) then tbl = {9,9,8,8,9,9,8,9,8,8,9,8,8,8,9,8,9,8}; elseif (day == 1 or day == 5) then tbl = {9,9,8,9,8,8,8,8,9,9,9,8,9,8,8,8,8,9}; elseif (day == 0 or day == 4) then tbl = {8,9,8,9,8,9,9,8,9,9,8,8,9,8,8,8,8,9}; else tbl = {9,8,9,9,8,9,8,8,9,8,8,9,8,9,8,9,8,8}; end GetNPCByID(SacrariumWallOffset):setAnimation(tbl[1]); GetNPCByID(SacrariumWallOffset+6):setAnimation(tbl[2]); GetNPCByID(SacrariumWallOffset+12):setAnimation(tbl[3]); GetNPCByID(SacrariumWallOffset+13):setAnimation(tbl[4]); GetNPCByID(SacrariumWallOffset+1):setAnimation(tbl[5]); GetNPCByID(SacrariumWallOffset+7):setAnimation(tbl[6]); GetNPCByID(SacrariumWallOffset+14):setAnimation(tbl[7]); GetNPCByID(SacrariumWallOffset+2):setAnimation(tbl[8]); GetNPCByID(SacrariumWallOffset+8):setAnimation(tbl[9]); GetNPCByID(SacrariumWallOffset+9):setAnimation(tbl[10]); GetNPCByID(SacrariumWallOffset+3):setAnimation(tbl[11]); GetNPCByID(SacrariumWallOffset+15):setAnimation(tbl[12]); GetNPCByID(SacrariumWallOffset+16):setAnimation(tbl[13]); GetNPCByID(SacrariumWallOffset+10):setAnimation(tbl[14]); GetNPCByID(SacrariumWallOffset+4):setAnimation(tbl[15]); GetNPCByID(SacrariumWallOffset+17):setAnimation(tbl[16]); GetNPCByID(SacrariumWallOffset+11):setAnimation(tbl[17]); GetNPCByID(SacrariumWallOffset+5):setAnimation(tbl[18]); 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
waytim/darkstar
scripts/zones/Lower_Delkfutts_Tower/npcs/Grounds_Tome.lua
30
1107
----------------------------------- -- Area: Lower Delkfutt's Tower -- NPC: Grounds Tome ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/groundsofvalor"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) startGov(GOV_EVENT_LOWER_DELKFUTTS_TOWER,player); end; ----------------------------------- -- onEventSelection ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); updateGov(player,csid,option,777,778,779,780,781,0,0,0,0,0); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); finishGov(player,csid,option,777,778,779,780,781,0,0,0,0,0,GOV_MSG_LOWER_DELKFUTTS_TOWER); end;
gpl-3.0
steven-jackson/PersonalLoot
libs/AceComm-3.0/AceComm-3.0.lua
10
11192
--- **AceComm-3.0** allows you to send messages of unlimited length over the addon comm channels. -- It'll automatically split the messages into multiple parts and rebuild them on the receiving end.\\ -- **ChatThrottleLib** is of course being used to avoid being disconnected by the server. -- -- **AceComm-3.0** can be embeded into your addon, either explicitly by calling AceComm:Embed(MyAddon) or by -- specifying it as an embeded library in your AceAddon. All functions will be available on your addon object -- and can be accessed directly, without having to explicitly call AceComm itself.\\ -- It is recommended to embed AceComm, otherwise you'll have to specify a custom `self` on all calls you -- make into AceComm. -- @class file -- @name AceComm-3.0 -- @release $Id: AceComm-3.0.lua 1107 2014-02-19 16:40:32Z nevcairiel $ --[[ AceComm-3.0 TODO: Time out old data rotting around from dead senders? Not a HUGE deal since the number of possible sender names is somewhat limited. ]] local MAJOR, MINOR = "AceComm-3.0", 9 local AceComm,oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not AceComm then return end local CallbackHandler = LibStub:GetLibrary("CallbackHandler-1.0") local CTL = assert(ChatThrottleLib, "AceComm-3.0 requires ChatThrottleLib") -- Lua APIs local type, next, pairs, tostring = type, next, pairs, tostring local strsub, strfind = string.sub, string.find local match = string.match local tinsert, tconcat = table.insert, table.concat local error, assert = error, assert -- WoW APIs local Ambiguate = Ambiguate -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- List them here for Mikk's FindGlobals script -- GLOBALS: LibStub, DEFAULT_CHAT_FRAME, geterrorhandler, RegisterAddonMessagePrefix AceComm.embeds = AceComm.embeds or {} -- for my sanity and yours, let's give the message type bytes some names local MSG_MULTI_FIRST = "\001" local MSG_MULTI_NEXT = "\002" local MSG_MULTI_LAST = "\003" local MSG_ESCAPE = "\004" -- remove old structures (pre WoW 4.0) AceComm.multipart_origprefixes = nil AceComm.multipart_reassemblers = nil -- the multipart message spool: indexed by a combination of sender+distribution+ AceComm.multipart_spool = AceComm.multipart_spool or {} --- Register for Addon Traffic on a specified prefix -- @param prefix A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent), max 16 characters -- @param method Callback to call on message reception: Function reference, or method name (string) to call on self. Defaults to "OnCommReceived" function AceComm:RegisterComm(prefix, method) if method == nil then method = "OnCommReceived" end if #prefix > 16 then -- TODO: 15? error("AceComm:RegisterComm(prefix,method): prefix length is limited to 16 characters") end RegisterAddonMessagePrefix(prefix) return AceComm._RegisterComm(self, prefix, method) -- created by CallbackHandler end local warnedPrefix=false --- Send a message over the Addon Channel -- @param prefix A printable character (\032-\255) classification of the message (typically AddonName or AddonNameEvent) -- @param text Data to send, nils (\000) not allowed. Any length. -- @param distribution Addon channel, e.g. "RAID", "GUILD", etc; see SendAddonMessage API -- @param target Destination for some distributions; see SendAddonMessage API -- @param prio OPTIONAL: ChatThrottleLib priority, "BULK", "NORMAL" or "ALERT". Defaults to "NORMAL". -- @param callbackFn OPTIONAL: callback function to be called as each chunk is sent. receives 3 args: the user supplied arg (see next), the number of bytes sent so far, and the number of bytes total to send. -- @param callbackArg: OPTIONAL: first arg to the callback function. nil will be passed if not specified. function AceComm:SendCommMessage(prefix, text, distribution, target, prio, callbackFn, callbackArg) prio = prio or "NORMAL" -- pasta's reference implementation had different prio for singlepart and multipart, but that's a very bad idea since that can easily lead to out-of-sequence delivery! if not( type(prefix)=="string" and type(text)=="string" and type(distribution)=="string" and (target==nil or type(target)=="string") and (prio=="BULK" or prio=="NORMAL" or prio=="ALERT") ) then error('Usage: SendCommMessage(addon, "prefix", "text", "distribution"[, "target"[, "prio"[, callbackFn, callbackarg]]])', 2) end local textlen = #text local maxtextlen = 255 -- Yes, the max is 255 even if the dev post said 256. I tested. Char 256+ get silently truncated. /Mikk, 20110327 local queueName = prefix..distribution..(target or "") local ctlCallback = nil if callbackFn then ctlCallback = function(sent) return callbackFn(callbackArg, sent, textlen) end end local forceMultipart if match(text, "^[\001-\009]") then -- 4.1+: see if the first character is a control character -- we need to escape the first character with a \004 if textlen+1 > maxtextlen then -- would we go over the size limit? forceMultipart = true -- just make it multipart, no escape problems then else text = "\004" .. text end end if not forceMultipart and textlen <= maxtextlen then -- fits all in one message CTL:SendAddonMessage(prio, prefix, text, distribution, target, queueName, ctlCallback, textlen) else maxtextlen = maxtextlen - 1 -- 1 extra byte for part indicator in prefix(4.0)/start of message(4.1) -- first part local chunk = strsub(text, 1, maxtextlen) CTL:SendAddonMessage(prio, prefix, MSG_MULTI_FIRST..chunk, distribution, target, queueName, ctlCallback, maxtextlen) -- continuation local pos = 1+maxtextlen while pos+maxtextlen <= textlen do chunk = strsub(text, pos, pos+maxtextlen-1) CTL:SendAddonMessage(prio, prefix, MSG_MULTI_NEXT..chunk, distribution, target, queueName, ctlCallback, pos+maxtextlen-1) pos = pos + maxtextlen end -- final part chunk = strsub(text, pos) CTL:SendAddonMessage(prio, prefix, MSG_MULTI_LAST..chunk, distribution, target, queueName, ctlCallback, textlen) end end ---------------------------------------- -- Message receiving ---------------------------------------- do local compost = setmetatable({}, {__mode = "k"}) local function new() local t = next(compost) if t then compost[t]=nil for i=#t,3,-1 do -- faster than pairs loop. don't even nil out 1/2 since they'll be overwritten t[i]=nil end return t end return {} end local function lostdatawarning(prefix,sender,where) DEFAULT_CHAT_FRAME:AddMessage(MAJOR..": Warning: lost network data regarding '"..tostring(prefix).."' from '"..tostring(sender).."' (in "..where..")") end function AceComm:OnReceiveMultipartFirst(prefix, message, distribution, sender) local key = prefix.."\t"..distribution.."\t"..sender -- a unique stream is defined by the prefix + distribution + sender local spool = AceComm.multipart_spool --[[ if spool[key] then lostdatawarning(prefix,sender,"First") -- continue and overwrite end --]] spool[key] = message -- plain string for now end function AceComm:OnReceiveMultipartNext(prefix, message, distribution, sender) local key = prefix.."\t"..distribution.."\t"..sender -- a unique stream is defined by the prefix + distribution + sender local spool = AceComm.multipart_spool local olddata = spool[key] if not olddata then --lostdatawarning(prefix,sender,"Next") return end if type(olddata)~="table" then -- ... but what we have is not a table. So make it one. (Pull a composted one if available) local t = new() t[1] = olddata -- add old data as first string t[2] = message -- and new message as second string spool[key] = t -- and put the table in the spool instead of the old string else tinsert(olddata, message) end end function AceComm:OnReceiveMultipartLast(prefix, message, distribution, sender) local key = prefix.."\t"..distribution.."\t"..sender -- a unique stream is defined by the prefix + distribution + sender local spool = AceComm.multipart_spool local olddata = spool[key] if not olddata then --lostdatawarning(prefix,sender,"End") return end spool[key] = nil if type(olddata) == "table" then -- if we've received a "next", the spooled data will be a table for rapid & garbage-free tconcat tinsert(olddata, message) AceComm.callbacks:Fire(prefix, tconcat(olddata, ""), distribution, sender) compost[olddata] = true else -- if we've only received a "first", the spooled data will still only be a string AceComm.callbacks:Fire(prefix, olddata..message, distribution, sender) end end end ---------------------------------------- -- Embed CallbackHandler ---------------------------------------- if not AceComm.callbacks then AceComm.callbacks = CallbackHandler:New(AceComm, "_RegisterComm", "UnregisterComm", "UnregisterAllComm") end AceComm.callbacks.OnUsed = nil AceComm.callbacks.OnUnused = nil local function OnEvent(self, event, prefix, message, distribution, sender) if event == "CHAT_MSG_ADDON" then sender = Ambiguate(sender, "none") local control, rest = match(message, "^([\001-\009])(.*)") if control then if control==MSG_MULTI_FIRST then AceComm:OnReceiveMultipartFirst(prefix, rest, distribution, sender) elseif control==MSG_MULTI_NEXT then AceComm:OnReceiveMultipartNext(prefix, rest, distribution, sender) elseif control==MSG_MULTI_LAST then AceComm:OnReceiveMultipartLast(prefix, rest, distribution, sender) elseif control==MSG_ESCAPE then AceComm.callbacks:Fire(prefix, rest, distribution, sender) else -- unknown control character, ignore SILENTLY (dont warn unnecessarily about future extensions!) end else -- single part: fire it off immediately and let CallbackHandler decide if it's registered or not AceComm.callbacks:Fire(prefix, message, distribution, sender) end else assert(false, "Received "..tostring(event).." event?!") end end AceComm.frame = AceComm.frame or CreateFrame("Frame", "AceComm30Frame") AceComm.frame:SetScript("OnEvent", OnEvent) AceComm.frame:UnregisterAllEvents() AceComm.frame:RegisterEvent("CHAT_MSG_ADDON") ---------------------------------------- -- Base library stuff ---------------------------------------- local mixins = { "RegisterComm", "UnregisterComm", "UnregisterAllComm", "SendCommMessage", } -- Embeds AceComm-3.0 into the target object making the functions from the mixins list available on target:.. -- @param target target object to embed AceComm-3.0 in function AceComm:Embed(target) for k, v in pairs(mixins) do target[v] = self[v] end self.embeds[target] = true return target end function AceComm:OnEmbedDisable(target) target:UnregisterAllComm() end -- Update embeds for target, v in pairs(AceComm.embeds) do AceComm:Embed(target) end
gpl-3.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Southern_San_dOria/npcs/Paunelie.lua
6
1146
----------------------------------- -- Area: Port Bastok -- NPC: Ilita -- Linkshell merchant -- @pos -142 -1 -25 236 ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/shop"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:showText(npc,PAUNELIE_SHOP_DIALOG,513); stock = { 0x0200,8000, -- Linkshell 0x3f9d,375 -- Pendant Compass } 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
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Dynamis-San_dOria/npcs/qm1.lua
2
1209
----------------------------------- -- Area: Dynamis San d'Oria -- NPC: ??? (Spawn when mega is defeated) ----------------------------------- package.loaded["scripts/zones/Dynamis-San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/zones/Dynamis-San_dOria/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) if(player:hasKeyItem(HYDRA_CORPS_COMMAND_SCEPTER) == false)then player:setVar("DynaSandoria_Win",1); player:addKeyItem(HYDRA_CORPS_COMMAND_SCEPTER); player:messageSpecial(KEYITEM_OBTAINED,HYDRA_CORPS_COMMAND_SCEPTER); 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
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Rabao/npcs/Generoit.lua
6
1305
----------------------------------- -- Area: Rabao -- NPC: Generoit -- Standard Merchant NPC ----------------------------------- require("scripts/globals/shop"); package.loaded["scripts/zones/Rabao/TextIDs"] = nil; require("scripts/zones/Rabao/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,GENEROIT_SHOP_DIALOG); stock = {0x11C1,61, -- Gysahl Greens 0x0348,7, -- Chocobo Feather 0x4278,10, -- Pet Food Alpha Biscuit 0x4279,81, -- Pet Food Beta Biscuit 0x45C4,81, -- Carrot Broth 0x45C6,687, -- Bug Broth 0x45C8,125, -- Herbal Broth 0x45CA,687, -- Carrion Broth 0x13D1,50784} -- Scroll of Chocobo Mazurka 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
CaptainPRICE/wire
lua/entities/gmod_wire_fx_emitter.lua
10
3723
AddCSLuaFile() DEFINE_BASECLASS( "base_wire_entity" ) ENT.PrintName = "Wire FX Emitter" ENT.WireDebugName = "FX Emitter" function ENT:SetupDataTables() self:NetworkVar( "Bool", 0, "On" ) self:NetworkVar( "Int", 0, "Effect" ) self:NetworkVar( "Float", 0, "Delay" ) self:NetworkVar( "Vector", 0, "FXDir" ) end function ENT:GetFXPos() return self:GetPos() end -- Effect registration ENT.Effects = {} ENT.fxcount = 0 local fx_emitter = ENT ComboBox_Wire_FX_Emitter_Options = {} function AddFXEmitterEffect(name, func, nicename) fx_emitter.fxcount = fx_emitter.fxcount+1 // Maintain a global reference for these effects ComboBox_Wire_FX_Emitter_Options[name] = fx_emitter.fxcount if CLIENT then fx_emitter.Effects[fx_emitter.fxcount] = func language.Add( "wire_fx_emitter_"..name, nicename ) end end -- Modular effect adding.. stuff include( "wire/fx_emitter_default.lua" ) if CLIENT then ENT.Delay = 0.05 function ENT:Draw() // Don't draw if we are in camera mode local ply = LocalPlayer() local wep = ply:GetActiveWeapon() if ( wep:IsValid() ) then local weapon_name = wep:GetClass() if ( weapon_name == "gmod_camera" ) then return end end self.BaseClass.Draw( self ) end function ENT:Think() if not self:GetOn() then return end if ( self.Delay > CurTime() ) then return end self.Delay = CurTime() + self:GetDelay() local Effect = self:GetEffect() // Missing effect... replace it if possible :/ if ( !self.Effects[ Effect ] ) then if ( self.Effects[1] ) then Effect = 1 else return end end local Angle = self:GetAngles() local FXDir = self:GetFXDir() if FXDir and not FXDir:IsZero() then Angle = FXDir:Angle() else self:GetUp():Angle() end local FXPos = self:GetFXPos() if not FXPos or FXDir:IsZero() then FXPos=self:GetPos() + Angle:Forward() * 12 end local b, e = pcall( self.Effects[Effect], FXPos, Angle ) if (!b) then // Report the error Print(self.Effects) Print(FXPos) Print(Angle) Msg("Error in Emitter "..tostring(Effect).."\n -> "..tostring(e).."\n") // Remove the naughty function self.Effects[ Effect ] = nil end end return -- No more client end -- Server function ENT:Initialize() self:SetModel( "models/props_lab/tpplug.mdl" ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self:DrawShadow( false ) self:SetCollisionGroup( COLLISION_GROUP_WEAPON ) local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end self.Inputs = WireLib.CreateInputs(self, {"On", "Effect", "Delay", "Direction [VECTOR]"}) end function ENT:Setup(delay, effect) if delay then self:SetDelay(delay) end if effect then self:SetEffect(effect) end end function ENT:TriggerInput( inputname, value, iter ) if inputname == "Direction" then self:SetFXDir(value:GetNormal()) elseif inputname == "Effect" then self:SetEffect(math.Clamp(value - value % 1, 1, self.fxcount)) elseif inputname == "On" then self:SetOn(value ~= 0) elseif inputname == "Delay" then self:SetDelay(math.Clamp(value, 0.05, 20)) --elseif (inputname == "Position") then -- removed for excessive mingability -- self:SetFXPos(value) end end function ENT:ApplyDupeInfo(ply, ent, info, GetEntByID) self.BaseClass.ApplyDupeInfo(self, ply, ent, info, GetEntByID) -- Old dupes stored this info here rather than as RegisterEntityClass vars if info.Effect then self:SetEffect(info.Effect) end if info.Delay then self:SetDelay(info.Delay) end end duplicator.RegisterEntityClass("gmod_wire_fx_emitter", WireLib.MakeWireEnt, "Data", "delay", "effect" ) -- Note: delay and effect are here for backwards compatibility, they're now stored in the DataTable
apache-2.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Newton_Movalpolos/npcs/Sleakachiq.lua
4
1057
----------------------------------- -- Area: Newton Movalpolos -- NPC: Sleakachiq -- Type: Adventurer's Assistant -- @zone: 12 -- @pos: 162.504 14.999 136.901 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Newton_Movalpolos/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x001a); 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
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Upper_Jeuno/npcs/Sibila-Mobla.lua
2
1289
----------------------------------- -- Area: Upper Jeuno -- NPC: Sibila-Mobla -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Upper_Jeuno/TextIDs"] = nil; require("scripts/zones/Upper_Jeuno/TextIDs"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local WildcatJeuno = player:getVar("WildcatJeuno"); if (player:getQuestStatus(JEUNO,LURE_OF_THE_WILDCAT_JEUNO) == QUEST_ACCEPTED and player:getMaskBit(WildcatJeuno,5) == false) then player:startEvent(10083); else player:startEvent(0x0062); 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 == 10083) then player:setMaskBit(player:getVar("WildcatJeuno"),"WildcatJeuno",5,true) end end;
gpl-3.0
pedrohenriquerls/cocos2d_ruby_binding
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/ParticleBatchNode.lua
10
3427
-------------------------------- -- @module ParticleBatchNode -- @extend Node,TextureProtocol -- @parent_module cc -------------------------------- -- -- @function [parent=#ParticleBatchNode] setTexture -- @param self -- @param #cc.Texture2D texture -------------------------------- -- disables a particle by inserting a 0'd quad into the texture atlas -- @function [parent=#ParticleBatchNode] disableParticle -- @param self -- @param #int particleIndex -------------------------------- -- -- @function [parent=#ParticleBatchNode] getTexture -- @param self -- @return Texture2D#Texture2D ret (return value: cc.Texture2D) -------------------------------- -- Sets the texture atlas used for drawing the quads -- @function [parent=#ParticleBatchNode] setTextureAtlas -- @param self -- @param #cc.TextureAtlas atlas -------------------------------- -- -- @function [parent=#ParticleBatchNode] removeAllChildrenWithCleanup -- @param self -- @param #bool doCleanup -------------------------------- -- Gets the texture atlas used for drawing the quads -- @function [parent=#ParticleBatchNode] getTextureAtlas -- @param self -- @return TextureAtlas#TextureAtlas ret (return value: cc.TextureAtlas) -------------------------------- -- Inserts a child into the ParticleBatchNode -- @function [parent=#ParticleBatchNode] insertChild -- @param self -- @param #cc.ParticleSystem system -- @param #int index -------------------------------- -- -- @function [parent=#ParticleBatchNode] removeChildAtIndex -- @param self -- @param #int index -- @param #bool doCleanup -------------------------------- -- initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles -- @function [parent=#ParticleBatchNode] create -- @param self -- @param #string fileImage -- @param #int capacity -- @return ParticleBatchNode#ParticleBatchNode ret (return value: cc.ParticleBatchNode) -------------------------------- -- initializes the particle system with Texture2D, a capacity of particles, which particle system to use -- @function [parent=#ParticleBatchNode] createWithTexture -- @param self -- @param #cc.Texture2D tex -- @param #int capacity -- @return ParticleBatchNode#ParticleBatchNode ret (return value: cc.ParticleBatchNode) -------------------------------- -- @overload self, cc.Node, int, string -- @overload self, cc.Node, int, int -- @function [parent=#ParticleBatchNode] addChild -- @param self -- @param #cc.Node child -- @param #int zOrder -- @param #int tag -------------------------------- -- -- @function [parent=#ParticleBatchNode] draw -- @param self -- @param #cc.Renderer renderer -- @param #mat4_table transform -- @param #unsigned int flags -------------------------------- -- -- @function [parent=#ParticleBatchNode] visit -- @param self -- @param #cc.Renderer renderer -- @param #mat4_table parentTransform -- @param #unsigned int parentFlags -------------------------------- -- -- @function [parent=#ParticleBatchNode] reorderChild -- @param self -- @param #cc.Node child -- @param #int zOrder -------------------------------- -- -- @function [parent=#ParticleBatchNode] removeChild -- @param self -- @param #cc.Node child -- @param #bool cleanup return nil
mit
waytim/darkstar
scripts/zones/Windurst_Waters/npcs/Ohbiru-Dohbiru.lua
28
12066
----------------------------------- -- Area: Windurst Waters -- NPC: Ohbiru-Dohbiru -- Involved in quest: Food For Thought, Say It with Flowers -- Starts and finishes quest: Toraimarai Turmoil ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; require("scripts/globals/quests"); require("scripts/globals/titles"); require("scripts/globals/common"); require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/Windurst_Waters/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) local turmoil = player:getQuestStatus(WINDURST,TORAIMARAI_TURMOIL); local count = trade:getItemCount(); if (player:getQuestStatus(WINDURST,WATER_WAY_TO_GO) == QUEST_ACCEPTED) then if (trade:hasItemQty(4351,1) and count == 1) then player:startEvent(0x0163,900); end elseif (player:getQuestStatus(WINDURST,FOOD_FOR_THOUGHT) == QUEST_ACCEPTED) then local OhbiruFood = player:getVar("Ohbiru_Food_var"); if (trade:hasItemQty(4493,1) == true and trade:hasItemQty(4408,1) == true and trade:hasItemQty(624,1) == true and count == 3 and OhbiruFood ~= 2) then -- Traded all 3 items & Didn't ask for order rand = math.random(1,2); if (rand == 1) then player:startEvent(0x0145,440); else player:startEvent(0x0146); end elseif (trade:hasItemQty(4493,1) == true and trade:hasItemQty(4408,1) == true and trade:hasItemQty(624,1) == true and count == 3 and OhbiruFood == 2) then -- Traded all 3 items after receiving order player:startEvent(0x0142,440); end elseif (turmoil == QUEST_ACCEPTED) then if (count == 3 and trade:getGil() == 0 and trade:hasItemQty(906,3) == true) then --Check that all 3 items have been traded player:startEvent(0x0317); else player:startEvent(0x0312,4500,267,906); -- Reminder of needed items end elseif (turmoil == QUEST_COMPLETED) then if (count == 3 and trade:getGil () == 0 and trade:hasItemQty(906,3) == true) then --Check that all 3 items have been traded player:startEvent(0x0317); else player:startEvent(0x031b,4500,0,906); -- Reminder of needed items for repeated quest end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) -- Check for Missions first (priority?) -- If the player has started the mission or not local pfame = player:getFameLevel(WINDURST); local turmoil = player:getQuestStatus(WINDURST,TORAIMARAI_TURMOIL); local FoodForThought = player:getQuestStatus(WINDURST,FOOD_FOR_THOUGHT); local needToZone = player:needToZone(); local OhbiruFood = player:getVar("Ohbiru_Food_var"); -- Variable to track progress of Ohbiru-Dohbiru in Food for Thought local waterWayToGo = player:getQuestStatus(WINDURST,WATER_WAY_TO_GO); local overnightDelivery = player:getQuestStatus(WINDURST,OVERNIGHT_DELIVERY); local SayFlowers = player:getQuestStatus(WINDURST,SAY_IT_WITH_FLOWERS); local FlowerProgress = player:getVar("FLOWER_PROGRESS"); if (player:getCurrentMission(COP) == THE_ROAD_FORKS and player:getVar("MEMORIES_OF_A_MAIDEN_Status")==2) then player:startEvent(0x0368); elseif (player:getCurrentMission(WINDURST) == THE_PRICE_OF_PEACE) then if (player:getVar("ohbiru_dohbiru_talk") == 1) then player:startEvent(0x8f); else player:startEvent(0x90); end elseif (SayFlowers == QUEST_ACCEPTED or FlowerProgress == 2) then if (needToZone) then player:startEvent(0x0206); elseif (player:getVar("FLOWER_PROGRESS") == 1) then player:startEvent(0x0205,0,0,0,0,950); else player:startEvent(0x0204,0,0,0,0,950); end elseif (waterWayToGo == QUEST_COMPLETED and needToZone) then player:startEvent(0x0164,0,4351); elseif (waterWayToGo == QUEST_ACCEPTED) then if (player:hasItem(504) == false and player:hasItem(4351) == false) then player:startEvent(0x0162); else player:startEvent(0x0161); end elseif (waterWayToGo == QUEST_AVAILABLE and overnightDelivery == QUEST_COMPLETED and pfame >= 3) then player:startEvent(0x0160,0,4351); elseif (FoodForThought == QUEST_AVAILABLE and OhbiruFood == 0) then player:startEvent(0x0134); -- Hungry; mentions the experiment. First step in quest for this NPC. player:setVar("Ohbiru_Food_var",1); elseif (FoodForThought == QUEST_AVAILABLE and OhbiruFood == 1) then player:startEvent(0x0135); -- Hungry. The NPC complains of being hungry before the quest is active. elseif (FoodForThought == QUEST_ACCEPTED and OhbiruFood < 2) then player:startEvent(0x013c,0,4493,624,4408); -- Gives Order player:setVar("Ohbiru_Food_var",2); elseif (FoodForThought == QUEST_ACCEPTED and OhbiruFood == 2) then player:startEvent(0x013d,0,4493,624,4408); -- Repeats Order elseif (FoodForThought == QUEST_ACCEPTED and OhbiruFood == 3) then player:startEvent(0x0144); -- Reminds player to check on friends if he has been given his food. elseif (FoodForThought == QUEST_COMPLETED and needToZone == true) then player:startEvent(0x0158); -- Post Food for Thought Dialogue elseif (overnightDelivery == QUEST_COMPLETED and pfame < 6) then player:startEvent(0x015f); -- Post Overnight Delivery Dialogue -- -- Begin Toraimarai Turmoil Section -- elseif (turmoil == QUEST_AVAILABLE and pfame >= 6 and needToZone == false) then player:startEvent(0x0311,4500,267,906); elseif (turmoil == QUEST_ACCEPTED) then player:startEvent(0x0312,4500,267,906); -- Reminder of needed items elseif (turmoil == QUEST_COMPLETED) then player:startEvent(0x031b,4500,0,906); -- Allows player to initiate repeat of Toraimarai Turmoil else player:startEvent(0x0158); 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); -- Check Missions first (priority?) local turmoil = player:getQuestStatus(WINDURST,TORAIMARAI_TURMOIL); if (csid == 0x8f) then player:setVar("ohbiru_dohbiru_talk",2); elseif (csid == 0x0142 or csid == 0x0145) then if (player:getVar("Kerutoto_Food_var") == 3 and player:getVar("Kenapa_Food_var") == 4 and player:getVar("Ohbiru_Food_var") == 2) then -- If this is the last NPC to be fed player:tradeComplete(); player:completeQuest(WINDURST,FOOD_FOR_THOUGHT); player:addTitle(FAST_FOOD_DELIVERER); player:addGil(GIL_RATE*440); player:setVar("Kerutoto_Food_var",0); -- ------------------------------------------ player:setVar("Kenapa_Food_var",0); -- Erase all the variables used in this quest player:setVar("Ohbiru_Food_var",0); -- ------------------------------------------ player:addFame(WINDURST,100); player:needToZone(true); else player:tradeComplete(); player:addGil(GIL_RATE*440); player:setVar("Ohbiru_Food_var",3); -- If this is NOT the last NPC given food, flag this NPC as completed. end elseif (csid == 0x0146) then if (player:getVar("Kerutoto_Food_var") == 3 and player:getVar("Kenapa_Food_var") == 4 and player:getVar("Ohbiru_Food_var") == 2) then -- If this is the last NPC to be fed player:tradeComplete(); player:completeQuest(WINDURST,FOOD_FOR_THOUGHT); player:addTitle(FAST_FOOD_DELIVERER); player:addGil(GIL_RATE*440); player:messageSpecial(GIL_OBTAINED,GIL_RATE*440); player:setVar("Kerutoto_Food_var",0); -- ------------------------------------------ player:setVar("Kenapa_Food_var",0); -- Erase all the variables used in this quest player:setVar("Ohbiru_Food_var",0); -- ------------------------------------------ player:addFame(WINDURST,100); player:needToZone(true); else player:tradeComplete(); player:addGil(GIL_RATE*440); player:messageSpecial(GIL_OBTAINED,GIL_RATE*440); player:setVar("Ohbiru_Food_var",3); -- If this is NOT the last NPC given food, flag this NPC as completed. end elseif (csid == 0x0311 and option == 1) then -- Adds Toraimarai turmoil player:addQuest(WINDURST,TORAIMARAI_TURMOIL); player:messageSpecial(KEYITEM_OBTAINED,267); player:addKeyItem(267); -- Rhinostery Certificate elseif (csid == 0x0317 and turmoil == QUEST_ACCEPTED) then -- Completes Toraimarai turmoil - first time player:addGil(GIL_RATE*4500); player:messageSpecial(GIL_OBTAINED,GIL_RATE*4500); player:completeQuest(WINDURST,TORAIMARAI_TURMOIL); player:addFame(WINDURST,100); player:addTitle(CERTIFIED_RHINOSTERY_VENTURER); player:tradeComplete(); elseif (csid == 0x0317 and turmoil == 2) then -- Completes Toraimarai turmoil - repeats player:addGil(GIL_RATE*4500); player:messageSpecial(GIL_OBTAINED,GIL_RATE*4500); player:addFame(WINDURST,50); player:tradeComplete(); elseif (csid == 0x0160 and option == 0 or csid == 0x0162) then if (player:getFreeSlotsCount() >= 1) then if (player:getQuestStatus(WINDURST,WATER_WAY_TO_GO) == QUEST_AVAILABLE) then player:addQuest(WINDURST,WATER_WAY_TO_GO); end player:addItem(504); player:messageSpecial(ITEM_OBTAINED,504); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,504); end elseif (csid == 0x0163) then player:addGil(GIL_RATE*900); player:completeQuest(WINDURST,WATER_WAY_TO_GO); player:addFame(WINDURST,40); player:tradeComplete(); player:needToZone(true); elseif (csid == 0x0368) then player:setVar("MEMORIES_OF_A_MAIDEN_Status",3); elseif (csid == 0x0204) then if (option == 0) then player:delGil(300); player:addItem(948); -- Carnation player:messageSpecial(ITEM_OBTAINED,948); player:needToZone(true); elseif (option == 1) then player:delGil(200); player:addItem(941); -- Red Rose player:messageSpecial(ITEM_OBTAINED,941); player:needToZone(true); elseif (option == 2) then player:delGil(250); player:addItem(949); -- Rain Lily player:messageSpecial(ITEM_OBTAINED,949); player:needToZone(true); elseif (option == 3) then player:delGil(150); player:addItem(956); -- Lilac player:messageSpecial(ITEM_OBTAINED,956); player:needToZone(true); elseif (option == 4) then player:delGil(200); player:addItem(957); -- Amaryllis player:messageSpecial(ITEM_OBTAINED,957); player:needToZone(true); elseif (option == 5) then player:delGil(100); player:addItem(958); -- Marguerite player:messageSpecial(ITEM_OBTAINED,958); player:needToZone(true); elseif (option == 7) then player:setVar("FLOWER_PROGRESS",1); end end end;
gpl-3.0
guillec/bluag
generators/newblog.lua
1
6183
function file_exists(name) local f=io.open(name,"w") if f~=nil then io.close(f) return true else return false end end function directory_exists(path) end function mkdir(dirname) if not directory_exists(dirname) then os.execute("mkdir " .. dirname) end end function create_index_page(filename) if file_exists(filename) then local file = io.open(filename, "w") default_content = [[ --title: Your First Page --end_config <p> All right, You just setup your blog! Now what?<br/> Well there are couple of things you can do, add a new post, create a new page or edit the layout! For more information on this check out the README. </p> <p> The other thing you can do is look at the code and help me make this better. Check out the README on how to contribute. </p> <p> Is Bluag for you? I dont know, but if you are looking to start a blog and don't want to use a annoying CMS you should try this. You should especially try this if you are a Lua developer, since all the code is written in Lua. I hope that with Bluag, as a developer you can just easily manipulate the content of your post and just over all have more fun. </p> <p> There is a lot more that can be done and I am always looking for feedback. Please if interested help me with this project. </p> <br/> {{posts}} ]] file:write(default_content) file:close() end end function create_default_layout(filename) if file_exists(filename) then local file = io.open(filename, "w") application_layout = [[ <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title> {{title}} </title> <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet"> <link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet"> {{stylesheets}} </head> <body> <div class="row-fluid" style="background-color: white; padding: 20px;"> <span class="row"> <span class="offset1"> <img src="http://www.pairprogramwith.me/badge.png" alt="pair with me logo" /> </span> {{top_menu}} </span> </div> <div class="row-fluid" style="padding-top: 35px;"> <div class="span10 offset1">{{post_body}}</div> </div> <div id="footer" class="row-fluid" style="padding-top: 15px;"> </div> <script> <!-- Google Analytics Here --> </script> </body> </html> ]] file:write(application_layout) file:close() end end function create_recent_posts(filename) if file_exists(filename) then local file = io.open(filename, "w") list_recent_posts = [[ <ul class="unstyled" style="padding-top: 10px;"> <li style="border-bottom: solid 1px #999999; padding: 7px 0px;"> <a href='/index.html'>Your Bluag Blog</a> <span style="float: right;" class="muted"><small>11/11/1111</small></span> </li> </ul> ]] file:write(list_recent_posts) file:close() end end function create_top_menu(filename) if file_exists(filename) then local file = io.open(filename, "w") list_recent_posts = [[ <span class="offset3" style="font-size: 20px; word-spacing: 5px;"> <a href="/index.html" rel="index" rel="index">HOME</a> | <a href="#" rel="index" rel="about">ABOUT ME</a> | <a href="#" rel="projects">PROJECTS</a> </span> ]] file:write(list_recent_posts) file:close() end end function create_stylesheet(filename) if file_exists(filename) then local file = io.open(filename, "w") list_recent_posts = [[ html,body { height: 100%; background-color: #f2f2f2; } #footer{ bottom: -50px; height: 50px; left: 0; position: absolute; right: 0; } hr { margin-top: 50px; margin-bottom: 50px; height: 1px; border: 0; border-top: 1px solid #ccc } span.label { margin-top: 10px; margin-right: 15px; padding: 15px; float: left; } div.post-header { margin-top: 15px; margin-bottom: 30px; } ]] file:write(list_recent_posts) file:close() end end function create_stylesheet_widget(filename) if file_exists(filename) then local file = io.open(filename, "w") list_recent_posts = [[ <link rel="stylesheet" href="assets/stylesheets/style.css"> ]] file:write(list_recent_posts) file:close() end end function create_first_post(filename) if file_exists(filename) then local file = io.open(filename, "w") list_recent_posts = [[ --title: Your First Blog Post --end_config <br/> <h3>Your First Post</h3> <p>This file is found in the <em>_sources</em> directory. If you want to add a new blog post just create a new html file in the <em>_sources</em> directory.</p> <p> <strong>VERY IMPORTANT:</strong> every file in the <em>_sources</em> directory <strong>requires</strong> a title config block. Look at the source file as an example. Without this the build will break. </p> ]] file:write(list_recent_posts) file:close() end end mkdir("_sources/") mkdir("_pages/") mkdir("_layouts/") mkdir("_build/") mkdir("_widgets/") mkdir("_assets/") mkdir("_assets/stylesheets/") mkdir("_assets/images/") create_index_page("_pages/index.html") create_default_layout("_layouts/default.html") create_recent_posts("_widgets/recent_posts.html") create_top_menu("_widgets/top_menu.html") create_stylesheet("_assets/stylesheets/style.css") create_stylesheet_widget("_widgets/stylesheets.html") create_first_post("_sources/the_very_first_post.html")
mit
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/zones/Windurst_Waters/npcs/Chyuk-Kochak.lua
4
1049
----------------------------------- -- Area: Windurst Waters -- NPC: Chyuk-Kochak -- Type: Standard NPC -- @zone: 238 -- @pos: -252.162 -6.319 -307.011 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0298); 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
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/items/loaf_of_steel_bread.lua
3
1089
----------------------------------------- -- ID: 4573 -- Item: loaf_of_steel_bread -- Food Effect: 60Min, All Races ----------------------------------------- -- Health 6 -- Vitality 1 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,3600,4573); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 6); target:addMod(MOD_VIT, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 6); target:delMod(MOD_VIT, 1); end;
gpl-3.0
pedrohenriquerls/cocos2d_ruby_binding
frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/TMXLayer.lua
2
5485
-------------------------------- -- @module TMXLayer -- @extend SpriteBatchNode -- @parent_module cc -------------------------------- -- returns the position in points of a given tile coordinate -- @function [parent=#TMXLayer] getPositionAt -- @param self -- @param #vec2_table tileCoordinate -- @return vec2_table#vec2_table ret (return value: vec2_table) -------------------------------- -- -- @function [parent=#TMXLayer] setLayerOrientation -- @param self -- @param #int orientation -------------------------------- -- dealloc the map that contains the tile position from memory.<br> -- Unless you want to know at runtime the tiles positions, you can safely call this method.<br> -- If you are going to call layer->tileGIDAt() then, don't release the map -- @function [parent=#TMXLayer] releaseMap -- @param self -------------------------------- -- size of the layer in tiles -- @function [parent=#TMXLayer] getLayerSize -- @param self -- @return size_table#size_table ret (return value: size_table) -------------------------------- -- -- @function [parent=#TMXLayer] setMapTileSize -- @param self -- @param #size_table size -------------------------------- -- Layer orientation, which is the same as the map orientation -- @function [parent=#TMXLayer] getLayerOrientation -- @param self -- @return int#int ret (return value: int) -------------------------------- -- -- @function [parent=#TMXLayer] setProperties -- @param self -- @param #map_table properties -------------------------------- -- -- @function [parent=#TMXLayer] setLayerName -- @param self -- @param #string layerName -------------------------------- -- removes a tile at given tile coordinate -- @function [parent=#TMXLayer] removeTileAt -- @param self -- @param #vec2_table tileCoordinate -------------------------------- -- initializes a TMXLayer with a tileset info, a layer info and a map info -- @function [parent=#TMXLayer] initWithTilesetInfo -- @param self -- @param #cc.TMXTilesetInfo tilesetInfo -- @param #cc.TMXLayerInfo layerInfo -- @param #cc.TMXMapInfo mapInfo -- @return bool#bool ret (return value: bool) -------------------------------- -- Creates the tiles -- @function [parent=#TMXLayer] setupTiles -- @param self -------------------------------- -- @overload self, unsigned int, vec2_table, int -- @overload self, unsigned int, vec2_table -- @function [parent=#TMXLayer] setTileGID -- @param self -- @param #unsigned int gid -- @param #vec2_table tileCoordinate -- @param #int flags -------------------------------- -- size of the map's tile (could be different from the tile's size) -- @function [parent=#TMXLayer] getMapTileSize -- @param self -- @return size_table#size_table ret (return value: size_table) -------------------------------- -- return the value for the specific property name -- @function [parent=#TMXLayer] getProperty -- @param self -- @param #string propertyName -- @return Value#Value ret (return value: cc.Value) -------------------------------- -- -- @function [parent=#TMXLayer] setLayerSize -- @param self -- @param #size_table size -------------------------------- -- -- @function [parent=#TMXLayer] getLayerName -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#TMXLayer] setTileSet -- @param self -- @param #cc.TMXTilesetInfo info -------------------------------- -- Tileset information for the layer -- @function [parent=#TMXLayer] getTileSet -- @param self -- @return TMXTilesetInfo#TMXTilesetInfo ret (return value: cc.TMXTilesetInfo) -------------------------------- -- @overload self -- @overload self -- @function [parent=#TMXLayer] getProperties -- @param self -- @return map_table#map_table ret (return value: map_table) -------------------------------- -- returns the tile (Sprite) at a given a tile coordinate.<br> -- The returned Sprite will be already added to the TMXLayer. Don't add it again.<br> -- The Sprite can be treated like any other Sprite: rotated, scaled, translated, opacity, color, etc.<br> -- You can remove either by calling:<br> -- - layer->removeChild(sprite, cleanup);<br> -- - or layer->removeTileAt(Vec2(x,y)); -- @function [parent=#TMXLayer] getTileAt -- @param self -- @param #vec2_table tileCoordinate -- @return Sprite#Sprite ret (return value: cc.Sprite) -------------------------------- -- creates a TMXLayer with an tileset info, a layer info and a map info -- @function [parent=#TMXLayer] create -- @param self -- @param #cc.TMXTilesetInfo tilesetInfo -- @param #cc.TMXLayerInfo layerInfo -- @param #cc.TMXMapInfo mapInfo -- @return TMXLayer#TMXLayer ret (return value: cc.TMXLayer) -------------------------------- -- -- @function [parent=#TMXLayer] addChild -- @param self -- @param #cc.Node child -- @param #int zOrder -- @param #int tag -------------------------------- -- -- @function [parent=#TMXLayer] getDescription -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#TMXLayer] removeChild -- @param self -- @param #cc.Node child -- @param #bool cleanup -------------------------------- -- js ctor -- @function [parent=#TMXLayer] TMXLayer -- @param self return nil
mit
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/mobskills/Wind_Shear_ZNM.lua
4
1090
--------------------------------------------- -- Wind Shear -- -- Description: Deals damage to enemies within an area of effect. Additional effect: Knockback -- Type: Physical -- Utsusemi/Blink absorb: 2-3 shadows -- Range: 10' radial -- Notes: The knockback is rather severe. Vulpangue uses an enhanced version that inflicts Weight. --------------------------------------------- require("/scripts/globals/settings"); require("/scripts/globals/status"); require("/scripts/globals/monstertpmoves"); --------------------------------------------- function OnMobSkillCheck(target,mob,skill) return 0; end; function OnMobWeaponSkill(target, mob, skill) -- EFFECT_KNOCKBACK local numhits = 1; local accmod = 1; local dmgmod = 1; local info = MobPhysicalMove(mob,target,skill,numhits,accmod,dmgmod,TP_NO_EFFECT); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_PHYSICAL,MOBPARAM_SLASH,MOBPARAM_3_SHADOW); local typeEffect = EFFECT_WEIGHT; MobPhysicalStatusEffectMove(mob, target, skill, typeEffect, 50, 0, 120); target:delHP(dmg); return dmg; end;
gpl-3.0
djdduty/OnionRing
TestGame/main.lua
2
1355
print("Hello from Lua Global!") frameCount = 0 frameTimer = 0 function onion.load() print("This lua file contains every bound input function!") onion.window.settitle("Lua, woohoo!") end function onion.update(deltatime) frameTimer = frameTimer + deltatime frameCount = frameCount + 1 --print ("update... " .. deltatime) if frameTimer >= 1000 then print ("Fps: " .. frameCount) frameCount = 0 frameTimer = 0 end --if onion.input.iskeydown(32) then - Not working atm --if onion.mouse.isdown(0) then - Not working atm end function onion.draw() end function onion.unload() print("Done...") end function onion.keydown(key) if key == 27 then onion.quit() end if key == 32 then onion.window.setsize(800,600) end print("Key "..key.." down!") end function onion.keyup(key) print("Key "..key.." up!") end function onion.mousedown(button) print("Mouse "..button.." down. x:"..onion.mouse.getX().." y:"..onion.mouse.getY()) if button == 1 then onion.mouse.hide() end if button == 3 then onion.mouse.show() end end function onion.mouseup(button) print("Mouse "..button.." up. x:"..onion.mouse.getX().." y:"..onion.mouse.getY()) end function onion.mousemove(x, y) --print("Mouse moved to "..x..", "..y) end
mit
TheOnePharaoh/YGOPro-Custom-Cards
script/c77777793.lua
2
4503
--Witchcrafter Combinatorial Relic function c77777793.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:SetTarget(c77777793.sptg) e1:SetOperation(c77777793.spop) c:RegisterEffect(e1) end function c77777793.mfilter0(c) return c:IsCanBeFusionMaterial() and c:IsAbleToRemove() end function c77777793.mfilter1(c,e) return c:IsCanBeFusionMaterial() and not c:IsImmuneToEffect(e) end function c77777793.mfilter2(c,e) return c:IsCanBeFusionMaterial() and c:IsAbleToRemove()and c:IsSetCard(0x407) and not c:IsImmuneToEffect(e) end function c77777793.spfilter1(c,e,tp,m,f,chkf) return c:IsType(TYPE_FUSION) and c:IsRace(RACE_SPELLCASTER) and (not f or f(c)) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) end function c77777793.spfilter2(c,e,tp,m,f,chkf) return c:IsType(TYPE_FUSION) and c:IsRace(RACE_SPELLCASTER) and (not f or f(c)) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) end function c77777793.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp local mg1=Duel.GetMatchingGroup(Card.IsCanBeFusionMaterial,tp,LOCATION_HAND+LOCATION_MZONE,0,nil) local res=Duel.IsExistingMatchingCard(c77777793.spfilter1,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) if res then return true end local mg2=Duel.GetMatchingGroup(c77777793.mfilter0,tp,LOCATION_GRAVE,0,nil) mg2:Merge(mg1) res=Duel.IsExistingMatchingCard(c77777793.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,nil,chkf) if not res then local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() local mg3=fgroup(ce,e,tp) local mf=ce:GetValue() res=Duel.IsExistingMatchingCard(c77777793.spfilter1,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg3,mf,chkf) end end return res end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function c77777793.spop(e,tp,eg,ep,ev,re,r,rp) local chkf=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and PLAYER_NONE or tp local mg1=Duel.GetMatchingGroup(c77777793.mfilter1,tp,LOCATION_HAND+LOCATION_MZONE,0,nil,e) local sg1=Duel.GetMatchingGroup(c77777793.spfilter1,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local mg2=Duel.GetMatchingGroup(c77777793.mfilter2,tp,LOCATION_GRAVE,0,nil,e) mg2:Merge(mg1) local sg2=Duel.GetMatchingGroup(c77777793.spfilter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,nil,chkf) sg1:Merge(sg2) local mg3=nil local sg3=nil local ce=Duel.GetChainMaterial(tp) if ce~=nil then local fgroup=ce:GetTarget() mg3=fgroup(ce,e,tp) local mf=ce:GetValue() sg3=Duel.GetMatchingGroup(c77777793.spfilter1,tp,LOCATION_EXTRA,0,nil,e,tp,mg3,mf,chkf) end if sg1:GetCount()>0 or (sg3~=nil and sg3:GetCount()>0) then local sg=sg1:Clone() if sg3 then sg:Merge(sg3) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=sg:Select(tp,1,1,nil) local tc=tg:GetFirst() if sg1:IsContains(tc) and (sg3==nil or not sg3:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then local mat1=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) tc:SetMaterial(mat1) local mat2=mat1:Filter(Card.IsLocation,nil,LOCATION_GRAVE) mat1:Sub(mat2) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.Remove(mat2,POS_FACEUP,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.BreakEffect() Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) else local mat=Duel.SelectFusionMaterial(tp,tc,mg3,nil,chkf) local fop=ce:GetOperation() fop(ce,e,tp,tc,mat) end tc:CompleteProcedure() else local cg1=Duel.GetFieldGroup(tp,LOCATION_HAND+LOCATION_MZONE,0) local cg2=Duel.GetFieldGroup(tp,LOCATION_EXTRA,0) local ct=cg1:GetCount() if not Duel.IsPlayerAffectedByEffect(tp,30459350) then ct=ct+Duel.GetMatchingGroupCount(c77777793.ctfilter,tp,LOCATION_GRAVE,0,nil) end if ct>1 and cg2:IsExists(Card.IsFacedown,1,nil) and Duel.IsPlayerCanSpecialSummon(tp) and not Duel.IsPlayerAffectedByEffect(tp,27581098) then Duel.ConfirmCards(1-tp,cg1) Duel.ConfirmCards(1-tp,cg2) Duel.ShuffleHand(tp) end end end function c77777793.ctfilter(c) return c:IsType(TYPE_MONSTER) and c:IsSetCard(0x407) end function c77777793.grvfilter(c) return c:IsLocation(LOCATION_GRAVE) and c:IsType(TYPE_MONSTER) and c:IsSetCard(0x407) end
gpl-3.0
waytim/darkstar
scripts/zones/Al_Zahbi/npcs/Hadibal.lua
13
1037
----------------------------------- -- Area: Al Zahbi -- NPC: Hadibal -- Type: Standard NPC -- @zone: 48 -- @pos -34.345 -1 -38.842 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Al_Zahbi/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x00f5); 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
delram/hw
plugins/stats.lua
866
4001
do -- Returns a table with `name` and `msgs` local function get_msgs_user_chat(user_id, chat_id) local user_info = {} local uhash = 'user:'..user_id local user = redis:hgetall(uhash) local um_hash = 'msgs:'..user_id..':'..chat_id user_info.msgs = tonumber(redis:get(um_hash) or 0) user_info.name = user_print_name(user)..' ['..user_id..']' return user_info end local function chat_stats(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'users in this chat \n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end local file = io.open("./groups/lists/"..chat_id.."stats.txt", "w") file:write(text) file:flush() file:close() send_document("chat#id"..chat_id,"./groups/lists/"..chat_id.."stats.txt", ok_cb, false) return --text end local function chat_stats2(chat_id) -- Users on chat local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) local users_info = {} -- Get user info for i = 1, #users do local user_id = users[i] local user_info = get_msgs_user_chat(user_id, chat_id) table.insert(users_info, user_info) end -- Sort users by msgs number table.sort(users_info, function(a, b) if a.msgs and b.msgs then return a.msgs > b.msgs end end) local text = 'users in this chat \n' for k,user in pairs(users_info) do text = text..user.name..' = '..user.msgs..'\n' end return text end -- Save stats, ban user local function bot_stats() local redis_scan = [[ local cursor = '0' local count = 0 repeat local r = redis.call("SCAN", cursor, "MATCH", KEYS[1]) cursor = r[1] count = count + #r[2] until cursor == '0' return count]] -- Users local hash = 'msgs:*:'..our_id local r = redis:eval(redis_scan, 1, hash) local text = 'Users: '..r hash = 'chat:*:users' r = redis:eval(redis_scan, 1, hash) text = text..'\nGroups: '..r return text end local function run(msg, matches) if matches[1]:lower() == 'teleseed' then -- Put everything you like :) local about = _config.about_text local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /teleseed ") return about end if matches[1]:lower() == "statslist" then if not is_momod(msg) then return "For mods only !" end local chat_id = msg.to.id local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ") return chat_stats2(chat_id) end if matches[1]:lower() == "stats" then if not matches[2] then if not is_momod(msg) then return "For mods only !" end if msg.to.type == 'chat' then local chat_id = msg.to.id local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested group stats ") return chat_stats(chat_id) else return end end if matches[2] == "teleseed" then -- Put everything you like :) if not is_admin(msg) then return "For admins only !" else return bot_stats() end end if matches[2] == "group" then if not is_admin(msg) then return "For admins only !" else return chat_stats(matches[3]) end end end end return { patterns = { "^[!/]([Ss]tats)$", "^[!/]([Ss]tatslist)$", "^[!/]([Ss]tats) (group) (%d+)", "^[!/]([Ss]tats) (teleseed)",-- Put everything you like :) "^[!/]([Tt]eleseed)"-- Put everything you like :) }, run = run } end
gpl-2.0
waytim/darkstar
scripts/zones/Boneyard_Gully/mobs/Race_Runner.lua
13
1477
----------------------------------- -- Area: Boneyard_Gully -- Name: Race Runner ----------------------------------- require("scripts/globals/titles"); require("scripts/globals/status"); local path = { -539, 0, -481, -556, 0, -478, -581, 0, -475, -579, -3, -460, -572, 2, -433, -545, 1, -440, -532, 0, -466 }; ----------------------------------- -- onMobInitialize Action ----------------------------------- function onMobInitialize(mob) end; ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) onMobRoam(mob); end; ----------------------------------- -- onMobRoamAction Action ----------------------------------- function onMobRoamAction(mob) pathfind.patrol(mob, path, PATHFLAG_REVERSE); end; ----------------------------------- -- onMobRoam Action ----------------------------------- function onMobRoam(mob) -- move to start position if not moving if (mob:isFollowingPath() == false) then mob:pathThrough(pathfind.first(path)); end end; ----------------------------------- -- onMobEngaged Action ----------------------------------- function onMobEngaged(mob,target) end; ----------------------------------- -- onMobFight Action ----------------------------------- function onMobFight(mob,target) end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, player, isKiller) end;
gpl-3.0
MinFu/luci
applications/luci-app-statistics/luasrc/statistics/i18n.lua
29
2184
-- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich <jow@openwrt.org> -- Licensed to the public under the Apache License 2.0. module("luci.statistics.i18n", package.seeall) require("luci.util") require("luci.i18n") Instance = luci.util.class() function Instance.__init__( self, graph ) self.i18n = luci.i18n self.graph = graph end function Instance._subst( self, str, val ) str = str:gsub( "%%H", self.graph.opts.host or "" ) str = str:gsub( "%%pn", val.plugin or "" ) str = str:gsub( "%%pi", val.pinst or "" ) str = str:gsub( "%%dt", val.dtype or "" ) str = str:gsub( "%%di", val.dinst or "" ) str = str:gsub( "%%ds", val.dsrc or "" ) return str end function Instance._translate( self, key, alt ) local val = self.i18n.string(key) if val ~= key then return val else return alt end end function Instance.title( self, plugin, pinst, dtype, dinst, user_title ) local title = user_title or "p=%s/pi=%s/dt=%s/di=%s" % { plugin, (pinst and #pinst > 0) and pinst or "(nil)", (dtype and #dtype > 0) and dtype or "(nil)", (dinst and #dinst > 0) and dinst or "(nil)" } return self:_subst( title, { plugin = plugin, pinst = pinst, dtype = dtype, dinst = dinst } ) end function Instance.label( self, plugin, pinst, dtype, dinst, user_label ) local label = user_label or "dt=%s/di=%s" % { (dtype and #dtype > 0) and dtype or "(nil)", (dinst and #dinst > 0) and dinst or "(nil)" } return self:_subst( label, { plugin = plugin, pinst = pinst, dtype = dtype, dinst = dinst } ) end function Instance.ds( self, source ) local label = source.title or self:_translate( string.format( "stat_ds_%s_%s_%s", source.type, source.instance, source.ds ), self:_translate( string.format( "stat_ds_%s_%s", source.type, source.instance ), self:_translate( string.format( "stat_ds_label_%s__%s", source.type, source.ds ), self:_translate( string.format( "stat_ds_%s", source.type ), source.type .. "_" .. source.instance:gsub("[^%w]","_") .. "_" .. source.ds ) ) ) ) return self:_subst( label, { dtype = source.type, dinst = source.instance, dsrc = source.ds } ) end
apache-2.0
zorfmorf/loveprojects
drip/src/libraries/hump/vector.lua
28
5323
--[[ Copyright (c) 2010-2013 Matthias Richter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. Except as contained in this notice, the name(s) of the above copyright holders shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ]]-- local assert = assert local sqrt, cos, sin, atan2 = math.sqrt, math.cos, math.sin, math.atan2 local vector = {} vector.__index = vector local function new(x,y) return setmetatable({x = x or 0, y = y or 0}, vector) end local zero = new(0,0) local function isvector(v) return type(v) == 'table' and type(v.x) == 'number' and type(v.y) == 'number' end function vector:clone() return new(self.x, self.y) end function vector:unpack() return self.x, self.y end function vector:__tostring() return "("..tonumber(self.x)..","..tonumber(self.y)..")" end function vector.__unm(a) return new(-a.x, -a.y) end function vector.__add(a,b) assert(isvector(a) and isvector(b), "Add: wrong argument types (<vector> expected)") return new(a.x+b.x, a.y+b.y) end function vector.__sub(a,b) assert(isvector(a) and isvector(b), "Sub: wrong argument types (<vector> expected)") return new(a.x-b.x, a.y-b.y) end function vector.__mul(a,b) if type(a) == "number" then return new(a*b.x, a*b.y) elseif type(b) == "number" then return new(b*a.x, b*a.y) else assert(isvector(a) and isvector(b), "Mul: wrong argument types (<vector> or <number> expected)") return a.x*b.x + a.y*b.y end end function vector.__div(a,b) assert(isvector(a) and type(b) == "number", "wrong argument types (expected <vector> / <number>)") return new(a.x / b, a.y / b) end function vector.__eq(a,b) return a.x == b.x and a.y == b.y end function vector.__lt(a,b) return a.x < b.x or (a.x == b.x and a.y < b.y) end function vector.__le(a,b) return a.x <= b.x and a.y <= b.y end function vector.permul(a,b) assert(isvector(a) and isvector(b), "permul: wrong argument types (<vector> expected)") return new(a.x*b.x, a.y*b.y) end function vector:len2() return self.x * self.x + self.y * self.y end function vector:len() return sqrt(self.x * self.x + self.y * self.y) end function vector.dist(a, b) assert(isvector(a) and isvector(b), "dist: wrong argument types (<vector> expected)") local dx = a.x - b.x local dy = a.y - b.y return sqrt(dx * dx + dy * dy) end function vector.dist2(a, b) assert(isvector(a) and isvector(b), "dist: wrong argument types (<vector> expected)") local dx = a.x - b.x local dy = a.y - b.y return (dx * dx + dy * dy) end function vector:normalize_inplace() local l = self:len() if l > 0 then self.x, self.y = self.x / l, self.y / l end return self end function vector:normalized() return self:clone():normalize_inplace() end function vector:rotate_inplace(phi) local c, s = cos(phi), sin(phi) self.x, self.y = c * self.x - s * self.y, s * self.x + c * self.y return self end function vector:rotated(phi) local c, s = cos(phi), sin(phi) return new(c * self.x - s * self.y, s * self.x + c * self.y) end function vector:perpendicular() return new(-self.y, self.x) end function vector:projectOn(v) assert(isvector(v), "invalid argument: cannot project vector on " .. type(v)) -- (self * v) * v / v:len2() local s = (self.x * v.x + self.y * v.y) / (v.x * v.x + v.y * v.y) return new(s * v.x, s * v.y) end function vector:mirrorOn(v) assert(isvector(v), "invalid argument: cannot mirror vector on " .. type(v)) -- 2 * self:projectOn(v) - self local s = 2 * (self.x * v.x + self.y * v.y) / (v.x * v.x + v.y * v.y) return new(s * v.x - self.x, s * v.y - self.y) end function vector:cross(v) assert(isvector(v), "cross: wrong argument types (<vector> expected)") return self.x * v.y - self.y * v.x end -- ref.: http://blog.signalsondisplay.com/?p=336 function vector:trim_inplace(maxLen) local s = maxLen * maxLen / self:len2() s = (s > 1 and 1) or math.sqrt(s) self.x, self.y = self.x * s, self.y * s return self end function vector:angleTo(other) if other then return atan2(self.y, self.x) - atan2(other.y, other.x) end return atan2(self.y, self.x) end function vector:trimmed(maxLen) return self:clone():trim_inplace(maxLen) end -- the module return setmetatable({new = new, isvector = isvector, zero = zero}, {__call = function(_, ...) return new(...) end})
apache-2.0
ffxinfinity/ffxinfinity
FFXI Server-Development/Build Files/scripts/globals/spells/exuviation.lua
4
1201
----------------------------------------- -- Spell: Exuviation -- Restores HP and removes one detrimental magic effect. -- Can be used with Diffusion. -- Shamelessly stolen from http://members.shaw.ca/pizza_steve/cure/Cure_Calculator.html ----------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function OnMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) local minCure = 60; local divisor = 1; local constant = 40; local power = getCurePowerOld(caster); if(power > 99) then divisor = 57; constant = 79.125; elseif(power > 59) then divisor = 2; constant = 55; end local final = getCureFinal(caster,spell,getBaseCureOld(power,divisor,constant),minCure,true); final = final + (final * (target:getMod(MOD_CURE_POTENCY_RCVD)/100)); local diff = (target:getMaxHP() - target:getHP()); if(final > diff) then final = diff; end caster:eraseStatusEffect(); target:addHP(final); caster:updateEnmityFromCure(target,final); return final; end;
gpl-3.0
erfan1292/sezar2
plugins/fantasty_writter.lua
3
28777
local function run(msg, matches) if #matches < 2 then return "بعد از این دستور، با قید یک فاصله کلمه یا جمله ی مورد نظر را جهت زیبا نویسی وارد کنید" end if string.len(matches[2]) > 20 then return "حداکثر حروف مجاز 20 کاراکتر انگلیسی و عدد است" end local font_base = "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,9,8,7,6,5,4,3,2,1,.,_" local font_hash = "z,y,x,w,v,u,t,s,r,q,p,o,n,m,l,k,j,i,h,g,f,e,d,c,b,a,Z,Y,X,W,V,U,T,S,R,Q,P,O,N,M,L,K,J,I,H,G,F,E,D,C,B,A,0,1,2,3,4,5,6,7,8,9,.,_" local fonts = { "ⓐ,ⓑ,ⓒ,ⓓ,ⓔ,ⓕ,ⓖ,ⓗ,ⓘ,ⓙ,ⓚ,ⓛ,ⓜ,ⓝ,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,ⓣ,ⓤ,ⓥ,ⓦ,ⓧ,ⓨ,ⓩ,ⓐ,ⓑ,ⓒ,ⓓ,ⓔ,ⓕ,ⓖ,ⓗ,ⓘ,ⓙ,ⓚ,ⓛ,ⓜ,ⓝ,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,ⓣ,ⓤ,ⓥ,ⓦ,ⓧ,ⓨ,ⓩ,⓪,➈,➇,➆,➅,➄,➃,➂,➁,➀,●,_", "⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⓪,⑼,⑻,⑺,⑹,⑸,⑷,⑶,⑵,⑴,.,_", "α,в,c,∂,є,ƒ,g,н,ι,נ,к,ℓ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,χ,у,z,α,в,c,∂,є,ƒ,g,н,ι,נ,к,ℓ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,χ,у,z,0,9,8,7,6,5,4,3,2,1,.,_", "α,в,c,d,e,ғ,ɢ,н,ι,j,ĸ,l,м,ɴ,o,p,q,r,ѕ,т,υ,v,w,х,y,z,α,в,c,d,e,ғ,ɢ,н,ι,j,ĸ,l,м,ɴ,o,p,q,r,ѕ,т,υ,v,w,х,y,z,0,9,8,7,6,5,4,3,2,1,.,_", "α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,0,9,8,7,6,5,4,3,2,1,.,_", "ą,ҍ,ç,ժ,ҽ,ƒ,ց,հ,ì,ʝ,ҟ,Ӏ,ʍ,ղ,օ,ք,զ,ɾ,ʂ,է,մ,ѵ,ա,×,վ,Հ,ą,ҍ,ç,ժ,ҽ,ƒ,ց,հ,ì,ʝ,ҟ,Ӏ,ʍ,ղ,օ,ք,զ,ɾ,ʂ,է,մ,ѵ,ա,×,վ,Հ,⊘,९,𝟠,7,Ϭ,Ƽ,५,Ӡ,ϩ,𝟙,.,_", "ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,0,9,8,7,6,5,4,3,2,1,.,_", "α,ß,ς,d,ε,ƒ,g,h,ï,յ,κ,レ,m,η,⊕,p,Ω,r,š,†,u,∀,ω,x,ψ,z,α,ß,ς,d,ε,ƒ,g,h,ï,յ,κ,レ,m,η,⊕,p,Ω,r,š,†,u,∀,ω,x,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ム,乃,ζ,Ð,乇,キ,Ǥ,ん,ノ,フ,ズ,レ,ᄊ,刀,Ծ,ア,Q,尺,ㄎ,イ,Ц,Џ,Щ,メ,リ,乙,ム,乃,ζ,Ð,乇,キ,Ǥ,ん,ノ,フ,ズ,レ,ᄊ,刀,Ծ,ア,q,尺,ㄎ,イ,Ц,Џ,Щ,メ,リ,乙,ᅙ,9,8,ᆨ,6,5,4,3,ᆯ,1,.,_", "α,β,c,δ,ε,Ŧ,ĝ,h,ι,j,κ,l,ʍ,π,ø,ρ,φ,Ʀ,$,†,u,υ,ω,χ,ψ,z,α,β,c,δ,ε,Ŧ,ĝ,h,ι,j,κ,l,ʍ,π,ø,ρ,φ,Ʀ,$,†,u,υ,ω,χ,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ձ,ъ,ƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,ձ,ъ,ƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,ɓ,¢,Ɗ,£,ƒ,ɢ,ɦ,ĩ,ʝ,Қ,Ł,ɱ,ה,ø,Ṗ,Ҩ,Ŕ,Ş,Ŧ,Ū,Ɣ,ω,Ж,¥,Ẑ,Λ,ɓ,¢,Ɗ,£,ƒ,ɢ,ɦ,ĩ,ʝ,Қ,Ł,ɱ,ה,ø,Ṗ,Ҩ,Ŕ,Ş,Ŧ,Ū,Ɣ,ω,Ж,¥,Ẑ,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,Б,Ͼ,Ð,Ξ,Ŧ,G,H,ł,J,К,Ł,M,Л,Ф,P,Ǫ,Я,S,T,U,V,Ш,Ж,Џ,Z,Λ,Б,Ͼ,Ð,Ξ,Ŧ,g,h,ł,j,К,Ł,m,Л,Ф,p,Ǫ,Я,s,t,u,v,Ш,Ж,Џ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,0,9,8,7,6,5,4,3,2,1,.,_", "A̴,̴B̴,̴C̴,̴D̴,̴E̴,̴F̴,̴G̴,̴H̴,̴I̴,̴J̴,̴K̴,̴L̴,̴M̴,̴N̴,̴O̴,̴P̴,̴Q̴,̴R̴,̴S̴,̴T̴,̴U̴,̴V̴,̴W̴,̴X̴,̴Y̴,̴Z̴,̴a̴,̴b̴,̴c̴,̴d̴,̴e̴,̴f̴,̴g̴,̴h̴,̴i̴,̴j̴,̴k̴,̴l̴,̴m̴,̴n̴,̴o̴,̴p̴,̴q̴,̴r̴,̴s̴,̴t̴,̴u̴,̴v̴,̴w̴,̴x̴,̴y̴,̴z̴,̴0̴,̴9̴,̴8̴,̴7̴,̴6̴,̴5̴,̴4̴,̴3̴,̴2̴,̴1̴,̴.̴,̴_̴", "ⓐ,ⓑ,ⓒ,ⓓ,ⓔ,ⓕ,ⓖ,ⓗ,ⓘ,ⓙ,ⓚ,ⓛ,ⓜ,ⓝ,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,ⓣ,ⓤ,ⓥ,ⓦ,ⓧ,ⓨ,ⓩ,ⓐ,ⓑ,ⓒ,ⓓ,ⓔ,ⓕ,ⓖ,ⓗ,ⓘ,ⓙ,ⓚ,ⓛ,ⓜ,ⓝ,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,ⓣ,ⓤ,ⓥ,ⓦ,ⓧ,ⓨ,ⓩ,⓪,➈,➇,➆,➅,➄,➃,➂,➁,➀,●,_", "⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⓪,⑼,⑻,⑺,⑹,⑸,⑷,⑶,⑵,⑴,.,_", "α,в,c,∂,є,ƒ,g,н,ι,נ,к,ℓ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,χ,у,z,α,в,c,∂,є,ƒ,g,н,ι,נ,к,ℓ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,χ,у,z,0,9,8,7,6,5,4,3,2,1,.,_", "α,в,c,ɗ,є,f,g,н,ι,נ,к,Ɩ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,x,у,z,α,в,c,ɗ,є,f,g,н,ι,נ,к,Ɩ,м,η,σ,ρ,q,я,ѕ,т,υ,ν,ω,x,у,z,0,9,8,7,6,5,4,3,2,1,.,_", "α,в,c,d,e,ғ,ɢ,н,ι,j,ĸ,l,м,ɴ,o,p,q,r,ѕ,т,υ,v,w,х,y,z,α,в,c,d,e,ғ,ɢ,н,ι,j,ĸ,l,м,ɴ,o,p,q,r,ѕ,т,υ,v,w,х,y,z,0,9,8,7,6,5,4,3,2,1,.,_", "α,Ⴆ,ƈ,ԃ,ҽ,ϝ,ɠ,ԋ,ι,ʝ,ƙ,ʅ,ɱ,ɳ,σ,ρ,ϙ,ɾ,ʂ,ƚ,υ,ʋ,ɯ,x,ყ,ȥ,α,Ⴆ,ƈ,ԃ,ҽ,ϝ,ɠ,ԋ,ι,ʝ,ƙ,ʅ,ɱ,ɳ,σ,ρ,ϙ,ɾ,ʂ,ƚ,υ,ʋ,ɯ,x,ყ,ȥ,0,9,8,7,6,5,4,3,2,1,.,_", "α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,0,9,8,7,6,5,4,3,2,1,.,_", "ą,ɓ,ƈ,đ,ε,∱,ɠ,ɧ,ï,ʆ,ҡ,ℓ,ɱ,ŋ,σ,þ,ҩ,ŗ,ş,ŧ,ų,√,щ,х,γ,ẕ,ą,ɓ,ƈ,đ,ε,∱,ɠ,ɧ,ï,ʆ,ҡ,ℓ,ɱ,ŋ,σ,þ,ҩ,ŗ,ş,ŧ,ų,√,щ,х,γ,ẕ,0,9,8,7,6,5,4,3,2,1,.,_", "ą,ҍ,ç,ժ,ҽ,ƒ,ց,հ,ì,ʝ,ҟ,Ӏ,ʍ,ղ,օ,ք,զ,ɾ,ʂ,է,մ,ѵ,ա,×,վ,Հ,ą,ҍ,ç,ժ,ҽ,ƒ,ց,հ,ì,ʝ,ҟ,Ӏ,ʍ,ղ,օ,ք,զ,ɾ,ʂ,է,մ,ѵ,ա,×,վ,Հ,⊘,९,𝟠,7,Ϭ,Ƽ,५,Ӡ,ϩ,𝟙,.,_", "მ,ჩ,ƈ,ძ,ε,բ,ց,հ,ἶ,ʝ,ƙ,l,ო,ղ,օ,ր,գ,ɾ,ʂ,է,մ,ν,ω,ჯ,ყ,z,მ,ჩ,ƈ,ძ,ε,բ,ց,հ,ἶ,ʝ,ƙ,l,ო,ղ,օ,ր,գ,ɾ,ʂ,է,մ,ν,ω,ჯ,ყ,z,0,Գ,Ց,Դ,6,5,Վ,Յ,Զ,1,.,_", "ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,0,9,8,7,6,5,4,3,2,1,.,_", "α,ß,ς,d,ε,ƒ,g,h,ï,յ,κ,レ,m,η,⊕,p,Ω,r,š,†,u,∀,ω,x,ψ,z,α,ß,ς,d,ε,ƒ,g,h,ï,յ,κ,レ,m,η,⊕,p,Ω,r,š,†,u,∀,ω,x,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ª,b,¢,Þ,È,F,૬,ɧ,Î,j,Κ,Ļ,м,η,◊,Ƿ,ƍ,r,S,⊥,µ,√,w,×,ý,z,ª,b,¢,Þ,È,F,૬,ɧ,Î,j,Κ,Ļ,м,η,◊,Ƿ,ƍ,r,S,⊥,µ,√,w,×,ý,z,0,9,8,7,6,5,4,3,2,1,.,_", "Δ,Ɓ,C,D,Σ,F,G,H,I,J,Ƙ,L,Μ,∏,Θ,Ƥ,Ⴓ,Γ,Ѕ,Ƭ,Ʊ,Ʋ,Ш,Ж,Ψ,Z,λ,ϐ,ς,d,ε,ғ,ɢ,н,ι,ϳ,κ,l,ϻ,π,σ,ρ,φ,г,s,τ,υ,v,ш,ϰ,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,ß,Ƈ,D,Ɛ,F,Ɠ,Ĥ,Ī,Ĵ,Ҡ,Ŀ,M,И,♡,Ṗ,Ҩ,Ŕ,S,Ƭ,Ʊ,Ѵ,Ѡ,Ӿ,Y,Z,Λ,ß,Ƈ,D,Ɛ,F,Ɠ,Ĥ,Ī,Ĵ,Ҡ,Ŀ,M,И,♡,Ṗ,Ҩ,Ŕ,S,Ƭ,Ʊ,Ѵ,Ѡ,Ӿ,Y,Z,0,9,8,7,6,5,4,3,2,1,.,_", "ム,乃,ζ,Ð,乇,キ,Ǥ,ん,ノ,フ,ズ,レ,ᄊ,刀,Ծ,ア,Q,尺,ㄎ,イ,Ц,Џ,Щ,メ,リ,乙,ム,乃,ζ,Ð,乇,キ,Ǥ,ん,ノ,フ,ズ,レ,ᄊ,刀,Ծ,ア,q,尺,ㄎ,イ,Ц,Џ,Щ,メ,リ,乙,ᅙ,9,8,ᆨ,6,5,4,3,ᆯ,1,.,_", "α,β,c,δ,ε,Ŧ,ĝ,h,ι,j,κ,l,ʍ,π,ø,ρ,φ,Ʀ,$,†,u,υ,ω,χ,ψ,z,α,β,c,δ,ε,Ŧ,ĝ,h,ι,j,κ,l,ʍ,π,ø,ρ,φ,Ʀ,$,†,u,υ,ω,χ,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ค,๖,¢,໓,ē,f,ງ,h,i,ว,k,l,๓,ຖ,໐,p,๑,r,Ş,t,น,ง,ຟ,x,ฯ,ຊ,ค,๖,¢,໓,ē,f,ງ,h,i,ว,k,l,๓,ຖ,໐,p,๑,r,Ş,t,น,ง,ຟ,x,ฯ,ຊ,0,9,8,7,6,5,4,3,2,1,.,_", "ձ,ъ,ƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,ձ,ъ,ƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,0,9,8,7,6,5,4,3,2,1,.,_", "Â,ß,Ĉ,Ð,Є,Ŧ,Ǥ,Ħ,Ī,ʖ,Қ,Ŀ,♏,И,Ø,P,Ҩ,R,$,ƚ,Ц,V,Щ,X,¥,Ẕ,Â,ß,Ĉ,Ð,Є,Ŧ,Ǥ,Ħ,Ī,ʖ,Қ,Ŀ,♏,И,Ø,P,Ҩ,R,$,ƚ,Ц,V,Щ,X,¥,Ẕ,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,ɓ,¢,Ɗ,£,ƒ,ɢ,ɦ,ĩ,ʝ,Қ,Ł,ɱ,ה,ø,Ṗ,Ҩ,Ŕ,Ş,Ŧ,Ū,Ɣ,ω,Ж,¥,Ẑ,Λ,ɓ,¢,Ɗ,£,ƒ,ɢ,ɦ,ĩ,ʝ,Қ,Ł,ɱ,ה,ø,Ṗ,Ҩ,Ŕ,Ş,Ŧ,Ū,Ɣ,ω,Ж,¥,Ẑ,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,Б,Ͼ,Ð,Ξ,Ŧ,G,H,ł,J,К,Ł,M,Л,Ф,P,Ǫ,Я,S,T,U,V,Ш,Ж,Џ,Z,Λ,Б,Ͼ,Ð,Ξ,Ŧ,g,h,ł,j,К,Ł,m,Л,Ф,p,Ǫ,Я,s,t,u,v,Ш,Ж,Џ,z,0,9,8,7,6,5,4,3,2,1,.,_", "Թ,Յ,Շ,Ժ,ȝ,Բ,Գ,ɧ,ɿ,ʝ,ƙ,ʅ,ʍ,Ռ,Ծ,ρ,φ,Ր,Տ,Ե,Մ,ע,ա,Ճ,Վ,Հ,Թ,Յ,Շ,Ժ,ȝ,Բ,Գ,ɧ,ɿ,ʝ,ƙ,ʅ,ʍ,Ռ,Ծ,ρ,φ,Ր,Տ,Ե,Մ,ע,ա,Ճ,Վ,Հ,0,9,8,7,6,5,4,3,2,1,.,_", "Æ,þ,©,Ð,E,F,ζ,Ħ,Ї,¿,ズ,ᄂ,M,Ñ,Θ,Ƿ,Ø,Ґ,Š,τ,υ,¥,w,χ,y,շ,Æ,þ,©,Ð,E,F,ζ,Ħ,Ї,¿,ズ,ᄂ,M,Ñ,Θ,Ƿ,Ø,Ґ,Š,τ,υ,¥,w,χ,y,շ,0,9,8,7,6,5,4,3,2,1,.,_", "ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,0,9,8,7,6,5,4,3,2,1,.,_", "4,8,C,D,3,F,9,H,!,J,K,1,M,N,0,P,Q,R,5,7,U,V,W,X,Y,2,4,8,C,D,3,F,9,H,!,J,K,1,M,N,0,P,Q,R,5,7,U,V,W,X,Y,2,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,M,X,ʎ,Z,ɐ,q,ɔ,p,ǝ,ɟ,ƃ,ɥ,ı,ɾ,ʞ,l,ա,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,Λ,M,X,ʎ,Z,ɐ,q,ɔ,p,ǝ,ɟ,ƃ,ɥ,ı,ɾ,ʞ,l,ա,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,0,9,8,7,6,5,4,3,2,1,.,‾", "A̴,̴B̴,̴C̴,̴D̴,̴E̴,̴F̴,̴G̴,̴H̴,̴I̴,̴J̴,̴K̴,̴L̴,̴M̴,̴N̴,̴O̴,̴P̴,̴Q̴,̴R̴,̴S̴,̴T̴,̴U̴,̴V̴,̴W̴,̴X̴,̴Y̴,̴Z̴,̴a̴,̴b̴,̴c̴,̴d̴,̴e̴,̴f̴,̴g̴,̴h̴,̴i̴,̴j̴,̴k̴,̴l̴,̴m̴,̴n̴,̴o̴,̴p̴,̴q̴,̴r̴,̴s̴,̴t̴,̴u̴,̴v̴,̴w̴,̴x̴,̴y̴,̴z̴,̴0̴,̴9̴,̴8̴,̴7̴,̴6̴,̴5̴,̴4̴,̴3̴,̴2̴,̴1̴,̴.̴,̴_̴", "A̱,̱Ḇ,̱C̱,̱Ḏ,̱E̱,̱F̱,̱G̱,̱H̱,̱I̱,̱J̱,̱Ḵ,̱Ḻ,̱M̱,̱Ṉ,̱O̱,̱P̱,̱Q̱,̱Ṟ,̱S̱,̱Ṯ,̱U̱,̱V̱,̱W̱,̱X̱,̱Y̱,̱Ẕ,̱a̱,̱ḇ,̱c̱,̱ḏ,̱e̱,̱f̱,̱g̱,̱ẖ,̱i̱,̱j̱,̱ḵ,̱ḻ,̱m̱,̱ṉ,̱o̱,̱p̱,̱q̱,̱ṟ,̱s̱,̱ṯ,̱u̱,̱v̱,̱w̱,̱x̱,̱y̱,̱ẕ,̱0̱,̱9̱,̱8̱,̱7̱,̱6̱,̱5̱,̱4̱,̱3̱,̱2̱,̱1̱,̱.̱,̱_̱", "A̲,̲B̲,̲C̲,̲D̲,̲E̲,̲F̲,̲G̲,̲H̲,̲I̲,̲J̲,̲K̲,̲L̲,̲M̲,̲N̲,̲O̲,̲P̲,̲Q̲,̲R̲,̲S̲,̲T̲,̲U̲,̲V̲,̲W̲,̲X̲,̲Y̲,̲Z̲,̲a̲,̲b̲,̲c̲,̲d̲,̲e̲,̲f̲,̲g̲,̲h̲,̲i̲,̲j̲,̲k̲,̲l̲,̲m̲,̲n̲,̲o̲,̲p̲,̲q̲,̲r̲,̲s̲,̲t̲,̲u̲,̲v̲,̲w̲,̲x̲,̲y̲,̲z̲,̲0̲,̲9̲,̲8̲,̲7̲,̲6̲,̲5̲,̲4̲,̲3̲,̲2̲,̲1̲,̲.̲,̲_̲", "Ā,̄B̄,̄C̄,̄D̄,̄Ē,̄F̄,̄Ḡ,̄H̄,̄Ī,̄J̄,̄K̄,̄L̄,̄M̄,̄N̄,̄Ō,̄P̄,̄Q̄,̄R̄,̄S̄,̄T̄,̄Ū,̄V̄,̄W̄,̄X̄,̄Ȳ,̄Z̄,̄ā,̄b̄,̄c̄,̄d̄,̄ē,̄f̄,̄ḡ,̄h̄,̄ī,̄j̄,̄k̄,̄l̄,̄m̄,̄n̄,̄ō,̄p̄,̄q̄,̄r̄,̄s̄,̄t̄,̄ū,̄v̄,̄w̄,̄x̄,̄ȳ,̄z̄,̄0̄,̄9̄,̄8̄,̄7̄,̄6̄,̄5̄,̄4̄,̄3̄,̄2̄,̄1̄,̄.̄,̄_̄", "A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,0,9,8,7,6,5,4,3,2,1,.,_", "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,9,8,7,6,5,4,3,2,1,.,_", "@,♭,ḉ,ⓓ,℮,ƒ,ℊ,ⓗ,ⓘ,נ,ⓚ,ℓ,ⓜ,η,ø,℘,ⓠ,ⓡ,﹩,т,ⓤ,√,ω,ж,૪,ℨ,@,♭,ḉ,ⓓ,℮,ƒ,ℊ,ⓗ,ⓘ,נ,ⓚ,ℓ,ⓜ,η,ø,℘,ⓠ,ⓡ,﹩,т,ⓤ,√,ω,ж,૪,ℨ,0,➈,➑,➐,➅,➄,➃,➌,➁,➊,.,_", "@,♭,¢,ⅾ,ε,ƒ,ℊ,ℌ,ї,נ,к,ℓ,м,п,ø,ρ,ⓠ,ґ,﹩,⊥,ü,√,ω,ϰ,૪,ℨ,@,♭,¢,ⅾ,ε,ƒ,ℊ,ℌ,ї,נ,к,ℓ,м,п,ø,ρ,ⓠ,ґ,﹩,⊥,ü,√,ω,ϰ,૪,ℨ,0,9,8,7,6,5,4,3,2,1,.,_", "α,♭,ḉ,∂,ℯ,ƒ,ℊ,ℌ,ї,ʝ,ḱ,ℓ,м,η,ø,℘,ⓠ,я,﹩,⊥,ц,ṽ,ω,ჯ,૪,ẕ,α,♭,ḉ,∂,ℯ,ƒ,ℊ,ℌ,ї,ʝ,ḱ,ℓ,м,η,ø,℘,ⓠ,я,﹩,⊥,ц,ṽ,ω,ჯ,૪,ẕ,0,9,8,7,6,5,4,3,2,1,.,_", "@,ß,¢,ḓ,℮,ƒ,ℊ,ℌ,ї,נ,ḱ,ʟ,м,п,◎,℘,ⓠ,я,﹩,т,ʊ,♥️,ẘ,✄,૪,ℨ,@,ß,¢,ḓ,℮,ƒ,ℊ,ℌ,ї,נ,ḱ,ʟ,м,п,◎,℘,ⓠ,я,﹩,т,ʊ,♥️,ẘ,✄,૪,ℨ,0,9,8,7,6,5,4,3,2,1,.,_", "@,ß,¢,ḓ,℮,ƒ,ℊ,н,ḯ,נ,к,ℓμ,п,☺️,℘,ⓠ,я,﹩,⊥,υ,ṽ,ω,✄,૪,ℨ,@,ß,¢,ḓ,℮,ƒ,ℊ,н,ḯ,נ,к,ℓμ,п,☺️,℘,ⓠ,я,﹩,⊥,υ,ṽ,ω,✄,૪,ℨ,0,9,8,7,6,5,4,3,2,1,.,_", "@,ß,ḉ,ḓ,є,ƒ,ℊ,ℌ,ї,נ,ḱ,ʟ,ღ,η,◎,℘,ⓠ,я,﹩,⊥,ʊ,♥️,ω,ϰ,૪,ẕ,@,ß,ḉ,ḓ,є,ƒ,ℊ,ℌ,ї,נ,ḱ,ʟ,ღ,η,◎,℘,ⓠ,я,﹩,⊥,ʊ,♥️,ω,ϰ,૪,ẕ,0,9,8,7,6,5,4,3,2,1,.,_", "@,ß,ḉ,∂,ε,ƒ,ℊ,ℌ,ї,נ,ḱ,ł,ღ,и,ø,℘,ⓠ,я,﹩,т,υ,√,ω,ჯ,૪,ẕ,@,ß,ḉ,∂,ε,ƒ,ℊ,ℌ,ї,נ,ḱ,ł,ღ,и,ø,℘,ⓠ,я,﹩,т,υ,√,ω,ჯ,૪,ẕ,0,9,8,7,6,5,4,3,2,1,.,_", "α,♭,¢,∂,ε,ƒ,❡,н,ḯ,ʝ,ḱ,ʟ,μ,п,ø,ρ,ⓠ,ґ,﹩,т,υ,ṽ,ω,ж,૪,ẕ,α,♭,¢,∂,ε,ƒ,❡,н,ḯ,ʝ,ḱ,ʟ,μ,п,ø,ρ,ⓠ,ґ,﹩,т,υ,ṽ,ω,ж,૪,ẕ,0,9,8,7,6,5,4,3,2,1,.,_", "α,♭,ḉ,∂,℮,ⓕ,ⓖ,н,ḯ,ʝ,ḱ,ℓ,м,п,ø,ⓟ,ⓠ,я,ⓢ,ⓣ,ⓤ,♥️,ⓦ,✄,ⓨ,ⓩ,α,♭,ḉ,∂,℮,ⓕ,ⓖ,н,ḯ,ʝ,ḱ,ℓ,м,п,ø,ⓟ,ⓠ,я,ⓢ,ⓣ,ⓤ,♥️,ⓦ,✄,ⓨ,ⓩ,0,➒,➑,➐,➏,➄,➍,➂,➁,➀,.,_", "@,♭,ḉ,ḓ,є,ƒ,ⓖ,ℌ,ⓘ,נ,к,ⓛ,м,ⓝ,ø,℘,ⓠ,я,﹩,ⓣ,ʊ,√,ω,ჯ,૪,ⓩ,@,♭,ḉ,ḓ,є,ƒ,ⓖ,ℌ,ⓘ,נ,к,ⓛ,м,ⓝ,ø,℘,ⓠ,я,﹩,ⓣ,ʊ,√,ω,ჯ,૪,ⓩ,0,➒,➇,➆,➅,➄,➍,➌,➋,➀,.,_", "α,♭,ⓒ,∂,є,ⓕ,ⓖ,ℌ,ḯ,ⓙ,ḱ,ł,ⓜ,и,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,⊥,ʊ,ⓥ,ⓦ,ж,ⓨ,ⓩ,α,♭,ⓒ,∂,є,ⓕ,ⓖ,ℌ,ḯ,ⓙ,ḱ,ł,ⓜ,и,ⓞ,ⓟ,ⓠ,ⓡ,ⓢ,⊥,ʊ,ⓥ,ⓦ,ж,ⓨ,ⓩ,0,➒,➑,➆,➅,➎,➍,➌,➁,➀,.,_", "ⓐ,ß,ḉ,∂,℮,ⓕ,❡,ⓗ,ї,נ,ḱ,ł,μ,η,ø,ρ,ⓠ,я,﹩,ⓣ,ц,√,ⓦ,✖️,૪,ℨ,ⓐ,ß,ḉ,∂,℮,ⓕ,❡,ⓗ,ї,נ,ḱ,ł,μ,η,ø,ρ,ⓠ,я,﹩,ⓣ,ц,√,ⓦ,✖️,૪,ℨ,0,➒,➑,➐,➅,➄,➍,➂,➁,➊,.,_", "α,ß,ⓒ,ⅾ,ℯ,ƒ,ℊ,ⓗ,ї,ʝ,к,ʟ,ⓜ,η,ⓞ,℘,ⓠ,ґ,﹩,т,υ,ⓥ,ⓦ,ж,ⓨ,ẕ,α,ß,ⓒ,ⅾ,ℯ,ƒ,ℊ,ⓗ,ї,ʝ,к,ʟ,ⓜ,η,ⓞ,℘,ⓠ,ґ,﹩,т,υ,ⓥ,ⓦ,ж,ⓨ,ẕ,0,➈,➇,➐,➅,➎,➍,➌,➁,➊,.,_", "@,♭,ḉ,ⅾ,є,ⓕ,❡,н,ḯ,נ,ⓚ,ⓛ,м,ⓝ,☺️,ⓟ,ⓠ,я,ⓢ,⊥,υ,♥️,ẘ,ϰ,૪,ⓩ,@,♭,ḉ,ⅾ,є,ⓕ,❡,н,ḯ,נ,ⓚ,ⓛ,м,ⓝ,☺️,ⓟ,ⓠ,я,ⓢ,⊥,υ,♥️,ẘ,ϰ,૪,ⓩ,0,➒,➑,➆,➅,➄,➃,➂,➁,➀,.,_", "ⓐ,♭,ḉ,ⅾ,є,ƒ,ℊ,ℌ,ḯ,ʝ,ḱ,ł,μ,η,ø,ⓟ,ⓠ,ґ,ⓢ,т,ⓤ,√,ⓦ,✖️,ⓨ,ẕ,ⓐ,♭,ḉ,ⅾ,є,ƒ,ℊ,ℌ,ḯ,ʝ,ḱ,ł,μ,η,ø,ⓟ,ⓠ,ґ,ⓢ,т,ⓤ,√,ⓦ,✖️,ⓨ,ẕ,0,➈,➇,➐,➅,➄,➃,➂,➁,➀,.,_", "ձ,ъƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,ձ,ъƈ,ժ,ε,բ,ց,հ,ﻨ,յ,ĸ,l,ო,ռ,օ,թ,զ,г,ร,է,ս,ν,ա,×,ყ,২,0,9,8,7,6,5,4,3,2,1,.,_", "λ,ϐ,ς,d,ε,ғ,ϑ,ɢ,н,ι,ϳ,κ,l,ϻ,π,σ,ρ,φ,г,s,τ,υ,v,ш,ϰ,ψ,z,λ,ϐ,ς,d,ε,ғ,ϑ,ɢ,н,ι,ϳ,κ,l,ϻ,π,σ,ρ,φ,г,s,τ,υ,v,ш,ϰ,ψ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,ค,๒,ς,๔,є,Ŧ,ɠ,ђ,เ,ן,к,l,๓,ภ,๏,թ,ợ,г,ร,t,ย,v,ฬ,x,ץ,z,0,9,8,7,6,5,4,3,2,1,.,_", "მ,ჩ,ƈძ,ε,բ,ց,հ,ἶ,ʝ,ƙ,l,ო,ղ,օ,ր,գ,ɾ,ʂ,է,մ,ν,ω,ჯ,ყ,z,მ,ჩ,ƈძ,ε,բ,ց,հ,ἶ,ʝ,ƙ,l,ო,ղ,օ,ր,գ,ɾ,ʂ,է,մ,ν,ω,ჯ,ყ,z,0,Գ,Ց,Դ,6,5,Վ,Յ,Զ,1,.,_", "ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,ค,ც,८,ძ,૯,Բ,૭,Һ,ɿ,ʆ,қ,Ն,ɱ,Ո,૦,ƿ,ҩ,Ր,ς,੮,υ,౮,ω,૪,ע,ઽ,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,Б,Ͼ,Ð,Ξ,Ŧ,g,h,ł,j,К,Ł,m,Л,Ф,p,Ǫ,Я,s,t,u,v,Ш,Ж,Џ,z,Λ,Б,Ͼ,Ð,Ξ,Ŧ,g,h,ł,j,К,Ł,m,Л,Ф,p,Ǫ,Я,s,t,u,v,Ш,Ж,Џ,z,0,9,8,7,6,5,4,3,2,1,.,_", "λ,ß,Ȼ,ɖ,ε,ʃ,Ģ,ħ,ί,ĵ,κ,ι,ɱ,ɴ,Θ,ρ,ƣ,ર,Ș,τ,Ʋ,ν,ώ,Χ,ϓ,Հ,λ,ß,Ȼ,ɖ,ε,ʃ,Ģ,ħ,ί,ĵ,κ,ι,ɱ,ɴ,Θ,ρ,ƣ,ર,Ș,τ,Ʋ,ν,ώ,Χ,ϓ,Հ,0,9,8,7,6,5,4,3,2,1,.,_", "ª,b,¢,Þ,È,F,૬,ɧ,Î,j,Κ,Ļ,м,η,◊,Ƿ,ƍ,r,S,⊥,µ,√,w,×,ý,z,ª,b,¢,Þ,È,F,૬,ɧ,Î,j,Κ,Ļ,м,η,◊,Ƿ,ƍ,r,S,⊥,µ,√,w,×,ý,z,0,9,8,7,6,5,4,3,2,1,.,_", "Թ,Յ,Շ,Ժ,ȝ,Բ,Գ,ɧ,ɿ,ʝ,ƙ,ʅ,ʍ,Ռ,Ծ,ρ,φ,Ր,Տ,Ե,Մ,ע,ա,Ճ,Վ,Հ,Թ,Յ,Շ,Ժ,ȝ,Բ,Գ,ɧ,ɿ,ʝ,ƙ,ʅ,ʍ,Ռ,Ծ,ρ,φ,Ր,Տ,Ե,Մ,ע,ա,Ճ,Վ,Հ,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,Ϧ,ㄈ,Ð,Ɛ,F,Ɠ,н,ɪ,フ,Қ,Ł,௱,Л,Ø,þ,Ҩ,尺,ら,Ť,Ц,Ɣ,Ɯ,χ,Ϥ,Ẕ,Λ,Ϧ,ㄈ,Ð,Ɛ,F,Ɠ,н,ɪ,フ,Қ,Ł,௱,Л,Ø,þ,Ҩ,尺,ら,Ť,Ц,Ɣ,Ɯ,χ,Ϥ,Ẕ,0,9,8,7,6,5,4,3,2,1,.,_", "Ǟ,в,ट,D,ę,բ,g,৸,i,j,κ,l,ɱ,П,Φ,Р,q,Я,s,Ʈ,Ц,v,Щ,ж,ყ,ւ,Ǟ,в,ट,D,ę,բ,g,৸,i,j,κ,l,ɱ,П,Φ,Р,q,Я,s,Ʈ,Ц,v,Щ,ж,ყ,ւ,0,9,8,7,6,5,4,3,2,1,.,_", "ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,ɒ,d,ɔ,b,ɘ,ʇ,ϱ,н,i,į,ʞ,l,м,и,o,q,p,я,ƨ,т,υ,v,w,x,γ,z,0,9,8,7,6,5,4,3,2,1,.,_", "Æ,þ,©,Ð,E,F,ζ,Ħ,Ї,¿,ズ,ᄂ,M,Ñ,Θ,Ƿ,Ø,Ґ,Š,τ,υ,¥,w,χ,y,շ,Æ,þ,©,Ð,E,F,ζ,Ħ,Ї,¿,ズ,ᄂ,M,Ñ,Θ,Ƿ,Ø,Ґ,Š,τ,υ,¥,w,χ,y,շ,0,9,8,7,6,5,4,3,2,1,.,_", "ª,ß,¢,ð,€,f,g,h,¡,j,k,|,m,ñ,¤,Þ,q,®,$,t,µ,v,w,×,ÿ,z,ª,ß,¢,ð,€,f,g,h,¡,j,k,|,m,ñ,¤,Þ,q,®,$,t,µ,v,w,×,ÿ,z,0,9,8,7,6,5,4,3,2,1,.,_", "ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,ɐ,q,ɔ,p,ǝ,ɟ,ɓ,ɥ,ı,ſ,ʞ,ๅ,ɯ,u,o,d,b,ɹ,s,ʇ,n,ʌ,ʍ,x,ʎ,z,0,9,8,7,6,5,4,3,2,1,.,_", "⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⒜,⒝,⒞,⒟,⒠,⒡,⒢,⒣,⒤,⒥,⒦,⒧,⒨,⒩,⒪,⒫,⒬,⒭,⒮,⒯,⒰,⒱,⒲,⒳,⒴,⒵,⒪,⑼,⑻,⑺,⑹,⑸,⑷,⑶,⑵,⑴,.,_", "ɑ,ʙ,c,ᴅ,є,ɻ,მ,ʜ,ι,ɿ,ĸ,г,w,и,o,ƅϭ,ʁ,ƨ,⊥,n,ʌ,ʍ,x,⑃,z,ɑ,ʙ,c,ᴅ,є,ɻ,მ,ʜ,ι,ɿ,ĸ,г,w,и,o,ƅϭ,ʁ,ƨ,⊥,n,ʌ,ʍ,x,⑃,z,0,9,8,7,6,5,4,3,2,1,.,_", "4,8,C,D,3,F,9,H,!,J,K,1,M,N,0,P,Q,R,5,7,U,V,W,X,Y,2,4,8,C,D,3,F,9,H,!,J,K,1,M,N,0,P,Q,R,5,7,U,V,W,X,Y,2,0,9,8,7,6,5,4,3,2,1,.,_", "Λ,ßƇ,D,Ɛ,F,Ɠ,Ĥ,Ī,Ĵ,Ҡ,Ŀ,M,И,♡,Ṗ,Ҩ,Ŕ,S,Ƭ,Ʊ,Ѵ,Ѡ,Ӿ,Y,Z,Λ,ßƇ,D,Ɛ,F,Ɠ,Ĥ,Ī,Ĵ,Ҡ,Ŀ,M,И,♡,Ṗ,Ҩ,Ŕ,S,Ƭ,Ʊ,Ѵ,Ѡ,Ӿ,Y,Z,0,9,8,7,6,5,4,3,2,1,.,_", "α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,α,в,¢,đ,e,f,g,ħ,ı,נ,κ,ł,м,и,ø,ρ,q,я,š,т,υ,ν,ω,χ,ч,z,0,9,8,7,6,5,4,3,2,1,.,_", "α,в,c,ɔ,ε,ғ,ɢ,н,ı,נ,κ,ʟ,м,п,σ,ρ,ǫ,я,ƨ,т,υ,ν,ш,х,ч,z,α,в,c,ɔ,ε,ғ,ɢ,н,ı,נ,κ,ʟ,м,п,σ,ρ,ǫ,я,ƨ,т,υ,ν,ш,х,ч,z,0,9,8,7,6,5,4,3,2,1,.,_", "【a】,【b】,【c】,【d】,【e】,【f】,【g】,【h】,【i】,【j】,【k】,【l】,【m】,【n】,【o】,【p】,【q】,【r】,【s】,【t】,【u】,【v】,【w】,【x】,【y】,【z】,【a】,【b】,【c】,【d】,【e】,【f】,【g】,【h】,【i】,【j】,【k】,【l】,【m】,【n】,【o】,【p】,【q】,【r】,【s】,【t】,【u】,【v】,【w】,【x】,【y】,【z】,【0】,【9】,【8】,【7】,【6】,【5】,【4】,【3】,【2】,【1】,.,_", "[̲̲̅̅a̲̅,̲̅b̲̲̅,̅c̲̅,̲̅d̲̲̅,̅e̲̲̅,̅f̲̲̅,̅g̲̅,̲̅h̲̲̅,̅i̲̲̅,̅j̲̲̅,̅k̲̅,̲̅l̲̲̅,̅m̲̅,̲̅n̲̅,̲̅o̲̲̅,̅p̲̅,̲̅q̲̅,̲̅r̲̲̅,̅s̲̅,̲̅t̲̲̅,̅u̲̅,̲̅v̲̅,̲̅w̲̅,̲̅x̲̅,̲̅y̲̅,̲̅z̲̅,[̲̲̅̅a̲̅,̲̅b̲̲̅,̅c̲̅,̲̅d̲̲̅,̅e̲̲̅,̅f̲̲̅,̅g̲̅,̲̅h̲̲̅,̅i̲̲̅,̅j̲̲̅,̅k̲̅,̲̅l̲̲̅,̅m̲̅,̲̅n̲̅,̲̅o̲̲̅,̅p̲̅,̲̅q̲̅,̲̅r̲̲̅,̅s̲̅,̲̅t̲̲̅,̅u̲̅,̲̅v̲̅,̲̅w̲̅,̲̅x̲̅,̲̅y̲̅,̲̅z̲̅,̲̅0̲̅,̲̅9̲̲̅,̅8̲̅,̲̅7̲̅,̲̅6̲̅,̲̅5̲̅,̲̅4̲̅,̲̅3̲̲̅,̅2̲̲̅,̅1̲̲̅̅],.,_", "[̺͆a̺͆͆,̺b̺͆͆,̺c̺͆,̺͆d̺͆,̺͆e̺͆,̺͆f̺͆͆,̺g̺͆,̺͆h̺͆,̺͆i̺͆,̺͆j̺͆,̺͆k̺͆,̺l̺͆͆,̺m̺͆͆,̺n̺͆͆,̺o̺͆,̺͆p̺͆͆,̺q̺͆͆,̺r̺͆͆,̺s̺͆͆,̺t̺͆͆,̺u̺͆͆,̺v̺͆͆,̺w̺͆,̺͆x̺͆,̺͆y̺͆,̺͆z̺,[̺͆a̺͆͆,̺b̺͆͆,̺c̺͆,̺͆d̺͆,̺͆e̺͆,̺͆f̺͆͆,̺g̺͆,̺͆h̺͆,̺͆i̺͆,̺͆j̺͆,̺͆k̺͆,̺l̺͆͆,̺m̺͆͆,̺n̺͆͆,̺o̺͆,̺͆p̺͆͆,̺q̺͆͆,̺r̺͆͆,̺s̺͆͆,̺t̺͆͆,̺u̺͆͆,̺v̺͆͆,̺w̺͆,̺͆x̺͆,̺͆y̺͆,̺͆z̺,̺͆͆0̺͆,̺͆9̺͆,̺͆8̺̺͆͆7̺͆,̺͆6̺͆,̺͆5̺͆,̺͆4̺͆,̺͆3̺͆,̺͆2̺͆,̺͆1̺͆],.,_", "̛̭̰̃ã̛̰̭,̛̭̰̃b̛̰̭̃̃,̛̭̰c̛̛̰̭̃̃,̭̰d̛̰̭̃,̛̭̰̃ḛ̛̭̃̃,̛̭̰f̛̰̭̃̃,̛̭̰g̛̰̭̃̃,̛̭̰h̛̰̭̃,̛̭̰̃ḭ̛̛̭̃̃,̭̰j̛̰̭̃̃,̛̭̰k̛̰̭̃̃,̛̭̰l̛̰̭,̛̭̰̃m̛̰̭̃̃,̛̭̰ñ̛̛̰̭̃,̭̰ỡ̰̭̃,̛̭̰p̛̰̭̃,̛̭̰̃q̛̰̭̃̃,̛̭̰r̛̛̰̭̃̃,̭̰s̛̰̭,̛̭̰̃̃t̛̰̭̃,̛̭̰̃ữ̰̭̃,̛̭̰ṽ̛̰̭̃,̛̭̰w̛̛̰̭̃̃,̭̰x̛̰̭̃,̛̭̰̃ỹ̛̰̭̃,̛̭̰z̛̰̭̃̃,̛̛̭̰ã̛̰̭,̛̭̰̃b̛̰̭̃̃,̛̭̰c̛̛̰̭̃̃,̭̰d̛̰̭̃,̛̭̰̃ḛ̛̭̃̃,̛̭̰f̛̰̭̃̃,̛̭̰g̛̰̭̃̃,̛̭̰h̛̰̭̃,̛̭̰̃ḭ̛̛̭̃̃,̭̰j̛̰̭̃̃,̛̭̰k̛̰̭̃̃,̛̭̰l̛̰̭,̛̭̰̃m̛̰̭̃̃,̛̭̰ñ̛̛̰̭̃,̭̰ỡ̰̭̃,̛̭̰p̛̰̭̃,̛̭̰̃q̛̰̭̃̃,̛̭̰r̛̛̰̭̃̃,̭̰s̛̰̭,̛̭̰̃̃t̛̰̭̃,̛̭̰̃ữ̰̭̃,̛̭̰ṽ̛̰̭̃,̛̭̰w̛̛̰̭̃̃,̭̰x̛̰̭̃,̛̭̰̃ỹ̛̰̭̃,̛̭̰z̛̰̭̃̃,̛̭̰0̛̛̰̭̃̃,̭̰9̛̰̭̃̃,̛̭̰8̛̛̰̭̃̃,̭̰7̛̰̭̃̃,̛̭̰6̛̰̭̃̃,̛̭̰5̛̰̭̃,̛̭̰̃4̛̰̭̃,̛̭̰̃3̛̰̭̃̃,̛̭̰2̛̰̭̃̃,̛̭̰1̛̰̭̃,.,_", "a,ะb,ะc,ะd,ะe,ะf,ะg,ะh,ะi,ะj,ะk,ะl,ะm,ะn,ะo,ะp,ะq,ะr,ะs,ะt,ะu,ะv,ะw,ะx,ะy,ะz,a,ะb,ะc,ะd,ะe,ะf,ะg,ะh,ะi,ะj,ะk,ะl,ะm,ะn,ะo,ะp,ะq,ะr,ะs,ะt,ะu,ะv,ะw,ะx,ะy,ะz,ะ0,ะ9,ะ8,ะ7,ะ6,ะ5,ะ4,ะ3,ะ2,ะ1ะ,.,_", "̑ȃ,̑b̑,̑c̑,̑d̑,̑ȇ,̑f̑,̑g̑,̑h̑,̑ȋ,̑j̑,̑k̑,̑l̑,̑m̑,̑n̑,̑ȏ,̑p̑,̑q̑,̑ȓ,̑s̑,̑t̑,̑ȗ,̑v̑,̑w̑,̑x̑,̑y̑,̑z̑,̑ȃ,̑b̑,̑c̑,̑d̑,̑ȇ,̑f̑,̑g̑,̑h̑,̑ȋ,̑j̑,̑k̑,̑l̑,̑m̑,̑n̑,̑ȏ,̑p̑,̑q̑,̑ȓ,̑s̑,̑t̑,̑ȗ,̑v̑,̑w̑,̑x̑,̑y̑,̑z̑,̑0̑,̑9̑,̑8̑,̑7̑,̑6̑,̑5̑,̑4̑,̑3̑,̑2̑,̑1̑,.,_", "~a,͜͝b,͜͝c,͜͝d,͜͝e,͜͝f,͜͝g,͜͝h,͜͝i,͜͝j,͜͝k,͜͝l,͜͝m,͜͝n,͜͝o,͜͝p,͜͝q,͜͝r,͜͝s,͜͝t,͜͝u,͜͝v,͜͝w,͜͝x,͜͝y,͜͝z,~a,͜͝b,͜͝c,͜͝d,͜͝e,͜͝f,͜͝g,͜͝h,͜͝i,͜͝j,͜͝k,͜͝l,͜͝m,͜͝n,͜͝o,͜͝p,͜͝q,͜͝r,͜͝s,͜͝t,͜͝u,͜͝v,͜͝w,͜͝x,͜͝y,͜͝z,͜͝0,͜͝9,͜͝8,͜͝7,͜͝6,͜͝5,͜͝4,͜͝3,͜͝2͜,͝1͜͝~,.,_", "̤̈ä̤,̤̈b̤̈,̤̈c̤̈̈,̤d̤̈,̤̈ë̤,̤̈f̤̈,̤̈g̤̈̈,̤ḧ̤̈,̤ï̤̈,̤j̤̈,̤̈k̤̈̈,̤l̤̈,̤̈m̤̈,̤̈n̤̈,̤̈ö̤,̤̈p̤̈,̤̈q̤̈,̤̈r̤̈,̤̈s̤̈̈,̤ẗ̤̈,̤ṳ̈,̤̈v̤̈,̤̈ẅ̤,̤̈ẍ̤,̤̈ÿ̤,̤̈z̤̈,̤̈ä̤,̤̈b̤̈,̤̈c̤̈̈,̤d̤̈,̤̈ë̤,̤̈f̤̈,̤̈g̤̈̈,̤ḧ̤̈,̤ï̤̈,̤j̤̈,̤̈k̤̈̈,̤l̤̈,̤̈m̤̈,̤̈n̤̈,̤̈ö̤,̤̈p̤̈,̤̈q̤̈,̤̈r̤̈,̤̈s̤̈̈,̤ẗ̤̈,̤ṳ̈,̤̈v̤̈,̤̈ẅ̤,̤̈ẍ̤,̤̈ÿ̤,̤̈z̤̈,̤̈0̤̈,̤̈9̤̈,̤̈8̤̈,̤̈7̤̈,̤̈6̤̈,̤̈5̤̈,̤̈4̤̈,̤̈3̤̈,̤̈2̤̈̈,̤1̤̈,.,_", "≋̮̑ȃ̮,̮̑b̮̑,̮̑c̮̑,̮̑d̮̑,̮̑ȇ̮,̮̑f̮̑,̮̑g̮̑,̮̑ḫ̑,̮̑ȋ̮,̮̑j̮̑,̮̑k̮̑,̮̑l̮̑,̮̑m̮̑,̮̑n̮̑,̮̑ȏ̮,̮̑p̮̑,̮̑q̮̑,̮̑r̮,̮̑̑s̮,̮̑̑t̮,̮̑̑u̮,̮̑̑v̮̑,̮̑w̮̑,̮̑x̮̑,̮̑y̮̑,̮̑z̮̑,≋̮̑ȃ̮,̮̑b̮̑,̮̑c̮̑,̮̑d̮̑,̮̑ȇ̮,̮̑f̮̑,̮̑g̮̑,̮̑ḫ̑,̮̑ȋ̮,̮̑j̮̑,̮̑k̮̑,̮̑l̮̑,̮̑m̮̑,̮̑n̮̑,̮̑ȏ̮,̮̑p̮̑,̮̑q̮̑,̮̑r̮,̮̑̑s̮,̮̑̑t̮,̮̑̑u̮,̮̑̑v̮̑,̮̑w̮̑,̮̑x̮̑,̮̑y̮̑,̮̑z̮̑,̮̑0̮̑,̮̑9̮̑,̮̑8̮̑,̮̑7̮̑,̮̑6̮̑,̮̑5̮̑,̮̑4̮̑,̮̑3̮̑,̮̑2̮̑,̮̑1̮̑≋,.,_", "a̮,̮b̮̮,c̮̮,d̮̮,e̮̮,f̮̮,g̮̮,ḫ̮,i̮,j̮̮,k̮̮,l̮,̮m̮,̮n̮̮,o̮,̮p̮̮,q̮̮,r̮̮,s̮,̮t̮̮,u̮̮,v̮̮,w̮̮,x̮̮,y̮̮,z̮̮,a̮,̮b̮̮,c̮̮,d̮̮,e̮̮,f̮̮,g̮̮,ḫ̮i,̮̮,j̮̮,k̮̮,l̮,̮m̮,̮n̮̮,o̮,̮p̮̮,q̮̮,r̮̮,s̮,̮t̮̮,u̮̮,v̮̮,w̮̮,x̮̮,y̮̮,z̮̮,0̮̮,9̮̮,8̮̮,7̮̮,6̮̮,5̮̮,4̮̮,3̮̮,2̮̮,1̮,.,_", "A̲,̲B̲,̲C̲,̲D̲,̲E̲,̲F̲,̲G̲,̲H̲,̲I̲,̲J̲,̲K̲,̲L̲,̲M̲,̲N̲,̲O̲,̲P̲,̲Q̲,̲R̲,̲S̲,̲T̲,̲U̲,̲V̲,̲W̲,̲X̲,̲Y̲,̲Z̲,̲a̲,̲b̲,̲c̲,̲d̲,̲e̲,̲f̲,̲g̲,̲h̲,̲i̲,̲j̲,̲k̲,̲l̲,̲m̲,̲n̲,̲o̲,̲p̲,̲q̲,̲r̲,̲s̲,̲t̲,̲u̲,̲v̲,̲w̲,̲x̲,̲y̲,̲z̲,̲0̲,̲9̲,̲8̲,̲7̲,̲6̲,̲5̲,̲4̲,̲3̲,̲2̲,̲1̲,̲.̲,̲_̲", "Â,ß,Ĉ,Ð,Є,Ŧ,Ǥ,Ħ,Ī,ʖ,Қ,Ŀ,♏,И,Ø,P,Ҩ,R,$,ƚ,Ц,V,Щ,X,¥,Ẕ,Â,ß,Ĉ,Ð,Є,Ŧ,Ǥ,Ħ,Ī,ʖ,Қ,Ŀ,♏,И,Ø,P,Ҩ,R,$,ƚ,Ц,V,Щ,X,¥,Ẕ,0,9,8,7,6,5,4,3,2,1,.,_", } -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local result = {} i=0 for k=1,#fonts do i=i+1 local tar_font = fonts[i]:split(",") local text = matches[2] local text = text:gsub("A",tar_font[1]) local text = text:gsub("B",tar_font[2]) local text = text:gsub("C",tar_font[3]) local text = text:gsub("D",tar_font[4]) local text = text:gsub("E",tar_font[5]) local text = text:gsub("F",tar_font[6]) local text = text:gsub("G",tar_font[7]) local text = text:gsub("H",tar_font[8]) local text = text:gsub("I",tar_font[9]) local text = text:gsub("J",tar_font[10]) local text = text:gsub("K",tar_font[11]) local text = text:gsub("L",tar_font[12]) local text = text:gsub("M",tar_font[13]) local text = text:gsub("N",tar_font[14]) local text = text:gsub("O",tar_font[15]) local text = text:gsub("P",tar_font[16]) local text = text:gsub("Q",tar_font[17]) local text = text:gsub("R",tar_font[18]) local text = text:gsub("S",tar_font[19]) local text = text:gsub("T",tar_font[20]) local text = text:gsub("U",tar_font[21]) local text = text:gsub("V",tar_font[22]) local text = text:gsub("W",tar_font[23]) local text = text:gsub("X",tar_font[24]) local text = text:gsub("Y",tar_font[25]) local text = text:gsub("Z",tar_font[26]) local text = text:gsub("a",tar_font[27]) local text = text:gsub("b",tar_font[28]) local text = text:gsub("c",tar_font[29]) local text = text:gsub("d",tar_font[30]) local text = text:gsub("e",tar_font[31]) local text = text:gsub("f",tar_font[32]) local text = text:gsub("g",tar_font[33]) local text = text:gsub("h",tar_font[34]) local text = text:gsub("i",tar_font[35]) local text = text:gsub("j",tar_font[36]) local text = text:gsub("k",tar_font[37]) local text = text:gsub("l",tar_font[38]) local text = text:gsub("m",tar_font[39]) local text = text:gsub("n",tar_font[40]) local text = text:gsub("o",tar_font[41]) local text = text:gsub("p",tar_font[42]) local text = text:gsub("q",tar_font[43]) local text = text:gsub("r",tar_font[44]) local text = text:gsub("s",tar_font[45]) local text = text:gsub("t",tar_font[46]) local text = text:gsub("u",tar_font[47]) local text = text:gsub("v",tar_font[48]) local text = text:gsub("w",tar_font[49]) local text = text:gsub("x",tar_font[50]) local text = text:gsub("y",tar_font[51]) local text = text:gsub("z",tar_font[52]) local text = text:gsub("0",tar_font[53]) local text = text:gsub("9",tar_font[54]) local text = text:gsub("8",tar_font[55]) local text = text:gsub("7",tar_font[56]) local text = text:gsub("6",tar_font[57]) local text = text:gsub("5",tar_font[58]) local text = text:gsub("4",tar_font[59]) local text = text:gsub("3",tar_font[60]) local text = text:gsub("2",tar_font[61]) local text = text:gsub("1",tar_font[62]) table.insert(result, text) end local result_text = "کلمه ی اولیه: "..matches[2].."\nطراحی با "..tostring(#fonts).." فونت:\n\n" a=0 for v=1,#result do a=a+1 result_text = result_text..a.."- "..result[a].."\n\n" end return result_text.."sezar.bot" end return { description = "Fantasy Writer", usagehtm = '<tr><td align="center">write متن</td><td align="right">با استفاده از این پلاگین میتوانید متون خود را با فونت های متنوع و زیبایی طراحی کنید. حد اکثر کاراکتر های مجاز 20 عدد میباشد و فقط میتوانید از حروف انگلیسی و اعداد استفاده کنید</td></tr>', usage = {"!write [text] : زیبا نویسی",}, patterns = { "^[#!/](بنویس) (.*)", "^[#!/](بنویس)$", "^[#!/]([Ww]rite) (.*)", "^[#!/]([Ww]rite)$", }, run = run }
gpl-2.0