repo_name
stringlengths
6
69
path
stringlengths
6
178
copies
stringclasses
278 values
size
stringlengths
4
7
content
stringlengths
671
917k
license
stringclasses
15 values
SorBlackPlus/AntiSpam
libs/serpent.lua
656
7877
local n, v = "serpent", 0.28 -- (C) 2012-15 Paul Kulchenko; MIT License local c, d = "Paul Kulchenko", "Lua serializer and pretty printer" local snum = {[tostring(1/0)]='1/0 --[[math.huge]]',[tostring(-1/0)]='-1/0 --[[-math.huge]]',[tostring(0/0)]='0/0'} local badtype = {thread = true, userdata = true, cdata = true} local keyword, globals, G = {}, {}, (_G or _ENV) for _,k in ipairs({'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while'}) do keyword[k] = true end for k,v in pairs(G) do globals[v] = k end -- build func to name mapping for _,g in ipairs({'coroutine', 'debug', 'io', 'math', 'string', 'table', 'os'}) do for k,v in pairs(G[g] or {}) do globals[v] = g..'.'..k end end local function s(t, opts) local name, indent, fatal, maxnum = opts.name, opts.indent, opts.fatal, opts.maxnum local sparse, custom, huge = opts.sparse, opts.custom, not opts.nohuge local space, maxl = (opts.compact and '' or ' '), (opts.maxlevel or math.huge) local iname, comm = '_'..(name or ''), opts.comment and (tonumber(opts.comment) or math.huge) local seen, sref, syms, symn = {}, {'local '..iname..'={}'}, {}, 0 local function gensym(val) return '_'..(tostring(tostring(val)):gsub("[^%w]",""):gsub("(%d%w+)", -- tostring(val) is needed because __tostring may return a non-string value function(s) if not syms[s] then symn = symn+1; syms[s] = symn end return tostring(syms[s]) end)) end local function safestr(s) return type(s) == "number" and tostring(huge and snum[tostring(s)] or s) or type(s) ~= "string" and tostring(s) -- escape NEWLINE/010 and EOF/026 or ("%q"):format(s):gsub("\010","n"):gsub("\026","\\026") end local function comment(s,l) return comm and (l or 0) < comm and ' --[['..tostring(s)..']]' or '' end local function globerr(s,l) return globals[s] and globals[s]..comment(s,l) or not fatal and safestr(select(2, pcall(tostring, s))) or error("Can't serialize "..tostring(s)) end local function safename(path, name) -- generates foo.bar, foo[3], or foo['b a r'] local n = name == nil and '' or name local plain = type(n) == "string" and n:match("^[%l%u_][%w_]*$") and not keyword[n] local safe = plain and n or '['..safestr(n)..']' return (path or '')..(plain and path and '.' or '')..safe, safe end local alphanumsort = type(opts.sortkeys) == 'function' and opts.sortkeys or function(k, o, n) -- k=keys, o=originaltable, n=padding local maxn, to = tonumber(n) or 12, {number = 'a', string = 'b'} local function padnum(d) return ("%0"..tostring(maxn).."d"):format(tonumber(d)) end table.sort(k, function(a,b) -- sort numeric keys first: k[key] is not nil for numerical keys return (k[a] ~= nil and 0 or to[type(a)] or 'z')..(tostring(a):gsub("%d+",padnum)) < (k[b] ~= nil and 0 or to[type(b)] or 'z')..(tostring(b):gsub("%d+",padnum)) end) end local function val2str(t, name, indent, insref, path, plainindex, level) local ttype, level, mt = type(t), (level or 0), getmetatable(t) local spath, sname = safename(path, name) local tag = plainindex and ((type(name) == "number") and '' or name..space..'='..space) or (name ~= nil and sname..space..'='..space or '') if seen[t] then -- already seen this element sref[#sref+1] = spath..space..'='..space..seen[t] return tag..'nil'..comment('ref', level) end if type(mt) == 'table' and (mt.__serialize or mt.__tostring) then -- knows how to serialize itself seen[t] = insref or spath if mt.__serialize then t = mt.__serialize(t) else t = tostring(t) end ttype = type(t) end -- new value falls through to be serialized if ttype == "table" then if level >= maxl then return tag..'{}'..comment('max', level) end seen[t] = insref or spath if next(t) == nil then return tag..'{}'..comment(t, level) end -- table empty local maxn, o, out = math.min(#t, maxnum or #t), {}, {} for key = 1, maxn do o[key] = key end if not maxnum or #o < maxnum then local n = #o -- n = n + 1; o[n] is much faster than o[#o+1] on large tables for key in pairs(t) do if o[key] ~= key then n = n + 1; o[n] = key end end end if maxnum and #o > maxnum then o[maxnum+1] = nil end if opts.sortkeys and #o > maxn then alphanumsort(o, t, opts.sortkeys) end local sparse = sparse and #o > maxn -- disable sparsness if only numeric keys (shorter output) for n, key in ipairs(o) do local value, ktype, plainindex = t[key], type(key), n <= maxn and not sparse if opts.valignore and opts.valignore[value] -- skip ignored values; do nothing or opts.keyallow and not opts.keyallow[key] or opts.valtypeignore and opts.valtypeignore[type(value)] -- skipping ignored value types or sparse and value == nil then -- skipping nils; do nothing elseif ktype == 'table' or ktype == 'function' or badtype[ktype] then if not seen[key] and not globals[key] then sref[#sref+1] = 'placeholder' local sname = safename(iname, gensym(key)) -- iname is table for local variables sref[#sref] = val2str(key,sname,indent,sname,iname,true) end sref[#sref+1] = 'placeholder' local path = seen[t]..'['..tostring(seen[key] or globals[key] or gensym(key))..']' sref[#sref] = path..space..'='..space..tostring(seen[value] or val2str(value,nil,indent,path)) else out[#out+1] = val2str(value,key,indent,insref,seen[t],plainindex,level+1) end end local prefix = string.rep(indent or '', level) local head = indent and '{\n'..prefix..indent or '{' local body = table.concat(out, ','..(indent and '\n'..prefix..indent or space)) local tail = indent and "\n"..prefix..'}' or '}' return (custom and custom(tag,head,body,tail) or tag..head..body..tail)..comment(t, level) elseif badtype[ttype] then seen[t] = insref or spath return tag..globerr(t, level) elseif ttype == 'function' then seen[t] = insref or spath local ok, res = pcall(string.dump, t) local func = ok and ((opts.nocode and "function() --[[..skipped..]] end" or "((loadstring or load)("..safestr(res)..",'@serialized'))")..comment(t, level)) return tag..(func or globerr(t, level)) else return tag..safestr(t) end -- handle all other types end local sepr = indent and "\n" or ";"..space local body = val2str(t, name, indent) -- this call also populates sref local tail = #sref>1 and table.concat(sref, sepr)..sepr or '' local warn = opts.comment and #sref>1 and space.."--[[incomplete output with shared/self-references skipped]]" or '' return not name and body..warn or "do local "..body..sepr..tail.."return "..name..sepr.."end" end local function deserialize(data, opts) local env = (opts and opts.safe == false) and G or setmetatable({}, { __index = function(t,k) return t end, __call = function(t,...) error("cannot call functions") end }) local f, res = (loadstring or load)('return '..data, nil, nil, env) if not f then f, res = (loadstring or load)(data, nil, nil, env) end if not f then return f, res end if setfenv then setfenv(f, env) end return pcall(f) end local function merge(a, b) if b then for k,v in pairs(b) do a[k] = v end end; return a; end return { _NAME = n, _COPYRIGHT = c, _DESCRIPTION = d, _VERSION = v, serialize = s, load = deserialize, dump = function(a, opts) return s(a, merge({name = '_', compact = true, sparse = true}, opts)) end, line = function(a, opts) return s(a, merge({sortkeys = true, comment = true}, opts)) end, block = function(a, opts) return s(a, merge({indent = ' ', sortkeys = true, comment = true}, opts)) end }
gpl-3.0
GENRALVS/GENRAL-VS
libs/serpent.lua
656
7877
local n, v = "serpent", 0.28 -- (C) 2012-15 Paul Kulchenko; MIT License local c, d = "Paul Kulchenko", "Lua serializer and pretty printer" local snum = {[tostring(1/0)]='1/0 --[[math.huge]]',[tostring(-1/0)]='-1/0 --[[-math.huge]]',[tostring(0/0)]='0/0'} local badtype = {thread = true, userdata = true, cdata = true} local keyword, globals, G = {}, {}, (_G or _ENV) for _,k in ipairs({'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while'}) do keyword[k] = true end for k,v in pairs(G) do globals[v] = k end -- build func to name mapping for _,g in ipairs({'coroutine', 'debug', 'io', 'math', 'string', 'table', 'os'}) do for k,v in pairs(G[g] or {}) do globals[v] = g..'.'..k end end local function s(t, opts) local name, indent, fatal, maxnum = opts.name, opts.indent, opts.fatal, opts.maxnum local sparse, custom, huge = opts.sparse, opts.custom, not opts.nohuge local space, maxl = (opts.compact and '' or ' '), (opts.maxlevel or math.huge) local iname, comm = '_'..(name or ''), opts.comment and (tonumber(opts.comment) or math.huge) local seen, sref, syms, symn = {}, {'local '..iname..'={}'}, {}, 0 local function gensym(val) return '_'..(tostring(tostring(val)):gsub("[^%w]",""):gsub("(%d%w+)", -- tostring(val) is needed because __tostring may return a non-string value function(s) if not syms[s] then symn = symn+1; syms[s] = symn end return tostring(syms[s]) end)) end local function safestr(s) return type(s) == "number" and tostring(huge and snum[tostring(s)] or s) or type(s) ~= "string" and tostring(s) -- escape NEWLINE/010 and EOF/026 or ("%q"):format(s):gsub("\010","n"):gsub("\026","\\026") end local function comment(s,l) return comm and (l or 0) < comm and ' --[['..tostring(s)..']]' or '' end local function globerr(s,l) return globals[s] and globals[s]..comment(s,l) or not fatal and safestr(select(2, pcall(tostring, s))) or error("Can't serialize "..tostring(s)) end local function safename(path, name) -- generates foo.bar, foo[3], or foo['b a r'] local n = name == nil and '' or name local plain = type(n) == "string" and n:match("^[%l%u_][%w_]*$") and not keyword[n] local safe = plain and n or '['..safestr(n)..']' return (path or '')..(plain and path and '.' or '')..safe, safe end local alphanumsort = type(opts.sortkeys) == 'function' and opts.sortkeys or function(k, o, n) -- k=keys, o=originaltable, n=padding local maxn, to = tonumber(n) or 12, {number = 'a', string = 'b'} local function padnum(d) return ("%0"..tostring(maxn).."d"):format(tonumber(d)) end table.sort(k, function(a,b) -- sort numeric keys first: k[key] is not nil for numerical keys return (k[a] ~= nil and 0 or to[type(a)] or 'z')..(tostring(a):gsub("%d+",padnum)) < (k[b] ~= nil and 0 or to[type(b)] or 'z')..(tostring(b):gsub("%d+",padnum)) end) end local function val2str(t, name, indent, insref, path, plainindex, level) local ttype, level, mt = type(t), (level or 0), getmetatable(t) local spath, sname = safename(path, name) local tag = plainindex and ((type(name) == "number") and '' or name..space..'='..space) or (name ~= nil and sname..space..'='..space or '') if seen[t] then -- already seen this element sref[#sref+1] = spath..space..'='..space..seen[t] return tag..'nil'..comment('ref', level) end if type(mt) == 'table' and (mt.__serialize or mt.__tostring) then -- knows how to serialize itself seen[t] = insref or spath if mt.__serialize then t = mt.__serialize(t) else t = tostring(t) end ttype = type(t) end -- new value falls through to be serialized if ttype == "table" then if level >= maxl then return tag..'{}'..comment('max', level) end seen[t] = insref or spath if next(t) == nil then return tag..'{}'..comment(t, level) end -- table empty local maxn, o, out = math.min(#t, maxnum or #t), {}, {} for key = 1, maxn do o[key] = key end if not maxnum or #o < maxnum then local n = #o -- n = n + 1; o[n] is much faster than o[#o+1] on large tables for key in pairs(t) do if o[key] ~= key then n = n + 1; o[n] = key end end end if maxnum and #o > maxnum then o[maxnum+1] = nil end if opts.sortkeys and #o > maxn then alphanumsort(o, t, opts.sortkeys) end local sparse = sparse and #o > maxn -- disable sparsness if only numeric keys (shorter output) for n, key in ipairs(o) do local value, ktype, plainindex = t[key], type(key), n <= maxn and not sparse if opts.valignore and opts.valignore[value] -- skip ignored values; do nothing or opts.keyallow and not opts.keyallow[key] or opts.valtypeignore and opts.valtypeignore[type(value)] -- skipping ignored value types or sparse and value == nil then -- skipping nils; do nothing elseif ktype == 'table' or ktype == 'function' or badtype[ktype] then if not seen[key] and not globals[key] then sref[#sref+1] = 'placeholder' local sname = safename(iname, gensym(key)) -- iname is table for local variables sref[#sref] = val2str(key,sname,indent,sname,iname,true) end sref[#sref+1] = 'placeholder' local path = seen[t]..'['..tostring(seen[key] or globals[key] or gensym(key))..']' sref[#sref] = path..space..'='..space..tostring(seen[value] or val2str(value,nil,indent,path)) else out[#out+1] = val2str(value,key,indent,insref,seen[t],plainindex,level+1) end end local prefix = string.rep(indent or '', level) local head = indent and '{\n'..prefix..indent or '{' local body = table.concat(out, ','..(indent and '\n'..prefix..indent or space)) local tail = indent and "\n"..prefix..'}' or '}' return (custom and custom(tag,head,body,tail) or tag..head..body..tail)..comment(t, level) elseif badtype[ttype] then seen[t] = insref or spath return tag..globerr(t, level) elseif ttype == 'function' then seen[t] = insref or spath local ok, res = pcall(string.dump, t) local func = ok and ((opts.nocode and "function() --[[..skipped..]] end" or "((loadstring or load)("..safestr(res)..",'@serialized'))")..comment(t, level)) return tag..(func or globerr(t, level)) else return tag..safestr(t) end -- handle all other types end local sepr = indent and "\n" or ";"..space local body = val2str(t, name, indent) -- this call also populates sref local tail = #sref>1 and table.concat(sref, sepr)..sepr or '' local warn = opts.comment and #sref>1 and space.."--[[incomplete output with shared/self-references skipped]]" or '' return not name and body..warn or "do local "..body..sepr..tail.."return "..name..sepr.."end" end local function deserialize(data, opts) local env = (opts and opts.safe == false) and G or setmetatable({}, { __index = function(t,k) return t end, __call = function(t,...) error("cannot call functions") end }) local f, res = (loadstring or load)('return '..data, nil, nil, env) if not f then f, res = (loadstring or load)(data, nil, nil, env) end if not f then return f, res end if setfenv then setfenv(f, env) end return pcall(f) end local function merge(a, b) if b then for k,v in pairs(b) do a[k] = v end end; return a; end return { _NAME = n, _COPYRIGHT = c, _DESCRIPTION = d, _VERSION = v, serialize = s, load = deserialize, dump = function(a, opts) return s(a, merge({name = '_', compact = true, sparse = true}, opts)) end, line = function(a, opts) return s(a, merge({sortkeys = true, comment = true}, opts)) end, block = function(a, opts) return s(a, merge({indent = ' ', sortkeys = true, comment = true}, opts)) end }
gpl-2.0
lbthomsen/openwrt-luci
applications/luci-app-coovachilli/luasrc/model/cbi/coovachilli_radius.lua
79
1554
-- Copyright 2008 Steven Barth <steven@midlink.org> -- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org> -- Licensed to the public under the Apache License 2.0. m = Map("coovachilli") -- radius server s1 = m:section(TypedSection, "radius") s1.anonymous = true s1:option( Value, "radiusserver1" ) s1:option( Value, "radiusserver2" ) s1:option( Value, "radiussecret" ).password = true s1:option( Value, "radiuslisten" ).optional = true s1:option( Value, "radiusauthport" ).optional = true s1:option( Value, "radiusacctport" ).optional = true s1:option( Value, "radiusnasid" ).optional = true s1:option( Value, "radiusnasip" ).optional = true s1:option( Value, "radiuscalled" ).optional = true s1:option( Value, "radiuslocationid" ).optional = true s1:option( Value, "radiuslocationname" ).optional = true s1:option( Value, "radiusnasporttype" ).optional = true s1:option( Flag, "radiusoriginalurl" ) s1:option( Value, "adminuser" ).optional = true rs = s1:option( Value, "adminpassword" ) rs.optional = true rs.password = true s1:option( Flag, "swapoctets" ) s1:option( Flag, "openidauth" ) s1:option( Flag, "wpaguests" ) s1:option( Flag, "acctupdate" ) s1:option( Value, "coaport" ).optional = true s1:option( Flag, "coanoipcheck" ) -- radius proxy s2 = m:section(TypedSection, "proxy") s2.anonymous = true s2:option( Value, "proxylisten" ).optional = true s2:option( Value, "proxyport" ).optional = true s2:option( Value, "proxyclient" ).optional = true ps = s2:option( Value, "proxysecret" ) ps.optional = true ps.password = true return m
apache-2.0
ricker75/Global-Server
data/npc/scripts/Ottokar.lua
1
1732
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local function creatureSayCallback(cid, type, msg) if not npcHandler:isFocused(cid) then return false end local player = Player(cid) if msgcontains(msg, 'belongings of deceasead') or msgcontains(msg, 'medicine') then if player:getItemCount(13506) > 0 then npcHandler:say('Did you bring me the medicine pouch?', cid) npcHandler.topic[cid] = 1 else npcHandler:say('I need a {medicine pouch}, to give you the {belongings of deceased}. Come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then if player:getItemCount(13506) > 0 then player:removeItem(13506, 1) player:addItem(13670, 1) local cStorage = player:getStorageValue(Storage.Achievements.DoctorDoctor) if cStorage < 100 then player:setStorageValue(Storage.Achievements.DoctorDoctor, math.max(1, cStorage) + 1) elseif cStorage == 100 then player:addAchievement('Doctor! Doctor!') player:setStorageValue(Storage.Achievements.DoctorDoctor, 101) end npcHandler:say('Here you are', cid) else npcHandler:say('You do not have the required items.', cid) end npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
gpl-2.0
greasydeal/darkstar
scripts/zones/West_Sarutabaruta/npcs/Roshina-Kuleshuna_WW.lua
30
3078
----------------------------------- -- Area: West Sarutabaruta -- NPC: Roshina-Kuleshuna, W.W. -- Type: Outpost Conquest Guards -- @pos -11.322 -13.459 317.696 115 ----------------------------------- package.loaded["scripts/zones/West_Sarutabaruta/TextIDs"] = nil; ----------------------------------- require("scripts/globals/conquest"); require("scripts/zones/West_Sarutabaruta/TextIDs"); local guardnation = WINDURST; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border local region = SARUTABARUTA; local csid = 0x7ff7; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then if (supplyRunFresh(player) == 1) then player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies ! else player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use." player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region)); player:setVar("supplyQuest_region",0); end else local arg1 = getArg1(guardnation, player) - 1; if (arg1 >= 1792) then -- foreign, non-allied player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0); else -- citizen or allied player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option == 2) then player:delKeyItem(getSupplyKey(region)); player:addCP(supplyReward[region + 1]) player:messageSpecial(CONQUEST); -- "You've earned conquest points!" if (hasOutpost(player, region+5) == 0) then local supply_quests = 2^(region+5); player:addNationTeleport(guardnation,supply_quests); player:setVar("supplyQuest_region",0); end elseif (option == 4) then if (player:delGil(giltosetHP(guardnation,player))) then player:setHomePoint(); player:messageSpecial(CONQUEST + 94); -- "Your home point has been set." else player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here." end end end;
gpl-3.0
LegionXI/darkstar
scripts/zones/Northern_San_dOria/TextIDs.lua
7
8664
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6587; -- Come back after sorting your inventory. ITEM_OBTAINED = 6592; -- Obtained: <<<Unknown Parameter (Type: 80) 1>>><<<Possible Special Code: 01>>><<<Possible Special Code: 05>>> GIL_OBTAINED = 6593; -- Obtained <<<Numeric Parameter 0>>> gil. KEYITEM_OBTAINED = 6595; -- Obtained key item: <<<Unknown Parameter (Type: 80) 1>>> NOT_HAVE_ENOUGH_GIL = 6597; -- You do not have enough gil. HOMEPOINT_SET = 188; -- Home point set! IMAGE_SUPPORT = 6947; -- Your ?Multiple Choice (Parameter 1)?[fishing/woodworking/smithing/goldsmithing/clothcraft/leatherworking/bonecraft/alchemy/cooking] skills went up ... GUILD_TERMINATE_CONTRACT = 6961; -- You have terminated your trading contract with the Multiple Choice (Parameter 1)[Fishermen's/Carpenters'/Blacksmiths'/Goldsmiths'/Weavers'/Tanners'/Boneworkers'/Alchemists'/Culinarians'] Guild and formed a new one with the Multiple Choice (Parameter 0)[Fishermen's/Carpenters'/Blacksmiths'/Goldsmiths'/Weavers'/Tanners'/Boneworkers'/Alchemists'/Culinarians'] Guild GUILD_NEW_CONTRACT = 6969; -- You have formed a new trading contract with the Multiple Choice (Parameter 0)[Fishermen's/Carpenters'/Blacksmiths'/Goldsmiths'/Weavers'/Tanners'/Boneworkers'/Alchemists'/Culinarians'] Guild NO_MORE_GP_ELIGIBLE = 6976; -- You are not eligible to receive guild points at this time GP_OBTAINED = 6981; -- Obtained: ?Numeric Parameter 0? guild points. NOT_HAVE_ENOUGH_GP = 6982; -- You do not have enough guild points. MOGHOUSE_EXIT = 12347; -- You have learned your way through the back alleys of San d'Oria! Now you can exit to any area from your residence. FISHING_MESSAGE_OFFSET = 7409; -- You can't fish here. -- Conquest System CONQUEST = 11696; -- You've earned conquest points! -- Mission Dialogs ORIGINAL_MISSION_OFFSET = 16; -- Bring me one of those axes, and your mission will be a success. No running away now; we've a proud country to defend! YOU_ACCEPT_THE_MISSION = 5; -- You accept the mission. -- Quest Dialog OLBERGIEUT_DIALOG = 11261; -- Friar Faurbellant is on retreat at the Crag of Holla. Please give FLYER_REFUSED = 11509; -- Your flyer is refused. FLYER_ACCEPTED = 12047; -- Your flyer is accepted! FLYER_ALREADY = 12048; -- This person already has a flyer. SHIVA_UNLOCKED = 12792; -- You are now able to summon -- Other Dialog GUILBERDRIER_DIALOG = 11137; -- A magic shop, you say? A bit of magic would come in handy... I know! I'll have my daughter study it for me! ABIOLEGET_DIALOG = 11213; -- All of Altana's children are welcome here. PELLIMIE_DIALOG = 11214; -- Is this your first time here? Join us in prayer! FITTESEGAT_DIALOG = 11215; -- Paradise is a place without fear, without death! MAURINE_DIALOG = 11216; -- Papsque Shamonde sometimes addresses the city from the balcony, you know. I long for his blessing, if but once! PRERIVON_DIALOG = 11217; -- With each sermon, I take another step closer to Paradise. MALFINE_DIALOG = 11218; -- Truly fortunate are we that words of sacrament are read every day! COULLENE_DIALOG = 11219; -- Goddess above, deliver us to Paradise! GUILERME_DIALOG = 11333; -- Behold Chateau d'Oraguille, the greatest fortress in the realm! PHAVIANE_DIALOG = 11337; -- This is Victory Arch. Beyond lies Southern San d'Oria. SOCHIENE_DIALOG = 11338; -- You stand before Victory Arch. Southern San d'Oria is on the other side. PEPIGORT_DIALOG = 11339; -- This gate leads to Port San d'Oria. RODAILLECE_DIALOG = 11340; -- This is Ranperre Gate. Fiends lurk in the lands beyond, so take caution! GALAHAD_DIALOG = 11353; -- Welcome to the Consulate of Jeuno. I am Galahad, Consul to San d'Oria. ISHWAR_DIALOG = 11354; -- May I assist you? ARIENH_DIALOG = 11355; -- If you have business with Consul Galahad, you'll find him inside. EMILIA_DIALOG = 11356; -- Welcome to the Consulate of Jeuno. HELAKU_DIALOG = 11385; -- Leave this building, and you'll see a great fortress to the right. That's Chateau d'Oraguille. And be polite; San d'Orians can be quite touchy. KASARORO_DIALOG = 11424; -- Step right outside, and you'll see a big castle on the left. That's Chateau d'Oraguille. They're a little touchy in there, so mind your manners! MAURINNE_DIALOG = 11461; -- This part of town is so lively, I like watching everybody just go about their business. AIVEDOIR_DIALOG = 11495; -- That's funny. I could have sworn she asked me to meet her here... CAPIRIA_DIALOG = 11496; -- He's late! I do hope he hasn't forgotten. BERTENONT_DIALOG = 11497; -- Stars are more beautiful up close. Don't you agree? GILIPESE_DIALOG = 11518; -- Nothing to report! BONCORT_DIALOG = 12043; -- Hmm... With magic, I could get hold of materials a mite easier. I'll have to check this CAPIRIA_DIALOG = 12044; -- A flyer? For me? Some reading material would be a welcome change of pace, indeed! VILLION_DIALOG = 12045; -- Opening a shop of magic, without consulting me first? I must pay this Regine a visit! COULLENE_DIALOG = 12046; -- Magic could be of use on my journey to Paradise. Thank you so much! COULLENE_MESSAGE = 13359; -- Coullene looks over curiously for a moment. GUILBERDRIER_MESSAGE = 13360; -- Guilberdrier looks over curiously for a moment. BONCORT_MESSAGE = 13361; -- Boncort looks over curiously for a moment. CAPIRIA_MESSAGE = 13362; -- Capiria looks over curiously for a moment. VILLION_MESSAGE = 13363; -- Villion looks over curiously for a moment. -- Shop Texts DOGGOMEHR_SHOP_DIALOG = 11531; -- Welcome to the Blacksmiths' Guild shop. LUCRETIA_SHOP_DIALOG = 11532; -- Blacksmiths' Guild shop, at your service! CAUZERISTE_SHOP_DIALOG = 11599; -- Welcome! San d'Oria Carpenters' Guild shop, at your service. ANTONIAN_OPEN_DIALOG = 11614; -- Interested in goods from Aragoneu? BONCORT_SHOP_DIALOG = 11615; -- Welcome to the Phoenix Perch! PIRVIDIAUCE_SHOP_DIALOG = 11616; -- Care to see what I have? PALGUEVION_OPEN_DIALOG = 11617; -- I've got a shipment straight from Valdeaunia! VICHUEL_OPEN_DIALOG = 11618; -- Fauregandi produce for sale! ARLENNE_SHOP_DIALOG = 11619; -- Welcome to the Royal Armory! TAVOURINE_SHOP_DIALOG = 11620; -- Looking for a weapon? We've got many in stock! ANTONIAN_CLOSED_DIALOG = 11624; -- The Kingdom's influence is waning in Aragoneu. I cannot import goods from that region, though I long to. PALGUEVION_CLOSED_DIALOG = 11625; -- Would that Valdeaunia came again under San d'Orian dominion, I could then import its goods! VICHUEL_CLOSED_DIALOG = 11626; -- I'd make a killing selling Fauregandi produce here, but that region's not under San d'Orian control! ATTARENA_CLOSED_DIALOG = 11627; -- Once all of Li'Telor is back under San d'Orian influence, I'll fill my stock with unique goods from there! EUGBALLION_CLOSED_DIALOG = 11628; -- I'd be making a fortune selling goods from Qufim Island...if it were only under San d'Orian control! EUGBALLION_OPEN_DIALOG = 11629; -- Have a look at these goods imported direct from Qufim Island! CHAUPIRE_SHOP_DIALOG = 11630; -- San d'Orian woodcraft is the finest in the land! GAUDYLOX_SHOP_DIALOG = 12607; -- You never see Goblinshhh from underworld? Me no bad. Me sell chipshhh. You buy. Use with shhhtone heart. You get lucky! MILLECHUCA_CLOSED_DIALOG = 12608; -- I've been trying to import goods from Vollbow, but it's so hard to get items from areas that aren't under San d'Orian control. ATTARENA_OPEN_DIALOG = 12693; -- Good day! Take a look at my selection from Li'Telor! MILLECHUCA_OPEN_DIALOG = 12694; -- Specialty goods from Vollbow! Specialty goods from Vollbow! ARACHAGNON_SHOP_DIALOG = 12896; -- Would you be interested in purchasing some adventurer-issue armor? Be careful when selecting, as we accept no refunds. JUSTI_SHOP_DIALOG = 13549; -- Hello! -- Harvest Festival TRICK_OR_TREAT = 13039; -- Trick or treat... THANK_YOU_TREAT = 13040; -- And now for your treat... HERE_TAKE_THIS = 12066; -- Here, take this... IF_YOU_WEAR_THIS = 13042; -- If you put this on and walk around, something...unexpected might happen... THANK_YOU = 13040; -- Thank you... -- conquest Base CONQUEST_BASE = 7250; -- Tallying conquest results... -- Porter Moogle RETRIEVE_DIALOG_ID = 18099; -- You retrieve$ from the porter moogle's care.
gpl-3.0
ibm2431/darkstar
scripts/zones/Cloister_of_Tremors/bcnms/trial_by_earth.lua
9
1510
----------------------------------- -- Area: Cloister of Tremors -- BCNM: Trial by Earth ----------------------------------- local ID = require("scripts/zones/Cloister_of_Tremors/IDs") require("scripts/globals/battlefield") require("scripts/globals/keyitems") require("scripts/globals/quests") require("scripts/globals/titles") ----------------------------------- function onBattlefieldTick(battlefield, tick) dsp.battlefield.onBattlefieldTick(battlefield, tick) end function onBattlefieldRegister(player, battlefield) end function onBattlefieldEnter(player, battlefield) end function onBattlefieldLeave(player, battlefield, leavecode) if leavecode == dsp.battlefield.leaveCode.WON then local name, clearTime, partySize = battlefield:getRecord() local arg8 = (player:hasCompletedQuest(BASTOK, dsp.quest.id.bastok.TRIAL_BY_EARTH)) and 1 or 0 player:startEvent(32001, battlefield:getArea(), clearTime, partySize, battlefield:getTimeInside(), 1, battlefield:getLocalVar("[cs]bit"), arg8) elseif leavecode == dsp.battlefield.leaveCode.LOST then player:startEvent(32002) end end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if csid == 32001 then player:delKeyItem(dsp.ki.TUNING_FORK_OF_EARTH) player:addKeyItem(dsp.ki.WHISPER_OF_TREMORS) player:addTitle(dsp.title.HEIR_OF_THE_GREAT_EARTH) player:messageSpecial(ID.text.KEYITEM_OBTAINED, dsp.ki.WHISPER_OF_TREMORS) end end
gpl-3.0
LegionXI/darkstar
scripts/globals/spells/drain.lua
21
1716
----------------------------------------- -- Spell: Drain -- Drain functions only on skill level!! ----------------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); require("scripts/globals/settings"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) --calculate raw damage (unknown function -> only dark skill though) - using http://www.bluegartr.com/threads/44518-Drain-Calculations -- also have small constant to account for 0 dark skill local dmg = 10 + (1.035 * (caster:getSkillLevel(DARK_MAGIC_SKILL)) + caster:getMod(79 + DARK_MAGIC_SKILL)); if (dmg > (caster:getSkillLevel(DARK_MAGIC_SKILL) + 20)) then dmg = (caster:getSkillLevel(DARK_MAGIC_SKILL) + 20); end --get resist multiplier (1x if no resist) local resist = applyResistance(caster,spell,target,caster:getStat(MOD_INT)-target:getStat(MOD_INT),DARK_MAGIC_SKILL,1.0); --get the resisted damage dmg = dmg*resist; --add on bonuses (staff/day/weather/jas/mab/etc all go in this function) dmg = addBonuses(caster,spell,target,dmg); --add in target adjustment dmg = adjustForTarget(target,dmg,spell:getElement()); --add in final adjustments if (dmg < 0) then dmg = 0 end if (target:getHP() < dmg) then dmg = target:getHP(); end if (target:isUndead()) then spell:setMsg(75); -- No effect return dmg; end dmg = finalMagicAdjustments(caster,target,spell,dmg); caster:addHP(dmg); return dmg; end;
gpl-3.0
LegionXI/darkstar
scripts/globals/items/blackened_newt.lua
12
1568
----------------------------------------- -- ID: 4581 -- Item: Blackened Newt -- Food Effect: 180Min, All Races ----------------------------------------- -- Dexterity 4 -- Mind -3 -- Attack % 18 -- Attack Cap 60 -- Virus Resist 4 -- Curse Resist 4 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,4581); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 4); target:addMod(MOD_MND, -3); target:addMod(MOD_FOOD_ATTP, 18); target:addMod(MOD_FOOD_ATT_CAP, 60); target:addMod(MOD_VIRUSRES, 4); target:addMod(MOD_CURSERES, 4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 4); target:delMod(MOD_MND, -3); target:delMod(MOD_FOOD_ATTP, 18); target:delMod(MOD_FOOD_ATT_CAP, 60); target:delMod(MOD_VIRUSRES, 4); target:delMod(MOD_CURSERES, 4); end;
gpl-3.0
LegionXI/darkstar
scripts/zones/Behemoths_Dominion/mobs/Behemoth.lua
12
1907
----------------------------------- -- Area: Behemoth's Dominion -- HNM: Behemoth ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/status"); ----------------------------------- -- onMobInitialize ----------------------------------- function onMobInitialize(mob) end; ----------------------------------- -- onMobSpawn ----------------------------------- function onMobSpawn(mob) if (LandKingSystem_NQ > 0 or LandKingSystem_HQ > 0) then GetNPCByID(17297459):setStatus(STATUS_DISAPPEAR); end end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, player, isKiller) player:addTitle(BEHEMOTHS_BANE); end; ----------------------------------- -- onMobDespawn ----------------------------------- function onMobDespawn(mob) local Behemoth = mob:getID(); local King_Behemoth = mob:getID()+1; local ToD = GetServerVariable("[POP]King_Behemoth"); local kills = GetServerVariable("[PH]King_Behemoth"); local popNow = (math.random(1,5) == 3 or kills > 6); if (LandKingSystem_HQ ~= 1 and ToD <= os.time(t) and popNow == true) then -- 0 = timed spawn, 1 = force pop only, 2 = BOTH if (LandKingSystem_NQ == 0) then DeterMob(Behemoth, true); end DeterMob(King_Behemoth, false); UpdateNMSpawnPoint(King_Behemoth); GetMobByID(King_Behemoth):setRespawnTime(math.random(75600,86400)); else if (LandKingSystem_NQ ~= 1) then UpdateNMSpawnPoint(Behemoth); mob:setRespawnTime(math.random(75600,86400)); SetServerVariable("[PH]King_Behemoth", kills + 1); end end if (LandKingSystem_NQ > 0 or LandKingSystem_HQ > 0) then GetNPCByID(17297459):updateNPCHideTime(FORCE_SPAWN_QM_RESET_TIME); end end;
gpl-3.0
naclander/tome
game/modules/tome/data/gfx/particles/dark_lightning.lua
3
2492
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org -- Make the 2 main forks local forks = {{}, {}} local m1 = forks[1] local m2 = forks[2] local tiles = math.ceil(math.sqrt(tx*tx+ty*ty)) local tx = tx * engine.Map.tile_w local ty = ty * engine.Map.tile_h local breakdir = math.rad(rng.range(-8, 8)) m1.bx = 0 m1.by = 0 m1.thick = 5 m1.dir = math.atan2(ty, tx) + breakdir m1.size = math.sqrt(tx*tx+ty*ty) / 2 m2.bx = m1.size * math.cos(m1.dir) m2.by = m1.size * math.sin(m1.dir) m2.thick = 5 m2.dir = math.atan2(ty, tx) - breakdir m2.size = math.sqrt(tx*tx+ty*ty) / 2 -- Add more forks for i = 1, math.min(math.max(3, m1.size / 5), 20) do local m = rng.percent(50) and forks[1] or forks[2] if rng.percent(60) then m = rng.table(forks) end local f = {} f.thick = 2 f.dir = m.dir + math.rad(rng.range(-30,30)) f.size = rng.range(6, 25) local br = rng.range(1, m.size) f.bx = br * math.cos(m.dir) + m.bx f.by = br * math.sin(m.dir) + m.by forks[#forks+1] = f end -- Populate the lightning based on the forks return { generator = function() local f = rng.table(forks) local a = f.dir local rad = rng.range(-3,3) local ra = math.rad(rad) local r = rng.range(1, f.size) return { life = life or 4, size = f.thick, sizev = 0, sizea = 0, x = r * math.cos(a) + 3 * math.cos(ra) + f.bx, xv = 0, xa = 0, y = r * math.sin(a) + 3 * math.sin(ra) + f.by, yv = 0, ya = 0, dir = 0, dirv = 0, dira = 0, vel = 0, velv = 0, vela = 0, r = rng.float(0.5, 0.7), rv = 0, ra = 0, g = rng.float(0.3, 0.5), gv = 0, ga = 0, b = rng.float(0, 1), bv = 0, ba = 0, a = rng.float(0.4, 1), av = 0, aa = 0, } end, }, function(self) self.nb = (self.nb or 0) + 1 if self.nb < 4 then self.ps:emit(230*tiles) end end, 4*(nb_particles or 230)*tiles
gpl-3.0
ibm2431/darkstar
scripts/globals/spells/bluemagic/sickle_slash.lua
8
1527
----------------------------------------- -- Spell: Sickle Slash -- Deals critical damage. Chance of critical hit varies with TP -- Spell cost: 41 MP -- Monster Type: Vermin -- Spell Type: Physical (Blunt) -- Blue Magic Points: 4 -- Stat Bonus: HP-5, MP+15 -- Level: 48 -- Casting Time: 0.5 seconds -- Recast Time: 20.5 seconds -- Skillchain Element: Dark (can open Transfixion or Detonation can close Compression or Gravitation) -- Combos: Store TP ----------------------------------------- require("scripts/globals/bluemagic") require("scripts/globals/status") require("scripts/globals/magic") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0 end function onSpellCast(caster,target,spell) local params = {} -- This data should match information on http://wiki.ffxiclopedia.org/wiki/Calculating_Blue_Magic_Damage params.tpmod = TPMOD_CRITICAL params.dmgtype = DMGTYPE_H2H params.scattr = SC_COMPRESSION params.numhits = 1 params.multiplier = 1.5 params.tp150 = 1.5 params.tp300 = 1.5 params.azuretp = 1.5 params.duppercap = 49 params.str_wsc = 0.0 params.dex_wsc = 0.5 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.0 params.chr_wsc = 0.0 damage = BluePhysicalSpell(caster, target, spell, params) damage = BlueFinalAdjustments(caster, target, spell, damage, params) return damage end
gpl-3.0
LegionXI/darkstar
scripts/zones/Southern_San_dOria/npcs/Foletta.lua
17
1458
----------------------------------- -- Area: Southern San d'Oria -- NPC: Foletta -- General Info NPC ------------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Southern_San_dOria/TextIDs"); require("scripts/globals/settings"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script local FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then local count = trade:getItemCount(); local MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x29a); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
shadog/mdo_th_boos
bot/seedbot.lua
22
14096
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") local f = assert(io.popen('/usr/bin/git describe --tags', 'r')) VERSION = assert(f:read('*a')) f:close() -- This function is called when tg receive a msg function on_msg_receive (msg) if not started then return end msg = backward_msg_format(msg) local receiver = get_receiver(msg) print(receiver) --vardump(msg) --vardump(msg) msg = pre_process_service_msg(msg) if msg_valid(msg) then msg = pre_process_msg(msg) if msg then match_plugins(msg) if redis:get("bot:markread") then if redis:get("bot:markread") == "on" then mark_read(receiver, ok_cb, false) end end end end end function ok_cb(extra, success, result) end function on_binlog_replay_end() started = true postpone (cron_plugins, false, 60*5.0) -- See plugins/isup.lua as an example for cron _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 < os.time() - 5 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 --send_large_msg(*group id*, msg.text) *login code will be sent to GroupID* return false 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("Sudo 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 = { "admin", "onservice", "inrealm", "ingroup", "inpm", "banhammer", "stats", "anti_spam", "owners", "arabic_lock", "set", "get", "broadcast", "invite", "all", "leave_ban", "supergroup", "whitelist", "msg_checks" }, sudo_users = {110626080,103649648,111020322,0,tonumber(our_id)},--Sudo users moderation = {data = 'data/moderation.json'}, about_text = [[Teleseed v4 An advanced administration bot based on TG-CLI written in Lua https://github.com/SEEDTEAM/TeleSeed Admins @iwals [Founder] @imandaneshi [Developer] @POTUS [Developer] @seyedan25 [Manager] @aRandomStranger [Admin] Special thanks to awkward_potato Siyanew topkecleon Vamptacus Our channels @teleseedch [English] @iranseed [persian] Our website http://teleseed.seedteam.org/ ]], help_text_realm = [[ Realm Commands: !creategroup [Name] Create a group !createrealm [Name] Create a realm !setname [Name] Set realm name !setabout [group|sgroup] [GroupID] [Text] Set a group's about text !setrules [GroupID] [Text] Set a group's rules !lock [GroupID] [setting] Lock a group's setting !unlock [GroupID] [setting] Unock a group's setting !settings [group|sgroup] [GroupID] Set settings for GroupID !wholist Get a list of members in group/realm !who Get a file of members in group/realm !type Get group type !kill chat [GroupID] Kick all memebers and delete group !kill realm [RealmID] Kick all members and delete realm !addadmin [id|username] Promote an admin by id OR username *Sudo only !removeadmin [id|username] Demote an admin by id OR username *Sudo only !list groups Get a list of all groups !list realms Get a list of all realms !support Promote user to support !-support Demote user from support !log Get a logfile of current group or realm !broadcast [text] !broadcast Hello ! Send text to all groups Only sudo users can run this command !bc [group_id] [text] !bc 123456789 Hello ! This command will send text to [group_id] **You can use "#", "!", or "/" to begin all commands *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 = [[ Commands list : !kick [username|id] You can also do it by reply !ban [ username|id] You can also do it by reply !unban [id] You can also do it by reply !who Members list !modlist Moderators list !promote [username] Promote someone !demote [username] Demote someone !kickme Will kick user !about Group description !setphoto Set and locks group photo !setname [name] Set group name !rules Group rules !id return group id or user id !help Returns help text !lock [links|flood|spam|Arabic|member|rtl|sticker|contacts|strict] Lock group settings *rtl: Kick user if Right To Left Char. is in name* !unlock [links|flood|spam|Arabic|member|rtl|sticker|contacts|strict] Unlock group settings *rtl: Kick user if Right To Left Char. is in name* !mute [all|audio|gifs|photo|video] mute group message types *If "muted" message type: user is kicked if message type is posted !unmute [all|audio|gifs|photo|video] Unmute group message types *If "unmuted" message type: user is not kicked if message type is posted !set rules <text> Set <text> as rules !set about <text> Set <text> as about !settings Returns group settings !muteslist Returns mutes for chat !muteuser [username] Mute a user in chat *user is kicked if they talk *only owners can mute | mods and owners can unmute !mutelist Returns list of muted users in chat !newlink create/revoke your group link !link returns group link !owner returns group owner id !setowner [id] Will set id as owner !setflood [value] Set [value] as flood sensitivity !stats Simple message statistics !save [value] <text> Save <text> as [value] !get [value] Returns text of [value] !clean [modlist|rules|about] Will clear [modlist|rules|about] and set it to nil !res [username] returns user id "!res @username" !log Returns group logs !banlist will return group ban list **You can use "#", "!", or "/" to begin all commands *Only owner and mods can add bots in group *Only moderators and owner can use kick,ban,unban,newlink,link,setphoto,setname,lock,unlock,set rules,set about and settings commands *Only owner can use res,setowner,promote,demote and log commands ]], help_text_super =[[ SuperGroup Commands: !info Displays general info about the SuperGroup !admins Returns SuperGroup admins list !owner Returns group owner !modlist Returns Moderators list !bots Lists bots in SuperGroup !who Lists all users in SuperGroup !block Kicks a user from SuperGroup *Adds user to blocked list* !ban Bans user from the SuperGroup !unban Unbans user from the SuperGroup !id Return SuperGroup ID or user id *For userID's: !id @username or reply !id* !id from Get ID of user message is forwarded from !kickme Kicks user from SuperGroup *Must be unblocked by owner or use join by pm to return* !setowner Sets the SuperGroup owner !promote [username|id] Promote a SuperGroup moderator !demote [username|id] Demote a SuperGroup moderator !setname Sets the chat name !setphoto Sets the chat photo !setrules Sets the chat rules !setabout Sets the about section in chat info(members list) !save [value] <text> Sets extra info for chat !get [value] Retrieves extra info for chat by value !newlink Generates a new group link !link Retireives the group link !rules Retrieves the chat rules !lock [links|flood|spam|Arabic|member|rtl|sticker|contacts|strict] Lock group settings *rtl: Delete msg if Right To Left Char. is in name* *strict: enable strict settings enforcement (violating user will be kicked)* !unlock [links|flood|spam|Arabic|member|rtl|sticker|contacts|strict] Unlock group settings *rtl: Delete msg if Right To Left Char. is in name* *strict: disable strict settings enforcement (violating user will not be kicked)* !mute [all|audio|gifs|photo|video|service] mute group message types *A "muted" message type is auto-deleted if posted !unmute [all|audio|gifs|photo|video|service] Unmute group message types *A "unmuted" message type is not auto-deleted if posted !setflood [value] Set [value] as flood sensitivity !settings Returns chat settings !muteslist Returns mutes for chat !muteuser [username] Mute a user in chat *If a muted user posts a message, the message is deleted automaically *only owners can mute | mods and owners can unmute !mutelist Returns list of muted users in chat !banlist Returns SuperGroup ban list !clean [rules|about|modlist|mutelist] !del Deletes a message by reply !public [yes|no] Set chat visibility in pm !chats or !chatlist commands !res [username] Returns users name and id by username !log Returns group logs *Search for kick reasons using [#RTL|#spam|#lockmember] **You can use "#", "!", or "/" to begin all commands *Only owner can add members to SuperGroup (use invite link to invite) *Only moderators and owner can use block, ban, unban, newlink, link, setphoto, setname, lock, unlock, setrules, setabout and settings commands *Only owner can use res, setowner, promote, demote, and log commands ]], } 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) --vardump (chat) 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(tostring(io.popen("lua plugins/"..v..".lua"):read('*all'))) 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
greasydeal/darkstar
scripts/zones/Sea_Serpent_Grotto/npcs/_4w3.lua
19
2691
----------------------------------- -- Area: Sea Serpent Grotto -- NPC: Mythril Beastcoin Door -- @zone 176 -- @pos 40 8.6 20.012 ----------------------------------- package.loaded["scripts/zones/Sea_Serpent_Grotto/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Sea_Serpent_Grotto/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(trade:hasItemQty(749,1) and trade:getItemCount() == 1) then if(player:getVar("SSG_MythrilDoor") == 7) then npc:openDoor(5) --Open the door if a mythril beastcoin has been traded after checking the door the required number of times end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) X = player:getXPos(); Z = player:getZPos(); MythrilDoorCheck = player:getVar("SSG_MythrilDoor"); if(X >= 40 and Z >= 15) then if(MythrilDoorCheck == 0) then --Door has never been checked player:messageSpecial(FIRST_CHECK); player:setVar("SSG_MythrilDoor",1); elseif(MythrilDoorCheck == 1) then --Door has been checked once player:messageSpecial(SECOND_CHECK); player:setVar("SSG_MythrilDoor",2); elseif(MythrilDoorCheck == 2) then --Door has been checked twice player:messageSpecial(THIRD_CHECK); player:setVar("SSG_MythrilDoor",3); elseif(MythrilDoorCheck == 3) then --Door has been checked three times player:messageSpecial(FOURTH_CHECK); player:setVar("SSG_MythrilDoor",4); elseif(MythrilDoorCheck == 4) then --Door has been checked four times player:messageSpecial(FIFTH_CHECK); player:setVar("SSG_MythrilDoor",5); elseif(MythrilDoorCheck == 5) then --Door has been checked five times player:messageSpecial(MYTHRIL_CHECK); player:setVar("SSG_MythrilDoor",6); elseif(MythrilDoorCheck == 6 or MythrilDoorCheck == 7) then --Door has been checked six or more times player:messageSpecial(COMPLETED_CHECK,749); player:setVar("SSG_MythrilDoor",7); end return 1 --Keep the door closed elseif(X < 40 and Z < 24) then return -1 --Open the door if coming from the "inside" end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
dojoteef/lualol
src/lol/summoner.lua
1
10457
--- Allows for making queries against the League of Legends Summoner API -- -- By first creating an api object and creating a new summoner object from it -- you can then make queries against the League of Legends Summoner API. -- -- @module lol.summoner local api = require('lol.api') local utils = require('pl.utils') --- This class encapsulates manipulating the League of Legends Summoner API -- @type summoner local _summoner = {} _summoner.__index = _summoner setmetatable(_summoner, { __call = function(_,apiObj) return _summoner.new(apiObj) end}) --- Create a new summoner object -- @param api the @{api} object that communicates with the League of Legends server -- @return a new summoner object -- @function summoner:summoner function _summoner.new(apiObj) utils.assert_arg(1,apiObj,'table',api.isvalid,'not a valid api object') local obj = {} obj.api = apiObj obj.version = '1.4' return setmetatable(obj, _summoner) end local function cacheKeyForName(summonerName) return {api='summoner',summonerName=summonerName} end local function cacheKeyForId(summonerId) return {api='summoner',summonerId=summonerId} end local function cacheKeyForMasteries(summonerId) return {api='summoner',data='masteries',summonerId=summonerId} end local function cacheKeyForRunes(summonerId) return {api='summoner',data='runes',summonerId=summonerId} end local function cacheSummonerName(cache, name, id) -- Currently no expiration time for name -> id mapping since I -- assume a name change doesn't allow someone to take the old name. -- If that isn't true I need to allow it to expire as well. name = _summoner.standardizeSummonerName(name) cache:set(cacheKeyForName(name),id) return name end --- Given a Summoner name, put it into the League of Legends API standardized format -- @tparam string summonerName the Summoner name to standardize -- @return a Summoner name in the League of Legends API standardized format -- @function summoner.standardizeSummonerName function _summoner.standardizeSummonerName(summonerName) return string.lower(string.gsub(summonerName, '%s+', '')) end --- Get a Summoner from the League of Legends API given a Summoner name -- @tparam string name the Summoner name of the Summoner to retreive -- @tparam table opts a table with optional parameters: -- @tparam long opts.expire how long in seconds to cache a response (defaults to 24 hours, _i.e. 24\*60\*60_) -- @tparam function opts.callback a callback which receives the response from the API (data, code, headers) -- _NOTE_: Since you may only retreive 40 summoners at a time the callback may be called multiple times from a single call to summoner:getByName -- @function summoner:getByName function _summoner:getByName(name, opts) return self:getByNames({name}, opts) end --- Get multiple Summoners from the League of Legends API given their Summoner names -- @tparam table names an array-like table with the list of Summoner names to retreive -- @tparam table opts a table with optional parameters: -- @tparam long opts.expire how long in seconds to cache a response (defaults to 24hrs, i.e. 24*60*60) -- @tparam function opts.callback a callback which receives the response from the API (data, code, headers) -- _NOTE_: Since you may only retreive 40 summoners at a time the callback may be called multiple times from a single call to summoner:getByNames -- @function summoner:getByNames function _summoner:getByNames(names, opts) opts = opts or {} local cache = self.api.cache local expire = opts.expire or 24*60*60 local onResponse = function(res, code, headers) if code and code == 200 then for name,summoner in pairs(res) do cacheSummonerName(cache, name, summoner.id) cache:set(cacheKeyForId(summoner.id),summoner,expire) end end if opts.callback then opts.callback(res, code, headers) end end local cachedCount = 0 local cachedSummoners = {} local maxNamesPerQuery = 40 local url = { params={version=self.version}, path='/api/lol/${region}/v${version}/summoner/by-name/${summonerNames}', } for index,name in ipairs(names) do local summonerName = self.standardizeSummonerName(name) local summonerId = cache:get(cacheKeyForName(summonerName)) local summoner if summonerId then summoner = cache:get(cacheKeyForId(summonerId)) end if summoner then cachedSummoners[summonerName] = summoner cachedCount = cachedCount + 1 else local nameString = url.params.summonerNames url.params.summonerNames = nameString and nameString..','..summonerName or summonerName if (index - cachedCount) % maxNamesPerQuery == 0 then self.api:get(url, onResponse) url.params.summonerNames = nil end end end if url.params.summonerNames then self.api:get(url, onResponse) end if cachedCount > 0 and opts.callback then opts.callback(cachedSummoners) end end --- Get a Summoner, their runes, names, or masteries from the League of Legends API given their Summoner id -- @tparam long id Summoner id of the Summoner who's data to retreive -- @tparam table opts a table with optional parameters: -- @tparam string filter denotes what type of information to retreive, valid values: -- *'name' -- * 'masteries' -- * 'runes' -- @tparam long opts.expire how long in seconds to cache a response (defaults to 24hrs, i.e. 24*60*60) -- @tparam function opts.callback a callback which receives the response from the API (data, code, headers) -- _NOTE_: Since you may only retreive 40 summoners at a time the callback may be called multiple times from a single call to summoner:getById -- @function summoner:getById function _summoner:getById(id, opts) self:getByIds({id}, opts) end --- Get multiple Summoners, their runes, names, or masteries from the League of Legends API given their Summoner ids -- @tparam table ids an array-like table with the list of Summoner ids to retreive -- @tparam table opts a table with optional parameters: -- @tparam string filter denotes what type of information to retreive, valid values: -- * 'name' -- * 'masteries' -- * 'runes' -- @tparam long opts.expire how long in seconds to cache a response (defaults to 24hrs, i.e. 24*60*60) -- @tparam function opts.callback a callback which receives the response from the API (data, code, headers) -- _NOTE_: Since you may only retreive 40 summoners at a time the callback may be called multiple times from a single call to summoner:getIds -- @function summoner:getByIds function _summoner:getByIds(ids, opts) opts = opts or {} local cache = self.api.cache local expire = opts.expire or 24*60*60 local onResponse = function(res, code, headers) local data = {} if code and code == 200 then for _,summoner in pairs(res) do local name = cacheSummonerName(cache, summoner.name, summoner.id) cache:set(cacheKeyForId(summoner.id),summoner,expire) data[name] = summoner end end if opts.callback then opts.callback(data, code, headers) end end local cacheKeyForFilter = { name=cacheKeyForId, masteries=cacheKeyForMasteries, runes=cacheKeyForRunes } local onFilterResponse = { name=function(res, code, headers) local data = {} if code and code == 200 then for idstr,name in pairs(res) do local id = tonumber(idstr) cacheSummonerName(cache, name, id) data[id] = name end end if opts.callback then opts.callback(data, code, headers) end end, masteries=function(res, code, headers) local data = {} if code and code == 200 then for idstr,val in pairs(res) do local id = tonumber(idstr) cache:set(cacheKeyForMasteries(id),val.pages,expire) data[id] = val.pages end end if opts.callback then opts.callback(data, code, headers) end end, runes=function(res, code, headers) local data = {} if code and code == 200 then for idstr,val in pairs(res) do local id = tonumber(idstr) cache:set(cacheKeyForRunes(id),val.pages,expire) data[id] = val.pages end end if opts.callback then opts.callback(data, code, headers) end end } if opts.filter then utils.assert_arg(2,opts.filter,'string',function() return onFilterResponse[opts.filter] end,'not a valid api object') end local cachedCount = 0 local cachedData = {} local maxIdsPerQuery = 40 local url = { params={version=self.version,filter=opts.filter and '/'..opts.filter or ''}, path='/api/lol/${region}/v${version}/summoner/${summonerIds}${filter}', } for index,summonerId in ipairs(ids) do local cacheKeyFn = opts.filter and cacheKeyForFilter[opts.filter] or cacheKeyForId local data = cache:get(cacheKeyFn(summonerId)) if data then local key = opts.filter and summonerId or self.standardizeSummonerName(data.name) cachedData[key] = opts.filter and cacheKeyFn == cacheKeyForId and data.name or data cachedCount = cachedCount + 1 else local idString = url.params.summonerIds url.params.summonerIds = idString and idString..','..summonerId or summonerId if (index - cachedCount) % maxIdsPerQuery == 0 then self.api:get(url, onFilterResponse[opts.filter] or onResponse) url.params.summonerIds = nil end end end if url.params.summonerIds then self.api:get(url, onFilterResponse[opts.filter] or onResponse) end if cachedCount > 0 and opts.callback then opts.callback(cachedData) end end return _summoner
mit
ibm2431/darkstar
scripts/globals/weaponskills/blade_shun.lua
10
1852
----------------------------------- -- Blade Shun -- Katana weapon skill -- Skill level: N/A -- Description: Delivers a fivefold attack. Attack power varies with TP. -- In order to obtain Blade: Shun the quest Martial Mastery must be completed. -- This Weapon Skill's first hit params.ftp is duplicated for all additional hits. -- Alignet with the Flame Gorget, Light Gorget & Thunder Gorget. -- Alignet with the Flame Belt, Light Belt & Thunder Belt. -- Element: None -- Skillchain Properties: Fusion/Impaction -- Modifiers: DEX:73~85%, depending on merit points upgrades. -- Damage Multipliers by TP: -- 100% 200% 300% -- 0.6875 0.6875 0.6875 ----------------------------------- require("scripts/globals/status") require("scripts/globals/settings") require("scripts/globals/weaponskills") ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {} params.numHits = 5 params.ftp100 = 0.6875 params.ftp200 = 0.6875 params.ftp300 = 0.6875 params.str_wsc = 0.0 params.dex_wsc = 0.85 + (player:getMerit(dsp.merit.BLADE_SHUN) / 100) params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.0 params.chr_wsc = 0.0 params.crit100 = 0.0 params.crit200 = 0.0 params.crit300 = 0.0 params.canCrit = false params.acc100 = 0.0 params.acc200= 0.0 params.acc300= 0.0 params.atk100 = 1; params.atk200 = 1; params.atk300 = 1; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp100 = 1 params.ftp200 = 1 params.ftp300 = 1 params.dex_wsc = 0.7 + (player:getMerit(dsp.merit.BLADE_SHUN) / 100) end local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, params, tp, action, primary, taChar) return tpHits, extraHits, criticalHit, damage end
gpl-3.0
Igalia/snabbswitch
lib/luajit/testsuite/test/lib/ffi/cdata_var.lua
6
1108
local ffi = require("ffi") do --- byte array allocations local typ = ffi.typeof"uint8_t[?]" for i = 4, 24 do for d = -5, 5 do local sz = 2^i + d assert(ffi.sizeof(typ, sz) == sz) local mem = ffi.new(typ, sz) assert(ffi.sizeof(mem) == sz) mem[0] = 0x21 mem[1] = 0x32 mem[2] = 0x43 mem[sz-3] = 0x54 mem[sz-2] = 0x65 mem[sz-1] = 0x76 assert(mem[0] == 0x21) assert(mem[1] == 0x32) assert(mem[2] == 0x43) assert(mem[3] == 0) assert(mem[sz-4] == 0) assert(mem[sz-3] == 0x54) assert(mem[sz-2] == 0x65) assert(mem[sz-1] == 0x76) end end end do --- int array allocations local typ = ffi.typeof"int32_t[?]" for i = 2, 17 do for d = -2, 2 do local sz = 2^i + d assert(ffi.sizeof(typ, sz) == sz*4) local mem = ffi.new(typ, sz) assert(ffi.sizeof(mem) == sz*4) mem[0] = -3 mem[sz-1] = -4 assert(mem[0] == -3) if sz ~= 2 then assert(mem[1] == 0) assert(mem[sz-2] == 0) end assert(mem[sz-1] == -4) end end end
apache-2.0
alerque/sile
shapers/base.lua
1
5729
-- local smallTokenSize = 20 -- Small words will be cached -- local shapeCache = {} -- local _key = function (options) -- return table.concat({ options.family;options.language;options.script;options.size;("%d"):format(options.weight);options.style;options.variant;options.features;options.direction;options.filename }, ";") -- end SILE.settings:declare({ parameter = "shaper.variablespaces", type = "boolean", default = true }) SILE.settings:declare({ parameter = "shaper.spaceenlargementfactor", type = "number or integer", default = 1.2 }) SILE.settings:declare({ parameter = "shaper.spacestretchfactor", type = "number or integer", default = 1/2 }) SILE.settings:declare({ parameter = "shaper.spaceshrinkfactor", type = "number or integer", default = 1/3 }) SILE.settings:declare({ parameter = "shaper.tracking", type = "number or nil", default = nil }) -- Function for testing shaping in the repl -- luacheck: ignore makenodes -- TODO, figure out a way to explicitly register things in the repl env makenodes = function (token, options) return SILE.shaper:createNnodes(token, SILE.font.loadDefaults(options or {})) end local function shapespace (spacewidth) spacewidth = SU.cast("measurement", spacewidth) -- In some scripts with word-level kerning, glue can be negative. -- Use absolute value to ensure stretch and shrink work as expected. local absoluteSpaceWidth = math.abs(spacewidth:tonumber()) local length = spacewidth * SILE.settings:get("shaper.spaceenlargementfactor") local stretch = absoluteSpaceWidth * SILE.settings:get("shaper.spacestretchfactor") local shrink = absoluteSpaceWidth * SILE.settings:get("shaper.spaceshrinkfactor") return SILE.length(length, stretch, shrink) end local shaper = pl.class() shaper.type = "shaper" shaper._name = "base" -- Return the length of a space character -- with a particular set of font options, -- giving preference to document.spaceskip -- Caching this has no significant speedup function shaper:measureSpace (options) local ss = SILE.settings:get("document.spaceskip") if ss then SILE.settings:temporarily(function () SILE.settings:set("font.size", options.size) SILE.settings:set("font.family", options.family) SILE.settings:set("font.filename", options.filename) ss = ss:absolute() end) return ss end local items, width = self:shapeToken(" ", options) if not width and not items[1] then SU.warn("Could not measure the width of a space") return SILE.length() end return shapespace(width and width.length or items[1].width) end function shaper:measureChar (char) local options = SILE.font.loadDefaults({}) options.tracking = SILE.settings:get("shaper.tracking") local items = self:shapeToken(char, options) if #items > 0 then return { height = items[1].height, width = items[1].width } else SU.error("Unable to measure character", char) end end -- Given a text and some font options, return a bunch of boxes function shaper.shapeToken (_, _, _) SU.error("Abstract function shapeToken called", true) end -- Given font options, select a font. We will handle -- caching here. Returns an arbitrary, implementation-specific -- object (ie a PAL for Pango, font number for libtexpdf, ...) function shaper.getFace (_) SU.error("Abstract function getFace called", true) end function shaper.addShapedGlyphToNnodeValue (_, _, _) SU.error("Abstract function addShapedGlyphToNnodeValue called", true) end function shaper.preAddNodes (_, _, _) end function shaper:createNnodes (token, options) options.tracking = SILE.settings:get("shaper.tracking") local items, _ = self:shapeToken(token, options) if #items < 1 then return {} end local lang = options.language SILE.languageSupport.loadLanguage(lang) local nodeMaker = SILE.nodeMakers[lang] or SILE.nodeMakers.unicode local nodes = {} for node in nodeMaker(options):iterator(items, token) do table.insert(nodes, node) end return nodes end function shaper:formNnode (contents, token, options) local nnodeContents = {} -- local glyphs = {} local totalWidth = 0 local totalDepth = 0 local totalHeight = 0 -- local glyphNames = {} local nnodeValue = { text = token, options = options, glyphString = {} } SILE.shaper:preAddNodes(contents, nnodeValue) local misfit = false if SILE.typesetter.frame and SILE.typesetter.frame:writingDirection() == "TTB" then if options.direction == "LTR" then misfit = true end else if options.direction == "TTB" then misfit = true end end for i = 1, #contents do local glyph = contents[i] if (options.direction == "TTB") ~= misfit then if glyph.width > totalHeight then totalHeight = glyph.width end totalWidth = totalWidth + glyph.height else if glyph.depth > totalDepth then totalDepth = glyph.depth end if glyph.height > totalHeight then totalHeight = glyph.height end totalWidth = totalWidth + glyph.width end self:addShapedGlyphToNnodeValue(nnodeValue, glyph) end table.insert(nnodeContents, SILE.nodefactory.hbox({ depth = totalDepth, height = totalHeight, misfit = misfit, width = SILE.length(totalWidth), value = nnodeValue })) return SILE.nodefactory.nnode({ nodes = nnodeContents, text = token, misfit = misfit, options = options, language = options.language }) end function shaper.makeSpaceNode (_, options, item) local width if SILE.settings:get("shaper.variablespaces") then width = shapespace(item.width) else width = SILE.shaper:measureSpace(options) end return SILE.nodefactory.glue(width) end function shaper.debugVersions (_) end return shaper
mit
LegionXI/darkstar
scripts/zones/Pashhow_Marshlands/npcs/Luck_Rune.lua
14
1069
----------------------------------- -- Area: Pashhow Marshlands -- NPC: Luck Rune -- Involved in Quest: Mhaura Fortune -- @pos 573.245 24.999 199.560 109 ----------------------------------- package.loaded["scripts/zones/Pashhow_Marshlands/TextIDs"] = nil; ------------------------------------- require("scripts/zones/Pashhow_Marshlands/TextIDs"); ----------------------------------- -- onTrade ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) player:messageSpecial(NOTHING_OUT_OF_THE_ORDINARY); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Altar_Room/Zone.lua
28
1623
----------------------------------- -- -- Zone: Altar_Room (152) -- ----------------------------------- package.loaded["scripts/zones/Altar_Room/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Altar_Room/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-247.998,12.609,-100.008,128); end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Cloister_of_Tremors/bcnms/sugar-coated_directive.lua
13
1704
---------------------------------------- -- Area: Cloister of Tremors -- BCNM: Sugar Coated Directive (ASA-4) ---------------------------------------- package.loaded["scripts/zones/Cloister_of_Tremors/TextIDs"] = nil; ---------------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/quests"); require("scripts/zones/Cloister_of_Tremors/TextIDs"); ---------------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) -- print("leave code "..leavecode); if(leavecode == 2) then -- play end CS. Need time and battle id for record keeping + storage if(player:hasCompleteQuest(ASA,SUGAR_COATED_DIRECTIVE)) then player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,4,1); else player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,4,0); end elseif(leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) -- print("bc finish csid "..csid.." and option "..option); if(csid == 0x7d01) then player:addExp(400); player:setVar("ASA4_Amber","1"); end end;
gpl-3.0
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/FadeTo.lua
11
1678
-------------------------------- -- @module FadeTo -- @extend ActionInterval -- @parent_module cc -------------------------------- -- initializes the action with duration and opacity <br> -- param duration in seconds -- @function [parent=#FadeTo] initWithDuration -- @param self -- @param #float duration -- @param #unsigned char opacity -- @return bool#bool ret (return value: bool) -------------------------------- -- Creates an action with duration and opacity.<br> -- param duration Duration time, in seconds.<br> -- param opacity A certain opacity, the range is from 0 to 255.<br> -- return An autoreleased FadeTo object. -- @function [parent=#FadeTo] create -- @param self -- @param #float duration -- @param #unsigned char opacity -- @return FadeTo#FadeTo ret (return value: cc.FadeTo) -------------------------------- -- -- @function [parent=#FadeTo] startWithTarget -- @param self -- @param #cc.Node target -- @return FadeTo#FadeTo self (return value: cc.FadeTo) -------------------------------- -- -- @function [parent=#FadeTo] clone -- @param self -- @return FadeTo#FadeTo ret (return value: cc.FadeTo) -------------------------------- -- -- @function [parent=#FadeTo] reverse -- @param self -- @return FadeTo#FadeTo ret (return value: cc.FadeTo) -------------------------------- -- param time In seconds. -- @function [parent=#FadeTo] update -- @param self -- @param #float time -- @return FadeTo#FadeTo self (return value: cc.FadeTo) -------------------------------- -- -- @function [parent=#FadeTo] FadeTo -- @param self -- @return FadeTo#FadeTo self (return value: cc.FadeTo) return nil
mit
naclander/tome
game/modules/tome/data/zones/maze/npcs.lua
3
7450
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org if not currentZone.is_collapsed then load("/data/general/npcs/vermin.lua", rarity(5)) load("/data/general/npcs/rodent.lua", rarity(5)) load("/data/general/npcs/canine.lua", rarity(6)) load("/data/general/npcs/snake.lua", rarity(4)) load("/data/general/npcs/ooze.lua", rarity(3)) load("/data/general/npcs/jelly.lua", rarity(3)) load("/data/general/npcs/ant.lua", rarity(4)) load("/data/general/npcs/thieve.lua", rarity(0)) load("/data/general/npcs/minotaur.lua", rarity(0)) load("/data/general/npcs/all.lua", rarity(4, 35)) else load("/data/general/npcs/canine.lua", rarity(6)) load("/data/general/npcs/snake.lua", rarity(4)) load("/data/general/npcs/ooze.lua", rarity(3)) load("/data/general/npcs/jelly.lua", rarity(3)) load("/data/general/npcs/thieve.lua", rarity(0)) load("/data/general/npcs/horror-corrupted.lua", rarity(0)) load("/data/general/npcs/horror_temporal.lua", rarity(1)) load("/data/general/npcs/all.lua", rarity(4, 35)) end local Talents = require("engine.interface.ActorTalents") -- The boss of the maze, no "rarity" field means it will not be randomly generated newEntity{ define_as = "HORNED_HORROR", allow_infinite_dungeon = true, type = "horror", subtype = "corrupted", unique = true, name = "Horned Horror", display = "h", color=colors.VIOLET, resolvers.nice_tile{image="invis.png", add_mos = {{image="npc/horror_corrupted_horner_horror.png", display_h=2, display_y=-1}}}, desc = [[Some horrible power has twisted this brutish minotaur into something altogether more terrifying. Huge tentacles undulate from its back as it clenches and unclenches its powerful fists.]], killer_message = "and revived as a mindless horror", level_range = {12, nil}, exp_worth = 2, max_life = 250, life_rating = 17, fixed_rating = true, stats = { str=20, dex=20, cun=20, mag=10, wil=10, con=20 }, rank = 4, size_category = 4, infravision = 10, move_others=true, instakill_immune = 1, blind_immune = 1, no_breath = 1, body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1, HANDS=1, }, resolvers.equip{ {type="armor", subtype="hands", defined="STORM_BRINGER_GAUNTLETS", random_art_replace={chance=75}, autoreq=true}, }, resolvers.drops{chance=100, nb=5, {tome_drops="boss"} }, combat_mindpower = 20, resolvers.talents{ [Talents.T_ARMOUR_TRAINING]={base=3, every=9, max=4}, [Talents.T_UNARMED_MASTERY]={base=2, every=6, max=5}, [Talents.T_UPPERCUT]={base=2, every=6, max=5}, [Talents.T_DOUBLE_STRIKE]={base=2, every=6, max=5}, [Talents.T_SPINNING_BACKHAND]={base=1, every=6, max=5}, [Talents.T_FLURRY_OF_FISTS]={base=1, every=6, max=5}, [Talents.T_VITALITY]={base=2, every=6, max=5}, [Talents.T_TENTACLE_GRAB]={base=1, every=6, max=5}, }, autolevel = "warrior", ai = "tactical", ai_state = { talent_in=1, ai_move="move_astar", }, ai_tactic = resolvers.tactic"melee", resolvers.inscriptions(2, {"invisibility rune", "lightning rune"}), on_die = function(self, who) game.state:activateBackupGuardian("NIMISIL", 2, 40, "Have you hard about the patrol that disappeared in the maze in the west?") game.player:resolveSource():grantQuest("starter-zones") game.player:resolveSource():setQuestStatus("starter-zones", engine.Quest.COMPLETED, "maze") game.player:resolveSource():setQuestStatus("starter-zones", engine.Quest.COMPLETED, "maze-horror") end, } -- The boss of the maze, no "rarity" field means it will not be randomly generated newEntity{ define_as = "MINOTAUR_MAZE", allow_infinite_dungeon = true, type = "giant", subtype = "minotaur", unique = true, name = "Minotaur of the Labyrinth", display = "H", color=colors.VIOLET, resolvers.nice_tile{image="invis.png", add_mos = {{image="npc/giant_minotaur_minotaur_of_the_labyrinth.png", display_h=2, display_y=-1}}}, desc = [[A fearsome bull-headed monster, he swings a mighty axe as he curses all who defy him.]], killer_message = "and hung on a wall-spike", level_range = {12, nil}, exp_worth = 2, max_life = 250, life_rating = 17, fixed_rating = true, max_stamina = 200, stats = { str=25, dex=10, cun=8, mag=20, wil=20, con=20 }, rank = 4, size_category = 4, infravision = 10, move_others=true, instakill_immune = 1, body = { INVEN = 10, MAINHAND=1, OFFHAND=1, BODY=1, HEAD=1, }, resolvers.equip{ {type="weapon", subtype="battleaxe", force_drop=true, tome_drops="boss", autoreq=true}, {type="armor", subtype="head", defined="HELM_OF_GARKUL", random_art_replace={chance=75}, autoreq=true}, }, resolvers.drops{chance=100, nb=5, {tome_drops="boss"} }, resolvers.talents{ [Talents.T_ARMOUR_TRAINING]={base=1, every=9, max=4}, [Talents.T_STAMINA_POOL]={base=1, every=6, max=5}, [Talents.T_WARSHOUT]={base=1, every=6, max=5}, [Talents.T_STUNNING_BLOW]={base=1, every=6, max=5}, [Talents.T_SUNDER_ARMOUR]={base=1, every=6, max=5}, [Talents.T_SUNDER_ARMS]={base=1, every=6, max=5}, [Talents.T_CRUSH]={base=1, every=6, max=5}, }, autolevel = "warrior", ai = "tactical", ai_state = { talent_in=1, ai_move="move_astar", }, ai_tactic = resolvers.tactic"melee", resolvers.inscriptions(2, "infusion"), on_die = function(self, who) game.state:activateBackupGuardian("NIMISIL", 2, 40, "Have you hard about the patrol that disappeared in the maze in the west?") game.player:resolveSource():grantQuest("starter-zones") game.player:resolveSource():setQuestStatus("starter-zones", engine.Quest.COMPLETED, "maze") end, } newEntity{ base = "BASE_NPC_SPIDER", define_as = "NIMISIL", unique = true, allow_infinite_dungeon = true, name = "Nimisil", color=colors.VIOLET, desc = [[Covered by eerie luminescent growths and protuberances, this spider now haunts the maze's silent passageways.]], level_range = {43, nil}, exp_worth = 3, max_life = 520, life_rating = 21, fixed_rating = true, rank = 4, negative_regen = 40, positive_regen = 40, move_others=true, instakill_immune = 1, resolvers.drops{chance=100, nb=5, {tome_drops="boss"} }, resolvers.drops{chance=100, nb=1, {defined="LUNAR_SHIELD", random_art_replace={chance=75}} }, combat_armor = 25, combat_def = 33, combat = {dam=80, atk=30, apr=15, dammod={mag=1.1}, damtype=DamageType.ARCANE}, autolevel = "caster", ai = "tactical", ai_state = { talent_in=1, ai_move="move_astar", }, resolvers.inscriptions(5, {}), inc_damage = {all=40}, resolvers.talents{ [Talents.T_SPIDER_WEB]={base=5, every=5, max=7}, [Talents.T_LAY_WEB]={base=5, every=5, max=7}, [Talents.T_PHASE_DOOR]={base=5, every=5, max=7}, [Talents.T_HYMN_OF_MOONLIGHT]={base=5, every=5, max=7}, [Talents.T_MOONLIGHT_RAY]={base=5, every=5, max=7}, [Talents.T_SHADOW_BLAST]={base=5, every=5, max=7}, [Talents.T_SEARING_LIGHT]={base=5, every=5, max=7}, }, }
gpl-3.0
greasydeal/darkstar
scripts/zones/Southern_San_dOria/npcs/Dahjal.lua
34
1231
----------------------------------- -- Area: Southern San d'Oria -- NPC: Dahjal -- first in conquest Npc -- @zone 230 -- @pos ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (FlyerForRegine == 1) then count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
ibm2431/darkstar
scripts/zones/Bastok_Markets/npcs/Umberto.lua
9
1080
----------------------------------- -- Area: Bastok Markets -- NPC: Umberto -- Type: Quest NPC -- Involved in Quest: Too Many Chefs -- !pos -56.896 -5 -134.267 235 ----------------------------------- local ID = require("scripts/zones/Bastok_Markets/IDs"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) if (player:getCharVar("TOO_MANY_CHEFS") == 5) then -- end Quest Too Many Chefs player:startEvent(473); else player:startEvent(411); end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 473) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,5674); else player:addItem(5674); player:messageSpecial(ID.text.ITEM_OBTAINED,5674); player:addFame(BASTOK,30); player:setCharVar("TOO_MANY_CHEFS",0); player:completeQuest(BASTOK,dsp.quest.id.bastok.TOO_MANY_CHEFS); end end end;
gpl-3.0
icyxp/kong
spec/fixtures/custom_plugins/kong/plugins/cache/handler.lua
5
1046
local BasePlugin = require "kong.plugins.base_plugin" local singletons = require "kong.singletons" local responses = require "kong.tools.responses" local CacheHandler = BasePlugin:extend() CacheHandler.PRIORITY = 1000 function CacheHandler:new() CacheHandler.super.new(self, "cache") end function CacheHandler:access(conf) CacheHandler.super.access(self) ngx.req.read_body() local args, err = ngx.req.get_post_args() if not args then return responses.send_HTTP_INTERNAL_SERVER_ERROR(err) end local cache_key = args.cache_key if not cache_key then return responses.send_HTTP_BAD_REQUEST("missing cache_key") end local cache_value = args.cache_value if not cache_value then return responses.send_HTTP_BAD_REQUEST("missing cache_value") end local function cb() return cache_value end local value, err = singletons.cache:get(cache_key, nil, cb) if err then return responses.send_HTTP_INTERNAL_SERVER_ERROR(err) end return responses.send_HTTP_OK(value) end return CacheHandler
apache-2.0
LegionXI/darkstar
scripts/globals/weaponskills/seraph_blade.lua
23
1356
----------------------------------- -- Seraph Blade -- Sword weapon skill -- Skill Level: 125 -- Deals light elemental damage to enemy. Damage varies with TP. -- Ignores shadows. -- Aligned with the Soil Gorget. -- Aligned with the Soil Belt. -- Element: Light -- Modifiers: STR:40% ; MND:40% -- 100%TP 200%TP 300%TP -- 1.125 2.625 4.125 ----------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {}; params.ftp100 = 1; params.ftp200 = 2.5; params.ftp300 = 3; params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.3; params.chr_wsc = 0.0; params.ele = ELE_LIGHT; params.skill = SKILL_SWD; params.includemab = true; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp100 = 1.125; params.ftp200 = 2.625; params.ftp300 = 4.125; params.str_wsc = 0.4; params.mnd_wsc = 0.4; end local damage, criticalHit, tpHits, extraHits = doMagicWeaponskill(player, target, wsID, tp, primary, action, params); return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
naclander/tome
game/modules/tome/data/gfx/particles/wormhole.lua
3
1269
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org base_size = 64 return { system_rotation = 0, system_rotationv = speed or 0.5, base = 1000, angle = { 0, 0 }, anglev = { 0, 0 }, anglea = { 0, 0 }, life = { 10000, 10000 }, size = { 64, 64 }, sizev = {0, 0}, sizea = {0, 0}, r = {255, 255}, rv = {0, 0}, ra = {0, 0}, g = {255, 255}, gv = {0, 0}, ga = {0, 0}, b = {255, 255}, bv = {0, 0}, ba = {0, 0}, a = {255, 255}, av = {0, 0}, aa = {0, 0}, }, function(self) self.ps:emit(1) end, 1, image or "shockbolt/terrain/wormhole", true
gpl-3.0
LegionXI/darkstar
scripts/zones/West_Ronfaure/npcs/Doladepaiton_RK.lua
14
3332
----------------------------------- -- Area: West Ronfaure -- NPC: Doladepaiton, R.K. -- Type: Outpost Conquest Guards -- @pos -448 -19 -214 100 ------------------------------------- package.loaded["scripts/zones/West_Ronfaure/TextIDs"] = nil; -------------------------------------- require("scripts/globals/conquest"); require("scripts/zones/West_Ronfaure/TextIDs"); local guardnation = NATION_SANDORIA; -- SANDORIA, BASTOK, WINDURST, 4 = jeuno local guardtype = 3; -- 1: city, 2: foreign, 3: outpost, 4: border local region = RONFAURE; local csid = 0x7ffb; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) tradeConquestGuard(player,npc,trade,guardnation,guardtype); end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:hasKeyItem(getSupplyKey(region)) and player:getNation() == guardnation) then if (supplyRunFresh(player) == 1) then player:startEvent(csid,16,0,0,0,1,0,0,255); -- you have brought us supplies ! else player:showText(npc, CONQUEST - 1); -- "Hmm... These supplies you have brought us are too old to be of any use." player:delKeyItem(getSupplyKey(region)); player:messageSpecial(KEYITEM_OBTAINED + 1, getSupplyKey(region)); player:setVar("supplyQuest_region",0); end else local arg1 = getArg1(guardnation, player) - 1; if (arg1 >= 1792) then -- foreign, non-allied player:startEvent(csid,1808,0,0,0,0,player:getRank(),0,0); else -- citizen or allied player:startEvent(csid,arg1,0,0x3F0000,0,0,getArg6(player),0,0); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("OPTION: %u",option); if (option == 1) then local duration = (player:getRank() + getNationRank(player:getNation()) + 3) * 3600; player:delStatusEffect(EFFECT_SIGIL); player:delStatusEffect(EFFECT_SANCTION); player:delStatusEffect(EFFECT_SIGNET); player:addStatusEffect(EFFECT_SIGNET,0,0,duration); -- Grant Signet elseif (option == 2) then player:delKeyItem(getSupplyKey(region)); player:addCP(supplyReward[region + 1]) player:messageSpecial(CONQUEST); -- "You've earned conquest points!" if (hasOutpost(player, region+5) == 0) then local supply_quests = 2^(region+5); player:addNationTeleport(guardnation,supply_quests); player:setVar("supplyQuest_region",0); end elseif (option == 4) then if (player:delGil(giltosetHP(guardnation,player))) then player:setHomePoint(); player:messageSpecial(CONQUEST + 94); -- "Your home point has been set." else player:messageSpecial(CONQUEST + 95); -- "You do not have enough gil to set your home point here." end end end;
gpl-3.0
everhopingandwaiting/telegram-bot
plugins/rss.lua
700
5434
local function get_base_redis(id, option, extra) local ex = '' if option ~= nil then ex = ex .. ':' .. option if extra ~= nil then ex = ex .. ':' .. extra end end return 'rss:' .. id .. ex end local function prot_url(url) local url, h = string.gsub(url, "http://", "") local url, hs = string.gsub(url, "https://", "") local protocol = "http" if hs == 1 then protocol = "https" end return url, protocol end local function get_rss(url, prot) local res, code = nil, 0 if prot == "http" then res, code = http.request(url) elseif prot == "https" then res, code = https.request(url) end if code ~= 200 then return nil, "Error while doing the petition to " .. url end local parsed = feedparser.parse(res) if parsed == nil then return nil, "Error decoding the RSS.\nAre you sure that " .. url .. " it's a RSS?" end return parsed, nil end local function get_new_entries(last, nentries) local entries = {} for k,v in pairs(nentries) do if v.id == last then return entries else table.insert(entries, v) end end return entries end local function print_subs(id) local uhash = get_base_redis(id) local subs = redis:smembers(uhash) local text = id .. ' are subscribed to:\n---------\n' for k,v in pairs(subs) do text = text .. k .. ") " .. v .. '\n' end return text end local function subscribe(id, url) local baseurl, protocol = prot_url(url) local prothash = get_base_redis(baseurl, "protocol") local lasthash = get_base_redis(baseurl, "last_entry") local lhash = get_base_redis(baseurl, "subs") local uhash = get_base_redis(id) if redis:sismember(uhash, baseurl) then return "You are already subscribed to " .. url end local parsed, err = get_rss(url, protocol) if err ~= nil then return err end local last_entry = "" if #parsed.entries > 0 then last_entry = parsed.entries[1].id end local name = parsed.feed.title redis:set(prothash, protocol) redis:set(lasthash, last_entry) redis:sadd(lhash, id) redis:sadd(uhash, baseurl) return "You had been subscribed to " .. name end local function unsubscribe(id, n) if #n > 3 then return "I don't think that you have that many subscriptions." end n = tonumber(n) local uhash = get_base_redis(id) local subs = redis:smembers(uhash) if n < 1 or n > #subs then return "Subscription id out of range!" end local sub = subs[n] local lhash = get_base_redis(sub, "subs") redis:srem(uhash, sub) redis:srem(lhash, id) local left = redis:smembers(lhash) if #left < 1 then -- no one subscribed, remove it local prothash = get_base_redis(sub, "protocol") local lasthash = get_base_redis(sub, "last_entry") redis:del(prothash) redis:del(lasthash) end return "You had been unsubscribed from " .. sub end local function cron() -- sync every 15 mins? local keys = redis:keys(get_base_redis("*", "subs")) for k,v in pairs(keys) do local base = string.match(v, "rss:(.+):subs") -- Get the URL base local prot = redis:get(get_base_redis(base, "protocol")) local last = redis:get(get_base_redis(base, "last_entry")) local url = prot .. "://" .. base local parsed, err = get_rss(url, prot) if err ~= nil then return end local newentr = get_new_entries(last, parsed.entries) local subscribers = {} local text = '' -- Send only one message with all updates for k2, v2 in pairs(newentr) do local title = v2.title or 'No title' local link = v2.link or v2.id or 'No Link' text = text .. "[rss](" .. link .. ") - " .. title .. '\n' end if text ~= '' then local newlast = newentr[1].id redis:set(get_base_redis(base, "last_entry"), newlast) for k2, receiver in pairs(redis:smembers(v)) do send_msg(receiver, text, ok_cb, false) end end end end local function run(msg, matches) local id = "user#id" .. msg.from.id if is_chat_msg(msg) then id = "chat#id" .. msg.to.id end if matches[1] == "!rss"then return print_subs(id) end if matches[1] == "sync" then if not is_sudo(msg) then return "Only sudo users can sync the RSS." end cron() end if matches[1] == "subscribe" or matches[1] == "sub" then return subscribe(id, matches[2]) end if matches[1] == "unsubscribe" or matches[1] == "uns" then return unsubscribe(id, matches[2]) end end return { description = "Manage User/Chat RSS subscriptions. If you are in a chat group, the RSS subscriptions will be of that chat. If you are in an one-to-one talk with the bot, the RSS subscriptions will be yours.", usage = { "!rss: Get your rss (or chat rss) subscriptions", "!rss subscribe (url): Subscribe to that url", "!rss unsubscribe (id): Unsubscribe of that id", "!rss sync: Download now the updates and send it. Only sudo users can use this option." }, patterns = { "^!rss$", "^!rss (subscribe) (https?://[%w-_%.%?%.:/%+=&]+)$", "^!rss (sub) (https?://[%w-_%.%?%.:/%+=&]+)$", "^!rss (unsubscribe) (%d+)$", "^!rss (uns) (%d+)$", "^!rss (sync)$" }, run = run, cron = cron }
gpl-2.0
LegionXI/darkstar
scripts/zones/Northern_San_dOria/npcs/Grilau.lua
14
6142
----------------------------------- -- Area: Northern San d'Oria -- NPC: Grilau -- @pos -241.987 6.999 57.887 231 ----------------------------------- package.loaded["scripts/zones/Northern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/Northern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) CurrentMission = player:getCurrentMission(SANDORIA); OrcishScoutCompleted = player:hasCompletedMission(SANDORIA,SMASH_THE_ORCISH_SCOUTS); BatHuntCompleted = player:hasCompletedMission(SANDORIA,BAT_HUNT); TheCSpringCompleted = player:hasCompletedMission(SANDORIA,THE_CRYSTAL_SPRING); MissionStatus = player:getVar("MissionStatus"); Count = trade:getItemCount(); if (CurrentMission ~= 255) then if (CurrentMission == SMASH_THE_ORCISH_SCOUTS and trade:hasItemQty(16656,1) and Count == 1 and OrcishScoutCompleted == false) then -- Trade Orcish Axe player:startEvent(0x03fc); -- Finish Mission "Smash the Orcish scouts" (First Time) elseif (CurrentMission == SMASH_THE_ORCISH_SCOUTS and trade:hasItemQty(16656,1) and Count == 1) then -- Trade Orcish Axe player:startEvent(0x03ea); -- Finish Mission "Smash the Orcish scouts" (Repeat) elseif (CurrentMission == BAT_HUNT and trade:hasItemQty(1112,1) and Count == 1 and BatHuntCompleted == false and MissionStatus == 2) then -- Trade Orcish Mail Scales player:startEvent(0x03ff); -- Finish Mission "Bat Hunt" elseif (CurrentMission == BAT_HUNT and trade:hasItemQty(891,1) and Count == 1 and BatHuntCompleted and MissionStatus == 2) then -- Trade Bat Fang player:startEvent(0x03eb); -- Finish Mission "Bat Hunt" (repeat) elseif (CurrentMission == THE_CRYSTAL_SPRING and trade:hasItemQty(4528,1) and Count == 1 and TheCSpringCompleted == false) then -- Trade Crystal Bass player:startEvent(0x0406); -- Dialog During Mission "The Crystal Spring" elseif (CurrentMission == THE_CRYSTAL_SPRING and trade:hasItemQty(4528,1) and Count == 1 and TheCSpringCompleted) then -- Trade Crystal Bass player:startEvent(0x03f5); -- Finish Mission "The Crystal Spring" (repeat) else player:startEvent(0x03f0); -- Wrong Item end else player:startEvent(0x03f2); -- Mission not activated end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local PresOfPapsqueCompleted = player:hasCompletedMission(SANDORIA,PRESTIGE_OF_THE_PAPSQUE); if (player:getNation() ~= NATION_SANDORIA) then player:startEvent(0x03f3); -- for Non-San d'Orians else CurrentMission = player:getCurrentMission(SANDORIA); MissionStatus = player:getVar("MissionStatus"); pRank = player:getRank(); cs, p, offset = getMissionOffset(player,1,CurrentMission,MissionStatus); if (CurrentMission <= 15 and (cs ~= 0 or offset ~= 0 or (CurrentMission == 0 and offset == 0))) then if (cs == 0) then player:showText(npc,ORIGINAL_MISSION_OFFSET + offset); -- dialog after accepting mission else player:startEvent(cs,p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8]); end elseif (pRank == 1 and player:hasCompletedMission(SANDORIA,SMASH_THE_ORCISH_SCOUTS) == false) then player:startEvent(0x03e8); -- Start First Mission "Smash the Orcish scouts" elseif (player:hasKeyItem(ANCIENT_SANDORIAN_BOOK)) then player:startEvent(0x040b); elseif (CurrentMission == RANPERRE_S_FINAL_REST and player:getVar("MissionStatus",4) and tonumber(os.date("%j")) == player:getVar("Wait1DayForRanperre_date")) then player:startEvent(0x040d); elseif (CurrentMission == RANPERRE_S_FINAL_REST and player:getVar("MissionStatus") == 6) then player:startEvent(0x040f); elseif (CurrentMission == RANPERRE_S_FINAL_REST and player:getVar("MissionStatus") == 9) then player:startEvent(0x0409); elseif (CurrentMission ~= THE_SECRET_WEAPON and pRank == 7 and PresOfPapsqueCompleted == true and getMissionRankPoints(player,19) == 1 and player:getVar("SecretWeaponStatus") == 0) then player:startEvent(0x0034); elseif (CurrentMission == THE_SECRET_WEAPON and player:getVar("SecretWeaponStatus") == 3) then player:startEvent(0x0413); elseif (CurrentMission ~= 255) then player:startEvent(0x03e9); -- Have mission already activated else mission_mask, repeat_mask = getMissionMask(player); player:startEvent(0x03f1,mission_mask, 0, 0 ,0 ,0 ,repeat_mask); -- Mission List end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("onUpdateCSID: %u",csid); -- printf("onUpdateOPTION: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("onFinishCSID: %u",csid); -- printf("onFinishOPTION: %u",option); finishMissionTimeline(player,1,csid,option); if (csid == 0x040b) then player:setVar("MissionStatus",4); player:delKeyItem(ANCIENT_SANDORIAN_BOOK); player:setVar("Wait1DayForRanperre_date", os.date("%j")); elseif (csid == 0x040d) then player:setVar("MissionStatus",6); elseif (csid == 0x040f) then player:setVar("MissionStatus",7); player:setVar("Wait1DayForRanperre_date",0); elseif (csid == 0x0409) then finishMissionTimeline(player,2,csid,option); elseif (csid == 0x0034) then player:setVar("SecretWeaponStatus",1); elseif (csid == 0x0413) then finishMissionTimeline(player,2,csid,option); end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Horlais_Peak/bcnms/the_secret_weapon.lua
13
2277
----------------------------------- -- Area: Horlais Peak -- Name: Mission Rank 7 -- @pos -509 158 -211 139 ----------------------------------- package.loaded["scripts/zones/Horlais_Peak/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/Horlais_Peak/TextIDs"); ----------------------------------- -- Maat Battle in Horlais Peak -- EXAMPLE SCRIPT -- -- What should go here: -- giving key items, playing ENDING cutscenes -- -- What should NOT go here: -- Handling of "battlefield" status, spawning of monsters, -- putting loot into treasure pool, -- enforcing ANY rules (SJ/number of people/etc), moving -- chars around, playing entrance CSes (entrance CSes go in bcnm.lua) -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) -- print("leave code "..leavecode); if(leavecode == 2) then -- play end CS. Need time and battle id for record keeping + storage if(player:hasCompletedMission(SANDORIA,THE_SECRET_WEAPON)) then player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,3,1); else player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,3,0); end elseif(leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) -- print("bc finish csid "..csid.." and option "..option); if(csid == 0x7d01) then if(player:getCurrentMission(SANDORIA) == THE_SECRET_WEAPON) then player:addKeyItem(CRYSTAL_DOWSER); player:messageSpecial(KEYITEM_OBTAINED,CRYSTAL_DOWSER); player:setVar("SecretWeaponStatus",3) end end end;
gpl-3.0
LegionXI/darkstar
scripts/zones/Bastok_Markets/npcs/Pavel.lua
30
1775
----------------------------------- -- Area: Bastok Markets -- NPC: Pavel -- Involved in Quest: Stamp Hunt -- @pos -349.798 -10.002 -181.296 235 ----------------------------------- package.loaded["scripts/zones/Bastok_Markets/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/zones/Bastok_Markets/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local WildcatBastok = player:getVar("WildcatBastok"); local StampHunt = player:getQuestStatus(BASTOK,STAMP_HUNT); if (player:getQuestStatus(BASTOK,LURE_OF_THE_WILDCAT_BASTOK) == QUEST_ACCEPTED and player:getMaskBit(WildcatBastok,14) == false) then player:startEvent(0x01af); elseif (StampHunt == QUEST_ACCEPTED and player:getMaskBit(player:getVar("StampHunt_Mask"),2) == false) then player:startEvent(0x00e3); else player:startEvent(0x0080); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x01af) then player:setMaskBit(player:getVar("WildcatBastok"),"WildcatBastok",14,true); elseif (csid == 0x00e3) then player:setMaskBit(player:getVar("StampHunt_Mask"),"StampHunt_Mask",2,true); end end;
gpl-3.0
naclander/tome
game/modules/tome/data/zones/town-zigur/grids.lua
3
2732
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org load("/data/general/grids/basic.lua") load("/data/general/grids/water.lua") load("/data/general/grids/sand.lua") load("/data/general/grids/forest.lua") newEntity{ define_as = "POST", name = "Zigur Postsign", lore="zigur-post", desc = [[The laws of the Ziguranth]], image = "terrain/grass.png", display = '_', color=colors.UMBER, back_color=colors.DARK_GREEN, add_displays = {class.new{image="terrain/signpost.png"}}, always_remember = true, on_move = function(self, x, y, who) if who.player then game.party:learnLore(self.lore) end end, } newEntity{ define_as = "LAVA", name='lava pit', display='~', color=colors.LIGHT_RED, back_color=colors.RED, always_remember = true, does_block_move = true, image="terrain/lava_floor.png", } newEntity{ base = "GRASS", define_as = "FIELDS", name="cultivated fields", display=';', image="terrain/cultivation.png", nice_tiler = { method="replace", base={"FIELDS", 100, 1, 4}}, } for i = 1, 4 do newEntity{ base = "FIELDS", define_as = "FIELDS"..i, image="terrain/grass.png", add_mos={{image="terrain/cultivation0"..i..".png"}} } end newEntity{ base = "FLOOR", define_as = "COBBLESTONE", name="cobblestone road", display='.', image="terrain/stone_road1.png", special_minimap = colors.DARK_GREY, } newEntity{ base = "HARDWALL", define_as = "ROCK", name="giant rock", image="terrain/oldstone_floor.png", z=1, add_displays = {class.new{z=2, image="terrain/huge_rock.png"}}, nice_tiler = false, } newEntity{ define_as = "CLOSED_GATE", name = "closed gate", image = "terrain/sealed_door.png", display = '+', color=colors.WHITE, back_color=colors.DARK_UMBER, notice = true, always_remember = true, block_sight = true, does_block_move = true, } newEntity{ define_as = "OPEN_GATE", type = "wall", subtype = "floor", name = "open gate", image = "terrain/sealed_door_cracked.png", display = "'", color=colors.WHITE, back_color=colors.DARK_UMBER, notice = true, always_remember = true, }
gpl-3.0
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/EaseElasticOut.lua
9
1215
-------------------------------- -- @module EaseElasticOut -- @extend EaseElastic -- @parent_module cc -------------------------------- -- @overload self, cc.ActionInterval -- @overload self, cc.ActionInterval, float -- @function [parent=#EaseElasticOut] create -- @param self -- @param #cc.ActionInterval action -- @param #float period -- @return EaseElasticOut#EaseElasticOut ret (return value: cc.EaseElasticOut) -------------------------------- -- -- @function [parent=#EaseElasticOut] clone -- @param self -- @return EaseElasticOut#EaseElasticOut ret (return value: cc.EaseElasticOut) -------------------------------- -- -- @function [parent=#EaseElasticOut] update -- @param self -- @param #float time -- @return EaseElasticOut#EaseElasticOut self (return value: cc.EaseElasticOut) -------------------------------- -- -- @function [parent=#EaseElasticOut] reverse -- @param self -- @return EaseElastic#EaseElastic ret (return value: cc.EaseElastic) -------------------------------- -- -- @function [parent=#EaseElasticOut] EaseElasticOut -- @param self -- @return EaseElasticOut#EaseElasticOut self (return value: cc.EaseElasticOut) return nil
mit
greasydeal/darkstar
scripts/zones/Lower_Jeuno/Zone.lua
12
3839
----------------------------------- -- -- Zone: Lower_Jeuno (245) -- ----------------------------------- package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Lower_Jeuno/TextIDs"); require("scripts/globals/settings"); require("scripts/globals/missions"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) zone:registerRegion(1, 23, 0, -43, 44, 7, -39); -- Inside Tenshodo HQ end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; local month = tonumber(os.date("%m")); local day = tonumber(os.date("%d")); -- Retail start/end dates vary, I am going with Dec 5th through Jan 5th. if ((month == 12 and day >= 5) or (month == 1 and day <= 5)) then player:ChangeMusic(0,239); player:ChangeMusic(1,239); -- No need for an 'else' to change it back outside these dates as a re-zone will handle that. end -- MOG HOUSE EXIT if ((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(41.2,-5, 84,85); if (player:getMainJob() ~= player:getVar("PlayerMainJob")) then cs = 0x7534; end player:setVar("PlayerMainJob",0); elseif(player:getCurrentMission(COP) == TENDING_AGED_WOUNDS and player:getVar("PromathiaStatus")==0)then player:setVar("PromathiaStatus",1); cs = 0x0046; elseif(ENABLE_ACP == 1 and player:getCurrentMission(ACP) == A_CRYSTALLINE_PROPHECY and player:getMainLvl() >=10) then cs = 0x276E; end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) -- print("entered region") if (region:GetRegionID() == 1) then -- print("entered region 1") if (player:getCurrentMission(ZILART) == AWAKENING and player:getVar("ZilartStatus") < 2) then player:startEvent(0x0014); end end end; ----------------------------------- -- onGameHour ----------------------------------- function onGameHour() local VanadielHour = VanadielHour(); -- Community Service Quest if(VanadielHour == 1) then if(GetServerVariable("[JEUNO]CommService") == 0) then GetNPCByID(17780880):setStatus(0); -- Vhana Ehgaklywha GetNPCByID(17780880):initNpcAi(); end; elseif(VanadielHour == 5) then SetServerVariable("[JEUNO]CommService",0); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x7534 and option == 0) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); elseif (csid == 0x0014) then player:setVar("ZilartStatus", player:getVar("ZilartStatus")+2); elseif (csid == 0x276E) then player:completeMission(ACP,A_CRYSTALLINE_PROPHECY); player:addMission(ACP,THE_ECHO_AWAKENS); end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Labyrinth_of_Onzozo/mobs/Goblin_Mercenary.lua
23
1060
----------------------------------- -- Area: Labyrinth of Onzozo -- MOB: Goblin Mercenary -- Note: Place holder Soulstealer Skullnix ----------------------------------- require("scripts/zones/Labyrinth_of_Onzozo/MobIDs"); ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) checkGoVregime(killer,mob,771,2); checkGoVregime(killer,mob,772,2); checkGoVregime(killer,mob,774,2); local mob = mob:getID(); if (Soulstealer_Skullnix_PH[mob] ~= nil) then local ToD = GetServerVariable("[POP]Soulstealer_Skullnix"); if (ToD <= os.time(t) and GetMobAction(Soulstealer_Skullnix) == 0) then if (math.random((1),(20)) == 5) then UpdateNMSpawnPoint(Soulstealer_Skullnix); GetMobByID(Soulstealer_Skullnix):setRespawnTime(GetMobRespawnTime(mob)); SetServerVariable("[PH]Soulstealer_Skullnix", mob); DeterMob(mob, true); end end end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Lower_Jeuno/npcs/Miladi-Nildi.lua
38
1034
----------------------------------- -- Area: Lower Jeuno -- NPC: Miladi-Nildi -- Type: Standard NPC -- @zone: 245 -- @pos 39.898 -5.999 77.190 -- -- Auto-Script: Requires Verification (Verfied by Brawndo) ----------------------------------- package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0061); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
naclander/tome
game/modules/gruesome/dialogs/MapMenu.lua
1
4789
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org require "engine.class" require "engine.ui.Dialog" local List = require "engine.ui.List" local Map = require "engine.Map" module(..., package.seeall, class.inherit(engine.ui.Dialog)) function _M:init(mx, my, tmx, tmy) self.tmx, self.tmy = util.bound(tmx, 0, game.level.map.w - 1), util.bound(tmy, 0, game.level.map.h - 1) if tmx == game.player.x and tmy == game.player.y then self.on_player = true end self:generateList() self.__showup = false local name = "Actions" local w = self.font_bold:size(name) engine.ui.Dialog.init(self, name, 1, 100, mx, my) local list = List.new{width=math.max(w, self.max) + 10, nb_items=#self.list, list=self.list, fct=function(item) self:use(item) end} self:loadUI{ {left=0, top=0, ui=list}, } self:setupUI(true, true, function(w, h) self.force_x = mx - w / 2 self.force_y = my - (self.h - self.ih + list.fh / 3) end) self.mouse:reset() self.mouse:registerZone(0, 0, game.w, game.h, function(button, x, y, xrel, yrel, bx, by, event) if (button == "left" or button == "right") and event == "button" then self.key:triggerVirtual("EXIT") end end) self.mouse:registerZone(self.display_x, self.display_y, self.w, self.h, function(button, x, y, xrel, yrel, bx, by, event) if button == "right" and event == "button" then self.key:triggerVirtual("EXIT") else self:mouseEvent(button, x, y, xrel, yrel, bx, by, event) end end) self.key:addBinds{ EXIT = function() game:unregisterDialog(self) end, } end function _M:use(item) if not item then return end game:unregisterDialog(self) local act = item.action if act == "move_to" then game.player:mouseMove(self.tmx, self.tmy) elseif act == "change_level" then game.key:triggerVirtual("CHANGE_LEVEL") elseif act == "talent" then local d = item if d.set_target then local a = game.level.map(self.tmx, self.tmy, Map.ACTOR) if not a then a = {x=self.tmx, y=self.tmy, __no_self=true} end game.player:useTalent(d.talent.id, nil, nil, nil, a) else game.player:useTalent(d.talent.id) end end end function _M:generateList() local list = {} local player = game.player local g = game.level.map(self.tmx, self.tmy, Map.TERRAIN) local t = game.level.map(self.tmx, self.tmy, Map.TRAP) local o = game.level.map(self.tmx, self.tmy, Map.OBJECT) local a = game.level.map(self.tmx, self.tmy, Map.ACTOR) -- Generic actions if g and g.change_level and self.on_player then list[#list+1] = {name="Change level", action="change_level", color=colors.simple(colors.VIOLET)} end if g and not self.on_player then list[#list+1] = {name="Move to", action="move_to", color=colors.simple(colors.ANTIQUE_WHITE)} end -- Talents if game.zone and not game.zone.wilderness then local tals = {} for tid, _ in pairs(player.talents) do local t = player:getTalentFromId(tid) if t.mode ~= "passive" and player:preUseTalent(t, true, true) and not player:isTalentCoolingDown(t) then local rt = util.getval(t.requires_target, player, t) if self.on_player and not rt then tals[#tals+1] = {name=t.name, talent=t, action="talent", color=colors.simple(colors.GOLD)} elseif not self.on_player and rt then tals[#tals+1] = {name=t.name, talent=t, action="talent", set_target=true, color=colors.simple(colors.GOLD)} end end end table.sort(tals, function(a, b) local ha, hb for i = 1, 36 do if player.hotkey[i] and player.hotkey[i][1] == "talent" and player.hotkey[i][2] == a.talent.id then ha = i end end for i = 1, 36 do if player.hotkey[i] and player.hotkey[i][1] == "talent" and player.hotkey[i][2] == b.talent.id then hb = i end end if ha and hb then return ha < hb elseif ha and not hb then return ha < 999999 elseif hb and not ha then return hb > 999999 else return a.talent.name < b.talent.name end end) for i = 1, #tals do list[#list+1] = tals[i] end end self.max = 0 self.maxh = 0 for i, v in ipairs(list) do local w, h = self.font:size(v.name) self.max = math.max(self.max, w) self.maxh = self.maxh + h end self.list = list end
gpl-3.0
greasydeal/darkstar
scripts/zones/Quicksand_Caves/npcs/qm5.lua
2
2024
----------------------------------- -- Area: Quicksand Caves -- NPC: ??? (qm5) -- Involved in Quest: The Missing Piece -- @pos --1:770 0 -419 --2:657 0 -537 --3:749 0 -573 --4:451 -16 -739 --5:787 -16 -819 --spawn in npc_list is 770 0 -419 ----------------------------------- package.loaded["scripts/zones/Quicksand_Caves/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/zones/Quicksand_Caves/TextIDs"); ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local TheMissingPiece = player:getQuestStatus(OUTLANDS,THE_MISSING_PIECE); local HasAncientFragment = player:hasKeyItem(ANCIENT_TABLET_FRAGMENT); local HasAncientTablet = player:hasKeyItem(TABLET_OF_ANCIENT_MAGIC); --Need to make sure the quest is flagged the player is no further along in the quest if(TheMissingPiece == QUEST_ACCEPTED and not(HasAncientTablet or HasAncientFragment or player:getTitle() == ACQUIRER_OF_ANCIENT_ARCANUM)) then player:addKeyItem(ANCIENT_TABLET_FRAGMENT); player:messageSpecial(KEYITEM_OBTAINED,ANCIENT_TABLET_FRAGMENT); --move the ??? to a random location local i = math.random(0,100); if(i >= 0 and i < 20) then npc:setPos(770,0,-419,0); elseif(i >= 20 and i < 40) then npc:setPos(657,0,-537,0); elseif(i >= 40 and i < 60) then npc:setPos(749,0,-573,0); elseif(i >= 60 and i < 80) then npc:setPos(451,-16,-739,0); elseif(i >= 80 and i <= 100) then npc:setPos(787,-16,-819,0); else npc:setPos(787,-16,-819,0); end; else player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end; end; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --print("CSID:",csid); --print("RESULT:",option); end;
gpl-3.0
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/PointLight.lua
11
1236
-------------------------------- -- @module PointLight -- @extend BaseLight -- @parent_module cc -------------------------------- -- get or set range -- @function [parent=#PointLight] getRange -- @param self -- @return float#float ret (return value: float) -------------------------------- -- -- @function [parent=#PointLight] setRange -- @param self -- @param #float range -- @return point_table#point_table self (return value: point_table) -------------------------------- -- Creates a point light.<br> -- param position The light's position<br> -- param color The light's color.<br> -- param range The light's range.<br> -- return The new point light. -- @function [parent=#PointLight] create -- @param self -- @param #vec3_table position -- @param #color3b_table color -- @param #float range -- @return point_table#point_table ret (return value: point_table) -------------------------------- -- -- @function [parent=#PointLight] getLightType -- @param self -- @return int#int ret (return value: int) -------------------------------- -- -- @function [parent=#PointLight] PointLight -- @param self -- @return point_table#point_table self (return value: point_table) return nil
mit
Codex-NG/otxserver
data/talkactions/scripts/mccheck.lua
40
1027
function onSay(player, words, param) if not player:getGroup():getAccess() then return true end if player:getAccountType() < ACCOUNT_TYPE_GOD then return false end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Multiclient Check List:") local ipList = {} local players = Game.getPlayers() for i = 1, #players do local tmpPlayer = players[i] local ip = tmpPlayer:getIp() if ip ~= 0 then local list = ipList[ip] if not list then ipList[ip] = {} list = ipList[ip] end list[#list + 1] = tmpPlayer end end for ip, list in pairs(ipList) do local listLength = #list if listLength > 1 then local tmpPlayer = list[1] local message = ("%s: %s [%d]"):format(Game.convertIpToString(ip), tmpPlayer:getName(), tmpPlayer:getLevel()) for i = 2, listLength do tmpPlayer = list[i] message = ("%s, %s [%d]"):format(message, tmpPlayer:getName(), tmpPlayer:getLevel()) end player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, message .. ".") end end return false end
gpl-2.0
NebronTM/TeleBot
libs/serpent.lua
31
8016
local n, v = "serpent", 0.28 -- (C) 2012-15 Paul Kulchenko; MIT License local c, d = "Paul Kulchenko", "Lua serializer and pretty printer" local snum = {[tostring(1/0)]='1/0 --[[math.huge]]',[tostring(-1/0)]='-1/0 --[[-math.huge]]',[tostring(0/0)]='0/0'} local badtype = {thread = true, userdata = true, cdata = true} local keyword, globals, G = {}, {}, (_G or _ENV) for _,k in ipairs({'and', 'break', 'do', 'else', 'elseif', 'end', 'false', 'for', 'function', 'goto', 'if', 'in', 'local', 'nil', 'not', 'or', 'repeat', 'return', 'then', 'true', 'until', 'while'}) do keyword[k] = true end for k,v in pairs(G) do globals[v] = k end -- build func to name mapping for _,g in ipairs({'coroutine', 'debug', 'io', 'math', 'string', 'table', 'os'}) do for k,v in pairs(G[g] or {}) do globals[v] = g..'.'..k end end local function s(t, opts) local name, indent, fatal, maxnum = opts.name, opts.indent, opts.fatal, opts.maxnum local sparse, custom, huge = opts.sparse, opts.custom, not opts.nohuge local space, maxl = (opts.compact and '' or ' '), (opts.maxlevel or math.huge) local iname, comm = '_'..(name or ''), opts.comment and (tonumber(opts.comment) or math.huge) local seen, sref, syms, symn = {}, {'local '..iname..'={}'}, {}, 0 local function gensym(val) return '_'..(tostring(tostring(val)):gsub("[^%w]",""):gsub("(%d%w+)", -- tostring(val) is needed because __tostring may return a non-string value function(s) if not syms[s] then symn = symn+1; syms[s] = symn end return tostring(syms[s]) end)) end local function safestr(s) return type(s) == "number" and tostring(huge and snum[tostring(s)] or s) or type(s) ~= "string" and tostring(s) -- escape NEWLINE/010 and EOF/026 or ("%q"):format(s):gsub("\010","n"):gsub("\026","\\026") end local function comment(s,l) return comm and (l or 0) < comm and ' --[['..tostring(s)..']]' or '' end local function globerr(s,l) return globals[s] and globals[s]..comment(s,l) or not fatal and safestr(select(2, pcall(tostring, s))) or error("Can't serialize "..tostring(s)) end local function safename(path, name) -- generates foo.bar, foo[3], or foo['b a r'] local n = name == nil and '' or name local plain = type(n) == "string" and n:match("^[%l%u_][%w_]*$") and not keyword[n] local safe = plain and n or '['..safestr(n)..']' return (path or '')..(plain and path and '.' or '')..safe, safe end local alphanumsort = type(opts.sortkeys) == 'function' and opts.sortkeys or function(k, o, n) -- k=keys, o=originaltable, n=padding local maxn, to = tonumber(n) or 12, {number = 'a', string = 'b'} local function padnum(d) return ("%0"..tostring(maxn).."d"):format(tonumber(d)) end table.sort(k, function(a,b) -- sort numeric keys first: k[key] is not nil for numerical keys return (k[a] ~= nil and 0 or to[type(a)] or 'z')..(tostring(a):gsub("%d+",padnum)) < (k[b] ~= nil and 0 or to[type(b)] or 'z')..(tostring(b):gsub("%d+",padnum)) end) end local function val2str(t, name, indent, insref, path, plainindex, level) local ttype, level, mt = type(t), (level or 0), getmetatable(t) local spath, sname = safename(path, name) local tag = plainindex and ((type(name) == "number") and '' or name..space..'='..space) or (name ~= nil and sname..space..'='..space or '') if seen[t] then -- already seen this element sref[#sref+1] = spath..space..'='..space..seen[t] return tag..'nil'..comment('ref', level) end if type(mt) == 'table' and (mt.__serialize or mt.__tostring) then -- knows how to serialize itself seen[t] = insref or spath if mt.__serialize then t = mt.__serialize(t) else t = tostring(t) end ttype = type(t) end -- new value falls through to be serialized if ttype == "table" then if level >= maxl then return tag..'{}'..comment('max', level) end seen[t] = insref or spath if next(t) == nil then return tag..'{}'..comment(t, level) end -- table empty local maxn, o, out = math.min(#t, maxnum or #t), {}, {} for key = 1, maxn do o[key] = key end if not maxnum or #o < maxnum then local n = #o -- n = n + 1; o[n] is much faster than o[#o+1] on large tables for key in pairs(t) do if o[key] ~= key then n = n + 1; o[n] = key end end end if maxnum and #o > maxnum then o[maxnum+1] = nil end if opts.sortkeys and #o > maxn then alphanumsort(o, t, opts.sortkeys) end local sparse = sparse and #o > maxn -- disable sparsness if only numeric keys (shorter output) for n, key in ipairs(o) do local value, ktype, plainindex = t[key], type(key), n <= maxn and not sparse if opts.valignore and opts.valignore[value] -- skip ignored values; do nothing or opts.keyallow and not opts.keyallow[key] or opts.valtypeignore and opts.valtypeignore[type(value)] -- skipping ignored value types or sparse and value == nil then -- skipping nils; do nothing elseif ktype == 'table' or ktype == 'function' or badtype[ktype] then if not seen[key] and not globals[key] then sref[#sref+1] = 'placeholder' local sname = safename(iname, gensym(key)) -- iname is table for local variables sref[#sref] = val2str(key,sname,indent,sname,iname,true) end sref[#sref+1] = 'placeholder' local path = seen[t]..'['..tostring(seen[key] or globals[key] or gensym(key))..']' sref[#sref] = path..space..'='..space..tostring(seen[value] or val2str(value,nil,indent,path)) else out[#out+1] = val2str(value,key,indent,insref,seen[t],plainindex,level+1) end end local prefix = string.rep(indent or '', level) local head = indent and '{\n'..prefix..indent or '{' local body = table.concat(out, ','..(indent and '\n'..prefix..indent or space)) local tail = indent and "\n"..prefix..'}' or '}' return (custom and custom(tag,head,body,tail) or tag..head..body..tail)..comment(t, level) elseif badtype[ttype] then seen[t] = insref or spath return tag..globerr(t, level) elseif ttype == 'function' then seen[t] = insref or spath local ok, res = pcall(string.dump, t) local func = ok and ((opts.nocode and "function() --[[..skipped..]] end" or "((loadstring or load)("..safestr(res)..",'@serialized'))")..comment(t, level)) return tag..(func or globerr(t, level)) else return tag..safestr(t) end -- handle all other types end local sepr = indent and "\n" or ";"..space local body = val2str(t, name, indent) -- this call also populates sref local tail = #sref>1 and table.concat(sref, sepr)..sepr or '' local warn = opts.comment and #sref>1 and space.."--[[incomplete output with shared/self-references skipped]]" or '' return not name and body..warn or "do local "..body..sepr..tail.."return "..name..sepr.."end" end local function deserialize(data, opts) local env = (opts and opts.safe == false) and G or setmetatable({}, { __index = function(t,k) return t end, __call = function(t,...) error("cannot call functions") end }) local f, res = (loadstring or load)('return '..data, nil, nil, env) if not f then f, res = (loadstring or load)(data, nil, nil, env) end if not f then return f, res end if setfenv then setfenv(f, env) end return pcall(f) end local function merge(a, b) if b then for k,v in pairs(b) do a[k] = v end end; return a; end return { _NAME = n, _COPYRIGHT = c, _DESCRIPTION = d, _VERSION = v, serialize = s, load = deserialize, dump = function(a, opts) return s(a, merge({name = '_', compact = true, sparse = true}, opts)) end, line = function(a, opts) return s(a, merge({sortkeys = true, comment = true}, opts)) end, block = function(a, opts) return s(a, merge({indent = ' ', sortkeys = true, comment = true}, opts)) end } -- کد های پایین در ربات نشان داده نمیشوند -- http://permag.ir -- @permag_ir -- @permag_bots -- @permag
gpl-3.0
knl/hammerspoon
extensions/timer/init.lua
8
6764
--- === hs.timer === --- --- Execute functions with various timing rules --- --- This module is based primarily on code from the previous incarnation of Mjolnir by [Steven Degutis](https://github.com/sdegutis/). local module = require("hs.timer.internal") -- private variables and methods ----------------------------------------- -- Public interface ------------------------------------------------------ function module.seconds(n) return n end --- hs.timer.minutes(n) -> seconds --- Function --- Converts minutes to seconds --- --- Parameters: --- * n - A number of minutes --- --- Returns: --- * The number of seconds in n minutes function module.minutes(n) return 60 * n end --- hs.timer.hours(n) -> seconds --- Function --- Converts hours to seconds --- --- Parameters: --- * n - A number of hours --- --- Returns: --- * The number of seconds in n hours function module.hours(n) return 60 * 60 * n end --- hs.timer.days(n) -> sec --- Function --- Converts days to seconds --- --- Parameters: --- * n - A number of days --- --- Returns: --- * The number of seconds in n days function module.days(n) return 60 * 60 * 24 * n end --- hs.timer.weeks(n) -> sec --- Function --- Converts weeks to seconds --- --- Parameters: --- * n - A number of weeks --- --- Returns: --- * The number of seconds in n weeks function module.weeks(n) return 60 * 60 * 24 * 7 * n end --- hs.timer.waitUntil(predicateFn, actionFn[, checkInterval]) -> timer --- Constructor --- Creates and starts a timer which will perform `actionFn` when `predicateFn` returns true. The timer is automatically stopped when `actionFn` is called. --- --- Parameters: --- * predicateFn - a function which determines when `actionFn` should be called. This function takes no arguments, but should return true when it is time to call `actionFn`. --- * actionFn - a function which performs the desired action. This function may take a single argument, the timer itself. --- * checkInterval - an optional parameter indicating how often to repeat the `predicateFn` check. Defaults to 1 second. --- --- Returns: --- * a timer object --- --- Notes: --- * The timer is stopped before `actionFn` is called, but the timer is passed as an argument to `actionFn` so that the actionFn may restart the timer to be called again the next time predicateFn returns true. --- * See also `hs.timer.waitWhile` module.waitUntil = function(predicateFn, actionFn, checkInterval) checkInterval = checkInterval or 1 local stopWatch stopWatch = module.new(checkInterval, function() if predicateFn() then stopWatch:stop() actionFn(stopWatch) end end):start() return stopWatch end --- hs.timer.doUntil(predicateFn, actionFn[, checkInterval]) -> timer --- Constructor --- Creates and starts a timer which will perform `actionFn` every `checkinterval` seconds until `predicateFn` returns true. The timer is automatically stopped when `predicateFn` returns false. --- --- Parameters: --- * predicateFn - a function which determines when to stop calling `actionFn`. This function takes no arguments, but should return true when it is time to stop calling `actionFn`. --- * actionFn - a function which performs the desired action. This function may take a single argument, the timer itself. --- * checkInterval - an optional parameter indicating how often to repeat the `predicateFn` check. Defaults to 1 second. --- --- Returns: --- * a timer object --- --- Notes: --- * The timer is passed as an argument to `actionFn` so that it may stop the timer prematurely (i.e. before predicateFn returns true) if desired. --- * See also `hs.timer.doWhile` module.doUntil = function(predicateFn, actionFn, checkInterval) checkInterval = checkInterval or 1 local stopWatch stopWatch = module.new(checkInterval, function() if not predicateFn() then actionFn(stopWatch) else stopWatch:stop() end end):start() return stopWatch end --- hs.timer.doEvery(interval, fn) -> timer --- Constructor --- Repeats fn every interval seconds. --- --- Parameters: --- * interval - A number of seconds between triggers --- * fn - A function to call every time the timer triggers --- --- Returns: --- * An `hs.timer` object --- --- Notes: --- * This function is a shorthand for `hs.timer.new(interval, fn):start()` module.doEvery = function(...) return module.new(...):start() end --- hs.timer.waitWhile(predicateFn, actionFn[, checkInterval]) -> timer --- Constructor --- Creates and starts a timer which will perform `actionFn` when `predicateFn` returns false. The timer is automatically stopped when `actionFn` is called. --- --- Parameters: --- * predicateFn - a function which determines when `actionFn` should be called. This function takes no arguments, but should return false when it is time to call `actionFn`. --- * actionFn - a function which performs the desired action. This function may take a single argument, the timer itself. --- * checkInterval - an optional parameter indicating how often to repeat the `predicateFn` check. Defaults to 1 second. --- --- Returns: --- * a timer object --- --- Notes: --- * The timer is stopped before `actionFn` is called, but the timer is passed as an argument to `actionFn` so that the actionFn may restart the timer to be called again the next time predicateFn returns false. --- * See also `hs.timer.waitUntil` module.waitWhile = function(predicateFn, ...) return module.waitUntil(function() return not predicateFn() end, ...) end --- hs.timer.doWhile(predicateFn, actionFn[, checkInterval]) -> timer --- Constructor --- Creates and starts a timer which will perform `actionFn` every `checkinterval` seconds while `predicateFn` returns true. The timer is automatically stopped when `predicateFn` returns false. --- --- Parameters: --- * predicateFn - a function which determines when to stop calling `actionFn`. This function takes no arguments, but should return false when it is time to stop calling `actionFn`. --- * actionFn - a function which performs the desired action. This function may take a single argument, the timer itself. --- * checkInterval - an optional parameter indicating how often to repeat the `predicateFn` check. Defaults to 1 second. --- --- Returns: --- * a timer object --- --- Notes: --- * The timer is passed as an argument to `actionFn` so that it may stop the timer prematurely (i.e. before predicateFn returns false) if desired. --- * See also `hs.timer.doUntil` module.doWhile = function(predicateFn, ...) return module.doUntil(function() return not predicateFn() end, ...) end -- Return Module Object -------------------------------------------------- return module
mit
LegionXI/darkstar
scripts/zones/Port_Jeuno/npcs/Dohhel.lua
14
1044
----------------------------------- -- Area: Port Jeuno -- NPC: Dohhel -- Type: Event Scene Replayer -- @zone 246 -- @pos -156.031 -2 6.051 -- -- Auto-Script: Requires Verification (Verfied by Brawndo) ----------------------------------- package.loaded["scripts/zones/Port_Jeuno/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x272c); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
gwlim/luci
applications/luci-diag-devinfo/luasrc/model/cbi/luci_diag/mactodevinfo.lua
80
1260
--[[ LuCI - Lua Configuration Interface (c) 2009 Daniel Dickinson 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$ ]]-- m = Map("mactodevinfo", luci.i18n.translate("MAC Device Info Overrides"), translate("Override the information returned by the MAC to Device Info Script (mac-to-devinfo) for a specified range of MAC Addresses")) s = m:section(TypedSection, "mactodevinfo", translate("MAC Device Override"), translate("MAC range and information used to override system and IEEE databases")) s.addremove = true s.anonymous = true v = s:option(Value, "name", translate("Name")) v.optional = true v = s:option(Value, "maclow", translate("Beginning of MAC address range")) v.optional = false v = s:option(Value, "machigh", translate("End of MAC address range")) v.optional = false v = s:option(Value, "vendor", translate("Vendor")) v.optional = false v = s:option(Value, "devtype", translate("Device Type")) v.optional = false v = s:option(Value, "model", translate("Model")) v.optional = false v = s:option(Value, "ouiowneroverride", translate("OUI Owner")) v.optional = true return m
apache-2.0
greasydeal/darkstar
scripts/commands/jail.lua
26
2109
--------------------------------------------------------------------------------------------------- -- func: jail -- desc: Sends the target player to jail. (Mordion Gaol) --------------------------------------------------------------------------------------------------- cmdprops = { permission = 1, parameters = "sis" }; function onTrigger(player, target, cellId, reason) local jailCells = { -- Floor 1 (Bottom) {-620, 11, 660, 0}, {-180, 11, 660, 0}, {-260, 11, 660, 0}, {-700, 11, 660, 0}, {-620, 11, 220, 0}, {-180, 11, 220, 0}, {-260, 11, 220, 0}, {-700, 11, 220, 0}, {-620, 11, -220, 0}, {-180, 11, -220, 0}, {-260, 11, -220, 0}, {-700, 11, -220, 0}, {-620, 11, -660, 0}, {-180, 11, -660, 0}, {-260, 11, -660, 0}, {-700, 11, -660, 0}, -- Floor 2 (Top) {-620, -440, 660, 0}, {-180, -440, 660, 0}, {-260, -440, 660, 0}, {-700, -440, 660, 0}, {-620, -440, 220, 0}, {-180, -440, 220, 0}, {-260, -440, 220, 0}, {-700, -440, 220, 0}, {-620, -440, -220, 0}, {-180, -440, -220, 0}, {-260, -440, -220, 0}, {-700, -440, -220, 0}, {-620, -440, -660, 0}, {-180, -440, -660, 0}, {-260, -440, -660, 0}, {-700, -440, -660, 0}, }; -- Validate the target.. local targ = GetPlayerByName( target ); if (targ == nil) then player:PrintToPlayer( string.format( "Invalid player '%s' given.", target ) ); return; end -- Validate the cell id.. if (cellId == nil or cellId == 0 or cellId > 32) then cellId = 1; end -- Validate the reason.. if (reason == nil) then reason = "Unspecified."; end -- Print that we have jailed someone.. local message = string.format( '%s jailed %s(%d) into cell %d. Reason: %s', player:getName(), target, targ:getID(), cellId, reason ); printf( message ); -- Send the target to jail.. local dest = jailCells[ cellId ]; targ:setVar( "inJail", cellId ); targ:setPos( dest[1], dest[2], dest[3], dest[4], 131 ); end
gpl-3.0
BackupGGCode/teebx
misc/lua/parse-desc.lua
4
1517
#!/usr/bin/env lua -- --- T2-COPYRIGHT-NOTE-BEGIN --- -- This copyright note is auto-generated by ./scripts/Create-CopyPatch. -- -- T2 SDE: misc/lua/parse-desc.lua -- Copyright (C) 2005 - 2006 The T2 SDE Project -- -- More information can be found in the files COPYING and README. -- -- 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; version 2 of the License. A copy of the -- GNU General Public License can be found in the file COPYING. -- --- T2-COPYRIGHT-NOTE-END --- -- try this: -- -- this file looks quite complicated already, but a comparsion to grep might help: -- -- time lua misc/lua/parse-desc.lua package/base/*/*.desc > /dev/null -- time grep "^[[]" package/base/*/*.desc > /dev/null -- require "misc/lua/sde/desc" if #arg < 1 then print("Usage: lua misc/lua/parse-desc.lua [path-to-desc-file]") os.exit(1) end function printf(...) io.write(string.format(unpack(arg))) end -- parse all files pkgs = {} for i,file in ipairs(arg) do if i > 0 then _,_,repo,pkg = string.find(file, "package/([^/]*)/([^/]*)/*"); -- put all parsed files into a table pkgs[pkg] = desc.parse(file) end end -- output for pkg,tab in pairs(pkgs) do printf("Package %s:\n", pkg); for k,v in pairs(tab) do if type(v) == "table" then printf(" %s: %s\n", k, table.concat(v,"\n ")); else printf(" %s: %s\n", k, v); end end end
gpl-2.0
greasydeal/darkstar
scripts/zones/Balgas_Dais/bcnms/charming_trio.lua
13
1813
----------------------------------- -- Area: Balgas_Dais -- Name: Charming Trio ----------------------------------- package.loaded["scripts/zones/Balgas_Dais/TextIDs"] = nil; ------------------------------------- require("scripts/globals/titles"); require("scripts/globals/quests"); require("scripts/zones/Balgas_Dais/TextIDs"); ----------------------------------- -- EXAMPLE SCRIPT -- -- What should go here: -- giving key items, playing ENDING cutscenes -- -- What should NOT go here: -- Handling of "battlefield" status, spawning of monsters, -- putting loot into treasure pool, -- enforcing ANY rules (SJ/number of people/etc), moving -- chars around, playing entrance CSes (entrance CSes go in bcnm.lua) -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) -- print("leave code "..leavecode); if(leavecode == 2) then -- play end CS. Need time and battle id for record keeping + storage player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,1,0); elseif(leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) -- print("bc finish csid "..csid.." and option "..option); end;
gpl-3.0
LegionXI/darkstar
scripts/globals/items/imperial_omelette.lua
12
2964
----------------------------------------- -- ID: 4331 -- Item: imperial_omelette -- Food Effect: 240Min, All Races ----------------------------------------- -- Non Elvaan Stats -- Strength 5 -- Dexterity 2 -- Intelligence -3 -- Mind 4 -- Attack % 22 -- Attack Cap 70 -- Ranged ATT % 22 -- Ranged ATT Cap 70 ----------------------------------------- -- Elvaan Stats -- Strength 7 -- Health 30 -- Magic 30 -- Intelligence -1 -- Mind 6 -- Charisma 5 -- Attack % 20 (cap 80) -- Ranged ATT % 20 (cap 80) ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,14400,4331); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) if (target:getRace() ~= 4) then target:addMod(MOD_STR, 5); target:addMod(MOD_DEX, 2); target:addMod(MOD_INT, -3); target:addMod(MOD_MND, 4); target:addMod(MOD_FOOD_ATTP, 22); target:addMod(MOD_FOOD_ATT_CAP, 70); target:addMod(MOD_FOOD_RATTP, 22); target:addMod(MOD_FOOD_RATT_CAP, 70); else target:addMod(MOD_HP, 30); target:addMod(MOD_MP, 30); target:addMod(MOD_STR, 7); target:addMod(MOD_DEX, 3); target:addMod(MOD_INT, -1); target:addMod(MOD_MND, 6); target:addMod(MOD_CHR, 5); target:addMod(MOD_FOOD_ATTP, 20); target:addMod(MOD_FOOD_ATT_CAP, 80); target:addMod(MOD_FOOD_RATTP, 20); target:addMod(MOD_FOOD_RATT_CAP, 80); end end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) if (target:getRace() ~= 4) then target:delMod(MOD_STR, 5); target:delMod(MOD_DEX, 2); target:delMod(MOD_INT, -3); target:delMod(MOD_MND, 4); target:delMod(MOD_FOOD_ATTP, 22); target:delMod(MOD_FOOD_ATT_CAP, 70); target:delMod(MOD_FOOD_RATTP, 22); target:delMod(MOD_FOOD_RATT_CAP, 70); else target:delMod(MOD_HP, 30); target:delMod(MOD_MP, 30); target:delMod(MOD_STR, 7); target:delMod(MOD_DEX, 3); target:delMod(MOD_INT, -1); target:delMod(MOD_MND, 6); target:delMod(MOD_CHR, 5); target:delMod(MOD_FOOD_ATTP, 20); target:delMod(MOD_FOOD_ATT_CAP, 80); target:delMod(MOD_FOOD_RATTP, 20); target:delMod(MOD_FOOD_RATT_CAP, 80); end end;
gpl-3.0
greasydeal/darkstar
scripts/globals/items/m&p_doner_kabob.lua
36
1132
----------------------------------------- -- ID: 5717 -- Item: M&P Doner Kabob -- Food Effect: 5Min, All Races ----------------------------------------- -- HP 5% -- MP 5% ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,5717); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HPP, 5); target:addMod(MOD_MPP, 5); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HPP, 5); target:delMod(MOD_MPP, 5); end;
gpl-3.0
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/PhysicsShape.lua
3
10110
-------------------------------- -- @module PhysicsShape -- @extend Ref -- @parent_module cc -------------------------------- -- Get this shape's friction.<br> -- return A float number. -- @function [parent=#PhysicsShape] getFriction -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Set the group of body.<br> -- Collision groups let you specify an integral group index. You can have all fixtures with the same group index always collide (positive index) or never collide (negative index).<br> -- param group An interger number, it have high priority than bit masks. -- @function [parent=#PhysicsShape] setGroup -- @param self -- @param #int group -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Set this shape's density.<br> -- It will change the body's mass this shape attaches.<br> -- param density A float number. -- @function [parent=#PhysicsShape] setDensity -- @param self -- @param #float density -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Get the mass of this shape.<br> -- return A float number. -- @function [parent=#PhysicsShape] getMass -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Get this shape's PhysicsMaterial object.<br> -- return A PhysicsMaterial object reference. -- @function [parent=#PhysicsShape] getMaterial -- @param self -- @return PhysicsMaterial#PhysicsMaterial ret (return value: cc.PhysicsMaterial) -------------------------------- -- -- @function [parent=#PhysicsShape] setSensor -- @param self -- @param #bool sensor -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Get a mask that defines which categories of physics bodies can collide with this physics body.<br> -- return An interger number. -- @function [parent=#PhysicsShape] getCollisionBitmask -- @param self -- @return int#int ret (return value: int) -------------------------------- -- Return this shape's area.<br> -- return A float number. -- @function [parent=#PhysicsShape] getArea -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Set a mask that defines which categories this physics body belongs to.<br> -- Every physics body in a scene can be assigned to up to 32 different categories, each corresponding to a bit in the bit mask. You define the mask values used in your game. In conjunction with the collisionBitMask and contactTestBitMask properties, you define which physics bodies interact with each other and when your game is notified of these interactions.<br> -- param bitmask An interger number, the default value is 0xFFFFFFFF (all bits set). -- @function [parent=#PhysicsShape] setCategoryBitmask -- @param self -- @param #int bitmask -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Get the group of body.<br> -- return An interger number. -- @function [parent=#PhysicsShape] getGroup -- @param self -- @return int#int ret (return value: int) -------------------------------- -- Set this shape's moment.<br> -- It will change the body's moment this shape attaches.<br> -- param moment A float number. -- @function [parent=#PhysicsShape] setMoment -- @param self -- @param #float moment -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Test point is inside this shape or not.<br> -- param point A Vec2 object.<br> -- return A bool object. -- @function [parent=#PhysicsShape] containsPoint -- @param self -- @param #vec2_table point -- @return bool#bool ret (return value: bool) -------------------------------- -- Get a mask that defines which categories this physics body belongs to.<br> -- return An interger number. -- @function [parent=#PhysicsShape] getCategoryBitmask -- @param self -- @return int#int ret (return value: int) -------------------------------- -- -- @function [parent=#PhysicsShape] isSensor -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- Return this shape's type.<br> -- return A Type object. -- @function [parent=#PhysicsShape] getType -- @param self -- @return int#int ret (return value: int) -------------------------------- -- Get a mask that defines which categories of bodies cause intersection notifications with this physics body.<br> -- return An interger number. -- @function [parent=#PhysicsShape] getContactTestBitmask -- @param self -- @return int#int ret (return value: int) -------------------------------- -- Get this shape's center position.<br> -- This function should be overrided in inherit classes.<br> -- return A Vec2 object. -- @function [parent=#PhysicsShape] getCenter -- @param self -- @return vec2_table#vec2_table ret (return value: vec2_table) -------------------------------- -- Get this shape's density.<br> -- return A float number. -- @function [parent=#PhysicsShape] getDensity -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Set this shape's mass.<br> -- It will change the body's mass this shape attaches.<br> -- param mass A float number. -- @function [parent=#PhysicsShape] setMass -- @param self -- @param #float mass -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Get this shape's tag.<br> -- return An interger number. -- @function [parent=#PhysicsShape] getTag -- @param self -- @return int#int ret (return value: int) -------------------------------- -- Calculate the default moment value.<br> -- This function should be overrided in inherit classes.<br> -- return A float number, equals 0.0. -- @function [parent=#PhysicsShape] calculateDefaultMoment -- @param self -- @return float#float ret (return value: float) -------------------------------- -- A mask that defines which categories of physics bodies can collide with this physics body.<br> -- When two physics bodies contact each other, a collision may occur. This body’s collision mask is compared to the other body’s category mask by performing a logical AND operation. If the result is a non-zero value, then this body is affected by the collision. Each body independently chooses whether it wants to be affected by the other body. For example, you might use this to avoid collision calculations that would make negligible changes to a body’s velocity.<br> -- param bitmask An interger number, the default value is 0xFFFFFFFF (all bits set). -- @function [parent=#PhysicsShape] setCollisionBitmask -- @param self -- @param #int bitmask -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Get this shape's moment.<br> -- return A float number. -- @function [parent=#PhysicsShape] getMoment -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Get this shape's position offset.<br> -- This function should be overrided in inherit classes.<br> -- return A Vec2 object. -- @function [parent=#PhysicsShape] getOffset -- @param self -- @return vec2_table#vec2_table ret (return value: vec2_table) -------------------------------- -- Get this shape's restitution.<br> -- return A float number. -- @function [parent=#PhysicsShape] getRestitution -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Set this shape's friction.<br> -- It will change the shape's friction.<br> -- param friction A float number. -- @function [parent=#PhysicsShape] setFriction -- @param self -- @param #float friction -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Set this shape's material.<br> -- It will change the shape's mass, elasticity and friction.<br> -- param material A PhysicsMaterial object. -- @function [parent=#PhysicsShape] setMaterial -- @param self -- @param #cc.PhysicsMaterial material -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Set this shape's tag.<br> -- param tag An interger number that identifies a shape object. -- @function [parent=#PhysicsShape] setTag -- @param self -- @param #int tag -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- A mask that defines which categories of bodies cause intersection notifications with this physics body.<br> -- When two bodies share the same space, each body’s category mask is tested against the other body’s contact mask by performing a logical AND operation. If either comparison results in a non-zero value, an PhysicsContact object is created and passed to the physics world’s delegate. For best performance, only set bits in the contacts mask for interactions you are interested in.<br> -- param bitmask An interger number, the default value is 0x00000000 (all bits cleared). -- @function [parent=#PhysicsShape] setContactTestBitmask -- @param self -- @param #int bitmask -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Set this shape's restitution.<br> -- It will change the shape's elasticity.<br> -- param restitution A float number. -- @function [parent=#PhysicsShape] setRestitution -- @param self -- @param #float restitution -- @return PhysicsShape#PhysicsShape self (return value: cc.PhysicsShape) -------------------------------- -- Get the body that this shape attaches.<br> -- return A PhysicsBody object pointer. -- @function [parent=#PhysicsShape] getBody -- @param self -- @return PhysicsBody#PhysicsBody ret (return value: cc.PhysicsBody) return nil
mit
LegionXI/darkstar
scripts/zones/Kazham/npcs/Rauteinot.lua
26
3159
----------------------------------- -- Area: Kazham -- NPC: Rauteinot -- Starts and Finishes Quest: Missionary Man -- @zone 250 -- @pos -42 -10 -89 ----------------------------------- package.loaded["scripts/zones/Kazham/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Kazham/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getVar("MissionaryManVar") == 1 and trade:hasItemQty(1146,1) == true and trade:getItemCount() == 1) then player:startEvent(0x008b); -- Trading elshimo marble end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) MissionaryMan = player:getQuestStatus(OUTLANDS,MISSIONARY_MAN); MissionaryManVar = player:getVar("MissionaryManVar"); if (MissionaryMan == QUEST_AVAILABLE and player:getFameLevel(KAZHAM) >= 3) then player:startEvent(0x0089,0,1146); -- Start quest "Missionary Man" elseif (MissionaryMan == QUEST_ACCEPTED and MissionaryManVar == 1) then player:startEvent(0x008a,0,1146); -- During quest (before trade marble) "Missionary Man" elseif (MissionaryMan == QUEST_ACCEPTED and (MissionaryManVar == 2 or MissionaryManVar == 3)) then player:startEvent(0x008c); -- During quest (after trade marble) "Missionary Man" elseif (MissionaryMan == QUEST_ACCEPTED and MissionaryManVar == 4) then player:startEvent(0x008d); -- Finish quest "Missionary Man" elseif (MissionaryMan == QUEST_COMPLETED) then player:startEvent(0x008e); -- New standard dialog else player:startEvent(0x0088); -- Standard dialog end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x0089 and option == 1) then player:addQuest(OUTLANDS,MISSIONARY_MAN); player:setVar("MissionaryManVar",1); elseif (csid == 0x008b) then player:setVar("MissionaryManVar",2); player:addKeyItem(RAUTEINOTS_PARCEL); player:messageSpecial(KEYITEM_OBTAINED,RAUTEINOTS_PARCEL); player:tradeComplete(); elseif (csid == 0x008d) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,4728); else player:setVar("MissionaryManVar",0); player:delKeyItem(SUBLIME_STATUE_OF_THE_GODDESS); player:addItem(4728); player:messageSpecial(ITEM_OBTAINED,4728); player:addFame(WINDURST,30); player:completeQuest(OUTLANDS,MISSIONARY_MAN); end end end;
gpl-3.0
ibm2431/darkstar
scripts/globals/items/plate_of_patlican_salata_+1.lua
11
1051
----------------------------------------- -- ID: 5583 -- Item: plate_of_patlican_salata_+1 -- Food Effect: 4Hrs, All Races ----------------------------------------- -- Agility 5 -- Vitality -2 -- Evasion +7 -- hHP +3 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,14400,5583) end function onEffectGain(target,effect) target:addMod(dsp.mod.AGI, 5) target:addMod(dsp.mod.VIT, -2) target:addMod(dsp.mod.EVA, 7) target:addMod(dsp.mod.HPHEAL, 3) end function onEffectLose(target, effect) target:delMod(dsp.mod.AGI, 5) target:delMod(dsp.mod.VIT, -2) target:delMod(dsp.mod.EVA, 7) target:delMod(dsp.mod.HPHEAL, 3) end
gpl-3.0
dojoteef/lualol
spec/match_spec.lua
1
5117
describe('lol.match', function() local match,lmatch setup(function() match = require('lol.match') lmatch = require('luassert.match') end) it('loaded okay', function() assert.not_nil(match) end) it('errors if given an invalid api obj', function() assert.has.errors(function() match({}) end) end) describe('match', function() local file, path local cacheDir, keyfile, testApi setup(function() file = require('pl.file') path = require('pl.path') cacheDir = '.testCache' if not path.isdir(cacheDir) then path.mkdir(cacheDir) end keyfile = '.test_keyfile' file.write(keyfile,'somerandomapikey') local api = require('lol.api') testApi = api(keyfile, 'na', cacheDir) end) teardown(function() file.delete(keyfile) if path.isdir(cacheDir) then local dir = require('pl.dir') dir.rmtree(cacheDir) end end) it('can be created', function() local testMatch = match(testApi) assert.is.not_nil(testMatch) end) it('has the correct API version', function() local testMatch = match(testApi) assert.is_equal(testMatch.version, '2.2') end) insulate('getById', function() local testMatch setup(function() testMatch = match(testApi) end) before_each(function() testMatch.api.cache:clearAll() end) it('uses api get on cache miss', function() local s1 = stub(testMatch.api, 'get',function() end) testMatch:getById(123456789) assert.stub(s1).called(1) local url = { path='/api/lol/${region}/v${version}/match/${matchId}', params={version=testMatch.version,matchId=123456789}, query={} } assert.stub(s1).called_with(testMatch.api, lmatch.same(url),lmatch.is_function()) s1:revert() end) local cacheForXSecsFn = function(secs) local mockRes = {{matchId=123456789}, 200, {}} local api = testMatch.api local cache = api.cache local cacheSecs = secs or 30*24*60*60 local s1 = spy.new(function() end) local s2 = stub(cache, 'set') local s3 = stub(api, 'get', function(_,_,c) c(unpack(mockRes)) end) testMatch:getById(123456789, {callback=s1,expire=secs}) assert.spy(s1).called(1) assert.spy(s1).called_with(unpack(mockRes)) local cacheKey = {api='match',matchId=123456789} assert.stub(s2).called_with(cache,lmatch.same(cacheKey),mockRes[1],cacheSecs) s2:revert() s3:revert() end it('caches api entries for 30 days by default', function() cacheForXSecsFn() end) it('caches api entries for the specified amount of time', function() cacheForXSecsFn(60) end) it('will return previously cached entries', function() local mockDto = {matchId=123456789} local cache = testMatch.api.cache local s1 = spy.new(function() end) local s2 = stub(cache, 'get', function() return mockDto end) testMatch:getById(mockDto.matchId, {callback=s1}) assert.spy(s1).called(1) assert.spy(s1).called_with(mockDto) s2:revert() end) it('supports timeline data', function() local s1 = stub(testMatch.api, 'get',function() end) testMatch:getById(123456789, {includeTimeline=true}) assert.stub(s1).called(1) local url = { path='/api/lol/${region}/v${version}/match/${matchId}', params={version=testMatch.version,matchId=123456789}, query={includeTimeline=true} } assert.stub(s1).called_with(testMatch.api, lmatch.same(url),lmatch.is_function()) s1:revert() end) it('goes to the network to retrieve timeline data if it was not previously requested', function() local mockDto = {matchId=123456789} local cache = testMatch.api.cache local api = testMatch.api local s1 = stub(cache, 'get', function() return mockDto end) local s2 = stub(api, 'get', function() end) testMatch:getById(mockDto.matchId, {callback=function() end,includeTimeline=true}) assert.stub(s2).called(1) s1:revert() s2:revert() end) end) end) end)
mit
greasydeal/darkstar
scripts/zones/Windurst_Woods/npcs/HomePoint#1.lua
12
1262
----------------------------------- -- Area: Windurst Woods -- NPC: HomePoint#1 -- @pos -98.588 0.001 -183.416 241 ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Windurst_Woods/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fc, 25); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x21fc) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/East_Sarutabaruta/npcs/Signpost.lua
38
2029
----------------------------------- -- Area: East Sarutabaruta -- NPC: Signpost ----------------------------------- package.loaded["scripts/zones/East_Sarutabaruta/TextIDs"] = nil; ----------------------------------- require("scripts/zones/East_Sarutabaruta/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local X = player:getXPos(); local Z = player:getZPos(); if ((X > 83.9 and X < 96.7) and (Z < -339.8 and Z > -352.6)) then player:messageSpecial(SIGNPOST_OFFSET); elseif ((X > 191.5 and X < 204.3) and (Z < -265.03 and Z > -277.13)) then player:messageSpecial(SIGNPOST_OFFSET+1); elseif ((X > 212.9 and X < 225) and (Z < -24.8 and Z > -37.7)) then player:messageSpecial(SIGNPOST_OFFSET+2); elseif ((X > -0.4 and X < 12.6) and (Z < -42.9 and Z > -54.9)) then player:messageSpecial(SIGNPOST_OFFSET+3); elseif ((X > -135.3 and X < -122.3) and (Z < -55.04 and Z > -67.14)) then player:messageSpecial(SIGNPOST_OFFSET+4); elseif ((X > -80.5 and X < -67.4) and (Z < 454.8 and Z > 442.7)) then player:messageSpecial(SIGNPOST_OFFSET+5); elseif ((X > 144.1 and X < 157.1) and (Z < 386.7 and Z > 374.6)) then player:messageSpecial(SIGNPOST_OFFSET+6); elseif ((X > -94.9 and X < -82.9) and (Z < -279.5 and Z > -292.4)) then player:messageSpecial(SIGNPOST_OFFSET+7); elseif ((X > -55.8 and X < -43.8) and (Z < -120.5 and Z > -133.5)) then player:messageSpecial(SIGNPOST_OFFSET+8); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --print("CSID: %u",csid); --print("RESULT: %u",option); end;
gpl-3.0
A2AFMI/devams2
plugins/newgroup.lua
1
35802
--[[ -----admin @llX8Xll ---صنع مجموعه —]] -- data saved to moderation.json -- check moderation plugin do local function create_group(msg) -- superuser and admins only (because sudo are always has privilege) if is_sudo(msg) or is_realm(msg) and is_admin1(msg) then local group_creator = msg.from.print_name create_group_chat (group_creator, group_name, ok_cb, false) return 'المجموعة🕵🏾 [ '..string.gsub(group_name, '_', ' ')..' ] تم بالفعل ✔️ صنعها 👨🏿‍💻 بنجاح🌚🍷' end end local function create_realm(msg) -- superuser and admins only (because sudo are always has privilege) if is_sudo(msg) or is_realm(msg) and is_admin1(msg) then local group_creator = msg.from.print_name create_group_chat (group_creator, group_name, ok_cb, false) return 'Realm [ '..string.gsub(group_name, '_', ' ')..' ] has been created.' end end local function killchat(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.peer_id local chatname = result.print_name for k,v in pairs(result.members) do kick_user_any(v.peer_id, result.peer_id) end end local function killrealm(cb_extra, success, result) local receiver = cb_extra.receiver local chat_id = "chat#id"..result.peer_id local chatname = result.print_name for k,v in pairs(result.members) do kick_user_any(v.peer_id, result.peer_id) end end local function get_group_type(msg) local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then if not data[tostring(msg.to.id)]['group_type'] then if msg.to.type == 'chat' and not is_realm(msg) then data[tostring(msg.to.id)]['group_type'] = 'Group' save_data(_config.moderation.data, data) elseif msg.to.type == 'channel' then data[tostring(msg.to.id)]['group_type'] = 'SuperGroup' save_data(_config.moderation.data, data) end end local group_type = data[tostring(msg.to.id)]['group_type'] return group_type else return 'Chat type not found.' end end local function callbackres(extra, success, result) --vardump(result) local user = result.peer_id local name = string.gsub(result.print_name, "_", " ") local chat = 'chat#id'..extra.chatid local channel = 'channel#id'..extra.chatid send_large_msg(chat, user..'\n'..name) send_large_msg(channel, user..'\n'..name) return user end local function set_description(msg, data, target, about) if not is_admin1(msg) then return "For admins 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 set_rules(msg, data, target) if not is_admin1(msg) then return "For admins 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 -- lock/unlock group name. bot automatically change group name when locked local function lock_group_name(msg, data, target) if not is_admin1(msg) then return "For admins 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_name(msg, data, target) if not is_admin1(msg) then return "For admins 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 --lock/unlock group member. bot automatically kick new added user when locked local function lock_group_member(msg, data, target) if not is_admin1(msg) then return "For admins 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_member(msg, data, target) if not is_admin1(msg) then return "For admins 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 --lock/unlock group photo. bot automatically keep group photo when locked local function lock_group_photo(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_photo_lock = data[tostring(target)]['settings']['lock_photo'] if group_photo_lock == 'yes' then return 'Group photo is already locked' else data[tostring(target)]['settings']['set_photo'] = 'waiting' save_data(_config.moderation.data, data) end return 'Please send me the group photo now' end local function unlock_group_photo(msg, data, target) if not is_admin1(msg) then return "For admins 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 lock_group_flood(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_flood(msg, data, target) if not is_admin1(msg) then return "For admins only!" 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_arabic(msg, data, target) if not is_admin1(msg) then return "For admins 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_admin1(msg) then return "For admins only!" end local group_arabic_lock = data[tostring(target)]['settings']['lock_arabic'] if group_arabic_lock == 'no' then return 'Arabic/Persian is already unlocked' else data[tostring(target)]['settings']['lock_arabic'] = 'no' save_data(_config.moderation.data, data) return 'Arabic/Persian has been unlocked' end end local function lock_group_rtl(msg, data, target) if not is_momod(msg) then return end local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl'] if group_rtl_lock == 'yes' then return 'RTL char. in names is already locked' else data[tostring(target)]['settings']['lock_rtl'] = 'yes' save_data(_config.moderation.data, data) return 'RTL char. in names has been locked' end end local function unlock_group_rtl(msg, data, target) if not is_momod(msg) then return end local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl'] if group_rtl_lock == 'no' then return 'RTL char. in names is already unlocked' else data[tostring(target)]['settings']['lock_rtl'] = 'no' save_data(_config.moderation.data, data) return 'RTL char. in names has been unlocked' end end local function lock_group_links(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_link_lock = data[tostring(target)]['settings']['lock_link'] if group_link_lock == 'yes' then return 'Link posting is already locked' else data[tostring(target)]['settings']['lock_link'] = 'yes' save_data(_config.moderation.data, data) return 'Link posting has been locked' end end local function unlock_group_links(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_link_lock = data[tostring(target)]['settings']['lock_link'] if group_link_lock == 'no' then return 'Link posting is not locked' else data[tostring(target)]['settings']['lock_link'] = 'no' save_data(_config.moderation.data, data) return 'Link posting has been unlocked' end end local function lock_group_spam(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_spam_lock = data[tostring(target)]['settings']['lock_spam'] if group_spam_lock == 'yes' then return 'SuperGroup spam is already locked' else data[tostring(target)]['settings']['lock_spam'] = 'yes' save_data(_config.moderation.data, data) return 'SuperGroup spam has been locked' end end local function unlock_group_spam(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_spam_lock = data[tostring(target)]['settings']['lock_spam'] if group_spam_lock == 'no' then return 'SuperGroup spam is not locked' else data[tostring(target)]['settings']['lock_spam'] = 'no' save_data(_config.moderation.data, data) return 'SuperGroup spam has been unlocked' end end local function lock_group_rtl(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl'] if group_rtl_lock == 'yes' then return 'RTL char. in names is already locked' else data[tostring(target)]['settings']['lock_rtl'] = 'yes' save_data(_config.moderation.data, data) return 'RTL char. in names has been locked' end end local function unlock_group_rtl(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_rtl_lock = data[tostring(target)]['settings']['lock_rtl'] if group_rtl_lock == 'no' then return 'RTL char. in names is already unlocked' else data[tostring(target)]['settings']['lock_rtl'] = 'no' save_data(_config.moderation.data, data) return 'RTL char. in names has been unlocked' end end local function lock_group_sticker(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker'] if group_sticker_lock == 'yes' then return 'Sticker posting is already locked' else data[tostring(target)]['settings']['lock_sticker'] = 'yes' save_data(_config.moderation.data, data) return 'Sticker posting has been locked' end end local function unlock_group_sticker(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_sticker_lock = data[tostring(target)]['settings']['lock_sticker'] if group_sticker_lock == 'no' then return 'Sticker posting is already unlocked' else data[tostring(target)]['settings']['lock_sticker'] = 'no' save_data(_config.moderation.data, data) return 'Sticker posting has been unlocked' end end local function set_public_membermod(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_public_lock = data[tostring(target)]['settings']['public'] if group_public_lock == 'yes' then return 'Group is already public' else data[tostring(target)]['settings']['public'] = 'yes' save_data(_config.moderation.data, data) end return 'SuperGroup is now: public' end local function unset_public_membermod(msg, data, target) if not is_admin1(msg) then return "For admins only!" end local group_public_lock = data[tostring(target)]['settings']['public'] if group_public_lock == 'no' then return 'Group is not public' else data[tostring(target)]['settings']['public'] = 'no' save_data(_config.moderation.data, data) return 'SuperGroup is now: not public' end end -- show group settings local function show_group_settings(msg, data, target) local data = load_data(_config.moderation.data, data) if not is_admin1(msg) then return "For admins only!" end if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['public'] then data[tostring(target)]['settings']['public'] = 'no' end end local settings = data[tostring(target)]['settings'] local text = "Group settings for "..target..":\nLock group name : "..settings.lock_name.."\nLock group photo : "..settings.lock_photo.."\nLock group member : "..settings.lock_member.."\nPublic: "..settings.public end -- show SuperGroup settings local function show_super_group_settings(msg, data, target) local data = load_data(_config.moderation.data, data) if not is_admin1(msg) then return "For admins only!" end if data[tostring(msg.to.id)]['settings'] then if not data[tostring(msg.to.id)]['settings']['public'] then data[tostring(msg.to.id)]['settings']['public'] = 'no' end end if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['lock_rtl'] then data[tostring(target)]['settings']['lock_rtl'] = 'no' end end if data[tostring(target)]['settings'] then if not data[tostring(target)]['settings']['lock_member'] then data[tostring(target)]['settings']['lock_member'] = 'no' end end local settings = data[tostring(target)]['settings'] local text = "SuperGroup settings for "..target..":\nLock links : "..settings.lock_link.."\nLock flood: "..settings.flood.."\nLock spam: "..settings.lock_spam.."\nLock Arabic: "..settings.lock_arabic.."\nLock Member: "..settings.lock_member.."\nLock RTL: "..settings.lock_rtl.."\nLock sticker: "..settings.lock_sticker.."\nPublic: "..settings.public.."\nStrict settings: "..settings.strict return text end local function returnids(cb_extra, success, result) local i = 1 local receiver = cb_extra.receiver local chat_id = "chat#id"..result.peer_id local chatname = result.print_name local text = 'Users in '..string.gsub(chatname,"_"," ")..' (ID: '..result.peer_id..'):\n\n' for k,v in pairs(result.members) do if v.print_name then local username = "" text = text ..i..' - '.. string.gsub(v.print_name,"_"," ") .. " [" .. v.peer_id .. "] \n\n" i = i + 1 end end local file = io.open("./groups/lists/"..result.peer_id.."memberlist.txt", "w") file:write(text) file:flush() file:close() end local function cb_user_info(cb_extra, success, result) local receiver = cb_extra.receiver if result.first_name then first_name = result.first_name:gsub("_", " ") else first_name = "None" end if result.last_name then last_name = result.last_name:gsub("_", " ") else last_name = "None" end if result.username then username = "@"..result.username else username = "@[none]" end text = "User Info:\n\nID: "..result.peer_id.."\nFirst: "..first_name.."\nLast: "..last_name.."\nUsername: "..username send_large_msg(receiver, text) end local function admin_promote(msg, admin_id) if not is_sudo(msg) then return "Access denied!" end local admins = 'admins' if not data[tostring(admins)] then data[tostring(admins)] = {} save_data(_config.moderation.data, data) end if data[tostring(admins)][tostring(admin_id)] then return admin_id..' is already an admin.' end data[tostring(admins)][tostring(admin_id)] = admin_id save_data(_config.moderation.data, data) return admin_id..' has been promoted as admin.' end local function admin_demote(msg, admin_id) if not is_sudo(msg) then return "Access denied!" end local data = load_data(_config.moderation.data) local admins = 'admins' if not data[tostring(admins)] then data[tostring(admins)] = {} save_data(_config.moderation.data, data) end if not data[tostring(admins)][tostring(admin_id)] then return admin_id..' is not an admin.' end data[tostring(admins)][tostring(admin_id)] = nil save_data(_config.moderation.data, data) return admin_id..' has been demoted from admin.' end local function admin_list(msg) local data = load_data(_config.moderation.data) local admins = 'admins' if not data[tostring(admins)] then data[tostring(admins)] = {} save_data(_config.moderation.data, data) end local message = 'List of global admins:\n' for k,v in pairs(data[tostring(admins)]) do message = message .. '- (at)' .. v .. ' [' .. k .. '] ' ..'\n' end return message end local function groups_list(msg) local data = load_data(_config.moderation.data) local groups = 'groups' if not data[tostring(groups)] then return 'No groups at the moment' end local message = 'List of groups:\n' for k,v in pairs(data[tostring(groups)]) do if data[tostring(v)] then if data[tostring(v)]['settings'] then local settings = data[tostring(v)]['settings'] for m,n in pairs(settings) do if m == 'set_name' then name = n end end local group_owner = "No owner" if data[tostring(v)]['set_owner'] then group_owner = tostring(data[tostring(v)]['set_owner']) end local group_link = "No link" if data[tostring(v)]['settings']['set_link'] then group_link = data[tostring(v)]['settings']['set_link'] end message = message .. '- '.. name .. ' (' .. v .. ') ['..group_owner..'] \n {'..group_link.."}\n" end end end local file = io.open("./groups/lists/groups.txt", "w") file:write(message) file:flush() file:close() return message end local function realms_list(msg) local data = load_data(_config.moderation.data) local realms = 'realms' if not data[tostring(realms)] then return 'No Realms at the moment' end local message = 'List of Realms:\n' for k,v in pairs(data[tostring(realms)]) do local settings = data[tostring(v)]['settings'] for m,n in pairs(settings) do if m == 'set_name' then name = n end end local group_owner = "No owner" if data[tostring(v)]['admins_in'] then group_owner = tostring(data[tostring(v)]['admins_in']) end local group_link = "No link" if data[tostring(v)]['settings']['set_link'] then group_link = data[tostring(v)]['settings']['set_link'] end message = message .. '- '.. name .. ' (' .. v .. ') ['..group_owner..'] \n {'..group_link.."}\n" end local file = io.open("./groups/lists/realms.txt", "w") file:write(message) file:flush() file:close() return message end local function admin_user_promote(receiver, member_username, member_id) local data = load_data(_config.moderation.data) if not data['admins'] then data['admins'] = {} save_data(_config.moderation.data, data) end if data['admins'][tostring(member_id)] then return send_large_msg(receiver, '@'..member_username..' is already an admin.') end data['admins'][tostring(member_id)] = member_username save_data(_config.moderation.data, data) return send_large_msg(receiver, '@'..member_username..' has been promoted as admin.') end local function admin_user_demote(receiver, member_username, member_id) local data = load_data(_config.moderation.data) if not data['admins'] then data['admins'] = {} save_data(_config.moderation.data, data) end if not data['admins'][tostring(member_id)] then send_large_msg(receiver, "@"..member_username..' is not an admin.') return end data['admins'][tostring(member_id)] = nil save_data(_config.moderation.data, data) send_large_msg(receiver, 'Admin @'..member_username..' has been demoted.') end local function username_id(cb_extra, success, result) local mod_cmd = cb_extra.mod_cmd local receiver = cb_extra.receiver local member = cb_extra.member local text = 'No user @'..member..' in this group.' for k,v in pairs(result.members) do vusername = v.username if vusername == member then member_username = member member_id = v.peer_id if mod_cmd == 'addadmin' then return admin_user_promote(receiver, member_username, member_id) elseif mod_cmd == 'removeadmin' then return admin_user_demote(receiver, member_username, member_id) end end end send_large_msg(receiver, text) end local function res_user_support(cb_extra, success, result) local receiver = cb_extra.receiver local get_cmd = cb_extra.get_cmd local support_id = result.peer_id if get_cmd == 'addsupport' then support_add(support_id) send_large_msg(receiver, "User ["..support_id.."] has been added to the support team") elseif get_cmd == 'removesupport' then support_remove(support_id) send_large_msg(receiver, "User ["..support_id.."] has been removed from the support team") end end local function set_log_group(target, data) if not is_admin1(msg) then return end local log_group = data[tostring(target)]['log_group'] if log_group == 'yes' then return 'Log group is already set' else data[tostring(target)]['log_group'] = 'yes' save_data(_config.moderation.data, data) return 'Log group has been set' end end local function unset_log_group(msg) if not is_admin1(msg) then return end local log_group = data[tostring(target)]['log_group'] if log_group == 'no' then return 'Log group is not set' else data[tostring(target)]['log_group'] = 'no' save_data(_config.moderation.data, data) return 'log group has been disabled' end end local function help() local help_text = tostring(_config.help_text_realm) return help_text end function run(msg, matches) local name_log = user_print_name(msg.from) if matches[1] == 'log' and is_owner(msg) then local receiver = get_receiver(msg) savelog(msg.to.id, "log file created by owner/support/admin") send_document(receiver,"./groups/logs/"..msg.to.id.."log.txt", ok_cb, false) end if matches[1] == 'who' and msg.to.type == 'chat' and is_momod(msg) then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested member list ") local receiver = get_receiver(msg) chat_info(receiver, returnids, {receiver=receiver}) local file = io.open("./groups/lists/"..msg.to.id.."memberlist.txt", "r") text = file:read("*a") send_large_msg(receiver,text) file:close() end if matches[1] == 'wholist' and is_momod(msg) then local name = user_print_name(msg.from) savelog(msg.to.id, name.." ["..msg.from.id.."] requested member list in a file") local receiver = get_receiver(msg) chat_info(receiver, returnids, {receiver=receiver}) send_document("chat#id"..msg.to.id,"./groups/lists/"..msg.to.id.."memberlist.txt", ok_cb, false) end if matches[1] == 'whois' and is_momod(msg) then local receiver = get_receiver(msg) local user_id = "user#id"..matches[2] user_info(user_id, cb_user_info, {receiver = receiver}) end if not is_sudo(msg) then if is_realm(msg) and is_admin1(msg) then print("Admin detected") else return end end if matches[1] == 'صنع مجموعه' and matches[2] then group_name = matches[2] group_type = 'group' return create_group(msg) end --[[ Experimental if matches[1] == 'createsuper' and matches[2] then if not is_sudo(msg) or is_admin1(msg) and is_realm(msg) then return "You cant create groups!" end group_name = matches[2] group_type = 'super_group' return create_group(msg) end]] if matches[1] == 'createrealm' and matches[2] then if not is_sudo(msg) then return "Sudo users only !" end group_name = matches[2] group_type = 'realm' return create_realm(msg) end local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) if matches[1] == 'setabout' and matches[2] == 'group' and is_realm(msg) then local target = matches[3] local about = matches[4] return set_description(msg, data, target, about) end if matches[1] == 'setabout' and matches[2] == 'sgroup'and is_realm(msg) then local channel = 'channel#id'..matches[3] local about_text = matches[4] local data_cat = 'description' local target = matches[3] channel_set_about(channel, about_text, ok_cb, false) data[tostring(target)][data_cat] = about_text save_data(_config.moderation.data, data) return "Description has been set for ["..matches[2]..']' end if matches[1] == 'setrules' then rules = matches[3] local target = matches[2] return set_rules(msg, data, target) end if matches[1] == 'lock' then local target = matches[2] if matches[3] == 'name' then return lock_group_name(msg, data, target) end if matches[3] == 'member' then return lock_group_member(msg, data, target) end if matches[3] == 'photo' then return lock_group_photo(msg, data, target) end if matches[3] == 'flood' then return lock_group_flood(msg, data, target) end if matches[2] == 'arabic' then return lock_group_arabic(msg, data, target) end if matches[3] == 'links' then return lock_group_links(msg, data, target) end if matches[3] == 'spam' then return lock_group_spam(msg, data, target) end if matches[3] == 'rtl' then return unlock_group_rtl(msg, data, target) end if matches[3] == 'sticker' then return lock_group_sticker(msg, data, target) end end if matches[1] == 'unlock' then local target = matches[2] if matches[3] == 'name' then return unlock_group_name(msg, data, target) end if matches[3] == 'member' then return unlock_group_member(msg, data, target) end if matches[3] == 'photo' then return unlock_group_photo(msg, data, target) end if matches[3] == 'flood' then return unlock_group_flood(msg, data, target) end if matches[3] == 'arabic' then return unlock_group_arabic(msg, data, target) end if matches[3] == 'links' then return unlock_group_links(msg, data, target) end if matches[3] == 'spam' then return unlock_group_spam(msg, data, target) end if matches[3] == 'rtl' then return unlock_group_rtl(msg, data, target) end if matches[3] == 'sticker' then return unlock_group_sticker(msg, data, target) end end if matches[1] == 'settings' and matches[2] == 'group' and data[tostring(matches[3])]['settings'] then local target = matches[3] text = show_group_settingsmod(msg, target) return text.."\nID: "..target.."\n" end if matches[1] == 'settings' and matches[2] == 'sgroup' and data[tostring(matches[3])]['settings'] then local target = matches[3] text = show_supergroup_settingsmod(msg, target) return text.."\nID: "..target.."\n" end if matches[1] == 'setname' and is_realm(msg) then local settings = data[tostring(matches[2])]['settings'] 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, "Realm { "..msg.to.print_name.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]") end if matches[1] == 'setgpname' and is_admin1(msg) then local new_name = string.gsub(matches[3], '_', ' ') data[tostring(matches[2])]['settings']['set_name'] = new_name save_data(_config.moderation.data, data) local group_name_set = data[tostring(matches[2])]['settings']['set_name'] local chat_to_rename = 'chat#id'..matches[2] local channel_to_rename = 'channel#id'..matches[2] rename_chat(to_rename, group_name_set, ok_cb, false) rename_channel(channel_to_rename, group_name_set, ok_cb, false) savelog(matches[3], "Group { "..group_name_set.." } name changed to [ "..new_name.." ] by "..name_log.." ["..msg.from.id.."]") end if matches[1] == 'help' and is_realm(msg) then savelog(msg.to.id, name_log.." ["..msg.from.id.."] Used /help") return help() end --[[if matches[1] == 'set' then if matches[2] == 'loggroup' and is_sudo(msg) then local target = msg.to.peer_id savelog(msg.to.peer_id, name_log.." ["..msg.from.id.."] set as log group") return set_log_group(target, data) end end if matches[1] == 'rem' then if matches[2] == 'loggroup' and is_sudo(msg) then local target = msg.to.id savelog(msg.to.id, name_log.." ["..msg.from.id.."] set as log group") return unset_log_group(target, data) end end]] if matches[1] == 'kill' and matches[2] == 'chat' and matches[3] then if not is_admin1(msg) then return end if is_realm(msg) then local receiver = 'chat#id'..matches[3] return modrem(msg), print("Closing Group: "..receiver), chat_info(receiver, killchat, {receiver=receiver}) else return 'Error: Group '..matches[3]..' not found' end end if matches[1] == 'kill' and matches[2] == 'realm' and matches[3] then if not is_admin1(msg) then return end if is_realm(msg) then local receiver = 'chat#id'..matches[3] return realmrem(msg), print("Closing realm: "..receiver), chat_info(receiver, killrealm, {receiver=receiver}) else return 'Error: Realm '..matches[3]..' not found' end end if matches[1] == 'rem' and matches[2] then -- Group configuration removal data[tostring(matches[2])] = 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(matches[2])] = nil save_data(_config.moderation.data, data) send_large_msg(receiver, 'Chat '..matches[2]..' removed') end if matches[1] == 'chat_add_user' then if not msg.service then return end local user = 'user#id'..msg.action.user.id local chat = 'chat#id'..msg.to.id if not is_admin1(msg) and is_realm(msg) then chat_del_user(chat, user, ok_cb, true) end end if matches[1] == 'addadmin' then if not is_sudo(msg) then-- Sudo only return end if string.match(matches[2], '^%d+$') then local admin_id = matches[2] print("user "..admin_id.." has been promoted as admin") return admin_promote(msg, admin_id) else local member = string.gsub(matches[2], "@", "") local mod_cmd = "addadmin" chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member}) end end if matches[1] == 'removeadmin' then if not is_sudo(msg) then-- Sudo only return end if string.match(matches[2], '^%d+$') then local admin_id = matches[2] print("user "..admin_id.." has been demoted") return admin_demote(msg, admin_id) else local member = string.gsub(matches[2], "@", "") local mod_cmd = "removeadmin" chat_info(receiver, username_id, {mod_cmd= mod_cmd, receiver=receiver, member=member}) end end if matches[1] == 'support' and matches[2] then if string.match(matches[2], '^%d+$') then local support_id = matches[2] print("User "..support_id.." has been added to the support team") support_add(support_id) return "User ["..support_id.."] has been added to the support team" else local member = string.gsub(matches[2], "@", "") local receiver = get_receiver(msg) local get_cmd = "addsupport" resolve_username(member, res_user_support, {get_cmd = get_cmd, receiver = receiver}) end end if matches[1] == '-support' then if string.match(matches[2], '^%d+$') then local support_id = matches[2] print("User "..support_id.." has been removed from the support team") support_remove(support_id) return "User ["..support_id.."] has been removed from the support team" else local member = string.gsub(matches[2], "@", "") local receiver = get_receiver(msg) local get_cmd = "removesupport" resolve_username(member, res_user_support, {get_cmd = get_cmd, receiver = receiver}) end end if matches[1] == 'type'then local group_type = get_group_type(msg) return group_type end if matches[1] == 'list' then if matches[2] == 'admins' then return admin_list(msg) end -- if matches[2] == 'support' and not matches[2] then -- return support_list() -- end end if matches[1] == 'list' and matches[2] == 'groups' then if msg.to.type == 'chat' or msg.to.type == 'channel' then groups_list(msg) send_document("chat#id"..msg.to.id, "./groups/lists/groups.txt", ok_cb, false) send_document("channel#id"..msg.to.id, "./groups/lists/groups.txt", ok_cb, false) return "Group list created" --group_list(msg) elseif msg.to.type == 'user' then groups_list(msg) send_document("user#id"..msg.from.id, "./groups/lists/groups.txt", ok_cb, false) return "Group list created" --group_list(msg) end end if matches[1] == 'list' and matches[2] == 'realms' then if msg.to.type == 'chat' or msg.to.type == 'channel' then realms_list(msg) send_document("chat#id"..msg.to.id, "./groups/lists/realms.txt", ok_cb, false) send_document("channel#id"..msg.to.id, "./groups/lists/realms.txt", ok_cb, false) return "Realms list created" --realms_list(msg) elseif msg.to.type == 'user' then realms_list(msg) send_document("user#id"..msg.from.id, "./groups/lists/realms.txt", ok_cb, false) return "Realms list created" --realms_list(msg) end 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 resolve_username(username, callbackres, cbres_extra) end end return { patterns = { "^(صنع مجموعه) (.*)$", "^!!tgservice (.+)$", }, run = run } end
gpl-2.0
u20024804/skynet
lualib/http/httpd.lua
101
3708
local internal = require "http.internal" local table = table local string = string local type = type local httpd = {} local http_status_msg = { [100] = "Continue", [101] = "Switching Protocols", [200] = "OK", [201] = "Created", [202] = "Accepted", [203] = "Non-Authoritative Information", [204] = "No Content", [205] = "Reset Content", [206] = "Partial Content", [300] = "Multiple Choices", [301] = "Moved Permanently", [302] = "Found", [303] = "See Other", [304] = "Not Modified", [305] = "Use Proxy", [307] = "Temporary Redirect", [400] = "Bad Request", [401] = "Unauthorized", [402] = "Payment Required", [403] = "Forbidden", [404] = "Not Found", [405] = "Method Not Allowed", [406] = "Not Acceptable", [407] = "Proxy Authentication Required", [408] = "Request Time-out", [409] = "Conflict", [410] = "Gone", [411] = "Length Required", [412] = "Precondition Failed", [413] = "Request Entity Too Large", [414] = "Request-URI Too Large", [415] = "Unsupported Media Type", [416] = "Requested range not satisfiable", [417] = "Expectation Failed", [500] = "Internal Server Error", [501] = "Not Implemented", [502] = "Bad Gateway", [503] = "Service Unavailable", [504] = "Gateway Time-out", [505] = "HTTP Version not supported", } local function readall(readbytes, bodylimit) local tmpline = {} local body = internal.recvheader(readbytes, tmpline, "") if not body then return 413 -- Request Entity Too Large end local request = assert(tmpline[1]) local method, url, httpver = request:match "^(%a+)%s+(.-)%s+HTTP/([%d%.]+)$" assert(method and url and httpver) httpver = assert(tonumber(httpver)) if httpver < 1.0 or httpver > 1.1 then return 505 -- HTTP Version not supported end local header = internal.parseheader(tmpline,2,{}) if not header then return 400 -- Bad request end local length = header["content-length"] if length then length = tonumber(length) end local mode = header["transfer-encoding"] if mode then if mode ~= "identity" and mode ~= "chunked" then return 501 -- Not Implemented end end if mode == "chunked" then body, header = internal.recvchunkedbody(readbytes, bodylimit, header, body) if not body then return 413 end else -- identity mode if length then if bodylimit and length > bodylimit then return 413 end if #body >= length then body = body:sub(1,length) else local padding = readbytes(length - #body) body = body .. padding end end end return 200, url, method, header, body end function httpd.read_request(...) local ok, code, url, method, header, body = pcall(readall, ...) if ok then return code, url, method, header, body else return nil, code end end local function writeall(writefunc, statuscode, bodyfunc, header) local statusline = string.format("HTTP/1.1 %03d %s\r\n", statuscode, http_status_msg[statuscode] or "") writefunc(statusline) if header then for k,v in pairs(header) do if type(v) == "table" then for _,v in ipairs(v) do writefunc(string.format("%s: %s\r\n", k,v)) end else writefunc(string.format("%s: %s\r\n", k,v)) end end end local t = type(bodyfunc) if t == "string" then writefunc(string.format("content-length: %d\r\n\r\n", #bodyfunc)) writefunc(bodyfunc) elseif t == "function" then writefunc("transfer-encoding: chunked\r\n") while true do local s = bodyfunc() if s then if s ~= "" then writefunc(string.format("\r\n%x\r\n", #s)) writefunc(s) end else writefunc("\r\n0\r\n\r\n") break end end else assert(t == "nil") writefunc("\r\n") end end function httpd.write_response(...) return pcall(writeall, ...) end return httpd
mit
ld-test/alnbox
spec/runAlnbox_spec.lua
1
14925
-- alnbox, alignment viewer based on the curses library -- Copyright (C) 2015 Boris Nagaev -- See the LICENSE file for terms of use local function sleep() local duration = os.getenv('TEST_SLEEP') or 5 os.execute('sleep ' .. duration) end local function startCode(rt, code) if type(code) == 'function' then code = string.dump(code) end local fname = os.tmpname() local f = io.open(fname, 'w') f:write(code) f:close() local lluacov = os.getenv('LOAD_LUACOV') or '' local cmd = 'lua %s %s; rm %s' cmd = cmd:format(lluacov, fname, fname) rt:forkPty(cmd) end describe("alnbox.runAlnbox", function() it("draws simple alignment", function() local rote = require 'rote' local rt = rote.RoteTerm(24, 80) startCode(rt, function() local runAlnbox = require 'alnbox.runAlnbox' runAlnbox {rows = 1, cols = 1, getCell = function() return 'X' end} end) sleep() rt:update() assert.truthy(rt:termText():match('X')) rt:write('q') end) it("draws simple alignment with #right header", function() local rote = require 'rote' local rt = rote.RoteTerm(24, 80) startCode(rt, function() local runAlnbox = require 'alnbox.runAlnbox' runAlnbox {rows = 1, cols = 1, getCell = function() return 'X' end, right_headers = 1, getRightHeader = function() return '|' end, } end) sleep() rt:update() assert.truthy(rt:termText():match('X|')) rt:write('q') end) it("draws simple alignment with decoration", function() local rote = require 'rote' local rt = rote.RoteTerm(24, 80) startCode(rt, function() local runAlnbox = require 'alnbox.runAlnbox' runAlnbox {rows = 1, cols = 1, getCell = function() return { character='X', underline=true, bold=true, blink=true, } end} end) sleep() rt:update() assert.truthy(rt:termText():match('X')) local attr = rt:cellAttr(0, 0) local fg, bg, bold, blink = rote.fromAttr(attr) assert.truthy(bold) assert.truthy(blink) -- TODO rote can't test underline rt:write('q') end) it("draws 1x1 alignment with all headers and #corners", function() local rote = require 'rote' local rt = rote.RoteTerm(24, 80) startCode(rt, function() local runAlnbox = require 'alnbox.runAlnbox' runAlnbox {rows = 1, cols = 1, getCell = function() return 'X' end, left_headers = 1, getLeftHeader = function() return '<' end, right_headers = 1, getRightHeader = function() return '>' end, top_headers = 1, getTopHeader = function() return '^' end, bottom_headers = 1, getBottomHeader = function() return 'v' end, getTopLeft = function() return '/' end, getTopRight = function() return '`' end, getBottomRight = function() return '/' end, getBottomLeft = function() return '`' end, } end) sleep() rt:update() assert.equal('/^`', rt:rowText(0):sub(1, 3)) assert.equal('<X>', rt:rowText(1):sub(1, 3)) assert.equal('`v/', rt:rowText(2):sub(1, 3)) rt:write('q') end) it("moves with arrow buttons", function() local rote = require 'rote' local cursesConsts = require 'rote.cursesConsts' local rt = rote.RoteTerm(5, 5) startCode(rt, function() local runAlnbox = require 'alnbox.runAlnbox' runAlnbox {rows = 6, cols = 6, getCell = function(row, col) return (row + 3 * col) % 4 end} end) sleep() rt:update() assert.truthy(rt:rowText(0):match('03210')) assert.truthy(rt:rowText(1):match('10321')) assert.truthy(rt:rowText(2):match('21032')) assert.truthy(rt:rowText(3):match('32103')) assert.truthy(rt:rowText(4):match('03210')) -- move down rt:keyPress(cursesConsts.KEY_DOWN) sleep() rt:update() assert.truthy(rt:rowText(0):match('10321')) assert.truthy(rt:rowText(1):match('21032')) assert.truthy(rt:rowText(2):match('32103')) assert.truthy(rt:rowText(3):match('03210')) assert.truthy(rt:rowText(4):match('10321')) -- move down again (does nothing) rt:keyPress(cursesConsts.KEY_DOWN) sleep() rt:update() assert.truthy(rt:rowText(0):match('10321')) assert.truthy(rt:rowText(1):match('21032')) assert.truthy(rt:rowText(2):match('32103')) assert.truthy(rt:rowText(3):match('03210')) assert.truthy(rt:rowText(4):match('10321')) -- move right rt:keyPress(cursesConsts.KEY_RIGHT) sleep() rt:update() assert.truthy(rt:rowText(0):match('03210')) assert.truthy(rt:rowText(1):match('10321')) assert.truthy(rt:rowText(2):match('21032')) assert.truthy(rt:rowText(3):match('32103')) assert.truthy(rt:rowText(4):match('03210')) -- move right again (does nothing) rt:keyPress(cursesConsts.KEY_RIGHT) sleep() rt:update() assert.truthy(rt:rowText(0):match('03210')) assert.truthy(rt:rowText(1):match('10321')) assert.truthy(rt:rowText(2):match('21032')) assert.truthy(rt:rowText(3):match('32103')) assert.truthy(rt:rowText(4):match('03210')) -- move down again (does nothing) rt:keyPress(cursesConsts.KEY_DOWN) sleep() rt:update() assert.truthy(rt:rowText(0):match('03210')) assert.truthy(rt:rowText(1):match('10321')) assert.truthy(rt:rowText(2):match('21032')) assert.truthy(rt:rowText(3):match('32103')) assert.truthy(rt:rowText(4):match('03210')) -- move up rt:keyPress(cursesConsts.KEY_UP) sleep() rt:update() assert.truthy(rt:rowText(0):match('32103')) assert.truthy(rt:rowText(1):match('03210')) assert.truthy(rt:rowText(2):match('10321')) assert.truthy(rt:rowText(3):match('21032')) assert.truthy(rt:rowText(4):match('32103')) -- move up again (does nothing) rt:keyPress(cursesConsts.KEY_UP) sleep() rt:update() assert.truthy(rt:rowText(0):match('32103')) assert.truthy(rt:rowText(1):match('03210')) assert.truthy(rt:rowText(2):match('10321')) assert.truthy(rt:rowText(3):match('21032')) assert.truthy(rt:rowText(4):match('32103')) -- move left (back to original position) rt:keyPress(cursesConsts.KEY_LEFT) sleep() rt:update() assert.truthy(rt:rowText(0):match('03210')) assert.truthy(rt:rowText(1):match('10321')) assert.truthy(rt:rowText(2):match('21032')) assert.truthy(rt:rowText(3):match('32103')) assert.truthy(rt:rowText(4):match('03210')) -- move left again (does nothing) rt:keyPress(cursesConsts.KEY_LEFT) sleep() rt:update() assert.truthy(rt:rowText(0):match('03210')) assert.truthy(rt:rowText(1):match('10321')) assert.truthy(rt:rowText(2):match('21032')) assert.truthy(rt:rowText(3):match('32103')) assert.truthy(rt:rowText(4):match('03210')) -- quit rt:write('q') end) it("prints #headers", function() local rote = require 'rote' local cursesConsts = require 'rote.cursesConsts' local rt = rote.RoteTerm(6, 20) startCode(rt, function() local runAlnbox = require 'alnbox.runAlnbox' local navigate = require 'alnbox.navigate' runAlnbox {rows = 6, cols = 50, getCell = function(row, col) return (row + 3 * col) % 4 end, top_headers = 2, getTopHeader = function(row, col) if row == 0 then return string.byte('A') + col else return col % 2 end end, left_headers = 1, getLeftHeader = function(row, col) return {character = '*', foreground = row + 1, background = row, } end, right_headers = 2, getRightHeader = function(row, col) if col == 0 then return string.byte('a') + row else return {character = '|', background = row + 1, foreground = row, } end end, bottom_headers = 1, getBottomHeader = function(row, col) return '-' end, -- custom binding: -- key "1" results in moving to (1, 1) navigate = function(aw, refresh, getch, _, curses) return navigate(aw, refresh, getch, {[string.byte('1')] = function() aw:moveTo(1, 1) end}, curses) end, } end) sleep() rt:update() assert.truthy(rt:rowText(0):match( 'ABCDEFGHIJKLMNOPQ')) assert.truthy(rt:rowText(1):match( '01010101010101010')) assert.truthy(rt:rowText(2):match('*03210321032103210a|')) assert.truthy(rt:rowText(3):match('*10321032103210321b|')) assert.truthy(rt:rowText(4):match('*21032103210321032c|')) assert.truthy(rt:rowText(5):match( '-----------------')) local attr = rt:cellAttr(2, 0) local fg, bg, bold, blink = rote.fromAttr(attr) assert.equal(0, bg) assert.equal(1, fg) -- move down rt:keyPress(cursesConsts.KEY_DOWN) sleep() rt:update() assert.truthy(rt:rowText(0):match( 'ABCDEFGHIJKLMNOPQ')) assert.truthy(rt:rowText(1):match( '01010101010101010')) assert.truthy(rt:rowText(2):match('*10321032103210321b|')) assert.truthy(rt:rowText(3):match('*21032103210321032c|')) assert.truthy(rt:rowText(4):match('*32103210321032103d|')) assert.truthy(rt:rowText(5):match( '-----------------')) local attr = rt:cellAttr(2, 0) local fg, bg, bold, blink = rote.fromAttr(attr) assert.equal(1, bg) assert.equal(2, fg) -- move right rt:keyPress(cursesConsts.KEY_RIGHT) sleep() rt:update() assert.truthy(rt:rowText(0):match( 'BCDEFGHIJKLMNOPQR')) assert.truthy(rt:rowText(1):match( '10101010101010101')) assert.truthy(rt:rowText(2):match('*03210321032103210b|')) assert.truthy(rt:rowText(3):match('*10321032103210321c|')) assert.truthy(rt:rowText(4):match('*21032103210321032d|')) assert.truthy(rt:rowText(5):match( '-----------------')) local attr = rt:cellAttr(2, 0) local fg, bg, bold, blink = rote.fromAttr(attr) assert.equal(1, bg) assert.equal(2, fg) -- move right again rt:keyPress(cursesConsts.KEY_RIGHT) sleep() rt:update() assert.truthy(rt:rowText(0):match( 'CDEFGHIJKLMNOPQRS')) assert.truthy(rt:rowText(1):match( '01010101010101010')) assert.truthy(rt:rowText(2):match('*32103210321032103b|')) assert.truthy(rt:rowText(3):match('*03210321032103210c|')) assert.truthy(rt:rowText(4):match('*10321032103210321d|')) assert.truthy(rt:rowText(5):match( '-----------------')) local attr = rt:cellAttr(2, 0) local fg, bg, bold, blink = rote.fromAttr(attr) assert.equal(1, bg) assert.equal(2, fg) -- move to top left corner (original) rt:keyPress(cursesConsts.KEY_HOME) rt:keyPress(cursesConsts.KEY_PPAGE) sleep() rt:update() assert.truthy(rt:rowText(0):match( 'ABCDEFGHIJKLMNOPQ')) assert.truthy(rt:rowText(1):match( '01010101010101010')) assert.truthy(rt:rowText(2):match('*03210321032103210a|')) assert.truthy(rt:rowText(3):match('*10321032103210321b|')) assert.truthy(rt:rowText(4):match('*21032103210321032c|')) assert.truthy(rt:rowText(5):match( '-----------------')) local attr = rt:cellAttr(2, 0) local fg, bg, bold, blink = rote.fromAttr(attr) assert.equal(0, bg) assert.equal(1, fg) -- move to bottom right corner (opposite) rt:keyPress(cursesConsts.KEY_END) rt:keyPress(cursesConsts.KEY_NPAGE) sleep() rt:update() assert.truthy(rt:rowText(0):match( 'bcdefghijklmnopqr')) assert.truthy(rt:rowText(1):match( '10101010101010101')) assert.truthy(rt:rowText(2):match('*21032103210321032d|')) assert.truthy(rt:rowText(3):match('*32103210321032103e|')) assert.truthy(rt:rowText(4):match('*03210321032103210f|')) assert.truthy(rt:rowText(5):match( '-----------------')) local attr = rt:cellAttr(2, 0) local fg, bg, bold, blink = rote.fromAttr(attr) assert.equal(3, bg) assert.equal(4, fg) -- move to position (1, 1) rt:write('1') sleep() rt:update() assert.truthy(rt:rowText(0):match( 'BCDEFGHIJKLMNOPQR')) assert.truthy(rt:rowText(1):match( '10101010101010101')) assert.truthy(rt:rowText(2):match('*03210321032103210b|')) assert.truthy(rt:rowText(3):match('*10321032103210321c|')) assert.truthy(rt:rowText(4):match('*21032103210321032d|')) assert.truthy(rt:rowText(5):match( '-----------------')) local attr = rt:cellAttr(2, 0) local fg, bg, bold, blink = rote.fromAttr(attr) assert.equal(1, bg) assert.equal(2, fg) -- quit rt:write('q') end) end)
mit
greasydeal/darkstar
scripts/zones/Lufaise_Meadows/mobs/Splinterspine_Grukjuk.lua
37
1181
----------------------------------- -- Area: Lufaise Meadows (24) -- Mob: Splinterspine_Grukjuk ----------------------------------- package.loaded["scripts/zones/Lufaise_Meadows/TextIDs"] = nil; ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/settings"); require("scripts/zones/Lufaise_Meadows/TextIDs"); -- require("scripts/zones/Lufaise_Meadows/MobIDs"); ----------------------------------- -- onMobInitialize ----------------------------------- function onMobInitialize(mob) end; ----------------------------------- -- onMobSpawn ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) end; ----------------------------------- -- onMobFight ----------------------------------- function onMobFight(mob,target) end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob,killer) if (killer:getQuestStatus(OTHER_AREAS,A_HARD_DAY_S_KNIGHT) == QUEST_ACCEPTED) then killer:setVar("SPLINTERSPINE_GRUKJUK",2); end end;
gpl-3.0
LegionXI/darkstar
scripts/globals/icanheararainbow.lua
14
8400
-- Functions below used in quest: I Can Hear a Rainbow require( "scripts/globals/status"); require( "scripts/globals/quests"); require( "scripts/globals/weather"); colorsAvailable = { 102, 103, 104, 105, 106, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 123, 124, 125}; -- Zone IDs -- Data below from http://wiki.ffxiclopedia.org/wiki/I_Can_Hear_a_Rainbow - Feb. 02, 2013 colorsAvailable[100] = { false, true, false, false, false, false, false}; -- West Ronfaure colorsAvailable[101] = { false, true, false, false, false, false, false}; -- East Ronfaure colorsAvailable[102] = { false, false, false, true, true, false, false}; -- La Theine Plateau colorsAvailable[103] = { true, false, true, false, false, false, false}; -- Valkurm Dunes colorsAvailable[104] = { false, false, false, false, true, false, true }; -- Jugner Forest colorsAvailable[105] = { false, false, true, false, false, true, false}; -- Batallia Downs colorsAvailable[106] = { false, true, false, false, false, false, false}; -- North Gustaberg colorsAvailable[107] = { false, true, false, false, false, false, false}; -- South Gustaberg colorsAvailable[108] = { false, false, true, false, false, false, true }; -- Konschtat Highlands colorsAvailable[109] = { false, false, false, false, true, false, true }; -- Pashhow Marshlands colorsAvailable[110] = { true, false, false, false, true, false, false}; -- Rolanberry Fields colorsAvailable[111] = { false, false, false, false, false, true, false}; -- Beaucedine Glacier colorsAvailable[112] = { false, false, false, false, false, true, false}; -- Xarcabard colorsAvailable[113] = { true, false, false, true, false, false, false}; -- Cape Teriggan colorsAvailable[114] = { true, true, true, false, false, false, false}; -- Eastern Altepa Desert colorsAvailable[115] = { false, true, false, false, false, false, false}; -- West Sarutabaruta colorsAvailable[116] = { false, true, false, false, false, false, false}; -- East Sarutabaruta colorsAvailable[117] = { false, false, true, true, false, false, false}; -- Tahrongi Canyon colorsAvailable[118] = { false, true, false, true, true, false, false}; -- Buburimu Peninsula colorsAvailable[119] = { true, false, true, false, false, false, false}; -- Meriphataud Mountains colorsAvailable[120] = { false, false, true, false, false, false, true }; -- Sauromugue Champaign colorsAvailable[121] = { false, false, false, false, true, false, true }; -- The Sanctuary of Zi'Tah colorsAvailable[123] = { true, false, false, false, true, false, false}; -- Yuhtunga Jungle colorsAvailable[124] = { true, true, false, false, true, false, false}; -- Yhoator Jungle colorsAvailable[125] = { true, false, true, false, false, false, false}; -- Western Altepa Desert -- The Event IDs to trigger the light cutscene for the following 3 zones is currently unknown. -- They are included only because they are listed at http://wiki.ffxiclopedia.org/wiki/I_Can_Hear_a_Rainbow -- colorsAvailable[128] = { false, false, false, true, false, false, false}; -- Valley of Sorrows -- colorsAvailable[136] = { false, false, false, false, false, true, false}; -- Beaucedine Glacier (S) -- colorsAvailable[205] = { true, false, false, false, false, false, false}; -- Ifrit's Cauldron ----------------------------------- -- triggerLightCutscene ----------------------------------- function triggerLightCutscene( player) local cutsceneTriggered = false; local RED = 1; local ORANGE = 2; local YELLOW = 3; local GREEN = 4; local BLUE = 5; local INDIGO = 6; local VIOLET = 7; local zone = player:getZoneID(); local weather = player:getWeather(); if (player:hasItem( 1125, 0)) then -- Player has Carbuncle's Ruby? if (player:getQuestStatus(WINDURST, I_CAN_HEAR_A_RAINBOW) == QUEST_ACCEPTED) then if (player:getMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),0) == false and (weather == WEATHER_HOT_SPELL or weather == WEATHER_HEAT_WAVE)) then if (colorsAvailable[zone][RED]) then cutsceneTriggered = true; player:setMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),"I_CAN_HEAR_A_RAINBOW",0,true); player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); end elseif (player:getMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),1) == false and (weather == WEATHER_NONE or weather == WEATHER_SUNSHINE)) then if (colorsAvailable[zone][ORANGE]) then cutsceneTriggered = true; player:setMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),"I_CAN_HEAR_A_RAINBOW",1,true); player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); end elseif (player:getMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),2) == false and (weather == WEATHER_DUST_STORM or weather == WEATHER_SAND_STORM)) then if (colorsAvailable[zone][YELLOW]) then cutsceneTriggered = true; player:setMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),"I_CAN_HEAR_A_RAINBOW",2,true); player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); end elseif (player:getMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),3) == false and (weather == WEATHER_WIND or weather == WEATHER_GALES)) then if (colorsAvailable[zone][GREEN]) then cutsceneTriggered = true; player:setMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),"I_CAN_HEAR_A_RAINBOW",3,true); player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); end elseif (player:getMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),4) == false and (weather == WEATHER_RAIN or weather == WEATHER_SQUALL)) then if (colorsAvailable[zone][BLUE]) then cutsceneTriggered = true; player:setMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),"I_CAN_HEAR_A_RAINBOW",4,true); player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); end elseif (player:getMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),5) == false and (weather == WEATHER_SNOW or weather == WEATHER_BLIZZARDS)) then if (colorsAvailable[zone][INDIGO]) then cutsceneTriggered = true; player:setMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),"I_CAN_HEAR_A_RAINBOW",5,true); player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); end elseif (player:getMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),6) == false and (weather == WEATHER_THUNDER or weather == WEATHER_THUNDERSTORMS)) then if (colorsAvailable[zone][VIOLET]) then cutsceneTriggered = true; player:setMaskBit(player:getVar("I_CAN_HEAR_A_RAINBOW"),"I_CAN_HEAR_A_RAINBOW",6,true); player:setVar( "I_CAN_HEAR_A_RAINBOW_Weather", weather); end end if (cutsceneTriggered) then fixChocoboBug(player); end end end return cutsceneTriggered; end; ----------------------------------- -- lightCutsceneUpdate ----------------------------------- function lightCutsceneUpdate( player) local weather = player:getVar( "I_CAN_HEAR_A_RAINBOW_Weather"); if (weather == WEATHER_SUNSHINE) then -- In some zones the light cutscene does not handle WEATHER_SUNSHINE properly weather = WEATHER_NONE; end if (player:getVar( "I_CAN_HEAR_A_RAINBOW") < 127) then player:updateEvent( 0, 0, weather); else player:updateEvent( 0, 0, weather, 6); end end; ----------------------------------- -- lightCutsceneFinish ----------------------------------- function lightCutsceneFinish( player) fixChocoboBug(player); player:setVar("I_CAN_HEAR_A_RAINBOW_Weather", 0); end; ----------------------------------- -- fixChocoboBug ----------------------------------- function fixChocoboBug( player) if (player:hasStatusEffect(EFFECT_CHOCOBO)) then if (player:getAnimation() == 5) then player:setAnimation( 0); elseif (player:getAnimation() == 0) then player:setAnimation( 5); end end end;
gpl-3.0
icyxp/kong
kong/cache.lua
4
3895
local kong_mlcache = require "kong.mlcache" local type = type local max = math.max local ngx_log = ngx.log local ngx_now = ngx.now local ERR = ngx.ERR local NOTICE = ngx.NOTICE local DEBUG = ngx.DEBUG local SHM_CACHE = "kong_cache" --[[ Hypothesis ---------- Item size: 1024 bytes Max memory limit: 500 MiBs LRU size must be: (500 * 2^20) / 1024 = 512000 Floored: 500.000 items should be a good default --]] local LRU_SIZE = 5e5 local _init local function log(lvl, ...) return ngx_log(lvl, "[DB cache] ", ...) end local _M = {} local mt = { __index = _M } function _M.new(opts) if _init then return error("kong.cache was already created") end -- opts validation opts = opts or {} if not opts.cluster_events then return error("opts.cluster_events is required") end if not opts.worker_events then return error("opts.worker_events is required") end if opts.propagation_delay and type(opts.propagation_delay) ~= "number" then return error("opts.propagation_delay must be a number") end if opts.ttl and type(opts.ttl) ~= "number" then return error("opts.ttl must be a number") end if opts.neg_ttl and type(opts.neg_ttl) ~= "number" then return error("opts.neg_ttl must be a number") end if opts.resty_lock_opts and type(opts.resty_lock_opts) ~= "table" then return error("opts.resty_lock_opts must be a table") end local mlcache, err = kong_mlcache.new(SHM_CACHE, opts.worker_events, { lru_size = LRU_SIZE, ttl = max(opts.ttl or 3600, 0), neg_ttl = max(opts.neg_ttl or 300, 0), resty_lock_opts = opts.resty_lock_opts, }) if not mlcache then return nil, "failed to instantiate mlcache: " .. err end local self = { propagation_delay = max(opts.propagation_delay or 0, 0), cluster_events = opts.cluster_events, mlcache = mlcache, } local ok, err = self.cluster_events:subscribe("invalidations", function(key) log(DEBUG, "received invalidate event from cluster for key: '", key, "'") self:invalidate_local(key) end) if not ok then return nil, "failed to subscribe to invalidations cluster events " .. "channel: " .. err end _init = true return setmetatable(self, mt) end function _M:get(key, opts, cb, ...) if type(key) ~= "string" then return error("key must be a string") end --log(DEBUG, "get from key: ", key) local v, err = self.mlcache:get(key, opts, cb, ...) if err then return nil, "failed to get from node cache: " .. err end return v end function _M:probe(key) if type(key) ~= "string" then return error("key must be a string") end local ttl, err, v = self.mlcache:probe(key) if err then return nil, "failed to probe from node cache: " .. err end return ttl, nil, v end function _M:invalidate_local(key) if type(key) ~= "string" then return error("key must be a string") end log(DEBUG, "invalidating (local): '", key, "'") local ok, err = self.mlcache:delete(key) if not ok then log(ERR, "failed to delete entity from node cache: ", err) end end function _M:invalidate(key) if type(key) ~= "string" then return error("key must be a string") end self:invalidate_local(key) local nbf if self.propagation_delay > 0 then nbf = ngx_now() + self.propagation_delay end log(DEBUG, "broadcasting (cluster) invalidation for key: '", key, "' ", "with nbf: '", nbf or "none", "'") local ok, err = self.cluster_events:broadcast("invalidations", key, nbf) if not ok then log(ERR, "failed to broadcast cached entity invalidation: ", err) end end function _M:purge() log(NOTICE, "purging (local) cache") local ok, err = self.mlcache:purge() if not ok then log(ERR, "failed to purge cache: ", err) end end return _M
apache-2.0
greasydeal/darkstar
scripts/zones/Windurst_Waters/npcs/Baehu-Faehu.lua
36
1615
----------------------------------- -- Area: Windurst Waters -- NPC: Baehu-Faehu -- Only sells when Windurst has control of Sarutabaruta -- Confirmed shop stock, August 2013 ----------------------------------- require("scripts/globals/shop"); require("scripts/globals/conquest"); package.loaded["scripts/zones/Windurst_Waters/TextIDs"] = nil; require("scripts/zones/Windurst_Waters/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) RegionOwner = GetRegionOwner(SARUTABARUTA); if (RegionOwner ~= WINDURST) then player:showText(npc,BAEHUFAEHU_CLOSED_DIALOG); else player:showText(npc,BAEHUFAEHU_OPEN_DIALOG); stock = { 0x115C, 22, --Rarab Tail 0x02B1, 33, --Lauan Log 0x026B, 43, --Popoto 0x1128, 29, --Saruta Orange 0x027B, 18 --Windurstian Tea Leaves } showShop(player,WINDURST,stock); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
greasydeal/darkstar
scripts/zones/West_Sarutabaruta_[S]/npcs/Sealed_Entrance_2.lua
21
2309
----------------------------------- -- Area: West Sarutabaruta [S] -- NPC: Sealed Entrance (Sealed_Entrance_2) -- @pos 263.600 -6.512 40.000 95 ----------------------------------- package.loaded["scripts/zones/West_Sarutabaruta_[S]/TextIDs"] = nil; ------------------------------------- require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/zones/West_Sarutabaruta_[S]/TextIDs"); ----------------------------------- -- onTrigger ----------------------------------- function onTrigger(player,npc) local QuestStatus = player:getQuestStatus(CRYSTAL_WAR, SNAKE_ON_THE_PLAINS); local HasPutty = player:hasKeyItem(ZONPAZIPPAS_ALLPURPOSE_PUTTY); local MaskBit1 = player:getMaskBit(player:getVar("SEALED_DOORS"),0) local MaskBit2 = player:getMaskBit(player:getVar("SEALED_DOORS"),1) local MaskBit3 = player:getMaskBit(player:getVar("SEALED_DOORS"),2) if (QuestStatus == QUEST_ACCEPTED and HasPutty) then if (MaskBit2 == false) then if (MaskBit1 == false or MaskBit3 == false) then player:setMaskBit(player:getVar("SEALED_DOORS"),"SEALED_DOORS",1,true); player:messageSpecial(DOOR_OFFSET+1,ZONPAZIPPAS_ALLPURPOSE_PUTTY); else player:setMaskBit(player:getVar("SEALED_DOORS"),"SEALED_DOORS",1,true); player:messageSpecial(DOOR_OFFSET+4,ZONPAZIPPAS_ALLPURPOSE_PUTTY); player:delKeyItem(ZONPAZIPPAS_ALLPURPOSE_PUTTY); end else player:messageSpecial(DOOR_OFFSET+2,ZONPAZIPPAS_ALLPURPOSE_PUTTY); end elseif (player:getQuestStatus(CRYSTAL_WAR,SNAKE_ON_THE_PLAINS) == QUEST_COMPLETED) then player:messageSpecial(DOOR_OFFSET+2, ZONPAZIPPAS_ALLPURPOSE_PUTTY); else player:messageSpecial(DOOR_OFFSET+3); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
ibm2431/darkstar
scripts/globals/items/red_curry_bun.lua
11
1876
----------------------------------------- -- ID: 5759 -- Item: red_curry_bun -- Food Effect: 30 Min, All Races ----------------------------------------- -- TODO: Group effects -- Health 25 -- Strength 7 -- Agility 1 -- Intelligence -2 -- Attack % 23 (cap 150) -- Ranged Atk % 23 (cap 150) -- Demon Killer 4 -- Resist Sleep +3 -- HP recovered when healing +2 -- MP recovered when healing +1 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,1800,5759) end function onEffectGain(target,effect) target:addMod(dsp.mod.HP, 25) target:addMod(dsp.mod.STR, 7) target:addMod(dsp.mod.AGI, 1) target:addMod(dsp.mod.INT, -2) target:addMod(dsp.mod.FOOD_ATTP, 23) target:addMod(dsp.mod.FOOD_ATT_CAP, 150) target:addMod(dsp.mod.FOOD_RATTP, 23) target:addMod(dsp.mod.FOOD_RATT_CAP, 150) target:addMod(dsp.mod.DEMON_KILLER, 4) target:addMod(dsp.mod.SLEEPRES, 3) target:addMod(dsp.mod.HPHEAL, 2) target:addMod(dsp.mod.MPHEAL, 1) end function onEffectLose(target, effect) target:delMod(dsp.mod.HP, 25) target:delMod(dsp.mod.STR, 7) target:delMod(dsp.mod.AGI, 1) target:delMod(dsp.mod.INT, -2) target:delMod(dsp.mod.FOOD_ATTP, 23) target:delMod(dsp.mod.FOOD_ATT_CAP, 150) target:delMod(dsp.mod.FOOD_RATTP, 23) target:delMod(dsp.mod.FOOD_RATT_CAP, 150) target:delMod(dsp.mod.DEMON_KILLER, 4) target:delMod(dsp.mod.SLEEPRES, 3) target:delMod(dsp.mod.HPHEAL, 2) target:delMod(dsp.mod.MPHEAL, 1) end
gpl-3.0
lbthomsen/openwrt-luci
applications/luci-app-nft-qos/luasrc/controller/nft-qos.lua
5
1607
-- Copyright 2018 Rosy Song <rosysong@rosinson.com> -- Licensed to the public under the Apache License 2.0. module("luci.controller.nft-qos", package.seeall) function index() if not nixio.fs.access("/etc/config/nft-qos") then return end local e e = entry({"admin", "status", "realtime", "rate"}, template("nft-qos/rate"), _("Rate"), 5) e.leaf = true e.acl_depends = { "luci-app-nft-qos" } e = entry({"admin", "status", "realtime", "rate_status"}, call("action_rate")) e.leaf = true e.acl_depends = { "luci-app-nft-qos" } e = entry({"admin", "services", "nft-qos"}, cbi("nft-qos/nft-qos"), _("QoS over Nftables"), 60) e.leaf = true e.acl_depends = { "luci-app-nft-qos" } end function _action_rate(rv, n) local c = nixio.fs.access("/proc/net/ipv6_route") and io.popen("nft list chain inet nft-qos-monitor " .. n .. " 2>/dev/null") or io.popen("nft list chain ip nft-qos-monitor " .. n .. " 2>/dev/null") if c then for l in c:lines() do local _, i, p, b = l:match( '^%s+ip ([^%s]+) ([^%s]+) counter packets (%d+) bytes (%d+)' ) if i and p and b then -- handle expression rv[#rv + 1] = { rule = { family = "inet", table = "nft-qos-monitor", chain = n, handle = 0, expr = { { match = { right = i } }, { counter = { packets = p, bytes = b } } } } } end end c:close() end end function action_rate() luci.http.prepare_content("application/json") local data = { nftables = {} } _action_rate(data.nftables, "upload") _action_rate(data.nftables, "download") luci.http.write_json(data) end
apache-2.0
ibm2431/darkstar
scripts/zones/Lower_Jeuno/npcs/Harnek.lua
9
1896
----------------------------------- -- Area: Lower Jeuno -- NPC: Harnek -- Starts and Finishes Quest: The Tenshodo Showdown (finish) -- !pos 44 0 -19 245 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/quests"); local ID = require("scripts/zones/Lower_Jeuno/IDs"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) if (player:hasKeyItem(dsp.ki.LETTER_FROM_THE_TENSHODO)) then player:startEvent(10021,0,dsp.ki.LETTER_FROM_THE_TENSHODO); -- During Quest "The Tenshodo Showdown" elseif (player:hasKeyItem(dsp.ki.SIGNED_ENVELOPE)) then player:startEvent(10022); -- Finish Quest "The Tenshodo Showdown" else player:startEvent(217); -- Standard dialog end end; -- 12 13 9 10 20 217 159 10021 10022 function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 10021) then player:setCharVar("theTenshodoShowdownCS",2); player:delKeyItem(dsp.ki.LETTER_FROM_THE_TENSHODO); player:addKeyItem(dsp.ki.TENSHODO_ENVELOPE); player:messageSpecial(ID.text.KEYITEM_OBTAINED,dsp.ki.TENSHODO_ENVELOPE); elseif (csid == 10022) then if (player:getFreeSlotsCount() == 0 or player:hasItem(16764)) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,16764); -- Marauder's Knife else player:delKeyItem(dsp.ki.SIGNED_ENVELOPE); player:addItem(16764); player:messageSpecial(ID.text.ITEM_OBTAINED, 16764); -- Marauder's Knife player:setCharVar("theTenshodoShowdownCS",0); player:addFame(WINDURST,30); player:completeQuest(WINDURST,dsp.quest.id.windurst.THE_TENSHODO_SHOWDOWN); end end end;
gpl-3.0
karthikncode/text-world-player
utils.lua
3
4305
local clock = os.clock function sleep(n) -- seconds local t0 = clock() while clock() - t0 <= n do end end function split(s, pattern) local parts = {} for i in string.gmatch(s, pattern) do table.insert(parts, i) end return parts 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 function string.trim(s) -- return (s:gsub("^%s*(.-)%s*$", "%1")) return s:match "^%W*(.-)%s*$" end function reverse_tensor(tensor) --make sure tensor is 1D local n = tensor:size(1) local tmp = torch.Tensor(n) for i=1, n do tmp[i] = tensor[n+1-i] end return tmp end -- function specific to make available_objects tensor function table_to_binary_tensor(t,N) local tensor if t then tensor = torch.zeros(N) for i,val in pairs(t) do tensor[val] = 1 end else tensor = torch.ones(N) end return tensor end function str_to_table(str) if type(str) == 'table' then return str end if not str or type(str) ~= 'string' then if type(str) == 'table' then return str end return {} end local ttr if str ~= '' then local ttx=tt loadstring('tt = {' .. str .. '}')() ttr = tt tt = ttx else ttr = {} end return ttr end -- IMP: very specific function - do not use for arbitrary tensors function tensor_to_table(tensor, state_dim, hist_len) batch_size = tensor:size(1) local NULL_INDEX = #symbols+1 -- convert 0 to NULL_INDEX (this happens when hist doesn't go back as far as hist_len in chain) for i=1, tensor:size(1) do for j=1, tensor:size(2) do if tensor[i][j] == 0 then tensor[i][j] = NULL_INDEX end end end local t2 = {} if tensor:size(1) == hist_len then -- hacky: this is testing case. They don't seem to have a consistent representation -- so this will have to do for now. -- print('testing' , tensor:size()) for j=1, tensor:size(1) do for k=1, tensor:size(2)/state_dim do t2_tmp = {} for i=(k-1)*state_dim+1, k*state_dim do t2_tmp[i%state_dim] = tensor[{{j}, {i}}]:reshape(1) end t2_tmp[state_dim] = t2_tmp[0] t2_tmp[0] = nil table.insert(t2, t2_tmp) end end else -- print('training' , tensor:size()) -- print(tensor[{{1}, {}}]) for j=1, tensor:size(2)/state_dim do t2_tmp = {} for i=(j-1)*state_dim+1,j*state_dim do t2_tmp[i%state_dim] = tensor[{{}, {i}}]:reshape(batch_size) end t2_tmp[state_dim] = t2_tmp[0] t2_tmp[0] = nil table.insert(t2, t2_tmp) end end -- for i=1, #t2 do -- for j=1, #t2[1] do -- for k=1, t2[i][j]:size(1) do -- assert(t2[i][j][k] ~= 0, "0 element at"..i..' '..j..' '..k) -- end -- end -- end return t2 end function table.copy(t) if t == nil then return nil end local nt = {} for k, v in pairs(t) do if type(v) == 'table' then nt[k] = table.copy(v) else nt[k] = v end end setmetatable(nt, table.copy(getmetatable(t))) return nt end function TableConcat(t1,t2) for i=1,#t2 do t1[#t1+1] = t2[i] end return t1 end function table.val_to_str ( v ) if "string" == type( v ) then v = string.gsub( v, "\n", "\\n" ) if string.match( string.gsub(v,"[^'\"]",""), '^"+$' ) then return "'" .. v .. "'" end return '"' .. string.gsub(v,'"', '\\"' ) .. '"' else return "table" == type( v ) and table.tostring( v ) or tostring( v ) end end function table.key_to_str ( k ) if "string" == type( k ) and string.match( k, "^[_%a][_%a%d]*$" ) then return k else return "[" .. table.val_to_str( k ) .. "]" end end function table.tostring( tbl ) local result, done = {}, {} for k, v in ipairs( tbl ) do table.insert( result, table.val_to_str( v ) ) done[ k ] = true end for k, v in pairs( tbl ) do if not done[ k ] then table.insert( result, table.key_to_str( k ) .. "=" .. table.val_to_str( v ) ) end end return "{" .. table.concat( result, "," ) .. "}" end
mit
LocutusOfBorg/ettercap
src/lua/share/core/hook_points.lua
9
6396
--- -- Provides hook point values for those setting up ettercap lua scripts. -- -- These values are defined in include/ec_hook.h, so this module will need -- to be updated if that file ever changes! -- -- Copyright (C) Ryan Linn and Mike Ryan -- -- 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. -- -- @module hook_points --- @usage local usage = [[ ... hook_point = ettercap.hook_points.tcp ... ]] local ffi = require("ettercap_ffi") local hook_points = {} --- All raw packets, prior to any dissecting. -- <br/>Defined in include/ec_hook.h as HOOK_RECEIVED hook_points.packet_received = ffi.C.HOOK_RECEIVED --- All packets, after protocol dissecting has been done. -- <br/>Defined in include/ec_hook.h as HOOK_DECODED hook_points.protocol_decoded = ffi.C.HOOK_DECODED --- Packets, just prior to being forwarded (if it has to be forwarded). -- <br/>Defined in include/ec_hook.h as HOOK_PRE_FORWARD hook_points.pre_forward = ffi.C.HOOK_PRE_FORWARD --- Packets at the top of the stack, but before the decision of PO_INGORE. -- <br/>Defined in include/ec_hook.h as HOOK_HANDLED hook_points.handled = ffi.C.HOOK_HANDLED --- All packets at the content filtering point. -- <br/>Defined in include/ec_hook.h as HOOK_FILTER hook_points.filter = ffi.C.HOOK_FILTER --- Packets in the TOP HALF (the packet is a copy). -- <br/>Defined in include/ec_hook.h as HOOK_DISPATCHER hook_points.dispatcher = ffi.C.HOOK_DISPATCHER --- Any ethernet packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ETH hook_points.eth = ffi.C.HOOK_PACKET_ETH --- Any FDDI packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_FDDI hook_points.fddi = ffi.C.HOOK_PACKET_FDDI --- Any token ring packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_TR hook_points.token_ring = ffi.C.HOOK_PACKET_TR --- Any wifi packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_WIFI hook_points.wifi = ffi.C.HOOK_PACKET_WIFI --- Any ARP packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ARP hook_points.arp = ffi.C.HOOK_PACKET_ARP --- ARP requests. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ARP_RQ hook_points.arp_request = ffi.C.HOOK_PACKET_ARP_RQ --- ARP replies. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ARP_RP hook_points.arp_reply = ffi.C.HOOK_PACKET_ARP_RP --- Any IP packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_IP hook_points.ip = ffi.C.HOOK_PACKET_IP --- Any IPv6 packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_IP6 hook_points.ipv6 = ffi.C.HOOK_PACKET_IP6 --- Any VLAN packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_VLAN hook_points.vlan = ffi.C.HOOK_PACKET_VLAN --- Any UDP packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_UDP hook_points.udp = ffi.C.HOOK_PACKET_UDP --- Any TCP packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_TCP hook_points.tcp = ffi.C.HOOK_PACKET_TCP --- Any ICMP packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ICMP hook_points.icmp = ffi.C.HOOK_PACKET_ICMP --- Any GRE packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_GRE hook_points.gre = ffi.C.HOOK_PACKET_GRE --- Any ICMP6 packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ICMP6 hook_points.icmp6 = ffi.C.HOOK_PACKET_ICMP6 --- ICMP6 Neighbor Discovery packets. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ICMP6_NSOL hook_points.icmp6_nsol = ffi.C.HOOK_PACKET_ICMP6_NSOL --- ICMP6 Nieghbor Advertisement packets. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ICMP6_NADV hook_points.icmp6_nadv = ffi.C.HOOK_PACKET_ICMP6_NADV --- PPP link control protocol packets. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_LCP hook_points.lcp = ffi.C.HOOK_PACKET_LCP --- PPP encryption control protocol packets. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_ECP hook_points.ecp = ffi.C.HOOK_PACKET_ECP --- PPP IP control protocol packets. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_IPCP hook_points.ipcp = ffi.C.HOOK_PACKET_IPCP --- Any PPP packet. -- <br/>Defined in include/ec_hook.h as HOOK_PACKET_PPP hook_points.ppp = ffi.C.HOOK_PACKET_PPP --- Any ESP packet. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_ESP hook_points.esp = ffi.C.HOOK_PACKET_ESP --- Any SMB packet. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_SMB hook_points.smb = ffi.C.HOOK_PROTO_SMB --- SMB challenge packets. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_SMB_CHL hook_points.smb_challenge = ffi.C.HOOK_PROTO_SMB_CHL --- SMB negotiation complete. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_SMB_CMPLT hook_points.smb_complete = ffi.C.HOOK_PROTO_SMB_CMPLT --- DHCP request packets. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_DHCP_REQUEST hook_points.dhcp_request = ffi.C.HOOK_PROTO_DHCP_REQUEST --- DHCP discovery packets. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_DHCP_DISCOVER hook_points.dhcp_discover = ffi.C.HOOK_PROTO_DHCP_DISCOVER --- Any DNS packet. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_DNS hook_points.dns = ffi.C.HOOK_PROTO_DNS --- Any NBNS packet. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_NBNS hook_points.nbns = ffi.C.HOOK_PROTO_NBNS --- *Some* HTTP packets. -- <br/>Defined in include/ec_hook.h as HOOK_PROTO_HTTP -- See src/dissectors/ec_http.c. hook_points.http = ffi.C.HOOK_PROTO_HTTP -- Commented out.. Unsure if this should ever be exposed to LUA... -- dhcp_profile = ffi.C.HOOK_PROTO_DHCP_PROFILE, -- DHCP profile ? return hook_points
gpl-2.0
ibm2431/darkstar
scripts/zones/Southern_San_dOria/IDs.lua
9
9961
----------------------------------- -- Area: Southern_San_dOria ----------------------------------- require("scripts/globals/zone") ----------------------------------- zones = zones or {} zones[dsp.zone.SOUTHERN_SAN_DORIA] = { text = { HOMEPOINT_SET = 24, -- Home point set! ITEM_CANNOT_BE_OBTAINED = 6426, -- You cannot obtain the <item>. Come back after sorting your inventory. FULL_INVENTORY_AFTER_TRADE = 6430, -- You cannot obtain the <item>. Try trading again after sorting your inventory. ITEM_OBTAINED = 6432, -- Obtained: <item>. GIL_OBTAINED = 6433, -- Obtained <number> gil. KEYITEM_OBTAINED = 6435, -- Obtained key item: <keyitem>. KEYITEM_LOST = 6436, -- Lost key item: <keyitem>. NOT_HAVE_ENOUGH_GIL = 6437, -- You do not have enough gil. NOTHING_OUT_OF_ORDINARY = 6446, -- There is nothing out of the ordinary here. MOG_LOCKER_OFFSET = 6673, -- Your Mog Locker lease is valid until <timestamp>, kupo. LEATHER_SUPPORT = 6775, -- Your [fishing/woodworking/smithing/goldsmithing/clothcraft/leatherworking/bonecraft/alchemy/cooking] skills went up [a little/ever so slightly/ever so slightly]. GUILD_TERMINATE_CONTRACT = 6789, -- You have terminated your trading contract with the [Fishermen's/Carpenters'/Blacksmiths'/Goldsmiths'/Weavers'/Tanners'/Boneworkers'/Alchemists'/Culinarians'] Guild and formed a new one with the [Fishermen's/Carpenters'/Blacksmiths'/Goldsmiths'/Weavers'/Tanners'/Boneworkers'/Alchemists'/Culinarians'] Guild. GUILD_NEW_CONTRACT = 6797, -- You have formed a new trading contract with the [Fishermen's/Carpenters'/Blacksmiths'/Goldsmiths'/Weavers'/Tanners'/Boneworkers'/Alchemists'/Culinarians'] Guild. NO_MORE_GP_ELIGIBLE = 6804, -- You are not eligible to receive guild points at this time. GP_OBTAINED = 6809, -- Obtained: <number> guild points. NOT_HAVE_ENOUGH_GP = 6810, -- You do not have enough guild points. CONQUEST_BASE = 7032, -- Tallying conquest results... YOU_ACCEPT_THE_MISSION = 7196, -- You accept the mission. ORIGINAL_MISSION_OFFSET = 7207, -- Bring me one of those axes, and your mission will be a success. No running away now; we've a proud country to defend! TRICK_OR_TREAT = 7355, -- Trick or treat... THANK_YOU_TREAT = 7356, -- Thank you... And now for your treat... HERE_TAKE_THIS = 7357, -- Here, take this... IF_YOU_WEAR_THIS = 7358, -- If you put this on and walk around, something...unexpected might happen... THANK_YOU = 7359, -- Thank you... NOKKHI_BAD_COUNT = 7377, -- What kinda smart-alecky baloney is this!? I told you to bring me the same kinda ammunition in complete sets. And don't forget the flowers, neither. NOKKHI_GOOD_TRADE = 7379, -- And here you go! Come back soon, and bring your friends! NOKKHI_BAD_ITEM = 7380, -- I'm real sorry, but there's nothing I can do with those. YOU_CANNOT_ENTER_DYNAMIS = 7414, -- You cannot enter Dynamis - [Dummy/San d'Oria/Bastok/Windurst/Jeuno/Beaucedine/Xarcabard/Valkurm/Buburimu/Qufim/Tavnazia] for <number> [day/days] (Vana'diel time). PLAYERS_HAVE_NOT_REACHED_LEVEL = 7416, -- Players who have not reached level <number> are prohibited from entering Dynamis. DYNA_NPC_DEFAULT_MESSAGE = 7426, -- There is an unusual arrangement of branches here. VARCHET_BET_LOST = 7757, -- You lose your bet of 5 gil. VARCHET_KEEP_PROMISE = 7766, -- As promised, I shall go and see about those woodchippers. Maybe we can play another game later. ROSEL_DIALOG = 7786, -- Hrmm... Now, this is interesting! It pays to keep an eye on the competition. Thanks for letting me know! LUSIANE_SHOP_DIALOG = 7960, -- Hello! Let Taumila's handle all your sundry needs! OSTALIE_SHOP_DIALOG = 7961, -- Welcome, customer. Please have a look. ASH_THADI_ENE_SHOP_DIALOG = 7982, -- Welcome to Helbort's Blades! UNLOCK_PALADIN = 8009, -- You can now become a paladin! BLENDARE_DIALOG = 8093, -- Wait! If I had magic, maybe I could keep my brother's hands off my sweets... RAMINEL_DELIVERY = 8097, -- Here's your delivery! RAMINEL_DELIVERIES = 8099, -- Sorry, I have deliveries to make! SHILAH_SHOP_DIALOG = 8114, -- Welcome, weary traveler. Make yourself at home! VALERIANO_SHOP_DIALOG = 8132, -- Oh, a fellow outsider! We are Troupe Valeriano. I am Valeriano, at your service! FERDOULEMIONT_SHOP_DIALOG = 8148, -- Hello! FLYER_REFUSED = 8180, -- Your flyer is refused. CLETAE_DIALOG = 8200, -- Why, hello. All our skins are guild-approved. KUEH_IGUNAHMORI_DIALOG = 8201, -- Good day! We have lots in stock today. PAUNELIE_DIALOG = 8309, -- I'm sorry, can I help you? PAUNELIE_SHOP_DIALOG = 8314, -- These magic shells are full of mysteries... ITEM_DELIVERY_DIALOG = 8409, -- Parcels delivered to rooms anywhere in Vana'diel! MACHIELLE_OPEN_DIALOG = 8415, -- Might I interest you in produce from Norvallen? CORUA_OPEN_DIALOG = 8416, -- Ronfaure produce for sale! PHAMELISE_OPEN_DIALOG = 8417, -- I've got fresh produce from Zulkheim! APAIREMANT_OPEN_DIALOG = 8418, -- Might you be interested in produce from Gustaberg AVELINE_SHOP_DIALOG = 8419, -- Welcome to Raimbroy's Grocery! MIOGIQUE_SHOP_DIALOG = 8420, -- Looking for something in particular? BENAIGE_SHOP_DIALOG = 8420, -- Looking for something in particular? CARAUTIA_SHOP_DIALOG = 8421, -- Well, what sort of armor would you like? MACHIELLE_CLOSED_DIALOG = 8422, -- We want to sell produce from Norvallen, but the entire region is under foreign control! CORUA_CLOSED_DIALOG = 8423, -- We specialize in Ronfaure produce, but we cannot import from that region without a strong San d'Orian presence there. PHAMELISE_CLOSED_DIALOG = 8424, -- I'd be making a killing selling produce from Zulkheim, but the region's under foreign control! APAIREMANT_CLOSED_DIALOG = 8425, -- I'd love to import produce from Gustaberg, but the foreign powers in control there make me feel unsafe! POURETTE_OPEN_DIALOG = 8426, -- Derfland produce for sale! POURETTE_CLOSED_DIALOG = 8427, -- Listen, adventurer... I can't import from Derfland until the region knows San d'Orian power! CONQUEST = 8484, -- You've earned conquest points! FLYER_ACCEPTED = 8829, -- The flyer is accepted. FLYER_ALREADY = 8830, -- This person already has a flyer. BLENDARE_MESSAGE = 8831, -- Blendare looks over curiously for a moment. ROSEL_MESSAGE = 8832, -- Rosel looks over curiously for a moment. MAUGIE_DIALOG = 8833, -- A magic shop, eh? Hmm... A little magic could go a long way for making a leisurely retirement! Ho ho ho! MAUGIE_MESSAGE = 8834, -- Maugie looks over curiously for a moment. ADAUNEL_DIALOG = 8835, -- A magic shop? Maybe I'll check it out one of these days. Could help with my work, even... ADAUNEL_MESSAGE = 8836, -- Adaunel looks over curiously for a moment. LEUVERET_DIALOG = 8837, -- A magic shop? That'd be a fine place to peddle my wares. I smell a profit! I'll be up to my gills in gil, I will! LEUVERET_MESSAGE = 8838, -- Leuveret looks over curiously for a moment. LUSIANE_THANK = 8880, -- Thank you! My snoring will express gratitude mere words cannot! Here's something for you in return. IMPULSE_DRIVE_LEARNED = 9317, -- You have learned the weapon skill Impulse Drive! CLOUD_BAD_COUNT = 10105, -- Well, don't just stand there like an idiot! I can't do any bundlin' until you fork over a set of 99 tools and <item>! And I ain't doin' no more than seven sets at one time, so don't even try it! CLOUD_GOOD_TRADE = 10109, -- Here, take 'em and scram. And don't say I ain't never did nothin' for you! CLOUD_BAD_ITEM = 10110, -- What the hell is this junk!? Why don't you try bringin' what I asked for before I shove one of my sandals up your...nose! CAPUCINE_SHOP_DIALOG = 10311, -- Hello! You seem to be working very hard. I'm really thankful! But you needn't rush around so fast. Take your time! I can wait if it makes the job easier for you! TUTORIAL_NPC = 13517, -- Greetings and well met! Guardian of the Kingdom, Alaune, at your most humble service. TEAR_IN_FABRIC_OF_SPACE = 16510, -- There appears to be a tear in the fabric of space... }, mob = { }, npc = { HALLOWEEN_SKINS = { [17719303] = 47, -- Machielle [17719304] = 50, -- Corua [17719305] = 48, -- Phamelise [17719306] = 46, -- Apairemant [17719493] = 49, -- Pourette }, LUSIANE = 17719350, ARPETION = 17719409, }, } return zones[dsp.zone.SOUTHERN_SAN_DORIA]
gpl-3.0
naclander/tome
game/modules/tome/data/maps/zones/unremarkable-cave.lua
3
6561
-- ToME - Tales of Maj'Eyal -- Copyright (C) 2009 - 2014 Nicolas Casalini -- -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with this program. If not, see <http://www.gnu.org/licenses/>. -- -- Nicolas Casalini "DarkGod" -- darkgod@te4.org defineTile('.', "CAVEFLOOR", nil, nil, nil, {lite=true}) defineTile('#', "CAVEWALL", nil, nil, nil, {lite=true}) defineTile('+', "CAVEFLOOR", nil, nil, nil, {lite=true}) defineTile('@', "CAVEFLOOR", nil, "FILLAREL", nil, {lite=true}) defineTile('M', "CAVEFLOOR", nil, "CORRUPTOR", nil, {lite=true}) subGenerator{ x = 0, y = 0, w = 86, h = 50, generator = "engine.generator.map.Roomer", data = { edge_entrances = {4,6}, nb_rooms = 13, rooms = {"random_room"}, ['.'] = "CAVEFLOOR", ['#'] = "CAVEWALL", up = "CAVE_LADDER_UP_WILDERNESS", door = "CAVEFLOOR", force_tunnels = { {"random", {85, 25}, id=-500}, }, }, define_up = true, } checkConnectivity({87,25}, "entrance", "boss-area", "boss-area") return [[ ############## ############## ############## ############## ############## ############## ############## ############## ############## ############## ############## ############## ############## #######.###### #####.....#### ###.........## ##...........# #............# #............# #............# #......@.....# #............# #............# #............# #............# +............# #............# #............# #............# #............# #......M.....# #............# #............# ##...........# ####.......### #####.....#### #######.###### ############## ############## ############## ############## ############## ############## ############## ############## ############## ############## ############## ############## ##############]]
gpl-3.0
siktirmirza/supergp
plugins/webshot.lua
110
1424
local helpers = require "OAuth.helpers" local base = 'https://screenshotmachine.com/' local url = base .. 'processor.php' local function get_webshot_url(param) local response_body = {} local request_constructor = { url = url, method = "GET", sink = ltn12.sink.table(response_body), headers = { referer = base, dnt = "1", origin = base, ["User-Agent"] = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36" }, redirect = false } local arguments = { urlparam = param, size = "FULL" } request_constructor.url = url .. "?" .. helpers.url_encode_arguments(arguments) local ok, response_code, response_headers, response_status_line = https.request(request_constructor) if not ok or response_code ~= 200 then return nil end local response = table.concat(response_body) return string.match(response, "href='(.-)'") end local function run(msg, matches) local find = get_webshot_url(matches[1]) if find then local imgurl = base .. find local receiver = get_receiver(msg) send_photo_from_url(receiver, imgurl) end end return { description = "Website Screen Shot", usage = { "/web (url) : screen shot of website" }, patterns = { "^[!/]web (https?://[%w-_%.%?%.:/%+=&]+)$", }, run = run }
gpl-2.0
greasydeal/darkstar
scripts/zones/Castle_Zvahl_Keep_[S]/Zone.lua
28
1341
----------------------------------- -- -- Zone: Castle_Zvahl_Keep_[S] (155) -- ----------------------------------- package.loaded["scripts/zones/Castle_Zvahl_Keep_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Castle_Zvahl_Keep_[S]/TextIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-555.996,-71.691,60,255); end return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
LegionXI/darkstar
scripts/zones/The_Ashu_Talif/Zone.lua
10
1253
----------------------------------- -- -- Zone: The_Ashu_Talif -- ----------------------------------- require("scripts/globals/settings"); local TheAshuTalif = require("scripts/zones/The_Ashu_Talif/IDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; return cs; end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option,target) -- printf("Zone Update CSID: %u",csid); -- printf("Zone Update RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("Zone Finish CSID: %u",csid); -- printf("Zone Finish RESULT: %u",option); if(csid == 102) then player:setPos(0,0,0,0,54); end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Spire_of_Dem/npcs/_0j3.lua
36
1313
----------------------------------- -- Area: Spire_of_Dem -- NPC: web of regret ----------------------------------- package.loaded["scripts/zones/Spire_of_Dem/TextIDs"] = nil; ----------------------------------- require("scripts/globals/bcnm"); require("scripts/zones/Spire_of_Dem/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(TradeBCNM(player,player:getZoneID(),trade,npc))then return; end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(EventTriggerBCNM(player,npc))then return 1; end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("onUpdate CSID: %u",csid); --printf("onUpdate RESULT: %u",option); if(EventUpdateBCNM(player,csid,option))then return; end end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --printf("onFinish CSID: %u",csid); --printf("onFinish RESULT: %u",option); if(EventFinishBCNM(player,csid,option))then return; end end;
gpl-3.0
siktirmirza/supergp
plugins/antisticker.lua
18
19258
-- data saved to data/moderation.json do local administrators_only = 'For administrator only!' local moderators_only = 'For moderators only!' local function create_group(msg) if not is_admin(msg) then return administrators_only end local group_creator = msg.from.print_name create_group_chat (group_creator, group_name, ok_cb, false) return 'Group '..string.gsub(group_name, '_', ' ')..' has been created.' end local function addgroup(msg) if not is_admin(msg) then return administrators_only end local data = load_data(_config.moderation.data) if data[tostring(msg.to.id)] then return 'Group is already added.' end -- create data array in moderation.json data[tostring(msg.to.id)] = { moderators ={}, settings = { set_name = string.gsub(msg.to.print_name, '_', ' '), lock_bots = 'no', lock_name = 'no', lock_photo = 'no', lock_member = 'no', anti_flood = 'no', welcome = 'no', sticker = 'ok' } } save_data(_config.moderation.data, data) return 'Group has been added.' end local function remgroup(msg) if not is_admin(msg) then return administrators_only end local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) if not data[tostring(msg.to.id)] then return 'Group is not added.' end data[tostring(msg.to.id)] = nil save_data(_config.moderation.data, data) return 'Group has been removed' end local function export_chat_link_callback(extra, success, result) local msg = extra.msg local group_name = msg.to.title local data = extra.data local receiver = get_receiver(msg) if success == 0 then return send_large_msg(receiver, 'Cannot generate invite link for this group.\nMake sure you are an admin or a sudoer.') end data[tostring(msg.to.id)]['link'] = result save_data(_config.moderation.data, data) return send_large_msg(receiver,'Newest generated invite link for '..group_name..' is:\n'..result) end local function set_description(msg, data) if not is_mod(msg) then return moderators_only end local data_cat = 'description' data[tostring(msg.to.id)][data_cat] = deskripsi save_data(_config.moderation.data, data) return 'Set group description to:\n'..deskripsi 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] return string.gsub(msg.to.print_name, "_", " ")..':\n\n'..about end local function set_rules(msg, data) if not is_mod(msg) then return moderators_only end local data_cat = 'rules' data[tostring(msg.to.id)][data_cat] = rules save_data(_config.moderation.data, data) return 'Set group rules to:\n'..rules 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 = string.gsub(msg.to.print_name, '_', ' ')..' rules:\n\n'..rules return rules end -- dis/allow APIs bots to enter group. Spam prevention. local function allow_api_bots(msg, data) if not is_mod(msg) then return moderators_only end local group_bot_lock = data[tostring(msg.to.id)]['settings']['lock_bots'] if group_bot_lock == 'no' then return 'Bots are allowed to enter group.' else data[tostring(msg.to.id)]['settings']['lock_bots'] = 'no' save_data(_config.moderation.data, data) return 'Group is open for bots.' end end local function disallow_api_bots(msg, data) if not is_mod(msg) then return moderators_only end local group_bot_lock = data[tostring(msg.to.id)]['settings']['lock_bots'] if group_bot_lock == 'yes' then return 'Group is already locked from bots.' else data[tostring(msg.to.id)]['settings']['lock_bots'] = 'yes' save_data(_config.moderation.data, data) return 'Group is locked from bots.' end end -- lock/unlock group name. bot automatically change group name when locked local function lock_group_name(msg, data) if not is_mod(msg) then return moderators_only end local group_name_set = data[tostring(msg.to.id)]['settings']['set_name'] local group_name_lock = data[tostring(msg.to.id)]['settings']['lock_name'] if group_name_lock == 'yes' then return 'Group name is already locked' else data[tostring(msg.to.id)]['settings']['lock_name'] = 'yes' save_data(_config.moderation.data, data) data[tostring(msg.to.id)]['settings']['set_name'] = string.gsub(msg.to.print_name, '_', ' ') save_data(_config.moderation.data, data) return 'Group name has been locked' end end local function unlock_group_name(msg, data) if not is_mod(msg) then return moderators_only end local group_name_set = data[tostring(msg.to.id)]['settings']['set_name'] local group_name_lock = data[tostring(msg.to.id)]['settings']['lock_name'] if group_name_lock == 'no' then return 'Group name is already unlocked' else data[tostring(msg.to.id)]['settings']['lock_name'] = 'no' save_data(_config.moderation.data, data) return 'Group name has been unlocked' end end --lock/unlock group member. bot automatically kick new added user when locked local function lock_group_member(msg, data) if not is_mod(msg) then return moderators_only end local group_member_lock = data[tostring(msg.to.id)]['settings']['lock_member'] if group_member_lock == 'yes' then return 'Group members are already locked' else data[tostring(msg.to.id)]['settings']['lock_member'] = 'yes' save_data(_config.moderation.data, data) end return 'Group members has been locked' end local function unlock_group_member(msg, data) if not is_mod(msg) then return moderators_only end local group_member_lock = data[tostring(msg.to.id)]['settings']['lock_member'] if group_member_lock == 'no' then return 'Group members are not locked' else data[tostring(msg.to.id)]['settings']['lock_member'] = 'no' save_data(_config.moderation.data, data) return 'Group members has been unlocked' end end --lock/unlock group photo. bot automatically keep group photo when locked local function lock_group_photo(msg, data) if not is_mod(msg) then return moderators_only end local group_photo_lock = data[tostring(msg.to.id)]['settings']['lock_photo'] if group_photo_lock == 'yes' then return 'Group photo is already locked' else data[tostring(msg.to.id)]['settings']['set_photo'] = 'waiting' save_data(_config.moderation.data, data) end return 'Please send me the group photo now' end local function unlock_group_photo(msg, data) if not is_mod(msg) then return moderators_only end local group_photo_lock = data[tostring(msg.to.id)]['settings']['lock_photo'] if group_photo_lock == 'no' then return 'Group photo is not locked' else data[tostring(msg.to.id)]['settings']['lock_photo'] = 'no' save_data(_config.moderation.data, data) return 'Group photo has been unlocked' end 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 -- show group settings local function show_group_settings(msg, data) if not is_mod(msg) then return moderators_only end local settings = data[tostring(msg.to.id)]['settings'] if settings.lock_bots == 'yes' then lock_bots_state = 'ًں”’' elseif settings.lock_bots == 'no' then lock_bots_state = 'ًں”“' end if settings.lock_name == 'yes' then lock_name_state = 'ًں”’' elseif settings.lock_name == 'no' then lock_name_state = 'ًں”“' end if settings.lock_photo == 'yes' then lock_photo_state = 'ًں”’' elseif settings.lock_photo == 'no' then lock_photo_state = 'ًں”“' end if settings.lock_member == 'yes' then lock_member_state = 'ًں”’' elseif settings.lock_member == 'no' then lock_member_state = 'ًں”“' end if settings.anti_flood ~= 'no' then antiflood_state = 'ًں”’' elseif settings.anti_flood == 'no' then antiflood_state = 'ًں”“' end if settings.welcome ~= 'no' then greeting_state = 'ًں”’' elseif settings.welcome == 'no' then greeting_state = 'ًں”“' end if settings.sticker ~= 'ok' then sticker_state = 'ًں”’' elseif settings.sticker == 'ok' then sticker_state = 'ًں”“' end local text = 'Group settings:\n' ..'\n'..lock_bots_state..' Lock group from bot : '..settings.lock_bots ..'\n'..lock_name_state..' Lock group name : '..settings.lock_name ..'\n'..lock_photo_state..' Lock group photo : '..settings.lock_photo ..'\n'..lock_member_state..' Lock group member : '..settings.lock_member ..'\n'..antiflood_state..' Flood protection : '..settings.anti_flood ..'\n'..greeting_state..' Welcome message : '..settings.welcome ..'\n'..sticker_state..' Sticker policy : '..settings.sticker return text end -- media handler. needed by group_photo_lock local function pre_process(msg) if not msg.text and msg.media then msg.text = '['..msg.media.type..']' end return msg end function run(msg, matches) if not is_chat_msg(msg) then return "This is not a group chat." end local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) -- create a group if matches[1] == 'mkgroup' and matches[2] then group_name = matches[2] return create_group(msg) end -- add a group to be moderated if matches[1] == 'addgroup' then return addgroup(msg) end -- remove group from moderation if matches[1] == 'remgroup' then return remgroup(msg) end if msg.media and is_chat_msg(msg) and is_momod(msg) then if msg.media.type == 'photo' and data[tostring(msg.to.id)] then if data[tostring(msg.to.id)]['settings']['set_photo'] == 'waiting' then load_photo(msg.id, set_group_photo, msg) end end end if data[tostring(msg.to.id)] then local settings = data[tostring(msg.to.id)]['settings'] if matches[1] == 'setabout' and matches[2] then deskripsi = matches[2] return set_description(msg, data) end if matches[1] == 'about' then return get_description(msg, data) end if matches[1] == 'setrules' then rules = matches[2] return set_rules(msg, data) end if matches[1] == 'rules' then return get_rules(msg, data) end -- group link {get|set} if matches[1] == 'link' then if matches[2] == 'get' then if data[tostring(msg.to.id)]['link'] then local about = get_description(msg, data) local link = data[tostring(msg.to.id)]['link'] return about.."\n\n"..link else return 'Invite link does not exist.\nTry !link set to generate it.' end end if matches[2] == 'set' and is_mod(msg) then msgr = export_chat_link(receiver, export_chat_link_callback, {data=data, msg=msg}) end end if matches[1] == 'group' then -- lock {bot|name|member|photo|sticker} if matches[2] == 'lock' then if matches[3] == 'bot' then return disallow_api_bots(msg, data) end if matches[3] == 'name' then return lock_group_name(msg, data) end if matches[3] == 'member' then return lock_group_member(msg, data) end if matches[3] == 'photo' then return lock_group_photo(msg, data) end -- unlock {bot|name|member|photo|sticker} elseif matches[2] == 'unlock' then if matches[3] == 'bot' then return allow_api_bots(msg, data) end if matches[3] == 'name' then return unlock_group_name(msg, data) end if matches[3] == 'member' then return unlock_group_member(msg, data) end if matches[3] == 'photo' then return unlock_group_photo(msg, data) end -- view group settings elseif matches[2] == 'settings' then return show_group_settings(msg, data) end end if matches[1] == 'sticker' then if matches[2] == 'warn' then if welcome_stat ~= 'warn' then data[tostring(msg.to.id)]['settings']['sticker'] = 'warn' save_data(_config.moderation.data, data) end return '[Alredy Enabled]\nSticker Sender will be warned first, then kicked for second Sticker.' end if matches[2] == 'kick' then if welcome_stat ~= 'kick' then data[tostring(msg.to.id)]['settings']['sticker'] = 'kick' save_data(_config.moderation.data, data) end return '[Already Enabled]Sticker Sender will be kicked!' end if matches[2] == 'ok' then if welcome_stat == 'ok' then return '[Already Disabled]Nothing Will Happend If Sticker Sent!' else data[tostring(msg.to.id)]['settings']['sticker'] = 'ok' save_data(_config.moderation.data, data) return 'Nothing Will Happend If Sticker Sent! ' end end end -- if group name is renamed 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 rename_chat(to_rename, group_name_set, ok_cb, false) end elseif group_name_lock == 'no' then return nil end end -- set group name if matches[1] == 'setname' and is_mod(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) end -- set group photo if matches[1] == 'setphoto' and is_mod(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 a user is added to group 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 group_bot_lock = settings.lock_bots local user = 'user#id'..msg.action.user.id if group_member_lock == 'yes' then chat_del_user(receiver, user, ok_cb, true) -- no APIs bot are allowed to enter chat group. elseif group_bot_lock == 'yes' and msg.action.user.flags == 4352 then chat_del_user(receiver, user, ok_cb, true) elseif group_bot_lock == 'no' or group_member_lock == 'no' then return nil end end -- if sticker is sent if msg.media and msg.media.caption == 'sticker.webp' and not is_momod(msg) then local user_id = msg.from.id local chat_id = msg.to.id local sticker_hash = 'mer_sticker:'..chat_id..':'..user_id local is_sticker_offender = redis:get(sticker_hash) if settings.sticker == 'warn' then if is_sticker_offender then chat_del_user(receiver, 'user#id'..user_id, ok_cb, true) redis:del(sticker_hash) return '[Warned Before]Kicked Because You Have Sent Stickers' elseif not is_sticker_offender then redis:set(sticker_hash, true) return ' Stop Sending Sticker.This Is A Warn Next Time You Will Kicked!' end elseif settings.sticker == 'kick' then chat_del_user(receiver, 'user#id'..user_id, ok_cb, true) return 'You Kicked Because You Have Sent Stickers??' elseif settings.sticker == 'ok' then return nil end end -- if group photo is deleted 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 chat_set_photo (receiver, settings.set_photo, ok_cb, false) elseif group_photo_lock == 'no' then return nil end end -- if group photo is changed 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 chat_set_photo (receiver, settings.set_photo, ok_cb, false) elseif group_photo_lock == 'no' then return nil end end end end return { description = 'Plugin to manage group chat.', usage = { admin = { '!mkgroup <group_name> : Make/create a new group.', '!addgroup : Add group to moderation list.', '!remgroup : Remove group from moderation list.' }, moderator = { '!group <lock|unlock> bot : {Dis}allow APIs bots.', '!group <lock|unlock> member : Lock/unlock group member.', '!group <lock|unlock> name : Lock/unlock group name.', '!group <lock|unlock> photo : Lock/unlock group photo.', '!group settings : Show group settings.', '!link <set> : Generate/revoke invite link.', '!setabout <description> : Set group description.', '!setname <new_name> : Set group name.', '!setphoto : Set group photo.', '!setrules <rules> : Set group rules.', '!sticker warn : Sticker restriction, sender will be warned for the first violation.', '!sticker kick : Sticker restriction, sender will be kick.', '!sticker ok : Disable sticker restriction.' }, user = { '!about : Read group description', '!rules : Read group rules', '!link <get> : Print invite link' }, }, patterns = { --"^!(about)$", --"^!(addgroup)$", "%[(audio)%]", "%[(document)%]", --"^!(group) (lock) (.*)$", --"^!(group) (settings)$", --"^!(group) (unlock) (.*)$", --"^!(link) (.*)$", --"^!(mkgroup) (.*)$", --"%[(photo)%]", --"^!(remgroup)$", --"^!(rules)$", -- "^!(setabout) (.*)$", -- "^!(setname) (.*)$", --"^!(setphoto)$", --"^!(setrules) (.*)$", "^[!/](sticker) (.*)$", "^!!tgservice (.+)$", "%[(video)%]" }, run = run, pre_process = pre_process } end --To Have This Update Lua-tg-c avaiable on tg folder
gpl-2.0
pokemoncentral/wiki-lua-modules
test/PokémonData.spec.lua
1
6932
-- "Test cases" for Typelist local pokeData = require('PokémonData') local tests = {} -- ================================ getName ================================ -- Tests 1, 5 -- Standard case table.insert(tests, { pokeData.getName{args={'398'}}, 'Staraptor' }) -- Few digits table.insert(tests, { pokeData.getName{args={'65'}}, 'Alakazam' }) -- getName alt form table.insert(tests, { pokeData.getName{args={'487O'}}, 'Giratina' }) -- getName useless form table.insert(tests, { pokeData.getName{args={'422E'}}, 'Shellos' }) -- getName both (Minior is better than Pikachu because it has a form in both) table.insert(tests, { pokeData.getName{args={'774R'}}, 'Minior' }) -- ================================ getFormName =============================== -- Tests 6, 11 -- AltForms table.insert(tests, { pokeData.getFormName{args={'800A'}}, "Necrozma Ali dell'Aurora" }) -- UselessForms table.insert(tests, { pokeData.getFormName{args={'422E'}}, 'Mare Est' }) -- BothForms table.insert(tests, { pokeData.getFormName{args={'774R'}}, 'Nucleo Rosso' }) -- Base form table.insert(tests, { pokeData.getFormName{args={'422'}}, 'Mare Ovest' }) -- Empty form name, few digits table.insert(tests, { pokeData.getFormName{args={'28'}}, '' }) -- Pokémon without alternative form table.insert(tests, { pokeData.getFormName{args={'398'}}, '' }) -- ================================ getAbil ================================ -- Tests 12, 18 -- Standard cases, names or two digits table.insert(tests, { pokeData.getAbil1{args={'065'}}, 'Sincronismo' }) table.insert(tests, { pokeData.getAbil2{args={'Alakazam'}}, 'Forza Interiore' }) table.insert(tests, { pokeData.getAbild{args={'65'}}, 'Magicscudo' }) table.insert(tests, { pokeData.getAbile{args={'744'}}, 'Mente Locale' }) -- Second ability on Pokémon with only one ability table.insert(tests, { pokeData.getAbil2{args={'398'}}, '' }) -- Alternative form ability table.insert(tests, { pokeData.getAbil1{args={'487O'}}, 'Levitazione' }) -- Old gen ability table.insert(tests, { pokeData.getAbil1{args={'94', gen = '5'}}, 'Levitazione' }) -- ================================ getType ================================ -- Tests 19, 27 -- Standard case table.insert(tests, { pokeData.getType1{args={'398'}}, 'Normale' }) table.insert(tests, { pokeData.getType2{args={'398'}}, 'Volante' }) -- From name table.insert(tests, { pokeData.getType1{args={'Ho-Oh'}}, 'Fuoco' }) -- Second type on Pokémon with only one type, two digits table.insert(tests, { pokeData.getType2{args={'65'}}, 'Psico' }) -- Alternative form type table.insert(tests, { pokeData.getType1{args={'493Fu'}}, 'Fuoco' }) table.insert(tests, { pokeData.getType2{args={'479L'}}, 'Acqua' }) -- Old gen type table.insert(tests, { pokeData.getType2{args={'082', gen = '1'}}, 'Elettro' }) -- Gradient types table.insert(tests, { pokeData.gradTypes{args={'400'}}, 'normale-acqua'}) table.insert(tests, { pokeData.gradTypes{args={'035', gen = '1'}}, 'normale-normale'}) -- ================================ getStat ================================ -- Tests 28, 31 -- Standard table.insert(tests, { pokeData.getStat{args={'398', 'hp'}}, 85 }) table.insert(tests, { pokeData.getStat{args={'65', 'spatk'}}, 135 }) -- Alternative form table.insert(tests, { pokeData.getStat{args={'487O', 'def'}}, 100 }) -- Old gen table.insert(tests, { pokeData.getStat{args={'189', 'spdef', gen = '2'}}, 85 }) -- =============================== getCriesList =============================== -- Tests 32, 35 -- Standard table.insert(tests, { pokeData.getCriesList{args={'800'}}, 'V-Necrozma Criniera del Vespro,A-Necrozma Ali dell\'Aurora,U-UltraNecrozma' }) -- Only some form table.insert(tests, { pokeData.getCriesList{args={'710'}}, 'XL-Maxi' }) -- No alternative forms table.insert(tests, { pokeData.getCriesList{args={'398'}}, '' }) -- All alternative forms equal table.insert(tests, { pokeData.getCriesList{args={'487'}}, 'all' }) -- ================================ getLink ================================ -- Those should be last because loads useless in Wikilib-forms -- Tests 36, 45 -- Standard case table.insert(tests, { pokeData.getLink{args={'487'}}, '<div class="small-text">[[Giratina/Forme|Forma Alterata]]</div>' }) table.insert(tests, { pokeData.getLink{args={'487O'}}, '<div class="small-text">[[Giratina/Forme|Forma Originale]]</div>' }) -- Empty base form link table.insert(tests, { pokeData.getLink{args={'028A'}}, '<div class="small-text">[[Forma di Alola#Sandshrew e Sandslash|Forma di Alola]]</div>' }) table.insert(tests, { pokeData.getLink{args={'028'}}, '' }) -- BothForms table.insert(tests, { pokeData.getLink{args={'774R'}}, '<div class="small-text">[[Minior/Forme|Nucleo Rosso]]</div>' }) -- Two kinds of "generic" links (ie: Mega and Galar) table.insert(tests, { pokeData.getLink{args={'080'}}, '' }) table.insert(tests, { pokeData.getLink{args={'080M'}}, '<div class="small-text">[[Megaevoluzione#Slowbro|MegaSlowbro]]</div>' }) table.insert(tests, { pokeData.getLink{args={'080G'}}, '<div class="small-text">[[Forma di Galar#Slowbro|Forma di Galar]]</div>' }) -- Urshifu (strange Gigamax) table.insert(tests, { pokeData.getLink{args={'892PGi', "black"}}, '<div class="small-text black-text">[[Urshifu/Forme|Urshifu Gigamax (Stile Pluricolpo)]]</div>' }) -- Pokémon without alternative forms table.insert(tests, { pokeData.getLink{args={'398'}}, '' }) -- Tests 46, 47 -- Standard case table.insert(tests, { pokeData.getLink{args={'487', 'plain'}}, '[[Giratina/Forme|Forma Alterata]]' }) -- Pokémon without alternative forms table.insert(tests, { pokeData.getLink{args={'398', 'black'}}, '' }) -- =================== -- Standard cases table.insert(tests, { pokeData.getPokeTextColor{args={" Luxray "}}, "black-text" }) table.insert(tests, { pokeData.getPokeTextColor{args={" Gengar "}}, "white-text" }) table.insert(tests, { pokeData.getPokeTextColor{args={" 065"}}, "black-text" }) table.insert(tests, { pokeData.getPokeTextColor{args={ "249" }}, "white-text" }) -- Alt forms table.insert(tests, { pokeData.getPokeTextColor{args={" alakazamM "}}, "black-text" }) table.insert(tests, { pokeData.getPokeTextColor{args={"487O"}}, "white-text" }) -- Useless forms (probably they shouldn't even work, but here we go) table.insert(tests, { pokeData.getPokeTextColor{args={" shellosE "}}, "white-text" }) -- Gen parameter table.insert(tests, { pokeData.getPokeTextColor{args={" 082 ", gen = " 1 "}}, "black-text" }) -- ==================== Actual execution ====================== for n, v in ipairs(tests) do if v[1] ~= v[2] then print(table.concat{ 'Test ', tostring(n), ' failed: ', v[2], ' expected, but ', v[1] or 'nil', ' got' }) return end end print('All tests succesfull!')
cc0-1.0
LegionXI/darkstar
scripts/zones/Meriphataud_Mountains_[S]/npcs/Cavernous_Maw.lua
29
1450
----------------------------------- -- Area: Meriphataud Mountains [S] -- NPC: Cavernous Maw -- @pos 597 -32 279 97 -- Teleports Players to Meriphataud Mountains ----------------------------------- package.loaded["scripts/zones/Meriphataud_Mountains_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/teleports"); require("scripts/globals/campaign"); require("scripts/zones/Meriphataud_Mountains_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (hasMawActivated(player,5) == false) then player:startEvent(0x0066); else player:startEvent(0x0067); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (option == 1) then if (csid == 0x0066) then player:addNationTeleport(MAW,32); end toMaw(player,18); end end;
gpl-3.0
evrooije/beerarchy
mods/walls/init.lua
26
1449
walls = {} walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) -- inventory node, and pole-type wall start item minetest.register_node(wall_name, { description = wall_desc, drawtype = "nodebox", node_box = { type = "connected", fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}}, -- connect_bottom = connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}}, connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}}, connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, }, connects_to = { "group:wall", "group:stone" }, paramtype = "light", is_ground_content = false, tiles = { wall_texture, }, walkable = true, groups = { cracky = 3, wall = 1, stone = 2 }, sounds = wall_sounds, }) -- crafting recipe minetest.register_craft({ output = wall_name .. " 6", recipe = { { '', '', '' }, { wall_mat, wall_mat, wall_mat}, { wall_mat, wall_mat, wall_mat}, } }) end walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png", "default:cobble", default.node_sound_stone_defaults()) walls.register("walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png", "default:mossycobble", default.node_sound_stone_defaults()) walls.register("walls:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png", "default:desert_cobble", default.node_sound_stone_defaults())
lgpl-2.1
ibm2431/darkstar
scripts/zones/Monastic_Cavern/npcs/Magicite.lua
9
1319
----------------------------------- -- Area: Monastic Cavern -- NPC: Magicite -- Involved in Mission: Magicite -- !pos -22 1 -66 150 ----------------------------------- require("scripts/globals/keyitems") local ID = require("scripts/zones/Monastic_Cavern/IDs") ----------------------------------- function onTrade(player,npc,trade) end function onTrigger(player,npc) if player:getCurrentMission(player:getNation()) == 13 and not player:hasKeyItem(dsp.ki.MAGICITE_OPTISTONE) then if player:getCharVar("Magicite") == 2 then player:startEvent(0,1,1,1,1,1,1,1,1) -- play Lion part of the CS (this is last magicite) else player:startEvent(0) -- don't play Lion part of the CS end else player:messageSpecial(ID.text.THE_MAGICITE_GLOWS_OMINOUSLY) end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) if csid == 0 then if player:getCharVar("Magicite") == 2 then player:setCharVar("Magicite",0) else player:setCharVar("Magicite",player:getCharVar("Magicite")+1) end player:setCharVar("MissionStatus",4) player:addKeyItem(dsp.ki.MAGICITE_OPTISTONE) player:messageSpecial(ID.text.KEYITEM_OBTAINED, dsp.ki.MAGICITE_OPTISTONE) end end
gpl-3.0
ibm2431/darkstar
scripts/zones/Southern_San_dOria/npcs/Adaunel.lua
9
1135
----------------------------------- -- Area: Southern San d'Oria -- NPC: Adaunel -- General Info NPC -- !pos 80 -7 -22 230 ------------------------------------ local ID = require("scripts/zones/Southern_San_dOria/IDs"); require("scripts/globals/settings"); require("scripts/globals/quests"); ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(SANDORIA,dsp.quest.id.sandoria.FLYERS_FOR_REGINE) == QUEST_ACCEPTED) then if (trade:hasItemQty(532,1) and trade:getItemCount() == 1 and player:getCharVar("tradeAdaunel") == 0) then player:messageSpecial(ID.text.ADAUNEL_DIALOG); player:addCharVar("FFR", -1) player:setCharVar("tradeAdaunel",1); player:messageSpecial(ID.text.FLYER_ACCEPTED); player:tradeComplete(); elseif (player:getCharVar("tradeAdaunel") == 1) then player:messageSpecial(ID.text.FLYER_ALREADY); end end end; function onTrigger(player,npc) player:startEvent(656); end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Throne_Room/npcs/_4l3.lua
36
1164
----------------------------------- -- Area: Throne Room -- NPC: Ore Door ------------------------------------- require("scripts/globals/bcnm"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if(TradeBCNM(player,player:getZoneID(),trade,npc))then return; end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(EventTriggerBCNM(player,npc))then return 1; end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("onUpdate CSID: %u",csid); --printf("onUpdate RESULT: %u",option); if(EventUpdateBCNM(player,csid,option))then return; end end; ----------------------------------- -- onEventFinish Action ----------------------------------- function onEventFinish(player,csid,option) --printf("onFinish CSID: %u",csid); --printf("onFinish RESULT: %u",option); if(EventFinishBCNM(player,csid,option))then return; end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Garlaige_Citadel/Zone.lua
10
3957
----------------------------------- -- -- Zone: Garlaige_Citadel (200) -- ----------------------------------- package.loaded["scripts/zones/Garlaige_Citadel/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/zone"); require("scripts/zones/Garlaige_Citadel/TextIDs"); banishing_gates_base = 17596761; -- _5k0 (First banishing gate) ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) local tomes = {17596852,17596853,17596854}; SetGroundsTome(tomes); -- Banishing Gate #1... zone:registerRegion(1,-208,-1,224,-206,1,227); zone:registerRegion(2,-208,-1,212,-206,1,215); zone:registerRegion(3,-213,-1,224,-211,1,227); zone:registerRegion(4,-213,-1,212,-211,1,215); -- Banishing Gate #2 zone:registerRegion(10,-51,-1,82,-49,1,84); zone:registerRegion(11,-151,-1,82,-149,1,84); zone:registerRegion(12,-51,-1,115,-49,1,117); zone:registerRegion(13,-151,-1,115,-149,1,117); -- Banishing Gate #3 zone:registerRegion(19,-190,-1,355,-188,1,357); zone:registerRegion(20,-130,-1,355,-128,1,357); zone:registerRegion(21,-190,-1,322,-188,1,324); zone:registerRegion(22,-130,-1,322,-128,1,324); -- Old Two-Wings SetRespawnTime(17596506, 900, 10800); -- Skewer Sam SetRespawnTime(17596507, 900, 10800); -- Serket SetRespawnTime(17596720, 900, 10800); UpdateTreasureSpawnPoint(17596808); UpdateTreasureSpawnPoint(17596809); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if((player:getXPos() == 0) and (player:getYPos() == 0) and (player:getZPos() == 0)) then player:setPos(-380.035,-13.548,398.032,64); end return cs; end; ----------------------------------- -- onConquestUpdate ----------------------------------- function onConquestUpdate(zone, updatetype) local players = zone:getPlayers(); for name, player in pairs(players) do conquestUpdate(zone, player, updatetype, CONQUEST_BASE); end end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) local regionID = region:GetRegionID(); local mylever = banishing_gates_base + regionID; GetNPCByID(mylever):setAnimation(8); if(regionID >= 1 and regionID <= 4) then gateid = banishing_gates_base; msg_offset = 0; elseif(regionID >= 10 and regionID <= 13) then gateid = banishing_gates_base + 9; msg_offset = 1; elseif(regionID >= 19 and regionID <= 22) then gateid = banishing_gates_base + 18; msg_offset = 2; end; -- Open Gate gate1 = GetNPCByID(gateid + 1); gate2 = GetNPCByID(gateid + 2); gate3 = GetNPCByID(gateid + 3); gate4 = GetNPCByID(gateid + 4); if(gate1:getAnimation() == 8 and gate2:getAnimation() == 8 and gate3:getAnimation() == 8 and gate4:getAnimation() == 8) then player:messageSpecial(BANISHING_GATES + msg_offset); -- Banishing gate opening GetNPCByID(gateid):openDoor(30); end end; ----------------------------------- -- onRegionLeave ----------------------------------- function onRegionLeave(player,region) local regionID = region:GetRegionID(); local mylever = banishing_gates_base + regionID; GetNPCByID(mylever):setAnimation(9); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
greasydeal/darkstar
scripts/globals/weaponskills/Flash_Nova.lua
30
1392
----------------------------------- -- Skill level: 290 -- Delivers light elemental damage. Additional effect: Flash. Chance of effect varies with TP. -- Generates a significant amount of Enmity. -- Does not stack with Sneak Attack -- Aligned with Aqua Gorget. -- Aligned with Aqua Belt. -- Properties: -- Element: Light -- Skillchain Properties:Induration Reverberation -- Modifiers: STR:30% MND:30% -- Damage Multipliers by TP: -- 100%TP 200%TP 300%TP -- 3.00 3.00 3.00 ----------------------------------- require("scripts/globals/magic"); require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID) local params = {}; params.ftp100 = 3; params.ftp200 = 3; params.ftp300 = 3; params.str_wsc = 0.3; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.3; params.chr_wsc = 0.0; params.ele = ELE_LIGHT; params.skill = SKILL_CLB; params.includemab = true; if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.5; params.mnd_wsc = 0.5; end local damage, criticalHit, tpHits, extraHits = doMagicWeaponskill(player, target, params); damage = damage * WEAPON_SKILL_POWER return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
LegionXI/darkstar
scripts/zones/Abyssea-Tahrongi/npcs/Cavernous_Maw.lua
29
1190
----------------------------------- -- Area: Abyssea - Tahrongi -- NPC: Cavernous Maw -- @pos -31.000, 47.000, -681.000 45 -- Teleports Players to Tahrongi Canyon ----------------------------------- package.loaded["scripts/zones/Abyssea-Tahrongi/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Abyssea-Tahrongi/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x00C8); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x00C8 and option ==1) then player:setPos(-28,46,-680,76,117); end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Stellar_Fulcrum/bcnms/return_to_delkfutts_tower.lua
13
1843
----------------------------------- -- Area: Stellar Fulcrum -- Name: Mission 5-2 -- @pos -520 -4 17 179 ----------------------------------- package.loaded["scripts/zones/Stellar_Fulcrum/TextIDs"] = nil; ------------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/zones/Stellar_Fulcrum/TextIDs"); ----------------------------------- -- After registering the BCNM via bcnmRegister(bcnmid) function onBcnmRegister(player,instance) end; -- Physically entering the BCNM via bcnmEnter(bcnmid) function onBcnmEnter(player,instance) end; -- Leaving the BCNM by every mean possible, given by the LeaveCode -- 1=Select Exit on circle -- 2=Winning the BC -- 3=Disconnected or warped out -- 4=Losing the BC -- via bcnmLeave(1) or bcnmLeave(2). LeaveCodes 3 and 4 are called -- from the core when a player disconnects or the time limit is up, etc function onBcnmLeave(player,instance,leavecode) -- print("leave code "..leavecode); if(leavecode == 2) then -- play end CS. Need time and battle id for record keeping + storage if(player:hasCompletedMission(ZILART,RETURN_TO_DELKFUTTS_TOWER)) then player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,0,1); else player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,0,0); end elseif(leavecode == 4) then player:startEvent(0x7d02); end end; function onEventUpdate(player,csid,option) -- print("bc update csid "..csid.." and option "..option); end; function onEventFinish(player,csid,option) -- print("bc finish csid "..csid.." and option "..option); if(csid == 0x7d01) then if(player:getCurrentMission(ZILART) == RETURN_TO_DELKFUTTS_TOWER) then player:completeMission(ZILART,RETURN_TO_DELKFUTTS_TOWER); player:addMission(ZILART,ROMAEVE); player:setVar("ZilartStatus",0); end end end;
gpl-3.0
ibm2431/darkstar
scripts/globals/abilities/pets/thunder_ii.lua
11
1064
--------------------------------------------------- -- Thunder 2 --------------------------------------------------- require("scripts/globals/settings") require("scripts/globals/status") require("scripts/globals/monstertpmoves") require("scripts/globals/magic") --------------------------------------------------- function onAbilityCheck(player, target, ability) return 0,0 end function onPetAbility(target, pet, skill) local dINT = math.floor(pet:getStat(dsp.mod.INT) - target:getStat(dsp.mod.INT)) local tp = skill:getTP() local damage = math.floor(45 + 0.025*(tp)) damage = damage + (dINT * 1.5) damage = MobMagicalMove(pet,target,skill,damage,dsp.magic.ele.LIGHTNING,1,TP_NO_EFFECT,0) damage = mobAddBonuses(pet, nil, target, damage.dmg, dsp.magic.ele.LIGHTNING) damage = AvatarFinalAdjustments(damage,pet,skill,target,dsp.attackType.MAGICAL,dsp.damageType.LIGHTNING,1) target:takeDamage(damage, pet, dsp.attackType.MAGICAL, dsp.damageType.LIGHTNING) target:updateEnmityFromDamage(pet,damage) return damage end
gpl-3.0
icyxp/kong
kong/plugins/response-ratelimiting/access.lua
6
2831
local policies = require "kong.plugins.response-ratelimiting.policies" local timestamp = require "kong.tools.timestamp" local responses = require "kong.tools.responses" local pairs = pairs local tostring = tostring local _M = {} local RATELIMIT_REMAINING = "X-RateLimit-Remaining" local function get_identifier(conf) local identifier -- Consumer is identified by ip address or authenticated_credential id if conf.limit_by == "consumer" then identifier = ngx.ctx.authenticated_consumer and ngx.ctx.authenticated_consumer.id if not identifier and ngx.ctx.authenticated_credential then -- Fallback on credential identifier = ngx.ctx.authenticated_credential.id end elseif conf.limit_by == "credential" then identifier = ngx.ctx.authenticated_credential and ngx.ctx.authenticated_credential.id end if not identifier then identifier = ngx.var.remote_addr end return identifier end local function get_usage(conf, api_id, identifier, current_timestamp, limits) local usage = {} for k, v in pairs(limits) do -- Iterate over limit names for lk, lv in pairs(v) do -- Iterare over periods local current_usage, err = policies[conf.policy].usage(conf, api_id, identifier, current_timestamp, lk, k) if err then return nil, err end local remaining = lv - current_usage if not usage[k] then usage[k] = {} end if not usage[k][lk] then usage[k][lk] = {} end usage[k][lk].limit = lv usage[k][lk].remaining = remaining end end return usage end function _M.execute(conf) if not next(conf.limits) then return end -- Load info local current_timestamp = timestamp.get_utc() ngx.ctx.current_timestamp = current_timestamp -- For later use local api_id = ngx.ctx.api.id local identifier = get_identifier(conf) ngx.ctx.identifier = identifier -- For later use -- Load current metric for configured period local usage, err = get_usage(conf, api_id, identifier, current_timestamp, conf.limits) if err then if conf.fault_tolerant then ngx.log(ngx.ERR, "failed to get usage: ", tostring(err)) return else return responses.send_HTTP_INTERNAL_SERVER_ERROR(err) end end -- Append usage headers to the upstream request. Also checks "block_on_first_violation". for k, v in pairs(conf.limits) do local remaining for lk, lv in pairs(usage[k]) do if conf.block_on_first_violation and lv.remaining == 0 then return responses.send(429, "API rate limit exceeded for '" .. k .. "'") end if not remaining or lv.remaining < remaining then remaining = lv.remaining end end ngx.req.set_header(RATELIMIT_REMAINING .. "-" .. k, remaining) end ngx.ctx.usage = usage -- For later use end return _M
apache-2.0
LegionXI/darkstar
scripts/globals/quests.lua
20
45133
require("scripts/globals/log_ids"); ----------------------------------- -- Nation IDs ----------------------------------- NATION_SANDORIA = 0; NATION_BASTOK = 1; NATION_WINDURST = 2; ----------------------------------- -- -- QUESTS ID -- ----------------------------------- QUEST_AVAILABLE = 0; QUEST_ACCEPTED = 1; QUEST_COMPLETED = 2; ----------------------------------- -- San d'Oria - 0 ----------------------------------- A_SENTRY_S_PERIL = 0; -- ± -- WATER_OF_THE_CHEVAL = 1; -- ± -- ROSEL_THE_ARMORER = 2; -- ± -- THE_PICKPOCKET = 3; -- ± -- FATHER_AND_SON = 4; -- + -- THE_SEAMSTRESS = 5; -- + -- THE_DISMAYED_CUSTOMER = 6; -- + -- THE_TRADER_IN_THE_FOREST = 7; -- + -- THE_SWEETEST_THINGS = 8; -- + -- THE_VICASQUE_S_SERMON = 9; -- + -- A_SQUIRE_S_TEST = 10; -- + -- GRAVE_CONCERNS = 11; -- ± -- THE_BRUGAIRE_CONSORTIUM = 12; -- + -- LIZARD_SKINS = 15; -- + -- FLYERS_FOR_REGINE = 16; -- + -- GATES_TO_PARADISE = 18; -- + -- A_SQUIRE_S_TEST_II = 19; -- + -- TO_CURE_A_COUGH = 20; -- + -- TIGER_S_TEETH = 23; -- ± -- UNDYING_FLAMES = 26; -- + -- A_PURCHASE_OF_ARMS = 27; -- + -- A_KNIGHT_S_TEST = 29; -- + -- THE_MEDICINE_WOMAN = 30; -- + -- BLACK_TIGER_SKINS = 31; -- + -- GROWING_FLOWERS = 58; -- ± -- TRIAL_BY_ICE = 59; -- + -- THE_GENERAL_S_SECRET = 60; -- ± -- THE_RUMOR = 61; -- ± -- HER_MAJESTY_S_GARDEN = 62; -- + -- INTRODUCTION_TO_TEAMWORK = 63; INTERMEDIATE_TEAMWORK = 64; ADVANCED_TEAMWORK = 65; GRIMY_SIGNPOSTS = 66; -- + -- A_JOB_FOR_THE_CONSORTIUM = 67; TROUBLE_AT_THE_SLUICE = 68; -- + -- THE_MERCHANT_S_BIDDING = 69; -- ± -- UNEXPECTED_TREASURE = 70; BLACKMAIL = 71; -- + -- THE_SETTING_SUN = 72; -- + -- DISTANT_LOYALTIES = 74; THE_RIVALRY = 75; -- ± -- THE_COMPETITION = 76; -- ± -- STARTING_A_FLAME = 77; -- ± -- FEAR_OF_THE_DARK = 78; -- + -- WARDING_VAMPIRES = 79; -- + -- SLEEPLESS_NIGHTS = 80; -- ± -- LUFET_S_LAKE_SALT = 81; -- ± -- HEALING_THE_LAND = 82; -- ± -- SORCERY_OF_THE_NORTH = 83; -- ± -- THE_CRIMSON_TRIAL = 84; -- ± -- ENVELOPED_IN_DARKNESS = 85; -- ± -- PEACE_FOR_THE_SPIRIT = 86; -- ± -- MESSENGER_FROM_BEYOND = 87; -- ± -- PRELUDE_OF_BLACK_AND_WHITE = 88; -- ± -- PIEUJE_S_DECISION = 89; -- + -- SHARPENING_THE_SWORD = 90; -- ± -- A_BOY_S_DREAM = 91; -- ± -- UNDER_OATH = 92; THE_HOLY_CREST = 93; -- + -- A_CRAFTSMAN_S_WORK = 94; -- ± -- CHASING_QUOTAS = 95; -- + -- KNIGHT_STALKER = 96; -- + -- ECO_WARRIOR_SAN = 97; METHODS_CREATE_MADNESS = 98; SOULS_IN_SHADOW = 99; A_TASTE_FOR_MEAT = 100; -- ± -- EXIT_THE_GAMBLER = 101; -- ± -- OLD_WOUNDS = 102; ESCORT_FOR_HIRE_SAN_D_ORIA = 103; A_DISCERNING_EYE_SAN_D_ORIA = 104; A_TIMELY_VISIT = 105; FIT_FOR_A_PRINCE = 106; TRIAL_SIZE_TRIAL_BY_ICE = 107; -- + -- SIGNED_IN_BLOOD = 108; -- + -- TEA_WITH_A_TONBERRY = 109; SPICE_GALS = 110; OVER_THE_HILLS_AND_FAR_AWAY = 112; LURE_OF_THE_WILDCAT_SAN_D_ORIA = 113; -- ± -- ATELLOUNE_S_LAMENT = 114; THICK_SHELLS = 117; -- ± -- FOREST_FOR_THE_TREES = 118; ----------------------------------- -- Bastok - 1 ----------------------------------- THE_SIREN_S_TEAR = 0; -- ± -- BEAUTY_AND_THE_GALKA = 1; -- ± -- WELCOME_TO_BASTOK = 2; -- + -- GUEST_OF_HAUTEUR = 3; THE_QUADAV_S_CURSE = 4; -- ± -- OUT_OF_ONE_S_SHELL = 5; -- ± -- HEARTS_OF_MYTHRIL = 6; -- ± -- THE_ELEVENTH_S_HOUR = 7; -- ± -- SHADY_BUSINESS = 8; -- ± -- A_FOREMAN_S_BEST_FRIEND = 9; -- ± -- BREAKING_STONES = 10; -- + -- THE_COLD_LIGHT_OF_DAY = 11; -- + -- GOURMET = 12; -- ± -- THE_ELVAAN_GOLDSMITH = 13; -- ± -- A_FLASH_IN_THE_PAN = 14; -- ± -- SMOKE_ON_THE_MOUNTAIN = 15; -- ± -- STAMP_HUNT = 16; -- + -- FOREVER_TO_HOLD = 17; -- ± -- TILL_DEATH_DO_US_PART = 18; -- ± -- FALLEN_COMRADES = 19; -- ± -- RIVALS = 20; -- + -- MOM_THE_ADVENTURER = 21; -- + -- THE_SIGNPOST_MARKS_THE_SPOT = 22; -- + -- PAST_PERFECT = 23; -- ± -- STARDUST = 24; -- + -- MEAN_MACHINE = 25; -- ± -- CID_S_SECRET = 26; -- ± -- THE_USUAL = 27; -- ± -- BLADE_OF_DARKNESS = 28; -- ± -- FATHER_FIGURE = 29; -- ± -- THE_RETURN_OF_THE_ADVENTURER = 30; -- ± -- DRACHENFALL = 31; -- + -- VENGEFUL_WRATH = 32; -- ± -- BEADEAUX_SMOG = 33; -- + -- THE_CURSE_COLLECTOR = 34; -- + -- FEAR_OF_FLYING = 35; -- + -- THE_WISDOM_OF_ELDERS = 36; -- ± -- GROCERIES = 37; -- ± -- THE_BARE_BONES = 38; -- ± -- MINESWEEPER = 39; -- ± -- THE_DARKSMITH = 40; -- ± -- BUCKETS_OF_GOLD = 41; -- ± -- THE_STARS_OF_IFRIT = 42; -- ± -- LOVE_AND_ICE = 43; -- ± -- BRYGID_THE_STYLIST = 44; -- ± -- THE_GUSTABERG_TOUR = 45; BITE_THE_DUST = 46; -- ± -- BLADE_OF_DEATH = 47; -- + -- SILENCE_OF_THE_RAMS = 48; -- ± -- ALTANA_S_SORROW = 49; -- + -- A_LADY_S_HEART = 50; -- ± -- GHOSTS_OF_THE_PAST = 51; -- ± -- THE_FIRST_MEETING = 52; -- ± -- TRUE_STRENGTH = 53; -- ± -- THE_DOORMAN = 54; -- ± -- THE_TALEKEEPER_S_TRUTH = 55; -- ± -- THE_TALEKEEPER_S_GIFT = 56; -- ± -- DARK_LEGACY = 57; -- ± -- DARK_PUPPET = 58; -- ± -- BLADE_OF_EVIL = 59; -- ± -- AYAME_AND_KAEDE = 60; -- ± -- TRIAL_BY_EARTH = 61; -- ± -- A_TEST_OF_TRUE_LOVE = 62; -- ± -- LOVERS_IN_THE_DUSK = 63; -- ± -- WISH_UPON_A_STAR = 64; ECO_WARRIOR_BAS = 65; THE_WEIGHT_OF_YOUR_LIMITS = 66; SHOOT_FIRST_ASK_QUESTIONS_LATER = 67; INHERITANCE = 68; THE_WALLS_OF_YOUR_MIND = 69; ESCORT_FOR_HIRE_BASTOK = 70; A_DISCERNING_EYE_BASTOK = 71; TRIAL_SIZE_TRIAL_BY_EARTH = 72; -- + -- FADED_PROMISES = 73; BRYGID_THE_STYLIST_RETURNS = 74; -- ± -- OUT_OF_THE_DEPTHS = 75; ALL_BY_MYSELF = 76; A_QUESTION_OF_FAITH = 77; RETURN_OF_THE_DEPTHS = 78; TEAK_ME_TO_THE_STARS = 79; HYPER_ACTIVE = 80; THE_NAMING_GAME = 81; CHIPS = 82; BAIT_AND_SWITCH = 83; LURE_OF_THE_WILDCAT_BASTOK = 84; ACHIEVING_TRUE_POWER = 85; TOO_MANY_CHEFS = 86; A_PROPER_BURIAL = 87; FULLY_MENTAL_ALCHEMIST = 88; SYNERGUSTIC_PURSUITS = 89; THE_WONDROUS_WHATCHAMACALLIT = 90; ----------------------------------- -- Windurst - 2 ----------------------------------- HAT_IN_HAND = 0; -- + -- A_FEATHER_IN_ONE_S_CAP = 1; -- + -- A_CRISIS_IN_THE_MAKING = 2; -- + -- MAKING_AMENDS = 3; -- + -- MAKING_THE_GRADE = 4; -- + -- IN_A_PICKLE = 5; -- + -- WONDERING_MINSTREL = 6; -- + -- A_POSE_BY_ANY_OTHER_NAME = 7; -- + -- MAKING_AMENS = 8; -- + -- THE_MOONLIT_PATH = 9; -- + -- STAR_STRUCK = 10; -- ± -- BLAST_FROM_THE_PAST = 11; -- + -- A_SMUDGE_ON_ONE_S_RECORD = 12; -- ± -- CHASING_TALES = 13; -- + -- FOOD_FOR_THOUGHT = 14; -- + -- OVERNIGHT_DELIVERY = 15; -- + -- WATER_WAY_TO_GO = 16; -- + -- BLUE_RIBBON_BLUES = 17; -- + -- THE_ALL_NEW_C_3000 = 18; -- + -- THE_POSTMAN_ALWAYS_KO_S_TWICE = 19; -- + -- EARLY_BIRD_CATCHES_THE_BOOKWORM = 20; -- + -- CATCH_IT_IF_YOU_CAN = 21; -- + -- ALL_AT_SEA = 23; THE_ALL_NEW_C_2000 = 24; -- ± -- MIHGO_S_AMIGO = 25; -- + -- ROCK_RACKETTER = 26; -- + -- CHOCOBILIOUS = 27; -- + -- TEACHER_S_PET = 28; -- + -- REAP_WHAT_YOU_SOW = 29; -- + -- GLYPH_HANGER = 30; -- + -- THE_FANGED_ONE = 31; -- + -- CURSES_FOILED_AGAIN_1 = 32; -- + -- CURSES_FOILED_AGAIN_2 = 33; -- + -- MANDRAGORA_MAD = 34; -- + -- TO_BEE_OR_NOT_TO_BEE = 35; -- + -- TRUTH_JUSTICE_AND_THE_ONION_WAY = 36; -- + -- MAKING_HEADLINES = 37; -- + -- SCOOPED = 38; CREEPY_CRAWLIES = 39; -- + -- KNOW_ONE_S_ONIONS = 40; -- + -- INSPECTOR_S_GADGET = 41; -- + -- ONION_RINGS = 42; -- + -- A_GREETING_CARDIAN = 43; -- + -- LEGENDARY_PLAN_B = 44; -- + -- IN_A_STEW = 45; -- + -- LET_SLEEPING_DOGS_LIE = 46; CAN_CARDIANS_CRY = 47; -- + -- WONDER_WANDS = 48; -- + -- HEAVEN_CENT = 49; SAY_IT_WITH_FLOWERS = 50; -- + -- HOIST_THE_JELLY_ROGER = 51; -- + -- SOMETHING_FISHY = 52; -- + -- TO_CATCH_A_FALLIHG_STAR = 53; -- + -- PAYING_LIP_SERVICE = 60; -- + -- THE_AMAZIN_SCORPIO = 61; -- + -- TWINSTONE_BONDING = 62; -- + -- CURSES_FOILED_A_GOLEM = 63; -- + -- ACTING_IN_GOOD_FAITH = 64; -- ± -- FLOWER_CHILD = 65; -- ± -- THE_THREE_MAGI = 66; -- ± -- RECOLLECTIONS = 67; -- ± -- THE_ROOT_OF_THE_PROBLEM = 68; THE_TENSHODO_SHOWDOWN = 69; -- + -- AS_THICK_AS_THIEVES = 70; -- + -- HITTING_THE_MARQUISATE = 71; -- + -- SIN_HUNTING = 72; -- + -- FIRE_AND_BRIMSTONE = 73; -- + -- UNBRIDLED_PASSION = 74; -- + -- I_CAN_HEAR_A_RAINBOW = 75; -- + -- CRYING_OVER_ONIONS = 76; -- + -- WILD_CARD = 77; -- + -- THE_PROMISE = 78; -- + -- NOTHING_MATTERS = 79; TORAIMARAI_TURMOIL = 80; -- + -- THE_PUPPET_MASTER = 81; -- + -- CLASS_REUNION = 82; -- + -- CARBUNCLE_DEBACLE = 83; -- + -- ECO_WARRIOR_WIN = 84; -- + -- FROM_SAPLINGS_GROW = 85; ORASTERY_WOES = 86; BLOOD_AND_GLORY = 87; ESCORT_FOR_HIRE_WINDURST = 88; A_DISCERNING_EYE_WINDURST = 89; TUNING_IN = 90; TUNING_OUT = 91; ONE_GOOD_DEED = 92; WAKING_DREAMS = 93; -- + -- LURE_OF_THE_WILDCAT_WINDURST = 94; BABBAN_NY_MHEILLEA = 95; ----------------------------------- -- Jeuno - 3 ----------------------------------- CREST_OF_DAVOI = 0; -- + -- SAVE_MY_SISTER = 1; -- + -- A_CLOCK_MOST_DELICATE = 2; -- + -- SAVE_THE_CLOCK_TOWER = 3; -- + -- CHOCOBO_S_WOUNDS = 4; -- + -- SAVE_MY_SON = 5; -- + -- A_CANDLELIGHT_VIGIL = 6; -- + -- THE_WONDER_MAGIC_SET = 7; -- + -- THE_KIND_CARDIAN = 8; -- + -- YOUR_CRYSTAL_BALL = 9; -- + -- COLLECT_TARUT_CARDS = 10; -- + -- THE_OLD_MONUMENT = 11; -- + -- A_MINSTREL_IN_DESPAIR = 12; -- + -- RUBBISH_DAY = 13; -- + -- NEVER_TO_RETURN = 14; -- + -- COMMUNITY_SERVICE = 15; -- + -- COOK_S_PRIDE = 16; -- + -- TENSHODO_MEMBERSHIP = 17; -- + -- THE_LOST_CARDIAN = 18; -- + -- PATH_OF_THE_BEASTMASTER = 19; -- + -- PATH_OF_THE_BARD = 20; -- + -- THE_CLOCKMASTER = 21; -- + -- CANDLE_MAKING = 22; -- + -- CHILD_S_PLAY = 23; -- + -- NORTHWARD = 24; -- + -- THE_ANTIQUE_COLLECTOR = 25; -- + -- DEAL_WITH_TENSHODO = 26; -- + -- THE_GOBBIEBAG_PART_I = 27; -- + -- THE_GOBBIEBAG_PART_II = 28; -- + -- THE_GOBBIEBAG_PART_III = 29; -- + -- THE_GOBBIEBAG_PART_IV = 30; -- + -- MYSTERIES_OF_BEADEAUX_I = 31; -- + -- MYSTERIES_OF_BEADEAUX_II = 32; -- + -- MYSTERY_OF_FIRE = 33; MYSTERY_OF_WATER = 34; MYSTERY_OF_EARTH = 35; MYSTERY_OF_WIND = 36; MYSTERY_OF_ICE = 37; MYSTERY_OF_LIGHTNING = 38; MYSTERY_OF_LIGHT = 39; MYSTERY_OF_DARKNESS = 40; FISTFUL_OF_FURY = 41; -- + -- THE_GOBLIN_TAILOR = 42; -- + -- PRETTY_LITTLE_THINGS = 43; -- ± -- BORGHERTZ_S_WARRING_HANDS = 44; -- + -- BORGHERTZ_S_STRIKING_HANDS = 45; -- + -- BORGHERTZ_S_HEALING_HANDS = 46; -- + -- BORGHERTZ_S_SORCEROUS_HANDS = 47; -- + -- BORGHERTZ_S_VERMILLION_HANDS = 48; -- + -- BORGHERTZ_S_SNEAKY_HANDS = 49; -- + -- BORGHERTZ_S_STALWART_HANDS = 50; -- + -- BORGHERTZ_S_SHADOWY_HANDS = 51; -- + -- BORGHERTZ_S_WILD_HANDS = 52; -- + -- BORGHERTZ_S_HARMONIOUS_HANDS = 53; -- + -- BORGHERTZ_S_CHASING_HANDS = 54; -- + -- BORGHERTZ_S_LOYAL_HANDS = 55; -- + -- BORGHERTZ_S_LURKING_HANDS = 56; -- + -- BORGHERTZ_S_DRAGON_HANDS = 57; -- + -- BORGHERTZ_S_CALLING_HANDS = 58; -- + -- AXE_THE_COMPETITION = 59; WINGS_OF_GOLD = 60; -- ± -- SCATTERED_INTO_SHADOW = 61; -- ± -- A_NEW_DAWN = 62; PAINFUL_MEMORY = 63; -- + -- THE_REQUIEM = 64; -- + -- THE_CIRCLE_OF_TIME = 65; -- + -- SEARCHING_FOR_THE_RIGHT_WORDS = 66; BEAT_AROUND_THE_BUSHIN = 67; -- + -- DUCAL_HOSPITALITY = 68; IN_THE_MOOD_FOR_LOVE = 69; EMPTY_MEMORIES = 70; HOOK_LINE_AND_SINKER = 71; A_CHOCOBO_S_TALE = 72; A_REPUTATION_IN_RUINS = 73; THE_GOBBIEBAG_PART_V = 74; -- + -- THE_GOBBIEBAG_PART_VI = 75; -- + -- BEYOND_THE_SUN = 76; UNLISTED_QUALITIES = 77; GIRL_IN_THE_LOOKING_GLASS = 78; MIRROR_MIRROR = 79; -- + -- PAST_REFLECTIONS = 80; BLIGHTED_GLOOM = 81; BLESSED_RADIANCE = 82; MIRROR_IMAGES = 83; CHAMELEON_CAPERS = 84; REGAINING_TRUST = 85; STORMS_OF_FATE = 86; MIXED_SIGNALS = 87; SHADOWS_OF_THE_DEPARTED = 88; APOCALYPSE_NIGH = 89; LURE_OF_THE_WILDCAT_JEUNO = 90; -- ± -- THE_ROAD_TO_AHT_URHGAN = 91; -- + -- CHOCOBO_ON_THE_LOOSE = 92; THE_GOBBIEBAG_PART_VII = 93; -- + -- THE_GOBBIEBAG_PART_VIII = 94; -- + -- LAKESIDE_MINUET = 95; THE_UNFINISHED_WALTZ = 96; -- ± -- THE_ROAD_TO_DIVADOM = 97; COMEBACK_QUEEN = 98; A_FURIOUS_FINALE = 99; THE_MIRACULOUS_DALE = 100; CLASH_OF_THE_COMRADES = 101; UNLOCKING_A_MYTH_WARRIOR = 102; UNLOCKING_A_MYTH_MONK = 103; UNLOCKING_A_MYTH_WHITE_MAGE = 104; UNLOCKING_A_MYTH_BLACK_MAGE = 105; UNLOCKING_A_MYTH_RED_MAGE = 106; UNLOCKING_A_MYTH_THIEF = 107; UNLOCKING_A_MYTH_PALADIN = 108; UNLOCKING_A_MYTH_DARK_KNIGHT = 109; UNLOCKING_A_MYTH_BEASTMASTER = 110; UNLOCKING_A_MYTH_BARD = 111; UNLOCKING_A_MYTH_RANGER = 112; UNLOCKING_A_MYTH_SAMURAI = 113; UNLOCKING_A_MYTH_NINJA = 114; UNLOCKING_A_MYTH_DRAGOON = 115; UNLOCKING_A_MYTH_SUMMONER = 116; UNLOCKING_A_MYTH_BLUE_MAGE = 117; UNLOCKING_A_MYTH_CORSAIR = 118; UNLOCKING_A_MYTH_PUPPETMASTER = 119; UNLOCKING_A_MYTH_DANCER = 120; UNLOCKING_A_MYTH_SCHOLAR = 121; THE_GOBBIEBAG_PART_IX = 123; -- + -- THE_GOBBIEBAG_PART_X = 124; -- + -- IN_DEFIANT_CHALLENGE = 128; -- + -- ATOP_THE_HIGHEST_MOUNTAINS = 129; -- + -- WHENCE_BLOWS_THE_WIND = 130; -- + -- RIDING_ON_THE_CLOUDS = 131; -- + -- SHATTERING_STARS = 132; -- + -- NEW_WORLDS_AWAIT = 133; EXPANDING_HORIZONS = 134; BEYOND_THE_STARS = 135; DORMANT_POWERS_DISLODGED = 136; BEYOND_INFINITY = 137; A_TRIAL_IN_TANDEM = 160; A_TRIAL_IN_TANDEM_REDUX = 161; YET_ANOTHER_TRIAL_IN_TANDEM = 162; A_QUATERNARY_TRIAL_IN_TANDEM = 163; A_TRIAL_IN_TANDEM_REVISITED = 164; ALL_IN_THE_CARDS = 166; MARTIAL_MASTERY = 167; VW_OP_115_VALKURM_DUSTER = 168; VW_OP_118_BUBURIMU_SQUALL = 169; PRELUDE_TO_PUISSANCE = 170; ----------------------------------- -- Other Areas - 4 ----------------------------------- RYCHARDE_THE_CHEF = 0; -- + -- WAY_OF_THE_COOK = 1; -- + -- UNENDING_CHASE = 2; -- + -- HIS_NAME_IS_VALGEIR = 3; -- + -- EXPERTISE = 4; -- + -- THE_CLUE = 5; -- + -- THE_BASICS = 6; -- + -- ORLANDO_S_ANTIQUES = 7; -- + -- THE_SAND_CHARM = 8; -- + -- A_POTTER_S_PREFERENCE = 9; -- + -- THE_OLD_LADY = 10; -- + -- FISHERMAN_S_HEART = 11; DONATE_TO_RECYCLING = 16; -- + -- UNDER_THE_SEA = 17; -- + -- ONLY_THE_BEST = 18; -- + -- EN_EXPLORER_S_FOOTSTEPS = 19; -- + -- CARGO = 20; -- + -- THE_GIFT = 21; -- + -- THE_REAL_GIFT = 22; -- + -- THE_RESCUE = 23; -- + -- ELDER_MEMORIES = 24; -- + -- TEST_MY_METTLE = 25; INSIDE_THE_BELLY = 26; -- ± -- TRIAL_BY_LIGHTNING = 27; -- ± -- TRIAL_SIZE_TRIAL_BY_LIGHTNING = 28; -- + -- IT_S_RAINING_MANNEQUINS = 29; RECYCLING_RODS = 30; PICTURE_PERFECT = 31; WAKING_THE_BEAST = 32; SURVIVAL_OF_THE_WISEST = 33; A_HARD_DAY_S_KNIGHT = 64; X_MARKS_THE_SPOT = 65; A_BITTER_PAST = 66; THE_CALL_OF_THE_SEA = 67; PARADISE_SALVATION_AND_MAPS = 68; GO_GO_GOBMUFFIN = 69; THE_BIG_ONE = 70; FLY_HIGH = 71; UNFORGIVEN = 72; SECRETS_OF_OVENS_LOST = 73; PETALS_FOR_PARELBRIAUX = 74; ELDERLY_PURSUITS = 75; IN_THE_NAME_OF_SCIENCE = 76; BEHIND_THE_SMILE = 77; KNOCKING_ON_FORBIDDEN_DOORS = 78; CONFESSIONS_OF_A_BELLMAKER = 79; IN_SEARCH_OF_THE_TRUTH = 80; UNINVITED_GUESTS = 81; TANGO_WITH_A_TRACKER = 82; REQUIEM_OF_SIN = 83; VW_OP_026_TAVNAZIAN_TERRORS = 84; VW_OP_004_BIBIKI_BOMBARDMENT = 85; BOMBS_AWAY = 96; MITHRAN_DELICACIES = 97; GIVE_A_MOOGLE_A_BREAK = 100; THE_MOOGLE_PICNIC = 101; MOOGLE_IN_THE_WILD = 102; MISSIONARY_MOBLIN = 103; FOR_THE_BIRDS = 104; BETTER_THE_DEMON_YOU_KNOW = 105; AN_UNDERSTANDING_OVERLORD = 106; AN_AFFABLE_ADAMANTKING = 107; A_MORAL_MANIFEST = 108; A_GENEROUS_GENERAL = 109; RECORDS_OF_EMINENCE = 110; UNITY_CONCORD = 111; ----------------------------------- -- Outlands - 5 ----------------------------------- -- Kazham (1-15) THE_FIREBLOOM_TREE = 1; GREETINGS_TO_THE_GUARDIAN = 2; -- + -- A_QUESTION_OF_TASTE = 3; EVERYONES_GRUDGING = 4; YOU_CALL_THAT_A_KNIFE = 6; MISSIONARY_MAN = 7; -- ± -- GULLIBLES_TRAVELS = 8; -- + -- EVEN_MORE_GULLIBLES_TRAVELS = 9; -- + -- PERSONAL_HYGIENE = 10; -- + -- THE_OPO_OPO_AND_I = 11; -- + -- TRIAL_BY_FIRE = 12; -- ± -- CLOAK_AND_DAGGER = 13; A_DISCERNING_EYE_KAZHAM = 14; TRIAL_SIZE_TRIAL_BY_FIRE = 15; -- + -- -- Voidwatch (100-105) VOIDWATCH_OPS_BORDER_CROSSING = 100; VW_OP_054_ELSHIMO_LIST = 101; VW_OP_101_DETOUR_TO_ZEPWELL = 102; VW_OP_115_LI_TELOR_VARIANT = 103; SKYWARD_HO_VOIDWATCHER = 104; -- Norg (128-149) THE_SAHAGINS_KEY = 128; -- ± -- FORGE_YOUR_DESTINY = 129; -- ± -- BLACK_MARKET = 130; MAMA_MIA = 131; STOP_YOUR_WHINING = 132; -- + -- TRIAL_BY_WATER = 133; -- + -- EVERYONES_GRUDGE = 134; SECRET_OF_THE_DAMP_SCROLL = 135; -- ± -- THE_SAHAGINS_STASH = 136; -- + -- ITS_NOT_YOUR_VAULT = 137; -- + -- LIKE_A_SHINING_SUBLIGAR = 138; -- + -- LIKE_A_SHINING_LEGGINGS = 139; -- + -- THE_SACRED_KATANA = 140; -- ± -- YOMI_OKURI = 141; -- ± -- A_THIEF_IN_NORG = 142; -- ± -- TWENTY_IN_PIRATE_YEARS = 143; -- ± -- I_LL_TAKE_THE_BIG_BOX = 144; -- ± -- TRUE_WILL = 145; -- ± -- THE_POTENTIAL_WITHIN = 146; BUGI_SODEN = 147; TRIAL_SIZE_TRIAL_BY_WATER = 148; -- + -- AN_UNDYING_PLEDGE = 149; -- Misc (160-165) WRATH_OF_THE_OPO_OPOS = 160; WANDERING_SOULS = 161; SOUL_SEARCHING = 162; DIVINE_MIGHT = 163; -- ± -- DIVINE_MIGHT_REPEAT = 164; -- ± -- OPEN_SESAME = 165; -- Rabao (192-201) DONT_FORGET_THE_ANTIDOTE = 192; -- ± -- THE_MISSING_PIECE = 193; -- ± -- TRIAL_BY_WIND = 194; -- ± -- THE_KUFTAL_TOUR = 195; THE_IMMORTAL_LU_SHANG = 196; -- ± -- TRIAL_SIZE_TRIAL_BY_WIND = 197; -- ± -- CHASING_DREAMS = 199; -- CoP Quest THE_SEARCH_FOR_GOLDMANE = 200; -- CoP Quest INDOMITABLE_SPIRIT = 201; -- ± -- ----------------------------------- -- Aht Urhgan - 6 ----------------------------------- KEEPING_NOTES = 0; ARTS_AND_CRAFTS = 1; OLDUUM = 2; -- + -- GOT_IT_ALL = 3; -- + -- GET_THE_PICTURE = 4; AN_EMPTY_VESSEL = 5; -- + -- LUCK_OF_THE_DRAW = 6; -- ± -- NO_STRINGS_ATTACHED = 7; -- + -- FINDING_FAULTS = 8; GIVE_PEACE_A_CHANCE = 9; THE_ART_OF_WAR = 10; na = 11; A_TASTE_OF_HONEY = 12; SUCH_SWEET_SORROW = 13; FEAR_OF_THE_DARK_II = 14; -- + -- COOK_A_ROON = 15; THE_DIE_IS_CAST = 16; TWO_HORN_THE_SAVAGE = 17; TOTOROONS_TREASURE_HUNT = 18; WHAT_FRIENDS_ARE_FOR = 19; ROCK_BOTTOM = 20; BEGINNINGS = 21; OMENS = 22; TRANSFORMATIONS = 23; EQUIPED_FOR_ALL_OCCASIONS = 24; -- + -- NAVIGATING_THE_UNFRIENDLY_SEAS = 25; -- + -- AGAINST_ALL_ODDS = 26; THE_WAYWARD_AUTOMATION = 27; OPERATION_TEATIME = 28; PUPPETMASTER_BLUES = 29; MOMENT_OF_TRUTH = 30; THREE_MEN_AND_A_CLOSET = 31; -- + -- FIVE_SECONDS_OF_FAME = 32; DELIVERING_THE_GOODS = 61; -- + -- VANISHING_ACT = 62; -- + -- STRIKING_A_BALANCE = 63; NOT_MEANT_TO_BE = 64; -- + -- LED_ASTRAY = 65; RAT_RACE = 66; -- + -- THE_PRINCE_AND_THE_HOPPER = 67; VW_OP_050_AHT_URGAN_ASSAULT = 68; VW_OP_068_SUBTERRAINEAN_SKIRMISH= 69; AN_IMPERIAL_HEIST = 70; DUTIES_TASKS_AND_DEEDS = 71; FORGING_A_NEW_MYTH = 72; COMING_FULL_CIRCLE = 73; WAKING_THE_COLLOSSUS = 74; DIVINE_INTERFERANCE = 75; THE_RIDER_COMETH = 76; UNWAVERING_RESOLVE = 77; A_STYGIAN_PACT = 78; ----------------------------------- -- Crystal War - 7 ----------------------------------- LOST_IN_TRANSLOCATION = 0; MESSAGE_ON_THE_WINDS = 1; THE_WEEKLY_ADVENTURER = 2; HEALING_HERBS = 3; REDEEMING_ROCKS = 4; THE_DAWN_OF_DELECTABILITY = 5; A_LITTLE_KNOWLEDGE = 6; -- + -- THE_FIGHTING_FOURTH = 7; SNAKE_ON_THE_PLAINS = 8; -- + -- STEAMED_RAMS = 9; -- + -- SEEING_SPOTS = 10; -- + -- THE_FLIPSIDE_OF_THINGS = 11; BETTER_PART_OF_VALOR = 12; FIRES_OF_DISCONTENT = 13; HAMMERING_HEARTS = 14; GIFTS_OF_THE_GRIFFON = 15; CLAWS_OF_THE_GRIFFON = 16; THE_TIGRESS_STIRS = 17; -- + -- THE_TIGRESS_STRIKES = 18; LIGHT_IN_THE_DARKNESS = 19; BURDEN_OF_SUSPICION = 20; EVIL_AT_THE_INLET = 21; THE_FUMBLING_FRIAR = 22; REQUIEM_FOR_THE_DEPARTED = 23; BOY_AND_THE_BEAST = 24; WRATH_OF_THE_GRIFFON = 25; THE_LOST_BOOK = 26; KNOT_QUITE_THERE = 27; A_MANIFEST_PROBLEM = 28; BEANS_AHOY = 29; -- + -- BEAST_FROM_THE_EAST = 30; THE_SWARM = 31; ON_SABBATICAL = 32; DOWNWARD_HELIX = 33; SEEING_BLOOD_RED = 34; STORM_ON_THE_HORIZON = 35; FIRE_IN_THE_HOLE = 36; PERILS_OF_THE_GRIFFON = 37; IN_A_HAZE_OF_GLORY = 38; WHEN_ONE_MAN_IS_NOT_ENOUGH = 39; A_FEAST_FOR_GNATS = 40; SAY_IT_WITH_A_HANDBAG = 41; QUELLING_THE_STORM = 42; HONOR_UNDER_FIRE = 43; THE_PRICE_OF_VALOR = 44; BONDS_THAT_NEVER_DIE = 45; THE_LONG_MARCH_NORTH = 46; THE_FORBIDDEN_PATH = 47; A_JEWELERS_LAMENT = 48; BENEATH_THE_MASK = 49; WHAT_PRICE_LOYALTY = 50; SONGBIRDS_IN_A_SNOWSTORM = 51; BLOOD_OF_HEROES = 52; SINS_OF_THE_MOTHERS = 53; HOWL_FROM_THE_HEAVENS = 54; SUCCOR_TO_THE_SIDHE = 55; THE_YOUNG_AND_THE_THREADLESS = 56; SON_AND_FATHER = 57; THE_TRUTH_LIES_HID = 58; BONDS_OF_MYTHRIL = 59; CHASING_SHADOWS = 60; FACE_OF_THE_FUTURE = 61; MANIFEST_DESTINY = 62; AT_JOURNEYS_END = 63; HER_MEMORIES_HOMECOMING_QUEEN = 64; HER_MEMORIES_OLD_BEAN = 65; HER_MEMORIES_THE_FAUX_PAS = 66; HER_MEMORIES_THE_GRAVE_RESOLVE = 67; HER_MEMORIES_OPERATION_CUPID = 68; HER_MEMORIES_CARNELIAN_FOOTFALLS = 69; HER_MEMORIES_AZURE_FOOTFALLS = 70; HER_MEMORIES_VERDURE_FOOTFALLS = 71; HER_MEMORIES_OF_MALIGN_MALADIES = 72; GUARDIAN_OF_THE_VOID = 80; DRAFTED_BY_THE_DUCHY = 81; BATTLE_ON_A_NEW_FRONT = 82; VOIDWALKER_OP_126 = 83; A_CAIT_CALLS = 84; THE_TRUTH_IS_OUT_THERE = 85; REDRAFTED_BY_THE_DUCHY = 86; A_NEW_MENACE = 87; NO_REST_FOR_THE_WEARY = 88; A_WORLD_IN_FLUX = 89; BETWEEN_A_ROCK_AND_RIFT = 90; A_FAREWELL_TO_FELINES = 91; THIRD_TOUR_OF_DUCHY = 92; GLIMMER_OF_HOPE = 93; BRACE_FOR_THE_UNKNOWN = 94; PROVENANCE = 95; CRYSTAL_GUARDIAN = 96; ENDINGS_AND_BEGINNINGS = 97; AD_INFINITUM = 98; ----------------------------------- -- Abyssea - 8 ----------------------------------- -- For some reason these did not match dat file order, -- had to adjust IDs >120 after using @addquest CATERING_CAPERS = 0; GIFT_OF_LIGHT = 1; FEAR_OF_THE_DARK_III = 2; AN_EYE_FOR_REVENGE = 3; UNBREAK_HIS_HEART = 4; EXPLOSIVE_ENDEAVORS = 5; THE_ANGLING_ARMORER = 6; WATER_OF_LIFE = 7; OUT_OF_TOUCH = 8; LOST_MEMORIES = 9; HOPE_BLOOMS_ON_THE_BATTLEFIELD = 10; OF_MALNOURISHED_MARTELLOS = 11; ROSE_ON_THE_HEATH = 12; FULL_OF_HIMSELF_ALCHEMIST = 13; THE_WALKING_WOUNDED = 14; SHADY_BUSINESS_REDUX = 15; ADDLED_MIND_UNDYING_DREAMS = 16; THE_SOUL_OF_THE_MATTER = 17; SECRET_AGENT_MAN = 18; PLAYING_PAPARAZZI = 19; HIS_BOX_HIS_BELOVED = 20; WEAPONS_NOT_WORRIES = 21; CLEANSING_THE_CANYON = 22; SAVORY_SALVATION = 23; BRINGING_DOWN_THE_MOUNTAIN = 24; A_STERLING_SPECIMEN = 25; FOR_LOVE_OF_A_DAUGHTER = 26; SISTERS_IN_CRIME = 27; WHEN_GOOD_CARDIANS_GO_BAD = 28; TANGLING_WITH_TONGUE_TWISTERS = 29; A_WARD_TO_END_ALL_WARDS = 30; THE_BOXWATCHERS_BEHEST = 31; HIS_BRIDGE_HIS_BELOVED = 32; BAD_COMMUNICATION = 33; FAMILY_TIES = 34; AQUA_PURA = 35; AQUA_PURAGA = 36; WHITHER_THE_WHISKER = 37; SCATTERED_SHELLS_SCATTERED_MIND = 38; WAYWARD_WARES = 39; LOOKING_FOR_LOOKOUTS = 40; FLOWN_THE_COOP = 41; THREADBARE_TRIBULATIONS = 42; AN_OFFER_YOU_CANT_REFUSE = 43; SOMETHING_IN_THE_AIR = 44; AN_ACRIDIDAEN_ANODYNE = 45; HAZY_PROSPECTS = 46; FOR_WANT_OF_A_POT = 47; MISSING_IN_ACTION = 48; I_DREAM_OF_FLOWERS = 49; DESTINY_ODYSSEY = 50; UNIDENTIFIED_RESEARCH_OBJECT = 51; COOKBOOK_OF_HOPE_RESTORING = 52; SMOKE_OVER_THE_COAST = 53; SOIL_AND_GREEN = 54; DROPPING_THE_BOMB = 55; WANTED_MEDICAL_SUPPLIES = 56; VOICES_FROM_BEYOND = 57; BENEVOLENCE_LOST = 58; BRUGAIRES_AMBITION = 59; CHOCOBO_PANIC = 60; THE_EGG_ENTHUSIAST = 61; GETTING_LUCKY = 62; HER_FATHERS_LEGACY = 63; THE_MYSTERIOUS_HEAD_PATROL = 64; MASTER_MISSING_MASTER_MISSED = 65; THE_PERILS_OF_KORORO = 66; LET_THERE_BE_LIGHT = 67; LOOK_OUT_BELOW = 68; HOME_HOME_ON_THE_RANGE = 69; IMPERIAL_ESPIONAGE = 70; IMPERIAL_ESPIONAGE_II = 71; BOREAL_BLOSSOMS = 72; BROTHERS_IN_ARMS = 73; SCOUTS_ASTRAY = 74; FROZEN_FLAME_REDUX = 75; SLIP_SLIDIN_AWAY = 76; CLASSROOMS_WITHOUT_BORDERS = 77; THE_SECRET_INGREDIENT = 78; HELP_NOT_WANTED = 79; THE_TITUS_TOUCH = 80; SLACKING_SUBORDINATES = 81; MOTHERLY_LOVE = 82; LOOK_TO_THE_SKY = 83; THE_UNMARKED_TOMB = 84; PROOF_OF_THE_LION = 85; BRYGID_THE_STYLIST_STRIKES_BACK = 86; DOMINION_OP_01_ALTEPA = 87; DOMINION_OP_02_ALTEPA = 88; DOMINION_OP_03_ALTEPA = 89; DOMINION_OP_04_ALTEPA = 90; DOMINION_OP_05_ALTEPA = 91; DOMINION_OP_06_ALTEPA = 92; DOMINION_OP_07_ALTEPA = 93; DOMINION_OP_08_ALTEPA = 94; DOMINION_OP_09_ALTEPA = 95; DOMINION_OP_10_ALTEPA = 96; DOMINION_OP_11_ALTEPA = 97; DOMINION_OP_12_ALTEPA = 98; DOMINION_OP_13_ALTEPA = 99; DOMINION_OP_14_ALTEPA = 100; DOMINION_OP_01_ULEGUERAND = 101; DOMINION_OP_02_ULEGUERAND = 102; DOMINION_OP_03_ULEGUERAND = 103; DOMINION_OP_04_ULEGUERAND = 104; DOMINION_OP_05_ULEGUERAND = 105; DOMINION_OP_06_ULEGUERAND = 106; DOMINION_OP_07_ULEGUERAND = 107; DOMINION_OP_08_ULEGUERAND = 108; DOMINION_OP_09_ULEGUERAND = 109; DOMINION_OP_10_ULEGUERAND = 110; DOMINION_OP_11_ULEGUERAND = 111; DOMINION_OP_12_ULEGUERAND = 112; DOMINION_OP_13_ULEGUERAND = 113; DOMINION_OP_14_ULEGUERAND = 114; DOMINION_OP_01_GRAUBERG = 115; DOMINION_OP_02_GRAUBERG = 116; DOMINION_OP_03_GRAUBERG = 117; DOMINION_OP_04_GRAUBERG = 118; DOMINION_OP_05_GRAUBERG = 119; DOMINION_OP_06_GRAUBERG = 120; DOMINION_OP_07_GRAUBERG = 121; DOMINION_OP_08_GRAUBERG = 122; DOMINION_OP_09_GRAUBERG = 123; WARD_WARDEN_I_ATTOHWA = 124; WARD_WARDEN_I_MISAREAUX = 125; WARD_WARDEN_I_VUNKERL = 126; WARD_WARDEN_II_ATTOHWA = 127; WARD_WARDEN_II_MISAREAUX = 128; WARD_WARDEN_II_VUNKERL = 129; DESERT_RAIN_I_ATTOHWA = 130; DESERT_RAIN_I_MISAREAUX = 131; DESERT_RAIN_I_VUNKERL = 132; DESERT_RAIN_II_ATTOHWA = 133; DESERT_RAIN_II_MISAREAUX = 134; DESERT_RAIN_II_VUNKERL = 135; CRIMSON_CARPET_I_ATTOHWA = 136; CRIMSON_CARPET_I_MISAREAUX = 137; CRIMSON_CARPET_I_VUNKERL = 138; CRIMSON_CARPET_II_ATTOHWA = 139; CRIMSON_CARPET_II_MISAREAUX = 140; CRIMSON_CARPET_II_VUNKERL = 141; REFUEL_AND_REPLENISH_LA_THEINE = 142; REFUEL_AND_REPLENISH_KONSCHTAT = 143; REFUEL_AND_REPLENISH_TAHRONGI = 144; REFUEL_AND_REPLENISH_ATTOHWA = 145; REFUEL_AND_REPLENISH_MISAREAUX = 146; REFUEL_AND_REPLENISH_VUNKERL = 147; REFUEL_AND_REPLENISH_ALTEPA = 148; REFUEL_AND_REPLENISH_ULEGUERAND = 149; REFUEL_AND_REPLENISH_GRAUBERG = 150; A_MIGHTIER_MARTELLO_LA_THEINE = 151; A_MIGHTIER_MARTELLO_KONSCHTAT = 152; A_MIGHTIER_MARTELLO_TAHRONGI = 153; A_MIGHTIER_MARTELLO_ATTOHWA = 154; A_MIGHTIER_MARTELLO_MISAREAUX = 155; A_MIGHTIER_MARTELLO_VUNKERL = 156; A_MIGHTIER_MARTELLO_ALTEPA = 157; A_MIGHTIER_MARTELLO_ULEGUERAND = 158; A_MIGHTIER_MARTELLO_GRAUBERG = 159; A_JOURNEY_BEGINS = 160; -- + -- THE_TRUTH_BECKONS = 161; -- + -- DAWN_OF_DEATH = 162; A_GOLDSTRUCK_GIGAS = 163; TO_PASTE_A_PEISTE = 164; MEGADRILE_MENACE = 165; THE_FORBIDDEN_FRONTIER = 166; FIRST_CONTACT = 167; AN_OFFICER_AND_A_PIRATE = 168; HEART_OF_MADNESS = 169; TENUOUS_EXISTENCE = 170; CHAMPIONS_OF_ABYSSEA = 171; THE_BEAST_OF_BASTORE = 172; A_DELECTABLE_DEMON = 173; A_FLUTTERY_FIEND = 174; SCARS_OF_ABYSSEA = 175; A_BEAKED_BLUSTERER = 176; A_MAN_EATING_MITE = 177; AN_ULCEROUS_URAGNITE = 178; HEROES_OF_ABYSSEA = 179; A_SEA_DOGS_SUMMONS = 180; DEATH_AND_REBIRTH = 181; EMISSARIES_OF_GOD = 182; BENEATH_A_BLOOD_RED_SKY = 183; THE_WYRM_GOD = 184; MEANWHILE_BACK_ON_ABYSSEA = 185; A_MOONLIGHT_REQUITE = 186; DOMINION_OP_10_GRAUBERG = 187; DOMINION_OP_11_GRAUBERG = 188; DOMINION_OP_12_GRAUBERG = 189; DOMINION_OP_13_GRAUBERG = 190; DOMINION_OP_14_GRAUBERG = 191; ----------------------------------- -- Adoulin - 9 ----------------------------------- -- These also do not match the DAT file order, had -- discrepencies and swapped orders from the start. TWITHERYM_DUST = 0; TO_CATCH_A_PREDATOR = 1; EMPTY_NEST = 2; DONT_CLAM_UP_ON_ME_NOW = 5; HOP_TO_IT = 6; BOILING_OVER = 9; POISONING_THE_WELL = 10; UNSULLIED_LANDS = 12; NO_RIME_LIKE_THE_PRESENT = 16; A_GEOTHERMAL_EXPEDITION = 18; ENDEAVORING_TO_AWAKEN = 22; FORGING_NEW_BONDS = 23; LEGACIES_LOST_AND_FOUND = 24; DESTINYS_DEVICE = 25; GRANDDADDY_DEAREST = 26; WAYWARD_WAYPOINTS = 27; ONE_GOOD_TURN = 28; FAILURE_IS_NOT_AN_OPTION = 29; ORDER_UP = 30; IT_NEVER_GOES_OUT_OF_STYLE = 31; WATER_WATER_EVERYWHERE = 32; DIRT_CHEAP = 33; FLOWER_POWER = 34; ELEMENTARY_MY_DEAR_SYLVIE = 35; FOR_WHOM_THE_BELL_TOLLS = 36; THE_BLOODLINE_OF_ZACARIAH = 37; THE_COMMUNION = 38; FLAVORS_OF_OUR_LIVES = 46; WESTERN_WAYPOINTS_HO = 50; WESEASTERN_WAYPOINTS_HO = 51; GRIND_TO_SAWDUST = 53; BREAKING_THE_ICE = 54; IM_ON_A_BOAT = 55; A_STONES_THROW_AWAY = 56; HIDE_AND_GO_PEAK = 57; THE_WHOLE_PLACE_IS_ABUZZ = 58; OROBON_APPETIT = 59; TALK_ABOUT_WRINKLY_SKIN = 60; NO_LOVE_LOST = 61; DID_YOU_FEEL_THAT = 62; DONT_EVER_LEAF_ME = 70; KEEP_YOUR_BLOOMERS_ON_ERISA = 71; SCAREDYCATS = 72; RAPTOR_RAPTURE = 73; EXOTIC_DELICACIES = 74; -- + -- A_PIONEERS_BEST_IMAGINARY_FRIEND= 75; -- + -- HUNGER_STRIKES = 76; -- + -- THE_OLD_MAN_AND_THE_HARPOON = 77; -- + -- A_CERTAIN_SUBSTITUTE_PATROLMAN = 78; -- + -- IT_SETS_MY_HEART_AFLUTTER = 79; TRANSPORTING = 82; THE_STARVING = 84; -- + -- FERTILE_GROUND = 85; ALWAYS_MORE_QUOTH_THE_RAVENOUS = 88; -- + -- MEGALOMANIAC = 89; THE_LONGEST_WAY_ROUND = 91; A_GOOD_PAIR_OF_CROCS = 93; CAFETERIA = 94; A_SHOT_IN_THE_DARK = 96; OPEN_THE_FLOODGATES = 100; NO_LAUGHING_MATTER = 102; ALL_THE_WAY_TO_THE_BANK = 103; TO_LAUGH_IS_TO_LOVE = 104; A_BARREL_OF_LAUGHS = 105; VEGETABLE_VEGETABLE_REVOLUTION = 108; VEGETABLE_VEGETABLE_EVOLUTION = 109; VEGETABLE_VEGETABLE_CRISIS = 110; VEGETABLE_VEGETABLE_FRUSTRATION = 111; A_THIRST_FOR_THE_AGES = 114; A_THIRST_FOR_THE_EONS = 115; A_THIRST_FOR_ETERNITY = 116; A_THIRST_BEFORE_TIME = 117; DANCES_WITH_LUOPANS = 118; CHILDREN_OF_THE_RUNE = 119; FLOWERS_FOR_SVENJA = 120; THORN_IN_THE_SIDE = 121; DO_NOT_GO_INTO_THE_LIGHT = 122; VELKKOVERT_OPERATIONS = 123; HYPOCRITICAL_OATH = 124; THE_GOOD_THE_BAD_THE_CLEMENT = 125; LERENES_LAMENT = 126; THE_SECRET_TO_SUCCESS = 127; NO_MERCY_FOR_THE_WICKED = 128; MISTRESS_OF_CEREMONIES = 129; SAVED_BY_THE_BELL = 131; QUIESCENCE = 132; SICK_AND_TIRED = 133; GEOMANCERRIFIC = 134; RUNE_FENCING_THE_NIGHT_AWAY = 135; THE_WEATHERSPOON_INQUISITION = 136; EYE_OF_THE_BEHOLDER = 137; THE_CURIOUS_CASE_OF_MELVIEN = 138; NOTSOCLEAN_BILL = 139; IN_THE_LAND_OF_THE_BLIND = 140; THE_WEATHERSPOON_WAR = 141; TREASURES_OF_THE_EARTH = 142; EPIPHANY = 143; ----------------------------------- -- Coalition - 10 ----------------------------------- -- Also slightly incongruent with DAT file order PROCURE_CEIZAK_BATTLEGROUNDS = 0; PROCURE_FORET_DE_HENNETIEL = 1; PROCURE_MORIMAR_BASALT_FIELDS = 2; PROCURE_YORCIA_WEALD = 3; PROCURE_MARJAMI_RAVINE = 4; PROCURE_KAMIHR_DRIFTS = 5; PROCURE_CIRDAS_CAVERNS = 6; PROCURE_OUTER_RAKAZNAR = 7; CLEAR_CEIZAK_BATTLEGROUNDS = 8; CLEAR_FORET_DE_HENNETIEL = 9; CLEAR_MORIMAR_BASALT_FIELDS = 10; CLEAR_YORCIA_WEALD = 11; CLEAR_MARJAMI_RAVINE = 12; CLEAR_KAMIHR_DRIFTS = 13; CLEAR_CIRDAS_CAVERNS = 14; CLEAR_OUTER_RAKAZNAR = 15; PROVIDE_FORET_DE_HENNETIEL = 16; PROVIDE_MORIMAR_BASALT_FIELDS = 17; PROVIDE_YORCIA_WEALD = 18; PROVIDE_MARJAMI_RAVINE = 19; PROVIDE_KAMIHR_DRIFTS = 20; DELIVER_FORET_DE_HENNETIEL = 21; DELIVER_MORIMAR_BASALT_FIELDS = 22; DELIVER_YORCIA_WEALD = 23; DELIVER_MARJAMI_RAVINE = 24; DELIVER_KAMIHR_DRIFTS = 25; SUPPORT_CEIZAK_BATTLEGROUNDS = 26; SUPPORT_FORET_DE_HENNETIEL = 27; SUPPORT_MORIMAR_BASALT_FIELDS = 28; SUPPORT_YORCIA_WEALD = 29; SUPPORT_MARJAMI_RAVINE = 30; SUPPORT_KAMIHR_DRIFTS = 31; GATHER_RALA_WATERWAYS = 32; GATHER_CEIZAK_BATTLEGROUNDS = 33; GATHER_YAHSE_HUNTING_GROUNDS = 34; GATHER_FORET_DE_HENNETIEL = 35; GATHER_MORIMAR_BASALT_FIELDS = 36; GATHER_YORCIA_WEALD = 37; GATHER_MARJAMI_RAVINE = 38; GATHER_KAMIHR_DRIFTS = 39; GATHER_SIH_GATES = 40; GATHER_MOH_GATES = 41; GATHER_CIRDAS_CAVERNS = 42; GATHER_DHO_GATES = 43; GATHER_WOH_GATES = 44; GATHER_OUTER_RAKAZNAR = 45; GATHER_RAKAZNAR_INNER_COURT = 46; -- GATHER = 47; -- Blank Gather: assignment SURVEY_CEIZAK_BATTLEGROUNDS = 48; SURVEY_FORET_DE_HENNETIEL = 49; SURVEY_MORIMAR_BASALT_FIELDS = 50; SURVEY_YORCIA_WEALD = 51; SURVEY_MARJAMI_RAVINE = 52; SURVEY_KAMIHR_DRIFTS = 53; SURVEY_SIH_GATES = 54; SURVEY_CIRDAS_CAVERNS = 55; SURVEY_DHO_GATES = 56; ANALYZE_FORET_DE_HENNETIEL = 57; ANALYZE_MORIMAR_BASALT_FIELDS = 58; ANALYZE_YORCIA_WEALD = 59; ANALYZE_MARJAMI_RAVINE = 60; ANALYZE_KAMIHR_DRIFTS = 61; ANALYZE_CIRDAS_CAVERNS = 62; ANALYZE_OUTER_RAKAZNAR = 63; PRESERVE_CEIZAK_BATTLEGROUNDS = 64; PRESERVE_YAHSE_HUNTING_GROUNDS = 65; PRESERVE_FORET_DE_HENNETIEL = 66; PRESERVE_MORIMAR_BASALT_FIELDS = 67; PRESERVE_YORCIA_WEALD = 68; PRESERVE_MARJAMI_RAVINE = 69; PRESERVE_KAMIHR_DRIFTS = 70; PRESERVE_CIRDAS_CAVERNS = 71; PRESERVE_OUTER_RAKAZNAR = 72; PATROL_RALA_WATERWAYS = 73; PATROL_SIH_GATES = 74; PATROL_MOH_GATES = 75; PATROL_CIRDAS_CAVERNS = 76; PATROL_DHO_GATES = 77; PATROL_WOH_GATES = 78; PATROL_OUTER_RAKAZNAR = 79; RECOVER_CEIZAK_BATTLEGROUNDS = 80; RECOVER_FORET_DE_HENNETIEL = 81; RECOVER_MORIMAR_BASALT_FIELDS = 82; RECOVER_YORCIA_WEALD = 83; RECOVER_MARJAMI_RAVINE = 84; RECOVER_KAMIHR_DRIFTS = 85; RESEARCH_RALA_WATERWAYS = 86; RESEARCH_CEIZAK_BATTLEGROUNDS = 87; RESEARCH_FORET_DE_HENNETIEL = 88; RESEARCH_MORIMAR_BASALT_FIELDS = 89; RESEARCH_YORCIA_WEALD = 90; RESEARCH_MARJAMI_RAVINE = 91; RESEARCH_KAMIHR_DRIFTS = 92; BOOST_FORET_DE_HENNETIEL = 93; BOOST_MARJAMI_RAVINE = 94; BOOST_KAMIHR_DRIFTS = 95;
gpl-3.0
LegionXI/darkstar
scripts/zones/Kazham/npcs/Vah_Keshura.lua
17
1073
----------------------------------- -- Area: Kazham -- NPC: Vah Keshura -- Standard Info NPC ----------------------------------- package.loaded["scripts/zones/Kazham/TextIDs"] = nil; require("scripts/zones/Kazham/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getVar("BathedInScent") == 1) then player:startEvent(0x00BB); -- scent from Blue Rafflesias else player:startEvent(0x007C); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Port_Jeuno/npcs/Imasuke.lua
10
3143
----------------------------------- -- Area: Port Jeuno -- NPC: Imasuke -- Starts and Finishes Quest: The Antique Collector -- @zone 246 -- @pos -165 11 94 ----------------------------------- package.loaded["scripts/zones/Port_Jeuno/TextIDs"] = nil; package.loaded["scripts/globals/settings"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Port_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(JEUNO,THE_ANTIQUE_COLLECTOR) == QUEST_ACCEPTED and trade:hasItemQty(16631,1) == true and trade:getItemCount() == 1) then player:startEvent(0x000f); -- End quest end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) TheAntiqueCollector = player:getQuestStatus(JEUNO,THE_ANTIQUE_COLLECTOR); local circleOfTime = player:getQuestStatus(JEUNO,THE_CIRCLE_OF_TIME); if (circleOfTime == QUEST_ACCEPTED) then if (player:getVar("circleTime") == 1) then player:startEvent(0x1E); elseif(player:getVar("circleTime") == 2) then player:startEvent(0x1D); elseif (player:getVar("circleTime") == 3) then player:startEvent(0x20); elseif (player:getVar("circleTime") == 4) then player:startEvent(0x21); elseif (player:getVar("circleTime") == 5) then player:startEvent(0x1F); end elseif(player:getFameLevel(JEUNO) >= 3 and TheAntiqueCollector == QUEST_AVAILABLE) then player:startEvent(0x000d); -- Start quest elseif(TheAntiqueCollector == QUEST_ACCEPTED) then player:startEvent(0x000e); -- Mid CS else player:startEvent(0x000c); -- Standard dialog end --end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x000d and option == 1) then player:addQuest(JEUNO,THE_ANTIQUE_COLLECTOR); elseif(csid == 0x000f) then player:addTitle(TRADER_OF_ANTIQUITIES); if(player:hasKeyItem(MAP_OF_DELKFUTTS_TOWER) == false) then player:addKeyItem(MAP_OF_DELKFUTTS_TOWER); player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_DELKFUTTS_TOWER); end player:addFame(JEUNO, JEUNO_FAME*30); player:tradeComplete(trade); player:completeQuest(JEUNO,THE_ANTIQUE_COLLECTOR); elseif(csid == 0x1D and option == 1) then player:setVar("circleTime",3); elseif(csid == 0x1E and option == 1) then player:setVar("circleTime",3); elseif(csid == 0x1E and option == 0) then player:setVar("circleTime",2); elseif (csid == 0x21) then player:setVar("circleTime",5); end end;
gpl-3.0
ibm2431/darkstar
scripts/globals/items/chunk_of_orobon_meat.lua
11
1339
----------------------------------------- -- ID: 5563 -- Item: Chunk of Orobon Meat -- Effect: 5 Minutes, food effect, Galka Only ----------------------------------------- -- HP 10 -- MP -10 -- Strength +6 -- Intelligence -8 -- Demon Killer 10 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if (target:getRace() ~= dsp.race.GALKA) then result = dsp.msg.basic.CANNOT_EAT end if (target:getMod(dsp.mod.EAT_RAW_MEAT) == 1) then result = 0 end if target:hasStatusEffect(dsp.effect.FOOD) or target:hasStatusEffect(dsp.effect.FIELD_SUPPORT_FOOD) then result = dsp.msg.basic.IS_FULL end return result end function onItemUse(target) target:addStatusEffect(dsp.effect.FOOD,0,0,300,5563) end function onEffectGain(target,effect) target:addMod(dsp.mod.HP, 10) target:addMod(dsp.mod.MP, -10) target:addMod(dsp.mod.STR, 6) target:addMod(dsp.mod.INT, -8) target:addMod(dsp.mod.DEMON_KILLER, 10) end function onEffectLose(target,effect) target:delMod(dsp.mod.HP, 10) target:delMod(dsp.mod.MP, -10) target:delMod(dsp.mod.STR, 6) target:delMod(dsp.mod.INT, -8) target:delMod(dsp.mod.DEMON_KILLER, 10) end
gpl-3.0
ibm2431/darkstar
scripts/globals/weaponskills/seraph_blade.lua
10
1346
----------------------------------- -- Seraph Blade -- Sword weapon skill -- Skill Level: 125 -- Deals light elemental damage to enemy. Damage varies with TP. -- Ignores shadows. -- Aligned with the Soil Gorget. -- Aligned with the Soil Belt. -- Element: Light -- Modifiers: STR:40% MND:40% -- 100%TP 200%TP 300%TP -- 1.125 2.625 4.125 ----------------------------------- require("scripts/globals/magic") require("scripts/globals/status") require("scripts/globals/settings") require("scripts/globals/weaponskills") ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {} params.ftp100 = 1 params.ftp200 = 2.5 params.ftp300 = 3 params.str_wsc = 0.3 params.dex_wsc = 0.0 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.3 params.chr_wsc = 0.0 params.ele = dsp.magic.ele.LIGHT params.skill = dsp.skill.SWORD params.includemab = true if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.ftp100 = 1.125 params.ftp200 = 2.625 params.ftp300 = 4.125 params.str_wsc = 0.4 params.mnd_wsc = 0.4 end local damage, criticalHit, tpHits, extraHits = doMagicWeaponskill(player, target, wsID, params, tp, action, primary) return tpHits, extraHits, criticalHit, damage end
gpl-3.0
srijan/ntopng
scripts/lua/modules/graph_utils.lua
1
12796
-- -- (C) 2013 - ntop.org -- function breakdownBar(sent, sentLabel, rcvd, rcvdLabel) if((sent+rcvd) > 0) then sent2rcvd = round((sent * 100) / (sent+rcvd), 0) print('<div class="progress"><div class="bar bar-warning" style="width: ' .. sent2rcvd.. '%;">'..sentLabel) print('</div><div class="bar bar-info" style="width: ' .. (100-sent2rcvd) .. '%;">' .. rcvdLabel .. '</div></div>') else print('&nbsp;') end end function percentageBar(total, value, valueLabel) if(total > 0) then pctg = round((value * 100) / total, 0) print('<div class="progress"><div class="bar bar-warning" style="width: ' .. pctg.. '%;">'..valueLabel) print('</div></div>') else print('&nbsp;') end end function drawRRD(ifname, host, rrdFile, zoomLevel, baseurl, show_timeseries, selectedEpoch, xInfoURL) dirs = ntop.getDirs() rrdname = fixPath(dirs.workingdir .. "/" .. purifyInterfaceName(ifname) .. "/rrd/") names = {} series = {} vals = { { "5m", "now-300s", 60*5 }, { "10m", "now-600s", 60*10 }, { "1h", "now-1h", 60*60*1 }, { "3h", "now-3h", 60*60*3 }, { "6h", "now-6h", 60*60*6 }, { "12h", "now-12h", 60*60*12 }, { "1d", "now-1d", 60*60*24 }, { "1w", "now-1w", 60*60*24*7 }, { "2w", "now-2w", 60*60*24*14 }, { "1m", "now-1mon", 60*60*24*31 }, { "6m", "now-6mon", 60*60*24*31*6 }, { "1y", "now-1y", 60*60*24*366 } } if(host ~= nil) then rrdname = rrdname .. host .. "/" end rrdname = rrdname .. rrdFile if(zoomLevel == nil) then zoomLevel = "1h" end nextZoomLevel = zoomLevel; epoch = tonumber(selectedEpoch); for k,v in ipairs(vals) do if(vals[k][1] == zoomLevel) then if (k > 1) then nextZoomLevel = vals[k-1][1] end if (epoch) then start_time = epoch - vals[k][3]/2 end_time = epoch + vals[k][3]/2 else start_time = vals[k][2] end_time = "now" end end end local maxval_bits_time = 0 local maxval_bits = 0 local minval_bits = 0 local minval_bits_time = 0 local lastval_bits = 0 local lastval_bits_time = 0 local total_bytes = 0 local num_points = 0 local step = 1 prefixLabel = l4Label(string.gsub(rrdFile, ".rrd", "")) if(prefixLabel == "bytes") then prefixLabel = "Traffic" end if(ntop.exists(rrdname)) then -- print("=> Found ".. start_time .. "|" .. end_time .. "\n") local fstart, fstep, fnames, fdata = ntop.rrd_fetch(rrdname, '--start', start_time, '--end', end_time, 'AVERAGE') --print("=> here we gho") local max_num_points = 600 -- This is to avoid having too many points and thus a fat graph local num_points_found = table.getn(fdata) local sample_rate = round(num_points_found / max_num_points) if(sample_rate < 1) then sample_rate = 1 end step = fstep num = 0 for i, n in ipairs(fnames) do names[num] = prefixLabel if(prefixLabel ~= firstToUpper(n)) then names[num] = names[num] .. " " .. firstToUpper(n) end num = num + 1 -- print(num.."\n") end id = 0 fend = 0 sampling = 0 sample_rate = sample_rate-1 for i, v in ipairs(fdata) do s = {} s[0] = fstart + (i-1)*fstep num_points = num_points + 1 local elemId = 1 for _, w in ipairs(v) do if(w ~= w) then -- This is a NaN v = 0 else v = tonumber(w) if(v < 0) then v = 0 end end if(v > 0) then lastval_bits_time = s[0] lastval_bits = v end s[elemId] = v*8 -- bps elemId = elemId + 1 end total_bytes = total_bytes + v*fstep --print(" | " .. (v*fstep) .." |\n") if(sampling == sample_rate) then series[id] = s id = id + 1 sampling = 0 else sampling = sampling + 1 end end for key, value in pairs(series) do local t = 0 for elemId=0,(num-1) do -- print(">"..value[elemId+1].. "<") t = t + value[elemId+1] -- bps end t = t * step if((minval_bits_time == 0) or (minval_bits >= t)) then minval_bits_time = value[0] minval_bits = t end if((maxval_bits_time == 0) or (maxval_bits <= t)) then maxval_bits_time = value[0] maxval_bits = t end end print [[ <style> #chart_container { display: inline-block; font-family: Arial, Helvetica, sans-serif; } #chart { float: left; } #legend { float: left; margin-left: 15px; color: black; background: white; } #y_axis { float: left; width: 40px; } </style> <div> ]] if(show_timeseries == 1) then print [[ <div class="btn-group"> <button class="btn btn-small dropdown-toggle" data-toggle="dropdown">Timeseries <span class="caret"></span></button> <ul class="dropdown-menu"> ]] print('<li><a href="'..baseurl .. '&rrd_file=' .. "bytes.rrd" .. '&graph_zoom=' .. zoomLevel .. '&epoch=' .. (selectedEpoch or '') .. '">'.. "Traffic" ..'</a></li>\n') print('<li class="divider"></li>\n') dirs = ntop.getDirs() rrds = ntop.readdir(fixPath(dirs.workingdir .. "/" .. ifname .. "/rrd/" .. host)) for k,v in pairsByKeys(rrds, asc) do proto = string.gsub(rrds[k], ".rrd", "") if(proto ~= "bytes") then label = l4Label(proto) print('<li><a href="'..baseurl .. '&rrd_file=' .. rrds[k] .. '&graph_zoom=' .. zoomLevel .. '&epoch=' .. (selectedEpoch or '') .. '">'.. label ..'</a></li>\n') end end print [[ </ul> </div><!-- /btn-group --> ]] end print('&nbsp;Timeframe: <div class="btn-group" data-toggle="buttons-radio" id="graph_zoom">\n') for k,v in ipairs(vals) do print('<a class="btn btn-small ') if(vals[k][1] == zoomLevel) then print("active") end print('" href="'..baseurl .. '&rrd_file=' .. rrdFile .. '&graph_zoom=' .. vals[k][1] .. '&epoch=' .. (selectedEpoch or '') ..'">'.. vals[k][1] ..'</a>\n') end print [[ </div> </div> <br /> <p> <div style="margin-left: 10px"> <div id="chart_container"> <p><font color=lightgray><small>NOTE: Click on the graph to zoom.</small></font> <div id="y_axis"></div> <div id="chart" style="margin-right: 10px"></div> <table style="border: 0"> <tr><td><div id="legend"></div></td><td><div id="chart_legend"></div></td></tr> <tr><td colspan=2> <table class="table table-bordered table-striped"> ]] print(' <tr><th>' .. prefixLabel .. '</th><th>Time</th><th>Value</th></tr>\n') print(' <tr><th>Min</th><td>' .. os.date("%x %X", minval_bits_time) .. '</td><td>' .. bitsToSize(minval_bits/step) .. '</td></tr>\n') print(' <tr><th>Max</th><td>' .. os.date("%x %X", maxval_bits_time) .. '</td><td>' .. bitsToSize(maxval_bits/step) .. '</td></tr>\n') print(' <tr><th>Last</th><td>' .. os.date("%x %X", last_time) .. '</td><td>' .. bitsToSize(lastval_bits/step) .. '</td></tr>\n') print(' <tr><th>Average</th><td colspan=2>' .. bitsToSize(total_bytes*8/(step*num_points)) .. '</td></tr>\n') print(' <tr><th>Total Traffic</th><td colspan=2>' .. bytesToSize(total_bytes).. '</td></tr>\n') print(' <tr><th>Selection Time</th><td colspan=2><div id=when></div></td></tr>\n') print(' <tr><th>Minute<br>Top Talkers</th><td colspan=2><div id=talkers></div></td></tr>\n') print [[ </table> </td></tr> </table> </div> </div> <script> var palette = new Rickshaw.Color.Palette(); var graph = new Rickshaw.Graph( { element: document.getElementById("chart"), width: 600, height: 300, renderer: 'area', series: [ ]] if(names ~= nil) then for elemId=0,(num-1) do if(elemId > 0) then print "," end print ("{\nname: '".. names[elemId] .. "',\n") print("color: palette.color(),\ndata: [\n") n = 0 for key, value in pairs(series) do if(n > 0) then print(",\n") end print ("\t{ x: ".. value[0] .. ", y: ".. value[elemId+1] .. " }") n = n + 1 end print("\n]}\n") end end print [[ ] } ); graph.render(); var chart_legend = document.querySelector('#chart_legend'); function fdate(when) { var epoch = when*1000; var d = new Date(epoch); return(d); } function fbits(bits) { var sizes = ['bps', 'Kbit', 'Mbit', 'Gbit', 'Tbit']; if (bits == 0) return 'n/a'; var i = parseInt(Math.floor(Math.log(bits) / Math.log(1024))); return Math.round(bits / Math.pow(1024, i), 2) + ' ' + sizes[i]; } function capitaliseFirstLetter(string) { return string.charAt(0).toUpperCase() + string.slice(1); } /** * Convert number of bytes into human readable format * * @param integer bytes Number of bytes to convert * @param integer precision Number of digits after the decimal separator * @return string */ function formatBytes(bytes, precision) { var kilobyte = 1024; var megabyte = kilobyte * 1024; var gigabyte = megabyte * 1024; var terabyte = gigabyte * 1024; if ((bytes >= 0) && (bytes < kilobyte)) { return bytes + ' B'; } else if ((bytes >= kilobyte) && (bytes < megabyte)) { return (bytes / kilobyte).toFixed(precision) + ' KB'; } else if ((bytes >= megabyte) && (bytes < gigabyte)) { return (bytes / megabyte).toFixed(precision) + ' MB'; } else if ((bytes >= gigabyte) && (bytes < terabyte)) { return (bytes / gigabyte).toFixed(precision) + ' GB'; } else if (bytes >= terabyte) { return (bytes / terabyte).toFixed(precision) + ' TB'; } else { return bytes + ' B'; } } var Hover = Rickshaw.Class.create(Rickshaw.Graph.HoverDetail, { graph: graph, xFormatter: function(x) { return new Date( x * 1000 ); }, yFormatter: function(bits) { return(fbits(bits)); }, render: function(args) { var graph = this.graph; var points = args.points; var point = points.filter( function(p) { return p.active } ).shift(); if (point.value.y === null) return; var formattedXValue = fdate(point.value.x); // point.formattedXValue; var formattedYValue = fbits(point.value.y); // point.formattedYValue; var infoHTML = ""; ]] if (xInfoURL) then print [[ $.ajax({ type: 'GET', url: ']] print(xInfoURL) print [[', data: { epoch: point.value.x }, async: false, success: function(content) { var info = jQuery.parseJSON(content); infoHTML += "<ul>"; $.each(info, function(i, n) { infoHTML += "<li>"+capitaliseFirstLetter(i)+" [Avg Traffic/sec]<ol>"; var items = 0; $.each(n, function(j, m) { if (items < 3) infoHTML += "<li><a href='host_details.lua?host="+m.label+"'>"+m.label+"</a> ("+fbits((m.value*8)/60)+")</li>"; items++; }); infoHTML += "</ol></li>"; }); infoHTML += "</ul>"; } }); ]] end print [[ this.element.innerHTML = ''; this.element.style.left = graph.x(point.value.x) + 'px'; /*var xLabel = document.createElement('div'); xLabel.setAttribute("style", "opacity: 0.5; background-color: #EEEEEE; filter: alpha(opacity=0.5)"); xLabel.className = 'x_label'; xLabel.innerHTML = formattedXValue + infoHTML; this.element.appendChild(xLabel); */ $('#when').html(formattedXValue); $('#talkers').html(infoHTML); var item = document.createElement('div'); item.className = 'item'; item.innerHTML = this.formatter(point.series, point.value.x, point.value.y, formattedXValue, formattedYValue, point); item.style.top = this.graph.y(point.value.y0 + point.value.y) + 'px'; this.element.appendChild(item); var dot = document.createElement('div'); dot.className = 'dot'; dot.style.top = item.style.top; dot.style.borderColor = point.series.color; this.element.appendChild(dot); if (point.active) { item.className = 'item active'; dot.className = 'dot active'; } this.show(); if (typeof this.onRender == 'function') { this.onRender(args); } // Put the selected graph epoch into the legend //chart_legend.innerHTML = point.value.x; // Epoch this.selected_epoch = point.value.x; event } } ); var hover = new Hover( { graph: graph } ); var legend = new Rickshaw.Graph.Legend( { graph: graph, element: document.getElementById('legend') } ); //var axes = new Rickshaw.Graph.Axis.Time( { graph: graph } ); axes.render(); var yAxis = new Rickshaw.Graph.Axis.Y({ graph: graph, tickFormat: Rickshaw.Fixtures.Number.formatKMBT }); yAxis.render(); $("#chart").click(function() { if (hover.selected_epoch) window.location.href = ']] print(baseurl .. '&rrd_file=' .. rrdFile .. '&graph_zoom=' .. nextZoomLevel .. '&epoch=') print[['+hover.selected_epoch; }); </script> ]] else print("<div class=\"alert alert-error\"><img src=/img/warning.png> This archive file cannot be found</div>") end end
gpl-3.0
ibm2431/darkstar
scripts/zones/Metalworks/npcs/Ayame.lua
9
2541
----------------------------------- -- Area: Metalworks -- NPC: Ayame -- Involved in Missions -- Starts and Finishes Quest: True Strength -- !pos 133 -19 34 237 ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/titles"); require("scripts/globals/keyitems"); require("scripts/globals/missions"); require("scripts/globals/quests"); local ID = require("scripts/zones/Metalworks/IDs"); ----------------------------------- function onTrade(player,npc,trade) if (player:getQuestStatus(BASTOK,dsp.quest.id.bastok.TRUE_STRENGTH) == QUEST_ACCEPTED) then if (trade:hasItemQty(1100,1) and trade:getItemCount() == 1) then -- Trade Xalmo Feather player:startEvent(749); -- Finish Quest "True Strength" end end end; function onTrigger(player,npc) local trueStrength = player:getQuestStatus(BASTOK,dsp.quest.id.bastok.TRUE_STRENGTH); local WildcatBastok = player:getCharVar("WildcatBastok"); if (player:getQuestStatus(BASTOK,dsp.quest.id.bastok.LURE_OF_THE_WILDCAT) == QUEST_ACCEPTED and player:getMaskBit(WildcatBastok,9) == false) then player:startEvent(935); elseif (player:getCurrentMission(BASTOK) == dsp.mission.id.bastok.THE_CRYSTAL_LINE and player:hasKeyItem(dsp.ki.C_L_REPORTS)) then player:startEvent(712); elseif (trueStrength == QUEST_AVAILABLE and player:getMainJob() == dsp.job.MNK and player:getMainLvl() >= 50) then player:startEvent(748); -- Start Quest "True Strength" else player:startEvent(701); -- Standard dialog end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 712) then finishMissionTimeline(player,1,csid,option); elseif (csid == 748) then player:addQuest(BASTOK,dsp.quest.id.bastok.TRUE_STRENGTH); elseif (csid == 749) then if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ID.text.ITEM_CANNOT_BE_OBTAINED,14215); -- Temple Hose else player:tradeComplete(); player:addTitle(dsp.title.PARAGON_OF_MONK_EXCELLENCE); player:addItem(14215); player:messageSpecial(ID.text.ITEM_OBTAINED,14215); -- Temple Hose player:addFame(BASTOK,60); player:completeQuest(BASTOK,dsp.quest.id.bastok.TRUE_STRENGTH); end elseif (csid == 935) then player:setMaskBit(player:getCharVar("WildcatBastok"),"WildcatBastok",9,true); end end;
gpl-3.0
greasydeal/darkstar
scripts/globals/items/san_dorian_carrot.lua
35
1200
----------------------------------------- -- ID: 4389 -- Item: san_dorian_carrot -- Food Effect: 5Min, All Races ----------------------------------------- -- Agility 2 -- Vitality -4 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,4389); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_AGI, 2); target:addMod(MOD_VIT, -4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_AGI, 2); target:delMod(MOD_VIT, -4); end;
gpl-3.0
LegionXI/darkstar
scripts/zones/Aydeewa_Subterrane/mobs/Pandemonium_Warden.lua
12
11865
----------------------------------- -- Area: Aydeewa Subterrane -- ZNM: Pandemonium_Warden ----------------------------------- require("scripts/globals/titles"); require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------- -- onMobInitialize Action ----------------------------------- function onMobInitialize(mob) end; ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) -- Make sure model is reset back to start mob:setModelId(1839); -- Two hours to forced depop mob:setLocalVar("PWardenDespawnTime", os.time(t) + 7200); end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) -- pop pets for i = 17056170, 17056177, 1 do SpawnMob(i):updateEnmity(target); GetMobByID(i):setModelId(1841); end end; ----------------------------------- -- onMobFight ----------------------------------- function onMobFight(mob,target) local depopTime = mob:getLocalVar("PWardenDespawnTime"); local mobHPP = mob:getHPP(); local change = mob:getLocalVar("change"); local petIDs = {17056170,17056171,17056172,17056173,17056174,17056175,17056176,17056177}; local petStatus = {GetMobAction(petIDs[1]),GetMobAction(petIDs[2]),GetMobAction(petIDs[3]),GetMobAction(petIDs[4]),GetMobAction(petIDs[5]),GetMobAction(petIDs[6]),GetMobAction(petIDs[7]),GetMobAction(petIDs[8])}; local TP = mob:getLocalVar("TP"); ------------------------ Notes ------------------------ -- I can't help but think this could be better executed with a single set of logic checks and a table of HP and skin values. -- Just the same, at least his pets respawn every form, and he doesn't get stuck. -- There are two sets of PW in the mobids. It's entirely possible SE did this fight by swapping between the two somehow. -- Some sources claim he should linger in Dverger form and throw off a few TP moves between forms. -- Should end up in "mini-dverger" form at the end. -- Using custom mobskill scripts so we don't clutter up existing scritps with a bunch of onMobSkillChecks. ------------------------ FORM CHANGES ------------------------ if (mobHPP <= 15 and change == 13) then -- Final Form, pets take Dvger form as well mob:setModelId(1839); mob:setLocalVar("change", 14); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1840); end elseif (mobHPP <= 26 and change == 12) then -- Khim and Co. mob:setModelId(1805); mob:setLocalVar("change", 13); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1746); end; elseif (mobHPP <= 28 and change == 11) then -- Normal Form mob:setModelId(1839); mob:setLocalVar("change", 12); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1841); end if (TP <= 5) then mob:useMobAbility(2114); mob:setLocalVar("TP", 6) end elseif (mobHPP <= 38 and change == 10) then -- Hydra and Co. mob:setModelId(1796); mob:setLocalVar("change", 11); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(421); end elseif (mobHPP <= 40 and change == 9) then -- Normal Form mob:setModelId(1839); mob:setLocalVar("change", 10); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1841); end if (TP <= 4) then mob:useMobAbility(2116); mob:setLocalVar("TP", 5) end elseif (mobHPP <= 50 and change == 8) then -- Cerb and Co. mob:setModelId(1793); mob:setLocalVar("change", 9); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(281); end; elseif (mobHPP <= 52 and change == 7) then -- Normal Form mob:setModelId(1839); mob:setLocalVar("change", 8); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1841); end if (TP <= 3) then mob:useMobAbility(2117); mob:setLocalVar("TP", 4) end elseif (mobHPP <= 62 and change == 6) then -- Troll and Co. mob:setModelId(1867); mob:setLocalVar("change", 7); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1680); end elseif (mobHPP <= 64 and change == 5) then -- Normal Form mob:setModelId(1839); mob:setLocalVar("change", 6); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1841); end if (TP <= 2) then mob:useMobAbility(2118); mob:setLocalVar("TP", 3) end elseif (mobHPP <= 74 and change == 4) then -- Lamia and Co. mob:setModelId(1865); mob:setLocalVar("change", 5); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1643); end elseif (mobHPP <= 76 and change == 3) then -- Normal Form mob:setModelId(1839); mob:setLocalVar("change", 4); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1841); end if (TP <= 1) then mob:useMobAbility(2119); mob:setLocalVar("TP", 2) end elseif (mobHPP <= 86 and change == 2) then -- Mamool and Co. mob:setModelId(1863); mob:setLocalVar("change", 3); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1639); end elseif (mobHPP <= 88 and change == 1) then -- Normal Form mob:setModelId(1839); mob:setLocalVar("change", 2); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1841); end if (TP <= 0) then mob:useMobAbility(2113); mob:setLocalVar("TP", 1) end elseif (mobHPP <= 98 and change == 0) then -- Chariots mob:setModelId(1825); mob:setLocalVar("change", 1); for i = 1, 8 do if petStatus[i] == 0 then SpawnMob(petIDs[i]):updateEnmity(target); end GetMobByID(petIDs[i]):setModelId(1820); end end ------------------------ Keep pets active ------------------------ -- Pets probably shouldn't despawn for this, but proof otherwise should remove this code. for i = 1, 8 do if (petStatus[i] == 16 or petStatus[i] == 18) then -- idle or disengaging pet GetMobByID(petIDs[i]):updateEnmity(target); end end -- Repops pets sets model and sets them agro.. -- This is TeoTwawki's loop for respawning pets, I left it here in case -- someone ever wants it -- if (mob:getLocalVar("repopPets") == 1) then -- for i = 1, 8 do -- if petStatus[i] == 0 then -- SpawnMob(petIDs[i]):updateEnmity(target); -- end -- if (GetMobByID(petIDs[i]):getModelId() ~= mob:getLocalVar("petsModelId")) then -- GetMobByID(petIDs[i]):setModelId(petsModelId); -- end -- end -- mob:setLocalVar("repopPets", 0); -- end ------------------------ Despawn timer ------------------------ if (os.time(t) > depopTime and mob:actionQueueEmpty() == true) then for i=17056170, 17056186 do DespawnMob(i); end printf("Timer expired at %i. Despawning Pandemonium Warden.", depopTime); end -- Very much early code. Couldn't find a way to depop the mob after AF pacts had executed. As such, doesn't work. -- Obviously, you have to move the Avatars to their own family, and give them access to AFlows via a new set of moves. -- Might be able to cheat by giving them a copy AFlow (change the name!) that despawns the mob once completed. -- Rearranging the skins may be necessary to use this trick efficiently on more SMNs. -- Either that, or probably somewhat complex core code. Avatars may not always be mobid+1. -- It wasn't clear if the avatars were a separate pop, or if all dead lamps should revive, go avatar, and AFlow. --[[ ------------------------ Astral Flow Logic ------------------------ -- Missing the log message for players. Needs to be handled in the core somehow. -- Possibly supposed to use twice per trigger? Did not check too far on this. Sounds fun. if (mobHP <= (mobMaxHP * 0.75) and target:getMaskBit(PWardenAstralFlows,3) == false) then for i=17056178, 17056186 do local rannum = math.random(0,7); local avatar = GetMobByID(i); avatar:changeSkin(23 + rannum); -- Random avatar skin SpawnMob(i):updateEnmity(target); avatar:useMobAbility(912); DespawnMob(i); end PWardenAstralFlows = PWardenAstralFlows + 4; -- 23 = Shiva, 628 Diamond Dust -- 24 = Ramuh, 637 Judgement Bolt -- 25 = Titan, 601 Earthen Fury -- 26 = Ifrit, 592 Inferno -- 27 = Leviathan, 610 Tidal Wave -- 28 = Garuda, 619 Aerial Blast -- 29 = Fenrir, 583 Howling Moon -- 30 = Carbuncle, 656 Searing Light -- 31 = Diabolos -- 646 = wyvern breath. Need to find diabolos. elseif (mobHP <= (mobMaxHP * 0.5) and target:getMaskBit(PWardenAstralFlows,2) == false) then for i=17056178, 17056186 do local rannum = math.random(0,7); local avatar = GetMobByID(i); avatar:changeSkin(23 + rannum); -- Random avatar skin SpawnMob(i):updateEnmity(target); avatar:useMobAbility(912); DespawnMob(i); end PWardenAstralFlows = PWardenAstralFlows + 2; elseif (mobHP <= (mobMaxHP * 0.25) and target:getMaskBit(PWardenAstralFlows,1) == false) then for i=17056178, 17056186 do local rannum = math.random(0,7); local avatar = GetMobByID(i); avatar:changeSkin(23 + rannum); -- Random avatar skin SpawnMob(i):updateEnmity(target); avatar:useMobAbility(912); DespawnMob(i); end PWardenAstralFlows = PWardenAstralFlows + 1; end ]]-- end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, player, isKiller) -- TODO: Death speech. player:addTitle(PANDEMONIUM_QUELLER); end;
gpl-3.0
greasydeal/darkstar
scripts/commands/takexp.lua
26
1232
--------------------------------------------------------------------------------------------------- -- func: @takexp <amount> <player> -- desc: Removes experience points from the target player. --------------------------------------------------------------------------------------------------- cmdprops = { permission = 1, parameters = "is" }; function onTrigger(player, amount, target) -- print( 'Exp amount: ' .. tostring( amount ) ); if (amount == nil) then player:PrintToPlayer( "You must enter a valid point amount." ); player:PrintToPlayer( "@takexp <amount> <player>" ); return; end if (target == nil) then player:delExp(amount); player:PrintToPlayer( string.format( "Removed %i exp from self. ", amount ) ); else local targ = GetPlayerByName(target); if (targ ~= nil) then targ:delExp(amount); player:PrintToPlayer( string.format( "Removed %i exp from player '%s' ", amount, target ) ) else player:PrintToPlayer( string.format( "Player named '%s' not found!", target ) ); player:PrintToPlayer( "@takexp <amount> <player>" ); end end end;
gpl-3.0