repo_name
stringlengths
6
78
path
stringlengths
4
206
copies
stringclasses
281 values
size
stringlengths
4
7
content
stringlengths
625
1.05M
license
stringclasses
15 values
zhaozg/lit
deps/semver.lua
4
6207
--[[lit-meta name = "creationix/semver" version = "2.0.0" homepage = "https://github.com/luvit/lit/blob/master/deps/prompt.lua" description = "Parser, comparer and matcher for semantic versions strings." tags = {"semver"} license = "MIT" author = { name = "Tim Caswell" } ]] local exports = {} local parse, normalize, match -- Make the module itself callable setmetatable(exports, { __call = function (_, ...) return match(...) end }) function parse(version) if not version then return end if not tonumber(string.match(version, "^v?(%d+)")) then error("Invalid version value: " .. version) end return tonumber(string.match(version, "^v?(%d+)")), tonumber(string.match(version, "^v?%d+%.(%d+)") or 0), tonumber(string.match(version, "^v?%d+%.%d+%.(%d+)") or 0), tonumber(string.match(version, "^v?%d+%.%d+%.%d+-(%d+)") or 0) end exports.parse = parse function normalize(version) if not version then return "*" end local a, b, c, d = parse(version) return a .. '.' .. b .. '.' .. c .. (d > 0 and ('-' .. d) or ('')) end exports.normalize = normalize -- Return true is first is greater than or equal to the second -- nil counts as lowest value in this case function exports.gte(first, second) if not second or first == second then return true end if not first then return false end local a, b, c, x = parse(second) local d, e, f, y = parse(first) return (d > a) or (d == a and (e > b or (e == b and (f > c or (f == c and y >= x))))) end -- Sanity check for gte code assert(exports.gte(nil, nil)) assert(exports.gte("0.0.0", nil)) assert(exports.gte("9.9.9", "9.9.9")) assert(exports.gte("1.2.3", "1.2.3-0")) assert(exports.gte("1.2.3-4", "1.2.3-4")) assert(exports.gte("9.9.10", "9.9.9")) assert(exports.gte("9.10.0", "9.9.99")) assert(exports.gte("10.0.0", "9.99.99")) assert(exports.gte("10.0.0-1", "10.0.0-0")) assert(exports.gte("10.0.1-0", "10.0.0-0")) assert(exports.gte("10.0.1", "10.0.0-10")) assert(not exports.gte(nil, "0.0.0")) assert(not exports.gte("9.9.9", "9.9.10")) assert(not exports.gte("9.9.99", "9.10.0")) assert(not exports.gte("9.99.99", "10.0.0")) assert(not exports.gte("10.0.0-0", "10.0.0-1")) -- Given a semver string in the format a.b.c, and a list of versions in the -- same format, return the newest version that is compatable. -- For all versions, don't match anything older than minumum. -- For 0.0.z-b, only match build updates -- For 0.y.z-b, match patch and build updates -- For x.y.z-b, match minor, patch, and build updates -- If there is no minumum, grab the absolute maximum. function match(version, iterator) -- Major Minor Patch Build -- found a b c x -- possible d e f y -- minimum g h i z local a, b, c, x if not version then -- With an empty match, simply grab the newest version for possible in iterator do local d, e, f, y = parse(possible) if (not a) or (d > a) or (d == a and (e > b or (e == b and (f > c or (f == c and y > x))))) then a, b, c, x = d, e, f, y end end else local g, h, i, z = parse(version) if g > 0 then -- From 1.0.0 and onward, minor updates are allowed since they mean non- -- breaking changes or additons. for possible in iterator do local d, e, f, y = parse(possible) -- Must be gte the minimum, but match major version. If this is the -- first match, keep it, otherwise, make sure it's better than the last -- match. if d == g and (e > h or (e == h and (f > i or (f == i and y >= z)))) and ((not a) or e > b or (e == b and (f > c or (f == c and y > x)))) then a, b, c, x = d, e, f, y end end elseif h > 0 then -- Before 1.0.0 we only allow patch updates assuming less stability at -- this period. for possible in iterator do local d, e, f, y = parse(possible) -- Must be gte the minumum, but match major and minor versions. if d == g and e == h and (f > i or (f == i and y >= z)) and ((not a) or f > c or (f == c and y > x)) then a, b, c, x = d, e, f, y end end else -- Before 0.1.0 we assume even less stability and only update new builds for possible in iterator do local d, e, f, y = parse(possible) -- Must match major, minor, and patch, only allow build updates if d == g and e == h and f == i and y >= z and ((not a) or y > x) then a, b, c, x = d, e, f, y end end end end return a and (a .. '.' .. b .. '.' .. c .. (x > 0 and ('-' .. x) or (''))) end exports.match = match local function iterator() local versions = { "0.0.1", "0.0.2", "0.0.3", "0.0.3-1", "0.0.3-2", "0.0.4", "0.1.0", "0.1.1", "0.2.0", "0.2.1", "0.3.0", "0.3.0-1", "0.3.0-2", "0.3.1", "0.4.0", "0.4.0-1", "0.4.0-2", "1.0.0", "1.1.0", "1.1.3", "2.0.0", "2.1.2", "3.1.4", "4.0.0", "4.0.0-1", "4.0.0-2", "4.0.1", "5.0.0", "5.0.0-1", "5.0.0-2", "6.0.0", "6.0.0-1", "6.1.0", } local i = 0 return function () i = i + 1 return versions[i] end end -- Sanity check for match code assert(match("0.0.1", iterator()) == "0.0.1") assert(match("0.0.3", iterator()) == "0.0.3-2") assert(match("0.1.0", iterator()) == "0.1.1") assert(match("0.1.0-1", iterator()) == "0.1.1") assert(match("0.2.0", iterator()) == "0.2.1") assert(match("0.3.0", iterator()) == "0.3.1") assert(match("0.4.0", iterator()) == "0.4.0-2") assert(not match("0.5.0", iterator())) assert(match("1.0.0", iterator()) == "1.1.3") assert(match("1.0.0-1", iterator()) == "1.1.3") assert(not match("1.1.4", iterator())) assert(not match("1.2.0", iterator())) assert(match("2.0.0", iterator()) == "2.1.2") assert(not match("2.1.3", iterator())) assert(not match("2.2.0", iterator())) assert(match("3.0.0", iterator()) == "3.1.4") assert(match("4.0.0", iterator()) == "4.0.1") assert(match("5.0.0", iterator()) == "5.0.0-2") assert(match("6.0.0", iterator()) == "6.1.0") assert(not match("3.1.5", iterator())) assert(match(nil, iterator()) == "6.1.0") return exports
apache-2.0
Lsty/ygopro-scripts
c79418153.lua
3
1103
--ランサー・デーモン function c79418153.initial_effect(c) --pierce local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(79418153,0)) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(c79418153.piercecon) e1:SetTarget(c79418153.piercetg) e1:SetOperation(c79418153.pierceop) c:RegisterEffect(e1) end function c79418153.piercecon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() return d and a:IsControler(tp) and d:IsDefencePos() end function c79418153.piercetg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.GetAttacker():CreateEffectRelation(e) end function c79418153.pierceop(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() if a:IsRelateToEffect(e) and a:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_PIERCE) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) a:RegisterEffect(e1) end end
gpl-2.0
MalRD/darkstar
scripts/zones/Port_Bastok/npcs/Agapito.lua
11
1462
----------------------------------- -- Area: Port Bastok -- NPC: Agapito -- Start & Finishes Quest: The Stars of Ifrit -- !pos -72.093 -3.097 9.309 236 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); local ID = require("scripts/zones/Port_Bastok/IDs"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) local TheStarsOfIfrit = player:getQuestStatus(BASTOK,dsp.quest.id.bastok.THE_STARS_OF_IFRIT); if (player:getFameLevel(BASTOK) >= 3 and TheStarsOfIfrit == QUEST_AVAILABLE and player:hasKeyItem(dsp.ki.AIRSHIP_PASS) == true) then player:startEvent(180); elseif (TheStarsOfIfrit == QUEST_ACCEPTED and player:hasKeyItem(dsp.ki.CARRIER_PIGEON_LETTER) == true) then player:startEvent(181); else player:startEvent(17); end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 180) then player:addQuest(BASTOK,dsp.quest.id.bastok.THE_STARS_OF_IFRIT); elseif (csid == 181) then player:addGil(GIL_RATE*2100); player:messageSpecial(ID.text.GIL_OBTAINED,GIL_RATE*2100); player:addFame(BASTOK,100); player:addTitle(dsp.title.STAR_OF_IFRIT); player:completeQuest(BASTOK,dsp.quest.id.bastok.THE_STARS_OF_IFRIT); end end;
gpl-3.0
Lsty/ygopro-scripts
c29795530.lua
5
2254
--妖怪のいたずら function c29795530.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,0x1c0) e1:SetTarget(c29795530.target) e1:SetOperation(c29795530.activate) c:RegisterEffect(e1) --lvdown local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(29795530,0)) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,0x1c0) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(aux.exccon) e2:SetCost(c29795530.lvcost) e2:SetTarget(c29795530.lvtg) e2:SetOperation(c29795530.lvop) c:RegisterEffect(e2) end function c29795530.filter(c) return c:IsFaceup() and c:IsLevelAbove(2) end function c29795530.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c29795530.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end end function c29795530.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c29795530.filter,tp,LOCATION_MZONE,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_LEVEL) e1:SetValue(-2) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) tc=g:GetNext() end end function c29795530.lvcost(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 c29795530.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and c29795530.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c29795530.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,c29795530.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function c29795530.lvop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(-1) e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) tc:RegisterEffect(e1) end end
gpl-2.0
Lsty/ygopro-scripts
c89181369.lua
9
2063
--星屑のきらめき function c89181369.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(c89181369.target) e1:SetOperation(c89181369.activate) c:RegisterEffect(e1) end function c89181369.spfilter(c,e,tp,rg) if not c:IsType(TYPE_SYNCHRO) or not c:IsRace(RACE_DRAGON) or not c:IsCanBeSpecialSummoned(e,0,tp,false,false) then return false end if rg:IsContains(c) then rg:RemoveCard(c) result=rg:CheckWithSumEqual(Card.GetLevel,c:GetLevel(),1,99) rg:AddCard(c) else result=rg:CheckWithSumEqual(Card.GetLevel,c:GetLevel(),1,99) end return result end function c89181369.rmfilter(c) return c:GetLevel()>0 and c:IsAbleToRemove() end function c89181369.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end local rg=Duel.GetMatchingGroup(c89181369.rmfilter,tp,LOCATION_GRAVE,0,nil) return Duel.IsExistingTarget(c89181369.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,rg) end local rg=Duel.GetMatchingGroup(c89181369.rmfilter,tp,LOCATION_GRAVE,0,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,c89181369.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,rg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function c89181369.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) then return end local rg=Duel.GetMatchingGroup(c89181369.rmfilter,tp,LOCATION_GRAVE,0,nil) rg:RemoveCard(tc) if rg:CheckWithSumEqual(Card.GetLevel,tc:GetLevel(),1,99) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rm=rg:SelectWithSumEqual(tp,Card.GetLevel,tc:GetLevel(),1,99) Duel.Remove(rm,POS_FACEUP,REASON_EFFECT) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
gpl-2.0
MalRD/darkstar
scripts/globals/spells/bluemagic/healing_breeze.lua
12
1625
----------------------------------------- -- Spell: Healing Breeze -- Restores HP for party members within area of effect -- Spell cost: 55 MP -- Monster Type: Beasts -- Spell Type: Magical (Wind) -- Blue Magic Points: 4 -- Stat Bonus: CHR+2, HP+10 -- Level: 16 -- Casting Time: 4.5 seconds -- Recast Time: 15 seconds -- -- Combos: Auto Regen ----------------------------------------- require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/magic") require("scripts/globals/msg") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0 end function onSpellCast(caster,target,spell) local minCure = 60 local divisor = 0.6666 local constant = -45 local power = getCurePowerOld(caster) if (power > 459) then divisor = 6.5 constant = 144.6666 elseif (power > 219) then divisor = 2 constant = 65 end local final = getCureFinal(caster,spell,getBaseCureOld(power,divisor,constant),minCure,true) local diff = (target:getMaxHP() - target:getHP()) final = final + (final * (target:getMod(dsp.mod.CURE_POTENCY_RCVD)/100)) if (target:getAllegiance() == caster:getAllegiance() and (target:getObjType() == dsp.objType.PC or target:getObjType() == dsp.objType.MOB)) then --Applying server mods.... final = final * CURE_POWER end if (final > diff) then final = diff end target:addHP(final) target:wakeUp() caster:updateEnmityFromCure(target,final) spell:setMsg(dsp.msg.basic.MAGIC_RECOVERS_HP) return final end
gpl-3.0
Lsty/ygopro-scripts
c85775486.lua
7
1497
--再機動 function c85775486.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(c85775486.cost) e1:SetTarget(c85775486.target) e1:SetOperation(c85775486.activate) c:RegisterEffect(e1) end function c85775486.cfilter(c) return c:IsSetCard(0x13) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeckAsCost() end function c85775486.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(c85775486.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,c85775486.cfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoDeck(g,nil,2,REASON_COST) end function c85775486.filter(c) return c:IsSetCard(0x13) and c:IsAbleToHand() end function c85775486.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and c85775486.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c85775486.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,c85775486.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function c85775486.activate(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
gpl-2.0
MalRD/darkstar
scripts/zones/RoMaeve/npcs/qm3.lua
9
1163
----------------------------------- -- Area: Ro'Maeve -- NPC: qm3 (Moongate Pass QM) -- !pos -277.651,-3.765,-17.895 122 and many <pos> ----------------------------------- local ID = require("scripts/zones/RoMaeve/IDs") require("scripts/globals/npc_util") require("scripts/globals/settings") require("scripts/globals/keyitems") ----------------------------------- function onTrade(player,npc,trade) end function onTrigger(player,npc) if player:hasKeyItem(dsp.ki.MOONGATE_PASS) then player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY) else local moongateQMLocations = { {-277.651,-3.765, -17.895}, { 264.681, 4.000, -52.630}, { 278.402, 4.993, -3.200}, { 151.779, 4.719, 68.553}, {-134.518, 4.000, 106.042} } npcUtil.giveKeyItem(player, dsp.ki.MOONGATE_PASS) npc:hideNPC(1800) local newPosition = npcUtil.pickNewPosition(npc:getID(), moongateQMLocations, true) npc:setPos(newPosition.x, newPosition.y, newPosition.z) end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) end
gpl-3.0
Lsty/ygopro-scripts
c46195773.lua
3
1528
--ターボ・ウォリアー function c46195773.initial_effect(c) --synchro summon aux.AddSynchroProcedure(c,c46195773.tfilter,aux.NonTuner(nil),1) c:EnableReviveLimit() --atk down local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(46195773,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetTarget(c46195773.atktg) e1:SetOperation(c46195773.atkop) c:RegisterEffect(e1) --cannot be target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(c46195773.efilter) c:RegisterEffect(e2) end function c46195773.tfilter(c) return c:IsCode(67270095) or c:IsHasEffect(20932152) end function c46195773.efilter(e,re,rp) return re:GetHandler():IsLevelBelow(6) and aux.tgval(e,re,rp) end function c46195773.atktg(e,tp,eg,ep,ev,re,r,rp,chk) local d=Duel.GetAttackTarget() if chk==0 then return d and d:IsFaceup() and d:GetLevel()>=6 and d:IsType(TYPE_SYNCHRO) end d:CreateEffectRelation(e) Duel.SetOperationInfo(0,CATEGORY_POSITION,d,1,0,0) end function c46195773.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local d=Duel.GetAttackTarget() if d:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(d:GetAttack()/2) e1:SetReset(RESET_PHASE+PHASE_DAMAGE) d:RegisterEffect(e1) end end
gpl-2.0
Lsty/ygopro-scripts
c6133894.lua
6
1646
--デビルマゼラ function c6133894.initial_effect(c) c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e2:SetRange(LOCATION_HAND) e2:SetCondition(c6133894.spcon) e2:SetOperation(c6133894.spop) c:RegisterEffect(e2) --handes local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(6133894,0)) e3:SetCategory(CATEGORY_HANDES) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetTarget(c6133894.hdtg) e3:SetOperation(c6133894.hdop) c:RegisterEffect(e3) end function c6133894.rfilter(c,code) return c:IsFaceup() and c:IsCode(code) end function c6133894.spcon(e,c) if c==nil then return Duel.IsEnvironment(94585852) end return Duel.CheckReleaseGroup(c:GetControler(),c6133894.rfilter,1,nil,66073051) end function c6133894.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectReleaseGroup(tp,c6133894.rfilter,1,1,nil,66073051) Duel.Release(g,REASON_COST) end function c6133894.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,3) end function c6133894.hdop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsEnvironment(94585852) then local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,3) Duel.SendtoGrave(g,REASON_EFFECT+REASON_DISCARD) end end
gpl-2.0
gallenmu/MoonGen
examples/moonsniff/traffic-gen.lua
1
5026
--- Generates MoonSniff traffic, i.e. packets contain an identifier and a fixed bit pattern --- Live mode and MSCAP mode require this type of traffic local lm = require "libmoon" local device = require "device" local memory = require "memory" local ts = require "timestamping" local hist = require "histogram" local timer = require "timer" local log = require "log" local stats = require "stats" local bit = require "bit" local limiter = require "software-ratecontrol" local MS_TYPE = 0b01010101 local band = bit.band local SRC_IP_BASE = "10.0.0.10" -- actual address will be SRC_IP_BASE + random(0, flows) function configure(parser) parser:description("Generate traffic which can be used by moonsniff to establish latencies induced by a device under test.") parser:argument("dev", "Devices to use."):args(2):convert(tonumber) parser:option("-v --fix-packetrate", "Approximate send rate in pps."):convert(tonumber):default(10000):target('fixedPacketRate') parser:option("-s --src-mac", "Overwrite source MAC address of every sent packet"):default(''):target("srcMAC") parser:option("-d --dst-mac", "Overwrite destination MAC address of every sent packet"):default(''):target("dstMAC") parser:option("-l --l4-dst", "Set the layer 4 destination port"):default(23432):target("l4dst") parser:option("-p --packets", "Send only the number of packets specified"):default(100000):convert(tonumber):target("numberOfPackets") parser:option("-x --size", "Packet size in bytes."):convert(tonumber):default(100):target('packetSize') parser:option("-b --burst", "Generated traffic is generated with the specified burst size (default burst size 1)"):default(1):target("burstSize") parser:option("-w --warm-up", "Warm-up device by sending 1000 pkts and pausing n seconds before real test begins."):convert(tonumber):default(0):target('warmUp') parser:option("-f --flows", "Number of flows (randomized source IP)."):default(1):convert(tonumber):target('flows') return parser:parse() end function master(args) args.dev[1] = device.config { port = args.dev[1], txQueues = 1 } args.dev[2] = device.config { port = args.dev[2], rxQueues = 1 } device.waitForLinks() local dev0tx = args.dev[1]:getTxQueue(0) local dev1rx = args.dev[2]:getRxQueue(0) stats.startStatsTask { txDevices = { args.dev[1] }, rxDevices = { args.dev[2] } } dstmc = parseMacAddress(args.dstMAC, 0) srcmc = parseMacAddress(args.srcMAC, 0) rateLimiter = limiter:new(dev0tx, "custom") local sender0 = lm.startTask("generateTraffic", dev0tx, args, rateLimiter, dstmc, srcmc) if args.warmUp > 0 then print('warm up active') end sender0:wait() lm.stop() lm.waitForTasks() end function generateTraffic(queue, args, rateLimiter, dstMAC, srcMAC) log:info("Trying to enable rx timestamping of all packets, this isn't supported by most nics") local pkt_id = 0 local baseIP = parseIPAddress(SRC_IP_BASE) local numberOfPackets = args.numberOfPackets if args.warmUp then numberOfPackets = numberOfPackets + 945 end local runtime = timer:new(args.time) local mempool = memory.createMemPool(function(buf) buf:getUdpPacket():fill { pktLength = args.packetSize, udpDst = args.l4dst } end) local bufs = mempool:bufArray() counter = 0 delay = 0 while lm.running() do bufs:alloc(args.packetSize) for i, buf in ipairs(bufs) do local pkt = buf:getUdpPacket() if dstMAC ~= nil then pkt.eth:setDst(dstMAC) end if srcMAC ~= nil then pkt.eth:setSrc(srcMAC) end -- for setters to work correctly, the number is not allowed to exceed 16 bit pkt.ip4:setID(band(pkt_id, 0xFFFF)) pkt.payload.uint32[0] = pkt_id pkt.payload.uint8[4] = MS_TYPE pkt_id = pkt_id + 1 numberOfPackets = numberOfPackets - 1 counter = counter + 1 if args.flows > 1 then pkt.ip4.src:set(baseIP + (counter % args.flows)) end --if args.warmUp > 0 and counter == 1000 then -- print("Warm-up ended, no packets for " .. args.warmUp .. "s.") -- print(i) -- rateLimiter:sendN(bufs, i) -- lm.sleepMillis(1000 * args.warmUp) -- --delay = (10000000000 / 8) * args.warmUp -- --buf:setDelay(0) -- print("Packet generation continues.") if (args.warmUp > 0 and counter == 946) then delay = (10000000000 / 8) * args.warmUp buf:setDelay(delay) delay = 0 --elseif (args.warmUp > 0 and counter > 946) or args.warmUp <= 0 then else delay = delay + (10000000000 / args.fixedPacketRate / 8 - (args.packetSize + 4)) if counter % args.burstSize == 0 then buf:setDelay(delay) delay = 0 else buf:setDelay(0) end end if numberOfPackets <= 0 then print(i) rateLimiter:sendN(bufs, i) lm.sleepMillis(1500) print(counter) lm.stop() lm.sleepMillis(1500) os.exit(0) return end end bufs:offloadIPChecksums() bufs:offloadUdpChecksums() rateLimiter:send(bufs) if args.warmUp > 0 and counter == 945 then lm.sleepMillis(1000 * args.warmUp) end end end
mit
SecondReality/Mudlet-Suttonian
src/LuaGlobal.lua
12
61444
---------------------------------------------------------------------------------- -- Useful global LUA functions that are accessible from within Mudlet ---------------------------------------------------------------------------------- -- These general functions can be used from anywhere within Mudlet scripts -- They are described in the manual. -------------------------------------------------------------------------------- -- default variables & function that are called by Mudlet atcp = {} function handleWindowResizeEvent() end function doSpeedWalk() end function doSwitchArea() end ----------------------------------------------------------------------------- -- General-purpose useful tools that were needed during development: ----------------------------------------------------------------------------- if package.loaded["rex_pcre"] then rex = require"rex_pcre" end -- Tests if a table is empty: this is useful in situations where you find -- yourself wanting to do 'if my_table == {}' and such. function table.is_empty(tbl) for k, v in pairs(tbl) do return false end return true end function string.starts(String,Start) return string.sub(String,1,string.len(Start))==Start end function string.ends(String,End) return End=='' or string.sub(String,-string.len(End))==End end ---------------------------------------------------------------------------------- -- Functions written by Blaine von Roeder - December 2009 ---------------------------------------------------------------------------------- -- This function flags a variable to be saved by Mudlet's variable persistence system. -- Usage: remember("varName") -- Example: remember("table_Weapons") -- Example: remember("var_EnemyHeight") -- Variables are automatically unpacked into the global namespace when the profile is loaded. -- They are saved to "SavedVariables.lua" when the profile is closed or saved. function remember(varName) if not _saveTable then _saveTable = {} end _saveTable[varName] = _G[varName] end --- This function should be primarily used by Mudlet. It loads saved settings in from the Mudlet home directory --- and unpacks them into the global namespace. function loadVars() if string.char(getMudletHomeDir():byte()) == "/" then _sep = "/" else _sep = "\\" end local l_SettingsFile = getMudletHomeDir() .. _sep .. "SavedVariables.lua" local lt_VariableHolder = {} if (io.exists(l_SettingsFile)) then table.load(l_SettingsFile, lt_VariableHolder) for k,v in pairs(lt_VariableHolder) do _G[k] = v end end end -- This function should primarily be used by Mudlet. It saves the contents of _saveTable into a file for persistence. function saveVars() if string.char(getMudletHomeDir():byte()) == "/" then _sep = "/" else _sep = "\\" end local l_SettingsFile = getMudletHomeDir() .. _sep .. "SavedVariables.lua" for k,_ in pairs(_saveTable) do remember(k) end table.save(l_SettingsFile, _saveTable) end -- Move a custom gauge built by createGauge(...) -- Example: moveGauge("healthBar", 1200, 400) -- This would move the health bar gauge to the location 1200, 400 function moveGauge(gaugeName, newX, newY) local newX, newY = newX, newY assert(gaugesTable[gaugeName], "moveGauge: no such gauge exists.") assert(newX and newY, "moveGauge: need to have both X and Y dimensions.") moveWindow(gaugeName, newX, newY) moveWindow(gaugeName .. "_back", newX, newY) gaugesTable[gaugeName].xpos, gaugesTable[gaugeName].ypos = newX, newY end -- Set the text on a custom gauge built by createGauge(...) -- Example: setGaugeText("healthBar", "HP: 100%", 40, 40, 40) -- Example: setGaugeText("healthBar", "HP: 100%", "red") -- An empty gaugeText will clear the text entirely. -- Colors are optional and will default to 0,0,0(black) if not passed as args. function setGaugeText(gaugeName, gaugeText, color1, color2, color3) assert(gaugesTable[gaugeName], "setGauge: no such gauge exists.") local red,green,blue = 0,0,0 local l_labelText = gaugeText if color1 ~= nil then if color2 == nil then red, green, blue = getRGB(color1) else red, green, blue = color1, color2, color3 end end -- Check to make sure we had a text to apply, if not, clear the text if l_labelText == nil then l_labelText = "" end local l_EchoString = [[<font color="#]] .. RGB2Hex(red,green,blue) .. [[">]] .. l_labelText .. [[</font>]] echo(gaugeName, l_EchoString) echo(gaugeName .. "_back", l_EchoString) gaugesTable[gaugeName].text = l_EchoString gaugesTable[gaugeName].color1, gaugesTable[gaugeName].color2, gaugesTable[gaugeName].color3 = color1, color2, color3 end -- Converts an RGB value into an HTML compliant(label usable) HEX number -- This function is colorNames aware and can take any defined global color as its first arg -- Example: RGB2Hex(255,255,255) returns "FFFFFF" -- Example: RGB2Hex("white") returns "FFFFFF" function RGB2Hex(red,green,blue) local l_Red, l_Green, l_Blue = 0,0,0 if green == nil then -- Not an RGB but a "color" instead! l_Red, l_Green, l_Blue = getRGB(red) else -- Nope, true color here l_Red, l_Green, l_Blue = red, green, blue end return PadHexNum(string.format("%X",l_Red)) .. PadHexNum(string.format("%X",l_Green)) .. PadHexNum(string.format("%X",l_Blue)) end -- Pads a hex number to ensure a minimum of 2 digits. -- Example: PadHexNum("F") returns "F0 function PadHexNum(incString) local l_Return = incString if tonumber(incString,16)<16 then if tonumber(incString,16)<10 then l_Return = "0" .. l_Return elseif tonumber(incString,16)>10 then l_Return = l_Return .. "0" end end return l_Return end ----------------------------------------------------------- -- Functions written by John Dahlstrom November 2008 ----------------------------------------------------------- -- Example: -- -- local red, green, blue = getRGB("green") -- echo(red .. "." .. green .. "." .. blue ) -- -- This would then display 0.255.0 on your screen. function getRGB(colorName) local red = color_table[colorName][1] local green = color_table[colorName][2] local blue = color_table[colorName][3] return red, green, blue end -- Make your very own customized gauge with this function. -- -- Example: -- -- createGauge("healthBar", 300, 20, 30, 300, nil, 0, 255, 0) -- or -- createGauge("healthBar", 300, 20, 30, 300, nil, "green") -- -- This would make a gauge at that's 300px width, 20px in height, located at Xpos and Ypos and is green. -- The second example is using the same names you'd use for something like fg() or bg(). -- -- If you wish to have some text on your label, you'll change the nil part and make it look like this: -- createGauge("healthBar", 300, 20, 30, 300, "Now with some text", 0, 255, 0) -- or -- createGauge("healthBar", 300, 20, 30, 300, "Now with some text", "green") gaugesTable = {} -- first we need to make this table which will be used later to store important data in... function createGauge(gaugeName, width, height, Xpos, Ypos, gaugeText, color1, color2, color3) -- make a nice background for our gauge createLabel(gaugeName .. "_back",0,0,0,0,1) if color2 == nil then local red, green, blue = getRGB(color1) setBackgroundColor(gaugeName .. "_back", red , green, blue, 100) else setBackgroundColor(gaugeName .. "_back", color1 ,color2, color3, 100) end moveWindow(gaugeName .. "_back", Xpos, Ypos) resizeWindow(gaugeName .. "_back", width, height) showWindow(gaugeName .. "_back") -- make a nicer front for our gauge createLabel(gaugeName,0,0,0,0,1) if color2 == nil then local red, green, blue = getRGB(color1) setBackgroundColor(gaugeName, red , green, blue, 255) else setBackgroundColor(gaugeName, color1 ,color2, color3, 255) end moveWindow(gaugeName, Xpos, Ypos) resizeWindow(gaugeName, width, height) showWindow(gaugeName) -- store important data in a table gaugesTable[gaugeName] = {width = width, height = height, xpos = Xpos, ypos = Ypos,text = gaugeText, color1 = color1, color2 = color2, color3 = color3} -- Set Gauge text (Defaults to black) -- If no gaugeText was passed, we'll just leave it blank! if gaugeText ~= nil then setGaugeText(gaugeName, gaugeText, "black") else setGaugeText(gaugeName) end end -- Use this function when you want to change the gauges look according to your values. -- -- Example: -- -- setGauge("healthBar", 200, 400) -- -- In that example, we'd change the looks of the gauge named healthBar and make it fill -- to half of its capacity. The height is always remembered. -- -- If you wish to change the text on your gauge, you'd do the following: -- -- setGauge("healthBar", 200, 400, "some text") -- -- Typical usage would be in a prompt with your current health or whatever value, and throw -- in some variables instead of the numbers. function setGauge(gaugeName, currentValue, maxValue, gaugeText) assert(gaugesTable[gaugeName], "setGauge: no such gauge exists.") assert(currentValue and maxValue, "setGauge: need to have both current and max values.") resizeWindow(gaugeName, gaugesTable[gaugeName].width/100*((100/maxValue)*currentValue), gaugesTable[gaugeName].height) -- if we wanted to change the text, we do it if gaugeText ~= nil then echo(gaugeName .. "_back", gaugeText) echo(gaugeName, gaugeText) gaugesTable[gaugeName].text = gaugeText end end -- Make a new console window with ease. The default background is black and text color white. -- -- Example: -- -- createConsole("myConsoleWindow", 8, 80, 20, 200, 400) -- -- This will create a miniconsole window that has a font size of 8pt, will display 80 characters in width, -- hold a maximum of 20 lines and be place at 200x400 of your mudlet window. -- If you wish to change the color you can easily do this when updating your text or manually somewhere, using -- setFgColor() and setBackgroundColor(). function createConsole(consoleName, fontSize, charsPerLine, numberOfLines, Xpos, Ypos) createMiniConsole(consoleName,0,0,1,1) setMiniConsoleFontSize(consoleName, fontSize) local x,y = calcFontSize( fontSize ) resizeWindow(consoleName, x*charsPerLine, y*numberOfLines) setWindowWrap(consoleName, Xpos) moveWindow(consoleName, Xpos, Ypos) setBackgroundColor(consoleName,0,0,0,0) setFgColor(consoleName, 255,255,255) end function sendAll( what, ... ) if table.maxn(arg) == 0 then send( what ) else local echo if arg[table.maxn(arg)] == false then echo = false else echo = true end send( what, echo ) for i,v in ipairs(arg) do send( v, echo ) end end end -- Echo something after your line function suffix(what, func, fg, bg, window) local length = string.len(line) moveCursor(window or "main", length-1, getLineNumber()) if func and (func == cecho or func == decho or func == hecho) then func(what, fg, bg, true, window) else insertText(what) end end -- Echo something before your line function prefix(what, func, fg, bg, window) moveCursor(window or "main", 0, getLineNumber()); if func and (func == cecho or func == decho or func == hecho) then func(what, fg, bg, true, window) else insertText(what) end end -- Gag the whole line function gagLine() --selectString(line, 1) --replace("") deleteLine() end -- Replace all words on the current line by your choice -- Example: replaceAll("John", "Doe") -- This will replace the word John with the word Doe, everytime the word John occurs on the current line. function replaceAll(word, what) while selectString(word, 1) > 0 do replace(what) end end -- Replace the whole with a string you'd like. function replaceLine(what) selectString(line, 1) replace("") insertText(what) end ----------------------------------- -- some functions from Heiko ---------------------------------- -- default resizeEvent handler function. -- overwrite this function to make a custom event handler if the main window is being resized function handleResizeEvent() end function deselect() selectString("",1); end -- Function shows the content of a Lua table on the screen function printTable( map ) echo("-------------------------------------------------------\n"); for k, v in pairs( map ) do echo( "key=" .. k .. " value=" .. v .. "\n" ) end echo("-------------------------------------------------------\n"); end function __printTable( k, v ) insertText ("\nkey = " .. tostring (k) .. " value = " .. tostring( v ) ) end -- Function colorizes all matched regex capture groups on the screen function showCaptureGroups() for k, v in pairs ( matches ) do selectCaptureGroup( tonumber(k) ) setFgColor( math.random(0,255), math.random(0,255), math.random(0,255) ) setBgColor( math.random(0,255), math.random(0,255), math.random(0,255) ) end end -- prints the content of the table multimatches[n][m] to the screen -- this is meant as a tool to help write multiline trigger scripts -- This helps you to easily see what your multiline trigger actually captured in all regex -- You can use these values directly in your script by referring to it with multimatches[regex-number][capturegroup] function showMultimatches() echo("\n-------------------------------------------------------"); echo("\nThe table multimatches[n][m] contains:"); echo("\n-------------------------------------------------------"); for k,v in ipairs(multimatches) do echo("\nregex " .. k .. " captured: (multimatches["..k .."][1-n])"); for k2,v2 in ipairs(v) do echo("\n key="..k2.." value="..v2); end end echo("\n-------------------------------------------------------\n"); end function listPrint( map ) echo("-------------------------------------------------------\n"); for k,v in ipairs( map ) do echo( k .. ". ) "..v .. "\n" ); end echo("-------------------------------------------------------\n"); end function listAdd( list, what ) table.insert( list, what ); end function listRemove( list, what ) for k,v in ipairs( list ) do if v == what then table.remove( list, k ) end end end ------------------------------------------------------------------- --.... some functions from Tichi 2009 ------------------------------------------------------------------- -- Gets the actual size of a non-numerical table function table.size(t) if not t then return 0 end local i = 0 for k, v in pairs(t) do i = i + 1 end return i end -- Checks to see if a file exists function io.exists(file) local f = io.open(file) if f then io.close(f) return true end return false end -- Splits a string function string:split(delimiter) local result = { } local from = 1 local delim_from, delim_to = string.find( self, delimiter, from ) while delim_from do table.insert( result, string.sub( self, from , delim_from-1 ) ) from = delim_to + 1 delim_from, delim_to = string.find( self, delimiter, from ) end table.insert( result, string.sub( self, from ) ) return result end -- Determines if a table contains a value as a key or as a value (recursive) function table.contains(t, value) for k, v in pairs(t) do if v == value then return true elseif k == value then return true elseif type(v) == "table" then if table.contains(v, value) then return true end end end return false end ----------------------------------------------------------- -- some functions from Vadim Peretrokin 2009 ----------------------------------------------------------- ------------------------------------------------------------------------------- -- Color Definitions -------------------------------------------------------------------------------- -- These color definitions are intended to be used in conjunction with fg() -- and bg() colorizer functions that are defined further below -------------------------------------------------------------------------------- color_table = { snow = {255, 250, 250}, ghost_white = {248, 248, 255}, GhostWhite = {248, 248, 255}, white_smoke = {245, 245, 245}, WhiteSmoke = {245, 245, 245}, gainsboro = {220, 220, 220}, floral_white = {255, 250, 240}, FloralWhite = {255, 250, 240}, old_lace = {253, 245, 230}, OldLace = {253, 245, 230}, linen = {250, 240, 230}, antique_white = {250, 235, 215}, AntiqueWhite = {250, 235, 215}, papaya_whip = {255, 239, 213}, PapayaWhip = {255, 239, 213}, blanched_almond = {255, 235, 205}, BlanchedAlmond = {255, 235, 205}, bisque = {255, 228, 196}, peach_puff = {255, 218, 185}, PeachPuff = {255, 218, 185}, navajo_white = {255, 222, 173}, NavajoWhite = {255, 222, 173}, moccasin = {255, 228, 181}, cornsilk = {255, 248, 220}, ivory = {255, 255, 240}, lemon_chiffon = {255, 250, 205}, LemonChiffon = {255, 250, 205}, seashell = {255, 245, 238}, honeydew = {240, 255, 240}, mint_cream = {245, 255, 250}, MintCream = {245, 255, 250}, azure = {240, 255, 255}, alice_blue = {240, 248, 255}, AliceBlue = {240, 248, 255}, lavender = {230, 230, 250}, lavender_blush = {255, 240, 245}, LavenderBlush = {255, 240, 245}, misty_rose = {255, 228, 225}, MistyRose = {255, 228, 225}, white = {255, 255, 255}, black = {0, 0, 0}, dark_slate_gray = {47, 79, 79}, DarkSlateGray = {47, 79, 79}, dark_slate_grey = {47, 79, 79}, DarkSlateGrey = {47, 79, 79}, dim_gray = {105, 105, 105}, DimGray = {105, 105, 105}, dim_grey = {105, 105, 105}, DimGrey = {105, 105, 105}, slate_gray = {112, 128, 144}, SlateGray = {112, 128, 144}, slate_grey = {112, 128, 144}, SlateGrey = {112, 128, 144}, light_slate_gray = {119, 136, 153}, LightSlateGray = {119, 136, 153}, light_slate_grey = {119, 136, 153}, LightSlateGrey = {119, 136, 153}, gray = {190, 190, 190}, grey = {190, 190, 190}, light_grey = {211, 211, 211}, LightGrey = {211, 211, 211}, light_gray = {211, 211, 211}, LightGray = {211, 211, 211}, midnight_blue = {25, 25, 112}, MidnightBlue = {25, 25, 112}, navy = {0, 0, 128}, navy_blue = {0, 0, 128}, NavyBlue = {0, 0, 128}, cornflower_blue = {100, 149, 237}, CornflowerBlue = {100, 149, 237}, dark_slate_blue = {72, 61, 139}, DarkSlateBlue = {72, 61, 139}, slate_blue = {106, 90, 205}, SlateBlue = {106, 90, 205}, medium_slate_blue = {123, 104, 238}, MediumSlateBlue = {123, 104, 238}, light_slate_blue = {132, 112, 255}, LightSlateBlue = {132, 112, 255}, medium_blue = {0, 0, 205}, MediumBlue = {0, 0, 205}, royal_blue = {65, 105, 225}, RoyalBlue = {65, 105, 225}, blue = {0, 0, 255}, dodger_blue = {30, 144, 255}, DodgerBlue = {30, 144, 255}, deep_sky_blue = {0, 191, 255}, DeepSkyBlue = {0, 191, 255}, sky_blue = {135, 206, 235}, SkyBlue = {135, 206, 235}, light_sky_blue = {135, 206, 250}, LightSkyBlue = {135, 206, 250}, steel_blue = {70, 130, 180}, SteelBlue = {70, 130, 180}, light_steel_blue = {176, 196, 222}, LightSteelBlue = {176, 196, 222}, light_blue = {173, 216, 230}, LightBlue = {173, 216, 230}, powder_blue = {176, 224, 230}, PowderBlue = {176, 224, 230}, pale_turquoise = {175, 238, 238}, PaleTurquoise = {175, 238, 238}, dark_turquoise = {0, 206, 209}, DarkTurquoise = {0, 206, 209}, medium_turquoise = {72, 209, 204}, MediumTurquoise = {72, 209, 204}, turquoise = {64, 224, 208}, cyan = {0, 255, 255}, light_cyan = {224, 255, 255}, LightCyan = {224, 255, 255}, cadet_blue = {95, 158, 160}, CadetBlue = {95, 158, 160}, medium_aquamarine = {102, 205, 170}, MediumAquamarine = {102, 205, 170}, aquamarine = {127, 255, 212}, dark_green = {0, 100, 0}, DarkGreen = {0, 100, 0}, dark_olive_green = {85, 107, 47}, DarkOliveGreen = {85, 107, 47}, dark_sea_green = {143, 188, 143}, DarkSeaGreen = {143, 188, 143}, sea_green = {46, 139, 87}, SeaGreen = {46, 139, 87}, medium_sea_green = {60, 179, 113}, MediumSeaGreen = {60, 179, 113}, light_sea_green = {32, 178, 170}, LightSeaGreen = {32, 178, 170}, pale_green = {152, 251, 152}, PaleGreen = {152, 251, 152}, spring_green = {0, 255, 127}, SpringGreen = {0, 255, 127}, lawn_green = {124, 252, 0}, LawnGreen = {124, 252, 0}, green = {0, 255, 0}, chartreuse = {127, 255, 0}, medium_spring_green = {0, 250, 154}, MediumSpringGreen = {0, 250, 154}, green_yellow = {173, 255, 47}, GreenYellow = {173, 255, 47}, lime_green = {50, 205, 50}, LimeGreen = {50, 205, 50}, yellow_green = {154, 205, 50}, YellowGreen = {154, 205, 50}, forest_green = {34, 139, 34}, ForestGreen = {34, 139, 34}, olive_drab = {107, 142, 35}, OliveDrab = {107, 142, 35}, dark_khaki = {189, 183, 107}, DarkKhaki = {189, 183, 107}, khaki = {240, 230, 140}, pale_goldenrod = {238, 232, 170}, PaleGoldenrod = {238, 232, 170}, light_goldenrod_yellow= {250, 250, 210}, LightGoldenrodYellow = {250, 250, 210}, light_yellow = {255, 255, 224}, LightYellow = {255, 255, 224}, yellow = {255, 255, 0}, gold = {255, 215, 0}, light_goldenrod = {238, 221, 130}, LightGoldenrod = {238, 221, 130}, goldenrod = {218, 165, 32}, dark_goldenrod = {184, 134, 11}, DarkGoldenrod = {184, 134, 11}, rosy_brown = {188, 143, 143}, RosyBrown = {188, 143, 143}, indian_red = {205, 92, 92}, IndianRed = {205, 92, 92}, saddle_brown = {139, 69, 19}, SaddleBrown = {139, 69, 19}, sienna = {160, 82, 45}, peru = {205, 133, 63}, burlywood = {222, 184, 135}, beige = {245, 245, 220}, wheat = {245, 222, 179}, sandy_brown = {244, 164, 96}, SandyBrown = {244, 164, 96}, tan = {210, 180, 140}, chocolate = {210, 105, 30}, firebrick = {178, 34, 34}, brown = {165, 42, 42}, dark_salmon = {233, 150, 122}, DarkSalmon = {233, 150, 122}, salmon = {250, 128, 114}, light_salmon = {255, 160, 122}, LightSalmon = {255, 160, 122}, orange = {255, 165, 0}, dark_orange = {255, 140, 0}, DarkOrange = {255, 140, 0}, coral = {255, 127, 80}, light_coral = {240, 128, 128}, LightCoral = {240, 128, 128}, tomato = {255, 99, 71}, orange_red = {255, 69, 0}, OrangeRed = {255, 69, 0}, red = {255, 0, 0}, hot_pink = {255, 105, 180}, HotPink = {255, 105, 180}, deep_pink = {255, 20, 147}, DeepPink = {255, 20, 147}, pink = {255, 192, 203}, light_pink = {255, 182, 193}, LightPink = {255, 182, 193}, pale_violet_red = {219, 112, 147}, PaleVioletRed = {219, 112, 147}, maroon = {176, 48, 96}, medium_violet_red = {199, 21, 133}, MediumVioletRed = {199, 21, 133}, violet_red = {208, 32, 144}, VioletRed = {208, 32, 144}, magenta = {255, 0, 255}, violet = {238, 130, 238}, plum = {221, 160, 221}, orchid = {218, 112, 214}, medium_orchid = {186, 85, 211}, MediumOrchid = {186, 85, 211}, dark_orchid = {153, 50, 204}, DarkOrchid = {153, 50, 204}, dark_violet = {148, 0, 211}, DarkViolet = {148, 0, 211}, blue_violet = {138, 43, 226}, BlueViolet = {138, 43, 226}, purple = {160, 32, 240}, medium_purple = {147, 112, 219}, MediumPurple = {147, 112, 219}, thistle = {216, 191, 216} } ----------------------------------------------------------------------------------- -- Color Functions ------------------------------------------------------------------------------------- -- sets current background color to a named color see table above -- usage: bg( "magenta" ) function bg(name) setBgColor(color_table[name][1], color_table[name][2], color_table[name][3]) end -- sets current foreground color see bg( ) above function fg(name) setFgColor(color_table[name][1], color_table[name][2], color_table[name][3]) end --------------------------------------------------------------------------------------- -- Save & Load Variables --------------------------------------------------------------------------------------- -- The below functions can be used to save individual Lua tables to disc and load -- them again at a later time e.g. make a database, collect statistical information etc. -- These functions are also used by Mudlet to load & save the entire Lua session variables -- -- table.load(file) - loads a serialized file into the globals table (only Mudlet should use this) -- table.load(file, table) - loads a serialized file into the given table -- table.save(file) - saves the globals table (minus some lua enviroment stuffs) into a file (only Mudlet should use this) -- table.save(file, table) - saves the given table into the given file -- -- Original code written by CHILLCODE™ on https://board.ptokax.ch, distributed under the same terms as Lua itself. -- -- Notes: -- Userdata and indices of these are not saved -- Functions are saved via string.dump, so make sure it has no upvalues -- References are saved -- function table.save( sfile, t ) if t == nil then t = _G end local tables = {} table.insert( tables, t ) local lookup = { [t] = 1 } local file = io.open( sfile, "w" ) file:write( "return {" ) for i,v in ipairs( tables ) do table.pickle( v, file, tables, lookup ) end file:write( "}" ) file:close() end function table.pickle( t, file, tables, lookup ) file:write( "{" ) for i,v in pairs( t ) do -- escape functions if type( v ) ~= "function" and type( v ) ~= "userdata" and (i ~= "string" and i ~= "xpcall" and i ~= "package" and i ~= "os" and i ~= "io" and i ~= "math" and i ~= "debug" and i ~= "coroutine" and i ~= "_G" and i ~= "_VERSION" and i ~= "table") then -- handle index if type( i ) == "table" then if not lookup[i] then table.insert( tables, i ) lookup[i] = table.maxn( tables ) end file:write( "[{"..lookup[i].."}] = " ) else local index = ( type( i ) == "string" and "[ "..string.enclose( i, 50 ).." ]" ) or string.format( "[%d]", i ) file:write( index.." = " ) end -- handle value if type( v ) == "table" then if not lookup[v] then table.insert( tables, v ) lookup[v] = table.maxn( tables ) end file:write( "{"..lookup[v].."}," ) else local value = ( type( v ) == "string" and string.enclose( v, 50 ) ) or tostring( v ) file:write( value.."," ) end end end file:write( "},\n" ) end -- enclose string by long brakets ( string, maxlevel ) function string.enclose( s, maxlevel ) s = "["..s.."]" local level = 0 while 1 do if maxlevel and level == maxlevel then error( "error: maxlevel too low, "..maxlevel ) -- elseif string.find( s, "%["..string.rep( "=", level ).."%[" ) or string.find( s, "]"..string.rep( "=", level ).."]" ) then level = level + 1 else return "["..string.rep( "=", level )..s..string.rep( "=", level ).."]" end end end function table.load( sfile, loadinto ) local tables = dofile( sfile ) if tables then if loadinto ~= nil and type(loadinto) == "table" then table.unpickle( tables[1], tables, loadinto ) else table.unpickle( tables[1], tables, _G ) end end end function table.unpickle( t, tables, tcopy, pickled ) pickled = pickled or {} pickled[t] = tcopy for i,v in pairs( t ) do local i2 = i if type( i ) == "table" then local pointer = tables[ i[1] ] if pickled[pointer] then i2 = pickled[pointer] else i2 = {} table.unpickle( pointer, tables, i2, pickled ) end end local v2 = v if type( v ) == "table" then local pointer = tables[ v[1] ] if pickled[pointer] then v2 = pickled[pointer] else v2 = {} table.unpickle( pointer, tables, v2, pickled ) end end tcopy[i2] = v2 end end -- Replaces the given wildcard (as a number) with the given text. -- -- -- Example: replaceWildcard(1, "hello") on a trigger of `^You wave (goodbye)\.$` function replaceWildcard(what, replacement) if replacement == nil or what == nil then return end selectCaptureGroup(what) replace(replacement) end ---------------------------------------------------------------------------------- -- function by Ryan: pretty print function for tables ---------------------------------------------------------------------------------- -- usage: display( mytable ) ---------------------------------------- -- pretty display function function display(what, numformat, recursion) recursion = recursion or 0 if recursion == 0 then echo("\n") -- echo("-------------------------------------------------------\n") end echo(printable(what, numformat)) -- Do all the stuff inside a table if type(what) == 'table' then echo(" {") local firstline = true -- a kludge so empty tables print on one line for k, v in pairs(what) do if firstline then echo("\n"); firstline = false end echo(indent(recursion)) echo(printable(k)) echo(": ") if not (v == _G) then display(v, numformat, recursion + 1) end end -- so empty tables print as {} instead of {..indent..} if not firstline then echo(indent(recursion - 1)) end echo("}") end echo("\n") if recursion == 0 then -- echo ("-------------------------------------------------------\n") end end -- Basically like tostring(), except takes a numformat -- and is a little better suited for working with display() function printable(what, numformat) local ret if type(what) == 'string' then ret = "'"..what.."'" -- ret = string.format("%q", what) -- this was ugly elseif type(what) == 'number' then if numformat then ret = string.format(numformat, what) else ret = what end elseif type(what) == 'boolean' then ret = tostring(what) elseif type(what) == 'table' then ret = what.__customtype or type(what) else ret = type(what) -- ret = tostring(what) -- this was ugly end return ret end -- Handles indentation do local indents = {} -- simulate a static variable function indent(num) if not indents[num] then indents[num] = "" for i = 0, num do indents[num] = indents[num].." " end end return indents[num] end end function resizeGauge(gaugeName, width, height) assert(gaugesTable[gaugeName], "resizeGauge: no such gauge exists.") assert(width and height, "resizeGauge: need to have both width and height.") resizeWindow(gaugeName, width, height) resizeWindow(gaugeName .. "_back", width, height) -- save in the table gaugesTable[gaugeName].width, gaugesTable[gaugeName].height = width, height end function setGaugeStyleSheet(gaugeName, css, cssback) if not setLabelStyleSheet then return end-- mudlet 1.0.5 and lower compatibility assert(gaugesTable[gaugeName], "setGaugeStyleSheet: no such gauge exists.") setLabelStyleSheet(gaugeName, css) setLabelStyleSheet(gaugeName .. "_back", cssback or css) end ---------------------------------------------------------------------------------- -- Functions written by Benjamin Smith - December 2009 ---------------------------------------------------------------------------------- --[[------------------------------------------------------------------------------ Color echo functions: hecho, decho, cecho Function: hecho() Arg1: String to echo Arg2: String containing value for foreground color in hexadecimal RGB format Arg3: String containing value for background color in hexadecimal RGB format Arg4: Bool that tells the function to use insertText() rather than echo() Arg5: Name of the console to echo to. Defaults to main. Color changes can be made within the string using the format |cFRFGFB,BRBGBB where FR is the foreground red value, FG is the foreground green value, FB is the foreground blue value, BR is the background red value, etc. ,BRBGBB is optional. |r can be used within the string to reset the colors to default. The colors in arg2 and arg3 replace the normal defaults for your console. So if you use cecho("|cff0000Testing |rTesting", "00ff00", "0000ff"), the first Testing would be red on black and the second would be green on blue. Function: decho() Arg1: String to echo Arg2: String containing value for foreground color in decimal format Arg3: String containing value for background color in decimal format Arg4: Bool that tells the function to use insertText() rather than echo() Arg5: Name of the console to echo to. Defaults to main. Color changes can be made using the format <FR,FG,FB:BR,BG,BB> where each field is a number from 0 to 255. The background portion can be omitted using <FR,FG,FB> or the foreground portion can be omitted using <:BR,BG,BB> Arguments 2 and 3 set the default fore and background colors for the string using the same format as is used within the string, sans angle brackets, e.g. decho("test", "255,0,0", "0,255,0") Function: cecho() Arg1: String to echo Arg2: String containing value for foreground color as a named color Arg3: String containing value for background color as a named color Arg4: Bool that tells the function to use insertText() rather than echo() Arg5: Name of the console to echo to. Defaults to main. Color changes can be made using the format <foreground:background> where each field is one of the colors listed by showColors() The background portion can be omitted using <foreground> or the foreground portion can be omitted using <:background> Arguments 2 and 3 to set the default colors take named colors as well. --]]------------------------------------------------------------------------------ if rex then Echos = { Patterns = { Hex = { [[(\x5c?\|c[0-9a-fA-F]{6}?(?:,[0-9a-fA-F]{6})?)|(\|r)]], rex.new[[\|c(?:([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2}))?(?:,([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2}))?]], }, Decimal = { [[(\x5c?<[0-9,:]+>)|(<r>)]], rex.new[[<(?:([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3}))?(?::(?=>))?(?::([0-9]{1,3}),([0-9]{1,3}),([0-9]{1,3}))?>]], }, Color = { [[(\x5c?<[a-zA-Z_,:]+>)]], rex.new[[<([a-zA-Z_]+)?(?:[:,](?=>))?(?:[:,]([a-zA-Z_]+))?>]], }, Ansi = { [[(\x5c?<[0-9,:]+>)]], rex.new[[<([0-9]{1,2})?(?::([0-9]{1,2}))?>]], }, }, Process = function(str, style) local t = {} for s, c, r in rex.split(str, Echos.Patterns[style][1]) do if c and (c:byte(1) == 92) then c = c:sub(2) if s then s = s .. c else s = c end c = nil end if s then table.insert(t, s) end if r then table.insert(t, "r") end if c then if style == 'Hex' or style == 'Decimal' then local fr, fg, fb, br, bg, bb = Echos.Patterns[style][2]:match(c) local color = {} if style == 'Hex' then if fr and fg and fb then fr, fg, fb = tonumber(fr, 16), tonumber(fg, 16), tonumber(fb, 16) end if br and bg and bb then br, bg, bb = tonumber(br, 16), tonumber(bg, 16), tonumber(bb, 16) end end if fr and fg and fb then color.fg = { fr, fg, fb } end if br and bg and bb then color.bg = { br, bg, bb } end table.insert(t, color) elseif style == 'Color' then if c == "<reset>" then table.insert(t, "r") else local fcolor, bcolor = Echos.Patterns[style][2]:match(c) local color = {} if fcolor and color_table[fcolor] then color.fg = color_table[fcolor] end if bcolor and color_table[bcolor] then color.bg = color_table[bcolor] end table.insert(t, color) end end end end return t end, } function xEcho(style, insert, win, str) if not str then str = win; win = nil end local reset, out if insert then if win then out = function(win, str) insertText(win, str) end else out = function(str) insertText(str) end end else if win then out = function(win, str) echo(win, str) end else out = function(str) echo(str) end end end if win then reset = function() resetFormat(win) end else reset = function() resetFormat() end end local t = Echos.Process(str, style) reset() for _, v in ipairs(t) do if type(v) == 'table' then if v.fg then local fr, fg, fb = unpack(v.fg) if win then setFgColor(win, fr, fg, fb) else setFgColor(fr, fg, fb) end end if v.bg then local br, bg, bb = unpack(v.bg) if win then setBgColor(win, br, bg, bb) else setBgColor(br, bg, bb) end end elseif v == "r" then reset() else if win then out(win, v) else out(v) end end end if win then resetFormat(win) else resetFormat() end end function hecho(...) xEcho("Hex", false, ...) end function decho(...) xEcho("Decimal", false, ...) end function cecho(...) xEcho("Color", false, ...) end function hinsertText(...) xEcho("Hex", true, ...) end function dinsertText(...) xEcho("Decimal", true, ...) end function cinsertText(...) xEcho("Color", true, ...) end checho = cecho else -- HEIKO: using this as a replacement until the problems of the real function -- are fixed. function cecho(window,text) local win = text and window local s = text or window if win then resetFormat(win) else resetFormat() end for color,text in string.gmatch("<white>"..s, "<([a-z_0-9, :]+)>([^<>]+)") do local colist = string.split(color..":", "%s*:%s*") local fgcol = colist[1] ~= "" and colist[1] or "white" local bgcol = colist[2] ~= "" and colist[2] or "black" local FGrgb = color_table[fgcol] or string.split(fgcol, ",") local BGrgb = color_table[bgcol] or string.split(bgcol, ",") if win then setFgColor(win, FGrgb[1], FGrgb[2], FGrgb[3]) setBgColor(win, BGrgb[1], BGrgb[2], BGrgb[3]) echo(win,text) else setFgColor(FGrgb[1], FGrgb[2], FGrgb[3]) setBgColor(BGrgb[1], BGrgb[2], BGrgb[3]) echo(text) end end if win then resetFormat(win) else resetFormat() end end -- function cecho(window, text) -- local win = text and window -- local s = text or window -- local reset -- if win then -- reset = function() resetFormat(win) end -- else -- reset = function() resetFormat() end -- end -- reset() -- for color, text in s:gmatch("<([a-zA-Z_:]+)>([^<>]+)") do -- if color == "reset" then -- reset() -- if win then echo(win, text) else echo(text) end -- else -- local colist = string.split(color..":", "%s*:%s*") -- local fgcol = colist[1] ~= "" and colist[1] or "white" -- local bgcol = colist[2] ~= "" and colist[2] or "black" -- local FGrgb = color_table[fgcol] -- local BGrgb = color_table[bgcol] -- -- if win then -- setFgColor(win, FGrgb[1], FGrgb[2], FGrgb[3]) -- setBgColor(win, BGrgb[1], BGrgb[2], BGrgb[3]) -- echo(win,text) -- else -- setFgColor(FGrgb[1], FGrgb[2], FGrgb[3]) -- setBgColor(BGrgb[1], BGrgb[2], BGrgb[3]) -- echo(text) -- end -- end -- end -- reset() -- end function decho(window, text) local win = text and window local s = text or window local reset if win then reset = function() resetFormat(win) end else reset = function() resetFormat() end end reset() for color, text in s:gmatch("<([0-9,:]+)>([^<>]+)") do if color == "reset" then reset() if win then echo(win, text) else echo(text) end else local colist = string.split(color..":", "%s*:%s*") local fgcol = colist[1] ~= "" and colist[1] or "white" local bgcol = colist[2] ~= "" and colist[2] or "black" local FGrgb = color_table[fgcol] or string.split(fgcol, ",") local BGrgb = color_table[bgcol] or string.split(bgcol, ",") if win then setFgColor(win, FGrgb[1], FGrgb[2], FGrgb[3]) setBgColor(win, BGrgb[1], BGrgb[2], BGrgb[3]) echo(win,text) else setFgColor(FGrgb[1], FGrgb[2], FGrgb[3]) setBgColor(BGrgb[1], BGrgb[2], BGrgb[3]) echo(text) end end end reset() end end -- Extending default libraries makes Babelfish happy. setmetatable( _G, { ["__call"] = function(func, ...) if type(func) == "function" then return func(...) else local h = metatable(func).__call if h then return h(func, ...) elseif _G[type(func)][func] then _G[type(func)][func](...) else debug("Error attempting to call function " .. func .. ", function does not exist.") end end end, }) function xor(a, b) if (a and (not b)) or (b and (not a)) then return true else return false end end function getOS() if string.char(getMudletHomeDir():byte()) == "/" then if string.find(os.getenv("HOME"), "home") == 2 then return "linux" else return "mac" end else return "windows" end end -- Opens URL in default browser function openURL(url) local os = getOS() if os == "linux" then _G.os.execute("xdg-open " .. url) elseif os == "mac" then _G.os.execute("open " .. url) elseif os == "windows" then _G.os.execute("start " .. url) end end -- Prints out a formatted list of all available named colors, optional arg specifies number of columns to print in, defaults to 3 function showColors(...) local cols = ... or 3 local i = 1 for k,v in pairs(color_table) do local fg local luminosity = (0.2126 * ((v[1]/255)^2.2)) + (0.7152 * ((v[2]/255)^2.2)) + (0.0722 * ((v[3]/255)^2.2)) if luminosity > 0.5 then fg = "black" else fg = "white" end cecho("<"..fg..":"..k..">"..k..string.rep(" ", 23-k:len())) echo" " if i == cols then echo"\n" i = 1 else i = i + 1 end end end -- Capitalize first character in a string function string:title() self = self:gsub("^%l", string.upper, 1) return self end --// Set functions // function _comp(a, b) if type(a) ~= type(b) then return false end if type(a) == 'table' then for k, v in pairs(a) do if not b[k] then return false end if not _comp(v, b[k]) then return false end end else if a ~= b then return false end end return true end --[[----------------------------------------------------------------------------------------- Table Union Returns a table that is the union of the provided tables. This is a union of key/value pairs. If two or more tables contain different values associated with the same key, that key in the returned table will contain a subtable containing all relevant values. See table.n_union() for a union of values. Note that the resulting table may not be reliably traversable with ipairs() due to the fact that it preserves keys. If there is a gap in numerical indices, ipairs() will cease traversal. Ex. tableA = { [1] = 123, [2] = 456, ["test"] = "test", } tableB = { [1] = 23, [3] = 7, ["test2"] = function() return true end, } tableC = { [5] = "c", } table.union(tableA, tableB, tableC) will return: { [1] = { 123, 23, }, [2] = 456, [3] = 7, [5] = "c", ["test"] = "test", ["test2"] = function() return true end, } --]]----------------------------------------------------------------------------------------- function table.union(...) local sets = arg local union = {} for _, set in ipairs(sets) do for key, val in pairs(set) do if union[key] and union[key] ~= val then if type(union[key]) == 'table' then table.insert(union[key], val) else union[key] = { union[key], val } end else union[key] = val end end end return union end --[[----------------------------------------------------------------------------------------- Table Union Returns a numerically indexed table that is the union of the provided tables. This is a union of unique values. The order and keys of the input tables are not preserved. --]]----------------------------------------------------------------------------------------- function table.n_union(...) local sets = arg local union = {} local union_keys = {} for _, set in ipairs(sets) do for key, val in pairs(set) do if not union_keys[val] then union_keys[val] = true table.insert(union, val) end end end return union end --[[----------------------------------------------------------------------------------------- Table Intersection Returns a table that is the intersection of the provided tables. This is an intersection of key/value pairs. See table.n_intersection() for an intersection of values. Note that the resulting table may not be reliably traversable with ipairs() due to the fact that it preserves keys. If there is a gap in numerical indices, ipairs() will cease traversal. Ex. tableA = { [1] = 123, [2] = 456, [4] = { 1, 2 }, [5] = "c", ["test"] = "test", } tableB = { [1] = 123, [2] = 4, [3] = 7, [4] = { 1, 2 }, ["test"] = function() return true end, } tableC = { [1] = 123, [4] = { 1, 2 }, [5] = "c", } table.intersection(tableA, tableB, tableC) will return: { [1] = 123, [4] = { 1, 2 }, } --]]----------------------------------------------------------------------------------------- function table.intersection(...) if #arg < 2 then return false end local intersection = {} local function intersect(set1, set2) local result = {} for key, val in pairs(set1) do if set2[key] then if _comp(val, set2[key]) then result[key] = val end end end return result end intersection = intersect(arg[1], arg[2]) for i, _ in ipairs(arg) do if i > 2 then intersection = intersect(intersection, arg[i]) end end return intersection end --[[----------------------------------------------------------------------------------------- Table Intersection Returns a numerically indexed table that is the intersection of the provided tables. This is an intersection of unique values. The order and keys of the input tables are not preserved. --]]----------------------------------------------------------------------------------------- function table.n_intersection(...) if #arg < 2 then return false end local intersection = {} local function intersect(set1, set2) local intersection_keys = {} local result = {} for _, val1 in pairs(set1) do for _, val2 in pairs(set2) do if _comp(val1, val2) and not intersection_keys[val1] then table.insert(result, val1) intersection_keys[val1] = true end end end return result end intersection = intersect(arg[1], arg[2]) for i, _ in ipairs(arg) do if i > 2 then intersection = intersect(intersection, arg[i]) end end return intersection end --[[----------------------------------------------------------------------------------------- Table Complement Returns a table that is the relative complement of the first table with respect to the second table. Returns a complement of key/value pairs. --]]----------------------------------------------------------------------------------------- function table.complement(set1, set2) if not set1 and set2 then return false end if type(set1) ~= 'table' or type(set2) ~= 'table' then return false end local complement = {} for key, val in pairs(set1) do if not _comp(set2[key], val) then complement[key] = val end end return complement end --[[----------------------------------------------------------------------------------------- Table Complement Returns a table that is the relative complement of the first table with respect to the second table. Returns a complement of values. --]]----------------------------------------------------------------------------------------- function table.n_complement(set1, set2) if not set1 and set2 then return false end local complement = {} for _, val1 in pairs(set1) do local insert = true for _, val2 in pairs(set2) do if _comp(val1, val2) then insert = false end end if insert then table.insert(complement, val1) end end return complement end -- Contribution from Iocun walklist = {} walkdelay = 0 function speedwalktimer() send(walklist[1]) table.remove(walklist, 1) if #walklist>0 then tempTimer(walkdelay, [[speedwalktimer()]]) end end function speedwalk(dirString, backwards, delay) local dirString = dirString:lower() walklist = {} walkdelay = delay local reversedir = { n = "s", en = "sw", e = "w", es = "nw", s = "n", ws = "ne", w = "e", wn = "se", u = "d", d = "u", ni = "out", tuo = "in" } if not backwards then for count, direction in string.gmatch(dirString, "([0-9]*)([neswudio][ewnu]?t?)") do count = (count == "" and 1 or count) for i=1, count do if delay then walklist[#walklist+1] = direction else send(direction) end end end else for direction, count in string.gmatch(dirString:reverse(), "(t?[ewnu]?[neswudio])([0-9]*)") do count = (count == "" and 1 or count) for i=1, count do if delay then walklist[#walklist+1] = reversedir[direction] else send(reversedir[direction]) end end end end if walkdelay then speedwalktimer() end end --[[----------------------------------------------------------------------------------------- Variable Persistence --]]----------------------------------------------------------------------------------------- SavedVariables = { } function SavedVariables:Add(tbl) if type(tbl) == 'string' then self[tbl] = _G[tbl] elseif type(tbl) == 'table' then for k,v in pairs(_G) do if _comp(v, tbl) then self[k] = tbl end end else hecho"|cff0000Error registering table for persistence: invalid argument to SavedVariables:Add()" end end
gpl-2.0
tarulas/luadch
core/adc.lua
1
26130
--[[ adc.lua by blastbeat - ADC stuff v0.09: by tarulas - strongly random salt - add FS (free slots) support, ADC ext 3.22 - add PFSR (partial file sharing) support, ADC ext 3.12 - add NATT (NAT traversal) support, ADC ext 3.9 v0.08: by blastbeat - add SEGA support (Grouping of file extensions in SCH) v0.07: by pulsar - improved out_put messages v0.06: by pulsar - add missing "AP" client flag in INF v0.05: by pulsar - add SUDP support (encrypting UDP traffic) - added: "KY" to "SCH" v0.04: by pulsar - add support for ASCH (Extended searching capability) - added: "FC", "TO", "RC" to "STA" - added: "MC", "PP", "OT", "NT", "MR", "PA", "RE" to "SCH" - added: "FI", "FO", "DA" to "RES" v0.03: by pulsar - set "nonpclones" to "false" in "commands.SCH" v0.02: by pulsar - add support for KEYP (Keyprint) - added: "KP" to "INF" ]]-- ----------------------------------// DECLARATION //-- local clean = use "cleantable" --// lua functions //-- local type = use "type" local ipairs = use "ipairs" local tostring = use "tostring" --// lua libs //-- local io = use "io" local os = use "os" local math = use "math" local table = use "table" local debug = use "debug" local string = use "string" --// lua lib methods //-- local io_open = io.open local os_date = os.date local os_time = os.time local os_clock = os.clock local string_sub = string.sub local string_byte = string.byte local math_random = math.random local math_fmod = math.fmod local string_gsub = string.gsub local string_find = string.find local string_match = string.match local table_insert = table.insert local table_concat = table.concat local table_remove = table.remove local debug_traceback = debug.traceback --// extern libs //-- local adclib = use "adclib" local unicode = use "unicode" --// extern lib methods //-- local utf_find = unicode.utf8.find local adclib_hash = adclib.hash local adclib_isutf8 = adclib.isutf8 local adclib_hashpas = adclib.hashpas --// core scripts //-- local out = use "out" local mem = use "mem" local types = use "types" --// core methods //-- local types_utf8 = types.utf8 local out_put = out.put local types_check = types.check --// functions //-- local parse local createid local tokenize local checkadccmd local checkadcstr local checkadcstring --// exported adc object methods //-- local adccmd_pos local adccmd_mysid local adccmd_getnp local adccmd_addnp local adccmd_setnp local adccmd_fourcc local adccmd_deletenp local adccmd_getallnp local adccmd_hasparam local adccmd_removesu local adccmd_targetsid local adccmd_adcstring --// tables //-- local _base32 local _clone local _regex -- some regex patterns local _buffer -- array with message params local _protocol -- adc specs local _protocol_types -- caching.. local _protocol_commands local _adccmds -- collection of all created adc commands --// simple data types //-- local _eol local _th -- pattern strings.. local _su local _sid local _sup local _sta local _bool local _onetwo local _integer local _feature local _contextsend local _contextdirect local _ ----------------------------------// DEFINITION //-- _adccmds = { } _clone = { } _buffer = { } _th = "^" .. string.rep( "[A-Z2-7]", 39 ) .. "$" _su = "[A-Z]" .. string.rep( "[A-Z0-9]", 3 ) .. "," _sta = "^[012]%d%d$" _sid = "^" .. string.rep( "[A-Z2-7]", 4 ) .. "$" _sup = "^" .. string.rep( "[A-Z]", 3 ) .. "[A-Z0-9]$" _bool = "^[1]?$" _onetwo = "^[12]?$" _integer = "^%d*$" _feature = "[%+%-][A-Z]" .. string.rep( "[A-Z0-9]", 3 ) _regex = { th = function( str ) return string_match( str, _th ) end, sid = function( str ) return string_match( str, _sid ) end, bool = function( str ) return string_match( str, _sid ) end, bool = function( str ) return string_match( str, _bool ) end, integer = function( str ) return string_match( str, _integer ) end, sta = function( str ) return string_match( str, _sta ) end, onetwo = function( str ) return string_match( str, _onetwo ) end, su = function( str ) str = str .. "," for i = 1, #str, 5 do if not string_match( string_sub( str, i, i + 5 ), _su ) then return false end end return true end, sup = function( str ) return string_match( str, _sup ) end, feature = function( str ) for i = 1, #str, 5 do if not string_match( string_sub( str, i, i + 5 ), _feature ) then return false end end return true end, default = function( ) return true end, --default = function( str ) -- return str --end, nowhitespace = function( str ) return not ( string_find( str, "\\n" ) or string_find( str, "\\s" ) ) end, context = { hub = "[H]", send = "[BFDE]", bcast = "[BF]", direct = "[DE]", hubdirect = "[HDE]", }, } _protocol = { types = { I = { len = 0, }, H = { len = 0, }, B = { _regex.sid, len = 1, }, F = { _regex.sid, _regex.feature, len = 2, }, D = { _regex.sid, _regex.sid, len = 2, }, E = { _regex.sid, _regex.sid, len = 2, }, }, commands = { SUP = { pp = { len = 0, }, np = { AD = _regex.sup, RM = _regex.sup, }, nonpclones = false, -- doesnt remove named parameters when parameter with same name already was found (for example ADBAS0, ADBASE) }, MSG = { pp = { _regex.default, len = 1, }, np = { PM = _regex.sid, ME = _regex.bool, }, nonpclones = true, -- removes named parameters when parameter with same name already was found (for example ME1, ME) }, STA = { pp = { _regex.sta, _regex.default, len = 2, }, np = { PR = _regex.default, FC = _regex.default, TL = _regex.default, TO = _regex.default, I4 = _regex.default, I6 = _regex.default, FM = _regex.default, FB = _regex.default, --// ASCH - Extended searching capability //-- http://adc.sourceforge.net/ADC-EXT.html#_asch_extended_searching_capability FC = _regex.default, TO = _regex.default, RC = _regex.default, }, nonpclones = true, -- removes named parameters when parameter with same name already was found (for example ME1, ME) }, INF = { pp = { len = 0, }, np = { ID = _regex.th, PD = _regex.th, I4 = _regex.default, -- ip string will be compared with real ip later, so no need for checking here.. I6 = _regex.default, U4 = _regex.integer, U6 = _regex.integer, SS = _regex.integer, SF = _regex.integer, US = _regex.integer, DS = _regex.integer, SL = _regex.integer, FS = _regex.integer, AS = _regex.integer, AM = _regex.integer, NI = _regex.nowhitespace, HN = _regex.integer, HR = _regex.integer, HO = _regex.integer, OP = _regex.bool, AW = _regex.onetwo, BO = _regex.bool, HI = _regex.bool, HU = _regex.bool, SU = _regex.su, CT = _regex.integer, DE = _regex.default, EM = _regex.default, AP = _regex.default, VE = _regex.default, --// KEYP - Certificate substitution protection //-- http://adc.sourceforge.net/ADC-EXT.html#_keyp_certificate_substitution_protection_in_conjunction_with_adcs KP = _regex.default, }, nonpclones = true, -- removes named parameters when parameter with same name already was found (for example HN1, HN4) }, CTM = { pp = { _regex.default, _regex.integer, _regex.default, len = 3, }, np = { }, nonpclones = false, }, RCM = { pp = { _regex.default, _regex.default, len = 2, }, np = { }, nonpclones = false, }, NAT = { pp = { _regex.default, _regex.integer, _regex.default, len = 3, }, np = { }, nonpclones = false, }, RNT = { pp = { _regex.default, _regex.integer, _regex.default, len = 3, }, np = { }, nonpclones = false, }, SCH = { pp = { len = 0, }, np = { AN = _regex.default, NO = _regex.default, EX = _regex.default, LE = _regex.integer, GE = _regex.integer, EQ = _regex.integer, TO = _regex.default, TY = _regex.onetwo, TR = _regex.th, TD = _regex.integer, --// ASCH - Extended searching capability //-- http://adc.sourceforge.net/ADC-EXT.html#_asch_extended_searching_capability MT = _regex.default, PP = _regex.default, OT = _regex.default, NT = _regex.default, MR = _regex.default, PA = _regex.default, RE = _regex.default, --// SUDP - Encrypting UDP traffic //-- http://adc.sourceforge.net/ADC-EXT.html#_sudp_encrypting_udp_traffic KY = _regex.default, --// SEGA - Grouping of file extensions in SCH //-- http://adc.sourceforge.net/ADC-EXT.html#_sega_grouping_of_file_extensions_in_sch GR = _regex.integer, RX = _regex.default, }, nonpclones = false, }, RES = { pp = { len = 0, }, np = { FN = _regex.default, SI = _regex.integer, SL = _regex.integer, TO = _regex.default, TR = _regex.th, TD = _regex.integer, --// ASCH - Extended searching capability //-- http://adc.sourceforge.net/ADC-EXT.html#_asch_extended_searching_capability FI = _regex.default, FO = _regex.default, DA = _regex.default, }, nonpclones = true, }, PSR = { pp = { len = 0, }, np = { HI = _regex.default, U4 = _regex.integer, U6 = _regex.integer, TR = _regex.th, PC = _regex.integer, PI = _regex.default, }, nonpclones = true, }, PAS = { pp = { _regex.th, len = 1, }, nonpclones = true, }, ADM = { pp = { _regex.default, _regex.default, _regex.default, len = 3, }, np = { PW = _regex.default, }, nonpclones = false, }, }, contexts = { STA = _regex.context.hubdirect, SUP = _regex.context.hub, SID = _regex.context.hub, INF = _regex.context.bcast, MSG = _regex.context.send, SCH = _regex.context.send, RES = _regex.context.direct, PSR = _regex.context.direct, CTM = _regex.context.direct, RCM = _regex.context.direct, NAT = _regex.context.direct, RNT = _regex.context.direct, GPA = _regex.context.hub, PAS = _regex.context.hub, QUI = _regex.context.hub, GET = _regex.context.hub, GFI = _regex.context.hub, SND = _regex.context.hub, ADM = _regex.context.hub, } } _base32 = { "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", "2", "3", "4", "5", "6", "7", } _protocol_types = _protocol.types _protocol_commands = _protocol.commands _contextsend = "[BFDE]" _contextdirect = "[DE]" adclib.createsid = function( ) return "".. _base32[ math_random( 32 ) ] .. _base32[ math_random( 32 ) ] .. _base32[ math_random( 32 ) ] .. _base32[ math_random( 32 ) ] end adclib.createsalt = function( num ) local randomdevice = io_open( "/dev/urandom", "r" ) num = num or 20 local randomstring = randomdevice:read( num ) randomdevice:close( ) local eol = 0 for i = 1, num do eol = eol + 1 _buffer[ eol ] = _base32[ math_fmod( string_byte( randomstring, i ), 32 ) + 1 ] end return table_concat( _buffer, "", 1, eol ) end checkadccmd = function( data, traceback, noerror ) local what = type( data ) if not _adccmds[ data ] then _ = noerror or error( "wrong type: adccmd expected, got " .. what, traceback or 3 ) return false end return true end checkadcstring = function( data, traceback, noerror ) local what = type( data ) if what ~= "string" or not adclib_isutf8( data ) or not parse( data ) then _ = noerror or error( "wrong type: adcstring expected, got " .. what, traceback or 3 ) return false end return true end checkadcstr = function( data, traceback, noerror ) local what = type( data ) if what ~= "string" or not adclib_isutf8( data ) or utf_find( data, " " ) or utf_find( data, "\n" ) then _ = noerror or error( "wrong type: adcstr expected, got " .. what, traceback or 3 ) return false end return true end createid = function( ) local str = os_date( ) .. os_clock( ) .. os_time( ) local pass = adclib.createsalt( ) local pid = adclib_hashpas( pass .. str, str .. pass ) return pid, adclib_hash( pid ) end tokenize = function( str ) _eol = _eol + 1 _buffer[ _eol ] = str end adccmd_pos = function( self, pos ) types_check( pos, "number" ) if pos == 1 then return self[ 1 ] .. self[ 2 ] else return self[ 2 * pos ] end end adccmd_getallnp = function( self ) local length = self.length local namedstart = self.namedstart if namedstart then local i = namedstart - 3 return function( ) i = i + 3 if i < length then return self[ i ], self[ i + 1 ] end end else return function( ) end end end adccmd_getnp = function( self, target ) types_utf8( target ) local namedstart = self.namedstart if namedstart then for i = namedstart, self.length, 3 do if target == self[ i ] then return self[ i + 1 ] end end end return nil end adccmd_addnp = function( self, target, value ) types_utf8( target ) types_utf8( value ) local length = self.length self[ length ] = " " self[ length + 1 ] = target self[ length + 2 ] = value self[ length + 3 ] = "\n" self.namedstart = self.namedstart or length + 1 local namedend = self.namedend if namedend then self.namedend = namedend + 3 else self.namedend = length + 2 end self.length = length + 3 self.cache = nil --types_check( self:adcstring( ), "adcstring" ) return true end adccmd_setnp = function( self, target, value ) types_utf8( target ) types_utf8( value ) local namedstart = self.namedstart local len = self.length if namedstart then for i = namedstart, len, 3 do if target == self[ i ] then self[ i + 1 ] = value self.cache = nil return true end end end --types_check( self:adcstring( ), "adcstring" ) return adccmd_addnp( self, target, value ) -- add new np end adccmd_deletenp = function( self, target ) types_utf8( target ) local length = self.length local namedstart = self.namedstart if namedstart then for i = namedstart, length, 3 do if target == self[ i ] then table_remove( self, i - 1 ) table_remove( self, i - 1 ) table_remove( self, i - 1 ) local namedend = self.namedend - 3 self.namedend = namedend self.length = length - 3 if namedend <= namedstart then self.namedstart, self.namedend = nil, nil end self.cache = nil return true end end end return false end adccmd_hasparam = function( self, target ) types_utf8( target ) for i = 1, self.length - 1 do local param = self[ i ] if target == param .. self[ i + 1 ] or target == param then return true end end return false end adccmd_removesu = function ( self, target ) local su = adccmd_getnp( self, "SU" ) if not su then return false end su = string_gsub( su, target..",", "" ) -- kill it in the middle or the start su = string_gsub( su, target, "" ) -- kill it at the end su = string_gsub( su, ",$", "" ) -- kill any trailing , adccmd_setnp( self, "SU", su ) self.cache = nil return true end adccmd_adcstring = function( self ) local adcstring = self.cache if not adcstring then adcstring = table_concat( self, "", 1, self.length ) self.cache = adcstring end return adcstring end adccmd_mysid = function( self ) return string_match( self[ 1 ], _contextsend ) and self[ 4 ] end adccmd_targetsid = function( self ) return string_match( self[ 1 ], _contextdirect ) and self[ 6 ] end adccmd_fourcc = function( self ) return self[ 1 ] .. self[ 2 ] end parse = function( data ) --types_utf8( data ) out_put( "adc.lua: try to parse '", data, "'" ) local command = { } -- array with parsed and checked message params (includes seperators and "\n"); is used also as adc command object with methods _eol = 0 -- end of buffer string_gsub( data, "([^ ]+)", tokenize ) -- extract message data into buffer; seperators wont be saved if _eol < 2 then out_put( "adc.lua: function 'parse': adc message to short" ) return nil end --// extract type, command from message header; check context //-- local fourcc = _buffer[ 1 ] local msgtype = string_sub( fourcc, 1, 1 ) local header = _protocol_types[ msgtype ] if not header then out_put( "adc.lua: function 'parse': type '", msgtype, "' is invalid, unknown or unsupported" ) return nil end local msgcmd = string_sub( fourcc, 2, -1 ) local context = _protocol.contexts[ msgcmd ] if not context or not string_match( msgtype, context ) then out_put( "adc.lua: function 'parse': invalid message header: type/cmd mismatch, unknown or unsupported ('", fourcc, "')" ) return nil end --// parse message header, body and parameters //-- command[ 1 ] = msgtype command[ 2 ] = msgcmd local length = 2 --// header //-- local len = header.len if _eol < len then out_put( "adc.lua: function 'parse': adc message to short" ) return nil end for i, regex in ipairs( header ) do local param = _buffer[ i + 1 ] if not regex( param ) then out_put( "adc.lua: function 'parse': invalid value in header '", fourcc, "': ", param ) return nil end length = length + 2 command[ length - 1 ] = " " command[ length ] = param end --// body //-- local cmd = _protocol_commands[ msgcmd ] if not cmd then out_put( "adc.lua: function 'parse': command '", msgcmd, "' is unknown or unsupported" ) return nil end --// positional parameters //-- local paramstart = 2 + len -- start of message params in buffer local positionalstart -- start of positional parameters in array "command" local positionalend -- end of positional parameters in array "command" local namedstart -- start of named parameters in array "command" local namedend -- end of named parameters in array "command" local ppregex = cmd.pp len = paramstart + ppregex.len - 1 for i = paramstart, len do local param = _buffer[ i ] if ppregex[ i - paramstart + 1 ]( param ) then length = length + 2 command[ length - 1 ] = " " command[ length ] = param positionalstart = positionalstart or length else out_put( "adc.lua: function 'parse': invalid positional parameter in '", fourcc, "' on position ", i, ": ", param ) return nil end end positionalend = positionalstart and length --// named paramters //-- local noclones = cmd.nonpclones local np = cmd.np for i = len + 1, _eol do local param = _buffer[ i ] local name = string_sub( param, 1, 2 ) or "" local npregex = np[ name ] if npregex then local body = string_sub( param, 3, -1 ) or "" if _clone[ name ] ~= true and _clone[ name ] ~= body then if npregex( body ) then length = length + 3 command[ length - 2 ] = " " command[ length - 1 ] = name command[ length ] = body if noclones then _clone[ name ] = true else _clone[ name ] = body end namedstart = namedstart or length - 1 else out_put( "adc.lua: function 'parse': invalid named parameter in '", fourcc, "': ", body ) return nil end else out_put( "adc.lua: function 'parse': removed clone named parameter in '", fourcc, "': ", body ) end else out_put( "adc.lua: function 'parse': ignored unknown named parameter in '", fourcc, "': ", name ) end end clean( _clone ) namedend = namedstart and length length = length + 1 command[ length ] = "\n" --// create adc command object //-- local contextsend = "[BFDE]" local contextdirect = "[DE]" --// public methods of the object //-- command.length = length command.namedend = namedend command.namedstart = namedstart --// this saves creating closures, but you have to use "self" //-- command.pos = adccmd_pos command.mysid = adccmd_mysid command.getnp = adccmd_getnp command.addnp = adccmd_addnp command.setnp = adccmd_setnp command.fourcc = adccmd_fourcc command.getallnp = adccmd_getallnp command.deletenp = adccmd_deletenp command.hasparam = adccmd_hasparam command.removesu = adccmd_removesu command.adcstring = adccmd_adcstring command.targetsid = adccmd_targetsid out_put( "adc.lua: function 'parse': parsed '", command:adcstring( ), "'" ) _adccmds[ command ] = fourcc return command, fourcc end ----------------------------------// BEGIN //-- use "setmetatable" ( _adccmds, { __mode = "k" } ) types.add( "adcstr", checkadcstr ) types.add( "adccmd", checkadccmd ) types.add( "adcstring", checkadcstring ) ----------------------------------// PUBLIC INTERFACE //-- return { parse = parse, createid = createid, }
gpl-3.0
qaheri/AASv2
plugins/Cpu.lua
9
1894
function run_sh(msg) name = get_name(msg) text = '' -- if config.sh_enabled == false then -- text = '!sh command is disabled' -- else -- if is_sudo(msg) then -- bash = msg.text:sub(4,-1) -- text = run_bash(bash) -- else -- text = name .. ' you have no power here!' -- end -- end if is_sudo(msg) then bash = msg.text:sub(4,-1) text = run_bash(bash) else text = name .. ' you have no power here!' end return text end function run_bash(str) local cmd = io.popen(str) local result = cmd:read('*all') cmd:close() return result end function on_getting_dialogs(cb_extra,success,result) if success then local dialogs={} for key,value in pairs(result) do for chatkey, chat in pairs(value.peer) do print(chatkey,chat) if chatkey=="id" then table.insert(dialogs,chat.."\n") end if chatkey=="print_name" then table.insert(dialogs,chat..": ") end end end send_msg(cb_extra[1],table.concat(dialogs),ok_cb,false) end end function run(msg, matches) if not is_sudo(msg) then return "شما دسترسی ندارید" end local receiver = get_receiver(msg) if string.match(msg.text, '!sh') then text = run_sh(msg) send_msg(receiver, text, ok_cb, false) return end if string.match(msg.text, 'uptime') then text = run_bash('uname -snr') .. ' ' .. run_bash('whoami') text = text .. '\n' .. run_bash('top -b |head -2') send_msg(receiver, text, ok_cb, false) return end if matches[1]=="Get dialogs" then get_dialog_list(on_getting_dialogs,{get_receiver(msg)}) return end end return { description = "shows cpuinfo", usage = "/uptime", patterns = { "^[!/#]uptime$", }, run = run }
gpl-2.0
MalRD/darkstar
scripts/zones/Apollyon/Zone.lua
9
10924
----------------------------------- -- -- Zone: Apollyon -- ----------------------------------- local ID = require("scripts/zones/Apollyon/IDs") require("scripts/globals/conquest") require("scripts/globals/limbus") require("scripts/globals/zone") ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) SetServerVariable("[NW_Apollyon]UniqueID",0); SetServerVariable("[SW_Apollyon]UniqueID",0); SetServerVariable("[NE_Apollyon]UniqueID",0) ; SetServerVariable("[SE_Apollyon]UniqueID",0); SetServerVariable("[CS_Apollyon]UniqueID",0); SetServerVariable("[CS_Apollyon_II]UniqueID",0); SetServerVariable("[Central_Apollyon]UniqueID",0); SetServerVariable("[Central_Apollyon_II]UniqueID",0); zone:registerRegion(1, 637,-4,-642,642,4,-637); -- APOLLYON_SE_NE exit zone:registerRegion(2, -642,-4,-642,-637,4,-637); -- APOLLYON_NW_SW exit zone:registerRegion(3, 468,-4,-637, 478,4,-622); -- appolyon SE register zone:registerRegion(4, 421,-4,-98, 455,4,-78); -- appolyon NE register zone:registerRegion(5, -470,-4,-629, -459,4,-620); -- appolyon SW register zone:registerRegion(6, -455,-4,-95, -425,4,-67); -- appolyon NW register zone:registerRegion(7, -3,-4,-214, 3,4,-210); -- appolyon CS register zone:registerRegion(8, -3,-4, 207, 3,4, 215); -- appolyon Center register zone:registerRegion(20, 396,-4,-522, 403,4,-516); -- appolyon SE telporter floor1 to floor2 zone:registerRegion(21, 116,-4,-443, 123,4,-436); -- appolyon SE telporter floor2 to floor3 zone:registerRegion(22, 276,-4,-283, 283,4,-276); -- appolyon SE telporter floor3 to floor4 zone:registerRegion(23, 517,-4,-323, 523,4,-316); -- appolyon SE telporter floor4 to entrance zone:registerRegion(24, 396,-4,76, 403,4,83); -- appolyon NE telporter floor1 to floor2 zone:registerRegion(25, 276,-4,356, 283,4,363); -- appolyon NE telporter floor2 to floor3 zone:registerRegion(26, 236,-4,517, 243,4,523); -- appolyon NE telporter floor3 to floor4 zone:registerRegion(27, 517,-4,637, 523,4,643); -- appolyon NE telporter floor4 to floor5 zone:registerRegion(28, 557,-4,356, 563,4,363); -- appolyon NE telporter floor5 to entrance zone:registerRegion(29, -403,-4,-523, -396,4,-516); -- appolyon SW telporter floor1 to floor2 zone:registerRegion(30, -123,-4,-443, -116,4,-436); -- appolyon SW telporter floor2 to floor3 zone:registerRegion(31, -283,-4,-283, -276,4,-276); -- appolyon SW telporter floor3 to floor4 zone:registerRegion(32, -523,-4,-323, -517,4,-316); -- appolyon SW telporter floor4 to entrance zone:registerRegion(33, -403,-4,76, -396,4,83); -- appolyon NW telporter floor1 to floor2 zone:registerRegion(34, -283,-4,356, -276,4,363); -- appolyon NW telporter floor2 to floor3 zone:registerRegion(35, -243,-4,516, -236,4,523); -- appolyon NW telporter floor3 to floor4 zone:registerRegion(36, -523,-4,636, -516,4,643); -- appolyon NW telporter floor4 to floor5 zone:registerRegion(37, -563,-4,356, -556,4,363); -- appolyon NW telporter floor5 to entrance end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) dsp.conq.onConquestUpdate(zone, updatetype) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) cs = -1; if (prevZone ~= dsp.zone.ALTAIEU) then local playerLimbusID = player:getCharVar("LimbusID"); if (playerLimbusID== 1290 or playerLimbusID== 1291 or playerLimbusID== 1294 or playerLimbusID== 1295 or playerLimbusID== 1296 or playerLimbusID== 1297) then player:setPos(-668,0.1,-666); else player:setPos(643,0.1,-600); end elseif ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(643,0.1,-600); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) local regionID = region:GetRegionID(); switch (regionID): caseof { [1] = function (x) player:startEvent(100); -- APOLLYON_SE_NE exit end, [2] = function (x) player:startEvent(101); -- APOLLYON_NW_SW exit -- print("APOLLYON_NW_SW"); end, [3] = function (x) if (player:hasStatusEffect(dsp.effect.BATTLEFIELD) == false) then RegisterLimbusInstance(player,1293); end --create instance appolyon SE end, [4] = function (x) if (player:hasStatusEffect(dsp.effect.BATTLEFIELD) == false) then RegisterLimbusInstance(player,1292); end --create instance appolyon NE end, [5] = function (x) if (player:hasStatusEffect(dsp.effect.BATTLEFIELD) == false) then RegisterLimbusInstance(player,1291); end --create instance appolyon SW end, [6] = function (x) if (player:hasStatusEffect(dsp.effect.BATTLEFIELD) == false) then RegisterLimbusInstance(player,1290); end --create instance appolyon NW end, [7] = function (x) if (player:hasStatusEffect(dsp.effect.BATTLEFIELD) == false) then RegisterLimbusInstance(player,1294); end --create instance appolyon CS end, [8] = function (x) if (player:hasStatusEffect(dsp.effect.BATTLEFIELD) == false) then RegisterLimbusInstance(player,1296); end --create instance appolyon CENTER end, -- ///////////////////////APOLLYON SE TELEPORTER/////////////////////////////////////////// [20] = function (x) -- print("SE_telporter_f1_to_f2"); if (IsMobDead(16932992)==true and player:getAnimation()==0) then player:startEvent(219);end end, [21] = function (x) -- print("SE_telporter_f2_to_f3"); if (IsMobDead(16933006)==true and player:getAnimation()==0) then player:startEvent(218);end end, [22] = function (x) -- print("SE_telporter_f3_to_f4"); if (IsMobDead(16933020)==true and player:getAnimation()==0) then player:startEvent(216);end end, [23] = function (x) -- print("SE_telporter_f3_to_entrance"); if (IsMobDead(16933032)==true and player:getAnimation()==0) then player:startEvent(217);end end, -- /////////////////////////////////////////////////////////////////////////////////////////// -- ///////////////////// APOLLYON NE TELEPORTER //////////////////////////////// [24] = function (x) -- print("NE_telporter_f1_to_f2"); if (IsMobDead(16933044)==true and player:getAnimation()==0) then player:startEvent(214);end end, [25] = function (x) -- print("NE_telporter_f2_to_f3"); if (IsMobDead(16933064)==true and player:getAnimation()==0) then player:startEvent(212);end --212 end, [26] = function (x) -- print("NE_telporter_f3_to_f4"); if (IsMobDead(16933086)==true and player:getAnimation()==0) then player:startEvent(210);end --210 end, [27] = function (x) -- print("NE_telporter_f4_to_f5"); if (IsMobDead(16933101)==true and player:getAnimation()==0) then player:startEvent(215);end --215 end, [28] = function (x) -- print("NE_telporter_f5_to_entrance"); if ( (IsMobDead(16933114)==true or IsMobDead(16933113)==true) and player:getAnimation()==0) then player:startEvent(213);end --213 end, -- ////////////////////////////////////////////////////////////////////////////////////////////////// -- ///////////////////// APOLLYON SW TELEPORTER //////////////////////////////// [29] = function (x) if (IsMobDead(16932873)==true and player:getAnimation()==0) then player:startEvent(208);end --208 end, [30] = function (x) if (IsMobDead(16932885)==true and player:getAnimation()==0) then player:startEvent(209);end --209 --printf("Mimics should be 0: %u",GetServerVariable("[SW_Apollyon]MimicTrigger")); end, [31] = function (x) if (( IsMobDead(16932896)==true or IsMobDead(16932897)==true or IsMobDead(16932898)==true or IsMobDead(16932899)==true )and player:getAnimation()==0) then player:startEvent(207);end -- 207 end, [32] = function (x) if (IselementalDayAreDead()==true and player:getAnimation()==0) then player:startEvent(206);end -- 206 end, -- ////////////////////////////////////////////////////////////////////////////////////////////////// -- ///////////////////// APOLLYON NW TELEPORTER //////////////////////////////// [33] = function (x) if (IsMobDead(16932937)==true and player:getAnimation()==0) then player:startEvent(205);end --205 end, [34] = function (x) if (IsMobDead(16932950)==true and player:getAnimation()==0) then player:startEvent(203);end --203 end, [35] = function (x) if (IsMobDead(16932963)==true and player:getAnimation()==0) then player:startEvent(201);end --201 end, [36] = function (x) if (IsMobDead(16932976)==true and player:getAnimation()==0) then player:startEvent(200);end --200 end, [37] = function (x) if (IsMobDead(16932985)==true and player:getAnimation()==0) then player:startEvent(202);end --202 end, } end; ----------------------------------- -- onRegionLeave ----------------------------------- function onRegionLeave(player,region) end; function onEventUpdate(player,csid,option) if (csid == 209 and option == 0 and GetServerVariable("[SW_Apollyon]MimicTrigger")==0) then SpawnCofferSWfloor3(); --printf("Mimics should be 1: %u",GetServerVariable("[SW_Apollyon]MimicTrigger")); elseif (csid == 207 and option == 0 and GetServerVariable("[SW_Apollyon]ElementalTrigger")==0) then SetServerVariable("[SW_Apollyon]ElementalTrigger",VanadielDayElement()+1); -- printf("Elementals should be 1: %u",GetServerVariable("[SW_Apollyon]ElementalTrigger")); end end; function onEventFinish(player,csid,option) if (csid == 100 and option == 1) then player:setPos(557,-1,441,128,33); -- APOLLYON_SE_NE exit elseif (csid == 101 and option == 1) then player:setPos(-561,0,443,242,33); -- APOLLYON_NW_SW exit end end;
gpl-3.0
mikhail-angelov/vlc
share/lua/playlist/youtube.lua
15
9862
--[[ $Id$ Copyright © 2007-2012 the VideoLAN team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. --]] -- Helper function to get a parameter's value in a URL function get_url_param( url, name ) local _, _, res = string.find( url, "[&?]"..name.."=([^&]*)" ) return res end function get_arturl() local iurl = get_url_param( vlc.path, "iurl" ) if iurl then return iurl end local video_id = get_url_param( vlc.path, "v" ) if not video_id then return nil end return "http://img.youtube.com/vi/"..video_id.."/default.jpg" end function get_prefres() local prefres = -1 if vlc.var and vlc.var.inherit then prefres = vlc.var.inherit(nil, "preferred-resolution") if prefres == nil then prefres = -1 end end return prefres end -- Pick the most suited format available function get_fmt( fmt_list ) local prefres = get_prefres() if prefres < 0 then return nil end local fmt = nil for itag,height in string.gmatch( fmt_list, "(%d+)/%d+x(%d+)/[^,]+" ) do -- Apparently formats are listed in quality -- order, so we take the first one that works, -- or fallback to the lowest quality fmt = itag if tonumber(height) <= prefres then break end end return fmt end -- Parse and pick our video URL function pick_url( url_map, fmt ) local path = nil for stream in string.gmatch( url_map, "[^,]+" ) do -- Apparently formats are listed in quality order, -- so we can afford to simply take the first one local itag = string.match( stream, "itag=(%d+)" ) if not fmt or not itag or tonumber( itag ) == tonumber( fmt ) then local url = string.match( stream, "url=([^&,]+)" ) if url then url = vlc.strings.decode_uri( url ) local sig = string.match( stream, "sig=([^&,]+)" ) local signature = "" if sig then signature = "&signature="..sig end path = url..signature break end end end return path end -- Probe function. function probe() if vlc.access ~= "http" and vlc.access ~= "https" then return false end youtube_site = string.match( string.sub( vlc.path, 1, 8 ), "youtube" ) if not youtube_site then -- FIXME we should be using a builtin list of known youtube websites -- like "fr.youtube.com", "uk.youtube.com" etc.. youtube_site = string.find( vlc.path, ".youtube.com" ) if youtube_site == nil then return false end end return ( string.match( vlc.path, "/watch%?" ) -- the html page or string.match( vlc.path, "/get_video_info%?" ) -- info API or string.match( vlc.path, "/v/" ) -- video in swf player or string.match( vlc.path, "/player2.swf" ) ) -- another player url end -- Parse function. function parse() if string.match( vlc.path, "/watch%?" ) then -- This is the HTML page's URL -- fmt is the format of the video -- (cf. http://en.wikipedia.org/wiki/YouTube#Quality_and_codecs) fmt = get_url_param( vlc.path, "fmt" ) while true do -- Try to find the video's title line = vlc.readline() if not line then break end if string.match( line, "<meta name=\"title\"" ) then _,_,name = string.find( line, "content=\"(.-)\"" ) name = vlc.strings.resolve_xml_special_chars( name ) name = vlc.strings.resolve_xml_special_chars( name ) end if string.match( line, "<meta name=\"description\"" ) then -- Don't ask me why they double encode ... _,_,description = string.find( line, "content=\"(.-)\"" ) description = vlc.strings.resolve_xml_special_chars( description ) description = vlc.strings.resolve_xml_special_chars( description ) end if string.match( line, "<meta property=\"og:image\"" ) then _,_,arturl = string.find( line, "content=\"(.-)\"" ) end if string.match( line, " rel=\"author\"" ) then _,_,artist = string.find( line, "href=\"/user/([^\"]*)\"" ) end -- JSON parameters, also formerly known as "swfConfig", -- "SWF_ARGS", "swfArgs", "PLAYER_CONFIG" ... if string.match( line, "playerConfig" ) then if not fmt then fmt_list = string.match( line, "\"fmt_list\": \"(.-)\"" ) if fmt_list then fmt_list = string.gsub( fmt_list, "\\/", "/" ) fmt = get_fmt( fmt_list ) end end url_map = string.match( line, "\"url_encoded_fmt_stream_map\": \"(.-)\"" ) if url_map then -- FIXME: do this properly url_map = string.gsub( url_map, "\\u0026", "&" ) path = pick_url( url_map, fmt ) end if not path then -- If this is a live stream, the URL map will be empty -- and we get the URL from this field instead local hlsvp = string.match( line, "\"hlsvp\": \"(.-)\"" ) if hlsvp then hlsvp = string.gsub( hlsvp, "\\/", "/" ) path = hlsvp end end -- There is also another version of the parameters, encoded -- differently, as an HTML attribute of an <object> or <embed> -- tag; but we don't need it now end end if not path then local video_id = get_url_param( vlc.path, "v" ) if video_id then if fmt then format = "&fmt=" .. fmt else format = "" end -- Without "el=detailpage", /get_video_info fails for many -- music videos with errors about copyrighted content being -- "restricted from playback on certain sites" path = "http://www.youtube.com/get_video_info?video_id="..video_id..format.."&el=detailpage" vlc.msg.warn( "Couldn't extract video URL, falling back to alternate youtube API" ) end end if not path then vlc.msg.err( "Couldn't extract youtube video URL, please check for updates to this script" ) return { } end if not arturl then arturl = get_arturl() end return { { path = path; name = name; description = description; artist = artist; arturl = arturl } } elseif string.match( vlc.path, "/get_video_info%?" ) then -- video info API local line = vlc.readline() -- data is on one line only local fmt = get_url_param( vlc.path, "fmt" ) if not fmt then local fmt_list = string.match( line, "&fmt_list=([^&]*)" ) if fmt_list then fmt_list = vlc.strings.decode_uri( fmt_list ) fmt = get_fmt( fmt_list ) end end local url_map = string.match( line, "&url_encoded_fmt_stream_map=([^&]*)" ) if url_map then url_map = vlc.strings.decode_uri( url_map ) path = pick_url( url_map, fmt ) end if not path then -- If this is a live stream, the URL map will be empty -- and we get the URL from this field instead local hlsvp = string.match( line, "&hlsvp=([^&]*)" ) if hlsvp then hlsvp = vlc.strings.decode_uri( hlsvp ) path = hlsvp end end if not path then vlc.msg.err( "Couldn't extract youtube video URL, please check for updates to this script" ) return { } end local title = string.match( line, "&title=([^&]*)" ) if title then title = string.gsub( title, "+", " " ) title = vlc.strings.decode_uri( title ) end local artist = string.match( line, "&author=([^&]*)" ) local arturl = string.match( line, "&thumbnail_url=([^&]*)" ) if arturl then arturl = vlc.strings.decode_uri( arturl ) end return { { path = path, title = title, artist = artist, arturl = arturl } } else -- This is the flash player's URL video_id = get_url_param( vlc.path, "video_id" ) if not video_id then _,_,video_id = string.find( vlc.path, "/v/([^?]*)" ) end if not video_id then vlc.msg.err( "Couldn't extract youtube video URL" ) return { } end fmt = get_url_param( vlc.path, "fmt" ) if fmt then format = "&fmt=" .. fmt else format = "" end return { { path = "http://www.youtube.com/watch?v="..video_id..format } } end end
gpl-2.0
RamiLego4Game/PlatformerWorld
Engine/loveframes/objects/internal/columnlist/columnlistarea.lua
6
9474
--[[------------------------------------------------ -- Love Frames - A GUI library for LOVE -- -- Copyright (c) 2012-2014 Kenny Shields -- --]]------------------------------------------------ -- columnlistarea class local newobject = loveframes.NewObject("columnlistarea", "loveframes_object_columnlistarea", true) --[[--------------------------------------------------------- - func: initialize() - desc: intializes the element --]]--------------------------------------------------------- function newobject:initialize(parent) self.type = "columnlistarea" self.display = "vertical" self.parent = parent self.width = 80 self.height = 25 self.clickx = 0 self.clicky = 0 self.offsety = 0 self.offsetx = 0 self.extrawidth = 0 self.extraheight = 0 self.rowcolorindex = 1 self.rowcolorindexmax = 2 self.buttonscrollamount = parent.buttonscrollamount self.mousewheelscrollamount = parent.mousewheelscrollamount self.bar = false self.dtscrolling = parent.dtscrolling self.internal = true self.internals = {} self.children = {} -- apply template properties to the object loveframes.templates.ApplyToObject(self) end --[[--------------------------------------------------------- - func: update(deltatime) - desc: updates the object --]]--------------------------------------------------------- function newobject:update(dt) local visible = self.visible local alwaysupdate = self.alwaysupdate if not visible then if not alwaysupdate then return end end local cwidth, cheight = self.parent:GetColumnSize() local parent = self.parent local base = loveframes.base local update = self.Update local internals = self.internals local children = self.children self:CheckHover() -- move to parent if there is a parent if parent ~= base then self.x = parent.x + self.staticx self.y = parent.y + self.staticy end for k, v in ipairs(internals) do v:update(dt) end for k, v in ipairs(children) do local col = loveframes.util.BoundingBox(self.x, v.x, self.y, v.y, self.width, v.width, self.height, v.height) if col then v:update(dt) end v:SetClickBounds(self.x, self.y, self.width, self.height) v.y = (v.parent.y + v.staticy) - self.offsety + cheight v.x = (v.parent.x + v.staticx) - self.offsetx end if update then update(self, dt) end end --[[--------------------------------------------------------- - func: draw() - desc: draws the object --]]--------------------------------------------------------- function newobject:draw() local visible = self.visible if not visible then return end local x = self.x local y = self.y local width = self.width local height = self.height local stencilfunc = function() love.graphics.rectangle("fill", x, y, width, height) end local skins = loveframes.skins.available local skinindex = loveframes.config["ACTIVESKIN"] local defaultskin = loveframes.config["DEFAULTSKIN"] local selfskin = self.skin local skin = skins[selfskin] or skins[skinindex] local drawfunc = skin.DrawColumnListArea or skins[defaultskin].DrawColumnListArea local drawoverfunc = skin.DrawOverColumnListArea or skins[defaultskin].DrawOverColumnListArea local draw = self.Draw local drawcount = loveframes.drawcount local internals = self.internals local children = self.children -- set the object's draw order self:SetDrawOrder() if draw then draw(self) else drawfunc(self) end love.graphics.setStencil(stencilfunc) for k, v in ipairs(children) do local col = loveframes.util.BoundingBox(self.x, v.x, self.y, v.y, self.width, v.width, self.height, v.height) if col then v:draw() end end love.graphics.setStencil() for k, v in ipairs(internals) do v:draw() end if not draw then skin.DrawOverColumnListArea(self) end end --[[--------------------------------------------------------- - func: mousepressed(x, y, button) - desc: called when the player presses a mouse button --]]--------------------------------------------------------- function newobject:mousepressed(x, y, button) local toplist = self:IsTopList() local scrollamount = self.mousewheelscrollamount local internals = self.internals local children = self.children if self.hover and button == "l" then local baseparent = self:GetBaseParent() if baseparent and baseparent.type == "frame" then baseparent:MakeTop() end end if self.bar and toplist then local bar = self:GetScrollBar() local dtscrolling = self.dtscrolling if dtscrolling then local dt = love.timer.getDelta() if button == "wu" then bar:Scroll(-scrollamount * dt) elseif button == "wd" then bar:Scroll(scrollamount * dt) end else if button == "wu" then bar:Scroll(-scrollamount) elseif button == "wd" then bar:Scroll(scrollamount) end end end for k, v in ipairs(internals) do v:mousepressed(x, y, button) end for k, v in ipairs(children) do v:mousepressed(x, y, button) end end --[[--------------------------------------------------------- - func: mousereleased(x, y, button) - desc: called when the player releases a mouse button --]]--------------------------------------------------------- function newobject:mousereleased(x, y, button) local internals = self.internals local children = self.children for k, v in ipairs(internals) do v:mousereleased(x, y, button) end for k, v in ipairs(children) do v:mousereleased(x, y, button) end end --[[--------------------------------------------------------- - func: CalculateSize() - desc: calculates the size of the object's children --]]--------------------------------------------------------- function newobject:CalculateSize() local columnheight = self.parent.columnheight local numitems = #self.children local height = self.height local width = self.width local itemheight = columnheight local itemwidth = 0 local bar = self.bar local children = self.children for k, v in ipairs(children) do itemheight = itemheight + v.height end self.itemheight = itemheight if self.itemheight > height then self.extraheight = self.itemheight - height if not bar then table.insert(self.internals, loveframes.objects["scrollbody"]:new(self, "vertical")) self.bar = true self:GetScrollBar().autoscroll = self.parent.autoscroll end else if bar then self.internals[1]:Remove() self.bar = false self.offsety = 0 end end end --[[--------------------------------------------------------- - func: RedoLayout() - desc: used to redo the layour of the object --]]--------------------------------------------------------- function newobject:RedoLayout() local children = self.children local starty = 0 local startx = 0 local bar = self.bar local display = self.display if #children > 0 then for k, v in ipairs(children) do local height = v.height v.staticx = startx v.staticy = starty if bar then v:SetWidth(self.width - self.internals[1].width) self.internals[1].staticx = self.width - self.internals[1].width self.internals[1].height = self.height else v:SetWidth(self.width) end starty = starty + v.height v.lastheight = v.height end end end --[[--------------------------------------------------------- - func: AddRow(data) - desc: adds a row to the object --]]--------------------------------------------------------- function newobject:AddRow(data) local row = loveframes.objects["columnlistrow"]:new(self, data) local colorindex = self.rowcolorindex local colorindexmax = self.rowcolorindexmax if colorindex == colorindexmax then self.rowcolorindex = 1 else self.rowcolorindex = colorindex + 1 end table.insert(self.children, row) self:CalculateSize() self:RedoLayout() self.parent:AdjustColumns() end --[[--------------------------------------------------------- - func: GetScrollBar() - desc: gets the object's scroll bar --]]--------------------------------------------------------- function newobject:GetScrollBar() local internals = self.internals if self.bar then local scrollbody = internals[1] local scrollarea = scrollbody.internals[1] local scrollbar = scrollarea.internals[1] return scrollbar else return false end end --[[--------------------------------------------------------- - func: Sort() - desc: sorts the object's children --]]--------------------------------------------------------- function newobject:Sort(column, desc) self.rowcolorindex = 1 local colorindexmax = self.rowcolorindexmax local children = self.children table.sort(children, function(a, b) if desc then return (tostring(a.columndata[column]) or a.columndata[column]) < (tostring(b.columndata[column]) or b.columndata[column]) else return (tostring(a.columndata[column]) or a.columndata[column]) > (tostring(b.columndata[column]) or b.columndata[column]) end end) for k, v in ipairs(children) do local colorindex = self.rowcolorindex v.colorindex = colorindex if colorindex == colorindexmax then self.rowcolorindex = 1 else self.rowcolorindex = colorindex + 1 end end self:CalculateSize() self:RedoLayout() end --[[--------------------------------------------------------- - func: Clear() - desc: removes all items from the object's list --]]--------------------------------------------------------- function newobject:Clear() self.children = {} self:CalculateSize() self:RedoLayout() self.parent:AdjustColumns() end
gpl-2.0
rigeirani/teshep
plugins/anti_spam.lua
3
3771
--An empty table for solving multiple kicking problem(thanks to @topkecleon ) kicktable = {} do local TIME_CHECK = 2 -- seconds local data = load_data(_config.moderation.data) -- Save stats, ban user local function pre_process(msg) -- Ignore service msg if msg.service then return msg end if msg.from.id == our_id then return msg end -- Save user on Redis if msg.from.type == 'user' then local hash = 'user:'..msg.from.id print('Saving user', hash) if msg.from.print_name then redis:hset(hash, 'print_name', msg.from.print_name) end if msg.from.first_name then redis:hset(hash, 'first_name', msg.from.first_name) end if msg.from.last_name then redis:hset(hash, 'last_name', msg.from.last_name) end end -- Save stats on Redis if msg.to.type == 'chat' then -- User is on chat local hash = 'chat:'..msg.to.id..':users' redis:sadd(hash, msg.from.id) end -- Total user msgs local hash = 'msgs:'..msg.from.id..':'..msg.to.id redis:incr(hash) --Load moderation data local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then --Check if flood is one or off if data[tostring(msg.to.id)]['settings']['flood'] == 'no' then return msg end end -- Check flood if msg.from.type == 'user' then local hash = 'user:'..msg.from.id..':msgs' local msgs = tonumber(redis:get(hash) or 0) local data = load_data(_config.moderation.data) local NUM_MSG_MAX = 5 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'])--Obtain group flood sensitivity end end local max_msg = NUM_MSG_MAX * 1 if msgs > max_msg then local user = msg.from.id -- Ignore mods,owner and admins if is_momod(msg) then return msg end local chat = msg.to.id local user = msg.from.id -- Return end if user was kicked before if kicktable[user] == true then return end kick_user(user, chat) local name = user_print_name(msg.from) --save it to log file savelog(msg.to.id, name.." ["..msg.from.id.."] kickato per spam! ") -- incr it on redis local gbanspam = 'gban:spam'..msg.from.id redis:incr(gbanspam) local gbanspam = 'gban:spam'..msg.from.id local gbanspamonredis = redis:get(gbanspam) --Check if user has spammed is group more than 4 times if gbanspamonredis then if tonumber(gbanspamonredis) == 4 and not is_owner(msg) then --Global ban that user banall_user(msg.from.id) local gbanspam = 'gban:spam'..msg.from.id --reset the counter redis:set(gbanspam, 0) local username = " " if msg.from.username ~= nil then username = msg.from.username end local name = user_print_name(msg.from) --Send this to that chat send_large_msg("chat#id"..msg.to.id, "L'utente [ "..name.." ]"..msg.from.id.." è stato bannato globalmente (spam)") local log_group = 1 --set log group caht id --send it to log group send_large_msg("chat#id"..log_group, "L'utente [ "..name.." ] ( @"..username.." )"..msg.from.id.." è stato bannato globalmente da ( "..msg.to.print_name.." ) [ "..msg.to.id.." ] (spam)") end end kicktable[user] = true msg = nil end redis:setex(hash, TIME_CHECK, msgs+1) end return msg end local function cron() --clear that table on the top of the plugins kicktable = {} end return { patterns = {}, cron = cron, pre_process = pre_process } end
gpl-2.0
Lsty/ygopro-scripts
c96598015.lua
3
2103
--金満な壺 function c96598015.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,96598015+EFFECT_COUNT_CODE_OATH) e1:SetCost(c96598015.cost) e1:SetTarget(c96598015.target) e1:SetOperation(c96598015.activate) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(96598015,ACTIVITY_SPSUMMON,c96598015.counterfilter) end function c96598015.counterfilter(c) return bit.band(c:GetSummonType(),SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end function c96598015.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(96598015,tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE+PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(c96598015.splimit) Duel.RegisterEffect(e1,tp) end function c96598015.splimit(e,c,sump,sumtype,sumpos,targetp,se) return bit.band(sumtype,SUMMON_TYPE_PENDULUM)~=SUMMON_TYPE_PENDULUM end function c96598015.filter(c) return c:IsType(TYPE_PENDULUM) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsAbleToDeck() and not c:IsHasEffect(EFFECT_NECRO_VALLEY) end function c96598015.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) and Duel.IsExistingMatchingCard(c96598015.filter,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,3,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,3,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function c96598015.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(c96598015.filter,tp,LOCATION_EXTRA+LOCATION_GRAVE,0,nil) if g:GetCount()<3 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local sg=g:Select(tp,3,3,nil) Duel.SendtoDeck(sg,nil,0,REASON_EFFECT) Duel.ShuffleDeck(tp) if sg:IsExists(Card.IsLocation,3,nil,LOCATION_DECK+LOCATION_EXTRA) then Duel.BreakEffect() Duel.Draw(tp,2,REASON_EFFECT) end end
gpl-2.0
Lsty/ygopro-scripts
c87973893.lua
7
2278
--甲虫装機の魔斧 ゼクトホーク function c87973893.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c87973893.target) e1:SetOperation(c87973893.operation) c:RegisterEffect(e1) --Atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(1000) 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(c87973893.eqlimit) c:RegisterEffect(e3) --actlimit local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_ATTACK_ANNOUNCE) e4:SetCondition(c87973893.accon) e4:SetOperation(c87973893.acop) c:RegisterEffect(e4) end function c87973893.eqlimit(e,c) return c:IsSetCard(0x56) end function c87973893.filter(c) return c:IsFaceup() and c:IsSetCard(0x56) end function c87973893.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and c87973893.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c87973893.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,c87973893.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function c87973893.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) end end function c87973893.accon(e,tp,eg,ep,ev,re,r,rp) return eg:GetFirst()==e:GetHandler():GetEquipTarget() end function c87973893.acop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,1) e1:SetValue(c87973893.aclimit) e1:SetReset(RESET_PHASE+PHASE_DAMAGE) Duel.RegisterEffect(e1,tp) end function c87973893.aclimit(e,re,tp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) end
gpl-2.0
Mkalo/forgottenserver
data/migrations/14.lua
55
1362
function onUpdateDatabase() print("> Updating database to version 15 (moving groups to data/XML/groups.xml)") db.query("ALTER TABLE players DROP FOREIGN KEY players_ibfk_2") db.query("DROP INDEX group_id ON players") db.query("ALTER TABLE accounts DROP FOREIGN KEY accounts_ibfk_1") db.query("DROP INDEX group_id ON accounts") db.query("ALTER TABLE `accounts` DROP `group_id`") local groupsFile = io.open("data/XML/groups.xml", "w") if groupsFile ~= nil then groupsFile:write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n") groupsFile:write("<groups>\r\n") local resultId = db.storeQuery("SELECT `id`, `name`, `flags`, `access`, `maxdepotitems`, `maxviplist` FROM `groups` ORDER BY `id` ASC") if resultId ~= false then repeat groupsFile:write("\t<group id=\"" .. result.getDataInt(resultId, "id") .. "\" name=\"" .. result.getDataString(resultId, "name") .. "\" flags=\"" .. string.format("%u", result.getDataLong(resultId, "flags")) .. "\" access=\"" .. result.getDataInt(resultId, "access") .. "\" maxdepotitems=\"" .. result.getDataInt(resultId, "maxdepotitems") .. "\" maxvipentries=\"" .. result.getDataInt(resultId, "maxviplist") .. "\" />\r\n") until not result.next(resultId) result.free(resultId) end groupsFile:write("</groups>\r\n") groupsFile:close() db.query("DROP TABLE `groups`") end return true end
gpl-2.0
ThingMesh/openwrt-luci
applications/luci-splash/luasrc/controller/splash/splash.lua
50
4511
module("luci.controller.splash.splash", package.seeall) local uci = luci.model.uci.cursor() local util = require "luci.util" function index() entry({"admin", "services", "splash"}, cbi("splash/splash"), _("Client-Splash"), 90) entry({"admin", "services", "splash", "splashtext" }, form("splash/splashtext"), _("Splashtext"), 10) local e e = node("splash") e.target = call("action_dispatch") node("splash", "activate").target = call("action_activate") node("splash", "splash").target = template("splash_splash/splash") node("splash", "blocked").target = template("splash/blocked") entry({"admin", "status", "splash"}, call("action_status_admin"), _("Client-Splash")) local page = node("splash", "publicstatus") page.target = call("action_status_public") page.leaf = true end function action_dispatch() local uci = luci.model.uci.cursor_state() local mac = luci.sys.net.ip4mac(luci.http.getenv("REMOTE_ADDR")) or "" local access = false uci:foreach("luci_splash", "lease", function(s) if s.mac and s.mac:lower() == mac then access = true end end) uci:foreach("luci_splash", "whitelist", function(s) if s.mac and s.mac:lower() == mac then access = true end end) if #mac > 0 and access then luci.http.redirect(luci.dispatcher.build_url()) else luci.http.redirect(luci.dispatcher.build_url("splash", "splash")) end end function blacklist() leased_macs = { } uci:foreach("luci_splash", "blacklist", function(s) leased_macs[s.mac:lower()] = true end) return leased_macs end function action_activate() local ip = luci.http.getenv("REMOTE_ADDR") or "127.0.0.1" local mac = luci.sys.net.ip4mac(ip:match("^[\[::ffff:]*(%d+.%d+%.%d+%.%d+)\]*$")) local uci_state = require "luci.model.uci".cursor_state() local blacklisted = false if mac and luci.http.formvalue("accept") then uci:foreach("luci_splash", "blacklist", function(s) if s.mac:lower() == mac or s.mac == mac then blacklisted = true end end) if blacklisted then luci.http.redirect(luci.dispatcher.build_url("splash" ,"blocked")) else local redirect_url = uci:get("luci_splash", "general", "redirect_url") if not redirect_url then redirect_url = uci_state:get("luci_splash_locations", mac:gsub(':', ''):lower(), "location") end if not redirect_url then redirect_url = luci.model.uci.cursor():get("freifunk", "community", "homepage") or 'http://www.freifunk.net' end remove_redirect(mac:gsub(':', ''):lower()) os.execute("luci-splash lease "..mac.." >/dev/null 2>&1") luci.http.redirect(redirect_url) end else luci.http.redirect(luci.dispatcher.build_url()) end end function action_status_admin() local uci = luci.model.uci.cursor_state() local macs = luci.http.formvaluetable("save") local changes = { whitelist = { }, blacklist = { }, lease = { }, remove = { } } for key, _ in pairs(macs) do local policy = luci.http.formvalue("policy.%s" % key) local mac = luci.http.protocol.urldecode(key) if policy == "whitelist" or policy == "blacklist" then changes[policy][#changes[policy]+1] = mac elseif policy == "normal" then changes["lease"][#changes["lease"]+1] = mac elseif policy == "kicked" then changes["remove"][#changes["remove"]+1] = mac end end if #changes.whitelist > 0 then os.execute("luci-splash whitelist %s >/dev/null" % table.concat(changes.whitelist)) end if #changes.blacklist > 0 then os.execute("luci-splash blacklist %s >/dev/null" % table.concat(changes.blacklist)) end if #changes.lease > 0 then os.execute("luci-splash lease %s >/dev/null" % table.concat(changes.lease)) end if #changes.remove > 0 then os.execute("luci-splash remove %s >/dev/null" % table.concat(changes.remove)) end luci.template.render("admin_status/splash", { is_admin = true }) end function action_status_public() luci.template.render("admin_status/splash", { is_admin = false }) end function remove_redirect(mac) local mac = mac:lower() mac = mac:gsub(":", "") local uci = require "luci.model.uci".cursor_state() local redirects = uci:get_all("luci_splash_locations") --uci:load("luci_splash_locations") uci:revert("luci_splash_locations") -- For all redirects for k, v in pairs(redirects) do if v[".type"] == "redirect" then if v[".name"] ~= mac then -- Rewrite state uci:section("luci_splash_locations", "redirect", v[".name"], { location = v.location }) end end end uci:save("luci_splash_redirects") end
apache-2.0
MalRD/darkstar
scripts/zones/Quicksand_Caves/npcs/qm7.lua
9
1473
----------------------------------- -- Area: Quicksand Caves -- NPC: ??? -- Involved in Mission: The Mithra and the Crystal (Zilart 12) -- !pos -504 20 -419 208 ----------------------------------- local ID = require("scripts/zones/Quicksand_Caves/IDs"); require("scripts/globals/keyitems"); require("scripts/globals/missions"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) if (player:getCurrentMission(ZILART) == dsp.mission.id.zilart.THE_MITHRA_AND_THE_CRYSTAL and player:getCharVar("ZilartStatus") == 1 and not player:hasKeyItem(dsp.ki.SCRAP_OF_PAPYRUS)) then if (player:needToZone() and player:getCharVar("AncientVesselKilled") == 1) then player:setCharVar("AncientVesselKilled",0); player:addKeyItem(dsp.ki.SCRAP_OF_PAPYRUS); player:messageSpecial(ID.text.KEYITEM_OBTAINED,dsp.ki.SCRAP_OF_PAPYRUS); else player:startEvent(12); end elseif (player:hasCompletedMission(ZILART,dsp.mission.id.zilart.THE_MITHRA_AND_THE_CRYSTAL) or player:hasKeyItem(dsp.ki.SCRAP_OF_PAPYRUS)) then player:messageSpecial(ID.text.YOU_FIND_NOTHING); else player:messageSpecial(ID.text.SOMETHING_IS_BURIED); end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 12 and option == 1) then SpawnMob(ID.mob.ANCIENT_VESSEL):updateClaim(player); end end;
gpl-3.0
LuaDist2/lrexlib-pcre
test/spencer_sets.lua
11
3250
-- See Copyright Notice in the file LICENSE local luatest = require "luatest" local N = luatest.NT local function norm(a) return a==nil and N or a end local function get_gsub (lib) return lib.gsub or function (subj, pattern, repl, n) return lib.new (pattern) : gsub (subj, repl, n) end end local function set_f_gsub1 (lib, flg) local subj, pat = "abcdef", "[abef]+" return { Name = "Function gsub, set1", Func = get_gsub (lib), --{ s, p, f, n, res1, res2, res3 }, { {"a\0c", ".", "#" }, {"###", 3, 3} }, -- subj contains nuls } end local function set_f_find (lib, flg) return { Name = "Function find", Func = lib.find, --{subj, patt, st,cf,ef}, { results } { {"a\0c", ".+"}, { 1,3 } }, -- subj contains nul { {"a\0c", "a\0c", N,flg.PEND}, { 1,3 } }, -- subj and patt contain nul } end local function set_f_match (lib, flg) return { Name = "Function match", Func = lib.match, --{subj, patt, st,cf,ef}, { results } { {"a\0c", ".+"}, {"a\0c"} }, -- subj contains nul { {"a\0c", "a\0c", N,flg.PEND}, {"a\0c"} }, -- subj and patt contain nul } end local function set_f_gmatch (lib, flg) -- gmatch (s, p, [cf], [ef]) local function test_gmatch (subj, patt) local out, guard = {}, 10 for a, b in lib.gmatch (subj, patt) do table.insert (out, { norm(a), norm(b) }) guard = guard - 1 if guard == 0 then break end end return unpack (out) end return { Name = "Function gmatch", Func = test_gmatch, --{ subj patt results } { {"a\0c", "." }, {{"a",N},{"\0",N},{"c",N}} },--nuls in subj } end local function set_f_split (lib, flg) -- split (s, p, [cf], [ef]) local function test_split (subj, patt) local out, guard = {}, 10 for a, b, c in lib.split (subj, patt) do table.insert (out, { norm(a), norm(b), norm(c) }) guard = guard - 1 if guard == 0 then break end end return unpack (out) end return { Name = "Function split", Func = test_split, --{ subj patt results } { {"a,\0,c", ","}, {{"a",",",N},{"\0",",",N},{"c",N,N}, } },--nuls in subj } end local function set_m_exec (lib, flg) return { Name = "Method exec", Method = "exec", -- {patt,cf}, {subj,st,ef} { results } { {".+"}, {"a\0c"}, {1,3,{}} }, -- subj contains nul { {"a\0c",flg.PEND}, {"a\0c"}, {1,3,{}} }, -- subj and patt contain nul } end local function set_m_tfind (lib, flg) return { Name = "Method tfind", Method = "tfind", -- {patt,cf}, {subj,st,ef} { results } { {".+"}, {"a\0c"}, {1,3,{}} }, -- subj contains nul { {"a\0c",flg.PEND}, {"a\0c"}, {1,3,{}} }, -- subj and patt contain nul } end return function (libname) local lib = require (libname) local flags = lib.flags () return { set_f_match (lib, flags), set_f_find (lib, flags), set_f_gmatch (lib, flags), set_f_gsub1 (lib, flags), set_m_exec (lib, flags), set_m_tfind (lib, flags), } end
mit
Lsty/ygopro-scripts
c87819421.lua
3
1403
--マスク・チャージ function c87819421.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c87819421.target) e1:SetOperation(c87819421.activate) c:RegisterEffect(e1) end function c87819421.filter1(c) return c:IsSetCard(0x8) and c:IsType(TYPE_MONSTER) and c:IsAbleToHand() end function c87819421.filter2(c) return c:IsSetCard(0xa5) and c:IsType(TYPE_QUICKPLAY) and c:IsAbleToHand() end function c87819421.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(c87819421.filter1,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsExistingTarget(c87819421.filter2,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g1=Duel.SelectTarget(tp,c87819421.filter1,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g2=Duel.SelectTarget(tp,c87819421.filter2,tp,LOCATION_GRAVE,0,1,1,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g1,2,0,0) end function c87819421.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) if sg:GetCount()>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end
gpl-2.0
MalRD/darkstar
scripts/zones/Northern_San_dOria/npcs/Macuillie.lua
12
2161
----------------------------------- -- Area: Northern San d'Oria -- NPC: Macuillie -- Type: Guildworker's Union Representative -- !pos -191.738 11.001 138.656 231 ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/crafting"); local ID = require("scripts/zones/Northern_San_dOria/IDs"); local keyitems = { [0] = { id = dsp.ki.METAL_PURIFICATION, rank = 3, cost = 40000 }, [1] = { id = dsp.ki.METAL_ENSORCELLMENT, rank = 3, cost = 40000 }, [2] = { id = dsp.ki.CHAINWORK, rank = 3, cost = 10000 }, [3] = { id = dsp.ki.SHEETING, rank = 3, cost = 10000 }, [4] = { id = dsp.ki.WAY_OF_THE_BLACKSMITH, rank = 9, cost = 20000 } }; local items = { [0] = { id = 15445, rank = 3, cost = 10000 }, [1] = { id = 14831, rank = 5, cost = 70000 }, [2] = { id = 14393, rank = 7, cost = 100000 }, [3] = { id = 153, rank = 9, cost = 150000 }, [4] = { id = 334, rank = 9, cost = 200000 }, [5] = { id = 15820, rank = 6, cost = 80000 }, [6] = { id = 3661, rank = 7, cost = 50000 }, [7] = { id = 3324, rank = 9, cost = 15000 } }; function onTrade(player,npc,trade) unionRepresentativeTrade(player, npc, trade, 730, 2); end; function onTrigger(player,npc) unionRepresentativeTrigger(player, 2, 729, "guild_smithing", keyitems); end; function onEventUpdate(player,csid,option,target) if (csid == 729) then unionRepresentativeTriggerFinish(player, option, target, 2, "guild_smithing", keyitems, items); end end; function onEventFinish(player,csid,option,target) if (csid == 729) then unionRepresentativeTriggerFinish(player, option, target, 2, "guild_smithing", keyitems, items); elseif (csid == 730) then player:messageSpecial(ID.text.GP_OBTAINED, option); end end;
gpl-3.0
Lsty/ygopro-scripts
c28106077.lua
7
2347
--ダグラの剣 function c28106077.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(c28106077.target) e1:SetOperation(c28106077.operation) c:RegisterEffect(e1) --recover local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCategory(CATEGORY_RECOVER) e2:SetDescription(aux.Stringid(28106077,0)) e2:SetCode(EVENT_BATTLE_DAMAGE) e2:SetRange(LOCATION_SZONE) e2:SetCondition(c28106077.reccon) e2:SetTarget(c28106077.rectg) e2:SetOperation(c28106077.recop) 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(c28106077.eqlimit) c:RegisterEffect(e3) --Atk up local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_EQUIP) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetValue(500) c:RegisterEffect(e4) end function c28106077.eqlimit(e,c) return c:IsRace(RACE_FAIRY) end function c28106077.filter(c) return c:IsFaceup() and c:IsRace(RACE_FAIRY) end function c28106077.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:GetLocation()==LOCATION_MZONE and c28106077.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(c28106077.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,c28106077.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function c28106077.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) end end function c28106077.reccon(e,tp,eg,ep,ev,re,r,rp) local ec=e:GetHandler():GetEquipTarget() return ec and eg:IsContains(ec) and ep~=tp end function c28106077.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(ev) Duel.SetOperationInfo(0,CATEGORY_RECOVER,0,0,tp,ev) end function c28106077.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
gpl-2.0
MalRD/darkstar
scripts/zones/Aht_Urhgan_Whitegate/npcs/Kubhe_Ijyuhla.lua
9
1681
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Kubhe Ijyuhla -- Standard Info NPC -- !pos 23.257 0.000 21.532 50 ----------------------------------- require("scripts/globals/quests") require("scripts/globals/settings") local ID = require("scripts/zones/Aht_Urhgan_Whitegate/IDs") ----------------------------------- function onTrade(player,npc,trade) end function onTrigger(player,npc) local threeMenProg = player:getCharVar("threemenandaclosetCS") local threeMenQuest = player:getQuestStatus(AHT_URHGAN,dsp.quest.id.ahtUrhgan.THREE_MEN_AND_A_CLOSET) if player:getQuestStatus(AHT_URHGAN,dsp.quest.id.ahtUrhgan.GOT_IT_ALL) == QUEST_COMPLETED and threeMenQuest == QUEST_AVAILABLE then player:startEvent(836) elseif threeMenProg == 2 then player:startEvent(837) elseif threeMenProg == 3 then player:startEvent(838) elseif threeMenProg == 4 then player:startEvent(839) elseif threeMenProg == 5 then player:startEvent(842) elseif threeMenProg == 6 then player:startEvent(845) elseif threeMenQuest == QUEST_COMPLETED then player:startEvent(846) end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) if csid == 836 then player:addQuest(AHT_URHGAN,dsp.quest.id.ahtUrhgan.THREE_MEN_AND_A_CLOSET) player:setCharVar("threemenandaclosetCS",2) elseif csid == 838 then player:setCharVar("threemenandaclosetCS",4) elseif csid == 845 then npcUtil.completeQuest(player, AHT_URHGAN, dsp.quest.id.ahtUrhgan.THREE_MEN_AND_A_CLOSET, { item=2184, var="threemenandaclosetCS"}) end end
gpl-3.0
Lsty/ygopro-scripts
c61307542.lua
3
3090
--버제스토마 아노말로카리스 function c61307542.initial_effect(c) --xyz summon aux.AddXyzProcedure(c,nil,2,3,nil,nil,5) c:EnableReviveLimit() --immune local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetValue(c61307542.efilter) c:RegisterEffect(e1) --reveal local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(61307542,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1) e2:SetCondition(c61307542.condition) e2:SetTarget(c61307542.target) e2:SetOperation(c61307542.operation) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(61307542,1)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1) e3:SetCondition(c61307542.descon) e3:SetCost(c61307542.descost) e3:SetTarget(c61307542.destg) e3:SetOperation(c61307542.desop) c:RegisterEffect(e3) end function c61307542.efilter(e,re) return re:IsActiveType(TYPE_MONSTER) and re:GetOwner()~=e:GetOwner() end function c61307542.cfilter(c,tp) return c:IsType(TYPE_TRAP) and c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_SZONE) and c:GetPreviousSequence()<5 end function c61307542.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(c61307542.cfilter,1,nil,tp) end function c61307542.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) end end function c61307542.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,1) then return end Duel.ConfirmDecktop(tp,1) local g=Duel.GetDecktopGroup(tp,1) local tc=g:GetFirst() if tc:IsType(TYPE_TRAP) and tc:IsAbleToHand() then Duel.DisableShuffleCheck() Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ShuffleHand(tp) else Duel.DisableShuffleCheck() Duel.SendtoGrave(tc,REASON_EFFECT+REASON_REVEAL) end end function c61307542.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetOverlayGroup():IsExists(Card.IsType,1,nil,TYPE_TRAP) end function c61307542.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST) end function c61307542.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsDestructable() end if chk==0 then return Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function c61307542.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
gpl-2.0
Lsty/ygopro-scripts
c9633505.lua
5
1209
--ガーディアン・ケースト function c9633505.initial_effect(c) --sum limit local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_SUMMON) e1:SetCondition(c9633505.sumlimit) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_FLIP_SUMMON) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EFFECT_SPSUMMON_CONDITION) 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:SetValue(c9633505.efilter) c:RegisterEffect(e4) --atk local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_IGNORE_BATTLE_TARGET) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e5:SetRange(LOCATION_MZONE) c:RegisterEffect(e5) end function c9633505.cfilter(c) return c:IsFaceup() and c:IsCode(95515060) end function c9633505.sumlimit(e) return not Duel.IsExistingMatchingCard(c9633505.cfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) end function c9633505.efilter(e,te) return te:IsActiveType(TYPE_SPELL) end
gpl-2.0
Lsty/ygopro-scripts
c52702748.lua
3
1802
--異次元への案内人 function c52702748.initial_effect(c) --control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(52702748,0)) e1:SetCategory(CATEGORY_CONTROL) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(c52702748.ctltg) e1:SetOperation(c52702748.ctlop) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(52702748,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCategory(CATEGORY_REMOVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(c52702748.rmtg) e2:SetOperation(c52702748.rmop) c:RegisterEffect(e2) end function c52702748.ctltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0) end function c52702748.ctlop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end if not Duel.GetControl(c,1-tp) and not c:IsImmuneToEffect(e) and c:IsAbleToChangeControler() then Duel.Destroy(c,REASON_EFFECT) end end function c52702748.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove(1-tp) end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_GRAVE,0,1,nil,1-tp) end Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(1-tp,Card.IsAbleToRemove,tp,LOCATION_GRAVE,0,1,1,nil,1-tp) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function c52702748.rmop(e,tp,eg,ep,ev,re,r,rp,chk) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
gpl-2.0
MalRD/darkstar
scripts/globals/mobskills/toxic_spit.lua
11
1093
--------------------------------------------- -- Toxic Spit -- -- Description: Spews a toxic glob at a single target. Additional effect: Poison -- Type: Magical Water -- Utsusemi/Blink absorb: Ignores shadows -- Notes: Additional effect can be removed with Poisona. --------------------------------------------- require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/monstertpmoves") --------------------------------------------- function onMobSkillCheck(target,mob,skill) return 0 end function onMobWeaponSkill(target, mob, skill) local typeEffect = dsp.effect.POISON local power = mob:getMainLvl()/5 + 3 MobStatusEffectMove(mob, target, typeEffect, power, 3, 120) local dmgmod = 1 local info = MobMagicalMove(mob,target,skill,mob:getWeaponDmg()*2.5,dsp.magic.ele.WATER,dmgmod,TP_NO_EFFECT) local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,dsp.attackType.MAGICAL,dsp.damageType.WATER,MOBPARAM_IGNORE_SHADOWS) target:takeDamage(dmg, mob, dsp.attackType.MAGICAL, dsp.damageType.WATER) return dmg end
gpl-3.0
EnglandTeam/EnglandTeamBot
libs/JSON.lua
3765
34843
-- -*- coding: utf-8 -*- -- -- Simple JSON encoding and decoding in pure Lua. -- -- Copyright 2010-2014 Jeffrey Friedl -- http://regex.info/blog/ -- -- Latest version: http://regex.info/blog/lua/json -- -- This code is released under a Creative Commons CC-BY "Attribution" License: -- http://creativecommons.org/licenses/by/3.0/deed.en_US -- -- It can be used for any purpose so long as the copyright notice above, -- the web-page links above, and the 'AUTHOR_NOTE' string below are -- maintained. Enjoy. -- local VERSION = 20141223.14 -- version history at end of file local AUTHOR_NOTE = "-[ JSON.lua package by Jeffrey Friedl (http://regex.info/blog/lua/json) version 20141223.14 ]-" -- -- The 'AUTHOR_NOTE' variable exists so that information about the source -- of the package is maintained even in compiled versions. It's also -- included in OBJDEF below mostly to quiet warnings about unused variables. -- local OBJDEF = { VERSION = VERSION, AUTHOR_NOTE = AUTHOR_NOTE, } -- -- Simple JSON encoding and decoding in pure Lua. -- http://www.json.org/ -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- -- -- -- DECODING (from a JSON string to a Lua table) -- -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local lua_value = JSON:decode(raw_json_text) -- -- If the JSON text is for an object or an array, e.g. -- { "what": "books", "count": 3 } -- or -- [ "Larry", "Curly", "Moe" ] -- -- the result is a Lua table, e.g. -- { what = "books", count = 3 } -- or -- { "Larry", "Curly", "Moe" } -- -- -- The encode and decode routines accept an optional second argument, -- "etc", which is not used during encoding or decoding, but upon error -- is passed along to error handlers. It can be of any type (including nil). -- -- -- -- ERROR HANDLING -- -- With most errors during decoding, this code calls -- -- JSON:onDecodeError(message, text, location, etc) -- -- with a message about the error, and if known, the JSON text being -- parsed and the byte count where the problem was discovered. You can -- replace the default JSON:onDecodeError() with your own function. -- -- The default onDecodeError() merely augments the message with data -- about the text and the location if known (and if a second 'etc' -- argument had been provided to decode(), its value is tacked onto the -- message as well), and then calls JSON.assert(), which itself defaults -- to Lua's built-in assert(), and can also be overridden. -- -- For example, in an Adobe Lightroom plugin, you might use something like -- -- function JSON:onDecodeError(message, text, location, etc) -- LrErrors.throwUserError("Internal Error: invalid JSON data") -- end -- -- or even just -- -- function JSON.assert(message) -- LrErrors.throwUserError("Internal Error: " .. message) -- end -- -- If JSON:decode() is passed a nil, this is called instead: -- -- JSON:onDecodeOfNilError(message, nil, nil, etc) -- -- and if JSON:decode() is passed HTML instead of JSON, this is called: -- -- JSON:onDecodeOfHTMLError(message, text, nil, etc) -- -- The use of the fourth 'etc' argument allows stronger coordination -- between decoding and error reporting, especially when you provide your -- own error-handling routines. Continuing with the the Adobe Lightroom -- plugin example: -- -- function JSON:onDecodeError(message, text, location, etc) -- local note = "Internal Error: invalid JSON data" -- if type(etc) = 'table' and etc.photo then -- note = note .. " while processing for " .. etc.photo:getFormattedMetadata('fileName') -- end -- LrErrors.throwUserError(note) -- end -- -- : -- : -- -- for i, photo in ipairs(photosToProcess) do -- : -- : -- local data = JSON:decode(someJsonText, { photo = photo }) -- : -- : -- end -- -- -- -- -- -- DECODING AND STRICT TYPES -- -- Because both JSON objects and JSON arrays are converted to Lua tables, -- it's not normally possible to tell which original JSON type a -- particular Lua table was derived from, or guarantee decode-encode -- round-trip equivalency. -- -- However, if you enable strictTypes, e.g. -- -- JSON = assert(loadfile "JSON.lua")() --load the routines -- JSON.strictTypes = true -- -- then the Lua table resulting from the decoding of a JSON object or -- JSON array is marked via Lua metatable, so that when re-encoded with -- JSON:encode() it ends up as the appropriate JSON type. -- -- (This is not the default because other routines may not work well with -- tables that have a metatable set, for example, Lightroom API calls.) -- -- -- ENCODING (from a lua table to a JSON string) -- -- JSON = assert(loadfile "JSON.lua")() -- one-time load of the routines -- -- local raw_json_text = JSON:encode(lua_table_or_value) -- local pretty_json_text = JSON:encode_pretty(lua_table_or_value) -- "pretty printed" version for human readability -- local custom_pretty = JSON:encode(lua_table_or_value, etc, { pretty = true, indent = "| ", align_keys = false }) -- -- On error during encoding, this code calls: -- -- JSON:onEncodeError(message, etc) -- -- which you can override in your local JSON object. -- -- The 'etc' in the error call is the second argument to encode() -- and encode_pretty(), or nil if it wasn't provided. -- -- -- PRETTY-PRINTING -- -- An optional third argument, a table of options, allows a bit of -- configuration about how the encoding takes place: -- -- pretty = JSON:encode(val, etc, { -- pretty = true, -- if false, no other options matter -- indent = " ", -- this provides for a three-space indent per nesting level -- align_keys = false, -- see below -- }) -- -- encode() and encode_pretty() are identical except that encode_pretty() -- provides a default options table if none given in the call: -- -- { pretty = true, align_keys = false, indent = " " } -- -- For example, if -- -- JSON:encode(data) -- -- produces: -- -- {"city":"Kyoto","climate":{"avg_temp":16,"humidity":"high","snowfall":"minimal"},"country":"Japan","wards":11} -- -- then -- -- JSON:encode_pretty(data) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- The following three lines return identical results: -- JSON:encode_pretty(data) -- JSON:encode_pretty(data, nil, { pretty = true, align_keys = false, indent = " " }) -- JSON:encode (data, nil, { pretty = true, align_keys = false, indent = " " }) -- -- An example of setting your own indent string: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = "| " }) -- -- produces: -- -- { -- | "city": "Kyoto", -- | "climate": { -- | | "avg_temp": 16, -- | | "humidity": "high", -- | | "snowfall": "minimal" -- | }, -- | "country": "Japan", -- | "wards": 11 -- } -- -- An example of setting align_keys to true: -- -- JSON:encode_pretty(data, nil, { pretty = true, indent = " ", align_keys = true }) -- -- produces: -- -- { -- "city": "Kyoto", -- "climate": { -- "avg_temp": 16, -- "humidity": "high", -- "snowfall": "minimal" -- }, -- "country": "Japan", -- "wards": 11 -- } -- -- which I must admit is kinda ugly, sorry. This was the default for -- encode_pretty() prior to version 20141223.14. -- -- -- AMBIGUOUS SITUATIONS DURING THE ENCODING -- -- During the encode, if a Lua table being encoded contains both string -- and numeric keys, it fits neither JSON's idea of an object, nor its -- idea of an array. To get around this, when any string key exists (or -- when non-positive numeric keys exist), numeric keys are converted to -- strings. -- -- For example, -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- produces the JSON object -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To prohibit this conversion and instead make it an error condition, set -- JSON.noKeyConversion = true -- -- -- SUMMARY OF METHODS YOU CAN OVERRIDE IN YOUR LOCAL LUA JSON OBJECT -- -- assert -- onDecodeError -- onDecodeOfNilError -- onDecodeOfHTMLError -- onEncodeError -- -- If you want to create a separate Lua JSON object with its own error handlers, -- you can reload JSON.lua or use the :new() method. -- --------------------------------------------------------------------------- local default_pretty_indent = " " local default_pretty_options = { pretty = true, align_keys = false, indent = default_pretty_indent } local isArray = { __tostring = function() return "JSON array" end } isArray.__index = isArray local isObject = { __tostring = function() return "JSON object" end } isObject.__index = isObject function OBJDEF:newArray(tbl) return setmetatable(tbl or {}, isArray) end function OBJDEF:newObject(tbl) return setmetatable(tbl or {}, isObject) end local function unicode_codepoint_as_utf8(codepoint) -- -- codepoint is a number -- if codepoint <= 127 then return string.char(codepoint) elseif codepoint <= 2047 then -- -- 110yyyxx 10xxxxxx <-- useful notation from http://en.wikipedia.org/wiki/Utf8 -- local highpart = math.floor(codepoint / 0x40) local lowpart = codepoint - (0x40 * highpart) return string.char(0xC0 + highpart, 0x80 + lowpart) elseif codepoint <= 65535 then -- -- 1110yyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x1000) local remainder = codepoint - 0x1000 * highpart local midpart = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midpart highpart = 0xE0 + highpart midpart = 0x80 + midpart lowpart = 0x80 + lowpart -- -- Check for an invalid character (thanks Andy R. at Adobe). -- See table 3.7, page 93, in http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf#G28070 -- if ( highpart == 0xE0 and midpart < 0xA0 ) or ( highpart == 0xED and midpart > 0x9F ) or ( highpart == 0xF0 and midpart < 0x90 ) or ( highpart == 0xF4 and midpart > 0x8F ) then return "?" else return string.char(highpart, midpart, lowpart) end else -- -- 11110zzz 10zzyyyy 10yyyyxx 10xxxxxx -- local highpart = math.floor(codepoint / 0x40000) local remainder = codepoint - 0x40000 * highpart local midA = math.floor(remainder / 0x1000) remainder = remainder - 0x1000 * midA local midB = math.floor(remainder / 0x40) local lowpart = remainder - 0x40 * midB return string.char(0xF0 + highpart, 0x80 + midA, 0x80 + midB, 0x80 + lowpart) end end function OBJDEF:onDecodeError(message, text, location, etc) if text then if location then message = string.format("%s at char %d of: %s", message, location, text) else message = string.format("%s: %s", message, text) end end if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end OBJDEF.onDecodeOfNilError = OBJDEF.onDecodeError OBJDEF.onDecodeOfHTMLError = OBJDEF.onDecodeError function OBJDEF:onEncodeError(message, etc) if etc ~= nil then message = message .. " (" .. OBJDEF:encode(etc) .. ")" end if self.assert then self.assert(false, message) else assert(false, message) end end local function grok_number(self, text, start, etc) -- -- Grab the integer part -- local integer_part = text:match('^-?[1-9]%d*', start) or text:match("^-?0", start) if not integer_part then self:onDecodeError("expected number", text, start, etc) end local i = start + integer_part:len() -- -- Grab an optional decimal part -- local decimal_part = text:match('^%.%d+', i) or "" i = i + decimal_part:len() -- -- Grab an optional exponential part -- local exponent_part = text:match('^[eE][-+]?%d+', i) or "" i = i + exponent_part:len() local full_number_text = integer_part .. decimal_part .. exponent_part local as_number = tonumber(full_number_text) if not as_number then self:onDecodeError("bad number", text, start, etc) end return as_number, i end local function grok_string(self, text, start, etc) if text:sub(start,start) ~= '"' then self:onDecodeError("expected string's opening quote", text, start, etc) end local i = start + 1 -- +1 to bypass the initial quote local text_len = text:len() local VALUE = "" while i <= text_len do local c = text:sub(i,i) if c == '"' then return VALUE, i + 1 end if c ~= '\\' then VALUE = VALUE .. c i = i + 1 elseif text:match('^\\b', i) then VALUE = VALUE .. "\b" i = i + 2 elseif text:match('^\\f', i) then VALUE = VALUE .. "\f" i = i + 2 elseif text:match('^\\n', i) then VALUE = VALUE .. "\n" i = i + 2 elseif text:match('^\\r', i) then VALUE = VALUE .. "\r" i = i + 2 elseif text:match('^\\t', i) then VALUE = VALUE .. "\t" i = i + 2 else local hex = text:match('^\\u([0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if hex then i = i + 6 -- bypass what we just read -- We have a Unicode codepoint. It could be standalone, or if in the proper range and -- followed by another in a specific range, it'll be a two-code surrogate pair. local codepoint = tonumber(hex, 16) if codepoint >= 0xD800 and codepoint <= 0xDBFF then -- it's a hi surrogate... see whether we have a following low local lo_surrogate = text:match('^\\u([dD][cdefCDEF][0123456789aAbBcCdDeEfF][0123456789aAbBcCdDeEfF])', i) if lo_surrogate then i = i + 6 -- bypass the low surrogate we just read codepoint = 0x2400 + (codepoint - 0xD800) * 0x400 + tonumber(lo_surrogate, 16) else -- not a proper low, so we'll just leave the first codepoint as is and spit it out. end end VALUE = VALUE .. unicode_codepoint_as_utf8(codepoint) else -- just pass through what's escaped VALUE = VALUE .. text:match('^\\(.)', i) i = i + 2 end end end self:onDecodeError("unclosed string", text, start, etc) end local function skip_whitespace(text, start) local _, match_end = text:find("^[ \n\r\t]+", start) -- [http://www.ietf.org/rfc/rfc4627.txt] Section 2 if match_end then return match_end + 1 else return start end end local grok_one -- assigned later local function grok_object(self, text, start, etc) if text:sub(start,start) ~= '{' then self:onDecodeError("expected '{'", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '{' local VALUE = self.strictTypes and self:newObject { } or { } if text:sub(i,i) == '}' then return VALUE, i + 1 end local text_len = text:len() while i <= text_len do local key, new_i = grok_string(self, text, i, etc) i = skip_whitespace(text, new_i) if text:sub(i, i) ~= ':' then self:onDecodeError("expected colon", text, i, etc) end i = skip_whitespace(text, i + 1) local new_val, new_i = grok_one(self, text, i) VALUE[key] = new_val -- -- Expect now either '}' to end things, or a ',' to allow us to continue. -- i = skip_whitespace(text, new_i) local c = text:sub(i,i) if c == '}' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '}'", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '{'", text, start, etc) end local function grok_array(self, text, start, etc) if text:sub(start,start) ~= '[' then self:onDecodeError("expected '['", text, start, etc) end local i = skip_whitespace(text, start + 1) -- +1 to skip the '[' local VALUE = self.strictTypes and self:newArray { } or { } if text:sub(i,i) == ']' then return VALUE, i + 1 end local VALUE_INDEX = 1 local text_len = text:len() while i <= text_len do local val, new_i = grok_one(self, text, i) -- can't table.insert(VALUE, val) here because it's a no-op if val is nil VALUE[VALUE_INDEX] = val VALUE_INDEX = VALUE_INDEX + 1 i = skip_whitespace(text, new_i) -- -- Expect now either ']' to end things, or a ',' to allow us to continue. -- local c = text:sub(i,i) if c == ']' then return VALUE, i + 1 end if text:sub(i, i) ~= ',' then self:onDecodeError("expected comma or '['", text, i, etc) end i = skip_whitespace(text, i + 1) end self:onDecodeError("unclosed '['", text, start, etc) end grok_one = function(self, text, start, etc) -- Skip any whitespace start = skip_whitespace(text, start) if start > text:len() then self:onDecodeError("unexpected end of string", text, nil, etc) end if text:find('^"', start) then return grok_string(self, text, start, etc) elseif text:find('^[-0123456789 ]', start) then return grok_number(self, text, start, etc) elseif text:find('^%{', start) then return grok_object(self, text, start, etc) elseif text:find('^%[', start) then return grok_array(self, text, start, etc) elseif text:find('^true', start) then return true, start + 4 elseif text:find('^false', start) then return false, start + 5 elseif text:find('^null', start) then return nil, start + 4 else self:onDecodeError("can't parse JSON", text, start, etc) end end function OBJDEF:decode(text, etc) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onDecodeError("JSON:decode must be called in method format", nil, nil, etc) end if text == nil then self:onDecodeOfNilError(string.format("nil passed to JSON:decode()"), nil, nil, etc) elseif type(text) ~= 'string' then self:onDecodeError(string.format("expected string argument to JSON:decode(), got %s", type(text)), nil, nil, etc) end if text:match('^%s*$') then return nil end if text:match('^%s*<') then -- Can't be JSON... we'll assume it's HTML self:onDecodeOfHTMLError(string.format("html passed to JSON:decode()"), text, nil, etc) end -- -- Ensure that it's not UTF-32 or UTF-16. -- Those are perfectly valid encodings for JSON (as per RFC 4627 section 3), -- but this package can't handle them. -- if text:sub(1,1):byte() == 0 or (text:len() >= 2 and text:sub(2,2):byte() == 0) then self:onDecodeError("JSON package groks only UTF-8, sorry", text, nil, etc) end local success, value = pcall(grok_one, self, text, 1, etc) if success then return value else -- if JSON:onDecodeError() didn't abort out of the pcall, we'll have received the error message here as "value", so pass it along as an assert. if self.assert then self.assert(false, value) else assert(false, value) end -- and if we're still here, return a nil and throw the error message on as a second arg return nil, value end end local function backslash_replacement_function(c) if c == "\n" then return "\\n" elseif c == "\r" then return "\\r" elseif c == "\t" then return "\\t" elseif c == "\b" then return "\\b" elseif c == "\f" then return "\\f" elseif c == '"' then return '\\"' elseif c == '\\' then return '\\\\' else return string.format("\\u%04x", c:byte()) end end local chars_to_be_escaped_in_JSON_string = '[' .. '"' -- class sub-pattern to match a double quote .. '%\\' -- class sub-pattern to match a backslash .. '%z' -- class sub-pattern to match a null .. '\001' .. '-' .. '\031' -- class sub-pattern to match control characters .. ']' local function json_string_literal(value) local newval = value:gsub(chars_to_be_escaped_in_JSON_string, backslash_replacement_function) return '"' .. newval .. '"' end local function object_or_array(self, T, etc) -- -- We need to inspect all the keys... if there are any strings, we'll convert to a JSON -- object. If there are only numbers, it's a JSON array. -- -- If we'll be converting to a JSON object, we'll want to sort the keys so that the -- end result is deterministic. -- local string_keys = { } local number_keys = { } local number_keys_must_be_strings = false local maximum_number_key for key in pairs(T) do if type(key) == 'string' then table.insert(string_keys, key) elseif type(key) == 'number' then table.insert(number_keys, key) if key <= 0 or key >= math.huge then number_keys_must_be_strings = true elseif not maximum_number_key or key > maximum_number_key then maximum_number_key = key end else self:onEncodeError("can't encode table with a key of type " .. type(key), etc) end end if #string_keys == 0 and not number_keys_must_be_strings then -- -- An empty table, or a numeric-only array -- if #number_keys > 0 then return nil, maximum_number_key -- an array elseif tostring(T) == "JSON array" then return nil elseif tostring(T) == "JSON object" then return { } else -- have to guess, so we'll pick array, since empty arrays are likely more common than empty objects return nil end end table.sort(string_keys) local map if #number_keys > 0 then -- -- If we're here then we have either mixed string/number keys, or numbers inappropriate for a JSON array -- It's not ideal, but we'll turn the numbers into strings so that we can at least create a JSON object. -- if self.noKeyConversion then self:onEncodeError("a table with both numeric and string keys could be an object or array; aborting", etc) end -- -- Have to make a shallow copy of the source table so we can remap the numeric keys to be strings -- map = { } for key, val in pairs(T) do map[key] = val end table.sort(number_keys) -- -- Throw numeric keys in there as strings -- for _, number_key in ipairs(number_keys) do local string_key = tostring(number_key) if map[string_key] == nil then table.insert(string_keys , string_key) map[string_key] = T[number_key] else self:onEncodeError("conflict converting table with mixed-type keys into a JSON object: key " .. number_key .. " exists both as a string and a number.", etc) end end end return string_keys, nil, map end -- -- Encode -- -- 'options' is nil, or a table with possible keys: -- pretty -- if true, return a pretty-printed version -- indent -- a string (usually of spaces) used to indent each nested level -- align_keys -- if true, align all the keys when formatting a table -- local encode_value -- must predeclare because it calls itself function encode_value(self, value, parents, etc, options, indent) if value == nil then return 'null' elseif type(value) == 'string' then return json_string_literal(value) elseif type(value) == 'number' then if value ~= value then -- -- NaN (Not a Number). -- JSON has no NaN, so we have to fudge the best we can. This should really be a package option. -- return "null" elseif value >= math.huge then -- -- Positive infinity. JSON has no INF, so we have to fudge the best we can. This should -- really be a package option. Note: at least with some implementations, positive infinity -- is both ">= math.huge" and "<= -math.huge", which makes no sense but that's how it is. -- Negative infinity is properly "<= -math.huge". So, we must be sure to check the ">=" -- case first. -- return "1e+9999" elseif value <= -math.huge then -- -- Negative infinity. -- JSON has no INF, so we have to fudge the best we can. This should really be a package option. -- return "-1e+9999" else return tostring(value) end elseif type(value) == 'boolean' then return tostring(value) elseif type(value) ~= 'table' then self:onEncodeError("can't convert " .. type(value) .. " to JSON", etc) else -- -- A table to be converted to either a JSON object or array. -- local T = value if type(options) ~= 'table' then options = {} end if type(indent) ~= 'string' then indent = "" end if parents[T] then self:onEncodeError("table " .. tostring(T) .. " is a child of itself", etc) else parents[T] = true end local result_value local object_keys, maximum_number_key, map = object_or_array(self, T, etc) if maximum_number_key then -- -- An array... -- local ITEMS = { } for i = 1, maximum_number_key do table.insert(ITEMS, encode_value(self, T[i], parents, etc, options, indent)) end if options.pretty then result_value = "[ " .. table.concat(ITEMS, ", ") .. " ]" else result_value = "[" .. table.concat(ITEMS, ",") .. "]" end elseif object_keys then -- -- An object -- local TT = map or T if options.pretty then local KEYS = { } local max_key_length = 0 for _, key in ipairs(object_keys) do local encoded = encode_value(self, tostring(key), parents, etc, options, indent) if options.align_keys then max_key_length = math.max(max_key_length, #encoded) end table.insert(KEYS, encoded) end local key_indent = indent .. tostring(options.indent or "") local subtable_indent = key_indent .. string.rep(" ", max_key_length) .. (options.align_keys and " " or "") local FORMAT = "%s%" .. string.format("%d", max_key_length) .. "s: %s" local COMBINED_PARTS = { } for i, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, subtable_indent) table.insert(COMBINED_PARTS, string.format(FORMAT, key_indent, KEYS[i], encoded_val)) end result_value = "{\n" .. table.concat(COMBINED_PARTS, ",\n") .. "\n" .. indent .. "}" else local PARTS = { } for _, key in ipairs(object_keys) do local encoded_val = encode_value(self, TT[key], parents, etc, options, indent) local encoded_key = encode_value(self, tostring(key), parents, etc, options, indent) table.insert(PARTS, string.format("%s:%s", encoded_key, encoded_val)) end result_value = "{" .. table.concat(PARTS, ",") .. "}" end else -- -- An empty array/object... we'll treat it as an array, though it should really be an option -- result_value = "[]" end parents[T] = false return result_value end end function OBJDEF:encode(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode must be called in method format", etc) end return encode_value(self, value, {}, etc, options or nil) end function OBJDEF:encode_pretty(value, etc, options) if type(self) ~= 'table' or self.__index ~= OBJDEF then OBJDEF:onEncodeError("JSON:encode_pretty must be called in method format", etc) end return encode_value(self, value, {}, etc, options or default_pretty_options) end function OBJDEF.__tostring() return "JSON encode/decode package" end OBJDEF.__index = OBJDEF function OBJDEF:new(args) local new = { } if args then for key, val in pairs(args) do new[key] = val end end return setmetatable(new, OBJDEF) end return OBJDEF:new() -- -- Version history: -- -- 20141223.14 The encode_pretty() routine produced fine results for small datasets, but isn't really -- appropriate for anything large, so with help from Alex Aulbach I've made the encode routines -- more flexible, and changed the default encode_pretty() to be more generally useful. -- -- Added a third 'options' argument to the encode() and encode_pretty() routines, to control -- how the encoding takes place. -- -- Updated docs to add assert() call to the loadfile() line, just as good practice so that -- if there is a problem loading JSON.lua, the appropriate error message will percolate up. -- -- 20140920.13 Put back (in a way that doesn't cause warnings about unused variables) the author string, -- so that the source of the package, and its version number, are visible in compiled copies. -- -- 20140911.12 Minor lua cleanup. -- Fixed internal reference to 'JSON.noKeyConversion' to reference 'self' instead of 'JSON'. -- (Thanks to SmugMug's David Parry for these.) -- -- 20140418.11 JSON nulls embedded within an array were being ignored, such that -- ["1",null,null,null,null,null,"seven"], -- would return -- {1,"seven"} -- It's now fixed to properly return -- {1, nil, nil, nil, nil, nil, "seven"} -- Thanks to "haddock" for catching the error. -- -- 20140116.10 The user's JSON.assert() wasn't always being used. Thanks to "blue" for the heads up. -- -- 20131118.9 Update for Lua 5.3... it seems that tostring(2/1) produces "2.0" instead of "2", -- and this caused some problems. -- -- 20131031.8 Unified the code for encode() and encode_pretty(); they had been stupidly separate, -- and had of course diverged (encode_pretty didn't get the fixes that encode got, so -- sometimes produced incorrect results; thanks to Mattie for the heads up). -- -- Handle encoding tables with non-positive numeric keys (unlikely, but possible). -- -- If a table has both numeric and string keys, or its numeric keys are inappropriate -- (such as being non-positive or infinite), the numeric keys are turned into -- string keys appropriate for a JSON object. So, as before, -- JSON:encode({ "one", "two", "three" }) -- produces the array -- ["one","two","three"] -- but now something with mixed key types like -- JSON:encode({ "one", "two", "three", SOMESTRING = "some string" })) -- instead of throwing an error produces an object: -- {"1":"one","2":"two","3":"three","SOMESTRING":"some string"} -- -- To maintain the prior throw-an-error semantics, set -- JSON.noKeyConversion = true -- -- 20131004.7 Release under a Creative Commons CC-BY license, which I should have done from day one, sorry. -- -- 20130120.6 Comment update: added a link to the specific page on my blog where this code can -- be found, so that folks who come across the code outside of my blog can find updates -- more easily. -- -- 20111207.5 Added support for the 'etc' arguments, for better error reporting. -- -- 20110731.4 More feedback from David Kolf on how to make the tests for Nan/Infinity system independent. -- -- 20110730.3 Incorporated feedback from David Kolf at http://lua-users.org/wiki/JsonModules: -- -- * When encoding lua for JSON, Sparse numeric arrays are now handled by -- spitting out full arrays, such that -- JSON:encode({"one", "two", [10] = "ten"}) -- returns -- ["one","two",null,null,null,null,null,null,null,"ten"] -- -- In 20100810.2 and earlier, only up to the first non-null value would have been retained. -- -- * When encoding lua for JSON, numeric value NaN gets spit out as null, and infinity as "1+e9999". -- Version 20100810.2 and earlier created invalid JSON in both cases. -- -- * Unicode surrogate pairs are now detected when decoding JSON. -- -- 20100810.2 added some checking to ensure that an invalid Unicode character couldn't leak in to the UTF-8 encoding -- -- 20100731.1 initial public release --
gpl-2.0
SummitCore/Summit
extras/Hyjal_RWC.lua
3
15980
------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------ -- -- -- Battle of Mount Hyjal script -- -- -- -- created by Shady, Ascent Team -- ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------ ------------------------------------------------------------------------------------------------------------------ -- Rage Winterchill Event -- ------------------------------------------------------------------------------------------------------------------ -- Cast timers RWC_RWC_ICEBOLT_TIMER = 9000 RWC_RWC_FROSTNOVA_TIMER = 15000 RWC_RWC_ICEARMOR_TIMER = 23000 RWC_RWC_DEATHANDDECAY_TIMER = 11000 RWC_ABOMINATION_POISONCLOUD_TIMER = 20000 RWC_NECROMANCER_UNHOLYFRENZY_TIMER = 8000 RWC_NECROMANCER_CRIPPLE_TIMER = 7000 RWC_NECROMANCER_SUMMONSKELETONS_TIMER =20000 RWC_NECROMANCER_SHADOWBOLT_TIMER = 5000 RWC_CRYPTFIEND_WEB_TIMER = 13500 -- Internal globals Jaina = null RWC_IsInProgress = 0 RWC_DeathAndDecayAllowed = 1 RWC_Spawns = { {4897.40,-1665.15,1319.50}, {4898.54,-1663.35,1319.60}, {4899.70,-1661.54,1319.70}, {4900.99,-1659.52,1319.72}, {4902.58,-1657.00,1320.04}, {4899.82,-1655.24,1319.89}, {4898.81,-1658.16,1319.37}, {4898.08,-1660.37,1319.35}, {4896.65,-1662.63,1319.24}, {4895.67,-1664.15,1319.13}, {4904.07,-1660.22,1320.24}, {4902.70,-1662.38,1320.13}, {4901.91,-1663.90,1320.17}, {4900.20,-1666.28,1320.00} } RWC_WaypointsDelta = { {59.5,-33.9,20.78 }, {124.3,-82.9,2.88 } } function RWC_RWC(unit) unit:RegisterEvent("RWC_Waves_Move",10000,1) end function RWC_RWC_Combat(unit) unit:RegisterEvent("RWC_RWC_Icebolt",RWC_RWC_ICEBOLT_TIMER,0) unit:RegisterEvent("RWC_RWC_FrostNova",RWC_RWC_FROSTNOVA_TIMER,0) unit:RegisterEvent("RWC_RWC_IceArmor",RWC_RWC_ICEARMOR_TIMER,0) unit:RegisterEvent("RWC_RWC_DeathAndDecay",RWC_RWC_DEATHANDDECAY_TIMER ,0) end function RWC_RWC_Icebolt(unit) local plr = unit:GetRandomPlayer(0) if (plr ~= nil) then unit:FullCastSpellOnTarget(31249,plr) end end function RWC_RWC_FrostNova(unit) unit:FullCastSpell(32365) RWC_DeathAndDecayAllowed = 0 unit:RegisterEvent("RWC_Allow_DeathAndDecay",6000,1) end function RWC_Allow_DeathAndDecay(unit) RWC_DeathAndDecayAllowed = 1 end function RWC_RWC_IceArmor(unit) unit:FullCastSpell(31256) end function RWC_RWC_DeathAndDecay(unit) if (RWC_DeathAndDecayAllowed>0) then local plr = unit:GetRandomPlayer(0) if (plr ~= nil) then unit:FullCastSpellOnTarget(34642,plr) end end end function RWC_Ghoul(unit) unit:RegisterEvent("RWC_Waves_Move",10000,1) end function RWC_Abomination(unit) unit:RegisterEvent("RWC_Waves_Move",10000,1) end function RWC_Waves_Move(unit) unit:CreateWaypoint(unit:GetX()+RWC_WaypointsDelta[1][1],unit:GetY()+RWC_WaypointsDelta[1][2],unit:GetZ()+RWC_WaypointsDelta[1][3],0,0,0,0) unit:CreateWaypoint(unit:GetX()+RWC_WaypointsDelta[2][1],unit:GetY()+RWC_WaypointsDelta[2][2],unit:GetZ()+RWC_WaypointsDelta[2][3],0,0,0,0) end function RWC_Abomination_Combat(unit) unit:RegisterEvent("RWC_Abomination_PoisonCloud",RWC_ABOMINATION_POISONCLOUD_TIMER,0) end function RWC_Abomination_PoisonCloud(unit) unit:FullCastSpell(30914) end function RWC_Necromancer(unit) unit:RegisterEvent("RWC_Waves_Move",10000,1) end function RWC_Necromancer_Combat(unit) unit:RegisterEvent("RWC_Necromancer_UnholyFrenzy",RWC_NECROMANCER_UNHOLYFRENZY_TIMER,0) unit:RegisterEvent("RWC_Necromancer_SummonSkeletons",RWC_NECROMANCER_SUMMONSKELETONS_TIMER,0) unit:RegisterEvent("RWC_Necromancer_Cripple",RWC_NECROMANCER_CRIPPLE_TIMER,0) unit:RegisterEvent("RWC_Necromancer_ShadowBolt",RWC_NECROMANCER_SHADOWBOLT_TIMER,0) end function RWC_Necromancer_UnholyFrenzy(unit) local plr = unit:GetRandomFriend() if (plr ~= nil) then unit:FullCastSpellOnTarget(31626,plr) end end function RWC_Necromancer_SummonSkeletons(unit) unit:FullCastSpell(31617) end function RWC_Necromancer_Cripple(unit) local plr = unit:GetClosestPlayer(); if (plr ~= nil) then unit:FullCastSpellOnTarget(33787,plr) end end function RWC_Necromancer_ShadowBolt(unit) local plr = unit:GetClosestPlayer(); if (plr ~= nil) then unit:FullCastSpellOnTarget(29487,plr) end end function RWC_CryptFiend(unit) unit:RegisterEvent("RWC_Waves_Move",10000,1) end function RWC_CryptFiend_Combat(unit) unit:RegisterEvent("RWC_CryptFiend_Web",RWC_CRYPTFIEND_WEB_TIMER,0) end function RWC_CryptFiend_Web(unit) local plr = unit:GetRandomPlayer(0) if (plr ~= nil) then unit:FullCastSpellOnTarget(745,plr) end end function RWC_Wave1() print "RWC_Wave1" Jaina:SpawnCreature(17895,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[2][1],RWC_Spawns[2][2],RWC_Spawns[2][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[3][1],RWC_Spawns[3][2],RWC_Spawns[3][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[4][1],RWC_Spawns[4][2],RWC_Spawns[4][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[5][1],RWC_Spawns[5][2],RWC_Spawns[5][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[6][1],RWC_Spawns[6][2],RWC_Spawns[6][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[7][1],RWC_Spawns[7][2],RWC_Spawns[7][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[8][1],RWC_Spawns[8][2],RWC_Spawns[8][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[9][1],RWC_Spawns[9][2],RWC_Spawns[9][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[10][1],RWC_Spawns[10][2],RWC_Spawns[10][3],0,1720,0) Jaina:RegisterEvent("RWC_Wave2",125000,1) end function RWC_Wave2() print "RWC_Wave2" Jaina:SpawnCreature(17895,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[2][1],RWC_Spawns[2][2],RWC_Spawns[2][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[3][1],RWC_Spawns[3][2],RWC_Spawns[3][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[4][1],RWC_Spawns[4][2],RWC_Spawns[4][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[5][1],RWC_Spawns[5][2],RWC_Spawns[5][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[6][1],RWC_Spawns[6][2],RWC_Spawns[6][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[7][1],RWC_Spawns[7][2],RWC_Spawns[7][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[8][1],RWC_Spawns[8][2],RWC_Spawns[8][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[9][1],RWC_Spawns[9][2],RWC_Spawns[9][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[10][1],RWC_Spawns[10][2],RWC_Spawns[10][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[11][1],RWC_Spawns[11][2],RWC_Spawns[11][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[12][1],RWC_Spawns[12][2],RWC_Spawns[12][3],0,1720,0) Jaina:RegisterEvent("RWC_Wave3",125000,1) end function RWC_Wave3() print "RWC_Wave3" Jaina:SpawnCreature(17895,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[2][1],RWC_Spawns[2][2],RWC_Spawns[2][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[3][1],RWC_Spawns[3][2],RWC_Spawns[3][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[4][1],RWC_Spawns[4][2],RWC_Spawns[4][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[5][1],RWC_Spawns[5][2],RWC_Spawns[5][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[6][1],RWC_Spawns[6][2],RWC_Spawns[6][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[7][1],RWC_Spawns[7][2],RWC_Spawns[7][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[8][1],RWC_Spawns[8][2],RWC_Spawns[8][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[9][1],RWC_Spawns[9][2],RWC_Spawns[9][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[10][1],RWC_Spawns[10][2],RWC_Spawns[10][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[11][1],RWC_Spawns[11][2],RWC_Spawns[11][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[12][1],RWC_Spawns[12][2],RWC_Spawns[12][3],0,1720,0) Jaina:RegisterEvent("RWC_Wave4",125000,1) end function RWC_Wave4() print "RWC_Wave4" Jaina:SpawnCreature(17895,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[2][1],RWC_Spawns[2][2],RWC_Spawns[2][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[3][1],RWC_Spawns[3][2],RWC_Spawns[3][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[4][1],RWC_Spawns[4][2],RWC_Spawns[4][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[5][1],RWC_Spawns[5][2],RWC_Spawns[5][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[6][1],RWC_Spawns[6][2],RWC_Spawns[6][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[7][1],RWC_Spawns[7][2],RWC_Spawns[7][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[8][1],RWC_Spawns[8][2],RWC_Spawns[8][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[9][1],RWC_Spawns[9][2],RWC_Spawns[9][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[10][1],RWC_Spawns[10][2],RWC_Spawns[10][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[11][1],RWC_Spawns[11][2],RWC_Spawns[11][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[12][1],RWC_Spawns[12][2],RWC_Spawns[12][3],0,1720,0) Jaina:RegisterEvent("RWC_Wave5",125000,1) end function RWC_Wave5() print "RWC_Wave5" Jaina:SpawnCreature(17895,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[2][1],RWC_Spawns[2][2],RWC_Spawns[2][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[3][1],RWC_Spawns[3][2],RWC_Spawns[3][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[4][1],RWC_Spawns[4][2],RWC_Spawns[4][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[5][1],RWC_Spawns[5][2],RWC_Spawns[5][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[6][1],RWC_Spawns[6][2],RWC_Spawns[6][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[7][1],RWC_Spawns[7][2],RWC_Spawns[7][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[8][1],RWC_Spawns[8][2],RWC_Spawns[8][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[9][1],RWC_Spawns[9][2],RWC_Spawns[9][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[10][1],RWC_Spawns[10][2],RWC_Spawns[10][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[11][1],RWC_Spawns[11][2],RWC_Spawns[11][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[12][1],RWC_Spawns[12][2],RWC_Spawns[12][3],0,1720,0) Jaina:RegisterEvent("RWC_Wave6",125000,1) end function RWC_Wave6() print "RWC_Wave6" Jaina:SpawnCreature(17895,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[2][1],RWC_Spawns[2][2],RWC_Spawns[2][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[3][1],RWC_Spawns[3][2],RWC_Spawns[3][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[4][1],RWC_Spawns[4][2],RWC_Spawns[4][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[5][1],RWC_Spawns[5][2],RWC_Spawns[5][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[6][1],RWC_Spawns[6][2],RWC_Spawns[6][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[7][1],RWC_Spawns[7][2],RWC_Spawns[7][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[8][1],RWC_Spawns[8][2],RWC_Spawns[8][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[9][1],RWC_Spawns[9][2],RWC_Spawns[9][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[10][1],RWC_Spawns[10][2],RWC_Spawns[10][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[11][1],RWC_Spawns[11][2],RWC_Spawns[11][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[12][1],RWC_Spawns[12][2],RWC_Spawns[12][3],0,1720,0) Jaina:RegisterEvent("RWC_Wave7",125000,1) end function RWC_Wave7() print "RWC_Wave7" Jaina:SpawnCreature(17895,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[2][1],RWC_Spawns[2][2],RWC_Spawns[2][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[3][1],RWC_Spawns[3][2],RWC_Spawns[3][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[4][1],RWC_Spawns[4][2],RWC_Spawns[4][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[5][1],RWC_Spawns[5][2],RWC_Spawns[5][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[6][1],RWC_Spawns[6][2],RWC_Spawns[6][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[7][1],RWC_Spawns[7][2],RWC_Spawns[7][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[8][1],RWC_Spawns[8][2],RWC_Spawns[8][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[9][1],RWC_Spawns[9][2],RWC_Spawns[9][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[10][1],RWC_Spawns[10][2],RWC_Spawns[10][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[11][1],RWC_Spawns[11][2],RWC_Spawns[11][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[12][1],RWC_Spawns[12][2],RWC_Spawns[12][3],0,1720,0) Jaina:RegisterEvent("RWC_Wave8",125000,1) end function RWC_Wave8() print "RWC_Wave8" Jaina:SpawnCreature(17895,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[2][1],RWC_Spawns[2][2],RWC_Spawns[2][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[3][1],RWC_Spawns[3][2],RWC_Spawns[3][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[4][1],RWC_Spawns[4][2],RWC_Spawns[4][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[5][1],RWC_Spawns[5][2],RWC_Spawns[5][3],0,1720,0) Jaina:SpawnCreature(17895,RWC_Spawns[6][1],RWC_Spawns[6][2],RWC_Spawns[6][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[7][1],RWC_Spawns[7][2],RWC_Spawns[7][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[8][1],RWC_Spawns[8][2],RWC_Spawns[8][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[9][1],RWC_Spawns[9][2],RWC_Spawns[9][3],0,1720,0) Jaina:SpawnCreature(17897,RWC_Spawns[10][1],RWC_Spawns[10][2],RWC_Spawns[10][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[11][1],RWC_Spawns[11][2],RWC_Spawns[11][3],0,1720,0) Jaina:SpawnCreature(17899,RWC_Spawns[12][1],RWC_Spawns[12][2],RWC_Spawns[12][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[13][1],RWC_Spawns[13][2],RWC_Spawns[13][3],0,1720,0) Jaina:SpawnCreature(17898,RWC_Spawns[14][1],RWC_Spawns[14][2],RWC_Spawns[14][3],0,1720,0) Jaina:RegisterEvent("RWC_Boss",200000,1) end function RWC_Boss() print "RWC_Boss" Jaina:SpawnCreature(17767,RWC_Spawns[1][1],RWC_Spawns[1][2],RWC_Spawns[1][3],0,1720,0) end function RWC_Start(unit) Jaina = unit if (RWC_IsInProgress == 0) then print "MH:RWC Start" RWC_IsInProgress = 1 Jaina:RegisterEvent("RWC_Wave1",100,1) end end function RWC_Failed(unit) print "MH:RWC Failed" Jaina:RemoveEvents() Jaina:SendChatMessage(12,0,"Event Failed. Try once again and dont let me die") Jaina:Despawn(0,5000) RWC_IsInProgress = 0 end RegisterUnitEvent(17895,6,"RWC_Ghoul") RegisterUnitEvent(17898,6,"RWC_Abomination") RegisterUnitEvent(17898,1,"RWC_Abomination_Combat") RegisterUnitEvent(17897,6,"RWC_CryptFiend") RegisterUnitEvent(17897,1,"RWC_CryptFiend_Combat") RegisterUnitEvent(17899,6,"RWC_Necromancer") RegisterUnitEvent(17899,1,"RWC_Necromancer_Combat") RegisterUnitEvent(17767,6,"RWC_RWC") RegisterUnitEvent(17767,1,"RWC_RWC_Combat") RegisterUnitEvent(17772,10,"RWC_Start") RegisterUnitEvent(17772,4,"RWC_Failed")
agpl-3.0
Spring-SpringBoard/SpringBoard-Core
scen_edit/model/trigger_manager.lua
1
7188
TriggerManager = Observable:extends{} function TriggerManager:init() self:super('init') self.triggerIDCount = 0 self.triggers = {} end --------------- -- CRUD methods --------------- function TriggerManager:addTrigger(trigger) local success, err = self:ValidateTrigger(trigger) if not success and Script.GetName() == "LuaUI" then Log.Warning("Failed validating trigger: " .. tostring(trigger.id) .. " err: " .. tostring(err)) --table.echo(trigger) end if trigger.id == nil then trigger.id = self.triggerIDCount + 1 end self.triggerIDCount = math.max(trigger.id, self.triggerIDCount) self.triggers[trigger.id] = trigger self:callListeners("onTriggerAdded", trigger.id) return trigger.id end function TriggerManager:removeTrigger(triggerID) if triggerID == nil then return end if self.triggers[triggerID] then self.triggers[triggerID] = nil self:callListeners("onTriggerRemoved", triggerID) return true else return false end end function TriggerManager:setTrigger(triggerID, value) self.triggers[triggerID] = value self:callListeners("onTriggerUpdated", triggerID) end function TriggerManager:disableTrigger(triggerID) if self.triggers[triggerID].enabled then self.triggers[triggerID].enabled = false self:callListeners("onTriggerUpdated", triggerID) end end function TriggerManager:enableTrigger(triggerID) if not self.triggers[triggerID].enabled then self.triggers[triggerID].enabled = true self:callListeners("onTriggerUpdated", triggerID) end end function TriggerManager:getTrigger(triggerID) return self.triggers[triggerID] end function TriggerManager:getAllTriggers() return self.triggers end function TriggerManager:serialize() return Table.DeepCopy(self.triggers) --[[ local retVal = {} for _, trigger in pairs(self.triggers) do retVal[trigger.id] = trigger end return retVal--]] end function TriggerManager:load(data) for id, trigger in pairs(data) do self:addTrigger(trigger) end end function TriggerManager:clear() for triggerID, _ in pairs(self.triggers) do self:removeTrigger(triggerID) end self.triggerIDCount = 0 end --------------- -- END CRUD methods --------------- function TriggerManager:GetTriggerScopeParams(trigger) local triggerScopeParams = {} if #trigger.events == 0 then return triggerScopeParams end for _, event in pairs(trigger.events) do local typeName = event.typeName local eventType = SB.metaModel.eventTypes[typeName] for _, param in pairs(eventType.param) do table.insert(triggerScopeParams, { name = param.name, type = param.type, humanName = "Trigger: " .. param.name, }) end end return triggerScopeParams end --------------------------------- -- Trigger verification utilities --------------------------------- function TriggerManager:ValidateEvent(trigger, event) if not SB.metaModel.eventTypes[event.typeName] then return false, "Missing reference: " .. event.typeName end return true end function TriggerManager:ValidateEvents(trigger) for _, event in pairs(trigger.events) do local success, msg = self:ValidateEvent(trigger, event) if not success then return false, msg end end return true end function TriggerManager:ValidateExpression(trigger, expr, exprDef) -- First check if all inputs defined in definition exist in instance -- Ignore "typeName" field local found = {typeName = true} local success = true local err for _, dataDef in ipairs(exprDef.input) do local dataDefName = dataDef.name if expr[dataDefName] then found[dataDefName] = true else -- Don't fail early, check for all errors success = false if err then err = err .. "\n" else err = "" end err = err .. "Missing " .. tostring(exprDef.name) .. ":" .. tostring(dataDefName) .. " for trigger: " .. tostring(trigger.id) end end -- Now check if there are any extra inputs that aren't present in the definition for name, value in pairs(expr) do if not found[name] then if err then err = err .. "\n" else err = "" end err = err .. "Unexpected " .. tostring(exprDef.name) .. ":" .. tostring(name) .. " for trigger: " .. tostring(trigger.id) .. ". Removing." expr[name] = nil end end return success, err end function TriggerManager:ValidateCondition(trigger, condition) local exprDef = SB.metaModel.functionTypes[condition.typeName] if not exprDef then return false, "Missing reference: " .. condition.typeName end return self:ValidateExpression(trigger, condition, exprDef) end function TriggerManager:ValidateConditions(trigger) for _, condition in pairs(trigger.conditions) do local success, msg = self:ValidateCondition(trigger, condition) if not success then return false, msg end end return true end function TriggerManager:ValidateAction(trigger, action) local exprDef = SB.metaModel.actionTypes[action.typeName] if not exprDef then return false, "Missing reference: " .. action.typeName end return self:ValidateExpression(trigger, action, exprDef) end function TriggerManager:ValidateActions(trigger) for _, action in pairs(trigger.actions) do local success, msg = self:ValidateAction(trigger, action) if not success then return false, msg end end return true end function TriggerManager:ValidateTrigger(trigger) local checks = {{self:ValidateEvents(trigger)}, {self:ValidateConditions(trigger)}, {self:ValidateActions(trigger)}} for _, check in pairs(checks) do local success, msg = check[1], check[2] if not success then return success, msg end end return true end function TriggerManager:ValidateTriggerRecursive(trigger) end function TriggerManager:GetSafeEventHumanName(trigger, event) if self:ValidateEvent(trigger, event) then return SB.metaModel.eventTypes[event.typeName].humanName else return "Invalid event: " .. tostring(event.typeName) end end ------------------------------------------------ -- Listener definition ------------------------------------------------ TriggerManagerListener = LCS.class.abstract{} function TriggerManagerListener:onTriggerAdded(triggerID) end function TriggerManagerListener:onTriggerRemoved(triggerID) end function TriggerManagerListener:onTriggerUpdated(triggerID) end ------------------------------------------------ -- End listener definition ------------------------------------------------
mit
keyidadi/luci
applications/luci-pbx/luasrc/model/cbi/pbx-users.lua
146
5623
--[[ Copyright 2011 Iordan Iordanov <iiordanov (AT) gmail.com> This file is part of luci-pbx. luci-pbx is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. luci-pbx 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 luci-pbx. If not, see <http://www.gnu.org/licenses/>. ]]-- if nixio.fs.access("/etc/init.d/asterisk") then server = "asterisk" elseif nixio.fs.access("/etc/init.d/freeswitch") then server = "freeswitch" else server = "" end modulename = "pbx-users" modulenamecalls = "pbx-calls" modulenameadvanced = "pbx-advanced" m = Map (modulename, translate("User Accounts"), translate("Here you must configure at least one SIP account, that you \ will use to register with this service. Use this account either in an Analog Telephony \ Adapter (ATA), or in a SIP software like CSipSimple, Linphone, or Sipdroid on your \ smartphone, or Ekiga, Linphone, or X-Lite on your computer. By default, all SIP accounts \ will ring simultaneously if a call is made to one of your VoIP provider accounts or GV \ numbers.")) -- Recreate the config, and restart services after changes are commited to the configuration. function m.on_after_commit(self) luci.sys.call("/etc/init.d/pbx-" .. server .. " restart 1\>/dev/null 2\>/dev/null") luci.sys.call("/etc/init.d/" .. server .. " restart 1\>/dev/null 2\>/dev/null") end externhost = m.uci:get(modulenameadvanced, "advanced", "externhost") bindport = m.uci:get(modulenameadvanced, "advanced", "bindport") ipaddr = m.uci:get("network", "lan", "ipaddr") ----------------------------------------------------------------------------- s = m:section(NamedSection, "server", "user", translate("Server Setting")) s.anonymous = true if ipaddr == nil or ipaddr == "" then ipaddr = "(IP address not static)" end if bindport ~= nil then just_ipaddr = ipaddr ipaddr = ipaddr .. ":" .. bindport end s:option(DummyValue, "ipaddr", translate("Server Setting for Local SIP Devices"), translate("Enter this IP (or IP:port) in the Server/Registrar setting of SIP devices you will \ use ONLY locally and never from a remote location.")).default = ipaddr if externhost ~= nil then if bindport ~= nil then just_externhost = externhost externhost = externhost .. ":" .. bindport end s:option(DummyValue, "externhost", translate("Server Setting for Remote SIP Devices"), translate("Enter this hostname (or hostname:port) in the Server/Registrar setting of SIP \ devices you will use from a remote location (they will work locally too).") ).default = externhost end if bindport ~= nil then s:option(DummyValue, "bindport", translate("Port Setting for SIP Devices"), translatef("If setting Server/Registrar to %s or %s does not work for you, try setting \ it to %s or %s and entering this port number in a separate field that specifies the \ Server/Registrar port number. Beware that some devices have a confusing \ setting that sets the port where SIP requests originate from on the SIP \ device itself (the bind port). The port specified on this page is NOT this bind port \ but the port this service listens on.", ipaddr, externhost, just_ipaddr, just_externhost)).default = bindport end ----------------------------------------------------------------------------- s = m:section(TypedSection, "local_user", translate("SIP Device/Softphone Accounts")) s.anonymous = true s.addremove = true s:option(Value, "fullname", translate("Full Name"), translate("You can specify a real name to show up in the Caller ID here.")) du = s:option(Value, "defaultuser", translate("User Name"), translate("Use (four to five digit) numeric user name if you are connecting normal telephones \ with ATAs to this system (so they can dial user names).")) du.datatype = "uciname" pwd = s:option(Value, "secret", translate("Password"), translate("Your password disappears when saved for your protection. It will be changed \ only when you enter a value different from the saved one.")) pwd.password = true pwd.rmempty = false -- We skip reading off the saved value and return nothing. function pwd.cfgvalue(self, section) return "" end -- We check the entered value against the saved one, and only write if the entered value is -- something other than the empty string, and it differes from the saved value. function pwd.write(self, section, value) local orig_pwd = m:get(section, self.option) if value and #value > 0 and orig_pwd ~= value then Value.write(self, section, value) end end p = s:option(ListValue, "ring", translate("Receives Incoming Calls")) p:value("yes", translate("Yes")) p:value("no", translate("No")) p.default = "yes" p = s:option(ListValue, "can_call", translate("Makes Outgoing Calls")) p:value("yes", translate("Yes")) p:value("no", translate("No")) p.default = "yes" return m
apache-2.0
mcastron/TinyBRL
scripts/lua_scripts/data/experiments_accurate.lua
3
1675
-- ============================================================================ -- This script describes the experiments to perform for the 'accurate' case -- (prior distribution = test distribution) -- -- An experiment is described as follows: -- -- ... -- { -- -- Short name of the prior distribution -- prior = "<prior name>", -- -- -- Prior distribution file in 'data/distributions/' -- priorFile = "<prior file>", -- -- -- Short name of the test distribution -- exp = "<exp name>", -- -- -- Test distribution file in 'data/distributions/' -- expFile = "<test file>", -- -- -- The number of MDPs to draw from the test distribution -- N = <number of MDPs>, -- -- -- The discount factor -- gamma = <discount factor>, -- -- -- The horizon limit -- T = <horizon limit> -- }, -- ... -- -- -- You also have to associate a short name to this set of experiments -- -- shortName = <short name> -- ============================================================================ local experiments = { { prior = "GC", priorFile = "GC-distrib.dat", exp = "GC", testFile = "GC-distrib.dat", N = 500, gamma = 0.95, T = 250 }, { prior = "GDL", priorFile = "GDL-distrib.dat", exp = "GDL", testFile = "GDL-distrib.dat", N = 500, gamma = 0.95, T = 250 }, { prior = "Grid", priorFile = "Grid-distrib.dat", exp = "Grid", testFile = "Grid-distrib.dat", N = 500, gamma = 0.95, T = 250 }, shortName = "accurate" } return experiments
gpl-2.0
Shayan123456/botttttt2
plugins/google.lua
336
1323
do local function googlethat(query) local url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&safe=active&&rsz=5&' local parameters = 'q='..(URL.escape(query) or '') -- Do the request local res, code = https.request(url..parameters) if code ~=200 then return nil end local data = json:decode(res) local results = {} for key,result in ipairs(data.responseData.results) do table.insert(results, { result.titleNoFormatting, result.unescapedUrl or result.url }) end return results end local function stringlinks(results) local stringresults='' i = 0 for key,val in ipairs(results) do i = i+1 stringresults=stringresults..i..'. '..val[1]..'\n'..val[2]..'\n' end return stringresults end local function run(msg, matches) -- comment this line if you want this plugin works in private message. if not is_chat_msg(msg) then return nil end local results = googlethat(matches[1]) return stringlinks(results) end return { description = 'Returns five results from Google. Safe search is enabled by default.', usage = ' !google [terms]: Searches Google and send results', patterns = { '^!google (.*)$', '^%.[g|G]oogle (.*)$' }, run = run } end
gpl-2.0
EvilHero90/forgottenserver
data/talkactions/scripts/reload.lua
6
2090
local reloadTypes = { ["all"] = RELOAD_TYPE_ALL, ["action"] = RELOAD_TYPE_ACTIONS, ["actions"] = RELOAD_TYPE_ACTIONS, ["chat"] = RELOAD_TYPE_CHAT, ["channel"] = RELOAD_TYPE_CHAT, ["chatchannels"] = RELOAD_TYPE_CHAT, ["config"] = RELOAD_TYPE_CONFIG, ["configuration"] = RELOAD_TYPE_CONFIG, ["creaturescript"] = RELOAD_TYPE_CREATURESCRIPTS, ["creaturescripts"] = RELOAD_TYPE_CREATURESCRIPTS, ["events"] = RELOAD_TYPE_EVENTS, ["global"] = RELOAD_TYPE_GLOBAL, ["globalevent"] = RELOAD_TYPE_GLOBALEVENTS, ["globalevents"] = RELOAD_TYPE_GLOBALEVENTS, ["items"] = RELOAD_TYPE_ITEMS, ["monster"] = RELOAD_TYPE_MONSTERS, ["monsters"] = RELOAD_TYPE_MONSTERS, ["mount"] = RELOAD_TYPE_MOUNTS, ["mounts"] = RELOAD_TYPE_MOUNTS, ["move"] = RELOAD_TYPE_MOVEMENTS, ["movement"] = RELOAD_TYPE_MOVEMENTS, ["movements"] = RELOAD_TYPE_MOVEMENTS, ["npc"] = RELOAD_TYPE_NPCS, ["npcs"] = RELOAD_TYPE_NPCS, ["quest"] = RELOAD_TYPE_QUESTS, ["quests"] = RELOAD_TYPE_QUESTS, ["raid"] = RELOAD_TYPE_RAIDS, ["raids"] = RELOAD_TYPE_RAIDS, ["spell"] = RELOAD_TYPE_SPELLS, ["spells"] = RELOAD_TYPE_SPELLS, ["talk"] = RELOAD_TYPE_TALKACTIONS, ["talkaction"] = RELOAD_TYPE_TALKACTIONS, ["talkactions"] = RELOAD_TYPE_TALKACTIONS, ["weapon"] = RELOAD_TYPE_WEAPONS, ["weapons"] = RELOAD_TYPE_WEAPONS, ["scripts"] = RELOAD_TYPE_SCRIPTS, ["libs"] = RELOAD_TYPE_GLOBAL } function onSay(player, words, param) if not player:getGroup():getAccess() then return true end if player:getAccountType() < ACCOUNT_TYPE_GOD then return false end logCommand(player, words, param) local reloadType = reloadTypes[param:lower()] if not reloadType then player:sendTextMessage(MESSAGE_INFO_DESCR, "Reload type not found.") return false end -- need to clear EventCallback.data or we end up having duplicated events on /reload scripts if table.contains({RELOAD_TYPE_SCRIPTS, RELOAD_TYPE_ALL}, reloadType) then EventCallback:clear() end Game.reload(reloadType) player:sendTextMessage(MESSAGE_INFO_DESCR, string.format("Reloaded %s.", param:lower())) return false end
gpl-2.0
Flexibity/luci
modules/admin-mini/luasrc/model/cbi/mini/system.lua
33
2293
--[[ LuCI - Lua Configuration Interface Copyright 2008 Steven Barth <steven@midlink.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- require("luci.sys") require("luci.sys.zoneinfo") require("luci.tools.webadmin") m = Map("system", translate("System"), translate("Here you can configure the basic aspects of your device like its hostname or the timezone.")) s = m:section(TypedSection, "system", "") s.anonymous = true s.addremove = false local system, model, memtotal, memcached, membuffers, memfree = luci.sys.sysinfo() local uptime = luci.sys.uptime() s:option(DummyValue, "_system", translate("System")).value = system s:option(DummyValue, "_cpu", translate("Processor")).value = model local load1, load5, load15 = luci.sys.loadavg() s:option(DummyValue, "_la", translate("Load")).value = string.format("%.2f, %.2f, %.2f", load1, load5, load15) s:option(DummyValue, "_memtotal", translate("Memory")).value = string.format("%.2f MB (%.0f%% %s, %.0f%% %s, %.0f%% %s)", tonumber(memtotal) / 1024, 100 * memcached / memtotal, tostring(translate("cached")), 100 * membuffers / memtotal, tostring(translate("buffered")), 100 * memfree / memtotal, tostring(translate("free")) ) s:option(DummyValue, "_systime", translate("Local Time")).value = os.date("%c") s:option(DummyValue, "_uptime", translate("Uptime")).value = luci.tools.webadmin.date_format(tonumber(uptime)) hn = s:option(Value, "hostname", translate("Hostname")) function hn.write(self, section, value) Value.write(self, section, value) luci.sys.hostname(value) end tz = s:option(ListValue, "zonename", translate("Timezone")) tz:value("UTC") for i, zone in ipairs(luci.sys.zoneinfo.TZ) do tz:value(zone[1]) end function tz.write(self, section, value) local function lookup_zone(title) for _, zone in ipairs(luci.sys.zoneinfo.TZ) do if zone[1] == title then return zone[2] end end end AbstractValue.write(self, section, value) self.map.uci:set("system", section, "timezone", lookup_zone(value) or "GMT0") end return m
apache-2.0
mohammadclashclash/info1
bot/InfernalTG.lua
1
8826
package.path = package.path .. ';.luarocks/share/lua/5.2/?.lua' ..';.luarocks/share/lua/5.2/?/init.lua' package.cpath = package.cpath .. ';.luarocks/lib/lua/5.2/?.so' require("./bot/utils") VERSION = '1.0' -- This function is called when tg receive a msg function on_msg_receive (msg) if not started then return end local receiver = get_receiver(msg) print (receiver) --vardump(msg) msg = pre_process_service_msg(msg) if msg_valid(msg) then msg = pre_process_msg(msg) if msg then match_plugins(msg) -- mark_read(receiver, ok_cb, false) end end end function ok_cb(extra, success, result) end function on_binlog_replay_end() started = true postpone (cron_plugins, false, 60*5.0) _config = load_config() -- load plugins plugins = {} load_plugins() end function msg_valid(msg) -- Don't process outgoing messages if msg.out then print('\27[36mNot valid: msg from us\27[39m') return false end -- Before bot was started if msg.date < now then print('\27[36mNot valid: old msg\27[39m') return false end if msg.unread == 0 then print('\27[36mNot valid: readed\27[39m') return false end if not msg.to.id then print('\27[36mNot valid: To id not provided\27[39m') return false end if not msg.from.id then print('\27[36mNot valid: From id not provided\27[39m') return false end if msg.from.id == our_id then print('\27[36mNot valid: Msg from our id\27[39m') return false end if msg.to.type == 'encr_chat' then print('\27[36mNot valid: Encrypted chat\27[39m') return false end if msg.from.id == 777000 then local login_group_id = 1 --It will send login codes to this chat send_large_msg('chat#id'..login_group_id, msg.text) end return true end -- function pre_process_service_msg(msg) if msg.service then local action = msg.action or {type=""} -- Double ! to discriminate of normal actions msg.text = "!!tgservice " .. action.type -- wipe the data to allow the bot to read service messages if msg.out then msg.out = false end if msg.from.id == our_id then msg.from.id = 0 end end return msg end -- Apply plugin.pre_process function function pre_process_msg(msg) for name,plugin in pairs(plugins) do if plugin.pre_process and msg then print('Preprocess', name) msg = plugin.pre_process(msg) end end return msg end -- Go over enabled plugins patterns. function match_plugins(msg) for name, plugin in pairs(plugins) do match_plugin(plugin, name, msg) end end -- Check if plugin is on _config.disabled_plugin_on_chat table local function is_plugin_disabled_on_chat(plugin_name, receiver) local disabled_chats = _config.disabled_plugin_on_chat -- Table exists and chat has disabled plugins if disabled_chats and disabled_chats[receiver] then -- Checks if plugin is disabled on this chat for disabled_plugin,disabled in pairs(disabled_chats[receiver]) do if disabled_plugin == plugin_name and disabled then local warning = 'Plugin '..disabled_plugin..' is disabled on this chat' print(warning) send_msg(receiver, warning, ok_cb, false) return true end end end return false end function match_plugin(plugin, plugin_name, msg) local receiver = get_receiver(msg) -- Go over patterns. If one matches it's enough. for k, pattern in pairs(plugin.patterns) do local matches = match_pattern(pattern, msg.text) if matches then print("msg matches: ", pattern) if is_plugin_disabled_on_chat(plugin_name, receiver) then return nil end -- Function exists if plugin.run then -- If plugin is for privileged users only if not warns_user_not_allowed(plugin, msg) then local result = plugin.run(msg, matches) if result then send_large_msg(receiver, result) end end end -- One patterns matches return end end end -- DEPRECATED, use send_large_msg(destination, text) function _send_msg(destination, text) send_large_msg(destination, text) end -- Save the content of _config to config.lua function save_config( ) serialize_to_file(_config, './data/config.lua') print ('saved config into ./data/config.lua') end -- Returns the config from config.lua file. -- If file doesn't exist, create it. function load_config( ) local f = io.open('./data/config.lua', "r") -- If config.lua doesn't exist if not f then print ("Created new config file: data/config.lua") create_config() else f:close() end local config = loadfile ("./data/config.lua")() for v,user in pairs(config.sudo_users) do print("Allowed user: " .. user) end return config end -- Create a basic config.json file and saves it. function create_config( ) -- A simple config with basic plugins and ourselves as privileged user config = { enabled_plugins = { "Help_All", "Auto_Leave", "BLOCK", "Feedback", "Member_Manager", "Group_Manager", "S2A", "SUDO", "all", "arabic_lock", "Banhammer", "download_media", "get", "inpm", "invite", "leaders", "leave_ban", "plugins", "realmcommands", "service_entergroup", "set", "anti_spam", "stats", "Version", "close_group", "kickall", "Maseage", "tagall", }, sudo_users = {150575718},--Sudo users disabled_channels = {}, moderation = {data = 'data/moderation.json'}, about_text = [[infernalTG v2 - Open Source An advance Administration bot based on yagop/telegram-bot our official github : Antispambot : @mohammad20162015 website ; www.appstore2016.blog.ir Admins @MOHAMMAD✌✌✌👍 [Founder] @NIMA NAJAFIAN [Developer] @ALPHA [Developer] @SHAH JOCKER ARMIN [Manager] Special thanks to ALPHA NIMA NAJAFIAN SHAH JOCKER AND MORE ...... ]], help_text_realm = [[ group admin Commands: !creategroup [Name] !createrealm [Name] !setname [Name] !setabout [GroupID] [Text] !setrules [GroupID] [Text] !lock [GroupID] [setting] !unlock [GroupID] [setting] !wholist !who !type !kill chat [GroupID] !kill realm [RealmID] !adminprom [id|username] !admindem [id|username] !list infernalgroups !list infernalrealms !log !broadcast [text] !broadcast InfernalTG ! !br [group_id] [text] !br 123456789 Hello ! **U can use both "/" and "!" *Only admins and sudo can add bots in group *Only admins and sudo can use kick,ban,unban,newlink,setphoto,setname,lock,unlock,set rules,set about and settings commands *Only admins and sudo can use res, setowner, commands ]], help_text = [[ tools for InfernalTG : >#1.Add_bot >#2.Anti_Bot >#3.Auto_Leave >#4.BLOCK >#5.Feedback >#6.Member_Manager >#7.S2A >#8.SUDO >#8.all >#9.arabic_lock >#10.banhammer >#11.down_media >#12.get >#13.inpm >#14.invite >#15.leaders >#16.leave_ban >#17.pluglist >#18.realmcommands >#19.service_entergroup >#20.set >#21.anti_spam >#22.stats >#23.toengsupport >#24.topersupport >#25.spammer_a >#26.Spammer_i >#27.Version >#28.close_group >#29.kickall >#30.SendPm >#31.tagall >#32.share help all plugin soon :D ," You Can Get Bot version by sending !version," Master admin : @mohammad20162015 ," our channel : ................ ," ]] } serialize_to_file(config, './data/config.lua') print('saved config into ./data/config.lua') end function on_our_id (id) our_id = id end function on_user_update (user, what) --vardump (user) end function on_chat_update (chat, what) end function on_secret_chat_update (schat, what) --vardump (schat) end function on_get_difference_end () end -- Enable plugins in config.json function load_plugins() for k, v in pairs(_config.enabled_plugins) do print("Loading plugin", v) local ok, err = pcall(function() local t = loadfile("plugins/"..v..'.lua')() plugins[v] = t end) if not ok then print('\27[31mError loading plugin '..v..'\27[39m') print('\27[31m'..err..'\27[39m') end end end -- custom add function load_data(filename) local f = io.open(filename) if not f then return {} end local s = f:read('*all') f:close() local data = JSON.decode(s) return data end function save_data(filename, data) local s = JSON.encode(data) local f = io.open(filename, 'w') f:write(s) f:close() end -- Call and postpone execution for cron plugins function cron_plugins() for name, plugin in pairs(plugins) do -- Only plugins with cron function if plugin.cron ~= nil then plugin.cron() end end -- Called again in 2 mins postpone (cron_plugins, false, 120) end -- Start and load values our_id = 0 now = os.time() math.randomseed(now) started = false
gpl-2.0
mcanthony/Polycode
Bindings/Contents/LUA/API/Polycode/EventDispatcher.lua
11
2316
class "EventDispatcher" function EventDispatcher:EventDispatcher() self.listenerEntries = {} end function EventDispatcher:addEventListener(listener, callback, eventCode) if self.listenerEntries == nil then self.listenerEntries = {} end local newEntry = {} if self.__ptr ~= nil then newEntry.handler = Polycore.EventHandler(newEntry) Polycore.EventDispatcher_addEventListener(self.__ptr, newEntry.handler, eventCode) end newEntry.listener = listener newEntry.callback = callback newEntry.eventCode = eventCode self.listenerEntries[#self.listenerEntries+1] = newEntry end function EventDispatcher:removeAllHandlers() if self.listenerEntries == nil then self.listenerEntries = {} end if self.__ptr ~= nil then Polycore.EventDispatcher_removeAllHandlers(self.__ptr) end self.listenerEntries = {} end function EventDispatcher:removeAllHandlersForListener(listener) if self.listenerEntries == nil then self.listenerEntries = {} end local i=1 while i <= #self.listenerEntries do if self.listenerEntries[i].listener == listener then if self.__ptr ~= nil and self.listenerEntries[i].handler ~= nil then Polycore.EventDispatcher_removeAllHandlersForListener(self.__ptr, self.listenerEntries[i].handler) Polycore.delete_EventHandler(self.listenerEntries[i].handler) end table.remove(self.listenerEntries, i) else i = i + 1 end end end function EventDispatcher:removeEventListener(listener, eventCode) if self.listenerEntries == nil then self.listenerEntries = {} end local i=1 while i <= #self.listenerEntries do if self.listenerEntries[i].listener == listener and self.listenerEntries[i].eventCode == eventCode then if self.__ptr ~= nil and self.listenerEntries[i].handler ~= nil then Polycore.EventDispatcher_removeAllHandlersForListener(self.__ptr, self.listenerEntries[i].handler) Polycore.delete_EventHandler(self.listenerEntries[i].handler) end table.remove(self.listenerEntries, i) else i = i + 1 end end end function EventDispatcher:dispatchEvent(event, eventCode) if self.listenerEntries == nil then self.listenerEntries = {} end for i=1,#self.listenerEntries do if self.listenerEntries[i].eventCode == eventCode then self.listenerEntries[i].callback(self.listenerEntries[i].listener, event) end end end
mit
keyidadi/luci
modules/base/luasrc/sgi/cgi.lua
87
2260
--[[ LuCI - SGI-Module for CGI Description: Server Gateway Interface for CGI FileId: $Id$ License: Copyright 2008 Steven Barth <steven@midlink.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ]]-- exectime = os.clock() module("luci.sgi.cgi", package.seeall) local ltn12 = require("luci.ltn12") require("nixio.util") require("luci.http") require("luci.sys") require("luci.dispatcher") -- Limited source to avoid endless blocking local function limitsource(handle, limit) limit = limit or 0 local BLOCKSIZE = ltn12.BLOCKSIZE return function() if limit < 1 then handle:close() return nil else local read = (limit > BLOCKSIZE) and BLOCKSIZE or limit limit = limit - read local chunk = handle:read(read) if not chunk then handle:close() end return chunk end end end function run() local r = luci.http.Request( luci.sys.getenv(), limitsource(io.stdin, tonumber(luci.sys.getenv("CONTENT_LENGTH"))), ltn12.sink.file(io.stderr) ) local x = coroutine.create(luci.dispatcher.httpdispatch) local hcache = "" local active = true while coroutine.status(x) ~= "dead" do local res, id, data1, data2 = coroutine.resume(x, r) if not res then print("Status: 500 Internal Server Error") print("Content-Type: text/plain\n") print(id) break; end if active then if id == 1 then io.write("Status: " .. tostring(data1) .. " " .. data2 .. "\r\n") elseif id == 2 then hcache = hcache .. data1 .. ": " .. data2 .. "\r\n" elseif id == 3 then io.write(hcache) io.write("\r\n") elseif id == 4 then io.write(tostring(data1 or "")) elseif id == 5 then io.flush() io.close() active = false elseif id == 6 then data1:copyz(nixio.stdout, data2) data1:close() end end end end
apache-2.0
leecrest/luvit
tests/test-readline.lua
6
1846
--[[ Copyright 2015 The Luvit Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --]] local readline = require('readline') local prettyPrint = require('pretty-print') local Editor = readline.Editor require('tap')(function(test) test('readline Editor:onKey', function(expect) local editor = Editor.new({ stdin = prettyPrint.stdin, stdout = prettyPrint.stdout }) -- need to call readLine to initialize some variables editor:readLine("", function() end) -- but don't want to actually read anything editor.stdin:read_stop() editor.stdin:set_mode(0) -- starting position assert(#editor.line == 0) assert(editor.position == 1) -- single key editor:onKey('a') assert(editor.line == "a") assert(editor.position == 2) -- left arrow editor:onKey('\027[D') assert(editor.line == "a") assert(editor.position == 1) -- multiple keys editor:onKey('abc') assert(editor.line == "abca") assert(editor.position == 4) -- multiple control sequences (left arrows) editor:onKey('\027[D\027[D\027[D') assert(editor.line == "abca") assert(editor.position == 1) -- mixture of characters and control sequences editor:onKey('a\027[Db\027[Dc\027[Dd') assert(editor.line == "dcbaabca") assert(editor.position == 2) end) end)
apache-2.0
xriss/fun64
fun/platobj.fun.lua
1
61039
local chatdown=require("wetgenes.gamecake.fun.chatdown") -- conversation trees local bitdown=require("wetgenes.gamecake.fun.bitdown") -- ascii to bitmap local chipmunk=require("wetgenes.chipmunk") -- 2d physics https://chipmunk-physics.net/ -- debug text dump local ls=function(t) print(require("wetgenes.string").dump(t)) end ----------------------------------------------------------------------------- --[[#hardware select the hardware we will need to run this code, eg layers of graphics, colors to use, sprites, text, sound, etc etc. Here we have chosen the default 320x240 setup. ]] ----------------------------------------------------------------------------- hardware,main=system.configurator({ mode="fun64", -- select the standard 320x240 screen using the swanky32 palette. graphics=function() return graphics end, update=function() update() end, -- called repeatedly to update draw=function() draw() end, -- called repeatedly to draw }) ----------------------------------------------------------------------------- --[[#graphics define all graphics in this global, we will convert and upload to tiles at setup although you can change tiles during a game, we try and only upload graphics during initial setup so we have a nice looking sprite sheet to be edited by artists ]] ----------------------------------------------------------------------------- graphics={ {0x0000,"_font",0x0140}, -- allocate the font area } -- load a single sprite graphics.load=function(idx,name,data) local found for i,v in ipairs(graphics) do if v[2]==name then found=v break end end if not found then -- add new graphics graphics[#graphics+1]={idx,name,data} else found[1]=idx found[2]=name found[3]=data end end -- load a list of sprites graphics.loads=function(tab) for i,v in ipairs(tab) do graphics.load(v[1],v[2],v[3]) end end ----------------------------------------------------------------------------- --[[#entities entities.reset() empty the list of entites to update and draw entities.caste(caste) get the list of entities of a given caste, eg "bullets" or "enemies" entities.add(it,caste) entities.add(it) add a new entity of caste or it.caste to the list of things to update entities.call(fname,...) for every entity call the function named fname like so it[fname](it,...) entities.get(name) get a value previously saved, this is an easy way to find a unique entity, eg the global space but it can be used to save any values you wish not just to bookmark unique entities. entities.set(name,value) save a value by a unique name entities.manifest(name,value) get a value previously saved, or initalize it to the given value if it does not already exist. The default value is {} as this is intended for lists. entities.systems A table to register or find a global system, these are not cleared by reset and should not contain any state data, just functions to create the actual entity or initialise data. entities.tiles These functions are called as we generate a level from ascii, every value in the tile legend data is checked against all the strings in entities.tiles and if it matches it calls that function which is then responsible for adding the appropriate collision and drawing code to make that tile actually add something to the level. The basic values of tile.tile and tile.back are used to write graphics into the two tile layers but could still be caught here if you need to. Multiple hooks may get called for a single tile, think of each string as a flag to signal that something happens and its value describes what happens. ]] ----------------------------------------------------------------------------- entities={systems={},tiles={}} -- a place to store everything that needs to be updated entities.reset=function() entities.data={} entities.info={} end -- get items for the given caste entities.caste=function(caste) caste=caste or "generic" if not entities.data[caste] then entities.data[caste]={} end -- create on use return entities.data[caste] end -- add an item to this caste entities.add=function(it,caste) caste=caste or it.caste -- probably from item caste=caste or "generic" local items=entities.caste(caste) items[ #items+1 ]=it -- add to end of array return it end -- call this functions on all items in every caste entities.call=function(fname,...) local count=0 for caste,items in pairs(entities.data) do for idx=#items,1,-1 do -- call backwards so item can remove self local it=items[idx] if it[fname] then it[fname](it,...) count=count+1 end end end return count -- number of items called end -- get/set info associated with this entities entities.get=function(name) return entities.info[name] end entities.set=function(name,value) entities.info[name]=value return value end entities.manifest=function(name,empty) if not entities.info[name] then entities.info[name]=empty or {} end -- create empty return entities.info[name] end -- also reset the entities right now entities.reset() ----------------------------------------------------------------------------- --[[#entities.systems.space space = entities.systems.space.setup() Create the space that simulates all of the physics. ]] ----------------------------------------------------------------------------- entities.systems.space={ setup=function() local space=entities.set("space", chipmunk.space() ) space:gravity(0,700) space:damping(0.5) space:sleep_time_threshold(1) space:idle_speed_threshold(10) -- run all arbiter space hooks that have been registered for n,v in pairs(entities.systems) do if v.space then v:space() end end return space end, } ----------------------------------------------------------------------------- --[[#entities.systems.tile setup background tile graphics ]] ----------------------------------------------------------------------------- entities.systems.tile={ load=function() graphics.loads{ {nil,"tile_empty",[[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ]]}, {nil,"tile_black",[[ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ]]}, {nil,"tile_wall",[[ O O R R R R O O O O R R R R O O r r r r o o o o r r r r o o o o R R O O O O R R R R O O O O R R o o o o r r r r o o o o r r r r ]]}, {nil,"tile_floor",[[ j j j j j j j j j j j j j j j j j f f f f f f f f j j j j j j j j j j j j j j j f f f F F F F f f f f f f f f f f F F F F F F F F f f f f f f j j j j j f f f f F F F f f f f F F F F F F F F F F f f f f f f f f F F F F F F f f f f f F F F F f f f f f f f f f f F F F F f f f f f f f f f f f f f f f f f F F F F F f f f f f f f j j j j f f f f f f f f f f j j j j j j j j f f f f f f f f f f f f f f f j j j f f f f j j j f f f f j j j f f f f f f f f j j j j j j f f f f f j j j j f f f j j j j f f f j j j j f f f j j j j j j j j f f f f f f j j j j j f f f f j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j j ]]}, {nil,"tile_bigwall",[[ j j j j r r r r i i i i f f f f r r r r i i i i i i i i f f f f r r r r f f f f j j j j r r r r i i i i f f f f r r r r i i i i i i i i f f f f r r r r f f f f O O R R R R j j j j O O O O r r r r O O O O f f f f F F F F O O O O f f f f O O O O R R R R j j j j O O O O r Y Y r O O O O f Y f f F F F F O O O O f f f f O O j j j j R R R R r r r r R R Y Y Y j j j R R R Y i i i i R R R R O O O O R R R R j j j j R R R R r r r r R Y Y Y Y Y Y Y Y Y Y Y Y i i i R R R R O O O O R R R R r r O O O O j j j j R R Y Y j Y Y Y Y Y Y R j Y Y Y R R R R j j j j R R R R r r r r O O O O j j j j R R Y R j Y Y Y Y R R R j Y Y Y Y Y R R j j j j R R R R r r i i i i f f f f r r r r f f f Y Y j j j r r r r i Y Y Y f f f f r r r r i i i i i i i i f f f f r r r r f f f Y j j j j r r r r i Y Y Y Y f f f r r r r i i i i f f F F F F O O O O f f f f O Y O O R R R R j j j j Y Y Y O r r r r O O O O f f f f F F F F O O O O f f f f O Y O O R R R R j j j j O O O O r r r r O O O O f f i i i i R R R R O O O O R R R R j j j j R R R R r r r r R R R R j j j j R R R R i i i i R R R R O O O O R R R R j j j j R R R R r r r r R R R R j j j j R R R R j j R R R R j j j j R R R R r r r r O O O O j j j j R R R R j j j j R R R R j j j j R R R R j j j j R R R R r r r r O O O O j j j j R R R R j j j j R R R R j j ]]}, {nil,"tile_grass",[[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . G . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . g G g . . . . . . . . . . . . . g . . . . . . . . g . g . . . . g G G . G . g . g . G . . . . g . . . g g . g . . G . . g . . g ]]}, {nil,"tile_stump",[[ . . F F F F . . f F f f f f F f j f F F F F f j j j f f f j f j j f f f j j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j ]]}, {nil,"tile_sidewood",[[ j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j j f F f f j f j ]]}, {nil,"tile_tree",[[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . j . . . . . . . . . j . . . . . j . . . . . . . . . . f . . . j . . . . . . . . . . . f F . j . . . . . . . . . . . . . f F j . . j . . . . . . . . . . j f F . f . . . . . . . . . . . . . f . j . . . . . . . . . . . . . f F f . . . . . . . . . . . j F f f f . . . . . . . . . . . . f F j . . . . . . . . . . . . . j F j . . . . . . . . . . . . . j f j . . . . . . . . . . . . . . F j . . . . . . . . . . j F F . f f . . . . . . . . . . . j F F j f j . . . . . . . . . . . j f j f . . . . . . . . . . . . . f f F f j j . . . . . . . . . . j F f j . . . . . . . . . . . . . f F . . . . . . . . . . . . . . f f . . . . . . . . . . . . . . j F . . . . . . . . . . . . . f f F f . . . . . . ]]}, {nil,"tile_sign",[[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . f . . . . . . . . . . . . . . . F f . . . . f f f 5 f f f 5 f f f F f . . . f F 4 F F F 4 F 4 F F f F f . . f j 3 j 3 j 3 j 3 j j f F f . . f j j 2 2 j j 2 j j f F f . . . . . . . j j j . . . F f . . . . . . . . F j j . . . f . . . . . . . . . F f j . . . . . . . . . . . . . F f j . . . . . . . . . . . . . F f j . . . . . . . . . . . . . F f j . . . . . . . ]]}, {nil,"tile_postbox",[[ . m m m m m m . m R R R R R R m m m m m m m m f m R R R R R R f m R 0 0 0 0 R f m R R R R R R f m R 3 2 3 2 R f m R 2 3 2 3 R f m R R R R R R f m R R R R R R f m R R R R R R f m R R R R R f f m R R R R f R f R R R R f R f f f R R f R f f f . f f f f f f . ]]}, }end, space=function() local space=entities.get("space") local arbiter_deadly={} -- deadly things arbiter_deadly.presolve=function(it) local callbacks=entities.manifest("callbacks") if it.shape_b.player then -- trigger die local pb=it.shape_b.player callbacks[#callbacks+1]=function() pb:die() end end return true end space:add_handler(arbiter_deadly,space:type("deadly")) local arbiter_crumbling={} -- crumbling tiles arbiter_crumbling.presolve=function(it) local points=it:points() -- once we trigger headroom, we keep a table of headroom shapes and it is not reset until total separation if it.shape_b.in_body.headroom then local headroom=false -- for n,v in pairs(it.shape_b.in_body.headroom) do headroom=true break end -- still touching an old headroom shape? -- if ( (points.normal_y>0) or headroom) then -- can only headroom through non dense tiles if ( (points.normal_y>0) or it.shape_b.in_body.headroom[it.shape_a] ) then it.shape_b.in_body.headroom[it.shape_a]=true return it:ignore() end local tile=it.shape_a.tile -- a humanoid is walking on this tile if tile then tile.level.updates[tile]=true -- start updates to animate this tile crumbling away end end return true end arbiter_crumbling.separate=function(it) if it.shape_a and it.shape_b and it.shape_b.in_body then if it.shape_b.in_body.headroom then -- only players types will have headroom it.shape_b.in_body.headroom[it.shape_a]=nil end end end space:add_handler(arbiter_crumbling,space:type("crumbling")) end, } ----------------------------------------------------------------------------- --[[#entities.systems.item item = entities.systems.item.add() items, can be used for general things, EG physics shapes with no special actions ]] ----------------------------------------------------------------------------- entities.systems.item={ load=function() graphics.loads{ {nil,"cannon_ball",[[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . O O O O . . . . . . . . . . . . . . . . . R O O O O O O O O R . . . . . . . . . . . . . R R R O O O O O O R R R . . . . . . . . . . . R R R R O O O O O O R R R R . . . . . . . . . . 5 R R R R O O O O R R R R c . . . . . . . . . . 5 5 5 R R O O O O R R c c c . . . . . . . . . 5 5 5 5 5 5 R 0 0 R c c c c c c . . . . . . . . 5 5 5 5 5 5 0 0 0 0 c c c c c c . . . . . . . . 5 5 5 5 5 5 0 0 0 0 c c c c c c . . . . . . . . 5 5 5 5 5 5 R 0 0 R c c c c c c . . . . . . . . . 5 5 5 R R o o o o R R c c c . . . . . . . . . . 5 R R R R o o o o R R R R c . . . . . . . . . . R R R R o o o o o o R R R R . . . . . . . . . . . R R R o o o o o o R R R . . . . . . . . . . . . . R o o o o o o o o R . . . . . . . . . . . . . . . . . o o o o . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ]]}, }end, space=function() end, add=function() local item=entities.add{caste="item"} item.draw=function() if item.active then local px,py,rz=item.px,item.py,item.rz if item.body then -- from fizix px,py=item.body:position() rz=item.body:angle() end rz=item.draw_rz or rz -- always face up? system.components.sprites.list_add({t=item.sprite,h=item.h,hx=item.hx,hy=item.hy,s=item.s,sx=item.sx,sy=item.sy,px=px,py=py,rz=180*rz/math.pi,color=item.color,pz=item.pz}) end end return item end, } ----------------------------------------------------------------------------- --[[#entities.systems.score score = entities.systems.score.setup() Create entity that handles the score hud update and display ]] ----------------------------------------------------------------------------- entities.systems.score={ space=function() local space=entities.get("space") local arbiter_loot={} -- loot things (pickups) arbiter_loot.presolve=function(it) if it.shape_a.loot and it.shape_b.player then -- trigger collect it.shape_a.loot.player=it.shape_b.player end return false end space:add_handler(arbiter_loot,space:type("loot")) end, setup=function() local score=entities.set("score",entities.add{}) entities.set("time",{ game=0, }) score.update=function() local time=entities.get("time") time.game=time.game+(1/60) end score.draw=function() --[[ local time=entities.get("time") local remain=0 for _,loot in ipairs( entities.caste("loot") ) do if loot.active then remain=remain+1 end -- count remaining loots end if remain==0 and not time.finish then -- done time.finish=time.game end local t=time.start and ( (time.finish or time.game) - ( time.start ) ) or 0 local ts=math.floor(t) local tp=math.floor((t%1)*100) local s=string.format("%d.%02d",ts,tp) system.components.text.text_print(s,math.floor((system.components.text.tilemap_hx-#s)/2),0) ]] local s="" local level=entities.get("level") s=level.title or s for i,player in pairs(entities.caste("player")) do if player.near_menu then s=player.near_menu.title end if player.near_npc then local chats=entities.get("chats") local chat=chats:get_subject(player.near_npc.name) s=chat:get_tag("title") or s end end system.components.text.text_print(s,math.floor((system.components.text.tilemap_hx-#s)/2),system.components.text.tilemap_hy-1) end return score end, } ----------------------------------------------------------------------------- --[[#entities.systems.player player = entities.systems.player.add(idx) Add a player, level should be setup before calling this ]] ----------------------------------------------------------------------------- entities.systems.player={ load=function() graphics.loads{ -- 4 x 16x32 {nil,"skel_walk_4",[[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . 7 7 7 7 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . 7 7 7 7 7 . . . . . . . . . . . 7 7 7 7 7 . . . . . . . . . . . 7 0 7 0 7 . . . . . . . . . . . 7 7 7 7 7 . . . . . . . . . . . 7 0 7 0 7 . . . . . . . . . . . 7 0 7 0 7 . . . . . . . . . . . 7 7 0 7 7 . . . . . . . . . . . 7 0 7 0 7 . . . . . . . . . . . 7 7 0 7 7 . . . . . . . . . . . 7 7 0 7 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . 7 7 0 7 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 0 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 0 7 . . . . . . . . . . . . . 7 0 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 0 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . 7 7 7 . 7 . 7 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . 7 7 7 . 7 . . 7 7 . . . . . . . . 7 7 . 7 . 7 7 . . . . . . . . 7 . . 7 7 7 7 7 . . . . . . . . 7 7 7 . 7 . . 7 7 . . . . . . . 7 . . 7 7 7 7 . 7 . . . . . . . . 7 . 7 7 7 7 7 . . . . . . . . 7 . 7 . 7 . . 7 . . . . . . . . 7 . . 7 7 7 7 . 7 . . . . . . . 7 . 7 . 7 . . 7 7 . . . . . . . . 7 7 . 7 . . 7 . . . . . . . . 7 . . 7 7 7 7 7 . . . . . . . . 7 . 7 . 7 . . 7 7 . . . . . . . 7 . . 7 7 7 7 . 7 . . . . . . . . 7 . 7 7 7 7 7 . . . . . . . . 7 7 7 . 7 . . 7 7 . . . . . . 7 7 . . 7 7 7 7 . 7 7 . . . . . . 7 7 7 . 7 . . 7 7 . . . . . . . . 7 7 . 7 . . 7 . . . . . . . . . 7 . 7 7 7 7 . 7 . . . . . . 7 . . 7 . 7 . . 7 . 7 . . . . . . . 7 . 7 7 7 7 7 . . . . . . . . . 7 . 7 7 7 7 7 . . . . . . . . . 7 7 . 7 7 . 7 7 . . . . . . 7 . . . 7 7 7 7 . . 7 . . . . . . . 7 7 . 7 7 . 7 . . . . . . . . . 7 7 . 7 7 . 7 . . . . . . . . . 7 7 7 7 7 7 7 7 7 . . . . . 7 . . 7 . 7 7 . 7 . 7 . . . . . . . 7 7 7 7 7 7 7 . . . . . . . . . 7 7 7 7 7 7 7 . . . . . . . . . 7 7 7 7 . 7 . 7 7 . . . . . 7 7 . 7 7 7 7 7 7 7 7 . . . . . . . 7 7 7 . . 7 7 . . . . . . . . . 7 7 7 . . 7 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . 7 7 . . 7 . . 7 . 7 7 . . . . . . . . . 7 . . . 7 7 . . . . . . . . . 7 . . . . 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . 7 . . 7 . . . . . . . . . . . . 7 . . . . 7 7 . . . . . . . 7 7 . . . . 7 7 . . . . . . . . . . . 7 7 7 7 . . . . . . . . . . . 7 7 7 7 . . . . . . . . . . . 7 7 . . . . 7 7 . . . . . . . 7 7 . . . . 7 7 . . . . . . . . . . 7 . . 7 7 . . . . . . . . . . . 7 7 7 7 . . . . . . . . . . . 7 7 . . . 7 . . . . . . . . . 7 . . . . . 7 . . . . . . . . . . . 7 . . 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . . . . . 7 . . . . 7 . . . . . . . . . 7 . . . . . 7 . . . . . . . . . . 7 . . . 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . . . . . 7 . . . 7 . . . . . . . . . . 7 . . . . . 7 . . . . . . . . . . 7 . . . 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . . . . . 7 . . . 7 . . . . . . . . . . 7 . . . . . 7 . . . . . . . . . 7 7 7 7 . 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . . . . . 7 . . 7 7 7 7 . . . . . . . 7 7 7 7 . . 7 7 7 7 . . . . . . . . . . . 7 7 7 7 . . . . . . . . . 7 7 7 7 7 7 . . . . . . . . . 7 7 7 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ]]}, }end, space=function() local space=entities.get("space") local arbiter_pass={} -- background tiles we can jump up through arbiter_pass.presolve=function(it) local points=it:points() -- once we trigger headroom, we keep a table of headroom shapes and it is not reset until total separation if it.shape_b.in_body.headroom then local headroom=false -- for n,v in pairs(it.shape_b.in_body.headroom) do headroom=true break end -- still touching an old headroom shape? -- if ( (points.normal_y>0) or headroom) then -- can only headroom through non dense tiles if ( (points.normal_y>0) or it.shape_b.in_body.headroom[it.shape_a] ) then it.shape_b.in_body.headroom[it.shape_a]=true return it:ignore() end end return true end arbiter_pass.separate=function(it) if it.shape_a and it.shape_b and it.shape_b.in_body then if it.shape_b.in_body.headroom then it.shape_b.in_body.headroom[it.shape_a]=nil end end end space:add_handler(arbiter_pass,space:type("pass")) local arbiter_walking={} -- walking things (players) arbiter_walking.presolve=function(it) local callbacks=entities.manifest("callbacks") if it.shape_a.player and it.shape_b.monster then local pa=it.shape_a.player callbacks[#callbacks+1]=function() pa:die() end end if it.shape_a.monster and it.shape_b.player then local pb=it.shape_b.player callbacks[#callbacks+1]=function() pb:die() end end if it.shape_a.player and it.shape_b.player then -- two players touch local pa=it.shape_a.player local pb=it.shape_b.player if pa.active then if pb.bubble_active and pb.joined then -- burst callbacks[#callbacks+1]=function() pb:join() end end end if pb.active then if pa.bubble_active and pa.joined then -- burst callbacks[#callbacks+1]=function() pa:join() end end end end return true end arbiter_walking.postsolve=function(it) local points=it:points() if points.normal_y>0.25 then -- on floor local time=entities.get("time") it.shape_a.in_body.floor_time=time.game it.shape_a.in_body.floor=it.shape_b end return true end space:add_handler(arbiter_walking,space:type("walking")) -- walking things (players) local arbiter_trigger={} -- trigger things arbiter_trigger.presolve=function(it) if it.shape_a.trigger and it.shape_b.triggered then -- trigger something it.shape_b.triggered.triggered = it.shape_a.trigger end return false end space:add_handler(arbiter_trigger,space:type("trigger")) end, ----------------------------------------------------------------------------- --[[#entities.systems.player entities.systems.player.controls(it,fast) Handle player style movement, so we can reuse this code for player style monsters. it is a player or monster, fast lets us tweak the speed and defaults to 1 movement controls are set in it it.move which is "left" or "right" to move left or right it.jump which is true if we should jump ]] ----------------------------------------------------------------------------- controls=function(it,fast) fast=fast or 1 local menu=entities.get("menu") local chats=entities.get("chats") local time=entities.get("time") local jump=fast*200 -- up velocity we want when jumping local speed=fast*60 -- required x velocity local airforce=speed*2 -- replaces surface velocity local groundforce=speed/2 -- helps surface velocity if ( time.game-it.body.floor_time < 0.125 ) or ( it.floor_time-time.game > 10 ) then -- floor available recently or not for a very long time (stuck) it.floor_time=time.game -- last time we had some floor it.shape:friction(1) if it.jump_clr and it.near_menu then local menu=entities.get("menu") local near_menu=it.near_menu local callbacks=entities.manifest("callbacks") callbacks[#callbacks+1]=function() menu.show(near_menu) end -- call later so we do not process menu input this frame end if it.jump_clr and it.near_npc then local callbacks=entities.manifest("callbacks") callbacks[#callbacks+1]=function() local chat=chats:get_subject(subject_name) chat:set_topic("welcome") menu.show( menu.chat_to_menu_items(chat) ) end -- call later so we do not process menu input this frame end if it.jump then local vx,vy=it.body:velocity() if vy>-20 then -- only when pushing against the ground a little if it.near_menu or it.near_npc then -- no jump else vy=-jump it.body:velocity(vx,vy) it.body.floor_time=0 end end end if it.move=="left" then local vx,vy=it.body:velocity() if vx>0 then it.body:velocity(0,vy) end it.shape:surface_velocity(speed,0) if vx>-speed then it.body:apply_force(-groundforce,0,0,0) end it.dir=-1 it.frame=it.frame+1 elseif it.move=="right" then local vx,vy=it.body:velocity() if vx<0 then it.body:velocity(0,vy) end it.shape:surface_velocity(-speed,0) if vx<speed then it.body:apply_force(groundforce,0,0,0) end it.dir= 1 it.frame=it.frame+1 else it.shape:surface_velocity(0,0) end else -- in air it.shape:friction(0) if it.move=="left" then local vx,vy=it.body:velocity() if vx>0 then it.body:velocity(0,vy) end if vx>-speed then it.body:apply_force(-airforce,0,0,0) end it.shape:surface_velocity(speed,0) it.dir=-1 it.frame=it.frame+1 elseif it.move=="right" then local vx,vy=it.body:velocity() if vx<0 then it.body:velocity(0,vy) end if vx<speed then it.body:apply_force(airforce,0,0,0) end it.shape:surface_velocity(-speed,0) it.dir= 1 it.frame=it.frame+1 else it.shape:surface_velocity(0,0) end end end, add=function(i) local players_colors={[0]=30,30,14,18,7,3,22} local names=system.components.tiles.names local space=entities.get("space") local player=entities.add{caste="player"} player.idx=i player.score=0 local t=bitdown.cmap[ players_colors[i] ] player.color={} player.color.r=t[1]/255 player.color.g=t[2]/255 player.color.b=t[3]/255 player.color.a=t[4]/255 player.color.idx=players_colors[i] player.up_text_x=math.ceil( (system.components.text.tilemap_hx/16)*( 1 + ((i>3 and i+2 or i)-1)*2 ) ) player.frame=0 player.frames={ names.skel_walk_4.idx+0 , names.skel_walk_4.idx+2 , names.skel_walk_4.idx+4 , names.skel_walk_4.idx+6 } player.join=function() local players_start=entities.get("players_start") or {64,64} local px,py=players_start[1]+i,players_start[2] local vx,vy=0,0 player.bubble_active=false player.active=true player.body=space:body(1,math.huge) player.body:position(px,py) player.body:velocity(vx,vy) player.body.headroom={} player.body:velocity_func(function(body) -- body.gravity_x=-body.gravity_x -- body.gravity_y=-body.gravity_y return true end) player.floor_time=0 -- last time we had some floor player.shape=player.body:shape("segment",0,2,0,11,4) player.shape:friction(1) player.shape:elasticity(0) player.shape:collision_type(space:type("walking")) -- walker player.shape.player=player player.body.floor_time=0 local time=entities.get("time") if not time.start then time.start=time.game -- when the game started end end player.update=function() local up=ups(player.idx) -- the controls for this player player.move=false player.jump=up.button("fire") player.jump_clr=up.button("fire_clr") if use_only_two_keys then -- touch screen control test? if up.button("left") and up.button("right") then -- jump player.move=player.move_last player.jump=true elseif up.button("left") then -- left player.move_last="left" player.move="left" elseif up.button("right") then -- right player.move_last="right" player.move="right" end else if up.button("left") and up.button("right") then -- stop player.move=nil elseif up.button("left") then -- left player.move="left" elseif up.button("right") then -- right player.move="right" end end if not player.joined then player.joined=true player:join() -- join for real and remove bubble end if player.active then entities.systems.player.controls(player) end end player.draw=function() if player.active then local px,py=player.body:position() local rz=player.body:angle() player.frame=player.frame%16 local t=player.frames[1+math.floor(player.frame/4)] system.components.sprites.list_add({t=t,hx=16,hy=32,px=px,py=py,sx=player.dir,sy=1,rz=180*rz/math.pi,color=player.color}) end -- if player.joined then -- local s=string.format("%d",player.score) -- system.components.text.text_print(s,math.floor(player.up_text_x-(#s/2)),0,player.color.idx) -- end end return player end, } ----------------------------------------------------------------------------- --[[#entities.systems.npc npc = entities.systems.npc.add(opts) Add an npc. ]] ----------------------------------------------------------------------------- entities.systems.npc={ chat_text=[[ #npc1 =title A door shaped like a dead man. =donuts 0 <welcome Good Day Kind Sir, If you fetch me all the donuts I will let you out. >exit?donuts<10 Fine I'll go look. >donut?donuts>9 Here you go, 10 donuts that have barely touched the ground. >out Where is out? <out Out is nearby, I may have been here a long long time but I know exactly how to get out and I can show you, just bring me donuts, all of them! >exit Be seeing you. ]], chat_hook_topic=function(chat,a) if chat.subject_name=="npc1" then if a.name=="exit" then if not entities.get("added_donuts") then entities.set("added_donuts",true) entities.systems.donut.spawn(10) end end if a.name=="donut" then entities.systems.level.setup(2) end end end, load=function() graphics.loads{ -- 4 x 16x32 {nil,"npc1_walk_4",[[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . 7 7 7 7 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . 7 7 7 7 7 . . . . . . . . . . . 7 7 7 7 7 . . . . . . . . . . . 7 0 7 0 7 . . . . . . . . . . . 7 7 7 7 7 . . . . . . . . . . . 7 0 7 0 7 . . . . . . . . . . . 7 0 7 0 7 . . . . . . . . . . . 7 7 0 7 7 . . . . . . . . . . . 7 0 7 0 7 . . . . . . . . . . . 7 7 0 7 7 . . . . . . . . . . . 7 7 0 7 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . 7 7 0 7 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 0 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 0 7 . . . . . . . . . . . . . 7 0 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 0 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . . 7 7 7 . . . . . . . . . 7 7 7 . 7 . 7 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . 7 7 7 . 7 . . 7 7 . . . . . . . . 7 7 . 7 . 7 7 . . . . . . . . 7 . . 7 7 7 7 7 . . . . . . . . 7 7 7 . 7 . . 7 7 . . . . . . . 7 . . 7 7 7 7 . 7 . . . . . . . . 7 . 7 7 7 7 7 . . . . . . . . 7 . 7 . 7 . . 7 . . . . . . . . 7 . . 7 7 7 7 . 7 . . . . . . . 7 . 7 . 7 . . 7 7 . . . . . . . . 7 7 . 7 . . 7 . . . . . . . . 7 . . 7 7 7 7 7 . . . . . . . . 7 . 7 . 7 . . 7 7 . . . . . . . 7 . . 7 7 7 7 . 7 . . . . . . . . 7 . 7 7 7 7 7 . . . . . . . . 7 7 7 . 7 . . 7 7 . . . . . . 7 7 . . 7 7 7 7 . 7 7 . . . . . . 7 7 7 . 7 . . 7 7 . . . . . . . . 7 7 . 7 . . 7 . . . . . . . . . 7 . 7 7 7 7 . 7 . . . . . . 7 . . 7 . 7 . . 7 . 7 . . . . . . . 7 . 7 7 7 7 7 . . . . . . . . . 7 . 7 7 7 7 7 . . . . . . . . . 7 7 . 7 7 . 7 7 . . . . . . 7 . . . 7 7 7 7 . . 7 . . . . . . . 7 7 . 7 7 . 7 . . . . . . . . . 7 7 . 7 7 . 7 . . . . . . . . . 7 7 7 7 7 7 7 7 7 . . . . . 7 . . 7 . 7 7 . 7 . 7 . . . . . . . 7 7 7 7 7 7 7 . . . . . . . . . 7 7 7 7 7 7 7 . . . . . . . . . 7 7 7 7 . 7 . 7 7 . . . . . 7 7 . 7 7 7 7 7 7 7 7 . . . . . . . 7 7 7 . . 7 7 . . . . . . . . . 7 7 7 . . 7 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . 7 7 . . 7 . . 7 . 7 7 . . . . . . . . . 7 . . . 7 7 . . . . . . . . . 7 . . . . 7 . . . . . . . . . . . . 7 7 7 . . . . . . . . . . . . 7 . . 7 . . . . . . . . . . . . 7 . . . . 7 7 . . . . . . . 7 7 . . . . 7 7 . . . . . . . . . . . 7 7 7 7 . . . . . . . . . . . 7 7 7 7 . . . . . . . . . . . 7 7 . . . . 7 7 . . . . . . . 7 7 . . . . 7 7 . . . . . . . . . . 7 . . 7 7 . . . . . . . . . . . 7 7 7 7 . . . . . . . . . . . 7 7 . . . 7 . . . . . . . . . 7 . . . . . 7 . . . . . . . . . . . 7 . . 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . . . . . 7 . . . . 7 . . . . . . . . . 7 . . . . . 7 . . . . . . . . . . 7 . . . 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . . . . . 7 . . . 7 . . . . . . . . . . 7 . . . . . 7 . . . . . . . . . . 7 . . . 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . . . . . 7 . . . 7 . . . . . . . . . . 7 . . . . . 7 . . . . . . . . . 7 7 7 7 . 7 . . . . . . . . . . . . 7 . 7 . . . . . . . . . . . . 7 . . 7 7 7 7 . . . . . . . 7 7 7 7 . . 7 7 7 7 . . . . . . . . . . . 7 7 7 7 . . . . . . . . . 7 7 7 7 7 7 . . . . . . . . . 7 7 7 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ]]}, }end, space=function() local space=entities.get("space") local arbiter_npc={} -- npc menu things arbiter_npc.presolve=function(it) if it.shape_a.npc and it.shape_b.player then -- remember npc menu it.shape_b.player.near_npc=it.shape_a.npc end return false end arbiter_npc.separate=function(it) if it.shape_a and it.shape_a.npc and it.shape_b and it.shape_b.player then -- forget npc menu it.shape_b.player.near_npc=false end return true end space:add_handler(arbiter_npc,space:type("npc")) end, add=function(opts) local names=system.components.tiles.names local space=entities.get("space") local npc=entities.add{caste="npc"} npc.frame=0 npc.frames={ names.npc1_walk_4.idx+0 , names.npc1_walk_4.idx+2 , names.npc1_walk_4.idx+4 , names.npc1_walk_4.idx+6 } npc.update=function() npc.move=false npc.jump=false npc.jump_clr=false if npc.active then entities.systems.player.controls(npc) end end npc.draw=function() if npc.active then local px,py=npc.body:position() local rz=npc.body:angle() local t=npc.frames[1] system.components.sprites.list_add({t=t,hx=16,hy=32,px=px,py=py,sx=npc.dir,sy=1,rz=180*rz/math.pi,color=npc.color}) end end local px,py=opts.px,opts.py local vx,vy=0,0 npc.dir=-1 npc.color={r=1/2,g=1,b=1/2,a=1} npc.active=true npc.body=space:body(1,math.huge) npc.body:position(px,py) npc.body:velocity(vx,vy) npc.body.headroom={} npc.body:velocity_func(function(body) -- body.gravity_x=-body.gravity_x -- body.gravity_y=-body.gravity_y return true end) npc.floor_time=0 -- last time we had some floor npc.shape=npc.body:shape("segment",0,2,0,11,4) npc.shape:friction(1) npc.shape:elasticity(0) npc.shape:collision_type(space:type("walking")) -- walker npc.shape2=npc.body:shape("segment",0,2,0,11,8) -- talk area npc.shape2:collision_type(space:type("npc")) npc.shape2.npc=npc npc.body.floor_time=0 npc.name="npc1" return npc end, } ----------------------------------------------------------------------------- --[[#entities.systems.donut donut = entities.systems.donut.add(opts) Add an donut. ]] ----------------------------------------------------------------------------- entities.systems.donut={ load=function() graphics.loads{ -- 1 x 24x24 {nil,"donut_1",[[ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . O O O O . . . . . . . . . . . . . . . . . O O O O O O O O O O . . . . . . . . . . . . . O O O O O O O O O O O O . . . . . . . . . . . O O O O O O O O O O O O O O . . . . . . . . . . O O O O O O O O O O O O O O . . . . . . . . . . O O O O O O . . O O O O O O . . . . . . . . . O O O O O O . . . . O O O O O O . . . . . . . . O O O O O . . . . . . O O O O O . . . . . . . . O O O O O . . . . . . O O O O O . . . . . . . . O O O O O O . . . . O O O O O O . . . . . . . . . O O O O O O . . O O O O O O . . . . . . . . . . O O O O O O O O O O O O O O . . . . . . . . . . O O O O O O O O O O O O O O . . . . . . . . . . . O O O O O O O O O O O O . . . . . . . . . . . . . O O O O O O O O O O . . . . . . . . . . . . . . . . . O O O O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ]]}, }end, space=function() local space=entities.get("space") local arbiter_loot={} -- loot things (pickups) arbiter_loot.presolve=function(it) if it.shape_a.loot and it.shape_b.player then -- trigger collect local loot=it.shape_a.loot local player=it.shape_b.player local callbacks=entities.manifest("callbacks") callbacks[#callbacks+1]=function() loot:pickup(player) end return false end return true end space:add_handler(arbiter_loot,space:type("donut")) end, spawn=function(count) for i=1,count do local px=math.random(32,320-32) local py=32 local vx=math.random(-4000,4000)/100 local vy=math.random(-4000,4000)/100 entities.systems.donut.add({px=px,py=py,vx=vx,vy=vy}) end end, add=function(opts) local names=system.components.tiles.names local space=entities.get("space") local donut=entities.add{caste="donut"} donut.frame=0 donut.frames={ names.donut_1.idx+0 } donut.update=function() end donut.draw=function() if donut.active then local px,py=donut.body:position() local rz=donut.body:angle() local t=donut.frames[1] system.components.sprites.list_add({t=t,h=24,px=px,py=py,rz=180*rz/math.pi}) end end donut.pickup=function(it,player) if donut.active then donut.active=false space:remove(donut.shape) space:remove(donut.body) local chats=entities.get("chats") chats:set_tag("npc1/donuts","+1") end end donut.active=true donut.body=space:body(1,1) donut.body:position(opts.px,opts.py) donut.body:velocity(opts.vx,opts.vy) donut.body.headroom={} donut.shape=donut.body:shape("circle",8,0,0) donut.shape:friction(1) donut.shape:elasticity(0) donut.shape:collision_type(space:type("donut")) donut.shape.loot=donut return donut end, } ---------------------------------------------------------------------------- --[[#entities.tiles.start The player start point, just save the x,y ]] ----------------------------------------------------------------------------- entities.tiles.start=function(tile) entities.set("players_start",{tile.x*8+4,tile.y*8+4}) -- remember start point end ----------------------------------------------------------------------------- --[[#entities.tiles.sprite Display a sprite ]] ----------------------------------------------------------------------------- entities.tiles.sprite=function(tile) local names=system.components.tiles.names local item=entities.systems.item.add() item.active=true item.px=tile.x*8+4 item.py=tile.y*8+4 item.sprite = names[tile.sprite].idx item.h=24 item.s=1 item.draw_rz=0 item.pz=-1 end ----------------------------------------------------------------------------- --[[#entities.tiles.npc Display a npc ]] ----------------------------------------------------------------------------- entities.tiles.npc=function(tile) local names=system.components.tiles.names local space=entities.get("space") local item=entities.systems.npc.add({px=tile.x*8,py=tile.y*8}) end ----------------------------------------------------------------------------- --[[#levels Design levels here ]] ----------------------------------------------------------------------------- local combine_legends=function(...) local legend={} for _,t in ipairs{...} do -- merge all for n,v in pairs(t) do -- shallow copy, right side values overwrite left legend[n]=v end end return legend end local default_legend={ [0]={ tile="tile_empty",back="tile_empty",uvworld=true}, -- screen edges ["00"]={ tile="tile_black", solid=1, dense=1, }, -- black border ["0 "]={ tile="tile_empty", solid=1, dense=1, }, -- empty border -- solid features ["||"]={ solid=1, tile="tile_sidewood", }, -- wall ["=="]={ solid=1, back="tile_floor", }, -- floor ["WW"]={ solid=1, tile="tile_bigwall", }, ["S="]={ solid=1, tile="tile_stump", }, ["P="]={ solid=1, tile="tile_postbox", }, -- foreground features [",,"]={ back="tile_grass", }, ["t."]={ tile="tile_tree", }, ["s."]={ tile="tile_sign", }, -- special locations ["S "]={ start=1, }, -- items not tiles, so display tile 0 and we will add a sprite for display ["N1"]={ npc="npc1", }, } levels={} levels[1]={ legend=combine_legends(default_legend,{ ["?0"]={ }, }), title="Welcome!", map=[[ ||0000000000000000000000000000000000000000000000000000000000000000000000000000|| ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||,,. . . . . . ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,. . . . . || ||==. . . . . . ====================================================. . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N1. . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||============================================================================|| ||0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 || ]], } levels[2]={ legend=combine_legends(default_legend,{ ["?0"]={ }, }), title="This is a test.", map=[[ ||0000000000000000000000000000000000000000000000000000000000000000000000000000|| ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . t.t.. . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . t.t.. . . . . . . s.s.. . . . . . . . . . . . . . . . . . || ||,,,,,,,,,,,,,,,,,,t.t.,,,,,,,,,,,,,,s.s.,,,,,,,,. . . . ,,,,,,,,,,,,,,,,,,,,|| ||================================================. . . . ====================|| ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||,,,,,,. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||======. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||,,,,,,,,,,. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||==========. . . . . . . . . . t.t.. . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . t.t.. . . . . . WWWWWWWWWWWW. . . . . . . . . || ||,,,,,,,,,,,,,,. . . . ,,,,,,,,t.t.,,,,,,,,,,,,WWWWWWWWWWWW,,,,,,,,,,,,,,,,,,|| ||==============. . . . ======================================================|| ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||,,. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||==. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||,,. . S . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||==. . . . . . . . . . . . . . . . . . . . . . S=. . . . . . . ,,,,,,,,,,,,,,|| ||. . . . . . . . . . . . . . . . P=. . S=. . . S=. . . . . . . ==============|| ||,,. . . . . . ,,,,,,,,,,S=,,,,,,P=,,,,S=,,,,,,S=,,,,,,,,,,,,,,,,,,. . . . . || ||==. . . . . . ====================================================. . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . || ||============================================================================|| ||0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 || ]], } ----------------------------------------------------------------------------- --[[#entities.systems.level entities.systems.level.setup(level) reset and setup everything for this level idx ]] ----------------------------------------------------------------------------- entities.systems.level={ setup=function(idx) entities.reset() local menu=entities.systems.menu.setup() entities.systems.score.setup() local level=entities.set("level",entities.add{}) local names=system.components.tiles.names level.updates={} -- tiles to update (animate) level.update=function() for v,b in pairs(level.updates) do -- update these things if v.update then v:update() end end end -- init map and space local space=entities.systems.space.setup() local tilemap={} for n,v in pairs( levels[idx].legend ) do -- build tilemap from legend if v.tile then -- convert name to tile local t={} for n,v in pairs( v ) do t[n]=v end for n,v in pairs( names[v.tile] ) do t[n]=v end tilemap[n]=t end end local backmap={} for n,v in pairs( levels[idx].legend ) do -- build tilemap from legend if v.back then -- convert name to tile local t={} for n,v in pairs( v ) do t[n]=v end for n,v in pairs( names[v.back] ) do t[n]=v end backmap[n]=t end end local map=entities.set("map", bitdown.pix_tiles( levels[idx].map, levels[idx].legend ) ) level.title=levels[idx].title bitdown.tile_grd( levels[idx].map, backmap, system.components.back.tilemap_grd ) -- draw into the screen (tiles) bitdown.tile_grd( levels[idx].map, tilemap, system.components.map.tilemap_grd ) -- draw into the screen (tiles) local unique=0 bitdown.map_build_collision_strips(map,function(tile) unique=unique+1 if tile.coll then -- can break the collision types up some more by appending a code to this setting if tile.unique then -- make unique tile.coll=tile.coll..unique end end end) for y,line in pairs(map) do for x,tile in pairs(line) do tile.map=map -- remember map tile.level=level -- remember level if tile.solid and (not tile.parent) then -- if we have no parent then we are the master tile local l=1 local t=tile while t.child do t=t.child l=l+1 end -- count length of strip local shape if tile.link==1 then -- x strip shape=space.static:shape("box",x*8,y*8,(x+l)*8,(y+1)*8,0) elseif tile.link==-1 then -- y strip shape=space.static:shape("box",x*8,y*8,(x+1)*8,(y+l)*8,0) else -- single box shape=space.static:shape("box",x*8,y*8,(x+1)*8,(y+1)*8,0) end tile.shape=shape shape.tile=tile shape:friction(tile.solid) shape:elasticity(tile.solid) shape.cx=x shape.cy=y shape.coll=tile.coll if not tile.dense then shape:collision_type(space:type("pass")) -- a tile we can jump up through end end end end for y,line in pairs(map) do for x,tile in pairs(line) do for n,f in pairs(entities.tiles) do if tile[n] then f(tile) end end end end system.components.back.dirty(true) system.components.map.dirty(true) entities.systems.player.add(0) -- add a player end, } ----------------------------------------------------------------------------- --[[#entities.systems.menu menu = entities.systems.menu.setup() Create a displayable and controllable menu system that can be fed chat data for user display. After setup, provide it with menu items to display using menu.show(items) then call update and draw each frame. ]] ----------------------------------------------------------------------------- entities.systems.menu={ space=function() local space=entities.get("space") local arbiter_menu={} -- menu things arbiter_menu.presolve=function(it) if it.shape_a.menu and it.shape_b.player then -- remember menu it.shape_b.player.near_menu=it.shape_a.menu end return false end arbiter_menu.separate=function(it) if it.shape_a and it.shape_a.menu and it.shape_b and it.shape_b.player then -- forget menu it.shape_b.player.near_menu=false end return true end space:add_handler(arbiter_menu,space:type("menu")) end, setup=function(items) -- join all entity chat_text to build chat_texts with local chat_texts={} for n,v in pairs(entities.systems) do if v.chat_text then chat_texts[#chat_texts+1]=v.chat_text end end chat_texts=table.concat(chat_texts,"\n\n") -- manage chat hooks from entities and print debug text local chat_hook=function(chat,change,...) local a,b=... if change=="subject" then print("subject ",chat.subject_name) for n,v in pairs(entities.systems) do if v.chat_hook_response then v.chat_hook_response(chat,a) end end elseif change=="topic" then print("topic ",chat.subject_name,a and a.name) for n,v in pairs(entities.systems) do if v.chat_hook_topic then v.chat_hook_topic(chat,a) end end elseif change=="goto" then print("goto ",chat.subject_name,a and a.name) for n,v in pairs(entities.systems) do if v.chat_hook_goto then v.chat_hook_goto(chat,a) end end elseif change=="tag" then print("tag ",chat.subject_name,a,b) for n,v in pairs(entities.systems) do if v.chat_hook_tag then v.chat_hook_tag(chat,a,b) end end end end local chats=entities.set( "chats", chatdown.setup_chats(chat_texts,chat_hook) ) local wstr=require("wetgenes.string") local menu=entities.set("menu",entities.add{}) -- local menu={} menu.stack={} menu.width=80-4 menu.cursor=0 menu.cx=math.floor((80-menu.width)/2) menu.cy=0 menu.chat_to_menu_items=function(chat) local items={cursor=1,cursor_max=0} items.title=chat:get_tag("title") items.portrait=chat:get_tag("portrait") local ss=chat.topic and chat.topic.text or {} if type(ss)=="string" then ss={ss} end for i,v in ipairs(ss) do if i>1 then items[#items+1]={text="",chat=chat} -- blank line end items[#items+1]={text=chat:replace_tags(v)or"",chat=chat} end for i,v in ipairs(chat.gotos or {}) do items[#items+1]={text="",chat=chat} -- blank line before each goto local ss=v and v.text or {} if type(ss)=="string" then ss={ss} end local color=30 if chat.viewed[v.name] then color=28 end -- we have already seen the response to this goto local f=function(item,menu) if item.topic and item.topic.name then chats.changes(chat,"topic",item.topic) chat:set_topic(item.topic.name) chat:set_tags(item.topic.tags) if item.topic.name=="exit" then menu.show(nil) else menu.show(menu.chat_to_menu_items(chat)) end end end items[#items+1]={text=chat:replace_tags(ss[1])or"",chat=chat,topic=v,cursor=i,call=f,color=color} -- only show first line items.cursor_max=i end return items end --[[ menu.chat=function(chat) local items={cursor=1,cursor_max=0} items.title=chat.description and chat.description.text or chat.description_name local ss=chat.response and chat.response.text or {} if type(ss)=="string" then ss={ss} end for i,v in ipairs(ss) do if i>1 then items[#items+1]={text="",chat=chat} -- blank line end items[#items+1]={text=chat.replace_proxies(v)or"",chat=chat} end for i,v in ipairs(chat.decisions or {}) do items[#items+1]={text="",chat=chat} -- blank line before each decision local ss=v and v.text or {} if type(ss)=="string" then ss={ss} end local color=30 if chat.viewed[v.name] then color=28 end -- we have already seen the response to this decision local f=function(item,menu) if item.decision and item.decision.name then chats.changes(chat,"decision",item.decision) chat.set_response(item.decision.name) chat.set_proxies(item.decision.proxies) menu.show( menu.chat(chat) ) end end items[#items+1]={text=chat.replace_proxies(ss[1])or"",chat=chat,decision=v,cursor=i,call=f,color=color} -- only show first line items.cursor_max=i end return items end ]] function menu.show(items,subject_name,topic_name) if subject_name and topic_name then local chat=chats:get_subject(subject_name) chat:set_topic(topic_name) items=menu.chat_to_menu_items(chat) elseif subject_name then local chat=chats:get_subject(subject_name) items=menu.chat_to_menu_items(chat) end if not items then menu.items=nil menu.lines=nil return end if items.call then items.call(items,menu) end -- refresh menu.items=items menu.cursor=items.cursor or 1 menu.lines={} for idx=1,#items do local item=items[idx] local text=item.text if text then local ls=wstr.smart_wrap(text,menu.width-8) if #ls==0 then ls={""} end -- blank line for i=1,#ls do local prefix=""--(i>1 and " " or "") if item.cursor then prefix=" " end -- indent decisions menu.lines[#menu.lines+1]={s=prefix..ls[i],idx=idx,item=item,cursor=item.cursor,color=item.color} end end end end menu.update=function() if not menu.items then return end local bfire,bup,bdown,bleft,bright for i=0,5 do -- any player, press a button, to control menu local up=ups(i) if up then bfire =bfire or up.button("fire_clr") bup =bup or up.button("up_set") bdown =bdown or up.button("down_set") bleft =bleft or up.button("left_set") bright=bright or up.button("right_set") end end if bfire then for i,item in ipairs(menu.items) do if item.cursor==menu.cursor then if item.call then -- do this if item and item.decision and item.decision.name=="exit" then --exit menu item.call( item , menu ) menu.show() -- hide else item.call( item , menu ) end end break end end end if bleft or bup then menu.cursor=menu.cursor-1 if menu.cursor<1 then menu.cursor=menu.items.cursor_max end end if bright or bdown then menu.cursor=menu.cursor+1 if menu.cursor>menu.items.cursor_max then menu.cursor=1 end end end menu.draw=function() local tprint=system.components.text.text_print local tgrd=system.components.text.tilemap_grd if not menu.lines then return end menu.cy=math.floor((30-(#menu.lines+4))/2) tgrd:clip(menu.cx,menu.cy,0,menu.width,#menu.lines+4,1):clear(0x02000000) tgrd:clip(menu.cx+2,menu.cy+1,0,menu.width-4,#menu.lines+4-2,1):clear(0x01000000) if menu.items.title then local title=" "..(menu.items.title).." " local wo2=math.floor(#title/2) tprint(title,menu.cx+(menu.width/2)-wo2,menu.cy+0,31,2) end for i,v in ipairs(menu.lines) do tprint(v.s,menu.cx+4,menu.cy+i+1,v.color or 31,1) end local it=nil for i=1,#menu.lines do if it~=menu.lines[i].item then -- first line only it=menu.lines[i].item if it.cursor == menu.cursor then tprint(">",menu.cx+4,menu.cy+i+1,31,1) end end end system.components.text.dirty(true) end if items then menu.show(items) end return menu end, } ----------------------------------------------------------------------------- --[[#update update() Update called every 1/60 of a second, possibly many times before we get a draw call. ]] ----------------------------------------------------------------------------- update=function() if not setup_done then entities.systems.level.setup(1) -- load map setup_done=true end local menu=entities.get("menu") if menu.lines then -- menu only, pause the entities and draw the menu menu.update() else entities.call("update") local space=entities.get("space") space:step(1/(60*2)) -- double step for increased stability, allows faster velocities. space:step(1/(60*2)) end local cb=entities.get("callbacks") or {} -- get callback list entities.set("callbacks",{}) -- and reset it -- run all the callbacks created by collisions for _,f in pairs(cb) do f() end end ----------------------------------------------------------------------------- --[[#draw draw() Draw called every frame, there may be any number of updates between each draw but hopefully we are looking at one update followed by a draw, if you have an exceptionally fast computer then we may even get 0 updates between some draws. ]] ----------------------------------------------------------------------------- draw=function() local menu=entities.get("menu") if menu.lines then menu.draw() end entities.call("draw") -- draw everything, well, actually just prepare everything to be drawn by the system end -- load graphics into texture memory for n,v in pairs(entities.systems) do if v.load then v:load() end end
mit
alfred-bot/phmbot
bot/utils.lua
356
14963
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 superuser 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 -- user has admins privileges 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 -- user has moderator privileges 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['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 -- 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) -- Berfungsi utk mengecek user jika plugin moderated = true if plugin.moderated and not is_momod(msg) then --Cek apakah user adalah momod if plugin.moderated and not is_admin(msg) then -- Cek apakah user adalah admin if plugin.moderated and not is_sudo(msg) then -- Cek apakah user adalah sudoers return false end end end -- Berfungsi mengecek user jika plugin privileged = true 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
gpl-2.0
Oliveryo/Interface
AddOns/BigWigs/Libs/AceDB-2.0/AceDB-2.0.lua
2
43459
--[[ Name: AceDB-2.0 Revision: $Rev: 17797 $ Developed by: The Ace Development Team (http://www.wowace.com/index.php/The_Ace_Development_Team) Inspired By: Ace 1.x by Turan (turan@gryphon.com) Website: http://www.wowace.com/ Documentation: http://www.wowace.com/index.php/AceDB-2.0 SVN: http://svn.wowace.com/root/trunk/Ace2/AceDB-2.0 Description: Mixin to allow for fast, clean, and featureful saved variable access. Dependencies: AceLibrary, AceOO-2.0, AceEvent-2.0 ]] local MAJOR_VERSION = "AceDB-2.0" local MINOR_VERSION = "$Revision: 17797 $" if not AceLibrary then error(MAJOR_VERSION .. " requires AceLibrary") end if not AceLibrary:IsNewVersion(MAJOR_VERSION, MINOR_VERSION) then return end if loadstring("return function(...) return ... end") and AceLibrary:HasInstance(MAJOR_VERSION) then return end -- lua51 check if not AceLibrary:HasInstance("AceOO-2.0") then error(MAJOR_VERSION .. " requires AceOO-2.0") end local ACTIVE, ENABLED, STATE, TOGGLE_ACTIVE, MAP_ACTIVESUSPENDED, SET_PROFILE, SET_PROFILE_USAGE, PROFILE, PLAYER_OF_REALM, CHOOSE_PROFILE_DESC, CHOOSE_PROFILE_GUI, COPY_PROFILE_DESC, COPY_PROFILE_GUI, OTHER_PROFILE_DESC, OTHER_PROFILE_GUI, OTHER_PROFILE_USAGE, CHARACTER, REALM, CLASS local function safecall(func,a,b,c,d,e,f,g,h,i) local success, err = pcall(func,a,b,c,d,e,f,g,h,i) if not success then geterrorhandler()(err) end end if GetLocale() == "deDE" then ACTIVE = "Aktiv" ENABLED = "Aktiviert" STATE = "Status" TOGGLE_ACTIVE = "Stoppt/Aktiviert dieses Addon." MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00Aktiv|r", [false] = "|cffff0000Gestoppt|r" } SET_PROFILE = "Setzt das Profil f\195\188r dieses Addon." SET_PROFILE_USAGE = "{Charakter || Klasse || Realm || <Profilname>}" PROFILE = "Profil" PLAYER_OF_REALM = "%s von %s" CHOOSE_PROFILE_DESC = "W\195\164hle ein Profil." CHOOSE_PROFILE_GUI = "W\195\164hle" COPY_PROFILE_DESC = "Kopiert Einstellungen von einem anderem Profil." COPY_PROFILE_GUI = "Kopiere von" OTHER_PROFILE_DESC = "W\195\164hle ein anderes Profil." OTHER_PROFILE_GUI = "Anderes" OTHER_PROFILE_USAGE = "<Profilname>" CHARACTER = "Charakter: " REALM = "Realm: " CLASS = "Klasse: " elseif GetLocale() == "frFR" then ACTIVE = "Actif" ENABLED = "Activ\195\169" STATE = "Etat" TOGGLE_ACTIVE = "Suspend/active cet addon." MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00Actif|r", [false] = "|cffff0000Suspendu|r" } SET_PROFILE = "S\195\169lectionne le profil pour cet addon." SET_PROFILE_USAGE = "{perso || classe || royaume || <nom de profil>}" PROFILE = "Profil" PLAYER_OF_REALM = "%s de %s" CHOOSE_PROFILE_DESC = "Choisissez un profil." CHOOSE_PROFILE_GUI = "Choix" COPY_PROFILE_DESC = "Copier les param\195\168tres d'un autre profil." COPY_PROFILE_GUI = "Copier \195\160 partir de" OTHER_PROFILE_DESC = "Choisissez un autre profil." OTHER_PROFILE_GUI = "Autre" OTHER_PROFILE_USAGE = "<nom de profil>" CHARACTER = "Personnage: " REALM = "Royaume: " CLASS = "Classe: " elseif GetLocale() == "koKR" then ACTIVE = "활성화" ENABLED = "활성화" STATE = "상태" TOGGLE_ACTIVE = "이 애드온 중지/계속 실행" MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00활성화|r", [false] = "|cffff0000중지됨|r" } SET_PROFILE = "이 애드온에 프로필 설정" SET_PROFILE_USAGE = "{캐릭터명 || 직업 || 서버명 || <프로필명>}" PROFILE = "프로필" PLAYER_OF_REALM = "%s (%s 서버)" CHOOSE_PROFILE_DESC = "프로파일을 선택합니다." CHOOSE_PROFILE_GUI = "선택" COPY_PROFILE_DESC = "다른 프로파일에서 설정을 복사합니다." COPY_PROFILE_GUI = "복사" OTHER_PROFILE_DESC = "다른 프로파일을 선택합니다." OTHER_PROFILE_GUI = "기타" OTHER_PROFILE_USAGE = "<프로파일명>" CHARACTER = "캐릭터: " REALM = "서버: " CLASS = "직업: " elseif GetLocale() == "zhTW" then ACTIVE = "啟動" ENABLED = "啟用" STATE = "狀態" TOGGLE_ACTIVE = "暫停/重啟這個插件。" MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00啟動|r", [false] = "|cffff0000已暫停|r" } SET_PROFILE = "設定這插件的記錄檔。" SET_PROFILE_USAGE = "{角色 || 聯業 || 伺服器 || <記錄檔名稱>}" PROFILE = "記錄檔" PLAYER_OF_REALM = "%s 於 %s" CHOOSE_PROFILE_DESC = "選擇一個記錄檔" CHOOSE_PROFILE_GUI = "選擇" COPY_PROFILE_DESC = "由其他記錄檔複製設定。" COPY_PROFILE_GUI = "複製由" OTHER_PROFILE_DESC = "選擇其他記錄檔。" OTHER_PROFILE_GUI = "其他" OTHER_PROFILE_USAGE = "<記錄檔名稱>" CHARACTER = "角色:" REALM = "伺服器:" CLASS = "聯業:" elseif GetLocale() == "zhCN" then ACTIVE = "\230\156\137\230\149\136" ENABLED = "\229\144\175\231\148\168" STATE = "\231\138\182\230\128\129" TOGGLE_ACTIVE = "\230\154\130\229\129\156/\230\129\162\229\164\141 \230\173\164\230\143\146\228\187\182." MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00\230\156\137\230\149\136|r", [false] = "|cffff0000\230\154\130\229\129\156|r" } SET_PROFILE = "\232\174\190\231\189\174\233\133\141\231\189\174\230\150\135\228\187\182\228\184\186\232\191\153\230\143\146\228\187\182." SET_PROFILE_USAGE = "{\229\173\151\231\172\166 || \233\128\137\228\187\182\231\177\187 || \229\159\159 || <\233\133\141\231\189\174\230\150\135\228\187\182\229\144\141\229\173\151>}" PROFILE = "\233\133\141\231\189\174\230\150\135\228\187\182" PLAYER_OF_REALM = "%s \231\154\132 %s" CHOOSE_PROFILE_DESC = "\233\128\137\230\139\169\233\133\141\231\189\174\230\150\135\228\187\182." CHOOSE_PROFILE_GUI = "\233\128\137\230\139\169" COPY_PROFILE_DESC = "\229\164\141\229\136\182\232\174\190\231\189\174\228\187\142\229\143\166\228\184\128\228\184\170\233\133\141\231\189\174\230\150\135\228\187\182." COPY_PROFILE_GUI = "\229\164\141\229\136\182\228\187\142" OTHER_PROFILE_DESC = "\233\128\137\230\139\169\229\143\166\228\184\128\228\184\170\233\133\141\231\189\174\230\150\135\228\187\182." OTHER_PROFILE_GUI = "\229\133\182\228\187\150" OTHER_PROFILE_USAGE = "<\233\133\141\231\189\174\230\150\135\228\187\182\229\144\141\229\173\151>" CHARACTER = "\229\173\151\231\172\166: " REALM = "\229\159\159: " CLASS = "\233\128\137\228\187\182\231\177\187: " else -- enUS ACTIVE = "Active" ENABLED = "Enabled" STATE = "State" TOGGLE_ACTIVE = "Suspend/resume this addon." MAP_ACTIVESUSPENDED = { [true] = "|cff00ff00Active|r", [false] = "|cffff0000Suspended|r" } SET_PROFILE = "Set profile for this addon." SET_PROFILE_USAGE = "{char || class || realm || <profile name>}" PROFILE = "Profile" PLAYER_OF_REALM = "%s of %s" CHOOSE_PROFILE_DESC = "Choose a profile." CHOOSE_PROFILE_GUI = "Choose" COPY_PROFILE_DESC = "Copy settings from another profile." COPY_PROFILE_GUI = "Copy from" OTHER_PROFILE_DESC = "Choose another profile." OTHER_PROFILE_GUI = "Other" OTHER_PROFILE_USAGE = "<profile name>" CHARACTER = "Character: " REALM = "Realm: " CLASS = "Class: " end local AceOO = AceLibrary("AceOO-2.0") local AceEvent local Mixin = AceOO.Mixin local AceDB = Mixin { "RegisterDB", "RegisterDefaults", "ResetDB", "SetProfile", "GetProfile", "ToggleActive", "IsActive", "AcquireDBNamespace", } local Dewdrop = AceLibrary:HasInstance("Dewdrop-2.0") and AceLibrary("Dewdrop-2.0") local _G = getfenv(0) local table_setn do local version = GetBuildInfo() if string.find(version, "^2%.") then -- 2.0.0 table_setn = function() end else table_setn = table.setn end end local function inheritDefaults(t, defaults) if not defaults then return t end for k,v in pairs(defaults) do if k == "*" then local v = v if type(v) == "table" then setmetatable(t, { __index = function(self, key) if key == nil then return nil end self[key] = {} inheritDefaults(self[key], v) return self[key] end } ) else setmetatable(t, { __index = function(self, key) if key == nil then return nil end self[key] = v return self[key] end } ) end for key in pairs(t) do if (defaults[key] == nil or key == "*") and type(t[key]) == "table" then inheritDefaults(t[key], v) end end else if type(v) == "table" then if type(t[k]) ~= "table" then t[k] = {} end inheritDefaults(t[k], v) elseif t[k] == nil then t[k] = v end end end return t end local _,race = UnitRace("player") local faction if race == "Orc" or race == "Scourge" or race == "Troll" or race == "Tauren" then faction = FACTION_HORDE else faction = FACTION_ALLIANCE end local charID = string.format(PLAYER_OF_REALM, UnitName("player"), (string.gsub(GetRealmName(), "^%s*(.-)%s*$", "%1"))) local realm = string.gsub(GetRealmName(), "^%s*(.-)%s*$", "%1") local realmID = realm .. " - " .. faction local classID = UnitClass("player") AceDB.CHAR_ID = charID AceDB.REALM_ID = realmID AceDB.CLASS_ID = classID AceDB.FACTION = faction AceDB.REALM = realm AceDB.NAME = UnitName("player") local new, del do local list = setmetatable({}, {__mode="k"}) function new() local t = next(list) if t then list[t] = nil return t else return {} end end function del(t) setmetatable(t, nil) for k in pairs(t) do t[k] = nil end table_setn(t, 0) list[t] = true end end local caseInsensitive_mt = { __index = function(self, key) if type(key) ~= "string" then return nil end local lowerKey = string.lower(key) for k,v in pairs(self) do if string.lower(k) == lowerKey then return self[k] end end end, __newindex = function(self, key, value) if type(key) ~= "string" then return error("table index is nil", 2) end local lowerKey = string.lower(key) for k in pairs(self) do if string.lower(k) == lowerKey then rawset(self, k, nil) rawset(self, key, value) return end end rawset(self, key, value) end } local db_mt = { __index = function(db, key) if key == "char" then if db.charName then if type(_G[db.charName]) ~= "table" then _G[db.charName] = {} end if type(_G[db.charName].global) ~= "table" then _G[db.charName].global = {} end rawset(db, 'char', _G[db.charName].global) else if type(db.raw.chars) ~= "table" then db.raw.chars = {} end local id = charID if type(db.raw.chars[id]) ~= "table" then db.raw.chars[id] = {} end rawset(db, 'char', db.raw.chars[id]) end if db.defaults and db.defaults.char then inheritDefaults(db.char, db.defaults.char) end return db.char elseif key == "realm" then if type(db.raw.realms) ~= "table" then db.raw.realms = {} end local id = realmID if type(db.raw.realms[id]) ~= "table" then db.raw.realms[id] = {} end rawset(db, 'realm', db.raw.realms[id]) if db.defaults and db.defaults.realm then inheritDefaults(db.realm, db.defaults.realm) end return db.realm elseif key == "account" then if type(db.raw.account) ~= "table" then db.raw.account = {} end rawset(db, 'account', db.raw.account) if db.defaults and db.defaults.account then inheritDefaults(db.account, db.defaults.account) end return db.account elseif key == "class" then if type(db.raw.classes) ~= "table" then db.raw.classes = {} end local id = classID if type(db.raw.classes[id]) ~= "table" then db.raw.classes[id] = {} end rawset(db, 'class', db.raw.classes[id]) if db.defaults and db.defaults.class then inheritDefaults(db.class, db.defaults.class) end return db.class elseif key == "profile" then if type(db.raw.profiles) ~= "table" then db.raw.profiles = setmetatable({}, caseInsensitive_mt) else setmetatable(db.raw.profiles, caseInsensitive_mt) end local id = db.raw.currentProfile[charID] if id == "char" then id = "char/" .. charID elseif id == "class" then id = "class/" .. classID elseif id == "realm" then id = "realm/" .. realmID end if type(db.raw.profiles[id]) ~= "table" then db.raw.profiles[id] = {} end rawset(db, 'profile', db.raw.profiles[id]) if db.defaults and db.defaults.profile then inheritDefaults(db.profile, db.defaults.profile) end return db.profile elseif key == "raw" or key == "defaults" or key == "name" or key == "charName" or key == "namespaces" then return nil end error(string.format('Cannot access key %q in db table. You may want to use db.profile[%q]', tostring(key), tostring(key)), 2) end, __newindex = function(db, key, value) error(string.format('Cannot access key %q in db table. You may want to use db.profile[%q]', tostring(key), tostring(key)), 2) end } local CrawlForSerialization local CrawlForDeserialization local function SerializeObject(o) local t = { o:Serialize() } t[0] = o.class:GetLibraryVersion() CrawlForSerialization(t) return t end local function DeserializeObject(t) CrawlForDeserialization(t) local className = t[0] for i = 20, 1, -1 do if t[i] then table_setn(t, i) break end end local o = AceLibrary(className):Deserialize(unpack(t)) table_setn(t, 0) return o end local function IsSerializable(t) return AceOO.inherits(t, AceOO.Class) and t.class and type(t.class.Deserialize) == "function" and type(t.Serialize) == "function" and type(t.class.GetLibraryVersion) == "function" end function CrawlForSerialization(t) local tmp = new() for k,v in pairs(t) do tmp[k] = v end for k,v in pairs(tmp) do if type(v) == "table" and type(v[0]) ~= "userdata" then if IsSerializable(v) then v = SerializeObject(v) t[k] = v else CrawlForSerialization(v) end end if type(k) == "table" and type(k[0]) ~= "userdata" then if IsSerializable(k) then t[k] = nil t[SerializeObject(k)] = v else CrawlForSerialization(k) end end tmp[k] = nil k = nil end tmp = del(tmp) end local function IsDeserializable(t) return type(t[0]) == "string" and AceLibrary:HasInstance(t[0]) end function CrawlForDeserialization(t) local tmp = new() for k,v in pairs(t) do tmp[k] = v end for k,v in pairs(tmp) do if type(v) == "table" then if IsDeserializable(v) then t[k] = DeserializeObject(v) del(v) v = t[k] elseif type(v[0]) ~= "userdata" then CrawlForDeserialization(v) end end if type(k) == "table" then if IsDeserializable(k) then t[k] = nil t[DeserializeObject(k)] = v del(k) elseif type(k[0]) ~= "userdata" then CrawlForDeserialization(k) end end tmp[k] = nil k = nil end tmp = del(tmp) end local namespace_mt = { __index = function(namespace, key) local db = namespace.db local name = namespace.name if key == "char" then if db.charName then if type(_G[db.charName]) ~= "table" then _G[db.charName] = {} end if type(_G[db.charName].namespaces) ~= "table" then _G[db.charName].namespaces = {} end if type(_G[db.charName].namespaces[name]) ~= "table" then _G[db.charName].namespaces[name] = {} end rawset(namespace, 'char', _G[db.charName].namespaces[name]) else if type(db.raw.namespaces) ~= "table" then db.raw.namespaces = {} end if type(db.raw.namespaces[name]) ~= "table" then db.raw.namespaces[name] = {} end if type(db.raw.namespaces[name].chars) ~= "table" then db.raw.namespaces[name].chars = {} end local id = charID if type(db.raw.namespaces[name].chars[id]) ~= "table" then db.raw.namespaces[name].chars[id] = {} end rawset(namespace, 'char', db.raw.namespaces[name].chars[id]) end if namespace.defaults and namespace.defaults.char then inheritDefaults(namespace.char, namespace.defaults.char) end return namespace.char elseif key == "realm" then if type(db.raw.namespaces) ~= "table" then db.raw.namespaces = {} end if type(db.raw.namespaces[name]) ~= "table" then db.raw.namespaces[name] = {} end if type(db.raw.namespaces[name].realms) ~= "table" then db.raw.namespaces[name].realms = {} end local id = realmID if type(db.raw.namespaces[name].realms[id]) ~= "table" then db.raw.namespaces[name].realms[id] = {} end rawset(namespace, 'realm', db.raw.namespaces[name].realms[id]) if namespace.defaults and namespace.defaults.realm then inheritDefaults(namespace.realm, namespace.defaults.realm) end return namespace.realm elseif key == "account" then if type(db.raw.namespaces) ~= "table" then db.raw.namespaces = {} end if type(db.raw.namespaces[name]) ~= "table" then db.raw.namespaces[name] = {} end if type(db.raw.namespaces[name].account) ~= "table" then db.raw.namespaces[name].account = {} end rawset(namespace, 'account', db.raw.namespaces[name].account) if namespace.defaults and namespace.defaults.account then inheritDefaults(namespace.account, namespace.defaults.account) end return namespace.account elseif key == "class" then if type(db.raw.namespaces) ~= "table" then db.raw.namespaces = {} end if type(db.raw.namespaces[name]) ~= "table" then db.raw.namespaces[name] = {} end if type(db.raw.namespaces[name].classes) ~= "table" then db.raw.namespaces[name].classes = {} end local id = classID if type(db.raw.namespaces[name].classes[id]) ~= "table" then db.raw.namespaces[name].classes[id] = {} end rawset(namespace, 'class', db.raw.namespaces[name].classes[id]) if namespace.defaults and namespace.defaults.class then inheritDefaults(namespace.class, namespace.defaults.class) end return namespace.class elseif key == "profile" then if type(db.raw.namespaces) ~= "table" then db.raw.namespaces = {} end if type(db.raw.namespaces[name]) ~= "table" then db.raw.namespaces[name] = {} end if type(db.raw.namespaces[name].profiles) ~= "table" then db.raw.namespaces[name].profiles = setmetatable({}, caseInsensitive_mt) else setmetatable(db.raw.namespaces[name].profiles, caseInsensitive_mt) end local id = db.raw.currentProfile[charID] if id == "char" then id = "char/" .. charID elseif id == "class" then id = "class/" .. classID elseif id == "realm" then id = "realm/" .. realmID end if type(db.raw.namespaces[name].profiles[id]) ~= "table" then db.raw.namespaces[name].profiles[id] = {} end rawset(namespace, 'profile', db.raw.namespaces[name].profiles[id]) if namespace.defaults and namespace.defaults.profile then inheritDefaults(namespace.profile, namespace.defaults.profile) end return namespace.profile elseif key == "defaults" or key == "name" or key == "db" then return nil end error(string.format('Cannot access key %q in db table. You may want to use db.profile[%q]', tostring(key), tostring(key)), 2) end, __newindex = function(db, key, value) error(string.format('Cannot access key %q in db table. You may want to use db.profile[%q]', tostring(key), tostring(key)), 2) end } function AceDB:InitializeDB(addonName) local db = self.db if not db then if addonName then AceDB.addonsLoaded[addonName] = true end return end if db.raw then -- someone manually initialized return end if type(_G[db.name]) ~= "table" then _G[db.name] = {} else CrawlForDeserialization(_G[db.name]) end if type(_G[db.charName]) == "table" then CrawlForDeserialization(_G[db.charName]) end rawset(db, 'raw', _G[db.name]) if not db.raw.currentProfile then db.raw.currentProfile = {} end if not db.raw.currentProfile[charID] then db.raw.currentProfile[charID] = "Default" end if db.raw.disabled then setmetatable(db.raw.disabled, caseInsensitive_mt) end if self['acedb-profile-copylist'] then local t = self['acedb-profile-copylist'] for k,v in pairs(t) do t[k] = nil end if db.raw.profiles then for k in pairs(db.raw.profiles) do if string.find(k, '^char/') then local name = string.sub(k, 6) if name ~= charID then t[k] = CHARACTER .. name end elseif string.find(k, '^realm/') then local name = string.sub(k, 7) if name ~= realmID then t[k] = REALM .. name end elseif string.find(k, '^class/') then local name = string.sub(k, 7) if name ~= classID then t[k] = CLASS .. name end end end end end if self['acedb-profile-list'] then local t = self['acedb-profile-list'] for k,v in pairs(t) do t[k] = nil end t.char = CHARACTER .. charID t.realm = REALM .. realmID t.class = CLASS .. classID t.Default = "Default" if db.raw.profiles then for k in pairs(db.raw.profiles) do if not string.find(k, '^char/') and not string.find(k, '^realm/') and not string.find(k, '^class/') then t[k] = k end end end end setmetatable(db, db_mt) end function AceDB:OnEmbedInitialize(target, name) if name then self:ADDON_LOADED(name) end self.InitializeDB(target, name) end function AceDB:RegisterDB(name, charName) AceDB:argCheck(name, 2, "string") AceDB:argCheck(charName, 3, "string", "nil") if self.db then AceDB:error("Cannot call \"RegisterDB\" if self.db is set.") end local stack = debugstack() local addonName = string.gsub(stack, ".-\n.-\\AddOns\\(.-)\\.*", "%1") self.db = { name = name, charName = charName } if AceDB.addonsLoaded[addonName] then AceDB.InitializeDB(self, addonName) else AceDB.addonsToBeInitialized[self] = addonName end AceDB.registry[self] = true end function AceDB:RegisterDefaults(kind, defaults, a3) local name if a3 then name, kind, defaults = kind, defaults, a3 AceDB:argCheck(name, 2, "string") AceDB:argCheck(kind, 3, "string") AceDB:argCheck(defaults, 4, "table") if kind ~= "char" and kind ~= "class" and kind ~= "profile" and kind ~= "account" and kind ~= "realm" then AceDB:error("Bad argument #3 to `RegisterDefaults' (\"char\", \"class\", \"profile\", \"account\", or \"realm\" expected, got %q)", kind) end else AceDB:argCheck(kind, 2, "string") AceDB:argCheck(defaults, 3, "table") if kind ~= "char" and kind ~= "class" and kind ~= "profile" and kind ~= "account" and kind ~= "realm" then AceDB:error("Bad argument #2 to `RegisterDefaults' (\"char\", \"class\", \"profile\", \"account\", or \"realm\" expected, got %q)", kind) end end if type(self.db) ~= "table" or type(self.db.name) ~= "string" then AceDB:error("Cannot call \"RegisterDefaults\" unless \"RegisterDB\" has been previously called.") end local db if name then local namespace = self:AcquireDBNamespace(name) if namespace.defaults and namespace.defaults[kind] then AceDB:error("\"RegisterDefaults\" has already been called for %q::%q.", name, kind) end db = namespace else if self.db.defaults and self.db.defaults[kind] then AceDB:error("\"RegisterDefaults\" has already been called for %q.", kind) end db = self.db end if not db.defaults then rawset(db, 'defaults', {}) end db.defaults[kind] = defaults if rawget(db, kind) then inheritDefaults(db[kind], defaults) end end function AceDB:ResetDB(kind) AceDB:argCheck(kind, 2, "nil", "string") if not self.db or not self.db.raw then AceDB:error("Cannot call \"ResetDB\" before \"RegisterDB\" has been called and before \"ADDON_LOADED\" has been fired.") end local db = self.db if kind == nil then if db.charName then _G[db.charName] = nil end _G[db.name] = nil rawset(db, 'raw', nil) AceDB.InitializeDB(self) if db.namespaces then for name,v in pairs(db.namespaces) do rawset(v, 'account', nil) rawset(v, 'char', nil) rawset(v, 'class', nil) rawset(v, 'profile', nil) rawset(v, 'realm', nil) end end elseif kind == "account" then db.raw.account = nil rawset(db, 'account', nil) if db.namespaces then for name,v in pairs(db.namespaces) do rawset(v, 'account', nil) end end elseif kind == "char" then if db.charName then _G[db.charName] = nil else if db.raw.chars then db.raw.chars[charID] = nil end if db.raw.namespaces then for name,v in pairs(db.raw.namespaces) do if v.chars then v.chars[charID] = nil end end end end rawset(db, 'char', nil) if db.namespaces then for name,v in pairs(db.namespaces) do rawset(v, 'char', nil) end end elseif kind == "realm" then if db.raw.realms then db.raw.realms[realmID] = nil end rawset(db, 'realm', nil) if db.raw.namespaces then for name,v in pairs(db.raw.namespaces) do if v.realms then v.realms[realmID] = nil end end end if db.namespaces then for name,v in pairs(db.namespaces) do rawset(v, 'realm', nil) end end elseif kind == "class" then if db.raw.realms then db.raw.realms[classID] = nil end rawset(db, 'class', nil) if db.raw.namespaces then for name,v in pairs(db.raw.namespaces) do if v.classes then v.classes[classID] = nil end end end if db.namespaces then for name,v in pairs(db.namespaces) do rawset(v, 'class', nil) end end elseif kind == "profile" then local id = db.raw.currentProfile and db.raw.currentProfile[charID] or "Default" if id == "char" then id = "char/" .. charID elseif id == "class" then id = "class/" .. classID elseif id == "realm" then id = "realm/" .. realmID end if db.raw.profiles then db.raw.profiles[id] = nil end rawset(db, 'profile', nil) if db.raw.namespaces then for name,v in pairs(db.raw.namespaces) do if v.profiles then v.profiles[id] = nil end end end if db.namespaces then for name,v in pairs(db.namespaces) do rawset(v, 'profile', nil) end end end end local function cleanDefaults(t, defaults) if defaults then for k,v in pairs(defaults) do if k == "*" then if type(v) == "table" then for k in pairs(t) do if (defaults[k] == nil or k == "*") and type(t[k]) == "table" then if cleanDefaults(t[k], v) then t[k] = nil end end end else for k in pairs(t) do if (defaults[k] == nil or k == "*") and t[k] == v then t[k] = nil end end end else if type(v) == "table" then if type(t[k]) == "table" then if cleanDefaults(t[k], v) then t[k] = nil end end elseif t[k] == v then t[k] = nil end end end end return t and not next(t) end function AceDB:GetProfile() if not self.db or not self.db.raw then return nil end if not self.db.raw.currentProfile then self.db.raw.currentProfile = {} end if not self.db.raw.currentProfile[charID] then self.db.raw.currentProfile[charID] = "Default" end local profile = self.db.raw.currentProfile[charID] if profile == "char" then return "char", "char/" .. charID elseif profile == "class" then return "class", "class/" .. classID elseif profile == "realm" then return "realm", "realm/" .. realmID end return profile, profile end local function copyTable(to, from) setmetatable(to, nil) for k,v in pairs(from) do if type(k) == "table" then k = copyTable({}, k) end if type(v) == "table" then v = copyTable({}, v) end to[k] = v end table_setn(to, table.getn(from)) setmetatable(to, from) return to end function AceDB:SetProfile(name, copyFrom) AceDB:argCheck(name, 2, "string") AceDB:argCheck(copyFrom, 3, "string", "nil") if not self.db or not self.db.raw then AceDB:error("Cannot call \"SetProfile\" before \"RegisterDB\" has been called and before \"ADDON_LOADED\" has been fired.") end local db = self.db local copy = false local lowerName = string.lower(name) local lowerCopyFrom = copyFrom and string.lower(copyFrom) if string.sub(lowerName, 1, 5) == "char/" or string.sub(lowerName, 1, 6) == "realm/" or string.sub(lowerName, 1, 6) == "class/" then if string.sub(lowerName, 1, 5) == "char/" then name, copyFrom = "char", name else name, copyFrom = string.sub(lowerName, 1, 5), name end lowerName = string.lower(name) lowerCopyFrom = string.lower(copyFrom) end if copyFrom then if string.sub(lowerCopyFrom, 1, 5) == "char/" then AceDB:assert(lowerName == "char", "If argument #3 starts with `char/', argument #2 must be `char'") elseif string.sub(lowerCopyFrom, 1, 6) == "realm/" then AceDB:assert(lowerName == "realm", "If argument #3 starts with `realm/', argument #2 must be `realm'") elseif string.sub(lowerCopyFrom, 1, 6) == "class/" then AceDB:assert(lowerName == "class", "If argument #3 starts with `class/', argument #2 must be `class'") else AceDB:assert(lowerName ~= "char" and lowerName ~= "realm" and lowerName ~= "class", "If argument #3 does not start with a special prefix, that prefix cannot be copied to.") end if not db.raw.profiles or not db.raw.profiles[copyFrom] then AceDB:error("Cannot copy profile %q, it does not exist.", copyFrom) elseif (string.sub(lowerName, 1, 5) == "char/" and string.sub(lowerName, 6) == string.lower(charID)) or (string.sub(lowerName, 1, 6) == "realm/" and string.sub(lowerName, 7) == string.lower(realmID)) or (string.sub(lowerName, 1, 6) == "class/" and string.sub(lowerName, 7) == string.lower(classID)) then AceDB:error("Cannot copy profile %q, it is currently in use.", name) end end local oldName = db.raw.currentProfile[charID] if string.lower(oldName) == string.lower(name) then return end local oldProfileData = db.profile local realName = name if lowerName == "char" then realName = name .. "/" .. charID elseif lowerName == "realm" then realName = name .. "/" .. realmID elseif lowerName == "class" then realName = name .. "/" .. classID end local current = self.class while current and current ~= AceOO.Class do if current.mixins then for mixin in pairs(current.mixins) do if type(mixin.OnEmbedProfileDisable) == "function" then safecall(mixin.OnEmbedProfileDisable, mixin, self, realName) end end end current = current.super end if type(self.OnProfileDisable) == "function" then safecall(self.OnProfileDisable, self, realName) end local active = self:IsActive() db.raw.currentProfile[charID] = name rawset(db, 'profile', nil) if db.namespaces then for k,v in pairs(db.namespaces) do rawset(v, 'profile', nil) end end if copyFrom then for k,v in pairs(db.profile) do db.profile[k] = nil end copyTable(db.profile, db.raw.profiles[copyFrom]) inheritDefaults(db.profile, db.defaults and db.defaults.profile) if db.namespaces then for l,u in pairs(db.namespaces) do for k,v in pairs(u.profile) do u.profile[k] = nil end copyTable(u.profile, db.raw.namespaces[l].profiles[copyFrom]) inheritDefaults(u.profile, u.defaults and u.defaults.profile) end end end local current = self.class while current and current ~= AceOO.Class do if current.mixins then for mixin in pairs(current.mixins) do if type(mixin.OnEmbedProfileEnable) == "function" then safecall(mixin.OnEmbedProfileEnable, mixin, self, oldName, oldProfileData, copyFrom) end end end current = current.super end if type(self.OnProfileEnable) == "function" then safecall(self.OnProfileEnable, self, oldName, oldProfileData, copyFrom) end if cleanDefaults(oldProfileData, db.defaults and db.defaults.profile) then db.raw.profiles[oldName] = nil if not next(db.raw.profiles) then db.raw.profiles = nil end end local newactive = self:IsActive() if active ~= newactive then if AceOO.inherits(self, "AceAddon-2.0") then local AceAddon = AceLibrary("AceAddon-2.0") if not AceAddon.addonsStarted[self] then return end end if newactive then local current = self.class while current and current ~= AceOO.Class do if current.mixins then for mixin in pairs(current.mixins) do if type(mixin.OnEmbedEnable) == "function" then safecall(mixin.OnEmbedEnable, mixin, self) end end end current = current.super end if type(self.OnEnable) == "function" then safecall(self.OnEnable, self) end if AceEvent then AceEvent:TriggerEvent("Ace2_AddonEnabled", self) end else local current = self.class while current and current ~= AceOO.Class do if current.mixins then for mixin in pairs(current.mixins) do if type(mixin.OnEmbedDisable) == "function" then safecall(mixin.OnEmbedDisable, mixin, self) end end end current = current.super end if type(self.OnDisable) == "function" then safecall(self.OnDisable, self) end if AceEvent then AceEvent:TriggerEvent("Ace2_AddonDisabled", self) end end end if self['acedb-profile-list'] then if not self['acedb-profile-list'][name] then self['acedb-profile-list'][name] = name end end if Dewdrop then Dewdrop:Refresh(1) Dewdrop:Refresh(2) Dewdrop:Refresh(3) Dewdrop:Refresh(4) Dewdrop:Refresh(5) end end function AceDB:IsActive() return not self.db or not self.db.raw or not self.db.raw.disabled or not self.db.raw.disabled[self.db.raw.currentProfile[charID]] end function AceDB:ToggleActive(state) AceDB:argCheck(state, 2, "boolean", "nil") if not self.db or not self.db.raw then AceDB:error("Cannot call \"ToggleActive\" before \"RegisterDB\" has been called and before \"ADDON_LOADED\" has been fired.") end local db = self.db if not db.raw.disabled then db.raw.disabled = setmetatable({}, caseInsensitive_mt) end local profile = db.raw.currentProfile[charID] local disable if state == nil then disable = not db.raw.disabled[profile] else disable = not state if disable == db.raw.disabled[profile] then return end end db.raw.disabled[profile] = disable or nil if AceOO.inherits(self, "AceAddon-2.0") then local AceAddon = AceLibrary("AceAddon-2.0") if not AceAddon.addonsStarted[self] then return end end if not disable then local current = self.class while current and current ~= AceOO.Class do if current.mixins then for mixin in pairs(current.mixins) do if type(mixin.OnEmbedEnable) == "function" then safecall(mixin.OnEmbedEnable, mixin, self) end end end current = current.super end if type(self.OnEnable) == "function" then safecall(self.OnEnable, self) end if AceEvent then AceEvent:TriggerEvent("Ace2_AddonEnabled", self) end else local current = self.class while current and current ~= AceOO.Class do if current.mixins then for mixin in pairs(current.mixins) do if type(mixin.OnEmbedDisable) == "function" then safecall(mixin.OnEmbedDisable, mixin, self) end end end current = current.super end if type(self.OnDisable) == "function" then safecall(self.OnDisable, self) end if AceEvent then AceEvent:TriggerEvent("Ace2_AddonDisabled", self) end end return not disable end function AceDB:embed(target) self.super.embed(self, target) if not AceEvent then AceDB:error(MAJOR_VERSION .. " requires AceEvent-2.0") end end function AceDB:ADDON_LOADED(name) AceDB.addonsLoaded[name] = true for addon, addonName in pairs(AceDB.addonsToBeInitialized) do if name == addonName then AceDB.InitializeDB(addon, name) AceDB.addonsToBeInitialized[addon] = nil end end end function AceDB:PLAYER_LOGOUT() for addon in pairs(AceDB.registry) do local db = addon.db if db then setmetatable(db, nil) CrawlForSerialization(db.raw) if type(_G[db.charName]) == "table" then CrawlForSerialization(_G[db.charName]) end if db.char and cleanDefaults(db.char, db.defaults and db.defaults.char) then if db.charName and _G[db.charName] and _G[db.charName].global == db.char then _G[db.charName].global = nil if not next(_G[db.charName]) then _G[db.charName] = nil end else if db.raw.chars then db.raw.chars[charID] = nil if not next(db.raw.chars) then db.raw.chars = nil end end end end if db.realm and cleanDefaults(db.realm, db.defaults and db.defaults.realm) then if db.raw.realms then db.raw.realms[realmID] = nil if not next(db.raw.realms) then db.raw.realms = nil end end end if db.class and cleanDefaults(db.class, db.defaults and db.defaults.class) then if db.raw.classes then db.raw.classes[classID] = nil if not next(db.raw.classes) then db.raw.classes = nil end end end if db.account and cleanDefaults(db.account, db.defaults and db.defaults.account) then db.raw.account = nil end if db.profile and cleanDefaults(db.profile, db.defaults and db.defaults.profile) then if db.raw.profiles then db.raw.profiles[db.raw.currentProfile and db.raw.currentProfile[charID] or "Default"] = nil if not next(db.raw.profiles) then db.raw.profiles = nil end end end if db.namespaces and db.raw.namespaces then for name,v in pairs(db.namespaces) do if db.raw.namespaces[name] then setmetatable(v, nil) if v.char and cleanDefaults(v.char, v.defaults and v.defaults.char) then if db.charName and _G[db.charName] and _G[db.charName].namespaces and _G[db.charName].namespaces[name] == v then _G[db.charName].namespaces[name] = nil if not next(_G[db.charName].namespaces) then _G[db.charName].namespaces = nil if not next(_G[db.charName]) then _G[db.charName] = nil end end else if db.raw.namespaces[name].chars then db.raw.namespaces[name].chars[charID] = nil if not next(db.raw.namespaces[name].chars) then db.raw.namespaces[name].chars = nil end end end end if v.realm and cleanDefaults(v.realm, v.defaults and v.defaults.realm) then if db.raw.namespaces[name].realms then db.raw.namespaces[name].realms[realmID] = nil if not next(db.raw.namespaces[name].realms) then db.raw.namespaces[name].realms = nil end end end if v.class and cleanDefaults(v.class, v.defaults and v.defaults.class) then if db.raw.namespaces[name].classes then db.raw.namespaces[name].classes[classID] = nil if not next(db.raw.namespaces[name].classes) then db.raw.namespaces[name].classes = nil end end end if v.account and cleanDefaults(v.account, v.defaults and v.defaults.account) then db.raw.namespaces[name].account = nil end if v.profile and cleanDefaults(v.profile, v.defaults and v.defaults.profile) then if db.raw.namespaces[name].profiles then db.raw.namespaces[name].profiles[db.raw.currentProfile and db.raw.currentProfile[charID] or "Default"] = nil if not next(db.raw.namespaces[name].profiles) then db.raw.namespaces[name].profiles = nil end end end if not next(db.raw.namespaces[name]) then db.raw.namespaces[name] = nil end end end if not next(db.raw.namespaces) then db.raw.namespaces = nil end end if db.raw.disabled and not next(db.raw.disabled) then db.raw.disabled = nil end if db.raw.currentProfile then for k,v in pairs(db.raw.currentProfile) do if string.lower(v) == "default" then db.raw.currentProfile[k] = nil end end if not next(db.raw.currentProfile) then db.raw.currentProfile = nil end end if _G[db.name] and not next(_G[db.name]) then _G[db.name] = nil end end end end function AceDB:AcquireDBNamespace(name) AceDB:argCheck(name, 2, "string") local db = self.db if not db then AceDB:error("Cannot call `AcquireDBNamespace' before `RegisterDB' has been called.", 2) end if not db.namespaces then rawset(db, 'namespaces', {}) end if not db.namespaces[name] then local namespace = {} db.namespaces[name] = namespace namespace.db = db namespace.name = name setmetatable(namespace, namespace_mt) end return db.namespaces[name] end function AceDB:GetAceOptionsDataTable(target) if not target['acedb-profile-list'] then target['acedb-profile-list'] = setmetatable({}, caseInsensitive_mt) local t = target['acedb-profile-list'] for k,v in pairs(t) do t[k] = nil end t.char = CHARACTER .. charID t.realm = REALM .. realmID t.class = CLASS .. classID t.Default = "Default" if target.db and target.db.raw then local db = target.db if db.raw.profiles then for k in pairs(db.raw.profiles) do if not string.find(k, '^char/') and not string.find(k, '^realm/') and not string.find(k, '^class/') then t[k] = k end end end end end if not target['acedb-profile-copylist'] then target['acedb-profile-copylist'] = setmetatable({}, caseInsensitive_mt) if target.db and target.db.raw then local t = target['acedb-profile-copylist'] local db = target.db if db.raw.profiles then for k in pairs(db.raw.profiles) do if string.find(k, '^char/') then local name = string.sub(k, 6) if name ~= charID then t[k] = CHARACTER .. name end elseif string.find(k, '^realm/') then local name = string.sub(k, 7) if name ~= realmID then t[k] = REALM .. name end elseif string.find(k, '^class/') then local name = string.sub(k, 7) if name ~= classID then t[k] = CLASS .. name end end end end end end return { standby = { cmdName = STATE, guiName = ENABLED, name = ACTIVE, desc = TOGGLE_ACTIVE, type = "toggle", get = "IsActive", set = "ToggleActive", map = MAP_ACTIVESUSPENDED, order = -3, }, profile = { type = 'group', name = PROFILE, desc = SET_PROFILE, order = -3.5, get = "GetProfile", args = { choose = { guiName = CHOOSE_PROFILE_GUI, cmdName = PROFILE, desc = CHOOSE_PROFILE_DESC, type = 'text', get = "GetProfile", set = "SetProfile", validate = target['acedb-profile-list'] }, copy = { guiName = COPY_PROFILE_GUI, cmdName = PROFILE, desc = COPY_PROFILE_DESC, type = 'text', get = "GetProfile", set = "SetProfile", validate = target['acedb-profile-copylist'], disabled = function() return not next(target['acedb-profile-copylist']) end, }, other = { guiName = OTHER_PROFILE_GUI, cmdName = PROFILE, desc = OTHER_PROFILE_DESC, usage = OTHER_PROFILE_USAGE, type = 'text', get = "GetProfile", set = "SetProfile", } } }, } end local function activate(self, oldLib, oldDeactivate) AceDB = self AceEvent = AceLibrary:HasInstance("AceEvent-2.0") and AceLibrary("AceEvent-2.0") self.super.activate(self, oldLib, oldDeactivate) for t in pairs(self.embedList) do if t.db then rawset(t.db, 'char', nil) rawset(t.db, 'realm', nil) rawset(t.db, 'class', nil) rawset(t.db, 'account', nil) rawset(t.db, 'profile', nil) setmetatable(t.db, db_mt) end end if oldLib then self.addonsToBeInitialized = oldLib.addonsToBeInitialized self.addonsLoaded = oldLib.addonsLoaded self.registry = oldLib.registry end if not self.addonsToBeInitialized then self.addonsToBeInitialized = {} end if not self.addonsLoaded then self.addonsLoaded = {} end if not self.registry then self.registry = {} end if oldLib then oldDeactivate(oldLib) end end local function external(self, major, instance) if major == "AceEvent-2.0" then AceEvent = instance AceEvent:embed(self) self:RegisterEvent("ADDON_LOADED") self:RegisterEvent("PLAYER_LOGOUT") elseif major == "Dewdrop-2.0" then Dewdrop = instance end end AceLibrary:Register(AceDB, MAJOR_VERSION, MINOR_VERSION, activate, nil, external) AceDB = AceLibrary(MAJOR_VERSION)
gpl-3.0
protito/nyas-space-quest-qd
cocos2d/plugin/luabindings/auto/api/AgentManager.lua
146
1798
-------------------------------- -- @module AgentManager -- @parent_module plugin -------------------------------- -- -- @function [parent=#AgentManager] getSocialPlugin -- @param self -- @return plugin::ProtocolSocial#plugin::ProtocolSocial ret (return value: cc.plugin::ProtocolSocial) -------------------------------- -- -- @function [parent=#AgentManager] getAdsPlugin -- @param self -- @return plugin::ProtocolAds#plugin::ProtocolAds ret (return value: cc.plugin::ProtocolAds) -------------------------------- -- -- @function [parent=#AgentManager] purge -- @param self -------------------------------- -- -- @function [parent=#AgentManager] getUserPlugin -- @param self -- @return plugin::ProtocolUser#plugin::ProtocolUser ret (return value: cc.plugin::ProtocolUser) -------------------------------- -- -- @function [parent=#AgentManager] getIAPPlugin -- @param self -- @return plugin::ProtocolIAP#plugin::ProtocolIAP ret (return value: cc.plugin::ProtocolIAP) -------------------------------- -- -- @function [parent=#AgentManager] getSharePlugin -- @param self -- @return plugin::ProtocolShare#plugin::ProtocolShare ret (return value: cc.plugin::ProtocolShare) -------------------------------- -- -- @function [parent=#AgentManager] getAnalyticsPlugin -- @param self -- @return plugin::ProtocolAnalytics#plugin::ProtocolAnalytics ret (return value: cc.plugin::ProtocolAnalytics) -------------------------------- -- -- @function [parent=#AgentManager] destroyInstance -- @param self -------------------------------- -- -- @function [parent=#AgentManager] getInstance -- @param self -- @return plugin::AgentManager#plugin::AgentManager ret (return value: cc.plugin::AgentManager) return nil
apache-2.0
alfred-bot/phmbot
plugins/vote.lua
615
2128
do local _file_votes = './data/votes.lua' function read_file_votes () local f = io.open(_file_votes, "r+") if f == nil then print ('Created voting file '.._file_votes) serialize_to_file({}, _file_votes) else print ('Values loaded: '.._file_votes) f:close() end return loadfile (_file_votes)() end function clear_votes (chat) local _votes = read_file_votes () _votes [chat] = {} serialize_to_file(_votes, _file_votes) end function votes_result (chat) local _votes = read_file_votes () local results = {} local result_string = "" if _votes [chat] == nil then _votes[chat] = {} end for user,vote in pairs (_votes[chat]) do if (results [vote] == nil) then results [vote] = user else results [vote] = results [vote] .. ", " .. user end end for vote,users in pairs (results) do result_string = result_string .. vote .. " : " .. users .. "\n" end return result_string end function save_vote(chat, user, vote) local _votes = read_file_votes () if _votes[chat] == nil then _votes[chat] = {} end _votes[chat][user] = vote serialize_to_file(_votes, _file_votes) end function run(msg, matches) if (matches[1] == "ing") then if (matches [2] == "reset") then clear_votes (tostring(msg.to.id)) return "Voting statistics reset.." elseif (matches [2] == "stats") then local votes_result = votes_result (tostring(msg.to.id)) if (votes_result == "") then votes_result = "[No votes registered]\n" end return "Voting statistics :\n" .. votes_result end else save_vote(tostring(msg.to.id), msg.from.print_name, tostring(tonumber(matches[2]))) return "Vote registered : " .. msg.from.print_name .. " " .. tostring(tonumber(matches [2])) end end return { description = "Plugin for voting in groups.", usage = { "!voting reset: Reset all the votes.", "!vote [number]: Cast the vote.", "!voting stats: Shows the statistics of voting." }, patterns = { "^!vot(ing) (reset)", "^!vot(ing) (stats)", "^!vot(e) ([0-9]+)$" }, run = run } end
gpl-2.0
Flexibity/luci
libs/web/luasrc/http/protocol/date.lua
88
2760
--[[ HTTP protocol implementation for LuCI - date handling (c) 2008 Freifunk Leipzig / Jo-Philipp Wich <xm@leipzig.freifunk.net> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 $Id$ ]]-- --- LuCI http protocol implementation - date helper class. -- This class contains functions to parse, compare and format http dates. module("luci.http.protocol.date", package.seeall) require("luci.sys.zoneinfo") MONTHS = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } --- Return the time offset in seconds between the UTC and given time zone. -- @param tz Symbolic or numeric timezone specifier -- @return Time offset to UTC in seconds function tz_offset(tz) if type(tz) == "string" then -- check for a numeric identifier local s, v = tz:match("([%+%-])([0-9]+)") if s == '+' then s = 1 else s = -1 end if v then v = tonumber(v) end if s and v then return s * 60 * ( math.floor( v / 100 ) * 60 + ( v % 100 ) ) -- lookup symbolic tz elseif luci.sys.zoneinfo.OFFSET[tz:lower()] then return luci.sys.zoneinfo.OFFSET[tz:lower()] end end -- bad luck return 0 end --- Parse given HTTP date string and convert it to unix epoch time. -- @param data String containing the date -- @return Unix epoch time function to_unix(date) local wd, day, mon, yr, hr, min, sec, tz = date:match( "([A-Z][a-z][a-z]), ([0-9]+) " .. "([A-Z][a-z][a-z]) ([0-9]+) " .. "([0-9]+):([0-9]+):([0-9]+) " .. "([A-Z0-9%+%-]+)" ) if day and mon and yr and hr and min and sec then -- find month local month = 1 for i = 1, 12 do if MONTHS[i] == mon then month = i break end end -- convert to epoch time return tz_offset(tz) + os.time( { year = yr, month = month, day = day, hour = hr, min = min, sec = sec } ) end return 0 end --- Convert the given unix epoch time to valid HTTP date string. -- @param time Unix epoch time -- @return String containing the formatted date function to_http(time) return os.date( "%a, %d %b %Y %H:%M:%S GMT", time ) end --- Compare two dates which can either be unix epoch times or HTTP date strings. -- @param d1 The first date or epoch time to compare -- @param d2 The first date or epoch time to compare -- @return -1 - if d1 is lower then d2 -- @return 0 - if both dates are equal -- @return 1 - if d1 is higher then d2 function compare(d1, d2) if d1:match("[^0-9]") then d1 = to_unix(d1) end if d2:match("[^0-9]") then d2 = to_unix(d2) end if d1 == d2 then return 0 elseif d1 < d2 then return -1 else return 1 end end
apache-2.0
Oliveryo/Interface
AddOns/Atlas/Locale/Atlas-enUS.lua
1
128260
--[[ Atlas, a World of Warcraft instance map browser Copyright 2005, 2006 Dan Gilbert Email me at loglow@gmail.com This file is part of Atlas. Atlas 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. Atlas 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 Atlas; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --]] --[[ -- Atlas Data (English) -- Compiled by Dan Gilbert -- loglow@gmail.com -- Last Update: 11/19/2006 -- additions: Niflheim at dragonblight --]] AtlasSortIgnore = {"the (.+)"}; ATLAS_TITLE = "Atlas"; ATLAS_SUBTITLE = "Instance Map Browser"; ATLAS_DESC = "Atlas is an instance map browser."; ATLAS_OPTIONS_BUTTON = "Options"; BINDING_HEADER_ATLAS_TITLE = "Atlas Bindings"; BINDING_NAME_ATLAS_TOGGLE = "Toggle Atlas"; BINDING_NAME_ATLAS_OPTIONS = "Toggle Options"; ATLAS_SLASH = "/atlas"; ATLAS_SLASH_OPTIONS = "options"; ATLAS_STRING_LOCATION = "Location"; ATLAS_STRING_LEVELRANGE = "Level Range"; ATLAS_STRING_PLAYERLIMIT = "Player Limit"; ATLAS_STRING_SELECT_CAT = "Select Category"; ATLAS_STRING_SELECT_MAP = "Select Map"; ATLAS_BUTTON_TOOLTIP = "Atlas"; ATLAS_BUTTON_TOOLTIP2 = "Left-click to open Atlas."; ATLAS_BUTTON_TOOLTIP3 = "Right-click and drag to move this button."; ATLAS_OPTIONS_TITLE = "Atlas Options"; ATLAS_OPTIONS_SHOWBUT = "Show Button on Minimap"; ATLAS_OPTIONS_AUTOSEL = "Auto-Select Instance Map"; ATLAS_OPTIONS_BUTPOS = "Button Position"; ATLAS_OPTIONS_TRANS = "Transparency"; ATLAS_OPTIONS_DONE = "Done"; ATLAS_OPTIONS_REPMAP = "Replace the World Map"; ATLAS_OPTIONS_RCLICK = "Right-Click for World Map"; ATLAS_OPTIONS_SHOWMAPNAME = "Show map name"; ATLAS_OPTIONS_RESETPOS = "Reset Position"; ATLAS_OPTIONS_ACRONYMS = "Display Acronyms"; ATLAS_OPTIONS_SCALE = "Scale"; ATLAS_OPTIONS_BUTRAD = "Button Radius"; ATLAS_OPTIONS_CLAMPED = "Clamp window to screen" ATLAS_HINT = "Hint: Left-click to open Atlas."; ATLAS_HELP = {"About Atlas\n===========\n\nAtlas is a user interface addon for World of Warcraft that provides a number of additional maps as well as an in-game map browser. Typing the command '/atlas' or clicking the mini-map icon will open the Atlas window. The options panel allows you to disable the icon, toggle the Auto Select feature, toggle the Replace World Map feature, toggle the Right-Click feature, change the icon's position, or adjust the transparency of the main window. If the Auto Select feature is enabled, Atlas will automatically open to the map of the instance you're in. If the Replace World Map feature is enabled, Atlas will open instead of the world map when you're in an instance. If the Right-Click feature is enabled, you can Right-Click on Atlas to open the World Map. You can move Atlas around by left-clicking and dragging. Use the small padlock icon in the upper-right corner to lock the window in place."}; ATLAS_LOCALE = { menu = "Atlas", tooltip = "Atlas", button = "Atlas" }; AtlasZoneSubstitutions = { ["The Temple of Atal'Hakkar"] = "The Sunken Temple"; ["Ahn'Qiraj"] = "The Temple of Ahn'Qiraj"; ["Ruins of Ahn'Qiraj"] = "The Ruins of Ahn'Qiraj"; }; local BLUE = "|cff6666ff"; local GREY = "|cff999999"; local GREN = "|cff66cc33"; local _RED = "|cffcc6666"; local ORNG = "|cffcc9933"; local PURP = "|cff9900ff"; local INDENT = " "; --Keeps track of the different categories of maps Atlas_MapTypes = { "Eastern Kingdoms Instances", "Kalimdor Instances", "Battleground Maps", "Flight Path Maps", "Dungeon Locations", "Raid Encounters", "Leveling Guide 1-20", "Leveling Guide 20-30", "Leveling Guide 30-40", "Leveling Guide 40-45", "Leveling Guide 45-50", "Leveling Guide 50-55", "Leveling Guide 55-60", }; AtlasKalimdor = { RagefireChasm = { ZoneName = "Ragefire Chasm"; Acronym = "RFC"; Location = "Orgrimmar"; BLUE.."A) Entrance"; GREY.."1) Maur Grimtotem"; GREY.."2) Taragaman the Hungerer"; GREY.."3) Jergosh the Invoker"; GREY.."4) Bazzalan"; }; WailingCaverns = { ZoneName = "Wailing Caverns"; Acronym = "WC"; Location = "The Barrens"; BLUE.."A) Entrance"; GREY.."1) Disciple of Naralex"; GREY.."2) Lord Cobrahn"; GREY.."3) Lady Anacondra"; GREY.."4) Kresh"; GREY.."5) Lord Pythas"; GREY.."6) Skum"; GREY.."7) Lord Serpentis (Upper)"; GREY.."8) Verdan the Everliving (Upper)"; GREY.."9) Mutanus the Devourer"; GREY..INDENT.."Naralex"; GREY.."10) Deviate Faerie Dragon (Rare)"; }; BlackfathomDeeps = { ZoneName = "Blackfathom Deeps"; Acronym = "BFD"; Location = "Ashenvale"; BLUE.."A) Entrance"; GREY.."1) Ghamoo-ra"; GREY.."2) Lorgalis Manuscript"; GREY.."3) Lady Sarevess"; GREY.."4) Argent Guard Thaelrid"; GREY.."5) Gelihast"; GREY.."6) Lorgus Jett (Varies)"; GREY.."7) Baron Aquanis"; GREY..INDENT.."Fathom Core"; GREY.."8) Twilight Lord Kelris"; GREY.."9) Old Serra'kis"; GREY.."10) Aku'mai"; }; RazorfenKraul = { ZoneName = "Razorfen Kraul"; Acronym = "RFK"; Location = "The Barrens"; BLUE.."A) Entrance"; GREY.."1) Roogug"; GREY.."2) Aggem Thorncurse"; GREY.."3) Death Speaker Jargba"; GREY.."4) Overlord Ramtusk"; GREY.."5) Agathelos the Raging"; GREY.."6) Blind Hunter (Rare)"; GREY.."7) Charlga Razorflank"; GREY.."8) Willix the Importer"; GREY..INDENT.."Heralath Fallowbrook"; GREY.."9) Earthcaller Halmgar (Rare)"; }; RazorfenDowns = { ZoneName = "Razorfen Downs"; Acronym = "RFD"; Location = "The Barrens"; BLUE.."A) Entrance"; GREY.."1) Tuten'kash"; GREY.."2) Henry Stern"; GREY..INDENT.."Belnistrasz"; GREY.."3) Mordresh Fire Eye"; GREY.."4) Glutton"; GREY.."5) Ragglesnout (Rare)"; GREY.."6) Amnennar the Coldbringer"; }; ZulFarrak = { ZoneName = "Zul'Farrak"; Acronym = "ZF"; Location = "Tanaris"; BLUE.."A) Entrance"; GREY.."1) Antu'sul"; GREY.."2) Theka the Martyr"; GREY.."3) Witch Doctor Zum'rah"; GREY..INDENT.."Zul'Farrak Dead Hero"; GREY.."4) Nekrum Gutchewer"; GREY..INDENT.."Shadowpriest Sezz'ziz"; GREY.."5) Sergeant Bly"; GREY.."6) Hydromancer Velratha"; GREY..INDENT.."Gahz'rilla"; GREY..INDENT.."Dustwraith (Rare)"; GREY.."7) Chief Ukorz Sandscalp"; GREY..INDENT.."Ruuzlu"; GREY.."8) Zerillis (Rare, Wanders)"; GREY.."9) Sandarr Dunereaver (Rare)"; }; Maraudon = { ZoneName = "Maraudon"; Acronym = "Mara"; Location = "Desolace"; BLUE.."A) Entrance (Orange)"; BLUE.."B) Entrance (Purple)"; BLUE.."C) Entrance (Portal)"; GREY.."1) Veng (The Fifth Khan)"; GREY.."2) Noxxion"; GREY.."3) Razorlash"; GREY.."4) Maraudos (The Fourth Khan)"; GREY.."5) Lord Vyletongue"; GREY.."6) Meshlok the Harvester (Rare)"; GREY.."7) Celebras the Cursed"; GREY.."8) Landslide"; GREY.."9) Tinkerer Gizlock"; GREY.."10) Rotgrip"; GREY.."11) Princess Theradras"; }; DireMaulEast = { ZoneName = "Dire Maul (East)"; Acronym = "DM"; Location = "Feralas"; BLUE.."A) Entrance"; BLUE.."B) Entrance"; BLUE.."C) Entrance"; BLUE.."D) Exit"; GREY.."1) Pusillin Chase Begins"; GREY.."2) Pusillin Chase Ends"; GREY.."3) Zevrim Thornhoof"; GREY..INDENT.."Hydrospawn"; GREY..INDENT.."Lethtendris"; GREY.."4) Old Ironbark"; GREY.."5) Alzzin the Wildshaper"; GREY..INDENT.."Isalien"; }; DireMaulNorth = { ZoneName = "Dire Maul (North)"; Acronym = "DM"; Location = "Feralas"; BLUE.."A) Entrance"; GREY.."1) Guard Mol'dar"; GREY.."2) Stomper Kreeg"; GREY.."3) Guard Fengus"; GREY.."4) Knot Thimblejack"; GREY..INDENT.."Guard Slip'kik"; GREY.."5) Captain Kromcrush"; GREY.."6) King Gordok"; GREY.."7) Dire Maul (West)"; GREN.."1') Library"; }; DireMaulWest = { ZoneName = "Dire Maul (West)"; Acronym = "DM"; Location = "Feralas"; BLUE.."A) Entrance"; BLUE.."B) Pylons"; GREY.."1) Shen'dralar Ancient"; GREY.."2) Tendris Warpwood"; GREY.."3) Illyanna Ravenoak"; GREY.."4) Magister Kalendris"; GREY.."5) Tsu'Zee (Rare)"; GREY.."6) Immol'thar"; GREY..INDENT.."Lord Hel'nurath"; GREY.."7) Prince Tortheldrin"; GREY.."8) Dire Maul (North)"; GREN.."1') Library"; }; OnyxiasLair = { ZoneName = "Onyxia's Lair"; Acronym = "Ony"; Location = "Dustwallow Marsh"; BLUE.."A) Entrance"; GREY.."1) Onyxian Warders"; GREY.."2) Whelp Eggs"; GREY.."3) Onyxia"; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ORNG.."Damage: Fire"; }; TheTempleofAhnQiraj = { ZoneName = "The Temple of Ahn'Qiraj"; Acronym = "AQ40"; Location = "Silithus"; BLUE.."A) Entrance"; GREY.."1) The Prophet Skeram (Outside)"; GREY.."2) Vem & Co (Optional)"; GREY.."3) Battleguard Sartura"; GREY.."4) Fankriss the Unyielding"; GREY.."5) Viscidus (Optional)"; GREY.."6) Princess Huhuran"; GREY.."7) Twin Emperors"; GREY.."8) Ouro (Optional)"; GREY.."9) Eye of C'Thun / C'Thun"; GREN.."1') Andorgos"; GREN..INDENT.."Vethsera"; GREN..INDENT.."Kandrostrasz"; GREN.."2') Arygos"; GREN..INDENT.."Caelestrasz"; GREN..INDENT.."Merithra of the Dream"; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ORNG.."Damage: Nature"; }; TheRuinsofAhnQiraj = { ZoneName = "The Ruins of Ahn'Qiraj"; Acronym = "AQ20"; Location = "Silithus"; BLUE.."A) Entrance"; GREY.."1) Kurinnaxx"; GREY..INDENT.."Lieutenant General Andorov"; GREY..INDENT.."Four Kaldorei Elites"; GREY.."2) General Rajaxx"; GREY..INDENT.."Captain Qeez"; GREY..INDENT.."Captain Tuubid"; GREY..INDENT.."Captain Drenn"; GREY..INDENT.."Captain Xurrem"; GREY..INDENT.."Major Yeggeth"; GREY..INDENT.."Major Pakkon"; GREY..INDENT.."Colonel Zerran"; GREY.."3) Moam (Optional)"; GREY.."4) Buru the Gorger (Optional)"; GREY.."5) Ayamiss the Hunter (Optional)"; GREY.."6) Ossirian the Unscarred"; GREN.."1') Safe Room"; ""; ""; ""; ""; ""; ""; ""; ""; ""; ORNG.."Damage: Nature"; }; }; AtlasEK = { BlackrockDepths = { ZoneName = "Blackrock Depths"; Acronym = "BRD"; Location = "Blackrock Mountain"; BLUE.."A) Entrance"; GREY.."1) Lord Roccor"; GREY.."2) Kharan Mighthammer"; GREY.."3) Commander Gor'shak"; GREY.."4) Marshal Windsor"; GREY.."5) High Interrogator Gerstahn"; GREY.."6) Ring of Law, Theldren"; GREY.."7) Mon. of Franclorn Forgewright"; GREY..INDENT.."Pyromancer Loregrain"; GREY.."8) The Vault"; GREY.."9) Fineous Darkvire"; GREY.."10) The Black Anvil"; GREY..INDENT.."Lord Incendius"; GREY.."11) Bael'Gar"; GREY.."12) Shadowforge Lock"; GREY.."13) General Angerforge"; GREY.."14) Golem Lord Argelmach"; GREY.."15) The Grim Guzzler"; GREY.."16) Ambassador Flamelash"; GREY.."17) Panzor the Invincible (Rare)"; GREY.."18) Summoner's Tomb"; GREY.."19) The Lyceum"; GREY.."20) Magmus"; GREY.."21) Emperor Dagran Thaurissan"; GREY..INDENT.."Princess Moira Bronzebeard"; GREY.."22) The Black Forge"; GREY.."23) Molten Core"; }; BlackrockSpireLower = { ZoneName = "Blackrock Spire (Lower)"; Acronym = "LBRS"; Location = "Blackrock Mountain"; BLUE.."A) Entrance"; GREY.."1) Warosh"; GREY.."2) Roughshod Pike"; GREY.."3) Highlord Omokk"; GREY..INDENT.."Spirestone Battle Lord (Rare)"; GREY.."4) Shadow Hunter Vosh'gajin"; GREY..INDENT.."Fifth Mosh'aru Tablet"; GREY.."5) War Master Voone"; GREY..INDENT.."Sixth Mosh'aru Tablet"; GREY..INDENT.."Mor Grayhoof"; GREY.."6) Mother Smolderweb"; GREY.."7) Crystal Fang (Rare)"; GREY.."8) Urok Doomhowl"; GREY.."9) Quartermaster Zigris"; GREY.."10) Gizrul the Slavener"; GREY..INDENT.."Halycon"; GREY.."11) Overlord Wyrmthalak"; GREY.."12) Bannok Grimaxe (Rare)"; GREY.."13) Spirestone Butcher (Rare)"; }; BlackrockSpireUpper = { ZoneName = "Blackrock Spire (Upper)"; Acronym = "UBRS"; Location = "Blackrock Mountain"; BLUE.."A) Entrance"; GREY.."1) Pyroguard Emberseer"; GREY.."2) Solakar Flamewreath"; GREY..INDENT.."Father Flame"; GREY.."3) Jed Runewatcher (Rare)"; GREY.."4) Goraluk Anvilcrack"; GREY.."5) Warchief Rend Blackhand"; GREY..INDENT.."Gyth"; GREY.."6) Awbee"; GREY.."7) The Beast"; GREY..INDENT.."Lord Valthalak"; GREY.."8) General Drakkisath"; GREY..INDENT.."Doomrigger's Clasp"; GREY.."9) Blackwing Lair"; }; BlackwingLair = { ZoneName = "Blackwing Lair"; Acronym = "BWL"; Location = "Blackrock Spire"; BLUE.."A) Entrance"; BLUE.."B) Connects"; BLUE.."C) Connects"; GREY.."1) Razorgore the Untamed"; GREY.."2) Vaelastrasz the Corrupt"; GREY.."3) Broodlord Lashlayer"; GREY.."4) Firemaw"; GREY.."5) Ebonroc"; GREY.."6) Flamegor"; GREY.."7) Chromaggus"; GREY.."8) Nefarian"; GREY.."9) Master Elemental Shaper Krixix"; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ORNG.."Damage: Fire"; }; Gnomeregan = { ZoneName = "Gnomeregan"; Location = "Dun Morogh"; BLUE.."A) Entrance (Front)"; BLUE.."B) Entrance (Back)"; GREY.."1) Viscous Fallout (Lower)"; GREY.."2) Grubbis"; GREY.."3) Matrix Punchograph 3005-B"; GREY.."4) Clean Zone"; GREY.."5) Electrocutioner 6000"; GREY..INDENT.."Matrix Punchograph 3005-C"; GREY.."6) Mekgineer Thermaplugg"; GREY.."7) Dark Iron Ambassador (Rare)"; GREY.."8) Crowd Pummeler 9-60"; GREY..INDENT.."Matrix Punchograph 3005-D"; }; MoltenCore = { ZoneName = "Molten Core"; Acronym = "MC"; Location = "Blackrock Depths"; BLUE.."A) Entrance"; GREY.."1) Lucifron"; GREY.."2) Magmadar"; GREY.."3) Gehennas"; GREY.."4) Garr"; GREY.."5) Shazzrah"; GREY.."6) Baron Geddon"; GREY.."7) Golemagg the Incinerator"; GREY.."8) Sulfuron Harbinger"; GREY.."9) Majordomo Executus"; GREY.."10) Ragnaros"; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ORNG.."Damage: Fire"; }; ScarletMonastery = { ZoneName = "Scarlet Monastery"; Acronym = "SM"; Location = "Tirisfal Glades"; BLUE.."A) Entrance (Library)"; BLUE.."B) Entrance (Armory)"; BLUE.."C) Entrance (Cathedral)"; BLUE.."D) Entrance (Graveyard)"; GREY.."1) Houndmaster Loksey"; GREY.."2) Arcanist Doan"; GREY.."3) Herod"; GREY.."4) High Inquisitor Fairbanks"; GREY.."5) Scarlet Commander Mograine"; GREY..INDENT.."High Inquisitor Whitemane"; GREY.."6) Ironspine (Rare)"; GREY.."7) Azshir the Sleepless (Rare)"; GREY.."8) Fallen Champion (Rare)"; GREY.."9) Bloodmage Thalnos"; }; Scholomance = { ZoneName = "Scholomance"; Acronym = "Scholo"; Location = "Western Plaguelands"; BLUE.."A) Entrance"; BLUE.."B) Stairway"; BLUE.."C) Stairway"; GREY.."1) Blood Steward of Kirtonos"; GREY..INDENT.."Deed to Southshore"; GREY.."2) Kirtonos the Herald"; GREY.."3) Jandice Barov"; GREY.."4) Deed to Tarren Mill"; GREY.."5) Rattlegore (Lower)"; GREY..INDENT.."Death Knight Darkreaver"; GREY.."6) Marduk Blackpool"; GREY..INDENT.."Vectus"; GREY.."7) Ras Frostwhisper"; GREY..INDENT.."Deed to Brill"; GREY..INDENT.."Kormok"; GREY.."8) Instructor Malicia"; GREY.."9) Doctor Theolen Krastinov"; GREY.."10) Lorekeeper Polkelt"; GREY.."11) The Ravenian"; GREY.."12) Lord Alexei Barov"; GREY..INDENT.."Deed to Caer Darrow"; GREY.."13) Lady Illucia Barov"; GREY.."14) Darkmaster Gandling"; GREN.."1') Torch Lever"; GREN.."2') Secret Chest"; GREN.."3') Alchemy Lab"; }; ShadowfangKeep = { ZoneName = "Shadowfang Keep"; Acronym = "SFK"; Location = "Silverpine Forest"; BLUE.."A) Entrance"; BLUE.."B) Walkway"; BLUE.."C) Walkway"; BLUE..INDENT.."Deathsworn Captain (Rare)"; GREY.."1) Deathstalker Adamant"; GREY..INDENT.."Sorcerer Ashcrombe"; GREY..INDENT.."Rethilgore"; GREY.."2) Razorclaw the Butcher"; GREY.."3) Baron Silverlaine"; GREY.."4) Commander Springvale"; GREY.."5) Odo the Blindwatcher"; GREY.."6) Fenrus the Devourer"; GREY.."7) Wolf Master Nandos"; GREY.."8) Archmage Arugal"; }; Stratholme = { ZoneName = "Stratholme"; Acronym = "Strat"; Location = "Eastern Plaguelands"; BLUE.."A) Entrance (Front)"; BLUE.."B) Entrance (Side)"; GREY.."1) Skul (Rare)"; GREY..INDENT.."Stratholme Courier"; GREY..INDENT.."Fras Siabi"; GREY.."2) Hearthsinger Forresten (Varies)"; GREY.."3) The Unforgiven"; GREY.."4) Timmy the Cruel"; GREY.."5) Cannon Master Willey"; GREY.."6) Archivist Galford"; GREY.."7) Balnazzar"; GREY..INDENT.."Sothos"; GREY..INDENT.."Jarien"; GREY.."8) Aurius"; GREY.."9) Stonespine (Rare)"; GREY.."10) Baroness Anastari"; GREY.."11) Nerub'enkan"; GREY.."12) Maleki the Pallid"; GREY.."13) Magistrate Barthilas (Varies)"; GREY.."14) Ramstein the Gorger"; GREY.."15) Baron Rivendare"; GREN.."1') Crusaders' Square Postbox"; GREN.."2') Market Row Postbox"; GREN.."3') Festival Lane Postbox"; GREN.."4') Elders' Square Postbox"; GREN.."5') King's Square Postbox"; GREN.."6') Fras Siabi's Postbox"; }; TheDeadmines = { ZoneName = "The Deadmines"; Acronym = "VC"; Location = "Westfall"; BLUE.."A) Entrance"; BLUE.."B) Exit"; GREY.."1) Rhahk'Zor"; GREY.."2) Miner Johnson (Rare)"; GREY.."3) Sneed"; GREY.."4) Gilnid"; GREY.."5) Defias Gunpowder"; GREY.."6) Captain Greenskin"; GREY..INDENT.."Edwin VanCleef"; GREY..INDENT.."Mr. Smite"; GREY..INDENT.."Cookie"; }; TheStockade = { ZoneName = "The Stockade"; Location = "Stormwind City"; BLUE.."A) Entrance"; GREY.."1) Targorr the Dread (Varies)"; GREY.."2) Kam Deepfury"; GREY.."3) Hamhock"; GREY.."4) Bazil Thredd"; GREY.."5) Dextren Ward"; GREY.."6) Bruegal Ironknuckle (Rare)"; }; TheSunkenTemple = { ZoneName = "The Sunken Temple"; Acronym = "ST"; Location = "Swamp of Sorrows"; BLUE.."A) Entrance"; BLUE.."B) Stairway"; BLUE.."C) Troll Minibosses (Upper)"; GREY.."1) Altar of Hakkar"; GREY..INDENT.."Atal'alarion"; GREY.."2) Dreamscythe"; GREY..INDENT.."Weaver"; GREY.."3) Avatar of Hakkar"; GREY.."4) Jammal'an the Prophet"; GREY..INDENT.."Ogom the Wretched"; GREY.."5) Morphaz"; GREY..INDENT.."Hazzas"; GREY.."6) Shade of Eranikus"; GREY..INDENT.."Essence Font"; GREN.."1'-6') Statue Activation Order"; }; Uldaman = { ZoneName = "Uldaman"; Acronym = "Ulda"; Location = "Badlands"; BLUE.."A) Entrance (Front)"; BLUE.."B) Entrance (Back)"; GREY.."1) Baelog"; GREY.."2) Remains of a Paladin"; GREY.."3) Revelosh"; GREY.."4) Ironaya"; GREY.."5) Obsidian Sentinel"; GREY.."6) Annora (Master Enchanter)"; GREY.."7) Ancient Stone Keeper"; GREY.."8) Galgann Firehammer"; GREY.."9) Grimlok"; GREY.."10) Archaedas (Lower)"; GREY.."11) The Discs of Norgannon"; GREY..INDENT.."Ancient Treasure (Lower)"; }; ZulGurub = { ZoneName = "Zul'Gurub"; Acronym = "ZG"; Location = "Stranglethorn Vale"; BLUE.."A) Entrance"; GREY.."1) High Priestess Jeklik (Bat)"; GREY.."2) High Priest Venoxis (Snake)"; GREY.."3) High Priestess Mar'li (Spider)"; GREY.."4) Bloodlord Mandokir (Raptor, Optional)"; GREY.."5) Edge of Madness (Optional)"; GREY..INDENT.."Gri'lek, of the Iron Blood"; GREY..INDENT.."Hazza'rah, the Dreamweaver"; GREY..INDENT.."Renataki, of the Thousand Blades"; GREY..INDENT.."Wushoolay, the Storm Witch"; GREY.."6) Gahz'ranka (Optional)"; GREY.."7) High Priest Thekal (Tiger)"; GREY.."8) High Priestess Arlokk (Panther)"; GREY.."9) Jin'do the Hexxer (Undead, Optional)"; GREY.."10) Hakkar"; GREN.."1') Muddy Churning Waters"; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ORNG.."Damage: Nature"; }; Naxxramas = { ZoneName = "Naxxramas"; Acronym = "Nax"; Location = "Stratholme"; BLUE.."Abomination Wing"; BLUE..INDENT.."1) Patchwerk"; BLUE..INDENT.."2) Grobbulus"; BLUE..INDENT.."3) Gluth"; BLUE..INDENT.."4) Thaddius"; ORNG.."Spider Wing"; ORNG..INDENT.."1) Anub'Rekhan"; ORNG..INDENT.."2) Grand Widow Faerlina"; ORNG..INDENT.."3) Maexxna"; _RED.."Deathknight Wing"; _RED..INDENT.."1) Instructor Razuvious"; _RED..INDENT.."2) Gothik the Harvester"; _RED..INDENT.."3) The Four Horsemen"; _RED..INDENT..INDENT.."Thane Korth'azz"; _RED..INDENT..INDENT.."Lady Blaumeux"; _RED..INDENT..INDENT.."Highlord Mograine"; _RED..INDENT..INDENT.."Sir Zeliek"; PURP.."Necro Wing"; PURP..INDENT.."1) Noth the Plaguebringer"; PURP..INDENT.."2) Heigan the Unclean"; PURP..INDENT.."3) Loatheb"; GREN.."Frostwyrm Lair"; GREN..INDENT.."1) Sapphiron"; GREN..INDENT.."2) Kel'Thuzad"; ""; ""; ORNG.."Damage: Frost"; }; }; AtlasBG = { AlteracValleyNorth = { ZoneName = "Alterac Valley (North)"; Location = "Alterac Mountains"; BLUE.."A) Entrance"; BLUE.."B) Dun Baldar (Alliance)"; _RED.."1) Stormpike Aid Station"; _RED.."2) Stormpike Graveyard"; _RED.."3) Stonehearth Graveyard"; _RED.."4) Snowfall Graveyard"; ORNG.."5) Dun Baldar North Bunker"; GREY..INDENT.."Wing Commander Mulverick (Horde)"; ORNG.."6) Dun Baldar South Bunker"; ORNG.."7) Icewing Bunker"; GREY..INDENT.."Wing Commander Guse (Horde)"; GREY..INDENT.."Commander Karl Philips (Alliance)"; ORNG.."8) Stonehearth Outpost (Balinda)"; ORNG.."9) Stonehearth Bunker"; GREY.."10) Irondeep Mine"; GREY.."11) Icewing Cavern"; GREY.."12) Steamsaw (Horde)"; GREY.."13) Wing Commander Jeztor (Horde)"; GREY.."14) Ivus the Forest Lord (Summon Zone)"; ""; ""; ""; ""; ""; _RED.."Red:"..BLUE.." Graveyards, Capturable Areas"; ORNG.."Orange:"..BLUE.." Bunkers, Towers, Destroyable Areas"; GREY.."White:"..BLUE.." Assault NPCs, Quest Areas"; }; AlteracValleySouth = { ZoneName = "Alterac Valley (South)"; Location = "Hillsbrad Foothills"; BLUE.."A) Entrance"; BLUE.."B) Frostwolf Keep (Horde)"; _RED.."1) Frostwolf Releif Hut"; _RED.."2) Frostwolf Graveyard"; _RED.."3) Iceblood Graveyard"; ORNG.."4) West Frostwolf Tower"; ORNG.."5) East Frostwolf Tower"; GREY..INDENT.."Wing Commander Ichman (Alliance)"; ORNG.."6) Tower Point"; GREY..INDENT.."Wing Commander Slidore (Alliance)"; GREY..INDENT.."Commander Louis Philips (Horde)"; ORNG.."7) Iceblood Tower"; ORNG.."8) Iceblood Garrison (Galvangar)"; GREY.."9) Wildpaw Cavern"; GREY.."10) Wolf Rider Commander"; GREY.."11) Wing Commander Vipore (Alliance)"; GREY.."12) Coldtooth Mine"; GREY.."13) Steamsaw (Alliance)"; GREY.."14) Lokholar the Ice Lord (Summon Zone)"; ""; ""; ""; ""; ""; _RED.."Red:"..BLUE.." Graveyards, Capturable Areas"; ORNG.."Orange:"..BLUE.." Bunkers, Towers, Destroyable Areas"; GREY.."White:"..BLUE.." Assault NPCs, Quest Areas"; }; ArathiBasin = { ZoneName = "Arathi Basin"; Location = "Arathi Highlands"; BLUE.."A) Trollbane Hall (Alliance)"; BLUE.."B) Defiler's Den (Horde)"; GREY.."1) Stables"; GREY.."2) Gold Mine"; GREY.."3) Smithy"; GREY.."4) Lumber Mill"; GREY.."5) Farm"; }; WarsongGulch = { ZoneName = "Warsong Gulch"; Location = "Ashenvale / The Barrens"; BLUE.."A) Silverwing Hold (Alliance)"; BLUE.."B) Warsong Lumber Mill (Horde)"; }; }; AtlasFP = { FPAllianceEast = { ZoneName = "Alliance (East)"; Location = "Eastern Kingdoms"; GREY.."1) Light's Hope Chapel, ".._RED.."Eastern Plaguelands"; GREY.."2) Chillwind Post, ".._RED.."Western Plaguelands"; GREY.."3) Aerie Peak, ".._RED.."The Hinterlands"; GREY.."4) Southshore, ".._RED.."Hillsbrad Foothills"; GREY.."5) Refuge Point, ".._RED.."Arathi Highlands"; GREY.."6) Menethil Harbor, ".._RED.."Wetlands"; GREY.."7) Ironforge, ".._RED.."Dun Morogh"; GREY.."8) Thelsamar, ".._RED.."Loch Modan"; GREY.."9) Thorium Point, ".._RED.."Searing Gorge"; GREY.."10) Morgan's Vigil, ".._RED.."Burning Steppes"; GREY.."11) Stormwind, ".._RED.."Elwyn Forest"; GREY.."12) Lakeshire, ".._RED.."Redridge Mountains"; GREY.."13) Sentinel Hill, ".._RED.."Westfall"; GREY.."14) Darkshire, ".._RED.."Duskwood"; GREY.."15) Netherguard Keep, ".._RED.."The Blasted Lands"; GREY.."16) Booty Bay, ".._RED.."Stranglethorn Vale"; }; FPAllianceWest = { ZoneName = "Alliance (West)"; Location = "Kalimdor"; GREY.."1) Rut'Theran Village, ".._RED.."Teldrassil"; GREY.."2) Shrine of Remulos, ".._RED.."Moonglade"; GREY.."3) Everlook, ".._RED.."Winterspring"; GREY.."4) Auberdine, ".._RED.."Darkshore"; GREY.."5) Talonbranch Glade, ".._RED.."Felwood"; GREY.."6) Stonetalon Peak, ".._RED.."Stonetalon Mountains"; GREY.."7) Astranaar, ".._RED.."Ashenvale Forest"; GREY.."8) Talrendis Point, ".._RED.."Azshara"; GREY.."9) Nijel's Point, ".._RED.."Desolace"; GREY.."10) Ratchet, ".._RED.."The Barrens"; GREY.."11) Theramore Isle, ".._RED.."Dustwallow Marsh"; GREY.."12) Feathermoon Stronghold, ".._RED.."Ferelas"; GREY.."13) Thalanaar, ".._RED.."Ferelas"; GREY.."14) Marshall's Refuge, ".._RED.."Un'Goro Crater"; GREY.."15) Cenarion Hold, ".._RED.."Silithus"; GREY.."16) Gadgetzan, ".._RED.."Tanaris Desert"; ""; GREN.."Green: Druid-only"; }; FPHordeEast = { ZoneName = "Horde (East)"; Location = "Eastern Kingdoms"; GREY.."1) Light's Hope Chapel, ".._RED.."Eastern Plaguelands"; GREY.."2) Undercity, ".._RED.."Tirisfal Glade"; GREY.."3) The Sepulcher, ".._RED.."Silverpine Forest"; GREY.."4) Tarren Mill, ".._RED.."Hillsbrad Foothills"; GREY.."5) Revantusk Village, ".._RED.."The Hinterlands"; GREY.."6) Hammerfall, ".._RED.."Arathi Highlands"; GREY.."7) Thorium Point, ".._RED.."Searing Gorge"; GREY.."8) Kargath, ".._RED.."Badlands"; GREY.."9) Flame Crest, ".._RED.."Burning Steppes"; GREY.."10) Stonard, ".._RED.."Swamp of Sorrows"; GREY.."11) Grom'Gol, ".._RED.."Stranglethorn Vale"; GREY.."12) Booty Bay, ".._RED.."Stranglethorn Vale"; }; FPHordeWest = { ZoneName = "Horde (West)"; Location = "Kalimdor"; GREY.."1) Shrine of Remulos, ".._RED.."Moonglade"; GREY.."2) Everlook, ".._RED.."Winterspring"; GREY.."3) Bloodvenom Post, ".._RED.."Felwood"; GREY.."4) Zoram'gar Outpost, ".._RED.."Ashenvale"; GREY.."5) Valormok, ".._RED.."Azshara"; GREY.."6) Splintertree Post, ".._RED.."Ashenvale"; GREY.."7) Orgrimmar, ".._RED.."Durotar"; GREY.."8) Sunrock Retreat, ".._RED.."Stonetalon Mountains"; GREY.."9) Crossroads, ".._RED.."The Barrens"; GREY.."10) Ratchet, ".._RED.."The Barrens"; GREY.."11) Shadowprey Village, ".._RED.."Desolace"; GREY.."12) Thunder Bluff, ".._RED.."Mulgore"; GREY.."13) Camp Taurajo, ".._RED.."The Barrens"; GREY.."14) Brackenwall Village, ".._RED.."Dustwallow Marsh"; GREY.."15) Camp Mojache, ".._RED.."Ferelas"; GREY.."16) Freewind Post, ".._RED.."Thousand Needles"; GREY.."17) Marshall's Refuge, ".._RED.."Un'Goro Crater"; GREY.."18) Cenarion Hold, ".._RED.."Silithus"; GREY.."19) Gadgetzan, ".._RED.."Tanaris Desert"; ""; GREN.."Green: Druid-only"; }; }; AtlasDL = { DLEast = { ZoneName = "Dungeon Locations (East)"; Location = "Eastern Kingdoms"; BLUE.."A) Alterac Valley, ".._RED.."Alterac / Hillsbrad"; BLUE.."B) Arathi Basin, ".._RED.."Arathi Highlands"; GREY.."1) Scarlet Monastery, ".._RED.."Tirisfal Glade"; GREY.."2) Stratholme, ".._RED.."Eastern Plaguelands"; GREY..INDENT.."Naxxramas, ".._RED.."Stratholme"; GREY.."3) Scholomance, ".._RED.."Western Plaguelands"; GREY.."4) Shadowfang Keep, ".._RED.."Silverpine Forest"; GREY.."5) Gnomeregan, ".._RED.."Dun Morogh"; GREY.."6) Uldaman, ".._RED.."Badlands"; GREY.."7) Blackwing Lair, ".._RED.."Blackrock Spire"; GREY..INDENT.."Blackrock Depths, ".._RED.."Blackrock Mountain"; GREY..INDENT.."Blackrock Spire, ".._RED.."Blackrock Mountain"; GREY..INDENT.."Molten Core, ".._RED.."Blackrock Depths"; GREY.."8) The Stockade, ".._RED.."Stormwind City"; GREY.."9) The Deadmines, ".._RED.."Westfall"; GREY.."10) Zul'Gurub, ".._RED.."Stranglethorn Vale"; GREY.."11) The Sunken Temple, ".._RED.."Swamp of Sorrows"; ""; ""; ""; ""; ""; ""; ""; ""; BLUE.."Blue:"..ORNG.." Battlegrounds"; GREY.."White:"..ORNG.." Instances"; }; DLWest = { ZoneName = "Dungeon Locations (West)"; Location = "Kalimdor"; BLUE.."A) Warsong Gulch, ".._RED.."The Barrens / Ashenvale"; GREY.."1) Blackfathom Deeps, ".._RED.."Ashenvale"; GREY.."2) Ragefire Chasm, ".._RED.."Orgrimmar"; GREY.."3) Wailing Caverns, ".._RED.."The Barrens"; GREY.."4) Maraudon, ".._RED.."Desolace"; GREY.."5) Dire Maul, ".._RED.."Feralas"; GREY.."6) Razorfen Kraul, ".._RED.."The Barrens"; GREY.."7) Razorfen Downs, ".._RED.."The Barrens"; GREY.."8) Onyxia's Lair, ".._RED.."Dustwallow Marsh"; GREY.."9) Zul'Farrak, ".._RED.."Tanaris"; GREY.."10) The Ruins of Ahn'Qiraj, ".._RED.."Silithus"; GREY..INDENT.."The Temple of Ahn'Qiraj, ".._RED.."Silithus"; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; ""; BLUE.."Blue:"..ORNG.." Battlegrounds"; GREY.."White:"..ORNG.." Instances"; }; }; AtlasRE = { Azuregos = { ZoneName = "Azuregos"; Location = "Azshara"; GREY.."1) Azuregos"; }; FourDragons = { ZoneName = "Dragons of Nightmare"; Location = "Various"; GREN..INDENT.."Lethon"; GREN..INDENT.."Emeriss"; GREN..INDENT.."Taerar"; GREN..INDENT.."Ysondre"; ""; GREY.."1) Duskwood"; GREY.."2) The Hinterlands"; GREY.."3) Feralas"; GREY.."4) Ashenvale"; }; Kazzak = { ZoneName = "Lord Kazzak"; Location = "Blasted Lands"; GREY.."1) Lord Kazzak"; GREY.."2) Nethergarde Keep"; }; }; AtlasLVL = { INTRO = { ZoneName = "Intro"; Location = "Azeroth"; _RED..INDENT..INDENT..INDENT.." Welcome To The Ingame"; _RED..INDENT..INDENT..INDENT.." Joana's Leveling Guide"; GREY.." "; GREY.." "; GREY.."Hello, I am Drbeefy"; GREY.."I play on the Feenix Emerald Dream Server"; BLUE.."I made this guide because I hated Alt Tabing"; BLUE.."Every time I did anything"; GREN.."Contact me in game".._RED.." Drbeefy"..GREN.." for any"; GREN.."Questions, Donations , Flaws"; GREN.."List of Bugged Quests or suggestions"; GREN.."Please notify my via in game mail"; ORNG.."I take no credit for the addon or guide itself"; ORNG.."Only putting the two together"; _RED..INDENT..INDENT..INDENT.."Coming Soon"; BLUE..INDENT..INDENT.."Possible Waypoints"; BLUE..INDENT..INDENT.."Emerald Dream Bugged quest Notes"; BLUE..INDENT..INDENT.."Removal of non existing quests"; _RED..INDENT..INDENT..INDENT.."Sponsored by the Tinydps fanclub"; }; a1 = { ZoneName = "1-5"; Location = "Durotar"; GREY.."2) Do Cutting Teeth"; GREY.."3) Accept Sarkoth, Do Sarkoth"; GREY.." Turn In, Accept Sarkoth pt.2"; GREY.."4) Turn in Sarkoth pt.2 and Cutting Teeth"; GREY.."5) Accept and do"; BLUE.." Sting of the Scorpid"; BLUE.." Vile Familiars"; BLUE.." Galgar's Cactus Apple Surprise"; BLUE.." Lazy Peons"; GREY.."6) Turn those quests in"; GREY.."7) Accept and do"; BLUE.." Burning Blade Medallion"; BLUE.." Thazz'ril's Pick"; GREN.." these are done in the cave at (44.56)"; GREY.."8) Hearth"; GREY.."9) Turn quests in"; GREY.."10) Accept"; BLUE.." Report to Sen'jin Village"; GREY.."11) Leave the Starting Zone"; _RED.." Next Guide"; }; a2 = { ZoneName = "5-7"; Location = "Durotar"; GREY.."12) Goto Sen'jen Village"; GREY.."13) On The Way Accept"; BLUE.." A Peon's Burden(52.68)"; BLUE.." Thwarting Kolkar Aggression(54.75)"; GREY.."14) Turn in Report to Sen'jin Village(55.74)"; GREY.."15) Accept"; BLUE.." A solvent Spirit"; BLUE.." Practical Prey"; BLUE.." Minshina's Skull"; BLUE.." Zalazane"; GREY.."16) Do NOT do A solvent Spirit yet."; GREY.."17) Grind your way to Razor Hill"; GREY.."18) Get to Level 6 before you get there"; GREY.."19) Accept"; BLUE.." Vanquish the Betrayers"; BLUE.." Encroachment"; BLUE.." Break a Few Eggs"; BLUE.." Dark Storms"; BLUE.." Carry Your Weight"; GREY.."20) Make Razor Hill your home"; GREY.."21) Get first aid."; _RED.." Next Guide"; }; a3 = { ZoneName = "7-9"; Location = "Durotar"; GREY.."22) Then Do"; BLUE.." Vanquish the Betrayers"; BLUE.." Carry Your Weight(57,55)"; GREY.."23) After killing Benedict(59.58) get his key,"; GREY.." Go Upstairs loot the chest grab the note"; GREY.."24) The Note Will Start"; BLUE.." The Admiral's Orders."; GREY.."25) Turn In"; BLUE.." Vanquish the Betrayers"; BLUE.." Carry Your Weight at Razor Hill"; GREY.."26) Then Do"; BLUE.." A solvent Spirit"; BLUE.." From The Wreckage(around 62.50)"; GREY.."27) Then Do"; BLUE.." First half of Encroachment(at 49.49)"; GREY.."28) If your not level 8 Grind then Turn in"; BLUE.." From The Wreckage"; GREY.."29) Run South and do and turn in"; BLUE.." Thwarting Kolkar Aggression(48,79)"; GREY.."30) Go to Echo Isles, Do These"; BLUE.."31) Break a Few Eggs"; BLUE.."32) Practical Prey"; BLUE.."33) Minshina's Skull(67.87)"; BLUE.."34) Zalazane(67,86)"; GREY.."35) Die on purpose to end up @ Sen'jin"; _RED.." Next Guide"; }; a4 = { ZoneName = "9-10"; Location = "Durotar"; GREY.."36) Turn In"; BLUE.." Practical Prey"; BLUE.." Minshina's Skull"; BLUE.." Zalazane"; GREN.." Hold Onto [Faintly Glowing Skull]"; GREY.."37) Hearth To Razor Hill, Turn In"; BLUE.." Break a Few Eggs"; GREY.."38) Then Do"; BLUE.." The Second half of Encroachment(42,38)"; GREY.."39) Accept"; BLUE.." Lost But Not Forgotten(43,30)"; GREY.."40) Grind on the way to Accept"; BLUE.." Winds in the Desert(46,22)"; GREY.."41) Then Do and turn in"; BLUE.." Winds in the Desert"; GREY.." Accept"; BLUE.." Securing the Lines"; GREY.."42) Grind to Level 10"; GREY.."43) Goto Razor Hill, Turn in"; BLUE.." Encroachment"; GREY.."51) Accept"; BLUE.." Need for a Cure(41,18)"; GREY.."52) Goto Org"; GREY.."54) Goto Trall's Chamber and turn in"; BLUE.." The Admiral's Orders"; _RED.." Next Guide"; }; a5 = { ZoneName = "10-11"; Location = "Durotar"; GREY.."55) Accept"; BLUE.." Hidden Enemies"; GREY.."56) Go into Cleft of Shadow, Accept"; BLUE.." Finding the Antidote(46.53)"; GREY.."57) Then Do"; BLUE.."58) Securing the Lines(53.23) turn in (46.22)"; GREY.."59) Then Do"; BLUE.."60) Finding the Antidote"; BLUE.." Lost But Not Forgotten"; GREY.."61) Then Do"; BLUE.."62) Dark Storms(41.26)"; GREY.."63) Then turn in"; BLUE.." Lost But Not Forgotten(43.30)"; BLUE.." Dark Storms(Razor Hill)"; GREY.."64) Accept"; BLUE.." Margoz"; GREY.."65) Turn in"; BLUE.." Margoz(56.20) then accept Skull Rock"; GREY.."66) Then Do"; BLUE.." Skull Rock"; BLUE.." Hidden Enemies(54.11)"; GREY.."67) Kill Gazz'uz and Accept"; GREN.." Use [Faintly Glowing Skull]"; BLUE.." Burning Shadows"; _RED.." Next Guide"; }; a6 = { ZoneName = "11-12"; Location = "Durotar"; GREY.."68) Turn in"; BLUE.." Skull Rock(56.20)"; BLUE.." Accept Neeru Fireblade"; GREY.."69) Go to Orgrimmar"; GREY.."70) Turn in"; BLUE.." Hidden Enemies(33.37)"; BLUE.." Accept Hidden Enemies"; GREY.."71) Go to Neeru Fireblade in Cleft of Shadows"; GREY.."72) Turn in"; BLUE.." Neeru Fireblade"; BLUE.." Burning Shadows"; BLUE.." Accept Ak'Zeloth"; BLUE.." Hidden Enemies"; GREY.."74) Goto Trall, Turn In"; BLUE.." Hidden Enemies"; GREY.."75) Leave Orgrimmar, Turn In"; BLUE.." Need for a Cure(41.18)"; GREY.."76) Hearth to Razor Hill"; GREY.."77) Build up first aid"; GREY.."78) Get new spells/abilities"; GREY.."79) Accept"; BLUE.." Conscript of the Horde(50.43)"; GREY.."80) Run west into the Barrens"; _RED.." Next Guide"; }; b1 = { ZoneName = "12-13"; Location = "Barrens"; GREY.."1) Turn in"; BLUE.." Conscript of the Horde"; BLUE.." Accept Crossroads Conscripton"; GREY.."2) Turn In"; BLUE.." Ak'Zeloth"; GREY.."3) Run to Crossroads"; GREY.."5) Turn in"; BLUE.." Crossroads Conscripton"; GREY.." Accept"; BLUE.." Plainstrider Menace"; BLUE.." The Forgotten Pools"; BLUE.." Raptor Thieves"; BLUE.." Wharfmaster Dizzywig"; BLUE.." Fungal Spores"; BLUE.." Disrupt the Attacks"; BLUE.." Supplies for the Crossroads"; BLUE.." Harpy Raiders(Top of watch tower)"; GREY.."6) Make XRs your home"; GREY.."7) Get FP"; GREY.."8) Then Do"; BLUE.." Disrupt the Attacks"; BLUE.." Plainstrider Menace"; BLUE.." Raptor Thieves(54.26)"; _RED.." Next Guide"; }; b2 = { ZoneName = "13-14"; Location = "Barrens"; GREY.."9) Turn In"; BLUE.." Disrupt the Attacks"; BLUE.." Accept The Disruption Ends"; GREY.."10) Then Do"; BLUE.." The Disruption Ends"; BLUE.." Supplies for the Crossroads(56.26)"; GREN.." If you find Chen's Empty Keg accept it"; GREY.."12) Once These are complete.."; BLUE.." Plainstrider Menace"; BLUE.." The Disruption Ends"; BLUE.." Supplies for the Crossroads"; GREY.."13) Go to Ratchet get the Flight Path"; GREY.." Accept"; BLUE.." Raptor Horns"; BLUE.." Samophlange"; BLUE.." Southsea Freebooters"; BLUE.." The Guns of Northwatch"; GREY.."14) Accept"; BLUE.." WANTED: Baron Longshore(Sign by the bank)"; GREY.."15) Turn in"; BLUE.." Wharfmaster Dizzywig(goblin on the docks)"; GREY.." Accept"; BLUE.." Miner's Fortune"; _RED.." Next Guide"; }; b3 = { ZoneName = "14-14"; Location = "Barrens"; GREY.."16) Then Do"; BLUE.." Southsea Freebooters"; BLUE.." WANTED: Baron Longshore(south of Ratchet)"; GREY.."17) Turn Those In, Accept next quests"; GREY.."18) Then Do"; BLUE.." The Missing Shipment(goblin at the docks)"; GREY.." Accept"; BLUE.." The Missing Shipment(part2)"; GREY.."19) Run back, Turn in"; BLUE.." The Missing Shipment(part2)"; GREY.." Accept"; BLUE.." Stolen Booty"; GREY.."20) Then Do"; BLUE.." Stolen Booty"; GREY.."21) Hearth to XRs"; GREY.."22) Turn In"; BLUE.." The Disruption Ends"; BLUE.." Supplies for the Crossroads"; GREY.." Accept New Quests"; GREY.."23) Turn In"; BLUE.." Plainstrider Menace"; GREY.." Accept"; BLUE.." The Zhevra"; GREY.."24) If you don't have buy 3-6 Slot bags"; _RED.." Next Guide"; }; b4 = { ZoneName = "14-15"; Location = "Barrens"; GREY.."25) Run west from XRs to the hut(45.28)"; GREY.."26) Accept"; BLUE.." Kolkar Leaders"; BLUE.." Centaur Bracers"; GREY.."27) Then Start Doing"; BLUE.."28) Kolkar Leaders(Barak is at 42.23)"; BLUE.." Centaur Bracers"; BLUE.." Raptor Thieves"; BLUE.." The Zhevra"; BLUE.." Fungal Spores"; BLUE.." The Forgotten Pools"; GREN.." All done north of you"; GREY.."29) Once Kolkar Leaders is done"; GREY.."30) Go Do"; BLUE.." Harpy Raiders(38.17)"; GREY.."31) Once Harpy Raiders is done"; GREY.." Grind into Stonetalon Mountains(34.28)"; _RED.." Next Guide"; }; c1 = { ZoneName = "15-16"; Location = "Stonetalon Mountains"; GREY.."1) Accept"; BLUE.." Goblin Invaders"; BLUE.." Avenge My Village(35,27)"; GREY.."2) Go Do and turn in"; BLUE.." Avenge My Village"; GREY.."3) Then do"; BLUE.." Kill Grundig Darkcloud(73.86)"; GREY.."5) Turn in"; BLUE.." Kill Grundig Darkcloud(35.27 in Barrens)"; GREY.."6) Go back to the Barrens"; _RED.." Next Guide"; }; d1 = { ZoneName = "16-17"; Location = "Barrens"; GREY.."1) Grind your way back to the hut(45.28)"; GREY.."2) Turn in"; BLUE.." Kolkar Leaders"; GREY.." Accept"; BLUE.." Verog the Dervish"; GREY.."3) Make sure you finish before you goto xroads"; BLUE.." Raptor Thieves"; BLUE.." The Zhevra"; BLUE.." Fungal Spores"; BLUE.." The Forgotten Pools"; GREY.."4) Run to XRs"; GREY.."5) Turn in quests, Accept New ones"; GREY.."6) Then do, Grinding on the way"; BLUE.." Apothecary Zamah(spirit rise cave in TB)"; GREY.."7) Grind your way down south and do"; BLUE.."8) Lost in Battle(49.50)"; GREY.."9) Accept and get FP at Camp Taurajo"; BLUE.." Tribes at War(44.59)"; GREY.."10) Once at TB, go to weapon master(40.62)"; GREY.." Train your weapon skill"; GREY.."11) Get new spells/abilities"; GREY.."12) Turn in"; BLUE.." Apothecary Zamah(Cave Spirit rise 29.29)"; _RED.." Next Guide"; }; d2 = { ZoneName = "17-17"; Location = "Barrens"; GREY.."13) Go to first aid guy at spirit rise Train"; GREY.."14) Get FP in the tower DON'T fly back to XRs"; GREY.."15) Hearth back to XRs"; GREY.."16) Turn in"; BLUE.." Lost in Battle"; GREY.."17) Then go north west of XRs and do"; BLUE.."18) Prowlers of the Barrens(37.20)"; BLUE.."19) Harpy Lieutenants(38.14)"; GREY.."20) Then grind your way east and do"; BLUE.."21) Samophlange(52.11) do the whole chain"; GREY.."22) Then go east to Sludge Fen and do"; BLUE.."23) Ignition(56.8)"; BLUE.."24) The Escape"; GREY.."25) Then go north-east and do"; BLUE.."26) Miner's Fortune(61.5)"; GREY.."27) Then grind your way south to Ratchet"; GREY.."28) Turn in"; BLUE.." Stolen Booty"; BLUE.." Samophlange"; BLUE.." The Escape"; GREY.."29) Turn In"; BLUE.." Miner's Fortune"; _RED.." Next Guide"; }; d3 = { ZoneName = "17-18"; Location = "Barrens"; GREY.."30) Then go west of ratchet and do"; BLUE.."31) The Stagnant Oasis"; BLUE.." Verog the Dervish(54.43)"; GREY.."32) Then run to XRs"; GREY.."33) Turn in"; BLUE.." Prowlers of the Barrens"; BLUE.." Harpy Lieutenants and Accept new quests"; GREY.."34) Go west of XRs, Turn in"; BLUE.." Centaur Bracers"; BLUE.." Verog the Dervish"; GREY.."35) Grind your way north, Do"; BLUE.." Serena Bloodfeather(38.11)"; GREY.."36) Then go east, Grind on the way, then do"; BLUE.." Echeyakee(55.17)"; GREY.."37) Hearth to XRs."; GREY.."38) Turn in"; BLUE.." Echeyakee"; GREY.." Accept"; BLUE.." The Angry Scytheclaws"; GREY.."39) Turn in"; BLUE.." Serena Bloodfeather"; GREY.." Accept"; BLUE.." Letter to Jin'Zil"; BLUE.." Consumed by Hatred"; _RED.." Next Guide"; }; d4 = { ZoneName = "18-19"; Location = "Barrens"; GREY.."40) Go down south and do"; BLUE.."41) Altered Beings(55.42)"; BLUE.."42) The Angry Scytheclaws(51.46)"; BLUE.."43) Raptor Horns"; BLUE.."44) Stolen Silver(57.54)"; BLUE.."45) Tribes at War"; BLUE.."46) Consumed by Hatred(51.54)"; GREY.."47) Then grind your way to Camp T(45.60)"; GREY.."48) Accept"; BLUE.." Weapons of Choice"; GREY.."49) Go to gnoll in the cage"; GREY.."50) Turn in"; BLUE.." Tribes at War"; GREY.." Accept"; BLUE.." Blood Shards of Agamaggan"; BLUE.." Betrayal from Within"; GREY.."51) Turn in"; BLUE.." Blood Shards of Agamaggan"; GREY.."52) Turn in bloodshards for Spirit of the Wind"; GREY.."53) You should be a 3rd way to level 20"; GREY.."54) Wailing Caverns Instance!(46.36)"; GREN.."55) OPTIONAL: GRIND all the way to level 20"; GREN.."56) Grind the brisstlebacks just north of CT"; GREN.."57) Look out for the mob named Owatanka"; GREN.." Drops [Owatanka's Tailspike],starts Owatanka"; _RED.." Next Guide"; }; d5 = { ZoneName = "19-20"; Location = "Barrens"; GREY.."58) About a bar away from 20, run to XRs"; GREY.."59) Turn in"; BLUE.." Stolen Silver"; BLUE.." Consumed by Hatred"; BLUE.." Altered Beings"; BLUE.." The Angry Scytheclaws"; GREY.." Then Accept all new quests"; GREY.."60) Fly to Orgrimmar, get new spells/abilities"; GREY.."61) Accept"; BLUE.." The Ashenvale Hunt"; GREY.."62) Hearth back to XRs"; GREY.."63) Fly to Ratchet"; GREY.."64) Accept"; BLUE.." Ziz Fizziks"; GREY.."65) Turn in"; BLUE.." Raptor Horns"; GREY.." Accept"; BLUE.." Deepmoss Spider Eggs"; GREY.."66) Then Do"; BLUE.." The Guns of Northwatch(60.55)"; BLUE.."69) Free From the Hold(escort quest)"; GREY.."70) Turn in both quests at Ratchet"; GREY.."71) Hearth to XRs"; GREY.."72) Run into Stonetalon Mountains"; _RED.." Next Guide"; }; }; AtlasLV = { e1 = { ZoneName = "20-20"; Location = "Stonetalon Mountains"; GREY.."1) Run to Malaka'Jin"; GREY.."2) Accept"; BLUE.." Blood Feeders(71.95)"; GREY.."3) Turn in"; BLUE.." Letter to Jin'Zil(74.97)"; GREY.." Accept"; BLUE.." Jin'Zil's Forest Magic"; GREY.."4) Then Do"; BLUE.." Blood Feeders"; BLUE.." Deepmoss Spider Eggs(54.76)"; GREY.."5) Turn in"; BLUE.." Ziz Fizziks(60.63)"; GREY.." Accept"; BLUE.." Super Reaper 6000"; GREY.."6) Then Do"; BLUE.." Goblin Invaders"; BLUE.." Super Reaper 6000"; GREY.."7) Turn In"; BLUE.." Super Reaper 6000"; GREY.." Accept"; BLUE.." Further Instructions"; GREY.."8) Run to Sun Rock Retreat at 46.59"; GREY.."9) Get FP there"; _RED.." Next Guide"; }; e2 = { ZoneName = "20-21"; Location = "Stonetalon Mountains"; GREY.."10) Run up the little pathway, Accept"; BLUE.." Boulderslide Ravine"; GREY.."11) Then Do"; BLUE.." Boulderslide Ravine(61.92)"; GREY.."12) Turn in"; BLUE.." Blood Feeders(71.95)"; GREY.."13) Turn in"; BLUE.." Goblin Invaders(35.27 Barrens)"; GREY.." Accept"; BLUE.." Shredding Machines"; BLUE.." The Elder Crone"; GREY.."14) Hearth to XRs"; GREY.."16) Run north to Ashenvale"; GREY.." Stop along the way to turn in"; BLUE.." Report to Kadrak"; _RED.." Next Guide"; }; e3 = { ZoneName = "21-22"; Location = "Ashenvale"; GREY.."2) Run to Splintertree Post(73.65)"; GREY.."3) Turn in"; BLUE.." The Ashenvale Hunt"; GREY.."4) Get FP in Splintertree Post"; GREY.."5) Grind Mobs on your way to Zoram Strand"; GREY.."7) Get FP there"; GREY.."8) Then Do"; BLUE.."9) Naga at the Zoram Strand"; BLUE.."10) Vorsha the Lasher"; GREY.."11) Turn those quests in"; GREY.."12) Hearth back to XRs"; _RED.." Next Guide"; }; e4 = { ZoneName = "22-23"; Location = "Southern Barrens"; GREY.."1) Fly to CT"; GREY.."2) Turn in"; BLUE.." Jorn Skyseer"; GREY.." Accept"; BLUE.." Ishamuhale"; GREY.."3) Make CT your home"; GREY.."5) Run down and do in the order"; BLUE.."6) Egg Hunt"; BLUE.."7) Chen's Empty Keg"; BLUE.."8) Betrayal from Within, Weapons of Choice"; BLUE.."9) Gann's Reclamation then turn it in"; GREY.." Accept the next part"; GREY.."10) Hearth back to Camp Taurajo"; GREY.." Turn in quests and Accept"; BLUE.." Betrayal from Within(part2)"; GREY.."11) Fly to XR"; GREY.."12) Turn in"; BLUE.." Betrayal from Within(part2), Egg Hunt"; BLUE.."13) Do Ishamuhale(60.32)"; GREY.."14) Turn in"; BLUE.." Further Instructions"; GREY.." Accept"; BLUE.." Further Instructions(part2)"; GREY.."15) Turn in"; BLUE.." Deepmoss Spider Eggs, Chen's Empty Keg"; GREY.."17) Fly to Stonetalon Mountains"; _RED.." Next Guide"; }; e5 = { ZoneName = "23-24"; Location = "Stonetalon Mountains"; GREY.."1) Accept all quests at Sun Rock Retreat"; GREY.."2) And make it your home"; BLUE.."3) Turn in Boulderslide Ravine"; GREY.."4) Do"; BLUE.."5) Cycle of Rebirth"; BLUE.."6) Cenarius' Legacy"; BLUE.."7) Jin'Zil's Forest Magic"; GREY.."8) Turn in"; BLUE.." Cycle of Rebirth, Accept New Life"; GREY.."9) Turn in"; BLUE.." Cenarius' Legacy, Accept Ordanus"; GREY.."11) Turn in"; BLUE.." Further Instructions(part2)"; GREY.." Accept"; BLUE.." Gerenzo Wrenchwhistle"; GREY.."12) Go do"; BLUE.." Gerenzo Wrenchwhistle"; BLUE.." Shredding Machines"; GREY.."13) Then turn in"; BLUE.." Gerenzo Wrenchwhistle"; GREY.."14) Then do"; BLUE.." Arachnophobia(wanted poster)"; GREY.."15) Turn in"; BLUE.." Jin'Zil's Forest Magic"; GREY.."16) Turn in"; BLUE.." Shredding Machines"; _RED.." Next Guide"; }; e6 = { ZoneName = "24-25"; Location = "Stoneralon Mountains"; GREY.."17) Hearth back to Sun Rock Retreat"; GREY.."18) Turn in"; BLUE.." Arachnophobia"; GREY.."19) Then do"; BLUE.."20) New Life"; BLUE.."21) Elemental War"; BLUE.."22) Harpies Threaten"; GREY.."23) Turn them all in"; GREY.."24) Fly directly to CT"; _RED.." Next Guide"; }; e7 = { ZoneName = "25-25"; Location = "Southern Barrens"; GREY.."1) Turn in"; BLUE.." Ishamuhale"; GREY.." Accept"; BLUE.." Enraged Thunder Lizards"; GREY.."2) Make CT your home"; GREY.."3) Accept"; BLUE.." A New Ore Sample"; GREY.."4) Go down and do"; BLUE.."5) Enraged Thunder Lizards"; GREN.."6) Find the mob Washte Pawne"; GREN.." He drops Washte Pawne Feather"; GREY.." Accept"; BLUE.." Washte Pawne"; GREY.."7) Turn in"; BLUE.." Revenge of Gann"; GREY.." Accept the next part"; BLUE.."8) Revenge of Gann then turn it in"; GREY.."9) Go to the Great Lift"; GREY.."10) Turn in"; BLUE.." Calling in the Reserves"; GREY.."11) Accept"; BLUE.." Message to Freewind Post"; GREY.."12) Run to Freewind Post"; _RED.." Next Guide"; }; e8 = { ZoneName = "25-26"; Location = "Thousand Needles"; GREY.."1) Turn in"; BLUE.." Message to Freewind Post"; GREY.." Accept"; BLUE.." Pacify the Centaur"; BLUE.."2) Wanted - Arnak Grimtotem"; BLUE.." Alien Egg, Wind Rider"; GREY.."3) Get FP there"; GREY.."4) Go do (in the following order)"; BLUE.."5) Pacify the Centaur"; BLUE.."6) Test of Faith(the cave at 52.43)"; BLUE.."7) A New Ore Sample"; BLUE.."8) Alien Egg(spawn points52.56/45.63/41.60)"; GREY.."9) If your not level 26 or two bars away, Grind"; GREY.."10) Go to Freewind Post"; GREY.."11) Turn in"; BLUE.." Pacify the Centaur"; GREY.." Accept"; BLUE.." Grimtotem Spying"; GREY.."12) Turn in"; BLUE.." Alien Egg"; GREY.." Accept"; BLUE.." Serpent Wild"; GREY.."13) Hearth to Camp Taurajo"; _RED.." Next Guide"; }; e9 = { ZoneName = "26-26"; Location = "Thousand Needles"; GREY.."14) Turn in"; BLUE.." Enraged Thunder Lizards and Washte Pawne"; GREY.." Accept"; BLUE.." Cry of the Thunderhawk"; GREY.."15) Turn in"; BLUE.." A New Ore Sample"; GREY.."16) Go do"; BLUE.." Cry of the Thunderhawk then turn it in"; GREY.."17) Fly to Thunder Bluff, get new spells/abilities"; GREY.."18) Turn in"; BLUE.." Melor Sends Word"; GREY.." Accept"; BLUE.." steelsnap"; BLUE.." 19) The sacred Flame"; GREY.."20) Fly to Ashenvale"; _RED.." Next Guide"; }; f1 = { ZoneName = "26-27"; Location = "Ashenvale"; GREY.."1) Make Ashenvale your home"; GREY.."2) Do the following order"; GREY.."3) Accept all the quests,SKIP Warsong Supplies"; GREY.."4) Kill the first three mobs in Ashenvale hunt"; BLUE.."5) Sharptalon's Claw (Kill Sharptalon"; GREY.."6) Do"; BLUE.." Ashenvale Outrunners"; GREY.."7) Go west and do Torek's Assault(68.75)"; BLUE.."8) Stonetalon Standstill"; GREN.." Look for Tideress, starts The Befouled Element"; BLUE.."9) Kill Ursangous, Ursangous's Paw"; BLUE.."10) Kill Shadumbra Shadumbra's Head"; BLUE.."11) The sacred Flame"; GREN.." (dryads61.52, moonwell59.74)"; GREY.."12) Hearth to Splintertree, turn in all quests"; GREY.."13) Fly to Zoram Strand"; GREY.."14) Turn in"; BLUE.." Je'neu of the Earthen Ring"; BLUE.." Trouble in the Deeps"; GREY.."15) Do"; BLUE.." Between a Rock and a Thistlefur"; BLUE.." Troll Charm"; GREY.."16) Turn them in, hearth to Splintertree Post"; GREY.."17) If not level 27 grind till you are"; _RED.." Next Guide"; }; f2 = { ZoneName = "27-27"; Location = "Ashenvale"; GREY.."22) Accept"; BLUE.." Destroy the Legion"; GREY.."23) Go do"; BLUE.." Ordanus(61.52)"; BLUE.."24) Satyr Horns(80.52)"; BLUE.."25) Destroy the Legion"; GREN.." You should find an item [Diabolical Plans]"; GREN.." Starts Diabolical Plans while doing this quest"; GREY.."26) Run back to Splintertree,Turn in ALL quests"; GREY.."28) Fly to Stonetalon Mountains"; _RED.." Next Guide"; }; f3 = { ZoneName = "27-27"; Location = "Stonetalon Mountains"; GREY.."1) Turn in"; BLUE.." Ordanus"; GREY.."2) Make it your home"; GREY.."3) Accept"; BLUE.." Bloodfury Bloodline"; GREY.." Go kill Bloodfury Ripper(30.63) then hearth "; GREY.."4) Turn it in"; GREY.."5) Fly to Thunder Bluff"; GREY.."6) Turn in"; BLUE.." The sacred Flame"; GREY.." Accept"; BLUE.." The sacred Flame(part2)"; GREY.."7) Fly to Thousand Needles"; _RED.." Next Guide"; }; f4 = { ZoneName = "27-28"; Location = "Thousand Needles"; GREY.."1) Turn in"; BLUE.." The sacred Flame"; GREY.." Accept"; BLUE.." The sacred Flame(part3)"; BLUE.." A Different Approach"; GREY.."2) I do the following order"; BLUE.."3) The sacred Flame(44.37)"; GREY.."4) Go to Whitereach Post get quests there, do"; BLUE.."5) Sacred Fire"; BLUE.."6) Wind Rider"; BLUE.."7) Homeward Bound"; BLUE.."8) Steelsnap"; BLUE.."9) A Different Approach"; GREY.."10) Hearth to Sun Rock Retreat"; GREY.."11) Fly to TB"; GREY.."12) Turn in"; BLUE.." Steelsnap"; GREY.." Accept"; BLUE.." Frostmaw"; GREY.."13) Turn in"; BLUE.." Sacred Fire"; GREY.." Accept"; BLUE.." Arikara"; GREY.."14) Get new spells/abilities"; GREY.."15) Fly to 1K Needles. Make Freewind your home"; _RED.." Next Guide"; }; f5 = { ZoneName = "28-29"; Location = "Thousand Needles"; GREY.."16) Turn in"; BLUE.." The sacred Flame"; BLUE.." Wind Rider"; GREY.."17) Do"; BLUE.." Grimtotem Spying"; BLUE.."18) Arikara"; BLUE.."19) Wanted - Arnak Grimtotem"; BLUE.."20) Free at Last"; GREY.."21) Go to Whitereach Post, turn in"; BLUE.." Arikara"; BLUE.." A Different Approach"; GREY.." Accept"; BLUE.." A Dip in the Moonwell"; GREY.."22) Go do"; BLUE.." A Dip in the Moonwell(9.18)"; GREY.."23) Grind to level 29"; GREY.."24) Then do"; BLUE.." Hypercapacitor Gizmo"; BLUE.."25) Kill the Galak Messenger"; GREN.." He drops [Assassination Note]"; GREN.." Starts Assassination Plot Turn in for Easy XP"; GREY.." Turn in"; BLUE.." A Dip in the Moonwell"; GREY.." Accept"; BLUE.." Testing the Tonic"; _RED.." Next Guide"; }; f6 = { ZoneName = "29-29"; Location = "Thousand Needles"; GREY.."26) Then do"; BLUE.." Protect Kanati Greycloud"; GREY.."27) Hearth back to Freewind Post"; GREY.."28) Turn in ALL quests"; GREY.."30) Fly to Orgrimmar"; GREY.."31) Make Orgrimmar your home"; GREY.."32) Go to UC"; GREY.."33) Run to Tarren Mill(through the sewers)"; _RED.." Next Guide"; }; f7 = { ZoneName = "29-30"; Location = "Hillsbrad Foothills"; GREY.."1) Accept"; BLUE.." Time To Strike"; GREY.."2) Once at Tarren Mill, Turn in"; BLUE.."3) Time To Strike"; GREY.."4) Accept"; BLUE.." Helcular's Revenge"; GREY.."5) Accept"; BLUE.." Elixir of Pain"; GREY.."6) GET FLIGHT PATH THERE"; GREY.."7) Go start killing Yetis"; GREY.."8) Keep grinding away at Yetis until 30"; GREN.." OPTIONAL:"; GREN.." you could go do RFK instead of the grinding"; GREY.."10) Once 30,"; GREY.." Hearth to Org get new spells/abilities"; GREY.."11) Then go back to Hillsbrad"; GREY.."12) Turn in"; BLUE.." Helcular's Revenge"; GREY.." Accept the next part to it"; GREY.."13) Go back to the Yeti cave"; GREY.."14) Charge The Flame of Azel, Flame of Veraz"; GREY.."16) Go up into Alterac Mountains"; _RED.." Next Guide"; }; f8 = { ZoneName = "30-30"; Location = "Alterac Mountains"; GREY.."1) Do the following"; BLUE.."2) Elixir of Pain"; GREY.."3) Charge Flame of Uzel"; GREY.."4) Kill Frostmaw"; GREY.."5) Run to Southshore, use the rod into the grave"; GREY.."6) Run back to Tarren Mill"; GREY.."7) Turn in"; BLUE.." Elixir of Pain"; GREY.."8) Accept"; BLUE.." The Hammer May Fall"; GREY.."9) Run into Arathi Highlands"; _RED.." Next Guide"; }; f9 = { ZoneName = "30-30"; Location = "Arathi Highlands"; GREY.."1) Do"; BLUE.."2) The Hammer May Fall(34.45)"; GREY.."3) Then run to Hammerfall"; GREY.."4) Accept"; BLUE.." Hammerfall"; GREY.."5) Turn in"; BLUE.." Hammerfall"; GREY.." Accept"; BLUE.." Rising Spirits"; GREY.."6) Turn in"; BLUE.." The Hammer May Fall"; GREY.."7) Get FP there"; GREY.."8) Then do"; BLUE.." Rising Spirits, turn it in"; GREY.." Accept"; BLUE.." Rising Spirits(part2)"; GREY.."9) Turn in"; BLUE.." Rising Spirits{part2)"; GREY.." Accept"; BLUE.." Rising Spirits(part3)"; GREY.."10) Turn in"; BLUE.." Rising Spirits(part3)"; GREY.."11) Hearth to Orgrimmar"; GREY.."12) Get on the Zeppelin to go to Grom'Gol"; _RED.." Next Guide"; }; }; AtlasLVE = { g1 = { ZoneName = "30-31"; Location = "Stranglethorn Vale"; GREY.."1) Get the FP at Grom'Gol"; GREY.."2) Go north and do the STV hunt quests"; BLUE.."3) Welcome to the Jungle"; BLUE.."4) Tiger Mastery"; BLUE.."5) Panther Mastery"; BLUE.."6) Panther Mastery"; BLUE.."7) Tiger Mastery"; BLUE.."8) Raptor Mastery"; GREY.."9) Accept"; BLUE.." Tiger Mastery"; GREY.."10) Accept"; BLUE.." Raptor Mastery"; GREY.."12) You should be lvl 31 now, if not grind to it"; GREY.."13) Hearth to Orgrimmar"; GREY.."14) Fly to XRs"; GREY.."15) Run west in the XRs"; GREY.." Accept"; BLUE.." The Swarm Grows"; GREY.."16) Then run west from the XRs to the hut"; GREY.." Accept"; BLUE.." The Kolkar of Desolace"; GREY.."17) Run back to XRs"; GREY.."18) Fly to 1K needles"; GREY.."19) Go to Shimmering Flats"; _RED.." Next Guide"; }; g2 = { ZoneName = "31-32"; Location = "Shimmering Flats"; GREY.."1) Accept"; BLUE.."2) Hemet Nesingwary"; BLUE.."3) Wharfmaster Dizzywig"; GREY.."4) Accept and do"; BLUE.."5) A Bump in the Road"; BLUE.."6) Hardened Shells"; BLUE.."7) Load Lightening"; BLUE.."8) Rocket Car Parts"; BLUE.."9) Salt Flat Venom"; GREY.."10) Turn them in"; GREY.."11) Accept"; BLUE.."12) Goblin Sponsorship"; BLUE.."13) Martek the Exiled"; GREY.."15) You should be 32 now, if not grind to it"; GREY.."16) Go to Tanaris to get FP"; GREY.."17) Hearth to Orgrimmar"; GREY.."18) Turn in"; BLUE.." The Swarm Grows"; GREY.."19) Accept"; BLUE.." Alliance Relations(Cleft of Shadow)"; GREY.."20) Then go to Keldran in Orgrimmar,Accept"; BLUE.." Alliance Relations(part 2)"; GREY.."21) Stop at firstaid guy,buy silk bandage training"; GREY.."22) Then fly to Stonetalon Mountains"; GREY.."23) Run into Desolace"; _RED.." Next Guide"; }; g3 = { ZoneName = "32-32"; Location = "Desolace"; GREY.."1) Start killing mobs at the Thunder Axe Fortress"; GREY.."2) Until this drops [Flayed Demon Skin]"; GREY.." Accept"; BLUE.." The Corrupter"; GREY.."3) Then go down the path and do"; BLUE.."4) Kodo Roundup"; GREY.."5) Then go to Ghost Walker Post"; GREY.."6) Turn in"; BLUE.." The Kolkar of Desolace"; GREY.." Accept"; BLUE.." Khan Dez'hepah"; GREY.."7) Accept"; BLUE.." Gelkis Alliance"; GREY.."8) Turn in"; BLUE.." Alliance Relations"; GREY.." Accept"; BLUE.." Alliance Relations"; GREY.." Accept"; BLUE.." Befouled by Satyr"; GREY.."9) Turn in"; BLUE.." The Corrupter"; GREY.." Accept"; BLUE.." The Corrupter(part2)"; _RED.." Next Guide"; }; g4 = { ZoneName = "32-33"; Location = "Desolace"; GREY.."10) Turn in"; BLUE.." Alliance Relations"; GREY.." Accept"; BLUE.." The Burning of Spirits"; GREY.."11) Do in the following order"; BLUE.."12) Befouled by Satyr"; BLUE.."13) The Corrupter(Part2)"; BLUE.."14) Khan Dez'hepah"; BLUE.."15) Gelkis Alliance"; GREY.."16) Turn them in, collect new quests then do"; GREY.."17) Then run to Shadowprey Village"; GREY.." Turn in along the way"; BLUE.." Gelkis Alliance"; GREY.." Accept"; BLUE.." Stealing Supplies"; GREY.."18) Accept all quests at Shadowprey Village"; GREY.."19) Make Shadowprey Village your home"; GREY.."20) Then do"; BLUE.."21) Go in the water, collect 10 Shellfish"; BLUE.."22) Turn those in for 2 Bloodbelly Fish"; GREY.."23) Collect [Soft-shelled Clam Meat]"; _RED.." Next Guide"; }; g5 = { ZoneName = "33-33"; Location = "Desolace"; GREY.."24) Then accept"; BLUE.." Claim Rackmore's Treasure!"; GREN.." the chest/wrecked boat along the shore"; GREY.."25) Accept"; BLUE.." Sceptre of Light"; GREY.."26) Then go do"; BLUE.."27) The Burning of Spirits"; BLUE.."28) Sceptre of Light"; BLUE.."29) Hand of Iruxos"; GREY.."30) Grind your way back to the argent dawn dude"; GREY.."31) Then turn in"; BLUE.." Sceptre of Light"; GREY.." Accept"; BLUE.." Book of the Ancients"; GREY.."32) Then do this stuff in the water to the west"; BLUE.."33) Other Fish to Fry"; BLUE.."34) Clam Bait"; BLUE.."35) Book of the Ancients"; BLUE.."36) The Corrupter(Part3)"; BLUE.."37) Claim Rackmore's Treasure!"; GREY.."38) Then turn in"; BLUE.." Claim Rackmore's Treasure!"; BLUE.."39) Book of the Ancients"; _RED.." Next Guide"; }; g6 = { ZoneName = "33-34"; Location = "Desolace"; GREY.."40) Then Accept"; BLUE.." Bone Collector"; GREY.."41) Go to Ghost Walker Post, turn in all quests"; GREY.." Accept New Quests"; GREY.."43) Then go do"; BLUE.."44) Bone Collector"; BLUE.."45) Centaur Bounty"; BLUE.." Stealing Supplies"; GREY.."46) Then turn in"; BLUE.." Bone Collector"; BLUE.."47) Centaur Bounty"; GREY.."48) Hearth to Shadowprey Village"; GREY.."50) Turn in all quests there"; GREY.."51) You should be level 34 now for sure."; GREY.."52) Turn in"; BLUE.." Stealing Supplies"; GREY.." Accept"; BLUE.." Ongeku"; _RED.." Next Guide"; }; g7 = { ZoneName = "34-34"; Location = "Desolace"; GREY.."54) Fly CT"; GREY.."55) Once at CT, run into Dust Wallowmarsh"; GREY.."56) Get 3 quest-objects at the Shady Rest Inn"; BLUE.."57) Suspicious Hoofprints"; BLUE.."58) Lieutenant Paval Reethe"; BLUE.."59) The Black Shield"; GREY.."60) Now run to Brackenwall Village"; GREY.."61) Turn those 3 quests in"; GREY.."62) Stop at the troll vendor, buy 3 first aid books"; GREY.."63) Fly to XRs"; GREY.."64) Fly to Ratchet to turn in"; BLUE.." Goblin Sponsorship"; BLUE.." Wharfmaster Dizzywig"; GREY.." Accept new quests"; GREY.."65) Get on the boat to go to BB(build up first aid)"; _RED.." Next Guide"; }; g8 = { ZoneName = "34-35"; Location = "Stranglethorn Vale"; GREY.."1) Grab all quests to do in BB"; GREY.."3) Make BB your home"; GREY.."4) Fly to Grom'gol"; GREY.."5) Grab all quests in grom'gol"; GREY.."6) Get new spells/abilities"; GREY.."9) Go complete these quests"; BLUE.."10) Singing Blue Shards"; BLUE.."11) Tiger Mastery"; BLUE.."12) Bloodscalp Ears"; BLUE.." Bloodscalp Insight"; BLUE.."13) Hunt for Yenniku"; BLUE.."14) Bloody Bone Necklaces"; BLUE.."15) Raptor Mastery"; BLUE.."16) The Defense of Grom'gol"; GREY.."17) Once all those are done, go to Grom'gol"; GREY.."18) Turn in"; BLUE.." Hunt for Yenniku"; GREY.." Accept"; BLUE.." Headhunting"; GREY.."19) Turn in"; BLUE.." The Defense of Grom'gol"; GREY.." Accept"; BLUE.." The Defense of Grom'gol(part2)"; _RED.." Next Guide"; }; g9 = { ZoneName = "35-35"; Location = "Stranglethorn Vale"; GREY.." Also turn in"; BLUE.." Bloodscalp Insight"; GREY.." Accept"; BLUE.." An Unusual Patron"; GREY.."20) Should be lvl 35 now for sure"; GREN.." Buy new water/food/repair"; GREY.." Then go do in order"; BLUE.."21) Headhunting"; BLUE.."22) An Unusual Patron(19.22)"; BLUE.."23) The Vile Reef"; GREY.."24) Then go to Nesingwary's Expedition"; GREY.." Turn in quests, accept all new ones, Then do"; BLUE.."25) Tiger Mastery(31.18), then turn in, Then do"; BLUE.."26) Hostile Takeover"; BLUE.." Goblin Sponsorship"; BLUE.."27) Panther Mastery"; BLUE.." Mok'thardin's Enchantment"; BLUE.."28) The Defense of Grom'gol(part2)"; GREY.."29) Hearth to BB, turn in quests"; GREY.."30) Turn in"; BLUE.." Goblin Sponsorship"; GREY.." Accept"; BLUE.." Goblin Sponsorship(part3)"; _RED.." Next Guide"; }; h1 = { ZoneName = "35-36"; Location = "Stranglethorn Vale"; GREY.."31) Fly to Grom'gol, should be level 36"; GREY.." Turn in quests"; GREY.." Accept"; BLUE.." Trollbane"; GREY.."32) Get new spells/abilities"; GREY.."33) Get on the zeppelin to go to the Undercity"; GREY.."34) Once in the UC, accept"; BLUE.." To Steal From Thieves"; GREY.."35) Then fly to Hammerfall"; _RED.." Next Guide"; }; h2 = { ZoneName = "36-37"; Location = "Arathi Highlands"; GREY.."1) Make Hammerfall your home"; GREY.."2) Turn in"; BLUE.." Trollbane"; GREY.."3) Accept"; BLUE.." Call to Arms"; BLUE.." Foul Magics"; BLUE.." Guile of the Raptor"; GREY.."4) Grind your way down south and do"; BLUE.." Call to Arms"; GREY.."5) Then grind your way up north and accept"; BLUE.." The Princess Trapped(59.35)"; GREY.."6) Then go do"; BLUE.." The Princess Trapped"; GREY.."7) Go in the cave"; GREY.."8) Then turn in"; BLUE.." The Princess Trapped"; GREY.." Accept"; BLUE.." Stones of Binding"; GREY.."9) Go to hammerfall, turn in"; BLUE.." Call to Arms"; GREY.." Accept"; BLUE.." Call to Arms"; GREY.."10) Build up first aid, go do"; BLUE.." Triage"; _RED.." Next Guide"; }; h3 = { ZoneName = "36-37"; Location = "Arathi Highlands"; GREY.."11) Then do"; BLUE.."12) Stones of Binding(62.35)"; GREY.."13) Then do"; BLUE.." To Steal From Thieves(54.40)"; BLUE.."14) Get the next key for Stones of Binding(52.50)"; GREY.."15) Then go down and do"; BLUE.."16) Call to Arms"; BLUE.." Guile of the Raptor"; GREY.."17) Then go up and do"; BLUE.." Foul Magics(31.28)"; BLUE.."18) Get the last key for Stones of Binding(25.31)"; GREY.."19) Go discover Stromguard, and turn in"; BLUE.." Stones of Binding(35.59)"; GREY.."21) Hearth to Hammerfall"; GREY.."22) Turn in"; BLUE.." Call to Arms"; BLUE.." Foul Magics"; BLUE.." Guile of the Raptor"; GREY.."23) Complete the"; BLUE.." Guile of the Raptor quest chain"; GREN.."24) NOTE: SKIP all stromguard quests"; GREN.." unless you can find groups"; GREY.."25) Fly to Tarren Mill"; _RED.." Next Guide"; }; h4 = { ZoneName = "37-37"; Location = "Alterac Mountains"; GREY.."1) Once at TM, accept"; BLUE.." Prison Break In"; BLUE.." Stone Tokens"; GREY.."2) Then go do them in Alteric Mountains"; GREY.."3) Then turn them in and accept"; BLUE.." Dalaran Patrols"; BLUE.." Bracers of Binding"; GREY.."4) Then go do them in Alteric Mountains"; GREY.."5) Once they are both completed die"; GREN.." So u end up at TM"; GREY.."6) Turn them in, then fly to the UC"; GREY.."7) Once at UC, turn in"; BLUE.." To Steal From Thieves"; GREY.."9) Then go to the cooking center in UC"; GREY.." Buy 3 soothing spices(this is for a later quest)"; GREY.."10) Get on zeppelin to go to orgrimmar"; GREY.."11) Once in Orgrimmar, turn in"; BLUE.." Alliance Relations(21.53)"; GREY.."12) Then fly to XRs"; GREY.."13) Make XRs your home"; GREY.."14) Fly to Freewind Post"; _RED.." Next Guide"; }; h5 = { ZoneName = "37-37"; Location = "Thousand Needles"; GREY.."2) Run towards the Shimmering Flats"; GREY.."3) Turn in"; BLUE.." The Swarm Grows"; GREY.." Accept"; BLUE.." The Swarm Grows(part2)"; GREY.."5) Stop at the goblins and turn in"; BLUE.." Delivery to the Gnomes"; BLUE.." Parts for Kravel"; BLUE.." Goblin Sponsorship(part3)"; GREY.."6) Accept"; BLUE.." The Rumormonger"; GREY.." Do"; BLUE.."8) The Swarm Grows"; BLUE.." Parts of the Swarm(item drop)"; GREY.."9) Then go turn in"; BLUE.." The Swarm Grows"; GREY.."10) Hearth to XRs"; GREY.."12) Turn in"; BLUE.." Parts of the Swarm"; GREY.." Accept"; BLUE.." Parts of the Swarm(part2)"; GREY.."13) Fly to Dustwallow Marsh"; _RED.." Next Guide"; }; h6 = { ZoneName = "37-38"; Location = "Dustwallow Marsh"; GREY.."1) Accept"; BLUE.." Theramore Spies"; BLUE.." The Black Shield"; GREY.."2) Go south of Brackenwall Village and accept"; BLUE.." Hungry!(35.37)"; GREY.." 3)Kill everything while doing these quests"; BLUE.."4) Theramore Spies"; BLUE.." The Black Shield"; BLUE.." Hungry!(58.23)"; GREY.." Accept"; BLUE.."6) The Lost Report(55.25)"; GREY.." Turn In"; BLUE.."7) Soothing Spices"; GREY.." Accept"; BLUE.." Jarl Needs Eyes"; GREY.."8) Grind at 47.17, clear several times"; GREY.."9) Do"; BLUE.." Stinky's Escape(45.17)"; GREY.."10) Then go do"; BLUE.." Jarl Needs Eyes"; GREY.."11) Stop at Brackenwall Village"; GREY.." Turn in all quests, and Accept all New ones"; _RED.." Next Guide"; }; h7 = { ZoneName = "38-38"; Location = "Dustwallow Marsh"; GREY.."12) Turn in"; BLUE.." Hungry!"; GREY.."13) Goto Jarl's cabin,Accept"; BLUE.." The Severed Head"; GREY.."14) Turn in"; BLUE.." Jarl Needs Eyes"; GREY.."15) Grind more raptors and such"; GREY.."16) Do this quest"; BLUE.."17) The Theramore Docks(71.51)"; GREY.."18) Then die on purpose"; GREY.." You'll end up right at Brackenwall Village"; GREY.."19) Turn in"; BLUE.." The Theramore Docks"; GREY.."20) Turn in"; BLUE.." The Severed Head"; GREY.." Accept"; BLUE.." The Troll Witchdoctor"; GREY.."21) Hearth to XRs"; GREY.."22) Fly to Ratchet, turn in"; BLUE.." Stinky's Escape"; GREY.."23) Get on the boat to go to BB"; _RED.." Next Guide"; }; h8 = { ZoneName = "38-39"; Location = "Stranglethorn Vale"; GREY.."1) Accept"; BLUE.." The Bloodsail Buccaneers"; BLUE.." Scaring Shaky"; BLUE.." Venture Company Mining"; GREY.."2) Make BB your home"; GREY.."3) Fly to Grom'gol"; GREY.."4) Accept"; BLUE.." Mok'thardin's Enchantment"; GREY.."5) Turn in"; BLUE.." The Troll Witchdoctor"; GREY.." Right click the cauldron, accept"; BLUE.." Marg Speaks"; GREY.."6) Go do"; BLUE.."7) Raptor Mastery"; BLUE.." Mok'thardin's Enchantment"; GREY.."8) Grind raptors/cold eye ballisks till level 39"; GREY.." Then Do"; BLUE.."9) Venture Company Mining(40.42)"; GREY.."10) Then go turn in"; BLUE.." Mok'thardin's Enchantment"; GREY.." Accept"; BLUE.." Mok'thardin's Enchantment(part3)"; GREY.."11) Then do"; BLUE.." Panther Mastery(48.20 or 47.26)"; _RED.." Next Guide"; }; h9 = { ZoneName = "39-39"; Location = "Stranglethorn Vale"; GREY.."12) Then turn in"; BLUE.." Panther Mastery"; BLUE.." Raptor Mastery"; GREY.."13) Accept"; BLUE.." Raptor Mastery"; GREY.."14) Hearth to BB"; GREY.."15) Turn in"; BLUE.." Venture Company Mining"; GREY.."16) Then go do"; BLUE.."17) The Bloodsail Buccaneers"; BLUE.."18) Scaring Shaky"; BLUE.." Mok'thardin's Enchantment(part3)"; GREY.."19) Once that's done run back into BB"; GREY.."20) Turn in"; BLUE.." Scaring Shaky"; GREY.." Accept"; BLUE.." Return to MacKinley"; GREY.."21) Turn in"; BLUE.." The Bloodsail Buccaneers"; GREY.." Accept"; BLUE.." The Bloodsail Buccaneers"; GREY.."22) Turn in"; BLUE.." Return to MacKinley"; _RED.." Next Guide"; }; i1 = { ZoneName = "39-40"; Location = "Stranglethorn Vale"; GREY.."23) Turn in"; BLUE.." The Bloodsail Buccaneers"; GREY.."24) Fly to Grom'gol"; GREY.."25) Turn in"; BLUE.." Mok'thardin's Enchantment(part3)"; GREY.."26) Should be a little over half way to 40 now."; GREY.."27) Now grind raptors/cold eye ballisks till 40"; GREN.."28) OPTIONAL:"; GREN.." Scarlet Monastery instance instead"; GREY.."29) Once 40, Get new spells/abilities"; GREY.."30) Then get on the zeppelin to go to the UC"; GREY.."31) Fly to Hammerfall"; GREY.."32) Run all the way to the Badlands"; _RED.." Next Guide"; }; }; AtlasLVV = { i2 = { ZoneName = "40-40"; Location = "Badlands"; GREY.."1) The goal here is not to leave till level 41"; GREY.." so grind mobs every where you go"; GREY.."2) Turn in"; BLUE.." Martek the Exiled(44.53)"; GREY.."3) Accept"; BLUE.." Barbecued Buzzard Wings"; GREY.."4) Grind your way north-west"; GREY.."5) Accept"; BLUE.." Study of the Elements: Rock"; GREY.."6) Grind your way west to Kargath"; GREY.."7) Get FP at Kargath"; GREN.."8) Do NOT make Kargath your home."; GREY.."9) Accept"; BLUE.." Unclaimed Baggage"; BLUE.." Coyote Thieves"; BLUE.." Report to Helgrum"; BLUE.." Broken Alliances"; BLUE.." Badlands Reagent Run"; GREY.."10) Then go do"; BLUE.."11) Barbecued Buzzard Wings"; BLUE.."12) Coyote Thieves"; BLUE.."13) Broken Alliances"; BLUE.."14) Badlands Reagent Run"; BLUE.."15) Unclaimed Baggage"; GREN.." done at Angor Fortress, 42.31"; GREN.." Pack is in a barrel on the left entrance"; GREN.." Rapier is on weapon rack @ right entrance"; _RED.." Next Guide"; }; i3 = { ZoneName = "40-41"; Location = "Badlands"; GREY.."16) Turn in"; BLUE.." Study of the Elements: Rock (lesser)"; GREY.."17) Then Do"; BLUE.." Study of the Elements: Rock (rock)"; GREY.." Turn in, then do"; BLUE.."18) Study of the Elements: Rock (greater)"; GREY.."19) Make sure all quests are done and turned in"; GREY.." Grind your way east discovering new areas"; GREY.." End up at Lethlor Ravine grinding whelps"; GREY.."20) You should be 41 now if not grind to it"; GREY.."21) Hearth to BB"; GREY.."22) Fly to Grom'gol"; GREY.."23) Then run all the way to Swamp of Sorrows."; GREY.."24) Stopping along the way to accept"; BLUE.." Nothing But the Truth (Duskwood at 87.35)"; GREY.."25) Then turn in"; BLUE.." Nothing But the Truth(guy next to him)"; GREY.."26) Accept"; BLUE.." Nothing But the Truth"; GREY.."27) Then run into Swamp of Sorrows"; _RED.." Next Guide"; }; i4 = { ZoneName = "41-41"; Location = "Swamp of Sorrows"; GREY.."1) Start off doing"; BLUE.."2) Dream Dust in the Swamp"; BLUE.."3) Nothing But the Truth"; GREN.." Kill Mire Lord for the Mire Lord Fungus(6.32)"; GREY.."4) Find and kill Cudgel"; GREN.." Drops Noboru's Cudgel, which starts"; BLUE.." Noboru the Cudgel"; GREY.."5) Go turn in"; BLUE.." Noboru the Cudgel"; GREY.." Accept"; BLUE.." Draenethyst Crystals"; GREY.."6) Grind to Stonard"; GREY.."7) Make it your home"; GREY.."8) Accept"; BLUE.." Lack of Surplus"; BLUE.." Fresh Meat"; BLUE.." Little Morsels"; GREY.."9) Stable pet."; GREY.."10) Get FP"; GREY.."11) Turn in"; BLUE.." Report to Helgrum"; GREY.." Accept"; BLUE.." Pool of Tears"; GREY.."14) Then hearth to Stonard"; _RED.." Next Guide"; }; i5 = { ZoneName = "41-42"; Location = "Swamp of Sorrows"; GREY.."16) Go do the following quests"; BLUE.."17) Pool of Tears"; GREN.." in the water around temple of atal'hakkar"; BLUE.."18) Lack of Surplus"; GREY.." then turn it in"; GREY.." Accept"; BLUE.." Lack of Surplus part2"; GREY.." then go do it"; BLUE.."19) Fresh Meat"; BLUE.."20) Nothing But the Truth(shadow panther)"; BLUE.."21) Ongeku"; BLUE.." Draenethyst Crystals"; BLUE.." Little Morsels"; GREY.."22) Go turn in"; BLUE.." Draenethyst Crystals"; BLUE.."23) Lack of Surplus part2"; GREY.." Accept"; BLUE.." Threat From the Sea"; GREY.."24) Turn in"; BLUE.." Threat From the Sea"; GREY.." Accept the next part"; _RED.." Next Guide"; }; i6 = { ZoneName = "42-42"; Location = "Swamp of Sorrows"; GREY.."25) Go do"; BLUE.." Threat From the Sea"; BLUE.." Fresh Meat"; GREY.."26) Turn in"; BLUE.." Threat From the Sea"; GREY.." Accept"; BLUE.." Continued Threat"; GREY.."28) Hearth to Stonard"; GREY.."29) Turn in"; BLUE.." Fresh Meat"; BLUE.." Little Morsels"; BLUE.." Pool of Tears"; GREY.." Accept"; BLUE.." The Atal'ai Exile"; GREY.."30) Should be lvl 42 now, get spells/abilities"; GREY.."31) Fly to Grom'gol"; _RED.." Next Guide"; }; i7 = { ZoneName = "42-42.5"; Location = "Stranglethorn Vale"; GREY.."1) Accept"; BLUE.." Mok'thardin's Enchantment part4"; BLUE.." Split Bone Necklace"; GREY.."2) Fly to BB"; GREY.."3) Accept ALL quests in BB"; GREY.."4) Turn in"; BLUE.." Dream Dust in the Swamp"; GREY.."5) Make BB your home."; GREY.."6) Then go do in the following order:"; BLUE.."7) The Bloodsail Buccaneers"; BLUE.." Up to Snuff"; BLUE.." Keep An Eye Out"; BLUE.."8) Mok'thardin's Enchantment part4"; BLUE.." Akiris by the Bundle"; BLUE.."9) Zanzil's Secret"; BLUE.." Voodoo Dues"; BLUE.."10) Skullsplitter Tusks"; BLUE.." Split Bone Necklace"; GREY.."11) Keep grinding away at Skullsplitter trolls"; GREY.." until at least 2-3 bars away from 43."; GREY.."12) Then hearth to BB"; GREY.."13) Turn in ALL quests."; GREY.."14) Fly to grom'gol"; _RED.." Next Guide"; }; i8 = { ZoneName = "42.5-43"; Location = "Stranglethorn Vale"; GREY.."15) Turn in"; BLUE.." Mok'thardin's Enchantment part4"; BLUE.." Split Bone Necklace"; GREY.."16) Accept"; BLUE.." Grim Message"; GREY.."17) Get on the zeppelin to go to Orgrimmar."; GREY.."18) Fly to Thunder Bluff"; GREY.."19) Turn in"; BLUE.." Frostmaw"; GREY.." Accept"; BLUE.." Deadmire"; GREN.." Keep Frostmaw's mane in bank"; GREY.."20) Fly to Desolace (or Dustwallow Marsh)"; _RED.." Next Guide"; }; i9 = { ZoneName = "43-43(optional)"; Location = "Desolace"; GREN.."1) OPTIONAL: This section can be skipped"; GREN.." if you are 4-5 blocks or more into lvl 43"; GREY.."2) Make Shadowprey Village your home."; GREY.."3) Accept"; BLUE.." Portals of the Legion"; GREY.."4) Go turn in"; BLUE.." Ongeku"; GREN.."5) While your in Desolace, keep an eye out for"; GREN.." Elite Giant for quest: Nothing But the Truth"; GREY.."7) Then do"; BLUE.."8) Portals of the Legion"; BLUE.."9) The Corrupter"; GREY.."10) Turn in"; BLUE.." The Corrupter"; GREY.."11) Then hearth to Shadowprey Village"; GREY.."12) Turn in"; BLUE.." Portals of the Legion"; GREY.."13) Fly to Dustwallow Marsh";; _RED.." Next Guide"; }; j1 = { ZoneName = "43-43"; Location = "Dustwallow Marsh"; GREY.."1) Accept"; BLUE.." Identifying the Brood"; BLUE.." Army of the Black Dragon"; BLUE.." Overlord Mok'Morokk's Concern"; GREY.."2) Go down to (39.36) and accept then do"; BLUE.." Questioning Reethe"; GREY.."3) Go down and do:"; BLUE.."4) Deadmire"; BLUE.."5) Marg Speaks (58.63)"; BLUE.."6) Identifying the Brood"; BLUE.." Army of the Black Dragon"; BLUE.."7) Overlord Mok'Morokk's Concern"; BLUE.." (44.66)(38.65)(36.69)"; GREY.."8) Then grind back to Brackenwall village"; GREY.."9) Turn in"; BLUE.." Questioning Reethe"; BLUE.." Army of the Black Dragon"; BLUE.." Overlord Mok'Morokk's Concern"; BLUE.." Identifying the Brood"; GREY.." Accept"; BLUE.." The Brood of Onyxia"; GREY.."10) Run back and forth until it is done"; GREY.."11) Turn in"; BLUE.." Marg Speaks"; GREY.." Accept"; BLUE.." Report to Zor"; GREY.."12) Fly to Tanaris"; _RED.." Next Guide"; }; j2 = { ZoneName = "43-43.5"; Location = "Tanaris"; GREY.."1) Go into Gadgetzan"; GREY.."2) Accept"; BLUE.." WANTED: Andre Firebeard"; BLUE.." WANTED: Caliph Scorpidsting"; GREY.."3) Turn in"; BLUE.." Tran'Rek"; GREY.."4) Accept"; BLUE.." Gadgetzan Water Survey"; BLUE.." Wastewander Justice"; BLUE.." Water Pouch Bounty"; GREY.."5) Make Gadgetzan your home."; GREY.."6) Then grind east to Steamwheedle Port."; GREY.."7) Then accept"; BLUE.." Pirate Hats Ahoy!"; BLUE.." Screecher Spirits"; BLUE.." Southsea Shakedown"; GREY.."8) Turn in"; BLUE.." Stoley's Debt"; GREY.." Accept"; BLUE.." Stoley's Shipment"; _RED.." Next Guide"; }; j3 = { ZoneName = "43.5-44"; Location = "Tanaris"; GREY.."9) Then go complete these quests"; BLUE.."10) Wastewander Justice"; BLUE.."11) Water Pouch Bounty"; BLUE.."12) Southsea Shakedown"; BLUE.."13) Pirate Hats Ahoy!"; BLUE.."14) Stoley's Shipment"; BLUE.."15) Ship Schedules"; BLUE.."16) WANTED: Andre Firebeard"; GREY.."17) Once their all done, hearth to Gadgetzan"; GREY.."18) Turn in"; BLUE.." Water Pouch Bounty"; BLUE.." Wastewander Justice"; GREY.." Accept"; BLUE.." More Wastewander Justice"; GREY.."19) Go do"; BLUE.." Gadgetzan Water Survey(38.29)"; GREY.." Turn it in"; GREY.."20) Go to Steamwheedle Port."; GREY.."21) Turn in ALL quests there"; GREY.." Accept"; BLUE.." Return to MacKinley"; GREY.."22) Then go do"; BLUE.." More Wastewander Justice"; BLUE.." WANTED: Caliph Scorpidsting"; _RED.." Next Guide"; }; j4 = { ZoneName = "44-44"; Location = "Tanaris"; GREY.."23) Then hearth to Gadgetzan."; GREN.." Make sure you save (put in your bank) all the"; GREN.." Wastewander Water Pouches you have"; GREN.." need them for a later quest"; GREY.."24) Turn in"; BLUE.." More Wastewander Justice"; BLUE.." WANTED: Caliph Scorpidsting"; GREY.."25) Fly to Freewind Post"; GREY.."26) Run into Feralas"; _RED.." Next Guide"; }; j5 = { ZoneName = "44-45"; Location = "Feralas"; GREY.."1) Run into Camp Mojache."; GREY.."2) Accept ALL quests there."; GREY.."3) Get FP."; GREY.."4) Make it your home."; GREY.."5) Then go do in the following order:"; BLUE.."6) War on the Woodpaw"; BLUE.."7) The Ogres of Feralas"; BLUE.." Gordunni Cobalt"; GREY.."8) Make sure you click on one of the"; GREY.." scrolls laying on the ground which starts"; BLUE.." The Gordunni Scroll"; GREY.."9) Then go do"; BLUE.." A New Cloak's Sheen"; GREY.."10) Turn ALL those quests in, accept new ones."; GREY.."11) Go do"; BLUE.." Alpha Strike"; GREY.." then turn it in."; GREY.."12) Go do"; BLUE.." Woodpaw Investigation"; GREY.." complete it, accept"; BLUE.." The Battle Plans"; GREY.."13) Then go do"; BLUE.." A Grim Discovery"; GREY.."14) Turn those quests in, accept new ones."; _RED.." Next Guide"; }; j6 = { ZoneName = "45-45"; Location = "Feralas"; GREY.."15) Then go do"; BLUE.."16) Stinglasher"; BLUE.." Zukk'ash Infestation"; BLUE.."17) Screecher Spirits"; BLUE.."18) The Ogres of Feralas part2"; BLUE.."19) Dark Ceremony"; BLUE.."20) The Mark of Quality"; GREY.."21) Turn those quests in, accept new ones."; GREN.."22) I tend to get 90+ gold to buy my mount."; GREY.."23) I then Fly to Orgrimmar"; GREY.."24) Once there turn in"; BLUE.." Zukk'ash Report"; GREY.."25) Accept"; BLUE.." Ripple Recovery"; GREY.."26) Then turn in"; BLUE.." Ripple Recovery"; GREY.." Accept"; BLUE.." Ripple Recovery again"; GREY.."27) Turn in"; BLUE.." Parts of the Swarm"; BLUE.." A Grim Discovery"; GREY.." Accept"; BLUE.." Betrayed"; _RED.." Next Guide"; }; }; AtlasLVX = { j7 = { ZoneName = "45-46"; Location = "Feralas"; GREY.."28) Go turn in"; BLUE.." A Strange Request"; GREY.." Accept"; BLUE.." Retrun to Witch Doctor Uzer'i(Cleft of S"; GREY.."29) Go turn in"; BLUE.." Report to Zor"; GREY.." Accept/complete"; BLUE.." Service to the Horde(valley of wisdom)"; GREY.."30) Go turn in"; BLUE.." The Gordunni Orb(valley of spirits)"; GREY.."31) buy mount"; GREY.."32) Then hearth back to Feralas"; GREY.."33) Turn in"; BLUE.." Retrun to Witch Doctor Uzer'i"; GREY.." Accept"; BLUE.." Natural Materials"; BLUE.." Testing the Vessel"; GREY.."34) Then do"; BLUE.." Natural Materials"; GREY.."35) Grind hippogryphs till it's completed."; GREN.."36) If the OOX-22/FE Distress Beacon"; GREN.." item drops accept the quest Find OOX-22/FE!"; GREY.."37) Turn in Find OOX-22/FE! (at 51.57)"; GREY.."38) If your not level 46, grind till you are"; GREN.." on hippogryphs."; _RED.." Next Guide"; }; j8 = { ZoneName = "46-46"; Location = "Feralas"; GREY.."39) Hearth back to Camp Mojache."; GREY.."40) Turn in"; BLUE.." Natural Materials"; GREY.." Accept"; BLUE.." The Sunken Temple"; GREY.."41) Fly to Thunder Bluff"; GREY.."42) Turn in"; BLUE.." Deadmire"; GREY.."43) Get new spells/abilities."; GREY.."44) Fly to Splintertree Post (Ashenvale)"; GREY.."45) Then go into Azshara"; _RED.." Next Guide"; }; j9 = { ZoneName = "46-46.5"; Location = "Azshara"; GREY.."1) Go accept"; BLUE.." Spiritual Unrest"; BLUE.." A Land Filled with Hatred(10.78)"; GREY.."2) Then go do them, and turn them in."; GREY.."3) Then go to Valormok (at 21.52)"; GREY.."4) Turn in"; BLUE.." Betrayed"; GREY.."5) Then get FP there and fly to Orgrimmar."; GREY.."6) Then head to Under City."; GREY.."7) Once at UC, accept"; BLUE.." Lines of Communication(magic quarter)"; GREY.."8) Then go to(apothecarium quarter), accept"; BLUE.." Seeping Corruption"; BLUE.." Errand for Apothecary Zinge"; GREY.."9) Then go turn in"; BLUE.." Errand for Apothecary Zinge(The other room)"; GREY.."10) Go return back, and turn in"; BLUE.." Errand for Apothecary Zinge"; GREY.." Accept"; BLUE.." Into the Field"; GREY.."11) Fly to Tarren Mill."; GREY.."12) Make Tarren Mill your home."; GREY.."13) Then go into Hinterlands"; _RED.." Next Guide"; }; k1 = { ZoneName = "46.5-47"; Location = "Hinterlands"; GREY.."1) Go turn in"; BLUE.." Ripple Recovery(at 25.47)"; GREY.." Accept"; BLUE.." A Sticky Situation"; GREY.."2) Ride all the way to Revantusk Village(77.80)"; GREY.."3) Accept"; BLUE.." Vilebranch Hooligans"; BLUE.." Cannibalistic Cousins"; BLUE.." Message to the Wildhammer"; BLUE.." Stalking the Stalkers"; BLUE.." Hunt the Savages"; BLUE.." Avenging the Fallen"; GREN.." Before you go start questing make sure you"; GREN.." stock up heavily on food/water/supplies"; GREN.." you won't be back to town for while."; GREY.."4) Then go do the following:"; BLUE.."5) Whiskey Slim's Lost Grog"; BLUE.."6) Vilebranch Hooligans"; BLUE.."7) Cannibalistic Cousins"; BLUE.."8) A Sticky Situation"; GREY.." Turn in later, accept"; BLUE.." Ripple Delivery"; BLUE.."9) Stalking the Stalkers"; BLUE.."10) Hunt the Savages"; _RED.." Next Guide"; }; k2 = { ZoneName = "47-47 P1"; Location = "Hinterlands"; BLUE.."11) Testing the Vessel"; BLUE.."12) Avenging the Fallen"; BLUE.."13) Lines of Communication"; BLUE.."14) Message to the Wildhammer"; BLUE.."15) Rin'ji is Trapped!"; GREN.." (the escort quest, starts at 31.48)"; BLUE.."16) Grim Message"; GREN.." while doing this quest accept"; BLUE.." Venom Bottles"; GREN.." (one of those little bottles on the table)"; GREY.."17) Yeah the good 'ol hinterlands grind.."; GREY.."18) If the OOX-09/HL Distress Beacon drops"; GREY.." accept the quest Find OOX-09/HL!"; GREY.."19) Turn in Find OOX-09/HL! (at 49.38)"; GREY.."20) Turn in Rin'ji is Trapped! (at 86.59)"; GREY.." Accept"; BLUE.." Rin'ji's Secret"; GREY.."21) Go to Revantusk Village."; GREY.."22) Turn in ALL quests."; GREY.."23) Then get FP and fly to TM."; GREY.."24) Turn in"; BLUE.." Venom Bottles"; GREY.." Accept"; BLUE.." Undamaged Venom Sac"; _RED.." Next Guide"; }; k3 = { ZoneName = "47-47 P2"; Location = "Hinterlands"; GREY.."25) Fly to Hammerfall"; GREY.."26) Then go to Dr Gregory Victor to lvl first aid"; GREN.."27) Usually able to get to 290 first aid for"; GREN.." Heavy Runecloth bandage, try to save"; GREN.." 60 mageweave cloth for a later quest called"; GREN.." A Donation of Mageweave"; GREY.."28) Then fly back to TM."; GREY.."29) Then ride back into Hinterlands (don’t fly)"; GREY.."30) Go do"; BLUE.." Undamaged Venom Sac"; BLUE.." The Atal'ai Exile"; GREY.." Accept"; BLUE.." Return to Fel'Zerul"; GREY.."31) Then hearth to TM."; GREY.."32) Turn in"; BLUE.." Undamaged Venom Sac"; GREY.."33) Fly to the UC."; GREY.."34) Go to magic quarter and turn in"; BLUE.." A Donation of Mageweave"; GREY.."35) Then turn in"; BLUE.." Lines of Communication"; BLUE.." Rin'ji's Secret"; GREY.." Then complete"; BLUE.." Oran's Gratitude"; GREY.."36) Get on the zeppelin to go to Grom'gol"; _RED.." Next Guide"; }; k4 = { ZoneName = "47-47 P3"; Location = "Stranglethorn Vale"; GREY.."1) Go do"; BLUE.." Raptor Mastery"; GREY.." then turn it in."; GREY.."2) Accept"; BLUE.." Big Game Hunter"; GREY.." Go do it, then turn it in."; GREY.."3) Go to Grom'gol.."; GREY.."4) Turn in"; BLUE.." Grim Message"; GREY.."5) Fly to BB."; GREY.."6) Accept"; BLUE.." The Bloodsail Buccaneers part5"; GREY.."7) Turn in"; BLUE.." Whiskey Slim's Lost Grog"; GREY.."8) Make BB your home."; GREY.."9) Accept"; BLUE.." The Captain's Chest"; GREY.." Then go do it (at 36.65)"; GREN.." NOTE: This quest is tough to solo"; GREN.." it can be soloed, but you should find a group"; GREN.." to help you kill Gorlash, I personally skip it"; GREN.." while racing to 60."; GREY.."10) Go out to the shore east of BB,"; GREY.." find a small bottle laying around the shore"; _RED.." Next Guide"; }; k5 = { ZoneName = "47-47 P4"; Location = "Stranglethorn Vale"; GREY.." until this item shows up Carefully Folded Note"; GREY.." which starts Message in a Bottle"; GREY.."12) Go turn in"; BLUE.." Message in a Bottle(at 37.82)"; GREY.."13) Then go do"; BLUE.." The Bloodsail Buccaneers part5"; GREN.." (kill the three pirates in the three ships)"; GREN.." while doing it, find Cortello's Riddle"; GREN.." (it's usually downstairs in the middle ship)"; GREY.."14) Then hearth back to BB"; GREY.."15) Turn in"; BLUE.." The Bloodsail Buccaneers part5"; BLUE.." The Captain's Chest"; GREY.."16) Fly to Kargath (Badlands)"; GREY.."18) Go into Searing Gorge"; _RED.." Next Guide"; }; k6 = { ZoneName = "47-47.5"; Location = "Searing Gorge"; GREY.."1) First thing I do here is go south-east and do"; BLUE.." Caught! (guy in the outhouse)"; GREN.." Need a stack of silk cloth"; GREY.." then turn it in"; GREY.." Accept"; BLUE.." Ledger from Tanaris"; GREY.." Click on outhouse to get the"; BLUE.." Goodsteel Ledger"; GREY.."2) Then go start killing Glassweb Spiders for"; BLUE.." Ledger from Tanaris quest."; GREY.."3) Then go up north-west, Talk to "; GREY.." Kalaran Windblade(39.39) on way"; GREY.." to Thorium Point.Do his listen quest"; BLUE.." Divine Retribution"; GREY.." In order to get"; BLUE.." The Flawless Flame"; GREY.." Collect all quests at Thorium Point"; GREY.." get the FP there too."; GREY.."4) Then do the following:"; BLUE.."5) Fiery Menace!"; BLUE.."6) Curse These Fat Fingers"; BLUE.."7) STOLEN: Smithing Tuyere"; BLUE.." Lookout's Spyglass"; GREY.."8) Turn in,then get and do"; BLUE.." Forging the Shaft"; BLUE.."9) JOB OPPORTUNITY: Culling the Competition"; _RED.." Next Guide"; }; k7 = { ZoneName = "47.5-48"; Location = "Searing Gorge"; BLUE.."10) WANTED: Overseer Maltorius"; GREN.." (only do this quest with a group"; BLUE.."11) What the Flux?"; BLUE.."12) Incendosaurs? Whateverosaur More Like It"; BLUE.."13) The Key to Freedom"; GREN.." Starts from an item Grimsite Outhouse Key"; GREN.." Turn in at the outhouse (south-east)"; GREY.."14) Once all that's done, turn them all in."; GREN.." Make sure you have 20 solid crystal leg shafts."; GREY.."15) Head south into Burning Steppes.."; GREY.."16) Discover some areas"; GREY.." Then get FP there(65.25)"; GREY.." Fly directly to Stonard (swamp of sorrows)"; _RED.." Next Guide"; }; k8 = { ZoneName = "48-48 P1"; Location = "Swamp of Sorrows"; GREY.."1) Make Stonard your home"; GREY.."2) Go to the"; BLUE.." Fallen Hero of the Horde(36.64)"; GREY.." Keep talking to him till you get the quest"; BLUE.." The Disgraced One"; GREY.."3) Then go do"; BLUE.." Cortello's Riddle(22.49 under the bridge)"; GREY.."Accept the next part to it."; GREY.."4) If Nothing But the Truth is completed"; GREY.." Go turn it in."; GREY.."5) Either way, hearth back to Stonard."; GREY.."6) Go turn in"; BLUE.." Return to Fel'Zerul"; BLUE.." The Disgraced One"; GREY.." Accept"; BLUE.." The Missing Orders"; GREY.."7) Get new spells/abilities"; GREY.."8) Go turn in"; BLUE.." The Missing Orders"; GREY.." Accept"; BLUE.." The Swamp Talker"; GREY.."9) Go do"; BLUE.." The Swamp Talker"; BLUE.." Continued Threat(cave at 65.78)"; GREY.."10) Then go turn in"; _RED.." Next Guide"; }; k9 = { ZoneName = "48-48 P2"; Location = "Swamp of Sorrows"; BLUE.." Continued Threat"; GREY.."11) Then kill the mob Jarquia(around 94.48)"; GREN.." Drops Goodsteel's Balanced Flameberge"; GREN.." For the quest"; BLUE.." Ledger from Tanaris"; GREY.."12) Then die on purpose end up at Stonard."; GREY.."13) Go to the"; BLUE.." Fallen Hero of the Horde(36.64)"; GREY.." turn in"; BLUE.." The Swamp Talker"; GREY.."14) Accept and do"; BLUE.." A Tale of Sorrow"; GREY.."15) Go back to Stonard and fly to Grom'gol"; GREY.."16) Get on the zeppelin to go to Orgrimmar."; GREY.."17) Fly to Brackenwall Village"; GREY.." Once there accept"; BLUE.." The Brood of Onyxia"; GREY.."18) Then head south and get"; GREY.." The Overdue Package for"; BLUE.." Ledger from Tanaris(at 52.53)"; GREY.."19) Go down a bit and do"; BLUE.." The Brood of Onyxia(eggs @ 53.72,48.75)"; GREY.."20) Head west to Bloodfen Burrow cave(31.67)"; GREY.." Do"; BLUE.." Cortello's Riddle"; GREY.." Accept the next part to it."; GREY.."21) Then die on purpose, end up at Brackenwall"; _RED.." Next Guide"; }; l1 = { ZoneName = "48-48 P3"; Location = "Swamp of Sorrows"; GREY.."22) Turn in"; BLUE.." The Brood of Onyxia"; GREY.."23) Then fly to Tanaris"; GREY.."24) Turn in"; BLUE.." Ledger from Tanaris"; BLUE.." Into the Field"; GREY.." Accept and complete"; BLUE.." Slake That Thirst"; GREY.."25) Then Fly to Feralas"; _RED.." Next Guide"; }; l2 = { ZoneName = "48-49 P1"; Location = "Feralas"; GREY.."1) Turn in"; BLUE.." Testing the Vessel"; GREY.." Accept"; BLUE.." Hippogryph Muisek"; GREY.."2) Accept"; BLUE.." Improved Quality"; BLUE.." Vengeance on the Northspring"; BLUE.." Dark Heart"; GREY.."3) Make it your home."; GREY.."4) Go do"; BLUE.." Hippogryph Muisek"; GREY.."5) Then hearth back to Camp Mojache."; GREY.."6) Turn in"; BLUE.." Hippogryph Muisek"; GREY.." Accept"; BLUE.." Faerie Dragon Muisek"; GREY.."7) Go do"; BLUE.." Faerie Dragon Muisek"; GREY.." Then turn it in, Accept"; BLUE.." Treant Muisek"; GREY.."8) Go do"; BLUE.." Treant Muisek"; GREY.." then turn it in, Accept"; BLUE.." Mountain Giant Muisek"; _RED.." Next Guide"; }; l3 = { ZoneName = "48-49 P2"; Location = "Feralas"; GREY.."10) Go accept"; BLUE.." Zapped Giants (at 44.44)"; GREY.." Do the following quests:"; BLUE.."13) Improved Quality"; BLUE.."14) Perfect Yeti Hide"; GREN.." (Might find item/quest Improved Quality)"; BLUE.."15) Vengeance on the Northspring"; BLUE.."16) Dark Heart", BLUE.."17) Mountain Giant Muisek"; BLUE.." Zapped Giants"; GREY.."18) Once those quests are completed, Turn in"; BLUE.." Zapped Giants"; GREY.."19) Hearth to Camp Mojache."; GREY.."21) Turn in"; BLUE.." Mountain Giant Muisek"; GREY.." Accept"; BLUE.." Weapons of Spirit"; GREY.." Then turn it in complete it."; GREY.."22) Turn in"; BLUE.." Improved Quality"; BLUE.." Perfect Yeti Hide"; BLUE.." Vengeance on the Northspring"; BLUE.." Dark Heart"; GREY.." Accept"; BLUE.." The Strength of Corruption"; GREY.."24) Fly to Tanaris"; _RED.." Next Guide"; }; l4 = { ZoneName = "49-50 P1"; Location = "Tanaris"; GREY.."1) Make Gadgetzan your home."; GREY.."2) Accept"; BLUE.." The Thirsty Goblin"; BLUE.." Noxious Lair Investigation"; BLUE.." Super Sticky"; BLUE.." Thistleshrub Valley"; BLUE.." The Dunemaul Compound"; GREY.."3) Go turn in"; BLUE.." The Sunken Temple(at 52.46)"; GREY.." Accept"; BLUE.." The Stone Circle"; BLUE.." Gahz'ridian"; GREY.."4) Go do (in the following order:)"; BLUE.."5) The Dunemaul Compound"; BLUE.." Gahz'ridian"; BLUE.."6) Noxious Lair Investigation"; BLUE.."7) Thistleshrub Valley"; BLUE.." The Thirsty Goblin"; BLUE.."8) Tooga's Quest"; GREY.."9) Then turn in"; BLUE.." Tooga's Quest"; BLUE.." Screecher Spirits"; GREY.."10) Hearth to Gadgetzan."; _RED.." Next Guide"; }; l5 = { ZoneName = "49-50 P2"; Location = "Tanaris"; GREY.."11) Turn in"; BLUE.." The Thirsty Goblin"; GREY.." Accept"; BLUE.." In Good Taste"; GREY.." turn it in, Accept"; BLUE.." Sprinkle's Secret Ingredient"; GREY.."12) Turn in"; BLUE.." Thistleshrub Valley"; BLUE.." The Dunemaul Compound"; BLUE.." Noxious Lair Investigation"; GREY.."13) Accept"; BLUE.." The Scrimshank Redemption"; GREY.."14) Go do:"; BLUE.."15) Tanaris Field Sampling"; GREY.." Turn in"; BLUE.." Gahz'ridian"; GREY.."16) If OOX-17/TN Distress Beacon item drops"; GREY.." Accept the quest Find OOX-17/TN!"; GREY.."17) Turn in Find OOX-17/TN! (at 59.65)"; GREN.."18) NOTE: I skip all escort robot chicken quests"; GREY.."19) Once Tanaris Field Sampling is done, go do"; BLUE.." The Scrimshank Redemption"; GREN.." The secret for finding the item for this quest"; GREN.." Keep making right turns in the cave"; GREN.." it will lead you to it"; _RED.." Next Guide"; }; l6 = { ZoneName = "49-50 P3"; Location = "Tanaris"; GREY.."20) Once The Scrimshank Redemption is done"; GREY.." die on purpose"; GREY.."21) Then turn in"; BLUE.." Tanaris Field Sampling"; GREY.." Accept"; BLUE.." Return to Apothecary Zinge"; GREY.."22) Turn in"; BLUE.." The Scrimshank Redemption"; GREY.." Accept"; BLUE.." Insect Part Analysis"; GREY.."23) Turn in"; BLUE.." Insect Part Analysis"; GREY.." Accept"; BLUE.." Insect Part Analysis"; GREY.."24) Turn in"; BLUE.." Insect Part Analysis"; GREY.." Accept"; BLUE.." Rise of the Silithid"; GREY.."25) Fly to Orgrimmar"; GREY.."26) Make Orgrimmar your home."; GREY.."27) Fly to Azshara"; _RED.." Next Guide"; }; l7 = { ZoneName = "50-50 P1"; Location = "Azshara"; GREY.."1) Accept"; BLUE.." Stealing Knowledge"; GREY.."2) Go do"; BLUE.."3) Stealing Knowledge"; BLUE.."4) Seeping Corruption"; GREY.."5) Once their done, turn in"; BLUE.." Stealing Knowledge"; GREY.." Accept ALL 4 delivery quests"; GREY.."6) Turn in"; BLUE.." Delivery to Archmage Xylem"; GREY.." Accept"; BLUE.." Xylem's Payment to Jediga"; GREY.."7) Then fly to Thunder Bluff"; GREY.."8) Turn in"; BLUE.." Delivery to Magatha(Elder Rise)"; GREY.." Accept"; BLUE.." Magatha's Payment to Jediga"; GREY.."9) Hearth to Orgrimmar."; GREY.."10) Go turn in"; BLUE.." Rise of the Silithid"; GREY.." Accept"; BLUE.." March of the Silithid(55.47)"; GREY.."11) Turn in"; BLUE.." Delivery to Jes'rimon(51.34)"; _RED.." Next Guide"; }; l8 = { ZoneName = "50-50 P2"; Location = "Azshara"; GREY.." Accept"; BLUE.." Jes'rimon's Payment to Jediga"; BLUE.." Bone-Bladed Weapons"; GREY.."12) Then turn in"; BLUE.." Ripple Delivery(55.35)"; GREY.."13) Then go get new spells/abilities"; GREY.."14) Then go to The Undercity"; GREY.." Head to the Apothecarium Quarter"; GREY.."15) Turn in"; BLUE.." Delivery to Andron Gant"; GREY.." Accept"; BLUE.." Andron's Payment to Jediga"; GREY.."16) Then turn in"; BLUE.." Seeping Corruption"; BLUE.." Return to Apothecary Zinge"; GREY.." Accept"; BLUE.." Vivian Lagrave"; GREY.."17) Then accept"; BLUE.." Seeping Corruption"; GREY.." Then turn it in (the tauren right next to him)"; GREY.."18) Then complete"; BLUE.." Seeping Corruption"; GREY.."19) Then accept"; BLUE.." A Sample of Slime..."; BLUE.." ... and a Batch of Ooze"; GREY.."20) Then fly to Raventusk Village (Hinterlands)"; _RED.." Next Guide"; }; l9 = { ZoneName = "50-50 P3"; Location = "Hinterlands"; GREY.."1) Accept"; BLUE.." Snapjaws, Mon!"; BLUE.." Gammerita, Mon!"; BLUE.." Lard Lost His Lunch"; GREY.."4) Go do in the following order:"; BLUE.."5) Snapjaws, Mon!"; BLUE.." Gammerita, Mon!"; BLUE.."6) Cortello's Riddle(81.47)"; BLUE.."7) Lard Lost His Lunch (at 84.42)"; GREY.."8) Then go turn in"; BLUE.." Snapjaws, Mon!"; BLUE.." Gammerita, Mon!"; BLUE.." Lard Lost His Lunch"; GREY.."9) Then go do"; BLUE.." Sprinkle's Secret Ingredient(at 41.60)"; GREY.."10) Then hearth to Orgrimmar, Fly to Azshara."; GREY.."12) Turn in all 4 delivery quests."; GREY.."13) Fly to XRs Make XRs your home."; GREY.."15) Fly to Ratchet."; GREY.."16) Pick up the"; BLUE.." Stone Circle"; BLUE.." Volcanic Activity"; GREY.."17) Get on the boat to go to BB"; GREY.."18) Fly to Stonard (swamp of sorrows).."; GREY.."19) Go into Blasted Lands..."; _RED.." Next Guide"; }; }; AtlasLVY = { m1 = { ZoneName = "50-51 P1"; Location = "Blasted Lands"; GREY.."1) Find all the items for these 5 quests"; BLUE.."2) A Boar's Vitality"; BLUE.."3) Snickerfang Jowls"; BLUE.."4) The Basilisk's Bite"; BLUE.."5) The Decisive Striker"; BLUE.."6) Vulture's Vigor"; GREN.."7) Need to find these many items"; GREN.." to complete those quests:"; _RED.."8) Vulture Gizzards =14"; _RED.."9) Basilisk Brain =11"; _RED.."10) Blasted Boar Lungs =6"; _RED.."11) Scorpok Pincers =6"; _RED.."12) Snickerfang Jowls =5"; GREY.."13) Discover most of all the areas for XP"; GREN.."14) If Imperfect Draenethyst Fragment drops"; GREN.." turn in for"; BLUE.." Everything Counts In Large Amounts"; GREY.."16) Turn in all quests."; GREY.."17) I turn in, ASAP"; BLUE.." The Decisive Striker"; GREY.."18) Then hearth to XRs."; GREY.."19) Fly to Tanaris"; GREY.."20) Turn in"; BLUE.." Sprinkle's Secret Ingredient"; _RED.." Next Guide"; }; m2 = { ZoneName = "50-51 P2"; Location = "Blasted Lands"; GREY.." Accept"; BLUE.." Delivery for Marin"; GREY.."21) Turn in"; BLUE.." March of the Silithid"; GREY.." Accept"; BLUE.." Bungle in the Jungle"; GREY.."22) Turn in"; BLUE.." Delivery for Marin"; GREY.." Accept"; BLUE.." Noggenfogger Elixir"; GREY.." then turn it in."; GREY.."23) Go turn in"; BLUE.." The Stone Circle(52.46 in Tanaris)"; GREY.."24) Then go into Un'Goro Crater"; _RED.." Next Guide"; }; m3 = { ZoneName = "51-52 P1"; Location = "Un'Goro Crater"; GREY.."1) Go accept"; BLUE.." The Apes of Un'Goro"; BLUE.." The Fare of Lar'korwi(69.77)"; GREY.."2) Go do"; BLUE.." The Fare of Lar'korwi(68.56)"; GREY.."3) Then go start doing"; BLUE.." Super Sticky"; GREY.." Until [A Mangled Journal] Drops"; GREY.."4) Then go into Marshal's Refuge"; GREY.." Get ALL quests there"; GREY.."5) Turn in"; BLUE.." Williden's Journal"; GREY.."6) Then go do the Ungoro Grind"; GREN.."7) Don’t worry about the ungoro dirt mounds"; GREN.." you'll find enough soil from mob drops."; GREY.."8) Find 7 crystals of each color for the"; BLUE.." Crystals of Power"; BLUE.."9) Super Sticky"; BLUE.."10) The Apes of Un'Goro"; BLUE.." Chasing A-Me 01"; BLUE.."11) Larion and Muigin"; BLUE.."12) Beware of Pterrordax"; BLUE.."13) Roll the Bones"; BLUE.."14) Expedition Salvation"; BLUE.."15) ... and a Batch of Ooze"; _RED.." Next Guide"; }; m4 = { ZoneName = "51-52 P2"; Location = "Un'Goro Crater"; GREY.."16) Go turn in"; BLUE.." The Apes of Un'Goro"; GREY.." Accept"; BLUE.." The Mighty U'cha"; GREY.."17) Turn in"; BLUE.." The Fare of Lar'korwi"; GREY.." Accept"; BLUE.." The Scent of Lar'korwi"; GREY.."18) Then go do"; BLUE.."19) Bone-Bladed Weapons"; BLUE.." The Scent of Lar'korwi"; BLUE.."20) It's a Secret to Everybody"; GREN.." (bag under water(63.69))"; GREY.."21) Then turn in"; BLUE.." The Scent of Lar'korwi"; GREY.." Accept"; BLUE.." The Bait for Lar'korwi"; GREY.."22) Then go do"; BLUE.." Alien Ecology"; BLUE.." Bungle in the Jungle"; GREY.."23) Go accept and do"; BLUE.." Finding the Source(30.51)"; BLUE.." Volcanic Activity"; GREY.."24) The hotspot path for the quest"; BLUE.." Finding the Source"; GREY.." starts at 51,42 and the hot spot is at 50,46 "; _RED.." Next Guide"; }; m5 = { ZoneName = "51-52 P3"; Location = "Un'Goro Crater"; BLUE.."25) Lost!"..GREN.."Not till other quests are done"; GREY.."26) Turn in ALL quests, accept new ones."; GREY.."27) Then go do (in the following order):"; BLUE.."28) The Northern Pylon(56.13)"; BLUE.."29) The Mighty U'cha"; BLUE.."30) The Eastern Pylon(77.50)"; BLUE.."31) The Bait for Lar'korwi"; GREN.." then turn it in along with The Mighty U'cha"; GREY.."32) Go west killing oozes along the way"; GREY.."33) Turn in"; BLUE.." Finding the Source"; GREY.." Accept"; BLUE.." The New Springs"; BLUE.."34) The Western Pylon(23.58)"; GREY.."35) Go to Marshal's Refuge kill oozes on the way"; GREY.."36) Turn in quests. make sure you complete"; BLUE.." Making Sense of It"; GREN.." (just talk to the gnome in the cave)"; GREY.."37) Then go to Cenarion Hold, get FP there."; GREY.."38) Fly to Tanaris"; GREY.."39) Turn in"; BLUE.." Super Sticky"; BLUE.." Bungle in the Jungle"; GREY.."40) Then fly to Thunder Bluff"; GREY.."41) Go to Elder Rise"; _RED.." Next Guide"; }; m6 = { ZoneName = "51-52 P4"; Location = "Un'Goro Crater"; GREY.."42) Accept"; BLUE.." Un'goro Soil"; GREY.." Then turn it in"; GREY.." Accept"; BLUE.." Morrowgrain Research"; GREY.." Then turn that in"; GREY.."44) Go get new spells/abilities."; GREY.."45) Hearth to XRs."; GREY.."46) Then fly to Ratchet"; GREY.."47) Turn in"; BLUE.." Volcanic Activity"; BLUE.." Marvon's Workshop"; GREY.."48) Get on the boat to go to BB"; GREY.."49) Fly to Kargath"; GREY.."50) Turn in"; BLUE.." Vivian Lagrave"; GREY.."51) Accept:"; BLUE.." Dreadmaul Rock"; BLUE.." The Rise of the Machines"; GREY.."52) Then fly to Burning Steppes"; _RED.." Next Guide"; }; m7 = { ZoneName = "52-53"; Location = "Burning Steppes"; GREY.."1) Accept"; BLUE.." Broodling Essence"; BLUE.." Tablet of the Seven"; GREY.."2) Then go do:"; BLUE.."3) Broodling Essence"..GREN.." kill all dragon whelps"; BLUE.."4) Dreadmaul Rock"; BLUE.." Krom'Grul"; BLUE.."5) Tablet of the Seven(54.40)"; BLUE.."6) The Rise of the Machines"; GREY.."7) Go turn in"; BLUE.." Tablet of the Seven"; BLUE.." Broodling Essence"; GREY.." Accept"; BLUE.." Felnok Steelspring"; GREY.."8) Then fly to Kargath and turn in"; BLUE.." Krom'Grul"; GREY.."10) Turn in"; BLUE.." The Rise of the Machines"; GREY.." Accept"; BLUE.." The Rise of the Machines part2"; GREY.."11) Go turn in"; BLUE.." The Rise of the Machines part2(25.46)"; GREY.."12) Then hearth to XRs, fly to Org"; GREY.."14) Make Orgrimmar your home."; GREY.."15) Fly to Azshara..."; _RED.." Next Guide"; }; m8 = { ZoneName = "53-54 P1"; Location = "Azshara"; GREY.."1) Accept"; BLUE.." Betrayed"; GREY.." Accept"; BLUE.." Courser Antlers"; GREY.."3) Go accept"; BLUE.." Kim'jael Indeed!(52.22)"; GREY.."4) Then go do"; BLUE.."5) Courser Antlers"; BLUE.."6) Betrayed"; BLUE.."7) Kim'jael Indeed!"; GREN.."8) Grind away at bloodelfs for a while"; GREY.."9) Once those 3 quests are done, go turn in"; BLUE.." Kim'jael Indeed!"; GREY.." Accept"; BLUE.." Kim'jael's Missing Equipment"; GREY.."10) Turn in"; BLUE.." Courser Antlers"; GREY.." Accept"; BLUE.." Wavethrashing"; GREY.."11) Then go do"; BLUE.."12) Kim'jael's Missing Equipment"; BLUE.."13) Wavethrashing"; GREY.."14) Once both are done, Hearth to Orgrimmar."; GREY.."15) Then Fly to Azshara.."; _RED.." Next Guide"; }; m9 = { ZoneName = "53-54 P2"; Location = "Azshara"; GREY.."16) Turn in"; BLUE.." Betrayed"; GREY.." Accept"; BLUE.." Betrayed"; GREY.."17) Turn in"; BLUE.." Wavethrashing"; GREY.."18) Turn in"; BLUE.." Kim'jael's Missing Equipment"; GREY.."19) At this point should be about 3/4th to 54"; GREY.." Grind your way to level 54 on BloodElfs."; GREN.."21) OPTIONAL: Do BRD instance instead."; GREY.."22) Once you hit 54 hearth to Orgrimmar."; GREY.."23) Then go turn in"; BLUE.." Bone-Bladed Weapons"; BLUE.." Betrayed"; GREY.."24) Then fly to Splintertree Post"; GREY.."25) Then go into Felwood"; _RED.." Next Guide"; }; n1 = { ZoneName = "54-54"; Location = "Felwood"; GREY.."1) Go accept"; BLUE.." Forces of Jaedenar"; BLUE.." Verifying the Corruption(at 50.81)"; GREY.."2) Go accept"; BLUE.." Cleansing Felwood(46.84)"; GREY.."3) I start killing oozes"; GREN.." Kill 30-40 oozes here total for"; BLUE.." A Sample of Slime..."; GREY.."4) Then go complete"; BLUE.." Forces of Jaedenar"; GREY.."5) Then go to BloodVenom Post"; GREY.."6) Accept"; BLUE.." Well of Corruption"; BLUE.." A Husband's Last Battle"; BLUE.." Wild Guardians"; GREY.."7) Get FP there."; GREY.."8) Then go do in the following order"; BLUE.."9) Verifying the Corruption"; BLUE.."10) Cleansing Felwood"; BLUE.."11) The Strength of Corruption"; GREY.."12) Go accept"; BLUE.." Deadwood of the North(64.8)"; GREY.."13) Grind way through the cave to Winterspring"; _RED.." Next Guide"; }; n2 = { ZoneName = "54-55 P1"; Location = "Winterspring"; GREY.."1) Exit the cave and accept"; BLUE.." Winterfall Activity"; GREY.."2) Go to Donova Snowden(31.46)"; GREY.."3) Turn in"; BLUE.." The New Springs"; BLUE.." It's a Secret to Everybody"; GREY.." Accept"; BLUE.." Strange Sources"; BLUE.." Threat of the Winterfall"; GREY.."5) Go to Everlook"; GREY.."6) Accept"; BLUE.." Are We There, Yeti?"; BLUE.." The Everlook Report"; BLUE.." Duke Nicholas Zverenhoff"; BLUE.." Sister Pamela"; GREY.."7) Turn in"; BLUE.." Felnok Steelspring"; GREY.." Accept"; BLUE.." Chillwind Horns"; GREY.."8) Make Everlook your home."; GREY.."9) Go Discover Darkwhisper Gorge for the quest"; BLUE.." Strange Sources"; GREY.."10) Then hearth back to Everlook."; _RED.." Next Guide"; }; n3 = { ZoneName = "54-55 P2"; Location = "Winterspring"; GREY.."11) Then go do the following quests"; BLUE.."12) Are We There, Yeti?"; BLUE.."13) Threat of the Winterfall"; GREN.." You should find Empty Firewater Flask"; GREN.." Starts Winterfall Firewater"; BLUE.."14) Wild Guardians"; BLUE.."15) Chillwind Horns"; GREY.."16) Once these are done turn in"; BLUE.." Threat of the Winterfall"; BLUE.." Winterfall Firewater"; GREY.." Accept"; BLUE.." Falling to Corruption"; GREY.."17) Once the rest of the quests are complete"; GREY.."18) Goto Everlook,Turn in all quests"; GREY.." Accept new ones"; GREY.."19) Then go do:"; BLUE.."20) Winterfall Activity"; BLUE.."21) Are We There, Yeti?"; GREY.."22) Then hearth to Everlook"; GREY.."23) Go turn in"; BLUE.." Are We There, Yeti?"; GREY.." Accept"; BLUE.." Are We There, Yeti? part3"; GREY.."24) Go scare Legacki for the quest"; BLUE.." Are We There, Yeti? part3"; GREY.."25) Then fly to Felwood"; _RED.." Next Guide"; }; n4 = { ZoneName = "55-55 P1"; Location = "Felwood"; GREY.."1) Turn in"; BLUE.." Wild Guardians"; GREY.." Accept"; BLUE.." Wild Guardians part2"; GREY.."2) Go turn in"; BLUE.." Cleansing Felwood"; GREY.." Then get a cenarion beacon for the quest"; BLUE.." Salve Via Hunting"; GREY.."3) Go turn in"; BLUE.." Verifying the Corruption"; BLUE.." Forces of Jaedenar"; GREY.." Accept"; BLUE.." Collection of the Corrupt Water"; GREY.."4) Go do in the following order:"; BLUE.."5) A Husband's Last Battle"; BLUE.."6) Well of Corruption"; GREY.." Collect 6 Corrupted Soul Shard for the quest"; BLUE.." Salve Via Hunting"; BLUE.."7) Collection of the Corrupt Water"; GREY.."8) Then go to Bloodvenom Post"; GREY.."9) Turn in"; BLUE.." A Husband's Last Battle"; BLUE.." Well of Corruption"; _RED.." Next Guide"; }; n5 = { ZoneName = "55-55 P2"; Location = "Felwood"; GREY.." Accept"; BLUE.." Corrupted Sabers"; GREY.."10) Go turn in"; BLUE.." Salve Via Hunting"; GREY.."11) Go turn in"; BLUE.." Collection of the Corrupt Water"; GREY.."12) Go do"; BLUE.." Corrupted Sabers"; GREY.." Then turn it in"; GREY.."13) Then go up north and do:"; BLUE.."14) Deadwood of the North"; BLUE.."15) Falling to Corruption"; GREY.." Then accept"; BLUE.." Mystery Goo"; GREY.."16) Go turn in"; BLUE.." Deadwood of the North"; GREY.."17) Then fight your way through the cave"; GREY.."18) Turn in"; BLUE.." Winterfall Activity"; _RED.." Next Guide"; }; n6 = { ZoneName = "55-55 P3"; Location = "Felwood"; GREY.."19) Then go turn in"; BLUE.." Mystery Goo"; GREY.."20) Then hearth to Everlook."; GREY.."21) Fly to Orgrimmar.."; GREY.."22) Make Orgrimmar your home."; GREY.."23) Fly to Camp Mojache, Feralas."; GREY.."24) Turn in"; BLUE.." The Strength of Corruption"; GREY.."25) Then fly to Tanaris."; GREY.."26) Go scare Sprinkle for the quest"; BLUE.." Are We There, Yeti? part3"; GREY.."27) Then fly to Silithus"; _RED.." Next Guide"; }; n7 = { ZoneName = "55-55 P4"; Location = "Silithus"; GREY.."1) Accept"; BLUE.." Report to General Kirika"; BLUE.." The Twilight Mystery"; BLUE.." Securing the Supply Lines"; BLUE.." Deadly Desert Venom"; GREY.."2) Go do"; BLUE.." Securing the Supply Lines"; BLUE.." Deadly Desert Venom"; GREY.."3) Then turn them in and accept new quests."; GREY.."4) Then go do:"; BLUE.."5) Stepping Up Security"; BLUE.."6) The Twilight Mystery"; GREY.."7) Go turn in"; BLUE.." Report to General Kirika(50.69)"; GREY.." Accept"; BLUE.." Scouring the Desert"; GREY.."8) Go do"; BLUE.." Noggle's Last Hope"; BLUE.." Scouring the Desert"; GREN.." Once you find the Silithyst item which"; GREN.." looks like a glowing red thing, bring it back"; GREN.." to the PVP horde base stand in the teleporter"; GREY.." Then turn the quest in for 6,600 XP!"; BLUE.."9) Wanted - Deathclasp, Terror of the Sands"; _RED.." Next Guide"; }; n8 = { ZoneName = "55-55 P5"; Location = "Silithus"; GREY.."10) Once those are done"; GREY.." Turn them in, accept new ones."; GREY.."11) Go do"; BLUE.." Noggle's Lost Satchel(40.90)"; BLUE.."12) The Deserter(67.71)"; GREY.."13) Die on purpose, end up at Cenarion Hold."; GREY.."14) Turn in"; BLUE.." Noggle's Lost Satchel"; GREY.."15) Then go to Marshal's Refuge"; GREY.."16) Go scare Quixxil for"; BLUE.." Are We There, Yeti? part3"; GREY.."17) Then hearth to Orgrimmar."; GREY.."18) Go to the UnderCity."; GREY.."19) Go complete"; BLUE.." A Sample of Slime..."; BLUE.." ... and a Batch of Ooze"; GREY.."20) Go accept"; BLUE.." A Call To Arms: The Plaguelands!"; GREY.."21) Make Under City your home."; GREY.."22) Go to the Bulwark."; _RED.." Next Guide"; }; }; AtlasLVZ = { n9 = { ZoneName = "55-56 P1"; Location = "Western Plaguelands"; GREY.."1) Turn in"; BLUE.." A Call To Arms: The Plaguelands!"; GREY.." Accept"; BLUE.." Scarlet Diversions"; GREN.."2) Get Flame in a Bottle first, it's in the box"; GREY.."3) Turn in"; BLUE.." The Everlook Report"; GREY.."4) Accept and complete"; BLUE.." Argent Dawn Commission"; GREY.."5) Accept"; BLUE.." The So-Called Mark of the Lightbringer"; BLUE.." A Plague Upon Thee"; GREY.."6) Go to the Western Plaguelands(field 38.55)"; GREY.."7) Accept"; BLUE.." Better Late Than Never(in the house)"; GREY.."8) Then go to the barn next door"; GREY.."9) Complete"; BLUE.." Better Late Than Never"; GREY.." Click on the chest again to accept"; BLUE.." Better Late Than Never AGAIN"; GREY.."10) Go do"; BLUE.." Scarlet Diversions"; GREY.."11) Go back to the Bulwark"; GREY.."12) Turn in"; BLUE.." Scarlet Diversions"; _RED.." Next Guide"; }; o1 = { ZoneName = "55-56 P2"; Location = "Western Plaguelands"; GREY.." Accept"; BLUE.." All Along the Watchtowers"; GREY.."13) Accept"; BLUE.." The Scourge Cauldrons"; GREY.."14) Go do the whole Cauldron quest chain"; BLUE.."15) Target: Felstone Field"; BLUE.."16) Target: Dalson's Tears"; BLUE.."17) Target: Writhing Haunt"; GREY.." While your there accept"; BLUE.." The Wildlife Suffers(54.65)"; BLUE.."18) Target: Gahrron's Withering"; GREY.."19) Keep going back and forth completing them."; GREY.."20) Then go accept and complete"; BLUE.." Mission Accomplished!"; GREY.."21) Then head into Eastern Plaguelands"; _RED.." Next Guide"; }; o2 = { ZoneName = "56-57 P1"; Location = "Eastern Plaguelands"; GREY.."1) Go accept"; BLUE.." Demon Dogs"; BLUE.." Blood Tinged Skies"; BLUE.." Carrion Grubbage(6.44)"; GREY.."2) Grind your way to(26.75), accept"; BLUE.." To Kill With Purpose"; BLUE.." Un-Life's Little Annoyances"; GREY.."4) Grind to Darrowshire doing these quests"; BLUE.."5) Demon Dogs"; BLUE.."6) Blood Tinged Skies"; BLUE.."7) Carrion Grubbage"; GREY.."8) Then turn in"; BLUE.." Sister Pamela"; GREY.." Accept and do"; BLUE.." Pamela's Doll"; GREY.."9) Turn in"; BLUE.." Pamela's Doll"; GREY.." Accept"; BLUE.." Auntie Marlene"; BLUE.." Uncle Carlin"; GREY.."10) Then go complete"; BLUE.." Blood Tinged Skies"; GREY.."11) Make sure you kill 20 Plaguehound Runts for"; BLUE.." Demon Dogs"; _RED.." Next Guide"; }; o3 = { ZoneName = "56-57 P2"; Location = "Eastern Plaguelands"; GREY.."12) Then go to Light's Hope Chapel (81.60)"; GREY.."13) Accept"; BLUE.." Zaeldarr the Outcast"; BLUE.." The Restless Souls"; GREY.."14) Turn in"; BLUE.." Duke Nicholas Zverenhoff"; BLUE.." Uncle Carlin"; GREY.." Accept"; BLUE.." Defenders of Darrowshire"; GREY.."15) Get FP there."; GREY.."16) Then go do:"; BLUE.."17) To Kill With Purpose"; BLUE.."18) Defenders of Darrowshire"; BLUE.."19) Demon Dogs"; BLUE.."20) Carrion Grubbage"; BLUE.."21) Un-Life's Little Annoyances"; BLUE.."22) A Plague Upon Thee"; BLUE.."23) Augustus' Receipt Book"; GREN.." Get this quest in the hut at 13.34"; GREN.." The book is upstairs in the inn at 15.33"; BLUE.."24) The Restless Souls (Egans in the hut 13.34)"; GREY.."25) Then go turn in"; BLUE.." Augustus' Receipt Book"; _RED.." Next Guide"; }; o4 = { ZoneName = "56-57 P3"; Location = "Eastern Plaguelands"; GREY.."26) Go through the cave and then turn in"; BLUE.." Demon Dogs"; BLUE.." Blood Tinged Skies"; BLUE.." Carrion Grubbage"; GREY.." Accept"; BLUE.." Redemption"; GREY.."27) Then go turn in"; BLUE.." To Kill With Purpose"; BLUE.." Un-Life's Little Annoyances"; GREY.."28) Then go do"; BLUE.." Zaeldarr the Outcast"; GREY.."29) Then turn in"; BLUE.." Zaeldarr the Outcast"; BLUE.." Defenders of Darrowshire"; GREY.."30) Hearth to UnderCity"; GREY.."31) Turn in"; BLUE.." Better Late Than Never"; GREY.." Accept"; BLUE.." The Jeremiah Blues"; GREY.."32) Turn in"; BLUE.." The Jeremiah Blues (UNDER BANK)"; GREY.." Accept"; BLUE.." Good Luck Charm"; GREY.."33) Go back to the Bulwark"; _RED.." Next Guide"; }; o5 = { ZoneName = "57-58 P1"; Location = "Western Plaguelands"; GREY.."1) Turn in"; BLUE.." A Plague Upon Thee"; GREY.." Accept"; BLUE.." A Plague Upon Thee part2"; GREY.."2) Go turn in Good Luck Charm"; GREY.." Accept"; BLUE.." Two Halves Become One"; GREY.."3) Do"; BLUE.." Two Halves Become One"; GREY.." Then turn it in."; GREY.."4) Then do"; BLUE.." A Plague Upon Thee part2"; GREY.." Accept"; BLUE.." A Plague Upon Thee part3 (46.32)"; GREY.."5) Then go accept"; BLUE.." Unfinished Business part1"; GREY.." Then do it at 50.42 and 53.44"; GREY.."6) Turn in"; BLUE.." Unfinished Business part1"; GREY.." Accept"; BLUE.." Unfinished Business part2"; GREY.." Then go do it. The 2 mobs are at (57.37 and 54.24)"; GREY.." While doing this quest make sure you do"; BLUE.." The So-Called Mark of the Lightbringer"; GREN.." (top of the tower 54.23)"; _RED.." Next Guide"; }; o6 = { ZoneName = "57-58 P2"; Location = "Western Plaguelands"; GREY.."7) Turn in"; BLUE.." Unfinished Business part2"; GREY.." Accept"; BLUE.." Unfinished Business part3"; GREY.." Then go do it go up in the tower (at 45.19)"; GREY.."8) Then turn in"; BLUE.." Unfinished Business part3"; GREY.."9) Then go complete and turn in"; BLUE.." The Wildlife Suffers Too"; GREY.." Accept"; BLUE.." The Wildlife Suffers Too part2"; GREY.."10) Do"; BLUE.." The Wildlife Suffers Too part2"; GREY.." Then turn it in and accept"; BLUE.." Glyphed Oaken Branch"; GREY.."11) Go turn in"; BLUE.." Auntie Marlene (48.78)"; GREY.." Accept"; BLUE.." A Strange Historian"; GREY.."12) Go do"; BLUE.." A Strange Historian"; GREN.." (the ring is in the graveyard)"; GREY.."13) Go into Andorhal and do"; BLUE.."14) All Along the Watchtowers"; _RED.." Next Guide"; }; o7 = { ZoneName = "57-58 P3"; Location = "Western Plaguelands"; GREY.."15) Turn in"; BLUE.." A Strange Historian(at Chromie)"; GREY.." Accept"; BLUE.." The Annals of Darrowshire"; BLUE.." A Matter of Time"; GREY.."16) Then go do(while grinding away at mobs)"; BLUE.."17) All Along the Watchtowers"; BLUE.."18) A Matter of Time"; BLUE.."19) The Annals of Darrowshire"; GREN.." the book for this is in the building at(42.67)"; GREY.."20) Go turn in"; BLUE.." A Matter of Time"; BLUE.." The Annals of Darrowshire"; GREY.." Accept"; BLUE.."21) Counting Out Time"; GREY.."22) Go do"; BLUE.." Counting Out Time"; GREY.." then turn it in"; GREN.."23) Keep grinding mobs in Andorhal till Friendly"; GREN.." With the Argent Dawn, So your able to buy"; GREN.." Enriched Manna Biscuits"; GREY.."24) Once you hit Friendly go back to the Bulwark"; GREY.."25) Turn in"; BLUE.." A Plague Upon Thee part3"; BLUE.." The So-Called Mark of the Lightbringer"; _RED.." Next Guide"; }; o8 = { ZoneName = "57-58 P4"; Location = "Western Plaguelands"; GREY.."26) Turn in"; BLUE.." All Along the Watchtowers"; GREY.." Accept"; BLUE.." Scholomance"; GREY.."27) Turn in"; BLUE.." Scholomance"; GREY.." Accept"; BLUE.." Skeletal Fragments"; GREY.."28) Then go back to Andorhal"; GREY.." Grind all the way to level 58, while doing"; BLUE.." Skeletal Fragments"; GREY.."29) Once your 58 go to the Bulwark, turn in"; BLUE.." Skeletal Fragments"; GREY.."30) I turn in any scourge stones, I have."; GREY.."31) stock up on Enriched Manna Biscuits"; GREY.."32) Then go get on the zeppelin to go to Org"; GREY.."33) Once in Orgrimmar get new spells/abilities."; GREY.."35) Then fly to Winterspring"; _RED.." Next Guide"; }; o9 = { ZoneName = "58-60 P1"; Location = "Winterspring"; GREY.."2) Then make Everlook your home."; GREY.."3) Turn in"; BLUE.." Are We There, Yeti? part3"; GREY.."4) Accept"; BLUE.." Luck Be With You"; BLUE.." Ursius of the Shardtooth"; GREY.." Then do"; BLUE.." Luck Be With You"; GREY.."7) Then hearth to Everlook."; GREY.."8) Go do"; BLUE.." Ursius of the Shardtooth"; GREN.." Grind on the hill north of everlook"; GREN.." Till Ursius shows up"; GREY.."9) Go turn in"; BLUE.." Luck Be With You"; BLUE.." Ursius of the Shardtooth"; GREY.." Accept"; BLUE.." Brumeran of the Chillwind"; GREY.."10) Then go south and do:"; BLUE.."11) Brumeran of the Chillwind"; BLUE.."13) Wild Guardians part2"; GREY.."14) When a few bars from 59 go to Everlook"; GREY.."15) Turn in"; BLUE.." Brumeran of the Chillwind"; GREY.."16) Fly to Bloodvenom Post(felwood)"; _RED.." Next Guide"; }; p1 = { ZoneName = "58-60 P2"; Location = "Winterspring"; GREY.."17) Turn in"; BLUE.." Wild Guardians part2"; GREY.." Accept"; BLUE.." Wild Guardians part3"; GREY.."18) Then hearth back to Everlook."; GREY.."19) Go down to the Owl Wing Thicket and do"; BLUE.." Wild Guardians part3"; GREY.."20) Keep grinding away at Owls till 59 1/2."; GREY.."21) Die on purpose, end up at Everlook"; GREY.."22) Then Fly to Bloodvenom Post(Felwood)"; GREY.."23) Turn in"; BLUE.." Wild Guardians part3"; BLUE.." Guarding Secrets"; GREY.." Accept"; BLUE.." Guarding Secrets part2"; GREY.."24) Then fly to Thunderbluff, go to Elder Rise"; GREY.."25) Turn in"; BLUE.." Guarding Secrets part2"; BLUE.." Glyphed Oaken Branch"; GREY.."26) Hearth back to Everlook."; GREY.."27) Should be about 3/4 way to 60"; GREY.."28) Then go back down to the Owl Wing Thicket"; GREY.." Grind to 60"; _RED.." Congrats on Level 60"; }; };
gpl-3.0
TheAnswer/FirstTest
bin/scripts/items/objects/clothing/dresses/main.lua
1
3514
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. RunItemLUAFile("objects/clothing/dresses/dress5.lua"); RunItemLUAFile("objects/clothing/dresses/dress6.lua"); RunItemLUAFile("objects/clothing/dresses/dress7.lua"); RunItemLUAFile("objects/clothing/dresses/dress8.lua"); RunItemLUAFile("objects/clothing/dresses/dress8quest.lua"); RunItemLUAFile("objects/clothing/dresses/dress9.lua"); RunItemLUAFile("objects/clothing/dresses/dress10.lua"); RunItemLUAFile("objects/clothing/dresses/dress11.lua"); RunItemLUAFile("objects/clothing/dresses/dress12.lua"); RunItemLUAFile("objects/clothing/dresses/dress13.lua"); RunItemLUAFile("objects/clothing/dresses/dress14.lua"); RunItemLUAFile("objects/clothing/dresses/dress15.lua"); RunItemLUAFile("objects/clothing/dresses/dress16.lua"); RunItemLUAFile("objects/clothing/dresses/dress18.lua"); RunItemLUAFile("objects/clothing/dresses/dress19.lua"); RunItemLUAFile("objects/clothing/dresses/dress23.lua"); RunItemLUAFile("objects/clothing/dresses/dress26.lua"); RunItemLUAFile("objects/clothing/dresses/dress27.lua"); RunItemLUAFile("objects/clothing/dresses/dress29.lua"); RunItemLUAFile("objects/clothing/dresses/dress30.lua"); RunItemLUAFile("objects/clothing/dresses/dress31.lua"); RunItemLUAFile("objects/clothing/dresses/dress32.lua"); RunItemLUAFile("objects/clothing/dresses/dress33.lua"); RunItemLUAFile("objects/clothing/dresses/dress34.lua"); RunItemLUAFile("objects/clothing/dresses/dress35.lua");
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/rori/creatures/tortonVoraciousPatriarch.lua
1
4795
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. tortonVoraciousPatriarch = Creature:new { objectName = "tortonVoraciousPatriarch", -- Lua Object Name creatureType = "ANIMAL", gender = "", speciesName = "torton_voracious_patriarch", stfName = "mob/creature_names", objectCRC = 2343686181, socialGroup = "Torton", level = 37, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 10300, healthMin = 8500, strength = 0, constitution = 0, actionMax = 10300, actionMin = 8500, quickness = 0, stamina = 0, mindMax = 10300, mindMin = 8500, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 15, energy = 15, electricity = 15, stun = 100, blast = 0, heat = 0, cold = 0, acid = 15, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 1, stalker = 0, killer = 0, ferocity = 0, aggressive = 1, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 365, weaponMaxDamage = 440, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, -- Likely hood to be tamed datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "bone_mammal_rori", boneMax = 1300, hideType = "hide_wooly_rori", hideMax = 1150, meatType = "meat_carnivore_rori", meatMax = 1300, --skills = { " Intimidation attack", " Knockdown attack", "" } skills = { "tortonAttack4", "tortonAttack3" }, respawnTimer = 60, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(tortonVoraciousPatriarch, 2343686181) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/endor/npcs/pubam/twistedPubamScavenger.lua
1
4608
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. twistedPubamScavenger = Creature:new { objectName = "twistedPubamScavenger", -- Lua Object Name creatureType = "NPC", faction = "pubam", factionPoints = 20, gender = "", speciesName = "twisted_pubam_scavenger", stfName = "mob/creature_names", objectCRC = 2350961206, socialGroup = "pubam", level = 34, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 10800, healthMin = 8800, strength = 0, constitution = 0, actionMax = 10800, actionMin = 8800, quickness = 0, stamina = 0, mindMax = 10800, mindMin = 8800, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = -1, stun = -1, blast = 0, heat = 0, cold = 0, acid = -1, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 1, ferocity = 0, aggressive = 1, invincible = 0, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 335, weaponMaxDamage = 380, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 2, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "pubamAttack1" }, respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(twistedPubamScavenger, 2350961206) -- Add to Global Table
lgpl-3.0
yav/language-lua
lua-5.3.1-tests/constructs.lua
4
7271
-- $Id: constructs.lua,v 1.39 2015/03/04 13:09:38 roberto Exp $ ;;print "testing syntax";; local debug = require "debug" -- testing semicollons do ;;; end ; do ; a = 3; assert(a == 3) end; ; -- invalid operations should not raise errors when not executed if false then a = 3 // 0; a = 0 % 0 end -- testing priorities assert(2^3^2 == 2^(3^2)); assert(2^3*4 == (2^3)*4); assert(2.0^-2 == 1/4 and -2^- -2 == - - -4); assert(not nil and 2 and not(2>3 or 3<2)); assert(-3-1-5 == 0+0-9); assert(-2^2 == -4 and (-2)^2 == 4 and 2*2-3-1 == 0); assert(-3%5 == 2 and -3+5 == 2) assert(2*1+3/3 == 3 and 1+2 .. 3*1 == "33"); assert(not(2+1 > 3*1) and "a".."b" > "a"); assert("7" .. 3 << 1 == 146) assert(10 >> 1 .. "9" == 0) assert(10 | 1 .. "9" == 27) assert(0xF0 | 0xCC ~ 0xAA & 0xFD == 0xF4) assert(0xFD & 0xAA ~ 0xCC | 0xF0 == 0xF4) assert(0xF0 & 0x0F + 1 == 0x10) assert(3^4//2^3//5 == 2) assert(-3+4*5//2^3^2//9+4%10/3 == (-3)+(((4*5)//(2^(3^2)))//9)+((4%10)/3)) assert(not ((true or false) and nil)) assert( true or false and nil) -- old bug assert((((1 or false) and true) or false) == true) assert((((nil and true) or false) and true) == false) local a,b = 1,nil; assert(-(1 or 2) == -1 and (1 and 2)+(-1.25 or -4) == 0.75); x = ((b or a)+1 == 2 and (10 or a)+1 == 11); assert(x); x = (((2<3) or 1) == true and (2<3 and 4) == 4); assert(x); x,y=1,2; assert((x>y) and x or y == 2); x,y=2,1; assert((x>y) and x or y == 2); assert(1234567890 == tonumber('1234567890') and 1234567890+1 == 1234567891) -- silly loops repeat until 1; repeat until true; while false do end; while nil do end; do -- test old bug (first name could not be an `upvalue') local a; function f(x) x={a=1}; x={x=1}; x={G=1} end end function f (i) if type(i) ~= 'number' then return i,'jojo'; end; if i > 0 then return i, f(i-1); end; end x = {f(3), f(5), f(10);}; assert(x[1] == 3 and x[2] == 5 and x[3] == 10 and x[4] == 9 and x[12] == 1); assert(x[nil] == nil) x = {f'alo', f'xixi', nil}; assert(x[1] == 'alo' and x[2] == 'xixi' and x[3] == nil); x = {f'alo'..'xixi'}; assert(x[1] == 'aloxixi') x = {f{}} assert(x[2] == 'jojo' and type(x[1]) == 'table') local f = function (i) if i < 10 then return 'a'; elseif i < 20 then return 'b'; elseif i < 30 then return 'c'; end; end assert(f(3) == 'a' and f(12) == 'b' and f(26) == 'c' and f(100) == nil) for i=1,1000 do break; end; n=100; i=3; t = {}; a=nil while not a do a=0; for i=1,n do for i=i,1,-1 do a=a+1; t[i]=1; end; end; end assert(a == n*(n+1)/2 and i==3); assert(t[1] and t[n] and not t[0] and not t[n+1]) function f(b) local x = 1; repeat local a; if b==1 then local b=1; x=10; break elseif b==2 then x=20; break; elseif b==3 then x=30; else local a,b,c,d=math.sin(1); x=x+1; end until x>=12; return x; end; assert(f(1) == 10 and f(2) == 20 and f(3) == 30 and f(4)==12) local f = function (i) if i < 10 then return 'a' elseif i < 20 then return 'b' elseif i < 30 then return 'c' else return 8 end end assert(f(3) == 'a' and f(12) == 'b' and f(26) == 'c' and f(100) == 8) local a, b = nil, 23 x = {f(100)*2+3 or a, a or b+2} assert(x[1] == 19 and x[2] == 25) x = {f=2+3 or a, a = b+2} assert(x.f == 5 and x.a == 25) a={y=1} x = {a.y} assert(x[1] == 1) function f(i) while 1 do if i>0 then i=i-1; else return; end; end; end; function g(i) while 1 do if i>0 then i=i-1 else return end end end f(10); g(10); do function f () return 1,2,3; end local a, b, c = f(); assert(a==1 and b==2 and c==3) a, b, c = (f()); assert(a==1 and b==nil and c==nil) end local a,b = 3 and f(); assert(a==1 and b==nil) function g() f(); return; end; assert(g() == nil) function g() return nil or f() end a,b = g() assert(a==1 and b==nil) print'+'; f = [[ return function ( a , b , c , d , e ) local x = a >= b or c or ( d and e ) or nil return x end , { a = 1 , b = 2 >= 1 , } or { 1 }; ]] f = string.gsub(f, "%s+", "\n"); -- force a SETLINE between opcodes f,a = load(f)(); assert(a.a == 1 and a.b) function g (a,b,c,d,e) if not (a>=b or c or d and e or nil) then return 0; else return 1; end; end function h (a,b,c,d,e) while (a>=b or c or (d and e) or nil) do return 1; end; return 0; end; assert(f(2,1) == true and g(2,1) == 1 and h(2,1) == 1) assert(f(1,2,'a') == 'a' and g(1,2,'a') == 1 and h(1,2,'a') == 1) assert(f(1,2,'a') ~= -- force SETLINE before nil nil, "") assert(f(1,2,'a') == 'a' and g(1,2,'a') == 1 and h(1,2,'a') == 1) assert(f(1,2,nil,1,'x') == 'x' and g(1,2,nil,1,'x') == 1 and h(1,2,nil,1,'x') == 1) assert(f(1,2,nil,nil,'x') == nil and g(1,2,nil,nil,'x') == 0 and h(1,2,nil,nil,'x') == 0) assert(f(1,2,nil,1,nil) == nil and g(1,2,nil,1,nil) == 0 and h(1,2,nil,1,nil) == 0) assert(1 and 2<3 == true and 2<3 and 'a'<'b' == true) x = 2<3 and not 3; assert(x==false) x = 2<1 or (2>1 and 'a'); assert(x=='a') do local a; if nil then a=1; else a=2; end; -- this nil comes as PUSHNIL 2 assert(a==2) end function F(a) assert(debug.getinfo(1, "n").name == 'F') return a,2,3 end a,b = F(1)~=nil; assert(a == true and b == nil); a,b = F(nil)==nil; assert(a == true and b == nil) ---------------------------------------------------------------- ------------------------------------------------------------------ -- sometimes will be 0, sometimes will not... _ENV.GLOB1 = math.floor(os.time()) % 2 -- basic expressions with their respective values local basiccases = { {"nil", nil}, {"false", false}, {"true", true}, {"10", 10}, {"(0==_ENV.GLOB1)", 0 == _ENV.GLOB1}, } print('testing short-circuit optimizations (' .. _ENV.GLOB1 .. ')') -- operators with their respective values local binops = { {" and ", function (a,b) if not a then return a else return b end end}, {" or ", function (a,b) if a then return a else return b end end}, } local cases = {} -- creates all combinations of '(cases[i] op cases[n-i])' plus -- 'not(cases[i] op cases[n-i])' (syntax + value) local function createcases (n) local res = {} for i = 1, n - 1 do for _, v1 in ipairs(cases[i]) do for _, v2 in ipairs(cases[n - i]) do for _, op in ipairs(binops) do local t = { "(" .. v1[1] .. op[1] .. v2[1] .. ")", op[2](v1[2], v2[2]) } res[#res + 1] = t res[#res + 1] = {"not" .. t[1], not t[2]} end end end end return res end -- do not do too many combinations for soft tests local level = _soft and 3 or 4 cases[1] = basiccases for i = 2, level do cases[i] = createcases(i) end print("+") local prog = [[if %s then IX = true end; return %s]] local i = 0 for n = 1, level do for _, v in pairs(cases[n]) do local s = v[1] local p = load(string.format(prog, s, s), "") IX = false assert(p() == v[2] and IX == not not v[2]) i = i + 1 if i % 60000 == 0 then print('+') end end end ------------------------------------------------------------------ -- testing some syntax errors (chosen through 'gcov') assert(string.find(select(2, load("for x do")), "expected")) assert(string.find(select(2, load("x:call")), "expected")) print'OK'
bsd-3-clause
Xeltor/ovale
dist/spellhelpers/warlock_demonology_helper.lua
1
3995
local __exports = LibStub:GetLibrary("ovale/scripts/ovale_warlock") if not __exports then return end __exports.registerWarlockDemonologyHelper = function(OvaleScripts) do local name = "WLKDEMOhelp" local desc = "[Xel][8.x] Spellhelper: Demonology" local code = [[ AddIcon { # Remove a line when you have its colour # Spells Texture(spell_shadow_shadowbolt) # Shadow Bolt Texture(ability_warlock_handofguldan) # Hand of Gul'dan Texture(inv__demonbolt) # Demonbolt Texture(inv_implosion) # Implosion Texture(ability_warrior_titansgrip) # Axe Toss (command demon) Texture(spell_shadow_mindrot) # Spell Lock (command demon) # Survival stuff Texture(spell_shadow_lifedrain02) # Drain Life Texture(ability_deathwing_bloodcorruption_death) # Health Funnel Texture(inv_misc_gem_bloodstone_01) # Create Healthstone Texture(inv_stone_04) # Healthstone Texture(spell_shadow_demonictactics) # Unending Resolve # Buffs Texture(inv_summondemonictyrant) # Summon Demonic Tyrant Texture(spell_warlock_calldreadstalkers) # Call Dreadstalkers Texture(spell_shadow_demonbreath) # Unending Breath Texture(spell_warlock_summonwrathguard) # Summon Felguard # Items Texture(inv_jewelry_talisman_12) # Trinkets # Heart of Azeroth Skills Texture(spell_azerite_essence_15) # Concentrated Flame Texture(spell_azerite_essence05) # Memory of Lucid Dreams Texture(298277) # Blood of the Enemy Texture(spell_azerite_essence14) # Guardian of Azeroth Texture(spell_azerite_essence12) # Focused Azerite Beam Texture(spell_azerite_essence04) # Purifying Blast Texture(spell_azerite_essence10) # Ripple in Space Texture(spell_azerite_essence03) # The Unbound Force Texture(inv_misc_azerite_01) # Worldvein Resonance Texture(ability_essence_reapingflames) # Reaping Flames Texture(ability_essence_momentofglory) # Moment of Glory Texture(ability_essence_replicaofknowledge) # Replica of Knowledge # Talents Texture(ability_warlock_demonicempowerment) # Demonic Strength (T1) Texture(ability_hunter_pet_bat) # Bilescourge Bombers (T1) Texture(ability_warlock_backdraft) # Power Siphon (T2) Texture(spell_shadow_shadowbolt) # Doom (T2) Texture(inv_polearm_2h_fellord_04) # Soul Strike (T4) Texture(inv_argusfelstalkermount) # Summon Vilefiend (T4) Texture(ability_warlock_mortalcoil) # Mortal Coil (T5) Texture(spell_shadow_summonfelguard) # Grimoire: Felguard (T6) Texture(inv_netherportal) # Nether Portal (T7) # Racials Texture(racial_orc_berserkerstrength) # Blood Fury (Orc) Texture(racial_troll_berserk) # Berserking (Troll) Texture(spell_shadow_teleport) # Arcane Torrent (Blood Elf) Texture(ability_warstomp) # War Stomp (Tauren) Texture(spell_shadow_raisedead) # Will of the Forsaken (Undead) Texture(inv_gizmo_rocketlauncher) # Rocket Barrage (Goblin) Texture(pandarenracial_quiveringpain) # Quaking Palm (Pandaren) Texture(spell_shadow_unholystrength) # Stoneform (Dwarf) Texture(spell_shadow_charm) # Every Man for Himself (Human) Texture(spell_holy_holyprotection) # Gift of the Naaru (Draenei) Texture(ability_racial_darkflight) # Darkflight (Worgen) Texture(ability_rogue_trip) # Escape Artist (Gnome) Texture(ability_ambush) # Shadowmeld (Night elf) Texture(ability_racial_forceshield) # Arcane Pulse (Nightborne) Texture(ability_racial_bullrush) # Bull Rush (Highmountain Tauren) Texture(ability_racial_orbitalstrike) # Light's Judgment (Lightforged Draenei) Texture(ability_racial_ancestralcall) # Ancestral Call (Mag'har Orcs) Texture(ability_racial_fireblood) # Fireblood (Dark Iron Dwarves) Texture(ability_racial_haymaker) # Haymaker (Kul Tiran Human) Texture(ability_racial_regeneratin) # Regeneratin (Zandalari Trolls) Texture(ability_racial_hyperorganiclightoriginator) # Hyper Organic Light Originator (Mechagnome) Texture(ability_racial_bagoftricks) # Bag of Tricks (Vulpera) } ]] OvaleScripts:RegisterScript("WARLOCK", "demonology", name, desc, code, "script") end end
mit
TheAnswer/FirstTest
bin/scripts/creatures/objects/dantooine/npcs/janta/jantaPrimalist.lua
1
4858
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. jantaPrimalist = Creature:new { objectName = "jantaPrimalist", -- Lua Object Name creatureType = "NPC", faction = "janta_tribe", factionPoints = 20, gender = "", speciesName = "janta_primalist", stfName = "mob/creature_names", objectCRC = 4083847450, socialGroup = "janta_tribe", level = 42, combatFlags = ATTACKABLE_FLAG, healthMax = 11900, healthMin = 9700, strength = 500, constitution = 500, actionMax = 11900, actionMin = 9700, quickness = 500, stamina = 500, mindMax = 11900, mindMin = 9700, focus = 500, willpower = 500, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = -1, energy = 0, electricity = 60, stun = -1, blast = -1, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 300, healer = 0, pack = 1, herd = 1, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/melee/polearm/shared_lance_staff_wood_s1.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "a Wooden Staff", -- Name ex. 'a Vibrolance' weaponTemp = "lance_staff_wood_s1", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "PolearmMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 1, weaponMinDamage = 405, weaponMaxDamage = 520, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "object/weapon/melee/knife/shared_knife_stone.iff", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "a Stone Knife", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "knife_stone", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "OneHandedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 1, alternateWeaponMinDamage = 405, alternateWeaponMaxDamage = 520, alternateweaponAttackSpeed = 2, alternateWeaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0,11,15,19,33,65", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "kungaAttack01", "kungaAttack02", "kungaAttack03", "kungaAttack04", "kungaAttack05", "kungaAttack06", "kungaAttack07", "kungaAttack08" }, respawnTimer = 300, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(jantaPrimalist, 4083847450) -- Add to Global Table
lgpl-3.0
weiDDD/WSSParticleSystem
cocos2d/cocos/scripting/lua-bindings/auto/api/TextField.lua
1
12913
-------------------------------- -- @module TextField -- @extend Widget -- @parent_module ccui -------------------------------- -- brief Toggle attach with IME.<br> -- param attach True if attach with IME, false otherwise. -- @function [parent=#TextField] setAttachWithIME -- @param self -- @param #bool attach -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Query the font size.<br> -- return The integer font size. -- @function [parent=#TextField] getFontSize -- @param self -- @return int#int ret (return value: int) -------------------------------- -- Query the content of TextField.<br> -- return The string value of TextField. -- @function [parent=#TextField] getString -- @param self -- @return string#string ret (return value: string) -------------------------------- -- brief Change password style text.<br> -- param styleText The styleText for password mask, the default value is "*". -- @function [parent=#TextField] setPasswordStyleText -- @param self -- @param #char styleText -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Whether it is ready to delete backward in TextField.<br> -- return True is the delete backward is enabled, false otherwise. -- @function [parent=#TextField] getDeleteBackward -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- brief Get the placeholder of TextField.<br> -- return A placeholder string. -- @function [parent=#TextField] getPlaceHolder -- @param self -- @return string#string ret (return value: string) -------------------------------- -- brief Query whether the IME is attached or not.<br> -- return True if IME is attached, false otherwise. -- @function [parent=#TextField] getAttachWithIME -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- brief Change the font name of TextField.<br> -- param name The font name string. -- @function [parent=#TextField] setFontName -- @param self -- @param #string name -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Whether it is ready to get the inserted text or not.<br> -- return True if the insert text is ready, false otherwise. -- @function [parent=#TextField] getInsertText -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- brief Toggle enable insert text mode<br> -- param insertText True if enable insert text, false otherwise. -- @function [parent=#TextField] setInsertText -- @param self -- @param #bool insertText -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- Change content of TextField.<br> -- param text A string content. -- @function [parent=#TextField] setString -- @param self -- @param #string text -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Query whether IME is detached or not.<br> -- return True if IME is detached, false otherwise. -- @function [parent=#TextField] getDetachWithIME -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- brief Change the vertical text alignment.<br> -- param alignment A alignment arguments in @see `TextVAlignment`. -- @function [parent=#TextField] setTextVerticalAlignment -- @param self -- @param #int alignment -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- Add a event listener to TextField, when some predefined event happens, the callback will be called.<br> -- param callback A callback function with type of `ccTextFieldCallback`. -- @function [parent=#TextField] addEventListener -- @param self -- @param #function callback -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Detach the IME. -- @function [parent=#TextField] didNotSelectSelf -- @param self -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Query the TextField's font name.<br> -- return The font name string. -- @function [parent=#TextField] getFontName -- @param self -- @return string#string ret (return value: string) -------------------------------- -- brief Change the text area size.<br> -- param size A delimitation zone. -- @function [parent=#TextField] setTextAreaSize -- @param self -- @param #size_table size -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Attach the IME for inputing. -- @function [parent=#TextField] attachWithIME -- @param self -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Query the input string length.<br> -- return A integer length value. -- @function [parent=#TextField] getStringLength -- @param self -- @return int#int ret (return value: int) -------------------------------- -- brief Get the the renderer size in auto mode.<br> -- return A delimitation zone. -- @function [parent=#TextField] getAutoRenderSize -- @param self -- @return size_table#size_table ret (return value: size_table) -------------------------------- -- brief Toggle enable password input mode.<br> -- param enable True if enable password input mode, false otherwise. -- @function [parent=#TextField] setPasswordEnabled -- @param self -- @param #bool enable -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Query the placeholder string color.<br> -- return The color of placeholder. -- @function [parent=#TextField] getPlaceHolderColor -- @param self -- @return color4b_table#color4b_table ret (return value: color4b_table) -------------------------------- -- brief Query the password style text.<br> -- return A password style text. -- @function [parent=#TextField] getPasswordStyleText -- @param self -- @return char#char ret (return value: char) -------------------------------- -- brief Toggle maximize length enable<br> -- param enable True if enable maximize length, false otherwise. -- @function [parent=#TextField] setMaxLengthEnabled -- @param self -- @param #bool enable -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Query whether password is enabled or not.<br> -- return True if password is enabled, false otherwise. -- @function [parent=#TextField] isPasswordEnabled -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- brief Toggle enable delete backward mode.<br> -- param deleteBackward True is delete backward is enabled, false otherwise. -- @function [parent=#TextField] setDeleteBackward -- @param self -- @param #bool deleteBackward -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Change font size of TextField.<br> -- param size The integer font size. -- @function [parent=#TextField] setFontSize -- @param self -- @param #int size -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Set placeholder of TextField.<br> -- param value The string value of placeholder. -- @function [parent=#TextField] setPlaceHolder -- @param self -- @param #string value -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- @overload self, color4b_table -- @overload self, color3b_table -- @function [parent=#TextField] setPlaceHolderColor -- @param self -- @param #color3b_table color -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Change horizontal text alignment.<br> -- param alignment A alignment arguments in @see `TextHAlignment`. -- @function [parent=#TextField] setTextHorizontalAlignment -- @param self -- @param #int alignment -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Change the text color.<br> -- param textColor The color value in `Color4B`. -- @function [parent=#TextField] setTextColor -- @param self -- @param #color4b_table textColor -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Query maximize input length of TextField.<br> -- return The integer value of maximize input length. -- @function [parent=#TextField] getMaxLength -- @param self -- @return int#int ret (return value: int) -------------------------------- -- brief Query whether max length is enabled or not.<br> -- return True if maximize length is enabled, false otherwise. -- @function [parent=#TextField] isMaxLengthEnabled -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- brief Toggle detach with IME.<br> -- param detach True if detach with IME, false otherwise. -- @function [parent=#TextField] setDetachWithIME -- @param self -- @param #bool detach -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Toggle enable touch area.<br> -- param enable True if enable touch area, false otherwise. -- @function [parent=#TextField] setTouchAreaEnabled -- @param self -- @param #bool enable -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Change maximize input length limitation.<br> -- param length A character count in integer. -- @function [parent=#TextField] setMaxLength -- @param self -- @param #int length -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Set the touch size<br> -- The touch size is used for @see `hitTest`.<br> -- param size A delimitation zone. -- @function [parent=#TextField] setTouchSize -- @param self -- @param #size_table size -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- brief Get current touch size of TextField.<br> -- return The TextField's touch size. -- @function [parent=#TextField] getTouchSize -- @param self -- @return size_table#size_table ret (return value: size_table) -------------------------------- -- @overload self, string, string, int -- @overload self -- @function [parent=#TextField] create -- @param self -- @param #string placeholder -- @param #string fontName -- @param #int fontSize -- @return TextField#TextField ret (return value: ccui.TextField) -------------------------------- -- -- @function [parent=#TextField] createInstance -- @param self -- @return Ref#Ref ret (return value: cc.Ref) -------------------------------- -- -- @function [parent=#TextField] getVirtualRenderer -- @param self -- @return Node#Node ret (return value: cc.Node) -------------------------------- -- -- @function [parent=#TextField] setNodeString -- @param self -- @param #string str -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- Returns the "class name" of widget. -- @function [parent=#TextField] getDescription -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#TextField] update -- @param self -- @param #float dt -- @return TextField#TextField self (return value: ccui.TextField) -------------------------------- -- -- @function [parent=#TextField] hitTest -- @param self -- @param #vec2_table pt -- @return bool#bool ret (return value: bool) -------------------------------- -- -- @function [parent=#TextField] getNodeString -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#TextField] getVirtualRendererSize -- @param self -- @return size_table#size_table ret (return value: size_table) -------------------------------- -- brief Default constructor. -- @function [parent=#TextField] TextField -- @param self -- @return TextField#TextField self (return value: ccui.TextField) return nil
apache-2.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/endor/npcs/gundula/gundulaVeteran.lua
1
4580
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. gundulakVeteran = Creature:new { objectName = "gundulakVeteran", -- Lua Object Name creatureType = "NPC", faction = "gondula_tribe", factionPoints = 20, gender = "", speciesName = "gondula_veteran", stfName = "mob/creature_names", objectCRC = 3253486254, socialGroup = "gondula_tribe", level = 35, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 10800, healthMin = 8800, strength = 0, constitution = 0, actionMax = 10800, actionMin = 8800, quickness = 0, stamina = 0, mindMax = 10800, mindMin = 8800, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 40, energy = 30, electricity = -1, stun = -1, blast = 0, heat = 50, cold = 50, acid = -1, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 320, weaponMaxDamage = 350, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "", "", "" }, respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(gundulakVeteran, 3253486254) -- Add to Global Table
lgpl-3.0
weiDDD/WSSParticleSystem
cocos2d/cocos/scripting/lua-bindings/auto/api/TransitionTurnOffTiles.lua
1
1196
-------------------------------- -- @module TransitionTurnOffTiles -- @extend TransitionScene,TransitionEaseScene -- @parent_module cc -------------------------------- -- -- @function [parent=#TransitionTurnOffTiles] easeActionWithAction -- @param self -- @param #cc.ActionInterval action -- @return ActionInterval#ActionInterval ret (return value: cc.ActionInterval) -------------------------------- -- Creates a transition with duration and incoming scene.<br> -- param t Duration time, in seconds.<br> -- param scene A given scene.<br> -- return A autoreleased TransitionTurnOffTiles object. -- @function [parent=#TransitionTurnOffTiles] create -- @param self -- @param #float t -- @param #cc.Scene scene -- @return TransitionTurnOffTiles#TransitionTurnOffTiles ret (return value: cc.TransitionTurnOffTiles) -------------------------------- -- js NA -- @function [parent=#TransitionTurnOffTiles] draw -- @param self -- @param #cc.Renderer renderer -- @param #mat4_table transform -- @param #unsigned int flags -- @return TransitionTurnOffTiles#TransitionTurnOffTiles self (return value: cc.TransitionTurnOffTiles) return nil
apache-2.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/rori/creatures/femaleKaiTok.lua
1
4732
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. femaleKaiTok = Creature:new { objectName = "femaleKaiTok", -- Lua Object Name creatureType = "ANIMAL", gender = "female", speciesName = "female_kai_tok", stfName = "mob/creature_names", objectCRC = 1823266132, socialGroup = "KaiTok", level = 13, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 1400, healthMin = 1200, strength = 0, constitution = 0, actionMax = 1400, actionMin = 1200, quickness = 0, stamina = 0, mindMax = 1400, mindMin = 1200, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 15, electricity = 0, stun = -1, blast = 0, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 130, weaponMaxDamage = 140, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0.25, -- Likely hood to be tamed datapadItemCRC = 3450820067, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "bone_avian_rori", boneMax = 46, hideType = "hide_leathery_rori", hideMax = 41, meatType = "meat_carnivore_rori", meatMax = 25, --skills = { " Stun attack", " Ranged attack (spit)", "" } skills = { "kaiTokAttack1", "kaiTokAttack2" }, respawnTimer = 60, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(femaleKaiTok, 1823266132) -- Add to Global Table
lgpl-3.0
mkwia/jc2atc
default_config.lua
1
6003
-- Welcome to the JC2-MP server configuration file! --[[ SERVER OPTIONS Server-related options. --]] Server = { -- The maximum number of players that can be on the server at any -- given time. Make sure your connection and server can handle it! -- Default value: 5000 MaxPlayers = 5000, -- Used to control what IP this server binds to. Unless you're a dedicated -- game host, you don't need to worry about this. -- Default value: "" BindIP = "", -- The port the server uses. -- Default value: 7777 BindPort = 7777, -- The time before a player is timed out after temporarily losing -- connection, or crashing without properly disconnecting. -- Default value (in milliseconds): 10000 Timeout = 10000, -- The name of the server, as seen by players and the server browser. -- Default value: "JC2-MP Server" Name = "JC2-MP Server", -- The server description, as seen by players and the server browser. -- Default value: "No description available" Description = "No description available.", -- The server password. -- Default value: "" Password = "", -- Controls whether the server announces its presence to the master server -- and therefore to the server browser. -- Default value: true Announce = true, -- Controls how often synchronization packets are broadcast by the server -- in milliseconds -- Default value (in milliseconds): 180 SyncUpdate = 180, -- CAUTION: Setting this variable to true unlocks a number of potentially -- unsafe operations, which include: -- * Native Lua packages (.dll, .so) -- * Execution of Lua from arbitrary paths (Access to loadfile/dofile) -- * Unbound io functions, allowing for access to the entire file-system -- Default value: false IKnowWhatImDoing = false } --[[ SYNCRATE OPTIONS Sync rate options. These values control how often synchronization packets are sent by the clients, in milliseconds. This lets you control how frequent the sync comes in, which may result in a smoother or less laggy experience --]] SyncRates = { -- Default value (in milliseconds): 75 Vehicle = 75, -- Default value (in milliseconds): 120 OnFoot = 120, -- Default value (in milliseconds): 1000 Passenger = 1000, -- Default value (in milliseconds): 250 MountedGun = 250, -- Default value (in milliseconds): 350 StuntPosition = 350 } --[[ STREAMER OPTIONS Streamer-related options. The streamer is responsible for controlling the visibility of objects (including players and vehicles) for other players. What this means is that if you want to extend the distance at which objects remain visible for players, you need to change the StreamDistance. --]] Streamer = { -- The default distance before objects are streamed out. -- Default value (in metres): 500 StreamDistance = 500 } --[[ VEHICLE OPTIONS Vehicle-related options. --]] Vehicle = { -- The number of seconds required for a vehicle to respawn after -- vehicle death. -- Default value (in seconds): 10 -- For instant respawn: 0 -- For no respawning: nil DeathRespawnTime = 10, -- Controls whether to remove the vehicle if respawning is turned off, -- and the vehicle dies. -- Default value: false DeathRemove = false, -- The number of seconds required for a vehicle to respawn after it is -- left unoccupied. -- Default value (in seconds): 45 -- For instant respawn: 0 -- For no respawning: nil UnoccupiedRespawnTime = 45, -- Controls whether to remove the vehicle if respawning is turned off, -- and the vehicle is left unoccupied. -- Default value: false UnoccupiedRemove = false, } --[[ PLAYER OPTIONS Player-related options. --]] Player = { -- The default spawn position for players. If you do not use a script -- to handle spawns, such as the freeroam script, then this spawn position -- will be used. -- Default value: Vector3( -6550, 209, -3290 ) SpawnPosition = Vector3( -6550, 209, -3290 ) } --[[ MODULE OPTIONS Lua module-related options. --]] Module = { --[[ To prevent a large number of errors building up, modules are automatically unloaded after a certain number of errors in a given timespan. Each error adds to a counter, which is decremented if there has not been an error in a certain amount of time. This allows you to adjust the number of errors before the module is unloaded, as well as the time since the last error for the counter to be decremented. --]] -- The maximum number of errors before a module is unloaded. -- Default value: 5 MaxErrorCount = 5, -- The time from the last error necessary for the error counter to be decremented. -- Default value (in milliseconds): 500 ErrorDecrementTime = 500, -- Controls whether autorun scripts (as controlled by IKnowWhatImDoing) should be -- sent to clients for empty modules. Don't turn this on unless you're willing to -- accept the bandwidth hit and know what you're doing! -- Default value: false SendAutorunWhenEmpty = false } --[[ WORLD OPTIONS Default settings for worlds. --]] World = { -- The default time of day at world creation. -- Default value (in hours): 0.0 Time = 0.0, -- The increment added to the time of day each second. -- Default value (in minutes): 1 TimeStep = 1, -- The default weather severity at world creation. -- Default value: 0 WeatherSeverity = 0 }
mit
TheAnswer/FirstTest
bin/scripts/creatures/objects/corellia/npcs/drall/drallGuard.lua
1
4521
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. drallGuard = Creature:new { objectName = "drallGuard", -- Lua Object Name creatureType = "NPC", faction = "Drall 0", gender = "", speciesName = "drall_guard", stfName = "mob/creature_names", objectCRC = 3116494340, socialGroup = "drall", level = 11, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 1200, healthMin = 1000, strength = 0, constitution = 0, actionMax = 1200, actionMin = 1000, quickness = 0, stamina = 0, mindMax = 1200, mindMin = 1000, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = 0, stun = -1, blast = 0, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 120, weaponMaxDamage = 130, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateweaponAttackSpeed = 2, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateweaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "", "", "" }, respawnTimer = 180, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(drallGuard, 3116494340) -- Add to Global Table
lgpl-3.0
mynameis123/uzzbot
plugins/bugzilla.lua
611
3983
do local BASE_URL = "https://bugzilla.mozilla.org/rest/" local function bugzilla_login() local url = BASE_URL.."login?login=" .. _config.bugzilla.username .. "&password=" .. _config.bugzilla.password print("accessing " .. url) local res,code = https.request( url ) local data = json:decode(res) return data end local function bugzilla_check(id) -- data = bugzilla_login() local url = BASE_URL.."bug/" .. id .. "?api_key=" .. _config.bugzilla.apikey -- print(url) local res,code = https.request( url ) local data = json:decode(res) return data end local function bugzilla_listopened(email) local url = BASE_URL.."bug?include_fields=id,summary,status,whiteboard,resolution&email1=" .. email .. "&email2=" .. email .. "&emailassigned_to2=1&emailreporter1=1&emailtype1=substring&emailtype2=substring&f1=bug_status&f2=bug_status&n1=1&n2=1&o1=equals&o2=equals&resolution=---&v1=closed&v2=resolved&api_key=" .. _config.bugzilla.apikey local res,code = https.request( url ) print(res) local data = json:decode(res) return data end local function run(msg, matches) local response = "" if matches[1] == "status" then local data = bugzilla_check(matches[2]) vardump(data) if data.error == true then return "Sorry, API failed with message: " .. data.message else response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator response = response .. "\n Last update: "..data.bugs[1].last_change_time response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1] print(response) end elseif matches[1] == "list" then local data = bugzilla_listopened(matches[2]) vardump(data) if data.error == true then return "Sorry, API failed with message: " .. data.message else -- response = "Bug #"..matches[1]..":\nReporter: "..data.bugs[1].creator -- response = response .. "\n Last update: "..data.bugs[1].last_change_time -- response = response .. "\n Status: "..data.bugs[1].status.." "..data.bugs[1].resolution -- response = response .. "\n Whiteboard: "..data.bugs[1].whiteboard -- response = response .. "\n Access: https://bugzilla.mozilla.org/show_bug.cgi?id=" .. matches[1] local total = table.map_length(data.bugs) print("total bugs: " .. total) local response = "There are " .. total .. " number of bug(s) assigned/reported by " .. matches[2] if total > 0 then response = response .. ": " for tableKey, bug in pairs(data.bugs) do response = response .. "\n #" .. bug.id response = response .. "\n Status: " .. bug.status .. " " .. bug.resolution response = response .. "\n Whiteboard: " .. bug.whiteboard response = response .. "\n Summary: " .. bug.summary end end end end return response end -- (table) -- [bugs] = (table) -- [1] = (table) -- [status] = (string) ASSIGNED -- [id] = (number) 927704 -- [whiteboard] = (string) [approved][full processed] -- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/mozilla-summit-2013/ -- [2] = (table) -- [status] = (string) ASSIGNED -- [id] = (number) 1049337 -- [whiteboard] = (string) [approved][full processed][waiting receipts][waiting report and photos] -- [summary] = (string) Budget Request - Arief Bayu Purwanto - https://reps.mozilla.org/e/workshop-firefox-os-pada-workshop-media-sosial-untuk-perubahan-1/ -- total bugs: 2 return { description = "Lookup bugzilla status update", usage = "/bot bugzilla [bug number]", patterns = { "^/bugzilla (status) (.*)$", "^/bugzilla (list) (.*)$" }, run = run } end
gpl-2.0
kyle-lu/fceux.js
output/luaScripts/taseditor/RecordBackwards.lua
7
4179
--------------------------------------------------------------------------- -- Recording Input while Rewinding Playback frame-by-frame -- by AnS, 2012 --------------------------------------------------------------------------- -- Showcases following functions: -- * joypad.getimmediate() -- * taseditor.getrecordermode() -- * taseditor.getsuperimpose() -- * taseditor.getinput() -- * taseditor.setinput() -- * taseditor.clearinputchanges() -- * taseditor.applyinputchanges() --------------------------------------------------------------------------- -- Usage: -- Run the script, unpause emulation (or simply Frame Advance once). -- Now you can hold some joypad buttons and press "Rewind Frame" hotkey -- to Record those buttons into PREVIOUS frame. -- Try using this crazy method alongside with Frame Advance Recording. -- This script supports multitracking and superimpose. Doesn't support Patterns. --------------------------------------------------------------------------- -- This function reads joypad input table and converts it to single byte function GetCurrentInputByte(player) input_byte = 0; input_table = joypad.getimmediate(player); if (input_table ~= nil) then -- A B select start up down left right if (input_table.A) then input_byte = OR(input_byte, 1) end; if (input_table.B) then input_byte = OR(input_byte, 2) end; if (input_table.select) then input_byte = OR(input_byte, 4) end; if (input_table.start) then input_byte = OR(input_byte, 8) end; if (input_table.up) then input_byte = OR(input_byte, 16) end; if (input_table.down) then input_byte = OR(input_byte, 32) end; if (input_table.left) then input_byte = OR(input_byte, 64) end; if (input_table.right) then input_byte = OR(input_byte, 128) end; end return input_byte; end function reversed_recorder() if taseditor.engaged() then playback_position = movie.framecount(); if (playback_position == (playback_last_position - 1)) then -- Playback cursor moved up 1 frame, probably Rewind was used this frame if (not movie.readonly()) then -- Recording on recording_mode = taseditor.getrecordermode(); superimpose = taseditor.getsuperimpose(); taseditor.clearinputchanges(); name = "Record"; if (recording_mode == "All") then -- Recording all 4 joypads for target_player = 1, 4 do new_joypad_input = GetCurrentInputByte(target_player); old_joypad_input = taseditor.getinput(playback_position, target_player); -- Superimpose with old input if needed if (superimpose == 1 or (superimpose == 2 and new_joypad_input == 0)) then new_joypad_input = OR(new_joypad_input, old_joypad_input); end -- Add joypad info to name if (new_joypad_input ~= old_joypad_input) then name = name .. "(" .. target_player .. "P)"; end taseditor.submitinputchange(playback_position, target_player, new_joypad_input); end -- Write to movie data taseditor.applyinputchanges(name); else -- Recording target_player using 1P keys new_joypad_input = GetCurrentInputByte(1); target_player = 1; if (recording_mode == "2P") then target_player = 2 end; if (recording_mode == "3P") then target_player = 3 end; if (recording_mode == "4P") then target_player = 4 end; old_joypad_input = taseditor.getinput(playback_position, target_player); -- Superimpose with old input if needed if (superimpose == 1 or (superimpose == 2 and new_joypad_input == 0)) then new_joypad_input = OR(new_joypad_input, old_joypad_input); end -- Add joypad info to name if (new_joypad_input ~= old_joypad_input) then name = name .. "(" .. recording_mode .. ")"; end -- Write to movie data taseditor.submitinputchange(playback_position, target_player, new_joypad_input); taseditor.applyinputchanges(name); end end end playback_last_position = playback_position; else gui.text(1, 9, "TAS Editor is not engaged."); end end playback_last_position = movie.framecount(); taseditor.registerauto(reversed_recorder);
gpl-2.0
TheAnswer/FirstTest
bin/scripts/items/objects/clothing/shirts/shirt28.lua
1
2232
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. shirt28 = Clothing:new { objectName = "Dress Blouse", templateName = "shirt_s28", objectCRC = "3497496979", objectType = SHIRT, itemMask = HUMANOID_FEMALES, equipped = "0" }
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/tailor/formalWearIiJewelry/suitBelt.lua
1
3849
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. suitBelt = Object:new { objectName = "Suit Belt", stfName = "belt_s12", stfFile = "wearables_name", objectCRC = 4066865224, groupName = "craftClothingFormalGroupB", -- Group schematic is awarded in (See skills table) craftingToolTab = 8, -- (See DraftSchemticImplementation.h) complexity = 15, size = 3, xpType = "crafting_clothing_general", xp = 135, assemblySkill = "clothing_assembly", experimentingSkill = "clothing_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "shell, binding_and_reinforcement, hardware", ingredientSlotType = "0, 0, 0", resourceTypes = "hide, petrochem_inert, gemstone_crystalline", resourceQuantities = "25, 25, 5", combineTypes = "0, 0, 0", contribution = "100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hitpoints", experimentalMin = "0, 0, 0, 1000", experimentalMax = "0, 0, 0, 1000", experimentalPrecision = "0, 0, 0, 0", tanoAttributes = "objecttype=16777218:objectcrc=1415002955:stfFile=wearables_name:stfName=clothing_belt_formal_12:stfDetail=:itemmask=65535::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "/private/index_color_1, /private/index_color_2", customizationDefaults = "0, 0", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(suitBelt, 4066865224)--- Add to global DraftSchematics table
lgpl-3.0
weiDDD/WSSParticleSystem
cocos2d/cocos/scripting/lua-bindings/script/cocosbuilder/DeprecatedCocosBuilderClass.lua
1
1213
if nil == cc.CCBProxy then return end -- This is the DeprecatedCocosBuilderClass DeprecatedCocosBuilderClass = {} or DeprecatedCocosBuilderClass --tip local function deprecatedTip(old_name,new_name) --print("\n********** \n"..old_name.." was deprecated please use ".. new_name .. " instead.\n**********") end --CCBReader class will be Deprecated,begin function DeprecatedCocosBuilderClass.CCBReader() deprecatedTip("CCBReader","cc.BReader") return cc.BReader end _G["CCBReader"] = DeprecatedCocosBuilderClass.CCBReader() --CCBReader class will be Deprecated,end --CCBAnimationManager class will be Deprecated,begin function DeprecatedCocosBuilderClass.CCBAnimationManager() deprecatedTip("CCBAnimationManager","cc.BAnimationManager") return cc.BAnimationManager end _G["CCBAnimationManager"] = DeprecatedCocosBuilderClass.CCBAnimationManager() --CCBAnimationManager class will be Deprecated,end --CCBProxy class will be Deprecated,begin function DeprecatedCocosBuilderClass.CCBProxy() deprecatedTip("CCBProxy","cc.CCBProxy") return cc.CCBProxy end _G["CCBProxy"] = DeprecatedCocosBuilderClass.CCBProxy() --CCBProxy class will be Deprecated,end
apache-2.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/endor/creatures/remmerDuneScavenger.lua
1
4759
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. remmerDuneScavenger = Creature:new { objectName = "remmerDuneScavenger", -- Lua Object Name creatureType = "ANIMAL", gender = "", speciesName = "remmer_dune_scavenger", stfName = "mob/creature_names", objectCRC = 3273659222, socialGroup = "Remmer", level = 20, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 5500, healthMin = 4500, strength = 0, constitution = 0, actionMax = 5500, actionMin = 4500, quickness = 0, stamina = 0, mindMax = 5500, mindMin = 4500, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 15, energy = 0, electricity = 0, stun = -1, blast = 25, heat = 35, cold = -1, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 1, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 180, weaponMaxDamage = 190, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 20, hideType = "hide_bristley_endor", hideMax = 20, meatType = "meat_carnivore_endor", meatMax = 35, --skills = { " Posture down attack", " Stun attack", " Ranged attack (spit)" } skills = { "remmerAttack2", "remmerAttack5", "remmerAttack3" }, respawnTimer = 60, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(remmerDuneScavenger, 3273659222) -- Add to Global Table
lgpl-3.0
Hammerspoon/hammerspoon
extensions/fnutils/fnutils.lua
6
20116
--- === hs.fnutils === --- --- Functional programming utility functions local fnutils = {} local pairs,ipairs = pairs,ipairs local floor = math.floor --- hs.fnutils.imap(list, fn) -> list --- Function --- Execute a function across a list-like table in order, and collect the results --- --- Parameters: --- * list - A list-like table, i.e. one whose keys are sequential integers starting from 1 --- * fn - A function that accepts a single parameter (a table element). The values returned from this function --- will be collected into the result list; when `nil` is returned the relevant element is discarded - the --- result list won't have any "holes". --- --- Returns: --- * A list-like table containing the results of calling the function on every element in the table --- --- Notes: --- * If `list` has "holes", all elements after the first hole will be lost, as the table is iterated over with `ipairs`; --- use `hs.fnutils.map()` if your table has holes function fnutils.imap(t, fn) local nt = {} for _, v in ipairs(t) do nt[#nt+1] = fn(v) -- or nil < removed, as this precludes inserting false! end return nt end local function isListIndex(k) return type(k)=='number' and k>=1 and floor(k)==k -- not using 5.3 syntax (k//1==k), as you never know end --- hs.fnutils.map(table, fn) -> table --- Function --- Execute a function across a table (in arbitrary order) and collect the results --- --- Parameters: --- * table - A table; it can have both a list (or array) part and a hash (or dict) part --- * fn - A function that accepts a single parameter (a table element). For the hash part, the values returned --- from this function (if non-nil) will be assigned to the same key in the result list. For the array part, this function --- behaves like `hs.fnutils.imap()` (i.e. `nil` results are discarded); however all keys, including integer keys after --- a "hole" in `table`, will be iterated over. --- --- Returns: --- * A table containing the results of calling the function on every element in the table --- --- Notes: --- * If `table` is a pure array table (list-like) without "holes", use `hs.fnutils.imap()` if you need guaranteed in-order --- processing and for better performance. function fnutils.map(t, fn) local nt = {} for k, v in pairs(t) do -- they'll potentially be out of order, but they always were anyway nt[isListIndex(k) and (#nt+1) or k] = fn(v) -- meh, but required for compatibility end return nt end --- hs.fnutils.ieach(list, fn) --- Function --- Execute a function across a list-like table in order, and discard the results --- --- Parameters: --- * list - A list-like table, i.e. one whose keys are sequential integers starting from 1 --- * fn - A function that accepts a single parameter (a table element) --- --- Returns: --- * None function fnutils.ieach(t, fn) for _, v in ipairs(t) do fn(v) end end --- hs.fnutils.each(table, fn) --- Function --- Execute a function across a table (in arbitrary order), and discard the results --- --- Parameters: --- * table - A table; it can have both a list (or array) part and a hash (or dict) part --- * fn - A function that accepts a single parameter (a table element) --- --- Returns: --- * None function fnutils.each(t, fn) for _, v in pairs(t) do fn(v) end end --- hs.fnutils.ifilter(list, fn) -> list --- Function --- Filter a list-like table by running a predicate function on its elements in order --- --- Parameters: --- * list - A list-like table, i.e. one whose keys are sequential integers starting from 1 --- * fn - A function that accepts a single parameter (a table element) and returns a boolean --- value: true if the parameter should be kept, false if it should be discarded --- --- Returns: --- * A list-like table containing the elements of the table for which fn(element) returns true --- --- Notes: --- * If `list` has "holes", all elements after the first hole will be lost, as the table is iterated over with `ipairs`; --- use `hs.fnutils.map()` if your table has holes function fnutils.ifilter(t, fn) local nt = {} for _, v in ipairs(t) do if fn(v) then nt[#nt+1] = v end end return nt end --- hs.fnutils.filter(table, fn) -> table --- Function --- Filter a table by running a predicate function on its elements (in arbitrary order) --- --- Parameters: --- * table - A table; it can have both a list (or array) part and a hash (or dict) part --- * fn - A function that accepts a single parameter (a table element) and returns a boolean --- value: true if the parameter should be kept, false if it should be discarded --- --- Returns: --- * A table containing the elements of the table for which fn(element) returns true --- --- Notes: --- * If `table` is a pure array table (list-like) without "holes", use `hs.fnutils.ifilter()` if you need guaranteed in-order --- processing and for better performance. function fnutils.filter(t, fn) local nt = {} for k, v in pairs(t) do if fn(v) then nt[isListIndex(k) and (#nt+1) or k] = v end -- meh etc. end return nt end --- hs.fnutils.copy(table) -> table --- Function --- Copy a table using `pairs()` --- --- Parameters: --- * table - A table containing some sort of data --- --- Returns: --- * A new table containing the same data as the input table function fnutils.copy(t) local nt = {} for k, v in pairs(t) do nt[k] = v end return nt end --- hs.fnutils.contains(table, element) -> bool --- Function --- Determine if a table contains a given object --- --- Parameters: --- * table - A table containing some sort of data --- * element - An object to search the table for --- --- Returns: --- * A boolean, true if the element could be found in the table, otherwise false function fnutils.contains(t, el) for _, v in pairs(t) do if v == el then return true end end return false end --- hs.fnutils.indexOf(table, element) -> number or nil --- Function --- Determine the location in a table of a given object --- --- Parameters: --- * table - A table containing some sort of data --- * element - An object to search the table for --- --- Returns: --- * A number containing the index of the element in the table, or nil if it could not be found function fnutils.indexOf(t, el) for k, v in pairs(t) do if v == el then return k end end return nil end --- hs.fnutils.concat(table1, table2) --- Function --- Join two tables together --- --- Parameters: --- * table1 - A table containing some sort of data --- * table2 - A table containing some sort of data --- --- Returns: --- * table1, with all of table2's elements added to the end of it --- --- Notes: --- * table2 cannot be a sparse table, see [http://www.luafaq.org/gotchas.html#T6.4](http://www.luafaq.org/gotchas.html#T6.4) function fnutils.concat(t1, t2) for i = 1, #t2 do t1[#t1 + 1] = t2[i] end return t1 end --- hs.fnutils.mapCat(table, fn) -> table --- Function --- Execute, across a table, a function that outputs tables, and concatenate all of those tables together --- --- Parameters: --- * table - A table containing some sort of data --- * fn - A function that takes a single parameter and returns a table --- --- Returns: --- * A table containing the concatenated results of calling fn(element) for every element in the supplied table function fnutils.mapCat(t, fn) local nt = {} for _, v in pairs(t) do fnutils.concat(nt, fn(v)) end return nt end --- hs.fnutils.reduce(table, fn) -> table --- Function --- Reduce a table to a single element, using a function --- --- Parameters: --- * table - A table containing some sort of data --- * fn - A function that takes two parameters, which will be elements of the supplied table. It should choose one of these elements and return it --- --- Returns: --- * The element of the supplied table that was chosen by the iterative reducer function --- --- Notes: --- * table cannot be a sparse table, see [http://www.luafaq.org/gotchas.html#T6.4](http://www.luafaq.org/gotchas.html#T6.4) --- * The first iteration of the reducer will call fn with the first and second elements of the table. The second iteration will call fn with the result of the first iteration, and the third element. This repeats until there is only one element left function fnutils.reduce(t, fn) local len = #t if len == 0 then return nil end if len == 1 then return t[1] end local result = t[1] for i = 2, #t do result = fn(result, t[i]) end return result end --- hs.fnutils.find(table, fn) -> element --- Function --- Execute a function across a table and return the first element where that function returns true --- --- Parameters: --- * table - A table containing some sort of data --- * fn - A function that takes one parameter and returns a boolean value --- --- Returns: --- * The element of the supplied table that first caused fn to return true function fnutils.find(t, fn) for _, v in pairs(t) do if fn(v) then return v end end return nil end --- hs.fnutils.sequence(...) -> fn --- Constructor --- Creates a function that will collect the result of a series of functions into a table --- --- Parameters: --- * ... - A number of functions, passed as different arguments. They should accept zero parameters, and return something --- --- Returns: --- * A function that, when called, will call all of the functions passed to this constructor. The output of these functions will be collected together and returned. function fnutils.sequence(...) local arg = table.pack(...) return function() local results = {} for _, fn in ipairs(arg) do table.insert(results, fn()) end return results end end --- hs.fnutils.partial(fn, ...) -> fn' --- Constructor --- Returns a new function which takes the provided arguments and pre-applies them as the initial arguments to the provided function. When the new function is later invoked with additional arguments, they are appended to the end of the initial list given and the complete list of arguments is finally passed into the provided function and its result returned. --- --- Parameters: --- * fn - The function which will act on all of the arguments provided now and when the result is invoked later. --- * ... - The initial arguments to pre-apply to the resulting new function. --- --- Returns: --- * A function --- --- Notes: --- * This is best understood with an example which you can test in the Hammerspoon console: --- --- Create the function `a` which has it's initial arguments set to `1,2,3`: --- a = hs.fnutils.partial(function(...) return table.pack(...) end, 1, 2, 3) --- --- Now some examples of using the new function, `a(...)`: --- hs.inspect(a("a","b","c")) will return: { 1, 2, 3, "a", "b", "c", n = 6 } --- hs.inspect(a(4,5,6,7)) will return: { 1, 2, 3, 4, 5, 6, 7, n = 7 } --- hs.inspect(a(1)) will return: { 1, 2, 3, 1, n = 4 } function fnutils.partial(fn, ...) local args = table.pack(...) return function(...) for idx = args.n+1,#args do args[idx] = nil end -- clear previous values for idx, val in ipairs(table.pack(...)) do args[args.n + idx] = val end return fn(table.unpack(args)) end end --- hs.fnutils.cycle(table) -> fn() --- Constructor --- Creates a function that repeatedly iterates a table --- --- Parameters: --- * table - A table containing some sort of data --- --- Returns: --- * A function that, when called repeatedly, will return all of the elements of the supplied table, repeating indefinitely --- --- Notes: --- * table cannot be a sparse table, see [http://www.luafaq.org/gotchas.html#T6.4](http://www.luafaq.org/gotchas.html#T6.4) --- * An example usage: --- ```lua --- f = cycle({4, 5, 6}) --- {f(), f(), f(), f(), f(), f(), f()} == {4, 5, 6, 4, 5, 6, 4} --- ``` function fnutils.cycle(t) local i = 1 return function() local x = t[i] i = i % #t + 1 return x end end --- hs.fnutils.every(table, fn) -> bool --- Function --- Returns true if the application of fn on every entry in table is true. --- --- Parameters: --- * table - A table containing some sort of data --- * fn - A function that accepts a single parameter and returns a "true" value (any value except the boolean `false` or nil) if the parameter was accepted, or a "false" value (the boolean false or nil) if the parameter was rejected. --- --- Returns: --- * True if the application of fn on every element of the table is true --- * False if the function returns `false` for any element of the table. Note that testing stops when the first false return is detected. function fnutils.every(table, fn) for k, v in pairs(table) do if not fn(v, k) then return false end end return true end --- hs.fnutils.some(table, fn) -> bool --- Function --- Returns true if the application of fn on entries in table are true for at least one of the members. --- --- Parameters: --- * table - A table containing some sort of data --- * fn - A function that accepts a single parameter and returns a "true" value (any value except the boolean `false` or nil) if the parameter was accepted, or a "false" value (the boolean false or nil) if the parameter was rejected. --- --- Returns: --- * True if the application of fn on any element of the table is true. Note that testing stops when the first true return is detected. --- * False if the function returns `false` for all elements of the table. function fnutils.some(table, fn) local function is_invalid(v, k) return not fn(v, k) end return not fnutils.every(table, is_invalid) end --- hs.fnutils.sortByKeys(table[ , function]) -> function --- Constructor --- Iterator for retrieving elements from a table of key-value pairs in the order of the keys. --- --- Parameters: --- * table - the table of key-value pairs to be iterated through --- * fn - an optional function which will be passed to `table.sort` to determine how the keys are sorted. If it is not present, then keys will be sorted numerically/alphabetically. --- --- Returns: --- * function to be used as an iterator --- --- Notes: --- * Similar to Perl's `sort(keys %hash)` --- * Iterators are used in looping constructs like `for`: --- * `for i,v in hs.fnutils.sortByKeys(t[, f]) do ... end` --- * A sort function should accept two arguments and return true if the first argument should appear before the second, or false otherwise. --- * e.g. `function(m,n) return not (m < n) end` would result in reverse alphabetic order. --- * See _Programming_In_Lua,_3rd_ed_, page 52 for a more complete discussion. --- * The default sort is to compare keys directly, if they are of the same type, or as their tostring() versions, if the key types differ: --- * function(m,n) if type(m) ~= type(n) then return tostring(m) < tostring(n) else return m < n end fnutils.sortByKeys = function(t, f) -- a default, simple comparison that treats keys as strings only if their types differ f = f or function(m,n) if type(m) ~= type(n) then return tostring(m) < tostring(n) else return m < n end end if t then local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 -- iterator variable local iter = function () -- iterator function i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter else return function() return nil end end end --- hs.fnutils.sortByKeyValues(table[ , function]) -> function --- Constructor --- Iterator for retrieving elements from a table of key-value pairs in the order of the values. --- --- Parameters: --- * table - the table of key-value pairs to be iterated through --- * fn - an optional function which will be passed to `table.sort` to determine how the values are sorted. If it is not present, then values will be sorted numerically/alphabetically. --- --- Returns: --- * function to be used as an iterator --- --- Notes: --- * Similar to Perl's `sort { $hash{$a} <=> $hash{$b} } keys %hash` --- * Iterators are used in looping constructs like `for`: --- * `for i,v in hs.fnutils.sortByKeyValues(t[, f]) do ... end` --- * A sort function should accept two arguments and return true if the first argument should appear before the second, or false otherwise. --- * e.g. `function(m,n) return not (m < n) end` would result in reverse alphabetic order. --- * See _Programming_In_Lua,_3rd_ed_, page 52 for a more complete discussion. --- * The default sort is to compare values directly, if they are of the same type, or as their tostring() versions, if the value types differ: --- * function(m,n) if type(m) ~= type(n) then return tostring(m) < tostring(n) else return m < n end fnutils.sortByKeyValues = function(t, f) -- a default, simple comparison that treats keys as strings only if their types differ f = f or function(m,n) if type(m) ~= type(n) then return tostring(m) < tostring(n) else return m < n end end if t then local a = {} for n in pairs(t) do table.insert(a, {n, t[n]}) end table.sort(a, function(m,n) return f(m[2], n[2]) end) local i = 0 -- iterator variable local iter = function () -- iterator function i = i + 1 if a[i] == nil then return nil else return a[i][1], a[i][2] end end return iter else return function() return nil end end end --- hs.fnutils.split(sString, sSeparator [, nMax] [, bPlain]) -> { array } --- Function --- Convert string to an array of strings, breaking at the specified separator. --- --- Parameters: --- * sString -- the string to split into substrings --- * sSeparator -- the separator. If `bPlain` is false or not provided, this is treated as a Lua pattern. --- * nMax -- optional parameter specifying the maximum number (or all if `nMax` is nil) of substrings to split from `sString`. --- * bPlain -- optional boolean parameter, defaulting to false, specifying if `sSeparator` should be treated as plain text (true) or a Lua pattern (false) --- --- Returns: --- * An array of substrings. The last element of the array will be the remaining portion of `sString` that remains after `nMax` (or all, if `nMax` is not provided or is nil) substrings have been identified. --- --- Notes: --- * Similar to "split" in Perl or "string.split" in Python. --- * Optional parameters `nMax` and `bPlain` are identified by their type -- if parameter 3 or 4 is a number or nil, it will be considered a value for `nMax`; if parameter 3 or 4 is a boolean value, it will be considered a value for `bPlain`. --- * Lua patterns are more flexible for pattern matching, but can also be slower if the split point is simple. See §6.4.1 of the _Lua_Reference_Manual_ at http://www.lua.org/manual/5.3/manual.html#6.4.1 for more information on Lua patterns. function fnutils.split(sString, sSeparator, nMax, bPlain) if type(nMax) == "boolean" then nMax, bPlain = bPlain, nMax end sSeparator = sSeparator or "" if type(sString) ~= "string" then error("sString parameter to hs.fnutils.split must be a string", 2) end if type(sSeparator) ~= "string" then error("sSeparator parameter to hs.fnutils.split must be a string", 2) end if type(nMax) ~= "number" and type(nMax) ~= "nil" then error("nMax parameter to hs.fnutils.split must be a number, if it is provided", 2) end if type(bPlain) ~= "boolean" and type(bPlain) ~= "nil" then error("bPlain parameter to hs.fnutils.split must be a boolean, if it is provided", 2) end if sSeparator == "" or nMax == 0 then return { sString } end -- degenerate cases local aRecord = {} if sString:len() > 0 then nMax = nMax or -1 local nField, nStart = 1, 1 local nFirst,nLast = sString:find(sSeparator, nStart, bPlain) while nFirst and nMax ~= 0 do aRecord[nField] = sString:sub(nStart, nFirst-1) nField = nField+1 nStart = nLast+1 nFirst,nLast = sString:find(sSeparator, nStart, bPlain) nMax = nMax-1 end aRecord[nField] = sString:sub(nStart) end return aRecord end return fnutils
mit
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/tailor/fieldWearIBasicGear/swoopHelm.lua
1
4340
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. swoopHelm = Object:new { objectName = "Swoop Helm", stfName = "hat_s04", stfFile = "wearables_name", objectCRC = 1708681155, groupName = "craftClothingFieldGroupA", -- Group schematic is awarded in (See skills table) craftingToolTab = 8, -- (See DraftSchemticImplementation.h) complexity = 19, size = 3, xpType = "crafting_clothing_general", xp = 100, assemblySkill = "clothing_assembly", experimentingSkill = "clothing_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "shell, binding_and_weatherproofing, liner", ingredientSlotType = "0, 0, 2", resourceTypes = "steel, petrochem_inert, object/tangible/component/clothing/shared_synthetic_cloth.iff", resourceQuantities = "25, 20, 1", combineTypes = "0, 0, 1", contribution = "100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hitpoints, mod_idx_one, mod_val_one, mod_idx_two, mod_val_two, mod_idx_three, mod_val_three, mod_idx_four, mod_val_four, mod_idx_five, mod_val_five, mod_idx_six, mod_val_six", experimentalMin = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalMax = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalPrecision = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", tanoAttributes = "objecttype=16777226:objectcrc=2915569359:stfFile=wearables_name:stfName=hat_s04:stfDetail=:itemmask=62975::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "/private/index_color_1, /private/index_color_2", customizationDefaults = "19, 7", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(swoopHelm, 1708681155)--- Add to global DraftSchematics table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/spawns/tatooine/dungeons/tuskenVillage.lua
1
2726
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. spawnCreature(tuskenBantha, 8, -5335.57, -4445.08) spawnCreature(tuskenCaptain, 8, -5337.28, -4436.5) spawnCreature(tuskenRaider, 8, -5328.29, -4455.34) spawnCreature(tuskenRaider, 8, -5324.76, -4453.15) spawnCreature(tuskenRaider, 8, -5325.7, -4448.72) spawnCreature(tuskenRaider, 8, -5326.1, -4452.37) spawnCreature(tuskenRaider, 8, -5313.29, -4429.99) spawnCreature(tuskenRaider, 8, -5309.9, -4431.66) spawnCreature(tuskenSniper, 8, -5311.55, -4434.84) spawnCreature(tuskenSniper, 8, -5310.28, -4431.01) spawnCreature(tuskenBantha, 8, -5281.86, -4455.33) spawnCreature(tuskenRaider, 8, -5287.78, -4440.92) spawnCreature(tuskenRaider, 8, -5287.9, -4445.52) spawnCreature(tuskenRaider, 8, -5285.84, -4444.11)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/armorsmith/noviceArmorsmith/mabariArmorweaveBelt.lua
1
4385
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. mabariArmorweaveBelt = Object:new { objectName = "Mabari Armorweave Belt", stfName = "armor_zam_wesell_belt", stfFile = "wearables_name", objectCRC = 344794469, groupName = "craftArmorPersonalGroupA", -- Group schematic is awarded in (See skills table) craftingToolTab = 2, -- (See DraftSchemticImplementation.h) complexity = 20, size = 4, xpType = "crafting_clothing_armor", xp = 40, assemblySkill = "armor_assembly", experimentingSkill = "armor_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "auxilary_coverage, body, liner", ingredientSlotType = "0, 0, 2", resourceTypes = "metal, hide, object/tangible/component/clothing/shared_fiberplast_panel.iff", resourceQuantities = "15, 4, 1", combineTypes = "0, 0, 1", contribution = "100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null, null, null, null, null, null, null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hit_points, armor_effectiveness, armor_integrity, armor_health_encumbrance, armor_action_encumbrance, armor_mind_encumbrance, armor_rating, armor_special_type, armor_special_effectiveness, armor_special_integrity", experimentalMin = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 1, 0, 0, 0", experimentalMax = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 1, 0, 0, 0", experimentalPrecision = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", tanoAttributes = "objecttype=16777218:objectcrc=1255925428:stfFile=wearables_name:stfName=armor_zam_wesell_belt:stfDetail=:itemmask=65535:customattributes=specialprotection=;vunerability=;armorPiece=16777218;armorStyle=;:", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "/private/index_color_2", customizationDefaults = "82", customizationSkill = "armor_customization" } DraftSchematics:addDraftSchematic(mabariArmorweaveBelt, 344794469)--- Add to global DraftSchematics table
lgpl-3.0
bartvm/Penlight
tests/test-xml.lua
8
10800
local xml = require 'pl.xml' local asserteq = require 'pl.test'.asserteq local dump = require 'pl.pretty'.dump -- Prosody stanza.lua style XML building d = xml.new 'top' : addtag 'child' : text 'alice' : up() : addtag 'child' : text 'bob' d = xml.new 'children' : addtag 'child' : addtag 'name' : text 'alice' : up() : addtag 'age' : text '5' : up() : addtag('toy',{type='fluffy'}) : up() : up() : addtag 'child': addtag 'name' : text 'bob' : up() : addtag 'age' : text '6' : up() : addtag('toy',{type='squeaky'}) asserteq( xml.tostring(d,'',' '), [[ <children> <child> <name>alice</name> <age>5</age> <toy type='fluffy'/> </child> <child> <name>bob</name> <age>6</age> <toy type='squeaky'/> </child> </children>]]) -- Orbit-style 'xmlification' local children,child,toy,name,age = xml.tags 'children, child, toy, name, age' d1 = children { child {name 'alice', age '5', toy {type='fluffy'}}, child {name 'bob', age '6', toy {type='squeaky'}} } assert(xml.compare(d,d1)) -- or we can use a template document to convert Lua data to LOM templ = child {name '$name', age '$age', toy{type='$toy'}} d2 = children(templ:subst{ {name='alice',age='5',toy='fluffy'}, {name='bob',age='6',toy='squeaky'} }) assert(xml.compare(d1,d2)) -- Parsing Google Weather service results -- local joburg = [[ <?xml version="1.0"?> <xml_api_reply version='1'> <weather module_id='0' tab_id='0' mobile_zipped='1' section='0' row='0' mobile_row='0'> <forecast_information> <city data='Johannesburg, Gauteng'/> <postal_code data='Johannesburg,ZA'/> <latitude_e6 data=''/> <longitude_e6 data=''/> <forecast_date data='2010-10-02'/> <current_date_time data='2010-10-02 18:30:00 +0000'/> <unit_system data='US'/> </forecast_information> <current_conditions> <condition data='Clear'/> <temp_f data='75'/> <temp_c data='24'/> <humidity data='Humidity: 19%'/> <icon data='/ig/images/weather/sunny.gif'/> <wind_condition data='Wind: NW at 7 mph'/> </current_conditions> <forecast_conditions> <day_of_week data='Sat'/> <low data='60'/> <high data='89'/> <icon data='/ig/images/weather/sunny.gif'/> <condition data='Clear'/> </forecast_conditions> <forecast_conditions> <day_of_week data='Sun'/> <low data='53'/> <high data='86'/> <icon data='/ig/images/weather/sunny.gif'/> <condition data='Clear'/> </forecast_conditions> <forecast_conditions> <day_of_week data='Mon'/> <low data='57'/> <high data='87'/> <icon data='/ig/images/weather/sunny.gif'/> <condition data='Clear'/> </forecast_conditions> <forecast_conditions> <day_of_week data='Tue'/> <low data='60'/> <high data='84'/> <icon data='/ig/images/weather/sunny.gif'/> <condition data='Clear'/> </forecast_conditions> </weather> </xml_api_reply> ]] -- we particularly want to test the built-in XML parser here, not lxp.lom local function parse (str) return xml.parse(str,false,true) end local d = parse(joburg) function match(t,xpect) local res,ret = d:match(t) asserteq(res,xpect,0,1) ---> note extra level, so we report on calls to this function! end t1 = [[ <weather> <current_conditions> <condition data='$condition'/> <temp_c data='$temp'/> </current_conditions> </weather> ]] match(t1,{ condition = "Clear", temp = "24", } ) t2 = [[ <weather> {{<forecast_conditions> <day_of_week data='$day'/> <low data='$low'/> <high data='$high'/> <condition data='$condition'/> </forecast_conditions>}} </weather> ]] local conditions = { { low = "60", high = "89", day = "Sat", condition = "Clear", }, { low = "53", high = "86", day = "Sun", condition = "Clear", }, { low = "57", high = "87", day = "Mon", condition = "Clear", }, { low = "60", high = "84", day = "Tue", condition = "Clear", } } match(t2,conditions) config = [[ <config> <alpha>1.3</alpha> <beta>10</beta> <name>bozo</name> </config> ]] d,err = parse(config) if not d then print(err); os.exit(1) end -- can match against wildcard tag names (end with -) -- can be names match([[ <config> {{<key->$value</key->}} </config> ]],{ {key="alpha", value = "1.3"}, {key="beta", value = "10"}, {key="name",value = "bozo"}, }) -- can be numerical indices match([[ <config> {{<1->$2</1->}} </config> ]],{ {"alpha","1.3"}, {"beta","10"}, {"name","bozo"}, }) -- _ is special; means 'this value is key of captured table' match([[ <config> {{<_->$1</_->}} </config> ]],{ alpha = {"1.3"}, beta = {"10"}, name = {"bozo"}, }) -- the numerical index 0 is special: a capture of {[0]=val} becomes simply the value val match([[ <config> {{<_->$0</_->}} </config> ]],{ alpha = "1.3", name = "bozo", beta = "10" }) -- this can of course also work with attributes, but then we don't want to collapse! config = [[ <config> <alpha type='number'>1.3</alpha> <beta type='number'>10</beta> <name type='string'>bozo</name> </config> ]] d,err = parse(config) if not d then print(err); os.exit(1) end match([[ <config> {{<_- type='$1'>$2</_->}} </config> ]],{ alpha = {"number","1.3"}, beta = {"number","10"}, name = {"string","bozo"}, }) d,err = parse [[ <configuremap> <configure name="NAME" value="ImageMagick"/> <configure name="LIB_VERSION" value="0x651"/> <configure name="LIB_VERSION_NUMBER" value="6,5,1,3"/> <configure name="RELEASE_DATE" value="2009-05-01"/> <configure name="VERSION" value="6.5.1"/> <configure name="CC" value="vs7"/> <configure name="HOST" value="windows-unknown-linux-gnu"/> <configure name="DELEGATES" value="bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib"/> <configure name="COPYRIGHT" value="Copyright (C) 1999-2009 ImageMagick Studio LLC"/> <configure name="WEBSITE" value="http://www.imagemagick.org"/> </configuremap> ]] if not d then print(err); os.exit(1) end --xml.debug = true res,err = d:match [[ <configuremap> {{<configure name="$_" value="$0"/>}} </configuremap> ]] asserteq(res,{ HOST = "windows-unknown-linux-gnu", COPYRIGHT = "Copyright (C) 1999-2009 ImageMagick Studio LLC", NAME = "ImageMagick", LIB_VERSION = "0x651", VERSION = "6.5.1", RELEASE_DATE = "2009-05-01", WEBSITE = "http://www.imagemagick.org", LIB_VERSION_NUMBER = "6,5,1,3", CC = "vs7", DELEGATES = "bzlib freetype jpeg jp2 lcms png tiff x11 xml wmf zlib" }) -- short excerpt from -- /usr/share/mobile-broadband-provider-info/serviceproviders.xml d = parse [[ <serviceproviders format="2.0"> <country code="za"> <provider> <name>Cell-c</name> <gsm> <network-id mcc="655" mnc="07"/> <apn value="internet"> <username>Cellcis</username> <dns>196.7.0.138</dns> <dns>196.7.142.132</dns> </apn> </gsm> </provider> <provider> <name>MTN</name> <gsm> <network-id mcc="655" mnc="10"/> <apn value="internet"> <dns>196.11.240.241</dns> <dns>209.212.97.1</dns> </apn> </gsm> </provider> <provider> <name>Vodacom</name> <gsm> <network-id mcc="655" mnc="01"/> <apn value="internet"> <dns>196.207.40.165</dns> <dns>196.43.46.190</dns> </apn> <apn value="unrestricted"> <name>Unrestricted</name> <dns>196.207.32.69</dns> <dns>196.43.45.190</dns> </apn> </gsm> </provider> <provider> <name>Virgin Mobile</name> <gsm> <apn value="vdata"> <dns>196.7.0.138</dns> <dns>196.7.142.132</dns> </apn> </gsm> </provider> </country> </serviceproviders> ]] res = d:match [[ <serviceproviders> {{<country code="$_"> {{<provider> <name>$0</name> </provider>}} </country>}} </serviceproviders> ]] asserteq(res,{ za = { "Cell-c", "MTN", "Vodacom", "Virgin Mobile" } }) res = d:match [[ <serviceproviders> <country code="$country"> <provider> <name>$name</name> <gsm> <apn value="$apn"> <dns>196.43.46.190</dns> </apn> </gsm> </provider> </country> </serviceproviders> ]] asserteq(res,{ name = "Vodacom", country = "za", apn = "internet" }) d = parse[[ <!DOCTYPE xml> <params> <param> <name>XXX</name> <value></value> </param> <param> <name>YYY</name> <value>1</value> </param> </params> ]] match([[ <params> {{<param> <name>$_</name> <value>$0</value> </param>}} </params> ]],{XXX = '',YYY = '1'}) -- can always use xmlification to generate your templates... local SP, country, provider, gsm, apn, dns = xml.tags 'serviceprovider, country, provider, gsm, apn, dns' t = SP{country{code="$country",provider{ name '$name', gsm{apn {value="$apn",dns '196.43.46.190'}} }}} out = xml.tostring(t,' ',' ') asserteq(out,[[ <serviceprovider> <country code='$country'> <provider> <name>$name</name> <gsm> <apn value='$apn'> <dns>196.43.46.190</dns> </apn> </gsm> </provider> </country> </serviceprovider>]]) ----- HTML is a degenerate form of XML ;) -- attribute values don't need to be quoted, tags are case insensitive, -- and some are treated as self-closing doc = xml.parsehtml [[ <BODY a=1> Hello dolly<br> HTML is <b>slack</b><br> </BODY> ]] asserteq(xml.tostring(doc),[[ <body a='1'> Hello dolly<br/> HTML is <b>slack</b><br/></body>]]) doc = xml.parsehtml [[ <!DOCTYPE html> <html lang=en> <head><!--head man--> </head> <body> </body> </html> ]] asserteq(xml.tostring(doc),"<html lang='en'><head/><body/></html>") -- note that HTML mode currently barfs if there isn't whitespace around things -- like '<' and '>' in scripts. doc = xml.parsehtml [[ <html> <head> <script>function less(a,b) { return a < b; }</script> </head> <body> <h2>hello dammit</h2> </body> </html> ]] script = doc:get_elements_with_name 'script' asserteq(script[1]:get_text(), 'function less(a,b) { return a < b; }') -- test attribute order local test_attrlist = xml.new('AttrList',{ Attr3="Value3", ['Attr1'] = "Value1", ['Attr2'] = "Value2", [1] = 'Attr1', [2] = 'Attr2', [3] = 'Attr3' }) asserteq( xml.tostring(test_attrlist), "<AttrList Attr1='Value1' Attr2='Value2' Attr3='Value3'/>" ) -- commments str = [[ <hello> <!-- any <i>momentous</i> stuff here --> dolly </hello> ]] doc = parse(str) asserteq(xml.tostring(doc),[[ <hello> dolly </hello>]]) -- underscores and dashes in attributes str = [[ <hello> <tag my_attribute='my_value'>dolly</tag> </hello> ]] doc = parse(str) print(doc) print(xml.tostring(doc)) asserteq(xml.tostring(doc),[[ <hello><tag my_attribute='my_value'>dolly</tag></hello>]])
mit
kyle-lu/fceux.js
output/luaScripts/ShowPalette.lua
9
1875
-- Show Palette -- Click for other palette boxes -- P00 - P3F are NES palette values. -- P40 - P7F are LUA palette values. -- True or False ShowTextLabels=true; function DecToHex(numberin) if (numberin < 16) then return string.format("0%X",numberin); else return string.format("%X",numberin); end; end; function text(x,y,str,text,back) if (x > 0 and x < 255 and y > 0 and y < 240) then gui.text(x,y,str,text,back); end; end; local ButtonWasPressed; local CurrentPaletteDisplay=0; while(true) do FCEU.frameadvance(); for i = 0, 7 do gui.box(0 + (30*i),0,29 + (30*i),29,"P" .. DecToHex(0+i+(CurrentPaletteDisplay * 8)),"P" .. DecToHex(0+i+(CurrentPaletteDisplay * 8))); gui.box(0 + (30*i),30,29 + (30*i),59,"P" .. DecToHex(16+i+(CurrentPaletteDisplay * 8)),"P" .. DecToHex(16+i+(CurrentPaletteDisplay * 8))); gui.box(0 + (30*i),60,29 + (30*i),89,"P" .. DecToHex(32+i+(CurrentPaletteDisplay * 8)),"P" .. DecToHex(32+i+(CurrentPaletteDisplay * 8))); gui.box(0 + (30*i),90,29 + (30*i),119,"P" .. DecToHex(48+i+(CurrentPaletteDisplay * 8)),"P" .. DecToHex(48+i+(CurrentPaletteDisplay * 8))); if(ShowTextLabels == true) then text(6 + (30*i),11,"P" .. DecToHex(0+i+(CurrentPaletteDisplay * 8))) text(6 + (30*i),41,"P" .. DecToHex(16+i+(CurrentPaletteDisplay * 8))) text(6 + (30*i),71,"P" .. DecToHex(32+i+(CurrentPaletteDisplay * 8))) text(6 + (30*i),101,"P" .. DecToHex(48+i+(CurrentPaletteDisplay * 8))) end; end; mousestuff = input.get() if (not ButtonWasPressed) then if (mousestuff.leftclick) then ButtonWasPressed = 1; CurrentPaletteDisplay=CurrentPaletteDisplay+1; if (CurrentPaletteDisplay == 2) then CurrentPaletteDisplay=8; end; if (CurrentPaletteDisplay == 10) then CurrentPaletteDisplay=0; end; end; end ButtonWasPressed = (mousestuff.leftclick); end;
gpl-2.0
alireza1998/radical-boy
plugins/banhammer.lua
214
11956
local function pre_process(msg) -- SERVICE MESSAGE if msg.action and msg.action.type then local action = msg.action.type -- Check if banned user joins chat by link if action == 'chat_add_user_link' then local user_id = msg.from.id print('Checking invited user '..user_id) local banned = is_banned(user_id, msg.to.id) if banned or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] is banned and kicked ! ")-- Save to logs kick_user(user_id, msg.to.id) end end -- Check if banned user joins chat if action == 'chat_add_user' then local user_id = msg.action.user.id print('Checking invited user '..user_id) local banned = is_banned(user_id, msg.to.id) if banned or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] added a banned user >"..msg.action.user.id)-- Save to logs kick_user(user_id, msg.to.id) local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id redis:incr(banhash) local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id local banaddredis = redis:get(banhash) if banaddredis then if tonumber(banaddredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 3 times end if tonumber(banaddredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 7 times local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id redis:set(banhash, 0)-- Reset the Counter end end end local bots_protection = "Yes" local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)]['settings']['lock_bots'] then bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots'] end if msg.action.user.username ~= nil then if string.sub(msg.action.user.username:lower(), -3) == 'bot' and not is_momod(msg) and bots_protection == "yes" then --- Will kick bots added by normal users local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] added a bot > @".. msg.action.user.username)-- Save to logs kick_user(msg.action.user.id, msg.to.id) end end end -- No further checks return msg end -- banned user is talking ! if msg.to.type == 'chat' then local data = load_data(_config.moderation.data) local group = msg.to.id local texttext = 'groups' --if not data[tostring(texttext)][tostring(msg.to.id)] and not is_realm(msg) then -- Check if this group is one of my groups or not --chat_del_user('chat#id'..msg.to.id,'user#id'..our_id,ok_cb,false) --return --end local user_id = msg.from.id local chat_id = msg.to.id local banned = is_banned(user_id, chat_id) if banned or is_gbanned(user_id) then -- Check it with redis print('Banned user talking!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] banned user is talking !")-- Save to logs kick_user(user_id, chat_id) msg.text = '' end end return msg end local function username_id(cb_extra, success, result) local get_cmd = cb_extra.get_cmd local receiver = cb_extra.receiver local chat_id = cb_extra.chat_id local member = cb_extra.member local text = '' for k,v in pairs(result.members) do vusername = v.username if vusername == member then member_username = member member_id = v.id if member_id == our_id then return false end if get_cmd == 'kick' then if is_momod2(member_id, chat_id) then return send_large_msg(receiver, "you can't kick mods/owner/admins") end return kick_user(member_id, chat_id) elseif get_cmd == 'ban' then if is_momod2(member_id, chat_id) then return send_large_msg(receiver, "you can't ban mods/owner/admins") end send_large_msg(receiver, 'User @'..member..' ['..member_id..'] banned') return ban_user(member_id, chat_id) elseif get_cmd == 'unban' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] unbanned') local hash = 'banned:'..chat_id redis:srem(hash, member_id) return 'User '..user_id..' unbanned' elseif get_cmd == 'banall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] globally banned') return banall_user(member_id, chat_id) elseif get_cmd == 'unbanall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] unbanned') return unbanall_user(member_id, chat_id) end end end return send_large_msg(receiver, text) end local function run(msg, matches) if matches[1]:lower() == 'id' then if msg.to.type == "user" then return "Bot ID: "..msg.to.id.. "\n\nYour ID: "..msg.from.id end if type(msg.reply_id) ~= "nil" then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") id = get_message(msg.reply_id,get_message_callback_id, false) elseif matches[1]:lower() == 'id' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") return "Group ID for " ..string.gsub(msg.to.print_name, "_", " ").. ":\n\n"..msg.to.id end end local receiver = get_receiver(msg) if matches[1]:lower() == 'kickme' then-- /kickme if msg.to.type == 'chat' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] left using kickme ")-- Save to logs chat_del_user("chat#id"..msg.to.id, "user#id"..msg.from.id, ok_cb, false) end end if not is_momod(msg) then -- Ignore normal users return nil end if matches[1]:lower() == "banlist" then -- Ban list ! local chat_id = msg.to.id if matches[2] and is_admin(msg) then chat_id = matches[2] end return ban_list(chat_id) end if matches[1]:lower() == 'ban' then-- /ban if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,ban_by_reply_admins, false) else msgr = get_message(msg.reply_id,ban_by_reply, false) end end if msg.to.type == 'chat' then local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(tonumber(matches[2]), msg.to.id) then return "you can't ban mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't ban your self !" end local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] baned user ".. matches[2]) ban_user(user_id, chat_id) else local member = string.gsub(matches[2], '@', '') local get_cmd = 'ban' local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] baned user ".. matches[2]) chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end return end end if matches[1]:lower() == 'unban' then -- /unban if type(msg.reply_id)~="nil" and is_momod(msg) then local msgr = get_message(msg.reply_id,unban_by_reply, false) end if msg.to.type == 'chat' then local user_id = matches[2] local chat_id = msg.to.id local targetuser = matches[2] if string.match(targetuser, '^%d+$') then local user_id = targetuser local hash = 'banned:'..chat_id redis:srem(hash, user_id) local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] unbaned user ".. matches[2]) return 'User '..user_id..' unbanned' else local member = string.gsub(matches[2], '@', '') local get_cmd = 'unban' chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end end end if matches[1]:lower() == 'kick' then if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,Kick_by_reply_admins, false) else msgr = get_message(msg.reply_id,Kick_by_reply, false) end end if msg.to.type == 'chat' then local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(matches[2], msg.to.id) then return "you can't kick mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't kick your self !" end local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2]) kick_user(user_id, chat_id) else local member = string.gsub(matches[2], '@', '') local get_cmd = 'kick' local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2]) chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end else return 'This isn\'t a chat group' end end if not is_admin(msg) then return end if matches[1]:lower() == 'banall' then -- Global ban if type(msg.reply_id) ~="nil" and is_admin(msg) then return get_message(msg.reply_id,banall_by_reply, false) end local user_id = matches[2] local chat_id = msg.to.id if msg.to.type == 'chat' then local targetuser = matches[2] if string.match(targetuser, '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return false end banall_user(targetuser) return 'User ['..user_id..' ] globally banned' else local member = string.gsub(matches[2], '@', '') local get_cmd = 'banall' chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end end end if matches[1]:lower() == 'unbanall' then -- Global unban local user_id = matches[2] local chat_id = msg.to.id if msg.to.type == 'chat' then if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return false end unbanall_user(user_id) return 'User ['..user_id..' ] removed from global ban list' else local member = string.gsub(matches[2], '@', '') local get_cmd = 'unbanall' chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end end end if matches[1]:lower() == "gbanlist" then -- Global ban list return banall_list() end end return { patterns = { "^[!/]([Bb]anall) (.*)$", "^[!/]([Bb]anall)$", "^[!/]([Bb]anlist) (.*)$", "^[!/]([Bb]anlist)$", "^[!/]([Gg]banlist)$", "^[!/]([Bb]an) (.*)$", "^[!/]([Kk]ick)$", "^[!/]([Uu]nban) (.*)$", "^[!/]([Uu]nbanall) (.*)$", "^[!/]([Uu]nbanall)$", "^[!/]([Kk]ick) (.*)$", "^[!/]([Kk]ickme)$", "^[!/]([Bb]an)$", "^[!/]([Uu]nban)$", "^[!/]([Ii]d)$", "^!!tgservice (.+)$", }, run = run, pre_process = pre_process }
gpl-2.0
Maxsteam/seed
plugins/banhammer.lua
214
11956
local function pre_process(msg) -- SERVICE MESSAGE if msg.action and msg.action.type then local action = msg.action.type -- Check if banned user joins chat by link if action == 'chat_add_user_link' then local user_id = msg.from.id print('Checking invited user '..user_id) local banned = is_banned(user_id, msg.to.id) if banned or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] is banned and kicked ! ")-- Save to logs kick_user(user_id, msg.to.id) end end -- Check if banned user joins chat if action == 'chat_add_user' then local user_id = msg.action.user.id print('Checking invited user '..user_id) local banned = is_banned(user_id, msg.to.id) if banned or is_gbanned(user_id) then -- Check it with redis print('User is banned!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] added a banned user >"..msg.action.user.id)-- Save to logs kick_user(user_id, msg.to.id) local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id redis:incr(banhash) local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id local banaddredis = redis:get(banhash) if banaddredis then if tonumber(banaddredis) == 4 and not is_owner(msg) then kick_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 3 times end if tonumber(banaddredis) == 8 and not is_owner(msg) then ban_user(msg.from.id, msg.to.id)-- Kick user who adds ban ppl more than 7 times local banhash = 'addedbanuser:'..msg.to.id..':'..msg.from.id redis:set(banhash, 0)-- Reset the Counter end end end local bots_protection = "Yes" local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)]['settings']['lock_bots'] then bots_protection = data[tostring(msg.to.id)]['settings']['lock_bots'] end if msg.action.user.username ~= nil then if string.sub(msg.action.user.username:lower(), -3) == 'bot' and not is_momod(msg) and bots_protection == "yes" then --- Will kick bots added by normal users local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] added a bot > @".. msg.action.user.username)-- Save to logs kick_user(msg.action.user.id, msg.to.id) end end end -- No further checks return msg end -- banned user is talking ! if msg.to.type == 'chat' then local data = load_data(_config.moderation.data) local group = msg.to.id local texttext = 'groups' --if not data[tostring(texttext)][tostring(msg.to.id)] and not is_realm(msg) then -- Check if this group is one of my groups or not --chat_del_user('chat#id'..msg.to.id,'user#id'..our_id,ok_cb,false) --return --end local user_id = msg.from.id local chat_id = msg.to.id local banned = is_banned(user_id, chat_id) if banned or is_gbanned(user_id) then -- Check it with redis print('Banned user talking!') local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] banned user is talking !")-- Save to logs kick_user(user_id, chat_id) msg.text = '' end end return msg end local function username_id(cb_extra, success, result) local get_cmd = cb_extra.get_cmd local receiver = cb_extra.receiver local chat_id = cb_extra.chat_id local member = cb_extra.member local text = '' for k,v in pairs(result.members) do vusername = v.username if vusername == member then member_username = member member_id = v.id if member_id == our_id then return false end if get_cmd == 'kick' then if is_momod2(member_id, chat_id) then return send_large_msg(receiver, "you can't kick mods/owner/admins") end return kick_user(member_id, chat_id) elseif get_cmd == 'ban' then if is_momod2(member_id, chat_id) then return send_large_msg(receiver, "you can't ban mods/owner/admins") end send_large_msg(receiver, 'User @'..member..' ['..member_id..'] banned') return ban_user(member_id, chat_id) elseif get_cmd == 'unban' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] unbanned') local hash = 'banned:'..chat_id redis:srem(hash, member_id) return 'User '..user_id..' unbanned' elseif get_cmd == 'banall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] globally banned') return banall_user(member_id, chat_id) elseif get_cmd == 'unbanall' then send_large_msg(receiver, 'User @'..member..' ['..member_id..'] unbanned') return unbanall_user(member_id, chat_id) end end end return send_large_msg(receiver, text) end local function run(msg, matches) if matches[1]:lower() == 'id' then if msg.to.type == "user" then return "Bot ID: "..msg.to.id.. "\n\nYour ID: "..msg.from.id end if type(msg.reply_id) ~= "nil" then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") id = get_message(msg.reply_id,get_message_callback_id, false) elseif matches[1]:lower() == 'id' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] used /id ") return "Group ID for " ..string.gsub(msg.to.print_name, "_", " ").. ":\n\n"..msg.to.id end end local receiver = get_receiver(msg) if matches[1]:lower() == 'kickme' then-- /kickme if msg.to.type == 'chat' then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] left using kickme ")-- Save to logs chat_del_user("chat#id"..msg.to.id, "user#id"..msg.from.id, ok_cb, false) end end if not is_momod(msg) then -- Ignore normal users return nil end if matches[1]:lower() == "banlist" then -- Ban list ! local chat_id = msg.to.id if matches[2] and is_admin(msg) then chat_id = matches[2] end return ban_list(chat_id) end if matches[1]:lower() == 'ban' then-- /ban if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,ban_by_reply_admins, false) else msgr = get_message(msg.reply_id,ban_by_reply, false) end end if msg.to.type == 'chat' then local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(tonumber(matches[2]), msg.to.id) then return "you can't ban mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't ban your self !" end local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] baned user ".. matches[2]) ban_user(user_id, chat_id) else local member = string.gsub(matches[2], '@', '') local get_cmd = 'ban' local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] baned user ".. matches[2]) chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end return end end if matches[1]:lower() == 'unban' then -- /unban if type(msg.reply_id)~="nil" and is_momod(msg) then local msgr = get_message(msg.reply_id,unban_by_reply, false) end if msg.to.type == 'chat' then local user_id = matches[2] local chat_id = msg.to.id local targetuser = matches[2] if string.match(targetuser, '^%d+$') then local user_id = targetuser local hash = 'banned:'..chat_id redis:srem(hash, user_id) local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] unbaned user ".. matches[2]) return 'User '..user_id..' unbanned' else local member = string.gsub(matches[2], '@', '') local get_cmd = 'unban' chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end end end if matches[1]:lower() == 'kick' then if type(msg.reply_id)~="nil" and is_momod(msg) then if is_admin(msg) then local msgr = get_message(msg.reply_id,Kick_by_reply_admins, false) else msgr = get_message(msg.reply_id,Kick_by_reply, false) end end if msg.to.type == 'chat' then local user_id = matches[2] local chat_id = msg.to.id if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return end if not is_admin(msg) and is_momod2(matches[2], msg.to.id) then return "you can't kick mods/owner/admins" end if tonumber(matches[2]) == tonumber(msg.from.id) then return "You can't kick your self !" end local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2]) kick_user(user_id, chat_id) else local member = string.gsub(matches[2], '@', '') local get_cmd = 'kick' local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] kicked user ".. matches[2]) chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end else return 'This isn\'t a chat group' end end if not is_admin(msg) then return end if matches[1]:lower() == 'banall' then -- Global ban if type(msg.reply_id) ~="nil" and is_admin(msg) then return get_message(msg.reply_id,banall_by_reply, false) end local user_id = matches[2] local chat_id = msg.to.id if msg.to.type == 'chat' then local targetuser = matches[2] if string.match(targetuser, '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return false end banall_user(targetuser) return 'User ['..user_id..' ] globally banned' else local member = string.gsub(matches[2], '@', '') local get_cmd = 'banall' chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end end end if matches[1]:lower() == 'unbanall' then -- Global unban local user_id = matches[2] local chat_id = msg.to.id if msg.to.type == 'chat' then if string.match(matches[2], '^%d+$') then if tonumber(matches[2]) == tonumber(our_id) then return false end unbanall_user(user_id) return 'User ['..user_id..' ] removed from global ban list' else local member = string.gsub(matches[2], '@', '') local get_cmd = 'unbanall' chat_info(receiver, username_id, {get_cmd=get_cmd, receiver=receiver, chat_id=msg.to.id, member=member}) end end end if matches[1]:lower() == "gbanlist" then -- Global ban list return banall_list() end end return { patterns = { "^[!/]([Bb]anall) (.*)$", "^[!/]([Bb]anall)$", "^[!/]([Bb]anlist) (.*)$", "^[!/]([Bb]anlist)$", "^[!/]([Gg]banlist)$", "^[!/]([Bb]an) (.*)$", "^[!/]([Kk]ick)$", "^[!/]([Uu]nban) (.*)$", "^[!/]([Uu]nbanall) (.*)$", "^[!/]([Uu]nbanall)$", "^[!/]([Kk]ick) (.*)$", "^[!/]([Kk]ickme)$", "^[!/]([Bb]an)$", "^[!/]([Uu]nban)$", "^[!/]([Ii]d)$", "^!!tgservice (.+)$", }, run = run, pre_process = pre_process }
gpl-2.0
TheAnswer/FirstTest
bin/scripts/object/tangible/ship/attachment/engine/objects.lua
1
56281
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_tangible_ship_attachment_engine_shared_awing_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/awing_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_awing_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_awing_engine_s01, 4185031918) object_tangible_ship_attachment_engine_shared_awing_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/awing_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_awing_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_awing_engine_s02, 577055865) object_tangible_ship_attachment_engine_shared_blacksun_heavy_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/black_sun_fighter_heavy_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_blacksun_fighter_heavy_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_blacksun_heavy_engine_s01, 1430717714) object_tangible_ship_attachment_engine_shared_blacksun_heavy_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/black_sun_fighter_heavy_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_blacksun_fighter_heavy_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_blacksun_heavy_engine_s02, 2387651973) object_tangible_ship_attachment_engine_shared_blacksun_light_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/black_sun_fighter_light_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_blacksun_fighter_light_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_blacksun_light_engine_s01, 2826438901) object_tangible_ship_attachment_engine_shared_blacksun_light_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/black_sun_fighter_light_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_blacksun_fighter_light_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_blacksun_light_engine_s02, 1936695394) object_tangible_ship_attachment_engine_shared_blacksun_medium_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/black_sun_fighter_medium_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_blacksun_fighter_medium_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_blacksun_medium_engine_s01, 2775195131) object_tangible_ship_attachment_engine_shared_blacksun_medium_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/black_sun_fighter_medium_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_blacksun_fighter_medium_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_blacksun_medium_engine_s02, 2122167660) object_tangible_ship_attachment_engine_shared_bwing_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/bwing_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_bwing_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_bwing_engine_s01, 2775913620) object_tangible_ship_attachment_engine_shared_bwing_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/bwing_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_bwing_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_bwing_engine_s02, 2120399875) object_tangible_ship_attachment_engine_shared_decimator_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/vt49_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_decimator.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_decimator_engine_s01, 1116177012) object_tangible_ship_attachment_engine_shared_decimator_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/vt49_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_decimator.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_decimator_engine_s02, 2576362211) object_tangible_ship_attachment_engine_shared_eng_tiefighter_basic = SharedTangibleObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_tiefighter_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_eng_tiefighter_basic, 1064155476) object_tangible_ship_attachment_engine_shared_hutt_heavy_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/hutt_fighter_heavy_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_hutt_fighter_heavy_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_hutt_heavy_engine_s01, 2054741017) object_tangible_ship_attachment_engine_shared_hutt_heavy_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/hutt_fighter_heavy_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_hutt_fighter_heavy_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_hutt_heavy_engine_s02, 2708436110) object_tangible_ship_attachment_engine_shared_hutt_light_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/hutt_fighter_light_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_hutt_fighter_light_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_hutt_light_engine_s01, 2269630974) object_tangible_ship_attachment_engine_shared_hutt_light_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/hutt_fighter_light_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_hutt_fighter_light_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_hutt_light_engine_s02, 1548777833) object_tangible_ship_attachment_engine_shared_hutt_medium_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/hutt_fighter_medium_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_hutt_fighter_medium_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_hutt_medium_engine_s01, 987700646) object_tangible_ship_attachment_engine_shared_hutt_medium_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/hutt_fighter_medium_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_hutt_fighter_medium_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_hutt_medium_engine_s02, 3788027185) object_tangible_ship_attachment_engine_shared_kse_firespray_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/kse_firespray_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_kse_firespray_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_kse_firespray_engine_s01, 1758759963) object_tangible_ship_attachment_engine_shared_kse_firespray_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/kse_firespray_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_kse_firespray_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_kse_firespray_engine_s02, 3015910540) object_tangible_ship_attachment_engine_shared_tie_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_tiefighter_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_tie_engine_s01, 557699423) object_tangible_ship_attachment_engine_shared_tieadvanced_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_tieadvanced_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_tieadvanced_engine_s01, 1078468437) object_tangible_ship_attachment_engine_shared_tiebomber_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_tiebomber_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_tiebomber_engine_s01, 4073386065) object_tangible_ship_attachment_engine_shared_tieinterceptor_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_tieinterceptor_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_tieinterceptor_engine_s01, 3973162809) object_tangible_ship_attachment_engine_shared_tieoppressor_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_tieoppressor_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_tieoppressor_engine_s01, 3648736552) object_tangible_ship_attachment_engine_shared_xwing_engine_neg_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/xwing_engine_neg_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_xwing_neg_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_xwing_engine_neg_s01, 1476333721) object_tangible_ship_attachment_engine_shared_xwing_engine_neg_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/xwing_engine_neg_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_xwing_neg_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_xwing_engine_neg_s02, 2364061710) object_tangible_ship_attachment_engine_shared_xwing_engine_neg_s03 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/xwing_engine_neg_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_xwing_neg_s03.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_xwing_engine_neg_s03, 3320176515) object_tangible_ship_attachment_engine_shared_xwing_engine_pos_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/xwing_engine_pos_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_xwing_pos_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_xwing_engine_pos_s01, 4116130746) object_tangible_ship_attachment_engine_shared_xwing_engine_pos_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/xwing_engine_pos_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_xwing_pos_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_xwing_engine_pos_s02, 775979821) object_tangible_ship_attachment_engine_shared_xwing_engine_pos_s03 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/xwing_engine_pos_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_xwing_pos_s03.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_xwing_engine_pos_s03, 1733158048) object_tangible_ship_attachment_engine_shared_ykl37r_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ykl37r_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_ykl37r_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_ykl37r_engine_s01, 332197254) object_tangible_ship_attachment_engine_shared_ykl37r_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ykl37r_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_ykl37r_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_ykl37r_engine_s02, 3369813265) object_tangible_ship_attachment_engine_shared_yt1300_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/yt1300_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_yt1300_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_yt1300_engine_s01, 3573306455) object_tangible_ship_attachment_engine_shared_yt1300_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/yt1300_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_yt1300_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_yt1300_engine_s02, 267123904) object_tangible_ship_attachment_engine_shared_ywing_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ywing_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_ywing_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_ywing_engine_s01, 281820240) object_tangible_ship_attachment_engine_shared_ywing_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ywing_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_ywing_s02.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_ywing_engine_s02, 3420165319) object_tangible_ship_attachment_engine_shared_z95_engine_s01 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/z95_engine_s01.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_z95_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_z95_engine_s01, 2645704367) object_tangible_ship_attachment_engine_shared_z95_engine_s02 = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/z95_engine_s02.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "clientdata/ship/component/eng_z95_s01.cdf", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@item_n:ship_attachment", gameObjectType = 1073741824, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@item_n:ship_attachment", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_ship_attachment_engine_shared_z95_engine_s02, 1185257016)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/object/tangible/wearables/armor/ithorian_defender/objects.lua
1
15217
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_bicep_l = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_bicep_l_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bicep_l.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 261, locationReservationRadius = 0, lookAtText = "@wearables_lookat:armor_composite_bracer_l", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_bicep_l", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_bicep_l, 391015330) object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_bicep_r = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_bicep_r_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bicep_r.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 261, locationReservationRadius = 0, lookAtText = "@wearables_lookat:ith_armor_s01_bicep_r", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_bicep_r", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_bicep_r, 1738223153) object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_boots = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_boots_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/shoe.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 263, locationReservationRadius = 0, lookAtText = "@wearables_lookat:ith_armor_s01_boots", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_boots", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_boots, 2766594033) object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_bracer_l = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_bracer_l_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bracer_l.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 261, locationReservationRadius = 0, lookAtText = "@wearables_lookat:ith_armor_s01_bracer_l", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_bracer_l", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_bracer_l, 3020283121) object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_bracer_r = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_bracer_r_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/bracer_r.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 261, locationReservationRadius = 0, lookAtText = "@wearables_lookat:ith_armor_s01_bracer_r", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_bracer_r", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_bracer_r, 3302005090) object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_chest_plate = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_chest_plate_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/vest.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 257, locationReservationRadius = 0, lookAtText = "@wearables_lookat:ith_armor_s01_chest_plate", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_chest_plate", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_chest_plate, 2075456355) object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_gloves = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_gloves_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/gloves.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 262, locationReservationRadius = 0, lookAtText = "@wearables_lookat:ith_armor_s01_gloves", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_gloves", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_gloves, 2214098424) object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_helmet = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_helmet_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/helmet_closed_full.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 258, locationReservationRadius = 0, lookAtText = "@wearables_lookat:ith_armor_s01_helmet", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_helmet", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_helmet, 892900592) object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_leggings = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/ith_armor_s01_leggings_f.sat", arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/pants.iff", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@wearables_detail:ithorian_armor", gameObjectType = 260, locationReservationRadius = 0, lookAtText = "@wearables_lookat:ith_armor_s01_leggings", noBuildRadius = 0, objectName = "@wearables_name:ith_armor_s01_leggings", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "abstract/slot/descriptor/tangible.iff", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_wearables_armor_ithorian_defender_shared_ith_armor_s01_leggings, 992018926)
lgpl-3.0
yobiya/tdd_game_sample
cross/cocos2d/cocos/scripting/lua/script/Cocos2d.lua
26
9014
require "CocoStudio" cc = cc or {} cc.DIRECTOR_PROJECTION_2D = 0 cc.DIRECTOR_PROJECTION_3D = 1 function cc.clampf(value, min_inclusive, max_inclusive) -- body local temp = 0 if min_inclusive > max_inclusive then temp = min_inclusive min_inclusive = max_inclusive max_inclusive = temp end if value < min_inclusive then return min_inclusive elseif value < max_inclusive then return value else return max_inclusive end end --Point function cc.p(_x,_y) if nil == _y then return { x = _x.x, y = _x.y } else return { x = _x, y = _y } end end function cc.pAdd(pt1,pt2) return {x = pt1.x + pt2.x , y = pt1.y + pt2.y } end function cc.pSub(pt1,pt2) return {x = pt1.x - pt2.x , y = pt1.y - pt2.y } end function cc.pMul(pt1,factor) return { x = pt1.x * factor , y = pt1.y * factor } end function cc.pMidpoint(pt1,pt2) return { x = (pt1.x + pt2.x) / 2.0 , y = ( pt1.y + pt2.y) / 2.0 } end function cc.pForAngle(a) return { x = math.cos(a), y = math.sin(a) } end function cc.pGetLength(pt) return math.sqrt( pt.x * pt.x + pt.y * pt.y ) end function cc.pNormalize(pt) local length = cc.pGetLength(pt) if 0 == length then return { x = 1.0,y = 0.0 } end return { x = pt.x / length, y = pt.y / length } end function cc.pCross(self,other) return self.x * other.y - self.y * other.x end function cc.pDot(self,other) return self.x * other.x + self.y * other.y end function cc.pToAngleSelf(self) return math.atan2(self.y, self.x) end function cc.pGetAngle(self,other) local a2 = cc.pNormalize(self) local b2 = cc.pNormalize(other) local angle = math.atan2(cc.pCross(a2, b2), cc.pDot(a2, b2) ) if angle < 1.192092896e-7 then return 0.0 end return angle end function cc.pGetDistance(startP,endP) return cc.pGetLength(cc.pSub(startP,endP)) end function cc.pIsLineIntersect(A, B, C, D, s, t) if ((A.x == B.x) and (A.y == B.y)) or ((C.x == D.x) and (C.y == D.y))then return false, s, t end local BAx = B.x - A.x local BAy = B.y - A.y local DCx = D.x - C.x local DCy = D.y - C.y local ACx = A.x - C.x local ACy = A.y - C.y local denom = DCy * BAx - DCx * BAy s = DCx * ACy - DCy * ACx t = BAx * ACy - BAy * ACx if (denom == 0) then if (s == 0 or t == 0) then return true, s , t end return false, s, t end s = s / denom t = t / denom return true,s,t end function cc.pPerp(pt) return { x = -pt.y, y = pt.x } end function cc.RPerp(pt) return { x = pt.y, y = -pt.x } end function cc.pProject(pt1, pt2) return { x = pt2.x * (cc.pDot(pt1,pt2) / cc.pDot(pt2,pt2)) , y = pt2.y * (cc.pDot(pt1,pt2) / cc.pDot(pt2,pt2)) } end function cc.pRotate(pt1, pt2) return { x = pt1.x * pt2.x - pt1.y * pt2.y, y = pt1.x * pt2.y + pt1.y * pt2.x } end function cc.pUnrotate(pt1, pt2) return { x = pt1.x * pt2.x + pt1.y * pt2.y, pt1.y * pt2.x - pt1.x * pt2.y } end --Calculates the square length of pt function cc.pLengthSQ(pt) return cc.pDot(pt,pt) end --Calculates the square distance between pt1 and pt2 function cc.pDistanceSQ(pt1,pt2) return cc.pLengthSQ(cc.pSub(pt1,pt2)) end function cc.pGetClampPoint(pt1,pt2,pt3) return { x = cc.clampf(pt1.x, pt2.x, pt3.x), y = cc.clampf(pt1.y, pt2.y, pt3.y) } end function cc.pFromSize(sz) return { x = sz.width, y = sz.height } end function cc.pLerp(pt1,pt2,alpha) return cc.pAdd(cc.pMul(pt1, 1.0 - alpha), cc.pMul(pt2,alpha) ) end function cc.pFuzzyEqual(pt1,pt2,variance) if (pt1.x - variance <= pt2.x) and (pt2.x <= pt1.x + variance) and (pt1.y - variance <= pt2.y) and (pt2.y <= pt1.y + variance) then return true else return false end end function cc.pRotateByAngle(pt1, pt2, angle) return cc.pAdd(pt2, cc.pRotate( cc.pSub(pt1, pt2),cc.pForAngle(angle))) end function cc.pIsSegmentIntersect(pt1,pt2,pt3,pt4) local s,t,ret = 0,0,false ret,s,t =cc.pIsLineIntersect(pt1, pt2, pt3, pt4,s,t) if ret and s >= 0.0 and s <= 1.0 and t >= 0.0 and t <= 0.0 then return true; end return false end function cc.pGetIntersectPoint(pt1,pt2,pt3,pt4) local s,t, ret = 0,0,false ret,s,t = cc.pIsLineIntersect(pt1,pt2,pt3,pt4,s,t) if ret then return cc.p(pt1.x + s * (pt2.x - pt1.x), pt1.y + s * (pt2.y - pt1.y)) else return cc.p(0,0) end end --Size function cc.size( _width,_height ) return { width = _width, height = _height } end --Rect function cc.rect(_x,_y,_width,_height) return { x = _x, y = _y, width = _width, height = _height } end function cc.rectEqualToRect(rect1,rect2) if ((rect1.x >= rect2.x) or (rect1.y >= rect2.y) or ( rect1.x + rect1.width <= rect2.x + rect2.width) or ( rect1.y + rect1.height <= rect2.y + rect2.height)) then return false end return true end function cc.rectGetMaxX(rect) return rect.x + rect.width end function cc.rectGetMidX(rect) return rect.x + rect.width / 2.0 end function cc.rectGetMinX(rect) return rect.x end function cc.rectGetMaxY(rect) return rect.y + rect.height end function cc.rectGetMidY(rect) return rect.y + rect.height / 2.0 end function cc.rectGetMinY(rect) return rect.y end function cc.rectContainsPoint( rect, point ) local ret = false if (point.x >= rect.x) and (point.x <= rect.x + rect.width) and (point.y >= rect.y) and (point.y <= rect.y + rect.height) then ret = true end return ret end function cc.rectIntersectsRect( rect1, rect2 ) local intersect = not ( rect1.x > rect2.x + rect2.width or rect1.x + rect1.width < rect2.x or rect1.y > rect2.y + rect2.height or rect1.y + rect1.height < rect2.y ) return intersect end function cc.rectUnion( rect1, rect2 ) local rect = cc.rect(0, 0, 0, 0) rect.x = math.min(rect1.x, rect2.x) rect.y = math.min(rect1.y, rect2.y) rect.width = math.max(rect1.x + rect1.width, rect2.x + rect2.width) - rect.x rect.height = math.max(rect1.y + rect1.height, rect2.y + rect2.height) - rect.y return rect end function cc.rectIntersection( rect1, rect2 ) local intersection = cc.rect( math.max(rect1.x, rect2.x), math.max(rect1.y, rect2.y), 0, 0) intersection.width = math.min(rect1.x + rect1.width, rect2.x + rect2.width) - intersection.x intersection.height = math.min(rect1.y + rect1.height, rect2.y + rect2.height) - intersection.y return intersection end --Color3B function cc.c3b( _r,_g,_b ) return { r = _r, g = _g, b = _b } end --Color4B function cc.c4b( _r,_g,_b,_a ) return { r = _r, g = _g, b = _b, a = _a } end --Color4F function cc.c4f( _r,_g,_b,_a ) return { r = _r, g = _g, b = _b, a = _a } end --Vertex2F function cc.vertex2F(_x,_y) return { x = _x, y = _y } end --Vertex3F function cc.Vertex3F(_x,_y,_z) return { x = _x, y = _y, z = _z } end --Tex2F function cc.tex2F(_u,_v) return { u = _u, v = _v } end --PointSprite function cc.PointSprite(_pos,_color,_size) return { pos = _pos, color = _color, size = _size } end --Quad2 function cc.Quad2(_tl,_tr,_bl,_br) return { tl = _tl, tr = _tr, bl = _bl, br = _br } end --Quad3 function cc.Quad3(_tl, _tr, _bl, _br) return { tl = _tl, tr = _tr, bl = _bl, br = _br } end --V2F_C4B_T2F function cc.V2F_C4B_T2F(_vertices, _colors, _texCoords) return { vertices = _vertices, colors = _colors, texCoords = _texCoords } end --V2F_C4F_T2F function cc.V2F_C4F_T2F(_vertices, _colors, _texCoords) return { vertices = _vertices, colors = _colors, texCoords = _texCoords } end --V3F_C4B_T2F function cc.V3F_C4B_T2F(_vertices, _colors, _texCoords) return { vertices = _vertices, colors = _colors, texCoords = _texCoords } end --V2F_C4B_T2F_Quad function cc.V2F_C4B_T2F_Quad(_bl, _br, _tl, _tr) return { bl = _bl, br = _br, tl = _tl, tr = _tr } end --V3F_C4B_T2F_Quad function cc.V3F_C4B_T2F_Quad(_tl, _bl, _tr, _br) return { tl = _tl, bl = _bl, tr = _tr, br = _br } end --V2F_C4F_T2F_Quad function cc.V2F_C4F_T2F_Quad(_bl, _br, _tl, _tr) return { bl = _bl, br = _br, tl = _tl, tr = _tr } end --T2F_Quad function cc.T2F_Quad(_bl, _br, _tl, _tr) return { bl = _bl, br = _br, tl = _tl, tr = _tr } end --AnimationFrameData function cc.AnimationFrameData( _texCoords, _delay, _size) return { texCoords = _texCoords, delay = _delay, size = _size } end --PhysicsMaterial function cc.PhysicsMaterial(_density, _restitution, _friction) return { density = _density, restitution = _restitution, friction = _friction } end local ConfigType = { NONE = 0, COCOSTUDIO = 1, } function __onParseConfig(configType,jasonStr) if configType == ConfigType.COCOSTUDIO then ccs.TriggerMng.getInstance():parse(jasonStr) end end
mit
TheAnswer/FirstTest
bin/scripts/creatures/objects/corellia/creatures/domesticHumbaba.lua
1
4674
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. domesticHumbaba = Creature:new { objectName = "domesticHumbaba", -- Lua Object Name creatureType = "ANIMAL", gender = "", speciesName = "domestic_humbaba", stfName = "mob/creature_names", objectCRC = 1217993661, socialGroup = "self", level = 7, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 330, healthMin = 270, strength = 0, constitution = 0, actionMax = 330, actionMin = 270, quickness = 0, stamina = 0, mindMax = 330, mindMin = 270, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = 0, stun = -1, blast = 0, heat = 0, cold = 0, acid = 0, lightsaber = 0, accuracy = 0, healer = 0, pack = 0, herd = 1, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 55, weaponMaxDamage = 65, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 1, boneType = "bone_mammal_corellia", boneMax = 65, hideType = "hide_leathery_corellia", hideMax = 115, meatType = "meat_domesticated_corellia", meatMax = 215, --skills = { " Posture down attack", "", "" } skills = { "humbabaAttack1" }, respawnTimer = 60, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(domesticHumbaba, 1217993661) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/tatooine/citys.lua
1
2533
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. -- Citys RunCreatureFile("objects/tatooine/citys/anchorhead.lua") RunCreatureFile("objects/tatooine/citys/bestine.lua") RunCreatureFile("objects/tatooine/citys/mosEisley.lua") RunCreatureFile("objects/tatooine/citys/mosEntha.lua") RunCreatureFile("objects/tatooine/citys/mosEspa.lua") RunCreatureFile("objects/tatooine/citys/wayfar.lua") -- Jabba's Palace RunCreatureFile("objects/tatooine/citys/jabbaPalace.lua")
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/object/tangible/dice/objects.lua
1
11349
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. object_tangible_dice_shared_eqp_chance_cube = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_chance_dice.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@dice/dice_details:eqp_chance_cube_single_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@dice/dice_details:eqp_chance_cube_single", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_dice_shared_eqp_chance_cube, 572459271) object_tangible_dice_shared_eqp_configurable_group_dice = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_chance_dice_s2.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@dice/dice_details:eqp_configurable_group_dice_single_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@dice/dice_details:eqp_configurable_group_dice_single", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_dice_shared_eqp_configurable_group_dice, 1212860070) object_tangible_dice_shared_eqp_one_hundred_sided_dice_set = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_chance_dice_s2.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@dice/dice_details:eqp_one_hundred_sided_dice_set_single_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@dice/dice_details:eqp_one_hundred_sided_dice_set_single", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_dice_shared_eqp_one_hundred_sided_dice_set, 2182985448) object_tangible_dice_shared_eqp_six_sided_dice_set = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_chance_dice_s2.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@dice/dice_details:eqp_six_sided_dice_set_single_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@dice/dice_details:eqp_six_sided_dice_set_single", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_dice_shared_eqp_six_sided_dice_set, 3211047396) object_tangible_dice_shared_eqp_ten_sided_dice_set = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_chance_dice_s2.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@dice/dice_details:eqp_ten_sided_dice_set_single_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@dice/dice_details:eqp_ten_sided_dice_set_single", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_dice_shared_eqp_ten_sided_dice_set, 3051569698) object_tangible_dice_shared_eqp_twelve_sided_dice_set = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_chance_dice_s2.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@dice/dice_details:eqp_twelve_sided_dice_set_single_d", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@dice/dice_details:eqp_twelve_sided_dice_set_single", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_dice_shared_eqp_twelve_sided_dice_set, 2176227197) object_tangible_dice_shared_eqp_twenty_sided_dice_set = SharedTangibleObjectTemplate:new { appearanceFilename = "appearance/eqp_chance_dice_s2.apt", arrangementDescriptorFilename = "", certificationsRequired = {}, clearFloraRadius = 0, clientDataFile = "", collisionActionBlockFlags = 0, collisionActionFlags = 51, collisionActionPassFlags = 1, collisionMaterialBlockFlags = 0, collisionMaterialFlags = 1, collisionMaterialPassFlags = 0, containerType = 0, containerVolumeLimit = 1, customizationVariableMapping = {}, detailedDescription = "@dice/dice_details:eqp_twenty_sided_dice_set_single_s", gameObjectType = 8211, locationReservationRadius = 0, lookAtText = "string_id_table", noBuildRadius = 0, objectName = "@dice/dice_details:eqp_twenty_sided_dice_set_single", onlyVisibleInTools = 0, paletteColorCustomizationVariables = {}, portalLayoutFilename = "", rangedIntCustomizationVariables = {}, scale = 1, scaleThresholdBeforeExtentTest = 0.5, sendToClient = 1, slotDescriptorFilename = "", snapToTerrain = 1, socketDestinations = {}, structureFootprintFileName = "", surfaceType = 0, targetable = 1, useStructureFootprintOutline = 0 } ObjectTemplates:addTemplate(object_tangible_dice_shared_eqp_twenty_sided_dice_set, 3564430823)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/lok/creatures/kimogilaHatchling.lua
1
4813
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. kimogilaHatchling = Creature:new { objectName = "kimogilaHatchling", -- Lua Object Name creatureType = "ANIMAL", gender = "", speciesName = "kimogila_hatchling", stfName = "mob/creature_names", objectCRC = 331807070, socialGroup = "Kimogila", level = 22, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 5000, healthMin = 4100, strength = 0, constitution = 0, actionMax = 5000, actionMin = 4100, quickness = 0, stamina = 0, mindMax = 5000, mindMin = 4100, focus = 0, willpower = 0, height = 0.3, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 0, energy = 0, electricity = 0, stun = -1, blast = 0, heat = 55, cold = 0, acid = 100, lightsaber = 0, accuracy = 300, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 1, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 1, weaponMinDamage = 210, weaponMaxDamage = 220, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateWeaponAttackSpeed = 0, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0", -- Group it belongs to for loot tame = 0, -- Likely hood to be tamed datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 20, hideType = "hide_leathery_lok", hideMax = 625, meatType = "meat_carnivore_lok", meatMax = 700, --skills = { " Dizzy attack", " Stun attack", " Ranged attack (spit)" } skills = { "kimogilaAttack3", "kimogilaAttack8" }, respawnTimer = 300, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(kimogilaHatchling, 331807070) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/items/objects/pharmaceutical/disease/actionDiseaseC.lua
1
2475
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. actionDiseaseC = Object:new { objectName = "Disease Action C", templateName = "object/tangible/medicine/crafted/shared_medpack_disease_action_c.iff", objectCRC = "3333236431", objectType = PHARMACEUTICAL, medpackType = DISEASEDELIVERYUNIT, usesRemaining = 8, medicineUse = 95, effectiveness = 203, range = 21.0, potency = 150.0, area = 0.0 }
lgpl-3.0
mrshayan/iranpower_english
plugins/plugins.lua
88
6304
do -- Returns the key (index) in the config.enabled_plugins table local function plugin_enabled( name ) for k,v in pairs(_config.enabled_plugins) do if name == v then return k end end -- If not found return false end -- Returns true if file exists in plugins folder local function plugin_exists( name ) for k,v in pairs(plugins_names()) do if name..'.lua' == v then return true end end return false end local function list_all_plugins(only_enabled) local text = '' local nsum = 0 for k, v in pairs( plugins_names( )) do -- ✔ enabled, ❌ disabled local status = '❌' nsum = nsum+1 nact = 0 -- Check if is enabled for k2, v2 in pairs(_config.enabled_plugins) do if v == v2..'.lua' then status = '✔' end nact = nact+1 end if not only_enabled or status == '✔' then -- get the name v = string.match (v, "(.*)%.lua") text = text..nsum..'. '..v..' '..status..'\n' end end local text = text..'\nThere are '..nsum..' plugins installed.\n'..nact..' plugins enabled and '..nsum-nact..' disabled' return text end local function list_plugins(only_enabled) local text = '' local nsum = 0 for k, v in pairs( plugins_names( )) do -- ✔ enabled, ❌ disabled local status = '❌' nsum = nsum+1 nact = 0 -- Check if is enabled for k2, v2 in pairs(_config.enabled_plugins) do if v == v2..'.lua' then status = '✔' end nact = nact+1 end if not only_enabled or status == '✔' then -- get the name v = string.match (v, "(.*)%.lua") text = text..v..' '..status..'\n' end end local text = text..'\n'..nact..' plugins enabled from '..nsum..' plugins installed.' return text end local function reload_plugins( ) plugins = {} load_plugins() return list_plugins(true) end local function enable_plugin( plugin_name ) print('checking if '..plugin_name..' exists') -- Check if plugin is enabled if plugin_enabled(plugin_name) then return 'Plugin '..plugin_name..' is enabled' end -- Checks if plugin exists if plugin_exists(plugin_name) then -- Add to the config table table.insert(_config.enabled_plugins, plugin_name) print(plugin_name..' added to _config table') save_config() -- Reload the plugins return reload_plugins( ) else return 'Plugin '..plugin_name..' does not exists' end end local function disable_plugin( name, chat ) -- Check if plugins exists if not plugin_exists(name) then return 'Plugin '..name..' does not exists' end local k = plugin_enabled(name) -- Check if plugin is enabled if not k then return 'Plugin '..name..' not enabled' end -- Disable and reload table.remove(_config.enabled_plugins, k) save_config( ) return reload_plugins(true) end local function disable_plugin_on_chat(receiver, plugin) if not plugin_exists(plugin) then return "Plugin doesn't exists" end if not _config.disabled_plugin_on_chat then _config.disabled_plugin_on_chat = {} end if not _config.disabled_plugin_on_chat[receiver] then _config.disabled_plugin_on_chat[receiver] = {} end _config.disabled_plugin_on_chat[receiver][plugin] = true save_config() return 'Plugin '..plugin..' disabled on this chat' end local function reenable_plugin_on_chat(receiver, plugin) if not _config.disabled_plugin_on_chat then return 'There aren\'t any disabled plugins' end if not _config.disabled_plugin_on_chat[receiver] then return 'There aren\'t any disabled plugins for this chat' end if not _config.disabled_plugin_on_chat[receiver][plugin] then return 'This plugin is not disabled' end _config.disabled_plugin_on_chat[receiver][plugin] = false save_config() return 'Plugin '..plugin..' is enabled again' end local function run(msg, matches) -- Show the available plugins if matches[1] == '!plugins' and is_sudo(msg) then --after changed to moderator mode, set only sudo return list_all_plugins() end -- Re-enable a plugin for this chat if matches[1] == 'enable' and matches[3] == 'chat' then local receiver = get_receiver(msg) local plugin = matches[2] print("enable "..plugin..' on this chat') return reenable_plugin_on_chat(receiver, plugin) end -- Enable a plugin if matches[1] == 'enable' and is_sudo(msg) then --after changed to moderator mode, set only sudo local plugin_name = matches[2] print("enable: "..matches[2]) return enable_plugin(plugin_name) end -- Disable a plugin on a chat if matches[1] == 'disable' and matches[3] == 'chat' then local plugin = matches[2] local receiver = get_receiver(msg) print("disable "..plugin..' on this chat') return disable_plugin_on_chat(receiver, plugin) end -- Disable a plugin if matches[1] == 'disable' and is_sudo(msg) then --after changed to moderator mode, set only sudo if matches[2] == 'plugins' then return 'This plugin can\'t be disabled' end print("disable: "..matches[2]) return disable_plugin(matches[2]) end -- Reload all the plugins! if matches[1] == 'reload' and is_sudo(msg) then --after changed to moderator mode, set only sudo return reload_plugins(true) end end return { description = "Plugin to manage other plugins. Enable, disable or reload.", usage = { moderator = { "!plugins disable [plugin] chat : disable plugin only this chat.", "!plugins enable [plugin] chat : enable plugin only this chat.", }, sudo = { "!plugins : list all plugins.", "!plugins enable [plugin] : enable plugin.", "!plugins disable [plugin] : disable plugin.", "!plugins reload : reloads all plugins." }, }, patterns = { "^!plugins$", "^!plugins? (enable) ([%w_%.%-]+)$", "^!plugins? (disable) ([%w_%.%-]+)$", "^!plugins? (enable) ([%w_%.%-]+) (chat)", "^!plugins? (disable) ([%w_%.%-]+) (chat)", "^!plugins? (reload)$" }, run = run, moderated = true, -- set to moderator mode --privileged = true } end --Copyright and edit; @behroozyaghi --Persian Translate; @behroozyaghi --ch : @nod32team --کپی بدون ذکر منبع حرام است
gpl-2.0
TheAnswer/FirstTest
bin/scripts/items/objects/clothing/shirts/shirt24.lua
1
2231
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. shirt24 = Clothing:new { objectName = "Sports Wrap", templateName = "shirt_s24", objectCRC = "2976519446", objectType = SHIRT, itemMask = HUMANOID_FEMALES, equipped = "0" }
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/dantooine/npcs/mokk/mokkHunter.lua
1
4825
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. mokkHunter = Creature:new { objectName = "mokkHunter", -- Lua Object Name creatureType = "NPC", faction = "mokk_tribe", factionPoints = 20, gender = "", speciesName = "mokk_hunter", stfName = "mob/creature_names", objectCRC = 4083847450, socialGroup = "mokk_tribe", level = 42, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG + AGGRESSIVE_FLAG, healthMax = 11300, healthMin = 9300, strength = 0, constitution = 0, actionMax = 11300, actionMin = 9300, quickness = 0, stamina = 0, mindMax = 11300, mindMin = 9300, focus = 0, willpower = 0, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 40, energy = 60, electricity = 60, stun = -1, blast = 0, heat = -1, cold = -1, acid = 60, lightsaber = 0, accuracy = 200, healer = False, pack = True, herd = True, stalker = False, killer = True, ferocity = 0, aggressive = True, attackCreatureOnSight = {}, -- Enter socialGroups weapon = "object/weapon/melee/polearm/shared_lance_staff_wood_s1.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "a Wooden Staff", -- Name ex. 'a Vibrolance' weaponTemp = "lance_staff_wood_s1", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "PolearmMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 1, weaponMinDamage = 345, weaponMaxDamage = 400, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "object/weapon/melee/knife/shared_knife_stone.iff", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "a Stone Knife", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "knife_stone", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "OneHandedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 1, alternateWeaponMinDamage = 345, alternateWeaponMaxDamage = 400, alternateweaponAttackSpeed = 2, alternateWeaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc alternateWeaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0,11,15,19,33", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = False, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "kungaAttack01", "kungaAttack02", "kungaAttack03", "kungaAttack04", "kungaAttack05", "kungaAttack06", "kungaAttack07", "kungaAttack08" }, respawnTimer = 180, -- behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(mokkHunter, 4083847450) -- Add to Global Table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/tailor/casualWearIiSynthetics/ithorianOvershirt.lua
1
4318
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. ithorianOvershirt = Object:new { objectName = "Ithorian Overshirt", stfName = "ith_jacket_s09", stfFile = "wearables_name", objectCRC = 158626778, groupName = "craftClothingCasualGroupB", -- Group schematic is awarded in (See skills table) craftingToolTab = 8, -- (See DraftSchemticImplementation.h) complexity = 18, size = 3, xpType = "crafting_clothing_general", xp = 130, assemblySkill = "clothing_assembly", experimentingSkill = "clothing_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "binding_and_hardware, liner, shell", ingredientSlotType = "0, 0, 0", resourceTypes = "petrochem_inert, hide, object/tangible/component/clothing/shared_synthetic_cloth.iff", resourceQuantities = "30, 55, 1", combineTypes = "0, 0, 1", contribution = "100, 100, 100", numberExperimentalProperties = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hitpoints, mod_idx_one, mod_val_one, mod_idx_two, mod_val_two, mod_idx_three, mod_val_three, mod_idx_four, mod_val_four, mod_idx_five, mod_val_five, mod_idx_six, mod_val_six", experimentalMin = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalMax = "0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", experimentalPrecision = "0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0", tanoAttributes = "objecttype=16777227:objectcrc=2326212722:stfFile=wearables_name:stfName=ith_jacket_s09:stfDetail=:itemmask=62975::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "", customizationDefaults = "", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(ithorianOvershirt, 158626778)--- Add to global DraftSchematics table
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/crafting/objects/draftschematics/artisan/domesticArtsIiiBasicDesserts/ithorianStripedShirt.lua
1
3752
--Copyright (C) 2009 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. ithorianStripedShirt = Object:new { objectName = "Ithorian Striped Shirt", stfName = "ith_shirt_s07", stfFile = "wearables_name", objectCRC = 4107021896, groupName = "craftArtisanDomesticGroupC", -- Group schematic is awarded in (See skills table) craftingToolTab = 8, -- (See DraftSchemticImplementation.h) complexity = 9, size = 3, xpType = "crafting_general", xp = 115, assemblySkill = "general_assembly", experimentingSkill = "general_experimentation", ingredientTemplateNames = "craft_clothing_ingredients_n, craft_clothing_ingredients_n", ingredientTitleNames = "body, binding_and_hardware", ingredientSlotType = "0, 0", resourceTypes = "fiberplast, petrochem_inert_polymer", resourceQuantities = "55, 35", combineTypes = "0, 0", contribution = "100, 100", numberExperimentalProperties = "1, 1, 1, 1", experimentalProperties = "XX, XX, XX, XX", experimentalWeights = "1, 1, 1, 1", experimentalGroupTitles = "null, null, null, null", experimentalSubGroupTitles = "null, null, sockets, hitpoints", experimentalMin = "0, 0, 0, 1000", experimentalMax = "0, 0, 0, 1000", experimentalPrecision = "0, 0, 0, 0", tanoAttributes = "objecttype=16777234:objectcrc=3367515818:stfFile=wearables_name:stfName=ith_shirt_s07:stfDetail=:itemmask=63491::", blueFrogAttributes = "", blueFrogEnabled = False, customizationOptions = "", customizationDefaults = "", customizationSkill = "clothing_customization" } DraftSchematics:addDraftSchematic(ithorianStripedShirt, 4107021896)--- Add to global DraftSchematics table
lgpl-3.0
weiDDD/WSSParticleSystem
cocos2d/cocos/scripting/lua-bindings/auto/api/EaseQuarticActionOut.lua
1
1242
-------------------------------- -- @module EaseQuarticActionOut -- @extend ActionEase -- @parent_module cc -------------------------------- -- brief Create the action with the inner action.<br> -- param action The pointer of the inner action.<br> -- return A pointer of EaseQuarticActionOut action. If creation failed, return nil. -- @function [parent=#EaseQuarticActionOut] create -- @param self -- @param #cc.ActionInterval action -- @return EaseQuarticActionOut#EaseQuarticActionOut ret (return value: cc.EaseQuarticActionOut) -------------------------------- -- -- @function [parent=#EaseQuarticActionOut] clone -- @param self -- @return EaseQuarticActionOut#EaseQuarticActionOut ret (return value: cc.EaseQuarticActionOut) -------------------------------- -- -- @function [parent=#EaseQuarticActionOut] update -- @param self -- @param #float time -- @return EaseQuarticActionOut#EaseQuarticActionOut self (return value: cc.EaseQuarticActionOut) -------------------------------- -- -- @function [parent=#EaseQuarticActionOut] reverse -- @param self -- @return EaseQuarticActionOut#EaseQuarticActionOut ret (return value: cc.EaseQuarticActionOut) return nil
apache-2.0
TheAnswer/FirstTest
bin/scripts/skills/creatureSkills/tatooine/creatures/rockBeetleAttacks.lua
1
4958
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. rockBeetleAttack1 = { attackname = "rockBeetleAttack1", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 2, arearange = 7, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 50, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(rockBeetleAttack1) ----------------------------------------------- rockBeetleAttack2 = { attackname = "rockBeetleAttack2", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 2, arearange = 7, accuracyBonus = 0, knockdownChance = 50, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(rockBeetleAttack2) ----------------------------------------------- rockBeetleAttack3 = { attackname = "rockBeetleAttack3", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 2, arearange = 7, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(rockBeetleAttack3) ----------------------------------------------- rockBeetleAttack4 = { attackname = "rockBeetleAttack4", animation = "creature_attack_light", requiredWeaponType = NONE, range = 7, damageRatio = 1.2, speedRatio = 2, arearange = 7, accuracyBonus = 0, knockdownChance = 0, postureDownChance = 0, postureUpChance = 0, dizzyChance = 0, blindChance = 0, stunChance = 0, intimidateChance = 0, CbtSpamBlock = "attack_block", CbtSpamCounter = "attack_counter", CbtSpamEvade = "attack_evade", CbtSpamHit = "attack_hit", CbtSpamMiss = "attack_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(rockBeetleAttack4) -----------------------------------------------
lgpl-3.0
schaeftide/factorio-teams
stdlib/string.lua
4
1258
--- String module -- @module string --- Returns a copy of the string with any leading or trailing whitespace from the string removed. -- @param s the string to remove leading or trailing whitespace from -- @return a copy of the string without leading or trailing whitespace function string.trim(s) return (s:gsub("^%s*(.-)%s*$", "%1")) end --- Tests if a string starts with a given substring -- @param s the string to check for the start substring -- @param start the substring to test for -- @return true if the start substring was found in the string function string.starts_with(s, start) return string.find(s, start, 1, true) == 1 end --- Tests if a string ends with a given substring -- @param s the string to check for the end substring -- @param ends the substring to test for -- @return true if the end substring was found in the string function string.ends_with(s, ends) return #s >= #ends and string.find(s, ends, #s - #ends + 1, true) and true or false end --- Tests if a string contains a given substring -- @param s the string to check for the substring -- @param ends the substring to test for -- @return true if the substring was found in the string function string.contains(s, ends) return s and string.find(s, ends) ~= nil end
mit
Andrettin/Wyrmsun
scripts/languages/germanic/middle_low_german.lua
1
16218
-- _________ __ __ -- / _____// |_____________ _/ |______ ____ __ __ ______ -- \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ -- / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ -- /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > -- \/ \/ \//_____/ \/ -- ______________________ ______________________ -- T H E W A R B E G I N S -- Stratagus - A free fantasy real time strategy game engine -- -- (c) Copyright 2016-2022 by Andrettin -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 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 -- DefineLanguageWord("Alf", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 20. Language = "middle-low-german", Type = "noun", Meanings = {"Evil Spirit", "Incubus"}, -- source gives the German "böser Geist, incubus" as the meaning DerivesFrom = {"proto-germanic", "noun", "Alba"} }) DefineLanguageWord("Bart", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 136. Language = "middle-low-german", Type = "noun", Meanings = {"Beard"}, -- source gives the German "Bart" as the meaning DerivesFrom = {"proto-germanic", "noun", "Barda"} }) DefineLanguageWord("Blî", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 148. Language = "middle-low-german", Type = "noun", Meanings = {"Lead"}, -- source gives the German "Blei" as the meaning DerivesFrom = {"old-saxon", "noun", "Blî"}, Gender = "neuter" }) DefineLanguageWord("Blôsem", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 146. Language = "middle-low-german", Type = "noun", Meanings = {"Blossom"}, -- apparently, but it is not clear from the source DerivesFrom = {"proto-germanic", "noun", "Blôma"}, Gender = "feminine" }) DefineLanguageWord("Brant", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 136. Language = "middle-low-german", Type = "noun", Meanings = {"Fire", "Firebrand", "Sword"}, -- source gives the German "Feuer, Feuerbrand, Schwert" DerivesFrom = {"old-saxon", "noun", "Brand"}, Gender = "masculine" }) DefineLanguageWord("Bret", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, pp. 135-136. Language = "middle-low-german", Type = "noun", Meanings = {"Board"}, -- source apparently gives the German "Brett" as the meaning DerivesFrom = {"proto-germanic", "noun", "Burda"}, Gender = "neuter", NumberCaseInflections = { "singular", "genitive", "Bredes" } }) DefineLanguageWord("Busch", { -- the TLFi also gives the alternative form "Busk"; Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 143; Source: http://www.cnrtl.fr/definition/bois Language = "middle-low-german", Type = "noun", Meanings = {"Bush"}, -- source gives the German "Busch" as the meaning DerivesFrom = {"old-saxon", "noun", "Busc"}, -- presumably Gender = "masculine" }) DefineLanguageWord("Darm", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 97. Language = "middle-low-german", Type = "noun", Meanings = {"Intestine"}, -- source gives the German "Darm" as the meaning DerivesFrom = {"old-saxon", "noun", "Tharm"} }) DefineLanguageWord("Drelle", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 101. Language = "middle-low-german", Type = "noun", Meanings = {"Serf"}, -- source gives the Latin "servus" as the meaning DerivesFrom = {"old-norse", "noun", "Þræll"} -- Fick mentions this as a possibility }) DefineLanguageWord("Gnîden", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 76. Language = "middle-low-german", Type = "verb", -- (apparently) a strong verb Meanings = {"Rub"}, -- source (apparently) gives the German "reiben" as the meaning DerivesFrom = {"proto-germanic", "verb", "Gnid"} }) DefineLanguageWord("Gnist", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 76. Language = "middle-low-german", Type = "noun", Meanings = {"Mange"}, -- source gives the German "Räude" as the meaning DerivesFrom = {"proto-germanic", "verb", "Gnid"} }) DefineLanguageWord("Gnisteren", { -- source also gives the alternative form "knisteren"; Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 76. Language = "middle-low-german", Type = "verb", -- Meanings = {"Grate"}, -- source gives the German "knirschen" and the Latin "stridere" as the meaning DerivesFrom = {"proto-germanic", "verb", "Gnid"} }) DefineLanguageWord("Gode", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 76. Language = "middle-low-german", Type = "noun", Meanings = {"Godfather"}, -- source (apparently, but not at all clear that this is the case) gives the German "Taufzeuge, Pate" as the meaning DerivesFrom = {"proto-germanic", "noun", "Gudjan"}, Gender = "masculine" -- apparently, but not at all clear that this is the case }) DefineLanguageWord("Grâwe", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 79. Language = "middle-low-german", Type = "adjective", Meanings = {"Gray"}, -- source gives the German "grau" as the meaning DerivesFrom = {"proto-germanic", "adjective", "Grêva"} }) DefineLanguageWord("Hameide", { -- source also gives the alternative forms "homeide" and "hameie"; Source: http://www.cnrtl.fr/definition/Amad%E9 Language = "middle-low-german", Type = "noun", Meanings = {"Enclosure", "Fence"} -- source gives the French "enclos, clôture" as the meaning }) DefineLanguageWord("Hēde", { -- Source: Sean Crist, "An Analysis of *z loss in West Germanic", 2002, pp. 1, 7. Language = "middle-low-german", Type = "noun", Meanings = {"Flax Fiber"}, DerivesFrom = {"proto-germanic", "noun", "Hezdōn"}, Uncountable = true, -- as a material, it is likely to be uncountable Gender = "feminine" }) DefineLanguageWord("Helfte", { -- source also gives the alternative form "helft"; Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 51. Language = "middle-low-german", Type = "noun", -- apparently Meanings = {"Half"}, -- source (apparently) gives the German "Hälfte" as the meaning DerivesFrom = {"proto-germanic", "noun", "Halbiþô"} }) DefineLanguageWord("Here", { -- Source: Carl D. Buck, "Words for 'Battle,' 'War,' 'Army,' and 'Soldier'", 1919, p. 10. Language = "middle-low-german", Type = "noun", Meanings = {"Army"}, DerivesFrom = {"old-saxon", "noun", "Heri"} }) DefineLanguageWord("Kên", { -- Source: Sean Crist, "An Analysis of *z loss in West Germanic", 2002, p. 4. Language = "middle-low-german", Type = "noun", Meanings = {"Resinous Wood"} }) DefineLanguageWord("Kerle", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 29. Language = "middle-low-german", Type = "noun", Meanings = {}, DerivesFrom = {"proto-germanic", "noun", "Karla"} }) DefineLanguageWord("Klei", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 38. Language = "middle-low-german", Type = "noun", Meanings = {"Clay"}, -- source gives the German "Lehm" as the meaning DerivesFrom = {"proto-germanic", "noun", "Klajja"} }) DefineLanguageWord("Knecht", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 27. Language = "middle-low-german", Type = "noun", Meanings = {"Boy", "Bachelor", "Servant"}, -- source gives the German "Knabe, Junggesell, Diener" as the meaning DerivesFrom = {"proto-germanic", "noun", "Knehta"} -- Old Low German "inkneht", although having the same root, appears to have a prefix, and thus this word likely does not derive from it }) DefineLanguageWord("Kringel", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 35. Language = "middle-low-german", Type = "noun", Meanings = {"Ring", "Circle", "Round Pastry"}, -- source gives the German "Ring, Kreis, rundes Gebäck" as the meaning DerivesFrom = {"proto-germanic", "noun", "Krenga"} }) DefineLanguageWord("Lêt", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 181. Language = "middle-low-german", Type = "noun", Meanings = {"Song"}, -- source gives the German "Lied" as the meaning DerivesFrom = {"proto-germanic", "noun", "Leuþa"}, Gender = "neuter" }) DefineLanguageWord("Liet", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 181. Language = "middle-low-german", Type = "noun", Meanings = {"Song"}, -- source gives the German "Lied" as the meaning DerivesFrom = {"old-high-german", "noun", "Liod"}, -- apparently, but isn't entirely clear from source Gender = "neuter" }) DefineLanguageWord("Lôt", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 181. Language = "middle-low-german", Type = "noun", Meanings = {"Lead", "Ball", "Lot"}, -- source gives the German "Blei, Kugel, ein gewisses Gewicht (Loth)" as the meaning DerivesFrom = {"proto-germanic", "noun", "Lauda"}, Gender = "neuter" }) DefineLanguageWord("Mage", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 156. Language = "middle-low-german", Type = "noun", Meanings = {"Stomach"}, -- source (apparently) gives the German "Magen" as the meaning DerivesFrom = {"proto-germanic", "noun", "Magan"}, Gender = "masculine" }) DefineLanguageWord("Marke", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 160. Language = "middle-low-german", Type = "noun", Meanings = {"Half Silver Pound"}, -- source gives the German "halbes Pfund Silbers" DerivesFrom = {"proto-germanic", "noun", {"Mark", "Half Pound", "Half Silver Pound"}, "Markô"} }) DefineLanguageWord("Mersch", { -- source also gives the alternative form "Marsch"; Source: http://www.cnrtl.fr/definition/marais Language = "middle-low-german", Type = "noun", Meanings = {"Fertile Coastland"}, -- source gives the French "terre fertile au bord de la mer" DerivesFrom = {"proto-germanic", "noun", "Mari"} }) DefineLanguageWord("Mêse", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 155. Language = "middle-low-german", Type = "noun", Meanings = {"Tit", "Titmouse"}, -- source gives the German "Meise" as the meaning DerivesFrom = {"proto-germanic", "noun", "Maisôn"}, Gender = "feminine" }) DefineLanguageWord("Note", { -- source also gives the alternative form "Not"; Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 58. Language = "middle-low-german", Type = "noun", Meanings = {"Nut"}, -- source (apparently) gives the German "Nuß" DerivesFrom = {"proto-germanic", "noun", "Hnut"} }) DefineLanguageWord("Orloge", { -- Source: Carl D. Buck, "Words for 'Battle,' 'War,' 'Army,' and 'Soldier'", 1919, p. 8. Language = "middle-low-german", Type = "noun", Meanings = {"War"} }) DefineLanguageWord("Smede", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 264. Language = "middle-low-german", Type = "noun", Meanings = {"Smithy"}, -- source gives the German "Schmiede" as the meaning DerivesFrom = {"proto-germanic", "noun", "Smiþjôn"} }) DefineLanguageWord("Smeden", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 264. Language = "middle-low-german", Type = "verb", Meanings = {"Forge"}, -- source gives the German "schmieden" as the meaning DerivesFrom = {"proto-germanic", "verb", "Smîþôn"} }) DefineLanguageWord("Smit", { -- source also gives the alternative form "Smet"; Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 263. Language = "middle-low-german", Type = "noun", Meanings = {"Smith"}, -- source gives the German "Schmied" DerivesFrom = {"old-saxon", "noun", "Smiđ"} }) DefineLanguageWord("Stapel", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 241. Language = "middle-low-german", Type = "noun", Meanings = {"Column", "Document", "Church Tower", "Piled Horde", "Stockyard"}, -- source gives the German "Säule, Unterlage, aufgeschichteter Haufe, Stapelplatz" as the meaning DerivesFrom = {"proto-germanic", "noun", "Stapula"}, Gender = "masculine" }) DefineLanguageWord("Stok", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 247. Language = "middle-low-german", Type = "noun", Meanings = {"Stick", "Tree Stump", "Beehive"}, -- source gives the German "Stock, Baumstumpf, Bienenstock" Gender = "masculine", DerivesFrom = {"old-saxon", "noun", "Stok"} }) DefineLanguageWord("Sûd", { -- source also gives the alternative form "sûder"; Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 223. Language = "middle-low-german", Type = "adverb", Meanings = {"Southward", "In the South"}, -- source gives the German "südwärts, im Süden" as the meaning DerivesFrom = {"proto-germanic", "adverb", "Sunþa"} }) DefineLanguageWord("Torf", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 86. Language = "middle-low-german", Type = "noun", Meanings = {"Lawn", "Turf"}, -- source gives the German "Rasen" as the meaning DerivesFrom = {"proto-germanic", "noun", "Turba"}, Gender = "masculine" }) DefineLanguageWord("Tûn", { -- Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 89. Language = "middle-low-german", Type = "noun", Meanings = {"Fence", "Property Enclosure", "Garden"}, -- source gives the German "Zaun, als Einfriedigung des Eigentums, Garten" as the meaning DerivesFrom = {"proto-germanic", "noun", "Tûna"}, Gender = "masculine" }) DefineLanguageWord("Twern", { -- Source: Sean Crist, "An Analysis of *z loss in West Germanic", 2002, p. 6. Language = "middle-low-german", Type = "noun", Meanings = {"Doubly Spun Twine"} }) DefineLanguageWord("Twernen", { -- Source: Sean Crist, "An Analysis of *z loss in West Germanic", 2002, p. 6. Language = "middle-low-german", Type = "verb", Meanings = {"Twine"} }) DefineLanguageWord("Vorde", { -- source also gives the alternative form "Vort"; Source: August Fick and Alf Torp, "Wortschatz der Germanischen Spracheinheit", 2006, p. 120. Language = "middle-low-german", Type = "noun", Meanings = {"Ford"}, -- source gives the German "Furt" as the meaning DerivesFrom = {"old-saxon", "noun", "Ford"}, Gender = "masculine" }) DefineLanguageWord("Werf", { -- source also gives the alternative form "Warf"; Source: http://www.cnrtl.fr/definition/barguigner Language = "middle-low-german", Type = "noun", Meanings = {"Industry", "Trade"} -- source gives the French "industrie, métier" as the meaning }) DefineLanguageWord("Wêt", { -- source also gives the alternative form "Wêde"; Source: Sean Crist, "An Analysis of *z loss in West Germanic", 2002, p. 4. Language = "middle-low-german", Type = "noun", Meanings = {"Woad"} })
gpl-2.0
TheAnswer/FirstTest
bin/scripts/slashcommands/skills/sampleDNA.lua
1
2624
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. --true = 1, false = 0 SampleDNASlashCommand = { name = "sampledna", alternativeNames = "", animation = "", invalidStateMask = 3894881371, --cover, combat, aiming, alert, feigndeath, tumbling, rallied, blinded, immobilized, frozen, swimming, glowingJedi, ridingMount, pilotingShip, shipOperations, shipGunner, invalidPostures = "3,2,5,6,7,8,9,10,11,12,13,14,4,", target = 2, targeType = 1, disabled = 0, maxRangeToTarget = 16, --adminLevel = 0, addToCombatQueue = 1, } AddSampleDNASlashCommand(SampleDNASlashCommand)
lgpl-3.0
TheAnswer/FirstTest
bin/scripts/creatures/objects/corellia/npcs/drall/drallChieftain.lua
1
4709
--Copyright (C) 2008 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. drallChieftain = Creature:new { objectName = "drallChieftain", -- Lua Object Name creatureType = "NPC", faction = "drall", factionPoints = 20, gender = "", speciesName = "drall_chieftain", stfName = "mob/creature_names", objectCRC = 3116494340, socialGroup = "drall", level = 22, combatFlags = ATTACKABLE_FLAG + ENEMY_FLAG, healthMax = 7200, healthMin = 5900, strength = 500, constitution = 500, actionMax = 7200, actionMin = 5900, quickness = 500, stamina = 500, mindMax = 7200, mindMin = 5900, focus = 500, willpower = 500, height = 1, -- Size of creature armor = 0, -- 0 = None; 1 = Light; 2 = Medium; 3 = Heavy kinetic = 20, energy = 0, electricity = 0, stun = -1, blast = 0, heat = -1, cold = 0, acid = -1, lightsaber = 0, accuracy = 300, healer = 0, pack = 1, herd = 0, stalker = 0, killer = 0, ferocity = 0, aggressive = 0, invincible = 0, meleeDefense = 1, rangedDefense = 1, attackCreatureOnSight = "", -- Enter socialGroups weapon = "object/weapon/creature/shared_creature_default_weapon.iff", -- File path to weapon -> object\xxx\xxx\xx weaponName = "Creature Defualt", -- Name ex. 'a Vibrolance' weaponTemp = "creature_default_weapon", -- Weapon Template ex. 'lance_vibrolance' weaponClass = "UnarmedMeleeWeapon", -- Weapon Class ex. 'PolearmMeleeWeapon' weaponEquipped = 0, weaponMinDamage = 210, weaponMaxDamage = 220, weaponAttackSpeed = 2, weaponDamageType = "KINETIC", -- ELECTRICITY, KINETIC, etc weaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY alternateWeapon = "", -- File path to weapon -> object\xxx\xxx\xx alternateWeaponName = "", -- Name ex. 'a Vibrolance' alternateWeaponTemp = "", -- Weapon Template ex. 'lance_vibrolance' alternateWeaponClass = "", -- Weapon Class ex. 'PolearmMeleeWeapon' alternateWeaponEquipped = 0, alternateWeaponMinDamage = 0, alternateWeaponMaxDamage = 0, alternateweaponAttackSpeed = 2, alternateWeaponDamageType = "", -- ELECTRICITY, KINETIC, etc alternateweaponArmorPiercing = "NONE", -- LIGHT, NONE, MEDIUM, HEAVY internalNPCDamageModifier = 0.3, -- Damage Modifier to other NPC's lootGroup = "0,11,15,19,33,39,40", -- Group it belongs to for loot tame = 0, datapadItemCRC = 0, mountCRC = 0, mountSpeed = 0, mountAcceleration = 0, milk = 0, boneType = "", boneMax = 0, hideType = "", hideMax = 0, meatType = "", meatMax = 0, skills = { "drallAttack01", "drallAttack02", "drallAttack03", "drallAttack04", "drallAttack05" }, respawnTimer = 300, behaviorScript = "", -- Link to the behavior script for this object } Creatures:addCreature(drallChieftain, 3116494340) -- Add to Global Table
lgpl-3.0
crosslife/OpenBird
Resources/DeprecatedOpenglEnum.lua
148
11934
-- This is the DeprecatedEnum DeprecatedClass = {} or DeprecatedClass _G.GL_RENDERBUFFER_INTERNAL_FORMAT = gl.RENDERBUFFER_INTERNAL_FORMAT _G.GL_LINE_WIDTH = gl.LINE_WIDTH _G.GL_CONSTANT_ALPHA = gl.CONSTANT_ALPHA _G.GL_BLEND_SRC_ALPHA = gl.BLEND_SRC_ALPHA _G.GL_GREEN_BITS = gl.GREEN_BITS _G.GL_STENCIL_REF = gl.STENCIL_REF _G.GL_ONE_MINUS_SRC_ALPHA = gl.ONE_MINUS_SRC_ALPHA _G.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE _G.GL_CCW = gl.CCW _G.GL_MAX_TEXTURE_IMAGE_UNITS = gl.MAX_TEXTURE_IMAGE_UNITS _G.GL_BACK = gl.BACK _G.GL_ACTIVE_ATTRIBUTES = gl.ACTIVE_ATTRIBUTES _G.GL_TEXTURE_CUBE_MAP_POSITIVE_X = gl.TEXTURE_CUBE_MAP_POSITIVE_X _G.GL_STENCIL_BACK_VALUE_MASK = gl.STENCIL_BACK_VALUE_MASK _G.GL_TEXTURE_CUBE_MAP_POSITIVE_Z = gl.TEXTURE_CUBE_MAP_POSITIVE_Z _G.GL_ONE = gl.ONE _G.GL_TRUE = gl.TRUE _G.GL_TEXTURE12 = gl.TEXTURE12 _G.GL_LINK_STATUS = gl.LINK_STATUS _G.GL_BLEND = gl.BLEND _G.GL_LESS = gl.LESS _G.GL_TEXTURE16 = gl.TEXTURE16 _G.GL_BOOL_VEC2 = gl.BOOL_VEC2 _G.GL_KEEP = gl.KEEP _G.GL_DST_COLOR = gl.DST_COLOR _G.GL_VERTEX_ATTRIB_ARRAY_ENABLED = gl.VERTEX_ATTRIB_ARRAY_ENABLED _G.GL_EXTENSIONS = gl.EXTENSIONS _G.GL_FRONT = gl.FRONT _G.GL_DST_ALPHA = gl.DST_ALPHA _G.GL_ATTACHED_SHADERS = gl.ATTACHED_SHADERS _G.GL_STENCIL_BACK_FUNC = gl.STENCIL_BACK_FUNC _G.GL_ONE_MINUS_DST_COLOR = gl.ONE_MINUS_DST_COLOR _G.GL_BLEND_EQUATION = gl.BLEND_EQUATION _G.GL_RENDERBUFFER_DEPTH_SIZE = gl.RENDERBUFFER_DEPTH_SIZE _G.GL_PACK_ALIGNMENT = gl.PACK_ALIGNMENT _G.GL_VENDOR = gl.VENDOR _G.GL_NEAREST_MIPMAP_LINEAR = gl.NEAREST_MIPMAP_LINEAR _G.GL_TEXTURE_CUBE_MAP_POSITIVE_Y = gl.TEXTURE_CUBE_MAP_POSITIVE_Y _G.GL_NEAREST = gl.NEAREST _G.GL_RENDERBUFFER_WIDTH = gl.RENDERBUFFER_WIDTH _G.GL_ARRAY_BUFFER_BINDING = gl.ARRAY_BUFFER_BINDING _G.GL_ARRAY_BUFFER = gl.ARRAY_BUFFER _G.GL_LEQUAL = gl.LEQUAL _G.GL_VERSION = gl.VERSION _G.GL_COLOR_CLEAR_VALUE = gl.COLOR_CLEAR_VALUE _G.GL_RENDERER = gl.RENDERER _G.GL_STENCIL_BACK_PASS_DEPTH_PASS = gl.STENCIL_BACK_PASS_DEPTH_PASS _G.GL_STENCIL_BACK_PASS_DEPTH_FAIL = gl.STENCIL_BACK_PASS_DEPTH_FAIL _G.GL_STENCIL_BACK_WRITEMASK = gl.STENCIL_BACK_WRITEMASK _G.GL_BOOL = gl.BOOL _G.GL_VIEWPORT = gl.VIEWPORT _G.GL_FRAGMENT_SHADER = gl.FRAGMENT_SHADER _G.GL_LUMINANCE = gl.LUMINANCE _G.GL_DECR_WRAP = gl.DECR_WRAP _G.GL_FUNC_ADD = gl.FUNC_ADD _G.GL_ONE_MINUS_DST_ALPHA = gl.ONE_MINUS_DST_ALPHA _G.GL_OUT_OF_MEMORY = gl.OUT_OF_MEMORY _G.GL_BOOL_VEC4 = gl.BOOL_VEC4 _G.GL_POLYGON_OFFSET_FACTOR = gl.POLYGON_OFFSET_FACTOR _G.GL_STATIC_DRAW = gl.STATIC_DRAW _G.GL_DITHER = gl.DITHER _G.GL_TEXTURE31 = gl.TEXTURE31 _G.GL_TEXTURE30 = gl.TEXTURE30 _G.GL_UNSIGNED_BYTE = gl.UNSIGNED_BYTE _G.GL_DEPTH_COMPONENT16 = gl.DEPTH_COMPONENT16 _G.GL_TEXTURE23 = gl.TEXTURE23 _G.GL_DEPTH_TEST = gl.DEPTH_TEST _G.GL_STENCIL_PASS_DEPTH_FAIL = gl.STENCIL_PASS_DEPTH_FAIL _G.GL_BOOL_VEC3 = gl.BOOL_VEC3 _G.GL_POLYGON_OFFSET_UNITS = gl.POLYGON_OFFSET_UNITS _G.GL_TEXTURE_BINDING_2D = gl.TEXTURE_BINDING_2D _G.GL_TEXTURE21 = gl.TEXTURE21 _G.GL_UNPACK_ALIGNMENT = gl.UNPACK_ALIGNMENT _G.GL_DONT_CARE = gl.DONT_CARE _G.GL_BUFFER_SIZE = gl.BUFFER_SIZE _G.GL_FLOAT_MAT3 = gl.FLOAT_MAT3 _G.GL_UNSIGNED_SHORT_5_6_5 = gl.UNSIGNED_SHORT_5_6_5 _G.GL_INT_VEC2 = gl.INT_VEC2 _G.GL_UNSIGNED_SHORT_4_4_4_4 = gl.UNSIGNED_SHORT_4_4_4_4 _G.GL_NONE = gl.NONE _G.GL_BLEND_DST_ALPHA = gl.BLEND_DST_ALPHA _G.GL_VERTEX_ATTRIB_ARRAY_SIZE = gl.VERTEX_ATTRIB_ARRAY_SIZE _G.GL_SRC_COLOR = gl.SRC_COLOR _G.GL_COMPRESSED_TEXTURE_FORMATS = gl.COMPRESSED_TEXTURE_FORMATS _G.GL_STENCIL_ATTACHMENT = gl.STENCIL_ATTACHMENT _G.GL_MAX_VERTEX_ATTRIBS = gl.MAX_VERTEX_ATTRIBS _G.GL_NUM_COMPRESSED_TEXTURE_FORMATS = gl.NUM_COMPRESSED_TEXTURE_FORMATS _G.GL_BLEND_EQUATION_RGB = gl.BLEND_EQUATION_RGB _G.GL_TEXTURE = gl.TEXTURE _G.GL_LINEAR_MIPMAP_LINEAR = gl.LINEAR_MIPMAP_LINEAR _G.GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING _G.GL_CURRENT_PROGRAM = gl.CURRENT_PROGRAM _G.GL_COLOR_BUFFER_BIT = gl.COLOR_BUFFER_BIT _G.GL_TEXTURE20 = gl.TEXTURE20 _G.GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = gl.ACTIVE_ATTRIBUTE_MAX_LENGTH _G.GL_TEXTURE28 = gl.TEXTURE28 _G.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE _G.GL_TEXTURE22 = gl.TEXTURE22 _G.GL_ELEMENT_ARRAY_BUFFER_BINDING = gl.ELEMENT_ARRAY_BUFFER_BINDING _G.GL_STREAM_DRAW = gl.STREAM_DRAW _G.GL_SCISSOR_BOX = gl.SCISSOR_BOX _G.GL_TEXTURE26 = gl.TEXTURE26 _G.GL_TEXTURE27 = gl.TEXTURE27 _G.GL_TEXTURE24 = gl.TEXTURE24 _G.GL_TEXTURE25 = gl.TEXTURE25 _G.GL_NO_ERROR = gl.NO_ERROR _G.GL_TEXTURE29 = gl.TEXTURE29 _G.GL_FLOAT_MAT4 = gl.FLOAT_MAT4 _G.GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = gl.VERTEX_ATTRIB_ARRAY_NORMALIZED _G.GL_SAMPLE_COVERAGE_INVERT = gl.SAMPLE_COVERAGE_INVERT _G.GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL _G.GL_FLOAT_VEC3 = gl.FLOAT_VEC3 _G.GL_STENCIL_CLEAR_VALUE = gl.STENCIL_CLEAR_VALUE _G.GL_UNSIGNED_SHORT_5_5_5_1 = gl.UNSIGNED_SHORT_5_5_5_1 _G.GL_ACTIVE_UNIFORMS = gl.ACTIVE_UNIFORMS _G.GL_INVALID_OPERATION = gl.INVALID_OPERATION _G.GL_DEPTH_ATTACHMENT = gl.DEPTH_ATTACHMENT _G.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS _G.GL_FRAMEBUFFER_COMPLETE = gl.FRAMEBUFFER_COMPLETE _G.GL_ONE_MINUS_CONSTANT_COLOR = gl.ONE_MINUS_CONSTANT_COLOR _G.GL_TEXTURE2 = gl.TEXTURE2 _G.GL_TEXTURE1 = gl.TEXTURE1 _G.GL_GEQUAL = gl.GEQUAL _G.GL_TEXTURE7 = gl.TEXTURE7 _G.GL_TEXTURE6 = gl.TEXTURE6 _G.GL_TEXTURE5 = gl.TEXTURE5 _G.GL_TEXTURE4 = gl.TEXTURE4 _G.GL_GENERATE_MIPMAP_HINT = gl.GENERATE_MIPMAP_HINT _G.GL_ONE_MINUS_SRC_COLOR = gl.ONE_MINUS_SRC_COLOR _G.GL_TEXTURE9 = gl.TEXTURE9 _G.GL_STENCIL_TEST = gl.STENCIL_TEST _G.GL_COLOR_WRITEMASK = gl.COLOR_WRITEMASK _G.GL_DEPTH_COMPONENT = gl.DEPTH_COMPONENT _G.GL_STENCIL_INDEX8 = gl.STENCIL_INDEX8 _G.GL_VERTEX_ATTRIB_ARRAY_TYPE = gl.VERTEX_ATTRIB_ARRAY_TYPE _G.GL_FLOAT_VEC2 = gl.FLOAT_VEC2 _G.GL_BLUE_BITS = gl.BLUE_BITS _G.GL_VERTEX_SHADER = gl.VERTEX_SHADER _G.GL_SUBPIXEL_BITS = gl.SUBPIXEL_BITS _G.GL_STENCIL_WRITEMASK = gl.STENCIL_WRITEMASK _G.GL_FLOAT_VEC4 = gl.FLOAT_VEC4 _G.GL_TEXTURE17 = gl.TEXTURE17 _G.GL_ONE_MINUS_CONSTANT_ALPHA = gl.ONE_MINUS_CONSTANT_ALPHA _G.GL_TEXTURE15 = gl.TEXTURE15 _G.GL_TEXTURE14 = gl.TEXTURE14 _G.GL_TEXTURE13 = gl.TEXTURE13 _G.GL_SAMPLES = gl.SAMPLES _G.GL_TEXTURE11 = gl.TEXTURE11 _G.GL_TEXTURE10 = gl.TEXTURE10 _G.GL_FUNC_SUBTRACT = gl.FUNC_SUBTRACT _G.GL_STENCIL_BUFFER_BIT = gl.STENCIL_BUFFER_BIT _G.GL_TEXTURE19 = gl.TEXTURE19 _G.GL_TEXTURE18 = gl.TEXTURE18 _G.GL_NEAREST_MIPMAP_NEAREST = gl.NEAREST_MIPMAP_NEAREST _G.GL_SHORT = gl.SHORT _G.GL_RENDERBUFFER_BINDING = gl.RENDERBUFFER_BINDING _G.GL_REPEAT = gl.REPEAT _G.GL_TEXTURE_MIN_FILTER = gl.TEXTURE_MIN_FILTER _G.GL_RED_BITS = gl.RED_BITS _G.GL_FRONT_FACE = gl.FRONT_FACE _G.GL_BLEND_COLOR = gl.BLEND_COLOR _G.GL_MIRRORED_REPEAT = gl.MIRRORED_REPEAT _G.GL_INT_VEC4 = gl.INT_VEC4 _G.GL_MAX_CUBE_MAP_TEXTURE_SIZE = gl.MAX_CUBE_MAP_TEXTURE_SIZE _G.GL_RENDERBUFFER_BLUE_SIZE = gl.RENDERBUFFER_BLUE_SIZE _G.GL_SAMPLE_COVERAGE = gl.SAMPLE_COVERAGE _G.GL_SRC_ALPHA = gl.SRC_ALPHA _G.GL_FUNC_REVERSE_SUBTRACT = gl.FUNC_REVERSE_SUBTRACT _G.GL_DEPTH_WRITEMASK = gl.DEPTH_WRITEMASK _G.GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = gl.FRAMEBUFFER_INCOMPLETE_ATTACHMENT _G.GL_POLYGON_OFFSET_FILL = gl.POLYGON_OFFSET_FILL _G.GL_STENCIL_FUNC = gl.STENCIL_FUNC _G.GL_REPLACE = gl.REPLACE _G.GL_LUMINANCE_ALPHA = gl.LUMINANCE_ALPHA _G.GL_DEPTH_RANGE = gl.DEPTH_RANGE _G.GL_FASTEST = gl.FASTEST _G.GL_STENCIL_FAIL = gl.STENCIL_FAIL _G.GL_UNSIGNED_SHORT = gl.UNSIGNED_SHORT _G.GL_RENDERBUFFER_HEIGHT = gl.RENDERBUFFER_HEIGHT _G.GL_STENCIL_BACK_FAIL = gl.STENCIL_BACK_FAIL _G.GL_BLEND_SRC_RGB = gl.BLEND_SRC_RGB _G.GL_TEXTURE3 = gl.TEXTURE3 _G.GL_RENDERBUFFER = gl.RENDERBUFFER _G.GL_RGB5_A1 = gl.RGB5_A1 _G.GL_RENDERBUFFER_ALPHA_SIZE = gl.RENDERBUFFER_ALPHA_SIZE _G.GL_RENDERBUFFER_STENCIL_SIZE = gl.RENDERBUFFER_STENCIL_SIZE _G.GL_NOTEQUAL = gl.NOTEQUAL _G.GL_BLEND_DST_RGB = gl.BLEND_DST_RGB _G.GL_FRONT_AND_BACK = gl.FRONT_AND_BACK _G.GL_TEXTURE_BINDING_CUBE_MAP = gl.TEXTURE_BINDING_CUBE_MAP _G.GL_MAX_RENDERBUFFER_SIZE = gl.MAX_RENDERBUFFER_SIZE _G.GL_ZERO = gl.ZERO _G.GL_TEXTURE0 = gl.TEXTURE0 _G.GL_SAMPLE_ALPHA_TO_COVERAGE = gl.SAMPLE_ALPHA_TO_COVERAGE _G.GL_BUFFER_USAGE = gl.BUFFER_USAGE _G.GL_ACTIVE_TEXTURE = gl.ACTIVE_TEXTURE _G.GL_BYTE = gl.BYTE _G.GL_CW = gl.CW _G.GL_DYNAMIC_DRAW = gl.DYNAMIC_DRAW _G.GL_RENDERBUFFER_RED_SIZE = gl.RENDERBUFFER_RED_SIZE _G.GL_FALSE = gl.FALSE _G.GL_GREATER = gl.GREATER _G.GL_RGBA4 = gl.RGBA4 _G.GL_VALIDATE_STATUS = gl.VALIDATE_STATUS _G.GL_STENCIL_BITS = gl.STENCIL_BITS _G.GL_RGB = gl.RGB _G.GL_INT = gl.INT _G.GL_DEPTH_FUNC = gl.DEPTH_FUNC _G.GL_SAMPLER_2D = gl.SAMPLER_2D _G.GL_NICEST = gl.NICEST _G.GL_MAX_VIEWPORT_DIMS = gl.MAX_VIEWPORT_DIMS _G.GL_CULL_FACE = gl.CULL_FACE _G.GL_INT_VEC3 = gl.INT_VEC3 _G.GL_ALIASED_POINT_SIZE_RANGE = gl.ALIASED_POINT_SIZE_RANGE _G.GL_INVALID_ENUM = gl.INVALID_ENUM _G.GL_INVERT = gl.INVERT _G.GL_CULL_FACE_MODE = gl.CULL_FACE_MODE _G.GL_TEXTURE8 = gl.TEXTURE8 _G.GL_VERTEX_ATTRIB_ARRAY_POINTER = gl.VERTEX_ATTRIB_ARRAY_POINTER _G.GL_TEXTURE_WRAP_S = gl.TEXTURE_WRAP_S _G.GL_VERTEX_ATTRIB_ARRAY_STRIDE = gl.VERTEX_ATTRIB_ARRAY_STRIDE _G.GL_LINES = gl.LINES _G.GL_EQUAL = gl.EQUAL _G.GL_LINE_LOOP = gl.LINE_LOOP _G.GL_TEXTURE_WRAP_T = gl.TEXTURE_WRAP_T _G.GL_DEPTH_BUFFER_BIT = gl.DEPTH_BUFFER_BIT _G.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS _G.GL_SHADER_TYPE = gl.SHADER_TYPE _G.GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME _G.GL_TEXTURE_CUBE_MAP_NEGATIVE_X = gl.TEXTURE_CUBE_MAP_NEGATIVE_X _G.GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = gl.TEXTURE_CUBE_MAP_NEGATIVE_Y _G.GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = gl.TEXTURE_CUBE_MAP_NEGATIVE_Z _G.GL_DECR = gl.DECR _G.GL_DELETE_STATUS = gl.DELETE_STATUS _G.GL_DEPTH_BITS = gl.DEPTH_BITS _G.GL_INCR = gl.INCR _G.GL_SAMPLE_COVERAGE_VALUE = gl.SAMPLE_COVERAGE_VALUE _G.GL_ALPHA_BITS = gl.ALPHA_BITS _G.GL_FLOAT_MAT2 = gl.FLOAT_MAT2 _G.GL_LINE_STRIP = gl.LINE_STRIP _G.GL_SHADER_SOURCE_LENGTH = gl.SHADER_SOURCE_LENGTH _G.GL_INVALID_VALUE = gl.INVALID_VALUE _G.GL_NEVER = gl.NEVER _G.GL_INCR_WRAP = gl.INCR_WRAP _G.GL_BLEND_EQUATION_ALPHA = gl.BLEND_EQUATION_ALPHA _G.GL_TEXTURE_MAG_FILTER = gl.TEXTURE_MAG_FILTER _G.GL_POINTS = gl.POINTS _G.GL_COLOR_ATTACHMENT0 = gl.COLOR_ATTACHMENT0 _G.GL_RGBA = gl.RGBA _G.GL_SRC_ALPHA_SATURATE = gl.SRC_ALPHA_SATURATE _G.GL_SAMPLER_CUBE = gl.SAMPLER_CUBE _G.GL_FRAMEBUFFER = gl.FRAMEBUFFER _G.GL_TEXTURE_CUBE_MAP = gl.TEXTURE_CUBE_MAP _G.GL_SAMPLE_BUFFERS = gl.SAMPLE_BUFFERS _G.GL_LINEAR = gl.LINEAR _G.GL_LINEAR_MIPMAP_NEAREST = gl.LINEAR_MIPMAP_NEAREST _G.GL_ACTIVE_UNIFORM_MAX_LENGTH = gl.ACTIVE_UNIFORM_MAX_LENGTH _G.GL_STENCIL_BACK_REF = gl.STENCIL_BACK_REF _G.GL_ELEMENT_ARRAY_BUFFER = gl.ELEMENT_ARRAY_BUFFER _G.GL_CLAMP_TO_EDGE = gl.CLAMP_TO_EDGE _G.GL_TRIANGLE_STRIP = gl.TRIANGLE_STRIP _G.GL_CONSTANT_COLOR = gl.CONSTANT_COLOR _G.GL_COMPILE_STATUS = gl.COMPILE_STATUS _G.GL_RENDERBUFFER_GREEN_SIZE = gl.RENDERBUFFER_GREEN_SIZE _G.GL_UNSIGNED_INT = gl.UNSIGNED_INT _G.GL_DEPTH_CLEAR_VALUE = gl.DEPTH_CLEAR_VALUE _G.GL_ALIASED_LINE_WIDTH_RANGE = gl.ALIASED_LINE_WIDTH_RANGE _G.GL_SHADING_LANGUAGE_VERSION = gl.SHADING_LANGUAGE_VERSION _G.GL_FRAMEBUFFER_UNSUPPORTED = gl.FRAMEBUFFER_UNSUPPORTED _G.GL_INFO_LOG_LENGTH = gl.INFO_LOG_LENGTH _G.GL_STENCIL_PASS_DEPTH_PASS = gl.STENCIL_PASS_DEPTH_PASS _G.GL_STENCIL_VALUE_MASK = gl.STENCIL_VALUE_MASK _G.GL_ALWAYS = gl.ALWAYS _G.GL_MAX_TEXTURE_SIZE = gl.MAX_TEXTURE_SIZE _G.GL_FLOAT = gl.FLOAT _G.GL_FRAMEBUFFER_BINDING = gl.FRAMEBUFFER_BINDING _G.GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = gl.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT _G.GL_TRIANGLE_FAN = gl.TRIANGLE_FAN _G.GL_INVALID_FRAMEBUFFER_OPERATION = gl.INVALID_FRAMEBUFFER_OPERATION _G.GL_TEXTURE_2D = gl.TEXTURE_2D _G.GL_ALPHA = gl.ALPHA _G.GL_CURRENT_VERTEX_ATTRIB = gl.CURRENT_VERTEX_ATTRIB _G.GL_SCISSOR_TEST = gl.SCISSOR_TEST _G.GL_TRIANGLES = gl.TRIANGLES
mit
infernall/nevermind
plugins/ingroup.lua
371
44212
do -- Check Member local function check_member_autorealm(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)] = { group_type = 'Realm', 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 realms = 'realms' if not data[tostring(realms)] then data[tostring(realms)] = {} save_data(_config.moderation.data, data) end data[tostring(realms)][tostring(msg.to.id)] = msg.to.id save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Welcome to your new realm !') end end end local function check_member_realm_add(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)] = { group_type = 'Realm', 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 realms = 'realms' if not data[tostring(realms)] then data[tostring(realms)] = {} save_data(_config.moderation.data, data) end data[tostring(realms)][tostring(msg.to.id)] = msg.to.id save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Realm has been added!') end end end function check_member_group(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)] = { group_type = 'Group', 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)] = { group_type = 'Group', 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_group,{receiver=receiver, data=data, msg = msg}) end end local function autorealmadd(msg) local data = load_data(_config.moderation.data) if msg.action.type == 'chat_created' then receiver = get_receiver(msg) chat_info(receiver, check_member_autorealm,{receiver=receiver, data=data, msg = msg}) end end local function check_member_realmrem(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 -- Realm configuration removal data[tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) local realms = 'realms' if not data[tostring(realms)] then data[tostring(realms)] = nil save_data(_config.moderation.data, data) end data[tostring(realms)][tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) return send_large_msg(receiver, 'Realm has been removed!') end 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 --End Check Member 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 leave_ban = "no" if data[tostring(msg.to.id)]['settings']['leave_ban'] then leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban'] 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.."\nLock group leave : "..leave_ban.."\nflood sensitivity : "..NUM_MSG_MAX.."\nBot protection : "..bots_protection--"\nPublic: "..public 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 set_public_membermod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_member_lock = data[tostring(target)]['settings']['public'] if group_member_lock == 'yes' then return 'Group is already public' else data[tostring(target)]['settings']['public'] = 'yes' save_data(_config.moderation.data, data) end return 'Group is now: public' end local function unset_public_membermod(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local group_member_lock = data[tostring(target)]['settings']['public'] if group_member_lock == 'no' then return 'Group is not public' else data[tostring(target)]['settings']['public'] = 'no' save_data(_config.moderation.data, data) return 'Group is now: not public' end end local function lock_group_leave(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban'] if leave_ban == 'yes' then return 'Leaving users will be banned' else data[tostring(msg.to.id)]['settings']['leave_ban'] = 'yes' save_data(_config.moderation.data, data) end return 'Leaving users will be banned' end local function unlock_group_leave(msg, data, target) if not is_momod(msg) then return "For moderators only!" end local leave_ban = data[tostring(msg.to.id)]['settings']['leave_ban'] if leave_ban == 'no' then return 'Leaving users will not be banned' else data[tostring(msg.to.id)]['settings']['leave_ban'] = 'no' save_data(_config.moderation.data, data) return 'Leaving users will not be banned' 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 is_group(msg) 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 realmadd(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 is_realm(msg) then return 'Realm is already added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_realm_add,{receiver=receiver, data=data, msg = msg}) end -- Global functions 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 is_group(msg) then return 'Group is not added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_modrem,{receiver=receiver, data=data, msg = msg}) end function realmrem(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 is_realm(msg) then return 'Realm is not added.' end receiver = get_receiver(msg) chat_info(receiver, check_member_realmrem,{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 promote_by_reply(extra, success, result) local msg = result local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '') if msg.from.username then member_username = '@'.. msg.from.username else member_username = full_name end local member_id = msg.from.id if msg.to.type == 'chat' then return promote(get_receiver(msg), member_username, member_id) end 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 demote_by_reply(extra, success, result) local msg = result local full_name = (msg.from.first_name or '')..' '..(msg.from.last_name or '') if msg.from.username then member_username = '@'..msg.from.username else member_username = full_name end local member_id = msg.from.id if msg.to.type == 'chat' then return demote(get_receiver(msg), member_username, member_id) end end local function setowner_by_reply(extra, success, result) local msg = result local receiver = get_receiver(msg) local data = load_data(_config.moderation.data) local name_log = msg.from.print_name:gsub("_", " ") data[tostring(msg.to.id)]['set_owner'] = tostring(msg.from.id) save_data(_config.moderation.data, data) savelog(msg.to.id, name_log.." ["..msg.from.id.."] setted ["..msg.from.id.."] as owner") local text = msg.from.print_name:gsub("_", " ").." is the owner now" return send_large_msg(receiver, text) end local function promote_demote_res(extra, success, result) --vardump(result) --vardump(extra) local member_id = result.id local member_username = "@"..result.username local chat_id = extra.chat_id local mod_cmd = extra.mod_cmd local receiver = "chat#id"..chat_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 local function modlist(msg) local data = load_data(_config.moderation.data) local groups = "groups" if not data[tostring(groups)][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) --vardump(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 for k,v in pairs(result.members) do kick_user(v.id, result.id) end end local function killchat(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.id local chatname = result.print_name for k,v in pairs(result.members) do kick_user_any(v.id, result.id) end end local function killrealm(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.id local chatname = result.print_name for k,v in pairs(result.members) do kick_user_any(v.id, result.id) end end local function user_msgs(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 = tonumber(redis:get(um_hash) or 0) return user_info end local function kick_zero(cb_extra, success, result) local chat_id = cb_extra.chat_id local chat = "chat#id"..chat_id local ci_user local re_user for k,v in pairs(result.members) do local si = false ci_user = v.id local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) for i = 1, #users do re_user = users[i] if tonumber(ci_user) == tonumber(re_user) then si = true end end if not si then if ci_user ~= our_id then if not is_momod2(ci_user, chat_id) then chat_del_user(chat, 'user#id'..ci_user, ok_cb, true) end end end end end local function kick_inactive(chat_id, num, receiver) local hash = 'chat:'..chat_id..':users' local users = redis:smembers(hash) -- Get user info for i = 1, #users do local user_id = users[i] local user_info = user_msgs(user_id, chat_id) local nmsg = user_info if tonumber(nmsg) < tonumber(num) then if not is_momod2(user_id, chat_id) then chat_del_user('chat#id'..chat_id, 'user#id'..user_id, ok_cb, true) end end end return chat_info(receiver, kick_zero, {chat_id = chat_id}) 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' and not matches[2] then if is_realm(msg) then return 'Error: Already a realm.' end print("group "..msg.to.print_name.."("..msg.to.id..") added") return modadd(msg) end if matches[1] == 'add' and matches[2] == 'realm' then if is_group(msg) then return 'Error: Already a group.' end print("group "..msg.to.print_name.."("..msg.to.id..") added as a realm") return realmadd(msg) end if matches[1] == 'rem' and not matches[2] then print("group "..msg.to.print_name.."("..msg.to.id..") removed") return modrem(msg) end if matches[1] == 'rem' and matches[2] == 'realm' then print("group "..msg.to.print_name.."("..msg.to.id..") removed as a realm") return realmrem(msg) end if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "group" then return automodadd(msg) end if matches[1] == 'chat_created' and msg.from.id == 0 and group_type == "realm" then return autorealmadd(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_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 not matches[2] then if not is_owner(msg) then return "Only the owner can prmote new moderators" end if type(msg.reply_id)~="nil" then msgr = get_message(msg.reply_id, promote_by_reply, false) end end if matches[1] == 'promote' and matches[2] then if not is_momod(msg) then return end if not is_owner(msg) then return "Only owner can promote" end local member = matches[2] savelog(msg.to.id, name_log.." ["..msg.from.id.."] promoted @".. member) local cbres_extra = { chat_id = msg.to.id, mod_cmd = 'promote', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') return res_user(username, promote_demote_res, cbres_extra) end if matches[1] == 'demote' and not matches[2] then if not is_owner(msg) then return "Only the owner can demote moderators" end if type(msg.reply_id)~="nil" then msgr = get_message(msg.reply_id, demote_by_reply, false) end end if matches[1] == 'demote' and matches[2] then if not is_momod(msg) then return end if not is_owner(msg) then return "Only owner can demote" end if string.gsub(matches[2], "@", "") == msg.from.username and not is_owner(msg) then return "You can't demote yourself" end local member = matches[2] savelog(msg.to.id, name_log.." ["..msg.from.id.."] demoted @".. member) local cbres_extra = { chat_id = msg.to.id, mod_cmd = 'demote', from_id = msg.from.id } local username = matches[2] local username = string.gsub(matches[2], '@', '') return res_user(username, promote_demote_res, cbres_extra) 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 if matches[2] == 'leave' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] locked leaving ") return lock_group_leave(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 if matches[2] == 'leave' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] unlocked leaving ") return unlock_group_leave(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] == 'public' then local target = msg.to.id if matches[2] == 'yes' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: public") return set_public_membermod(msg, data, target) end if matches[2] == 'no' then savelog(msg.to.id, name_log.." ["..msg.from.id.."] set group to: not public") return unset_public_membermod(msg, data, target) end end]] if matches[1] == 'newlink' and not is_realm(msg) 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' and matches[2] 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] == 'setowner' and not matches[2] then if not is_owner(msg) then return "only for the owner!" end if type(msg.reply_id)~="nil" then msgr = get_message(msg.reply_id, setowner_by_reply, false) end end if matches[1] == 'owner' then local group_owner = data[tostring(msg.to.id)]['set_owner'] local user_info = redis:hgetall('user:'..group_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") if user_info.username then return "Group onwer is @"..user_info.username.." ["..group_owner.."]" else return "Group owner is ["..group_owner..']' end 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] == 'kill' and matches[2] == 'chat' then if not is_admin(msg) then return nil end if not is_realm(msg) then local receiver = get_receiver(msg) return modrem(msg), print("Closing Group..."), chat_info(receiver, killchat, {receiver=receiver}) else return 'This is a realm' end end if matches[1] == 'kill' and matches[2] == 'realm' then if not is_admin(msg) then return nil end if not is_group(msg) then local receiver = get_receiver(msg) return realmrem(msg), print("Closing Realm..."), chat_info(receiver, killrealm, {receiver=receiver}) else return 'This is a group' end end if matches[1] == 'help' then if not is_momod(msg) or is_realm(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 if matches[1] == 'kickinactive' then --send_large_msg('chat#id'..msg.to.id, 'I\'m in matches[1]') if not is_momod(msg) then return 'Only a moderator can kick inactive users' end local num = 1 if matches[2] then num = matches[2] end local chat_id = msg.to.id local receiver = get_receiver(msg) return kick_inactive(chat_id, num, receiver) end end end return { patterns = { "^[!/](add)$", "^[!/](add) (realm)$", "^[!/](rem)$", "^[!/](rem) (realm)$", "^[!/](rules)$", "^[!/](about)$", "^[!/](setname) (.*)$", "^[!/](setphoto)$", "^[!/](promote) (.*)$", "^[!/](promote)", "^[!/](help)$", "^[!/](clean) (.*)$", "^[!/](kill) (chat)$", "^[!/](kill) (realm)$", "^[!/](demote) (.*)$", "^[!/](demote)", "^[!/](set) ([^%s]+) (.*)$", "^[!/](lock) (.*)$", "^[!/](setowner) (%d+)$", "^[!/](setowner)", "^[!/](owner)$", "^[!/](res) (.*)$", "^[!/](setgpowner) (%d+) (%d+)$",-- (group id) (owner id) "^[!/](unlock) (.*)$", "^[!/](setflood) (%d+)$", "^[!/](settings)$", -- "^[!/](public) (.*)$", "^[!/](modlist)$", "^[!/](newlink)$", "^[!/](link)$", "^[!/](kickinactive)$", "^[!/](kickinactive) (%d+)$", "%[(photo)%]", "^!!tgservice (.+)$", }, run = run } end
gpl-2.0
Wargus/stargus
scripts/protoss/upgrade.lua
2
4671
-- -- Upgrades --[[ upgrades = { { "upgrade-zerg-zergling-speed", "icon-zerg-zergling-attack-speed", { 200, 100, 100, 0, 0, 0, 0}}, { "upgrade-terran-infantry-weapons2", "icon-terran-upgrade-infantry-weapons", { 200, 175, 175, 0, 0, 0, 0}}, { "upgrade-terran-infantry-weapons3", "icon-terran-upgrade-infantry-weapons", { 200, 250, 250, 0, 0, 0, 0}}, { "upgrade-terran-infantry-armor1", "icon-terran-upgrade-infantry-armor", { 200, 100, 100, 0, 0, 0, 0}}, { "upgrade-terran-infantry-armor2", "icon-terran-upgrade-infantry-armor", { 200, 175, 175, 0, 0, 0, 0}}, { "upgrade-terran-infantry-armor3", "icon-terran-upgrade-infantry-armor", { 200, 250, 250, 0, 0, 0, 0}}, { "upgrade-terran-u238-shells", "icon-terran-u238-shells", { 200, 150, 150, 0, 0, 0, 0}}, { "upgrade-terran-stim-pack", "icon-terran-stim-pack", { 200, 100, 100, 0, 0, 0, 0}}, } for i = 1,table.getn(upgrades) do u = CUpgrade:New(upgrades[i][1]) u.Icon = Icons[upgrades[i][2]] --[[ for j = 1,table.getn(upgrades[1][3]) do u.Costs[j - 1] = upgrades[i][3][j] end end -- -- Modifiers -- DefineModifier("upgrade-terran-infantry-weapons1", {"Level", 1}, {"PiercingDamage", 2}, {"apply-to", "unit-terran-marine"}, {"apply-to", "unit-terran-firebat"}, {"apply-to", "unit-terran-ghost"}) DefineModifier("upgrade-terran-infantry-weapons2", {"Level", 2}, {"PiercingDamage", 3}, {"apply-to", "unit-terran-marine"}, {"apply-to", "unit-terran-firebat"}, {"apply-to", "unit-terran-ghost"}) DefineModifier("upgrade-terran-infantry-weapons3", {"Level", 3}, {"PiercingDamage", 4}, {"apply-to", "unit-terran-marine"}, {"apply-to", "unit-terran-firebat"}, {"apply-to", "unit-terran-ghost"}) DefineModifier("upgrade-terran-infantry-armor1", {"Level", 1}, {"Armor", 2}, {"apply-to", "unit-terran-marine"}, {"apply-to", "unit-terran-firebat"}, {"apply-to", "unit-terran-ghost"}) DefineModifier("upgrade-terran-infantry-armor2", {"Level", 2}, {"Armor", 3}, {"apply-to", "unit-terran-marine"}, {"apply-to", "unit-terran-firebat"}, {"apply-to", "unit-terran-ghost"}) DefineModifier("upgrade-terran-infantry-armor3", {"Level", 3}, {"Armor", 4}, {"apply-to", "unit-terran-marine"}, {"apply-to", "unit-terran-firebat"}, {"apply-to", "unit-terran-ghost"}) DefineModifier("upgrade-terran-u238-shells", {"Level", 1}, {"AttackRange", 4}, {"apply-to", "unit-terran-marine"}, {"apply-to", "unit-terran-ghost"}) DefineModifier("upgrade-terran-stim-pack", {"Level", 1}, {"Armor", 2}, {"apply-to", "unit-terran-marine"}, {"apply-to", "unit-terran-firebat"}, {"apply-to", "unit-terran-ghost"}) -- -- Allow -- DefineAllow("upgrade-terran-infantry-weapons1", "AAAAAAAAAAAAAAAA") DefineAllow("upgrade-terran-infantry-weapons2", "AAAAAAAAAAAAAAAA") DefineAllow("upgrade-terran-infantry-weapons3", "AAAAAAAAAAAAAAAA") DefineAllow("upgrade-terran-infantry-armor1", "AAAAAAAAAAAAAAAA") DefineAllow("upgrade-terran-infantry-armor2", "AAAAAAAAAAAAAAAA") DefineAllow("upgrade-terran-infantry-armor3", "AAAAAAAAAAAAAAAA") DefineAllow("upgrade-terran-stim-pack", "AAAAAAAAAAAAAAAA") DefineAllow("upgrade-terran-u238-shells", "AAAAAAAAAAAAAAAA") -- -- Dependencies -- DefineDependency("upgrade-terran-infantry-weapons2", {"upgrade-terran-infantry-weapons1"}) DefineDependency("upgrade-terran-infantry-weapons3", {"upgrade-terran-infantry-weapons2"}) DefineDependency("upgrade-terran-infantry-armor2", {"upgrade-terran-infantry-armor1"}) DefineDependency("upgrade-terran-infantry-armor3", {"upgrade-terran-infantry-armor2"}) DefineDependency("unit-terran-ghost", {"unit-terran-academy", "unit-terran-science-facility", --[["unit-terran-covert-ops"]]}) DefineDependency("unit-terran-supply-depot", {"unit-terran-command-center"}) DefineDependency("unit-terran-engineering-bay", {"unit-terran-command-center"}) DefineDependency("unit-terran-barracks", {"unit-terran-command-center"}) DefineDependency("unit-terran-refinery", {"unit-terran-command-center"}) DefineDependency("unit-terran-missile-turret", {"unit-terran-engineering-bay"}) DefineDependency("unit-terran-academy", {"unit-terran-barracks"}) DefineDependency("unit-terran-bunker", {"unit-terran-barracks"}) DefineDependency("unit-terran-factory", {"unit-terran-barracks"}) DefineDependency("unit-terran-armory", {"unit-terran-factory"}) DefineDependency("unit-terran-starport", {"unit-terran-factory"}) DefineDependency("unit-terran-science-facility", {"unit-terran-starport"}) --]]
gpl-2.0
TheAnswer/FirstTest
bin/scripts/skills/creatureSkills/npcs/imperial/imperialMajorGeneralAttacks.lua
1
3016
--Copyright (C) 2007 <SWGEmu> --This File is part of Core3. --This program is free software; you can redistribute --it and/or modify it under the terms of the GNU Lesser --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 Lesser General Public License for --more details. --You should have received a copy of the GNU Lesser General --Public License along with this program; if not, write to --the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA --Linking Engine3 statically or dynamically with other modules --is making a combined work based on Engine3. --Thus, the terms and conditions of the GNU Lesser General Public License --cover the whole combination. --In addition, as a special exception, the copyright holders of Engine3 --give you permission to combine Engine3 program with free software --programs or libraries that are released under the GNU LGPL and with --code included in the standard release of Core3 under the GNU LGPL --license (or modified versions of such code, with unchanged license). --You may copy and distribute such a system following the terms of the --GNU LGPL for Engine3 and the licenses of the other code concerned, --provided that you include the source code of that other code when --and as the GNU LGPL requires distribution of source code. --Note that people who make modified versions of Engine3 are not obligated --to grant this special exception for their modified versions; --it is their choice whether to do so. The GNU Lesser General Public License --gives permission to release a modified version without this exception; --this exception also makes it possible to release a modified version --which carries forward this exception. imperialMajorGeneralAttack1 = { attackname = "imperialMajorGeneralAttack1", animation = "fire_1_special_single_light", requiredWeaponType = PISTOL, range = 65, damageRatio = 1.2, speedRatio = 1, areaRange = 0, accuracyBonus = 0, healthAttackChance = 100, actionAttackChance = 0, mindAttackChance = 0, dotChance = 60, tickStrengthOfHit = 1, fireStrength = 0, fireType = 0, bleedingStrength = 1, bleedingType = HEALTH, poisonStrength = 0, poisonType = 0, diseaseStrength = 0, diseaseType = 0, CbtSpamBlock = "sapblast_block", CbtSpamCounter = "sapblast_counter", CbtSpamEvade = "sapblast_evade", CbtSpamHit = "sapblast_hit", CbtSpamMiss = "sapblast_miss", invalidStateMask = 0, invalidPostures = "", instant = 0 } AddRandomPoolAttackTargetSkill(imperialMajorGeneralAttack1) -----------------------------------------------------------------------
lgpl-3.0