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
LegionXI/darkstar
scripts/globals/items/cup_of_chamomile_tea.lua
12
1477
----------------------------------------- -- ID: 4603 -- Item: cup_of_chamomile_tea -- Food Effect: 180Min, All Races ----------------------------------------- -- Magic 8 -- Vitality -2 -- Charisma 2 -- Magic Regen While Healing 1 -- Sleep resistance -30 ----------------------------------------- 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,4603); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_MP, 8); target:addMod(MOD_VIT, -2); target:addMod(MOD_CHR, 2); target:addMod(MOD_MPHEAL, 1); target:addMod(MOD_SLEEPRES, -30); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_MP, 8); target:delMod(MOD_VIT, -2); target:delMod(MOD_CHR, 2); target:delMod(MOD_MPHEAL, 1); target:delMod(MOD_SLEEPRES, -30); end;
gpl-3.0
greasydeal/darkstar
scripts/globals/items/zafmlug_bass.lua
17
1321
----------------------------------------- -- ID: 4385 -- Item: zafmlug_bass -- Food Effect: 5Min, Mithra only ----------------------------------------- -- Dexterity 2 -- Mind -4 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:getRace() ~= 7) then result = 247; end if(target:getMod(MOD_EAT_RAW_FISH) == 1) then result = 0; end if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,4385); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 2); target:addMod(MOD_MND, -4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 2); target:delMod(MOD_MND, -4); end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Selbina/npcs/Graegham.lua
7
1182
----------------------------------- -- Area: Selbina -- NPC: Graegham -- Guild Merchant NPC: Fishing Guild -- @pos -12.423 -7.287 8.665 248 ----------------------------------- package.loaded["scripts/zones/Selbina/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/zones/Selbina/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if(player:sendGuild(5182,3,18,5)) then player:showText(npc,FISHING_SHOP_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); end;
gpl-3.0
LegionXI/darkstar
scripts/globals/spells/absorb-vit.lua
9
1369
-------------------------------------- -- Spell: Absorb-VIT -- Steals an enemy's vitality. -------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------------- -- OnSpellCast ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0; end; function onSpellCast(caster,target,spell) if (target:hasStatusEffect(EFFECT_VIT_DOWN) or caster:hasStatusEffect(EFFECT_VIT_BOOST)) then spell:setMsg(75); -- no effect else local dINT = caster:getStat(MOD_INT) - target:getStat(MOD_INT); local resist = applyResistance(caster,spell,target,dINT,37,0); if (resist <= 0.125) then spell:setMsg(85); else spell:setMsg(331); caster:addStatusEffect(EFFECT_VIT_BOOST,ABSORB_SPELL_AMOUNT*resist*((100+(caster:getMod(MOD_AUGMENTS_ABSORB)))/100), ABSORB_SPELL_TICK, ABSORB_SPELL_AMOUNT*ABSORB_SPELL_TICK,FLAG_DISPELABLE); -- caster gains VIT target:addStatusEffect(EFFECT_VIT_DOWN,ABSORB_SPELL_AMOUNT*resist*((100+(caster:getMod(MOD_AUGMENTS_ABSORB)))/100), ABSORB_SPELL_TICK, ABSORB_SPELL_AMOUNT*ABSORB_SPELL_TICK,FLAG_ERASABLE); -- target loses VIT end end return EFFECT_VIT_DOWN; end;
gpl-3.0
ibm2431/darkstar
scripts/zones/Grand_Palace_of_HuXzoi/mobs/Eoghrah.lua
9
2620
----------------------------------- -- Area: Grand Palace of Hu'Xzoi -- Mob: Eo'ghrah ----------------------------------- require("scripts/globals/status"); ----------------------------------- function onMobSpawn(mob) -- Set core Skin and mob elemental resist/weakness; other elements set to 0. -- Set to non aggro. mob:AnimationSub(0); mob:setAggressive(0); mob:setLocalVar("roamTime", os.time()); mob:setLocalVar("form2",math.random(2,3)); local skin = math.random(1161,1168); mob:setModelId(skin); if (skin == 1161) then -- Fire mob:setMod(dsp.mod.ICERES, 27); mob:setMod(dsp.mod.WATERRES, -27); elseif (skin == 1164) then --Earth mob:setMod(dsp.mod.THUNDERRES, 27); mob:setMod(dsp.mod.WINDRES, -27); elseif (skin == 1162) then -- Water mob:setMod(dsp.mod.THUNDERRES, -27); mob:setMod(dsp.mod.FIRERES, 27); elseif (skin == 1163) then -- Wind mob:setMod(dsp.mod.ICERES, -27); mob:setMod(dsp.mod.EARTHRES, 27); elseif (skin == 1166) then --Ice mob:setMod(dsp.mod.WINDRES, 27); mob:setMod(dsp.mod.FIRERES, -27); elseif (skin == 1165) then --Lightning mob:setMod(dsp.mod.WATERRES, 27); mob:setMod(dsp.mod.EARTHRES, -27); elseif (skin == 1167) then --Light mob:setMod(dsp.mod.LIGHTRES, 27); mob:setMod(dsp.mod.DARKRES, -27); elseif (skin == 1168) then --Dark mob:setMod(dsp.mod.DARKRES, 27); mob:setMod(dsp.mod.LIGHTRES, -27); end; end; function onMobRoam(mob) local roamTime = mob:getLocalVar("roamTime"); if (mob:AnimationSub() == 0 and os.time() - roamTime > 60) then mob:AnimationSub(mob:getLocalVar("form2")); mob:setLocalVar("roamTime", os.time()); mob:setAggressive(1); elseif (mob:AnimationSub() == mob:getLocalVar("form2") and os.time() - roamTime > 60) then mob:AnimationSub(0); mob:setAggressive(0); mob:setLocalVar("roamTime", os.time()); end end; function onMobFight(mob,target) local changeTime = mob:getLocalVar("changeTime"); if (mob:AnimationSub() == 0 and mob:getBattleTime() - changeTime > 60) then mob:AnimationSub(mob:getLocalVar("form2")); mob:setAggressive(1); mob:setLocalVar("changeTime", mob:getBattleTime()); elseif (mob:AnimationSub() == mob:getLocalVar("form2") and mob:getBattleTime() - changeTime > 60) then mob:AnimationSub(0); mob:setAggressive(0); mob:setLocalVar("changeTime", mob:getBattleTime()); end end; function onMobDeath(mob, player, isKiller) end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Windurst_Waters_[S]/npcs/Ampiro-Mapiro.lua
38
1053
----------------------------------- -- Area: Windurst Waters (S) -- NPC: Ampiro-Mapiro -- Type: Standard NPC -- @zone: 94 -- @pos 131.380 -6.75 174.169 -- -- Auto-Script: Requires Verification (Verified by Brawndo) ----------------------------------- package.loaded["scripts/zones/Windurst_Waters_[S]/TextIDs"] = nil; ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x01a7); 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/Caedarva_Mire/npcs/qm10.lua
9
1050
----------------------------------- -- Area: Caedarva Mire -- NPC: qm10 -- Involved in quest: Operation Teatime -- !pos 473 -31 75 79 ----------------------------------- local ID = require("scripts/zones/Caedarva_Mire/IDs") require("scripts/globals/npc_util") require("scripts/globals/quests") ----------------------------------- function onTrade(player,npc,trade) end function onTrigger(player,npc) local OperationTeatime = player:getQuestStatus(AHT_URHGAN,dsp.quest.id.ahtUrhgan.OPERATION_TEATIME) local OperationTeatimeProgress = player:getCharVar("OperationTeatimeProgress") if OperationTeatime == QUEST_ACCEPTED and OperationTeatimeProgress == 3 then player:startEvent(15) else player:messageSpecial(ID.text.NOTHING_OUT_OF_ORDINARY) end end function onEventUpdate(player,csid,option) end function onEventFinish(player,csid,option) if csid == 15 then npcUtil.completeQuest(player, AHT_URHGAN, dsp.quest.id.ahtUrhgan.OPERATION_TEATIME, {item=15602, var="OperationTeatimeProgress"}) end end
gpl-3.0
siktirmirza/supergp
plugins/chating.lua
12
1106
local function run(msg) if msg.text == "hi" then return "Hello bb" end if msg.text == "Hi" then return "Hello honey" end if msg.text == "Hello" then return "Hi bb" end if msg.text == "hello" then return "Hi honey" end if msg.text == "Salam" then return "Salam aleykom" end if msg.text == "salam" then return "va aleykol asalam" end if msg.text == "BossTG" then return "Sardare shoma" end if msg.text == "Boss" then return "sardar" end if msg.text == "kir" then return "to konet" end if msg.text == "boss" then return "Yes?" end if msg.text == "boss" then return "What?" end if msg.text == "bot" then return "hum?" end if msg.text == "Bot" then return "Huuuum?" end if msg.text == "?" then return "Hum??" end if msg.text == "Bye" then return "Babay" end if msg.text == "bye" then return "Bye Bye" end end return { description = "Chat With Robot Server", usage = "chat with robot", patterns = { "^[Hh]i$", "^[Hh]ello$", "^BossTG$", "^Boss$", "^[Bb]ot$", "^boss$", "^[Bb]ye$", "^?$", "^[Ss]alam$", }, run = run, --privileged = true, pre_process = pre_process }
gpl-2.0
LegionXI/darkstar
scripts/zones/Valkurm_Dunes/npcs/qm2.lua
14
1328
----------------------------------- -- Area: Valkurm Dunes -- NPC: qm2 (???) -- Involved In Quest: Messenger from Beyond -- @pos -716 -10 66 103 ----------------------------------- package.loaded["scripts/zones/Valkurm_Dunes/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Valkurm_Dunes/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getQuestStatus(SANDORIA,MESSENGER_FROM_BEYOND) == QUEST_ACCEPTED and player:hasItem(1096) == false) then SpawnMob(17199566):updateClaim(player); else player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID2: %u",csid); -- printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
greasydeal/darkstar
scripts/zones/LaLoff_Amphitheater/bcnms/ark_angels_2.lua
13
3037
----------------------------------- -- Area: LaLoff Amphitheater -- Name: Ark Angels 2 (Tarutaru) ----------------------------------- package.loaded["scripts/zones/LaLoff_Amphitheater/TextIDs"] = nil; ----------------------------------- require("scripts/zones/LaLoff_Amphitheater/TextIDs"); require("scripts/globals/missions"); require("scripts/globals/keyitems"); ----------------------------------- -- Death cutscenes: -- player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,0,0); -- Hume -- player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,1,0); -- taru -- player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,2,0); -- mithra -- player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,3,0); -- elvan -- player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,4,0); -- galka -- player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,5,0); -- divine might -- player:startEvent(0x7d01,1,1,1,instance:getTimeInside(),1,6,0); -- skip ending cs -- 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,ARK_ANGELS)) then player:startEvent(0x7d01,instance:getEntrance(),instance:getFastestTime(),1,instance:getTimeInside(),180,1,1); -- winning CS (allow player to skip) else player:startEvent(0x7d01,instance:getEntrance(),instance:getFastestTime(),1,instance:getTimeInside(),180,1,0); -- winning CS (allow player to skip) end elseif(leavecode == 4) then player:startEvent(0x7d02, 0, 0, 0, 0, 0, instance:getEntrance(), 180); -- player lost 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); local AAKeyitems = (player:hasKeyItem(SHARD_OF_APATHY) and player:hasKeyItem(SHARD_OF_ARROGANCE) and player:hasKeyItem(SHARD_OF_ENVY) and player:hasKeyItem(SHARD_OF_RAGE)); if(csid == 0x7d01) then if (player:getCurrentMission(ZILART) == ARK_ANGELS and player:getVar("ZilartStatus") == 1) then player:addKeyItem(SHARD_OF_COWARDICE); player:messageSpecial(KEYITEM_OBTAINED,SHARD_OF_COWARDICE); if (AAKeyitems == true) then player:completeMission(ZILART,ARK_ANGELS); player:addMission(ZILART,THE_SEALED_SHRINE); player:setVar("ZilartStatus",0); end end end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Garlaige_Citadel/npcs/qm13.lua
34
1386
----------------------------------- -- Area: Garlaige Citadel -- NPC: qm13 (???) -- Involved in Quest: Hitting the Marquisate (THF AF3) -- @pos -194.166 -5.500 139.969 200 ----------------------------------- package.loaded["scripts/zones/Garlaige_Citadel/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/Garlaige_Citadel/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local hittingTheMarquisateHagainCS = player:getVar("hittingTheMarquisateHagainCS"); if (hittingTheMarquisateHagainCS == 5) then player:messageSpecial(PRESENCE_FROM_CEILING); player:setVar("hittingTheMarquisateHagainCS",6); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID2: %u",csid); --printf("RESULT2: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end;
gpl-3.0
wizardbottttt/wizard
plugins/meme.lua
637
5791
local helpers = require "OAuth.helpers" local _file_memes = './data/memes.lua' local _cache = {} local function post_petition(url, arguments) local response_body = {} local request_constructor = { url = url, method = "POST", sink = ltn12.sink.table(response_body), headers = {}, redirect = false } local source = arguments if type(arguments) == "table" then local source = helpers.url_encode_arguments(arguments) end request_constructor.headers["Content-Type"] = "application/x-www-form-urlencoded" request_constructor.headers["Content-Length"] = tostring(#source) request_constructor.source = ltn12.source.string(source) local ok, response_code, response_headers, response_status_line = http.request(request_constructor) if not ok then return nil end response_body = json:decode(table.concat(response_body)) return response_body end local function upload_memes(memes) local base = "http://hastebin.com/" local pet = post_petition(base .. "documents", memes) if pet == nil then return '', '' end local key = pet.key return base .. key, base .. 'raw/' .. key end local function analyze_meme_list() local function get_m(res, n) local r = "<option.*>(.*)</option>.*" local start = string.find(res, "<option.*>", n) if start == nil then return nil, nil end local final = string.find(res, "</option>", n) + #"</option>" local sub = string.sub(res, start, final) local f = string.match(sub, r) return f, final end local res, code = http.request('http://apimeme.com/') local r = "<option.*>(.*)</option>.*" local n = 0 local f, n = get_m(res, n) local ult = {} while f ~= nil do print(f) table.insert(ult, f) f, n = get_m(res, n) end return ult end local function get_memes() local memes = analyze_meme_list() return { last_time = os.time(), memes = memes } end local function load_data() local data = load_from_file(_file_memes) if not next(data) or data.memes == {} or os.time() - data.last_time > 86400 then data = get_memes() -- Upload only if changed? link, rawlink = upload_memes(table.concat(data.memes, '\n')) data.link = link data.rawlink = rawlink serialize_to_file(data, _file_memes) end return data end local function match_n_word(list1, list2) local n = 0 for k,v in pairs(list1) do for k2, v2 in pairs(list2) do if v2:find(v) then n = n + 1 end end end return n end local function match_meme(name) local _memes = load_data() local name = name:lower():split(' ') local max = 0 local id = nil for k,v in pairs(_memes.memes) do local n = match_n_word(name, v:lower():split(' ')) if n > 0 and n > max then max = n id = v end end return id end local function generate_meme(id, textup, textdown) local base = "http://apimeme.com/meme" local arguments = { meme=id, top=textup, bottom=textdown } return base .. "?" .. helpers.url_encode_arguments(arguments) end local function get_all_memes_names() local _memes = load_data() local text = 'Last time: ' .. _memes.last_time .. '\n-----------\n' for k, v in pairs(_memes.memes) do text = text .. '- ' .. v .. '\n' end text = text .. '--------------\n' .. 'You can see the images here: http://apimeme.com/' return text end local function callback_send(cb_extra, success, data) if success == 0 then send_msg(cb_extra.receiver, "Something wrong happened, probably that meme had been removed from server: " .. cb_extra.url, ok_cb, false) end end local function run(msg, matches) local receiver = get_receiver(msg) if matches[1] == 'list' then local _memes = load_data() return 'I have ' .. #_memes.memes .. ' meme names.\nCheck this link to see all :)\n' .. _memes.link elseif matches[1] == 'listall' then if not is_sudo(msg) then return "You can't list this way, use \"!meme list\"" else return get_all_memes_names() end elseif matches[1] == "search" then local meme_id = match_meme(matches[2]) if meme_id == nil then return "I can't match that search with any meme." end return "With that search your meme is " .. meme_id end local searchterm = string.gsub(matches[1]:lower(), ' ', '') local meme_id = _cache[searchterm] or match_meme(matches[1]) if not meme_id then return 'I don\'t understand the meme name "' .. matches[1] .. '"' end _cache[searchterm] = meme_id print("Generating meme: " .. meme_id .. " with texts " .. matches[2] .. ' and ' .. matches[3]) local url_gen = generate_meme(meme_id, matches[2], matches[3]) send_photo_from_url(receiver, url_gen, callback_send, {receiver=receiver, url=url_gen}) return nil end return { description = "Generate a meme image with up and bottom texts.", usage = { "!meme search (name): Return the name of the meme that match.", "!meme list: Return the link where you can see the memes.", "!meme listall: Return the list of all memes. Only admin can call it.", '!meme [name] - [text_up] - [text_down]: Generate a meme with the picture that match with that name with the texts provided.', '!meme [name] "[text_up]" "[text_down]": Generate a meme with the picture that match with that name with the texts provided.', }, patterns = { "^!meme (search) (.+)$", '^!meme (list)$', '^!meme (listall)$', '^!meme (.+) "(.*)" "(.*)"$', '^!meme "(.+)" "(.*)" "(.*)"$', "^!meme (.+) %- (.*) %- (.*)$" }, run = run }
gpl-2.0
greasydeal/darkstar
scripts/zones/Davoi/npcs/_45h.lua
19
2043
----------------------------------- -- Area: Davoi -- NPC: Howling Pond -- Used In Quest: Whence Blows the Wind -- @pos 21 0.1 -258 149 ----------------------------------- package.loaded["scripts/zones/Davoi/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/zones/Davoi/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0033); 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 == 0x0033 and player:getVar("miniQuestForORB_CS") == 1) then local c = player:getVar("countRedPoolForORB"); if(c == 0) then player:setVar("countRedPoolForORB", c + 1); player:delKeyItem(WHITE_ORB); player:addKeyItem(PINK_ORB); player:messageSpecial(KEYITEM_OBTAINED, PINK_ORB); elseif(c == 2 or c == 4 or c == 8) then player:setVar("countRedPoolForORB", c + 1); player:delKeyItem(PINK_ORB); player:addKeyItem(RED_ORB); player:messageSpecial(KEYITEM_OBTAINED, RED_ORB); elseif(c == 6 or c == 10 or c == 12) then player:setVar("countRedPoolForORB", c + 1); player:delKeyItem(RED_ORB); player:addKeyItem(BLOOD_ORB); player:messageSpecial(KEYITEM_OBTAINED, BLOOD_ORB); elseif(c == 14) then player:setVar("countRedPoolForORB", c + 1); player:delKeyItem(BLOOD_ORB); player:addKeyItem(CURSED_ORB); player:messageSpecial(KEYITEM_OBTAINED, CURSED_ORB); player:addStatusEffect(EFFECT_PLAGUE,0,0,900); end end end;
gpl-3.0
LegionXI/darkstar
scripts/zones/Southern_San_dOria_[S]/npcs/Mainchelite.lua
29
5404
----------------------------------- -- Area: Southern SandOria [S] -- NPC: Mainchelite -- @zone 80 -- @pos -16 1 -30 -- CS IDs: -- 0x005 = Generic Greeting for Iron Ram members -- 0x006 = Mid Initiation of other nation -- 0x007 = Ask player to Join Iron Rams -- 0x008 = Ask if changed mind about joining Iron rams (after player has declined) -- 0x009 = Mid Initiation of other nation -- 0x00A = Player works for another nation, offer to switch +give quest -- 0x00B = Player works for another nation, offer to switch +give quest -- 0x00C = Complete investigation -- 0x00D = "How fares the search, <player>?" -- 0x00E = "How fares the search, <player>?" -- 0x00F = No Red Recommendation Letter and has no nation affiliation -- Todo: medal loss from nation switching. Since there is no rank-up yet, this isn't so important for now. ----------------------------------- package.loaded["scripts/zones/Southern_San_dOria_[S]/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/titles"); require("scripts/globals/quests"); require("scripts/globals/missions"); require("scripts/zones/Southern_San_dOria_[S]/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local Allegiance = player:getCampaignAllegiance(); -- 0 = none, 1 = San d'Oria Iron Rams, 2 = Bastok Fighting Fourth, 3 = Windurst Cobras local TheFightingFourth = player:getQuestStatus(CRYSTAL_WAR,THE_FIGHTING_FOURTH); local SnakeOnThePlains = player:getQuestStatus(CRYSTAL_WAR,SNAKE_ON_THE_PLAINS); local SteamedRams = player:getQuestStatus(CRYSTAL_WAR,STEAMED_RAMS); local RedLetter = player:hasKeyItem(RED_RECOMMENDATION_LETTER); local CharredPropeller = player:hasKeyItem(CHARRED_PROPELLER); local OxidizedPlate = player:hasKeyItem(OXIDIZED_PLATE); local ShatteredLumber = player:hasKeyItem(PIECE_OF_SHATTERED_LUMBER); if (TheFightingFourth == QUEST_ACCEPTED or SnakeOnThePlains == QUEST_ACCEPTED) then player:startEvent(0x009); elseif (SteamedRams == QUEST_AVAILABLE and RedLetter == true) then player:startEvent(0x007); elseif (SteamedRams == QUEST_AVAILABLE and player:getVar("RED_R_LETTER_USED") == 1) then player:startEvent(0x008); elseif (SteamedRams == QUEST_ACCEPTED and CharredPropeller == true and OxidizedPlate == true and ShatteredLumber == true) then player:startEvent(0x00C); elseif (SteamedRams == QUEST_ACCEPTED) then player:startEvent(0x00D); elseif (SteamedRams == QUEST_COMPLETED and Allegiance == 1) then player:startEvent(0x005); else player:startEvent(0x00F); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x007 and option == 0) then player:addQuest(CRYSTAL_WAR,STEAMED_RAMS); player:setVar("RED_R_LETTER_USED",1); player:delKeyItem(RED_RECOMMENDATION_LETTER); elseif (csid == 0x007 and option == 1) then player:setVar("RED_R_LETTER_USED",1); player:delKeyItem(RED_RECOMMENDATION_LETTER); elseif (csid == 0x008 and option == 0) then player:addQuest(CRYSTAL_WAR, STEAMED_RAMS); elseif (csid == 0x00A and option == 0) then player:addQuest(CRYSTAL_WAR, STEAMED_RAMS); elseif (csid == 0x00B and option == 0) then player:addQuest(CRYSTAL_WAR, STEAMED_RAMS); elseif (csid == 0x00C and option == 0) then -- Is first join, so add Sprinter's Shoes and bronze medal if (player:getVar("Campaign_Nation") == 0) then if (player:getFreeSlotsCount() >= 1) then player:setCampaignAllegiance(1); player:setVar("RED_R_LETTER_USED",0); player:addTitle(KNIGHT_OF_THE_IRON_RAM); player:addKeyItem(BRONZE_RIBBON_OF_SERVICE); player:addItem(15754); player:completeQuest(CRYSTAL_WAR,STEAMED_RAMS); player:delKeyItem(CHARRED_PROPELLER); player:delKeyItem(OXIDIZED_PLATE); player:delKeyItem(PIECE_OF_SHATTERED_LUMBER); player:messageSpecial(KEYITEM_OBTAINED, BRONZE_RIBBON_OF_SERVICE); player:messageSpecial(ITEM_OBTAINED, 15754); else player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 15754); end else player:setCampaignAllegiance(1); player:setVar("RED_R_LETTER_USED",0); player:addTitle(KNIGHT_OF_THE_IRON_RAM); player:completeQuest(CRYSTAL_WAR,STEAMED_RAMS); player:delKeyItem(CHARRED_PROPELLER); player:delKeyItem(OXIDIZED_PLATE); player:delKeyItem(PIECE_OF_SHATTERED_LUMBER); end elseif (csid == 0x00D and option == 1) then player:delQuest(CRYSTAL_WAR,STEAMED_RAMS); end end;
gpl-3.0
LegionXI/darkstar
scripts/zones/Jugner_Forest/npcs/Cavernous_Maw.lua
29
1443
----------------------------------- -- Area: Jugner Forest -- NPC: Cavernous Maw -- @pos -118 -8 -518 104 -- Teleports Players to Jugner Forest [S] ----------------------------------- package.loaded["scripts/zones/Jugner_Forest/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/teleports"); require("scripts/globals/campaign"); require("scripts/zones/Jugner_Forest/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (ENABLE_WOTG == 1 and player:hasKeyItem(PURE_WHITE_FEATHER) and hasMawActivated(player,3)) then player:startEvent(0x0389); else player:messageSpecial(NOTHING_HAPPENS); 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 (csid == 0x0389 and option == 1) then toMaw(player,13); end end;
gpl-3.0
evrooije/beerarchy
mods/00_bt_nodes/farming/init.lua
1
18555
--[[ Minetest Farming Redo Mod 1.24 (28th April 2017) by TenPlus1 NEW growing routine by prestidigitator auto-refill by crabman77 ]] farming = {} farming.mod = "redo" farming.path = minetest.get_modpath("farming") farming.hoe_on_use = default.hoe_on_use farming.select = { type = "fixed", fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5} } farming.DEBUG = false -- farming.DEBUG = {} -- Uncomment to turn on profiling code/functions local DEBUG_abm_runs = 0 local DEBUG_abm_time = 0 local DEBUG_timer_runs = 0 local DEBUG_timer_time = 0 if farming.DEBUG then function farming.DEBUG.reset_times() DEBUG_abm_runs = 0 DEBUG_abm_time = 0 DEBUG_timer_runs = 0 DEBUG_timer_time = 0 end function farming.DEBUG.report_times() local abm_n = DEBUG_abm_runs local abm_dt = DEBUG_abm_time local abm_avg = (abm_n > 0 and abm_dt / abm_n) or 0 local timer_n = DEBUG_timer_runs local timer_dt = DEBUG_timer_time local timer_avg = (timer_n > 0 and timer_dt / timer_n) or 0 local dt = abm_dt + timer_dt print("ABM ran for "..abm_dt.."µs over "..abm_n.." runs: "..abm_avg.."µs/run") print("Timer ran for "..timer_dt.."µs over "..timer_n.." runs: "..timer_avg.."µs/run") print("Total farming time: "..dt.."µs") end end local statistics = dofile(farming.path.."/statistics.lua") -- Intllib local S if minetest.get_modpath("intllib") then S = intllib.Getter() else S = function(s) return s end end farming.intllib = S -- Utility Functions local time_speed = tonumber(minetest.setting_get("time_speed")) or 72 local SECS_PER_CYCLE = (time_speed > 0 and 24 * 60 * 60 / time_speed) or 0 local function clamp(x, min, max) return (x < min and min) or (x > max and max) or x end local function in_range(x, min, max) return min <= x and x <= max end --- Tests the amount of day or night time between two times. -- -- @param t_game -- The current time, as reported by mintest.get_gametime(). -- @param t_day -- The current time, as reported by mintest.get_timeofday(). -- @param dt -- The amount of elapsed time. -- @param count_day -- If true, count elapsed day time. Otherwise, count elapsed night time. -- @return -- The amount of day or night time that has elapsed. local function day_or_night_time(t_game, t_day, dt, count_day) local t1_day = t_day - dt / SECS_PER_CYCLE local t1_c, t2_c -- t1_c < t2_c and t2_c always in [0, 1) if count_day then if t_day < 0.25 then t1_c = t1_day + 0.75 -- Relative to sunup, yesterday t2_c = t_day + 0.75 else t1_c = t1_day - 0.25 -- Relative to sunup, today t2_c = t_day - 0.25 end else if t_day < 0.75 then t1_c = t1_day + 0.25 -- Relative to sundown, yesterday t2_c = t_day + 0.25 else t1_c = t1_day - 0.75 -- Relative to sundown, today t2_c = t_day - 0.75 end end local dt_c = clamp(t2_c, 0, 0.5) - clamp(t1_c, 0, 0.5) -- this cycle if t1_c < -0.5 then local nc = math.floor(-t1_c) t1_c = t1_c + nc dt_c = dt_c + 0.5 * nc + clamp(-t1_c - 0.5, 0, 0.5) end return dt_c * SECS_PER_CYCLE end --- Tests the amount of elapsed day time. -- -- @param dt -- The amount of elapsed time. -- @return -- The amount of day time that has elapsed. -- local function day_time(dt) return day_or_night_time(minetest.get_gametime(), minetest.get_timeofday(), dt, true) end --- Tests the amount of elapsed night time. -- -- @param dt -- The amount of elapsed time. -- @return -- The amount of night time that has elapsed. -- local function night_time(time_game, time_day, dt, count_day) return day_or_night_time(minetest.get_gametime(), minetest.get_timeofday(), dt, false) end -- Growth Logic local STAGE_LENGTH_AVG = 160.0 local STAGE_LENGTH_DEV = STAGE_LENGTH_AVG / 6 local MIN_LIGHT = 13 local MAX_LIGHT = 1000 --- Determines plant name and stage from node. -- -- Separates node name on the last underscore (_). -- -- @param node -- Node or position table, or node name. -- @return -- List (plant_name, stage), or nothing (nil) if node isn't loaded local function plant_name_stage(node) local name if type(node) == "table" then if node.name then name = node.name elseif node.x and node.y and node.z then node = minetest.get_node_or_nil(node) name = node and node.name end else name = tostring(node) end if not name or name == "ignore" then return nil end local sep_pos = name:find("_[^_]+$") if sep_pos and sep_pos > 1 then local stage = tonumber(name:sub(sep_pos + 1)) if stage and stage >= 0 then return name:sub(1, sep_pos - 1), stage end end return name, 0 end -- Map from node name to -- { plant_name = ..., name = ..., stage = n, stages_left = { node_name, ... } } local plant_stages = {} farming.plant_stages = plant_stages --- Registers the stages of growth of a (possible plant) node. -- -- @param node -- Node or position table, or node name. -- @return -- The (possibly zero) number of stages of growth the plant will go through -- before being fully grown, or nil if not a plant. local register_plant_node -- Recursive helper local function reg_plant_stages(plant_name, stage, force_last) local node_name = plant_name and plant_name .. "_" .. stage local node_def = node_name and minetest.registered_nodes[node_name] if not node_def then return nil end local stages = plant_stages[node_name] if stages then return stages end if minetest.get_item_group(node_name, "growing") > 0 then local ns = reg_plant_stages(plant_name, stage + 1, true) local stages_left = (ns and { ns.name, unpack(ns.stages_left) }) or {} stages = { plant_name = plant_name, name = node_name, stage = stage, stages_left = stages_left } if #stages_left > 0 then local old_constr = node_def.on_construct local old_destr = node_def.on_destruct minetest.override_item(node_name, { on_construct = function(pos) if old_constr then old_constr(pos) end farming.handle_growth(pos) end, on_destruct = function(pos) minetest.get_node_timer(pos):stop() if old_destr then old_destr(pos) end end, on_timer = function(pos, elapsed) return farming.plant_growth_timer(pos, elapsed, node_name) end, }) end elseif force_last then stages = { plant_name = plant_name, name = node_name, stage = stage, stages_left = {} } else return nil end plant_stages[node_name] = stages return stages end register_plant_node = function(node) local plant_name, stage = plant_name_stage(node) if plant_name then local stages = reg_plant_stages(plant_name, stage, false) return stages and #stages.stages_left else return nil end end local function set_growing(pos, stages_left) if not stages_left then return end local timer = minetest.get_node_timer(pos) if stages_left > 0 then if not timer:is_started() then local stage_length = statistics.normal(STAGE_LENGTH_AVG, STAGE_LENGTH_DEV) stage_length = clamp(stage_length, 0.5 * STAGE_LENGTH_AVG, 3.0 * STAGE_LENGTH_AVG) timer:set(stage_length, -0.5 * math.random() * STAGE_LENGTH_AVG) end elseif timer:is_started() then timer:stop() end end -- Detects a plant type node at the given position, starting -- or stopping the plant growth timer as appopriate -- @param pos -- The node's position. -- @param node -- The cached node table if available, or nil. function farming.handle_growth(pos, node) if not pos then return end local stages_left = register_plant_node(node or pos) if stages_left then set_growing(pos, stages_left) end end minetest.after(0, function() for _, node_def in ipairs(minetest.registered_nodes) do register_plant_node(node_def) end end) local abm_func = farming.handle_growth if farming.DEBUG then local normal_abm_func = abm_func abm_func = function(...) local t0 = minetest.get_us_time() local r = { normal_abm_func(...) } local t1 = minetest.get_us_time() DEBUG_abm_runs = DEBUG_abm_runs + 1 DEBUG_abm_time = DEBUG_abm_time + (t1 - t0) return unpack(r) end end -- Just in case a growing type or added node is missed (also catches existing -- nodes added to map before timers were incorporated). minetest.register_abm({ nodenames = { "group:growing" }, interval = 300, chance = 1, action = abm_func }) -- Plant timer function. -- Grows plants under the right conditions. function farming.plant_growth_timer(pos, elapsed, node_name) local stages = plant_stages[node_name] if not stages then return false end local max_growth = #stages.stages_left if max_growth <= 0 then return false end if stages.plant_name == "farming:cocoa" then if not minetest.find_node_near(pos, 1, {"default:jungletree", "moretrees:jungletree_leaves_green"}) then return true end else local under = minetest.get_node({ x = pos.x, y = pos.y - 1, z = pos.z }) if minetest.get_item_group(under.name, "soil") < 3 then return true end end local growth local light_pos = {x = pos.x, y = pos.y + 1, z = pos.z} local lambda = elapsed / STAGE_LENGTH_AVG if lambda < 0.1 then return true end if max_growth == 1 or lambda < 2.0 then local light = (minetest.get_node_light(light_pos) or 0) --print ("light level:", light) if not in_range(light, MIN_LIGHT, MAX_LIGHT) then return true end growth = 1 else local night_light = (minetest.get_node_light(light_pos, 0) or 0) local day_light = (minetest.get_node_light(light_pos, 0.5) or 0) local night_growth = in_range(night_light, MIN_LIGHT, MAX_LIGHT) local day_growth = in_range(day_light, MIN_LIGHT, MAX_LIGHT) if not night_growth then if not day_growth then return true end lambda = day_time(elapsed) / STAGE_LENGTH_AVG elseif not day_growth then lambda = night_time(elapsed) / STAGE_LENGTH_AVG end growth = statistics.poisson(lambda, max_growth) if growth < 1 then return true end end if minetest.registered_nodes[stages.stages_left[growth]] then minetest.swap_node(pos, {name = stages.stages_left[growth]}) else return true end return growth ~= max_growth end if farming.DEBUG then local timer_func = farming.plant_growth_timer; farming.plant_growth_timer = function(pos, elapsed, node_name) local t0 = minetest.get_us_time() local r = { timer_func(pos, elapsed, node_name) } local t1 = minetest.get_us_time() DEBUG_timer_runs = DEBUG_timer_runs + 1 DEBUG_timer_time = DEBUG_timer_time + (t1 - t0) return unpack(r) end end -- refill placed plant by crabman (26/08/2015) local can_refill_plant = { ["farming:blueberry_1"] = "farming:blueberries", ["farming:carrot_1"] = "farming:carrot", ["farming:coffee_1"] = "farming:coffee_beans", ["farming:corn_1"] = "farming:corn", ["farming:cotton_1"] = "farming:seed_cotton", ["farming:cucumber_1"] = "farming:cucumber", ["farming:melon_1"] = "farming:melon_slice", ["farming:potato_1"] = "farming:potato", ["farming:pumpkin_1"] = "farming:pumpkin_slice", ["farming:raspberry_1"] = "farming:raspberries", ["farming:rhubarb_1"] = "farming:rhubarb", ["farming:tomato_1"] = "farming:tomato", ["farming:wheat_1"] = "farming:seed_wheat", ["farming:grapes_1"] = "farming:grapes", ["farming:beans_1"] = "farming:beans", ["farming:rhubarb_1"] = "farming:rhubarb", ["farming:cocoa_1"] = "farming:cocoa_beans", ["farming:barley_1"] = "farming:seed_barley", ["farming:hemp_1"] = "farming:seed_hemp", } function farming.refill_plant(player, plantname, index) local inv = player:get_inventory() local old_stack = inv:get_stack("main", index) if old_stack:get_name() ~= "" then return end for i, stack in ipairs(inv:get_list("main")) do if stack:get_name() == plantname and i ~= index then inv:set_stack("main", index, stack) stack:clear() inv:set_stack("main", i, stack) --minetest.log("action", "farming: refilled stack("..plantname..") of " .. player:get_player_name() ) return end end end -- Place Seeds on Soil function farming.place_seed(itemstack, placer, pointed_thing, plantname) local pt = pointed_thing -- check if pointing at a node if not pt or pt.type ~= "node" then return end local under = minetest.get_node(pt.under) -- am I right-clicking on something that has a custom on_place set? -- thanks to Krock for helping with this issue :) local def = minetest.registered_nodes[under.name] if def and def.on_rightclick then return def.on_rightclick(pt.under, under, placer, itemstack) end local above = minetest.get_node(pt.above) -- check if pointing at the top of the node if pt.above.y ~= pt.under.y + 1 then return end -- return if any of the nodes is not registered if not minetest.registered_nodes[under.name] or not minetest.registered_nodes[above.name] then return end -- can I replace above node, and am I pointing at soil if not minetest.registered_nodes[above.name].buildable_to or minetest.get_item_group(under.name, "soil") < 2 -- avoid multiple seed placement bug or minetest.get_item_group(above.name, "plant") ~= 0 then return end -- if not protected then add node and remove 1 item from the itemstack if not minetest.is_protected(pt.above, placer:get_player_name()) then minetest.set_node(pt.above, {name = plantname, param2 = 1}) minetest.sound_play("default_place_node", {pos = pt.above, gain = 1.0}) if not minetest.setting_getbool("creative_mode") then itemstack:take_item() -- check for refill if itemstack:get_count() == 0 and can_refill_plant[plantname] then minetest.after(0.10, farming.refill_plant, placer, can_refill_plant[plantname], placer:get_wield_index() ) end end return itemstack end end -- Function to register plants (for compatibility) farming.register_plant = function(name, def) local mname = name:split(":")[1] local pname = name:split(":")[2] -- Check def table if not def.description then def.description = S("Seed") end if not def.inventory_image then def.inventory_image = "unknown_item.png" end if not def.steps then return nil end -- Register seed minetest.register_node(":" .. mname .. ":seed_" .. pname, { description = def.description, tiles = {def.inventory_image}, inventory_image = def.inventory_image, wield_image = def.inventory_image, drawtype = "signlike", groups = {seed = 1, snappy = 3, attached_node = 1}, paramtype = "light", paramtype2 = "wallmounted", walkable = false, sunlight_propagates = true, selection_box = farming.select, on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":" .. pname .. "_1") end, }) -- Register harvest minetest.register_craftitem(":" .. mname .. ":" .. pname, { description = pname:gsub("^%l", string.upper), inventory_image = mname .. "_" .. pname .. ".png", }) -- Register growing steps for i = 1, def.steps do local base_rarity = 1 if def.steps ~= 1 then base_rarity = 8 - (i - 1) * 7 / (def.steps - 1) end local drop = { items = { {items = {mname .. ":" .. pname}, rarity = base_rarity}, {items = {mname .. ":" .. pname}, rarity = base_rarity * 2}, {items = {mname .. ":seed_" .. pname}, rarity = base_rarity}, {items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2}, } } local g = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1, growing = 1} -- Last step doesn't need growing=1 so Abm never has to check these if i == def.steps then g.growing = 0 end local node_name = mname .. ":" .. pname .. "_" .. i minetest.register_node(node_name, { drawtype = "plantlike", waving = 1, tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"}, paramtype = "light", walkable = false, buildable_to = true, drop = drop, selection_box = farming.select, groups = g, sounds = default.node_sound_leaves_defaults(), }) -- register_plant_node(node_name) end -- Return info local r = {seed = mname .. ":seed_" .. pname, harvest = mname .. ":" .. pname} return r end -- default settings farming.carrot = true farming.potato = true farming.tomato = true farming.cucumber = true farming.corn = true farming.coffee = true farming.coffee = true farming.melon = true farming.sugar = true farming.pumpkin = true farming.cocoa = true farming.raspberry = true farming.blueberry = true farming.rhubarb = true farming.beans = true farming.grapes = true farming.barley = true farming.hemp = true farming.donuts = true -- Load new global settings if found inside mod folder local input = io.open(farming.path.."/farming.conf", "r") if input then dofile(farming.path .. "/farming.conf") input:close() input = nil end -- load new world-specific settings if found inside world folder local worldpath = minetest.get_worldpath() local input = io.open(worldpath.."/farming.conf", "r") if input then dofile(worldpath .. "/farming.conf") input:close() input = nil end -- load crops dofile(farming.path.."/soil.lua") dofile(farming.path.."/hoes.lua") dofile(farming.path.."/grass.lua") dofile(farming.path.."/wheat.lua") dofile(farming.path.."/cotton.lua") if farming.carrot then dofile(farming.path.."/carrot.lua") end if farming.potato then dofile(farming.path.."/potato.lua") end if farming.tomato then dofile(farming.path.."/tomato.lua") end if farming.cucumber then dofile(farming.path.."/cucumber.lua") end if farming.corn then dofile(farming.path.."/corn.lua") end if farming.coffee then dofile(farming.path.."/coffee.lua") end if farming.melon then dofile(farming.path.."/melon.lua") end if farming.sugar then dofile(farming.path.."/sugar.lua") end if farming.pumpkin then dofile(farming.path.."/pumpkin.lua") end if farming.cocoa then dofile(farming.path.."/cocoa.lua") end if farming.raspberry then dofile(farming.path.."/raspberry.lua") end if farming.blueberry then dofile(farming.path.."/blueberry.lua") end if farming.rhubarb then dofile(farming.path.."/rhubarb.lua") end if farming.beans then dofile(farming.path.."/beanpole.lua") end if farming.grapes then dofile(farming.path.."/grapes.lua") end if farming.barley then dofile(farming.path.."/barley.lua") end if farming.hemp then dofile(farming.path.."/hemp.lua") end if farming.donuts then dofile(farming.path.."/donut.lua") end dofile(farming.path.."/mapgen.lua") dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility dofile(farming.path.."/lucky_block.lua")
lgpl-2.1
gwlim/luci
protocols/ipv6/luasrc/model/network/proto_6x4.lua
78
1602
--[[ LuCI - Network model - 6to4, 6in4 & 6rd protocol extensions Copyright 2011 Jo-Philipp Wich <xm@subsignal.org> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ]]-- local netmod = luci.model.network local _, p for _, p in ipairs({"6in4", "6to4", "6rd"}) do local proto = netmod:register_protocol(p) function proto.get_i18n(self) if p == "6in4" then return luci.i18n.translate("IPv6-in-IPv4 (RFC4213)") elseif p == "6to4" then return luci.i18n.translate("IPv6-over-IPv4 (6to4)") elseif p == "6rd" then return luci.i18n.translate("IPv6-over-IPv4 (6rd)") end end function proto.ifname(self) return p .. "-" .. self.sid end function proto.opkg_package(self) return p end function proto.is_installed(self) return nixio.fs.access("/lib/netifd/proto/" .. p .. ".sh") end function proto.is_floating(self) return true end function proto.is_virtual(self) return true end function proto.get_interfaces(self) return nil end function proto.contains_interface(self, ifname) return (netmod:ifnameof(ifc) == self:ifname()) end netmod:register_pattern_virtual("^%s-%%w" % p) end
apache-2.0
ibm2431/darkstar
scripts/globals/items/blindfish.lua
11
1048
----------------------------------------- -- ID: 4313 -- Item: Blindfish -- Food Effect: 5Min, Mithra only ----------------------------------------- -- Dexterity 2 -- Mind -4 ----------------------------------------- require("scripts/globals/status") require("scripts/globals/msg") ----------------------------------------- function onItemCheck(target) local result = 0 if (target:getRace() ~= dsp.race.MITHRA) then result = dsp.msg.basic.CANNOT_EAT end if (target:getMod(dsp.mod.EAT_RAW_FISH) == 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,4313) end function onEffectGain(target, effect) target:addMod(dsp.mod.DEX, 2) target:addMod(dsp.mod.MND, -4) end function onEffectLose(target, effect) target:delMod(dsp.mod.DEX, 2) target:delMod(dsp.mod.MND, -4) end
gpl-3.0
icyxp/kong
spec/02-integration/04-admin_api/03-consumers_routes_spec.lua
3
31474
local helpers = require "spec.helpers" local cjson = require "cjson" local escape = require("socket.url").escape local function it_content_types(title, fn) local test_form_encoded = fn("application/x-www-form-urlencoded") local test_json = fn("application/json") it(title .. " with application/www-form-urlencoded", test_form_encoded) it(title .. " with application/json", test_json) end describe("Admin API", function() local client setup(function() helpers.run_migrations() assert(helpers.start_kong()) client = helpers.admin_client() end) teardown(function() if client then client:close() end helpers.stop_kong() end) local consumer, consumer2, consumer3 before_each(function() helpers.dao:truncate_tables() consumer = assert(helpers.dao.consumers:insert { username = "bob", custom_id = "1234" }) consumer2 = assert(helpers.dao.consumers:insert { username = "bob pop", -- containing space for urlencoded test custom_id = "abcd" }) consumer3 = assert(helpers.dao.consumers:insert { username = "83825bb5-38c7-4160-8c23-54dd2b007f31", -- uuid format custom_id = "1a2b" }) end) describe("/consumers", function() describe("POST", function() it_content_types("creates a Consumer", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers", body = { username = "consumer-post" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(201, res) local json = cjson.decode(body) assert.equal("consumer-post", json.username) assert.is_number(json.created_at) assert.is_string(json.id) end end) describe("errors", function() it_content_types("handles invalid input", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers", body = {}, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(400, res) local json = cjson.decode(body) assert.same( { custom_id = "At least a 'custom_id' or a 'username' must be specified", username = "At least a 'custom_id' or a 'username' must be specified" }, json ) end end) it_content_types("returns 409 on conflicting username", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers", body = { username = "bob" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(409, res) local json = cjson.decode(body) assert.same({ username = "already exists with value 'bob'" }, json) end end) it_content_types("returns 409 on conflicting custom_id", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers", body = { username = "tom", custom_id = consumer.custom_id, }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(409, res) local json = cjson.decode(body) assert.same({ custom_id = "already exists with value '1234'" }, json) end end) end) end) describe("PUT", function() it_content_types("creates if not exists", function(content_type) return function() local res = assert(client:send { method = "PUT", path = "/consumers", body = { username = "consumer-post" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(201, res) local json = cjson.decode(body) assert.equal("consumer-post", json.username) assert.is_number(json.created_at) assert.is_string(json.id) end end) it_content_types("replaces if exists", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers", body = { username = "alice" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(201, res) local json = cjson.decode(body) res = assert(client:send { method = "PUT", path = "/consumers", body = { id = json.id, username = "alicia", custom_id = "0000", created_at = 1461276890000 }, headers = {["Content-Type"] = content_type} }) body = assert.res_status(200, res) local updated_json = cjson.decode(body) assert.equal("alicia", updated_json.username) assert.equal("0000", updated_json.custom_id) assert.equal(json.id, updated_json.id) end end) describe("errors", function() it_content_types("handles invalid input", function(content_type) return function() local res = assert(client:send { method = "PUT", path = "/consumers", body = {}, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(400, res) local json = cjson.decode(body) assert.same( { custom_id = "At least a 'custom_id' or a 'username' must be specified", username = "At least a 'custom_id' or a 'username' must be specified" }, json ) end end) it_content_types("returns 409 on conflict", function(content_type) -- @TODO this particular test actually defeats the purpose of PUT. -- It should probably replace the entity return function() local res = assert(client:send { method = "PUT", path = "/consumers", body = { username = "alice" }, headers = {["Content-Type"] = content_type} }) assert.res_status(201, res) res = assert(client:send { method = "PUT", path = "/consumers", body = { username = "alice", custom_id = "0000" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(409, res) local json = cjson.decode(body) assert.same({ username = "already exists with value 'alice'" }, json) end end) end) end) describe("GET", function() before_each(function() helpers.dao:truncate_tables() for i = 1, 10 do assert(helpers.dao.consumers:insert { username = "consumer-" .. i, }) end end) teardown(function() helpers.dao:truncate_tables() end) it("retrieves the first page", function() local res = assert(client:send { methd = "GET", path = "/consumers" }) res = assert.res_status(200, res) local json = cjson.decode(res) assert.equal(10, #json.data) assert.equal(10, json.total) end) it("paginates a set", function() local pages = {} local offset for i = 1, 4 do local res = assert(client:send { method = "GET", path = "/consumers", query = {size = 3, offset = offset} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equal(10, json.total) if i < 4 then assert.equal(3, #json.data) else assert.equal(1, #json.data) end if i > 1 then -- check all pages are different assert.not_same(pages[i-1], json) end offset = json.offset pages[i] = json end end) it("handles invalid filters", function() local res = assert(client:send { method = "GET", path = "/consumers", query = {foo = "bar"} }) local body = assert.res_status(400, res) local json = cjson.decode(body) assert.same({ foo = "unknown field" }, json) end) end) it("returns 405 on invalid method", function() local methods = {"DELETE", "PATCH"} for i = 1, #methods do local res = assert(client:send { method = methods[i], path = "/consumers", body = {}, -- tmp: body to allow POST/PUT to work headers = {["Content-Type"] = "application/json"} }) local body = assert.response(res).has.status(405) local json = cjson.decode(body) assert.same({ message = "Method not allowed" }, json) end end) describe("/consumers/{consumer}", function() describe("GET", function() it("retrieves by id", function() local res = assert(client:send { method = "GET", path = "/consumers/" .. consumer.id }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.same(consumer, json) end) it("retrieves by username", function() local res = assert(client:send { method = "GET", path = "/consumers/" .. consumer.username }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.same(consumer, json) end) it("retrieves by username in uuid format", function() local res = assert(client:send { method = "GET", path = "/consumers/" .. consumer3.username }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.same(consumer3, json) end) it("retrieves by urlencoded username", function() local res = assert(client:send { method = "GET", path = "/consumers/" .. escape(consumer2.username) }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.same(consumer2, json) end) it("returns 404 if not found", function() local res = assert(client:send { method = "GET", path = "/consumers/_inexistent_" }) assert.res_status(404, res) end) end) describe("PATCH", function() it_content_types("updates by id", function(content_type) return function() local res = assert(client:send { method = "PATCH", path = "/consumers/" .. consumer.id, body = { username = "alice" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equal("alice", json.username) assert.equal(consumer.id, json.id) local in_db = assert(helpers.dao.consumers:find {id = consumer.id}) assert.same(json, in_db) end end) it_content_types("updates by username", function(content_type) return function() local res = assert(client:send { method = "PATCH", path = "/consumers/" .. consumer.username, body = { username = "alice" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equal("alice", json.username) assert.equal(consumer.id, json.id) local in_db = assert(helpers.dao.consumers:find {id = consumer.id}) assert.same(json, in_db) end end) describe("errors", function() it_content_types("returns 404 if not found", function(content_type) return function() local res = assert(client:send { method = "PATCH", path = "/consumers/_inexistent_", body = { username = "alice" }, headers = {["Content-Type"] = content_type} }) assert.res_status(404, res) end end) it_content_types("handles invalid input", function(content_type) return function() local res = assert(client:send { method = "PATCH", path = "/consumers/" .. consumer.id, body = {}, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(400, res) local json = cjson.decode(body) assert.same({ message = "empty body" }, json) end end) end) end) describe("DELETE", function() it("deletes by id", function() local res = assert(client:send { method = "DELETE", path = "/consumers/" .. consumer.id }) local body = assert.res_status(204, res) assert.equal("", body) end) it("deletes by username", function() local res = assert(client:send { method = "DELETE", path = "/consumers/" .. consumer.username }) local body = assert.res_status(204, res) assert.equal("", body) end) describe("error", function() it("returns 404 if not found", function() local res = assert(client:send { method = "DELETE", path = "/consumers/_inexistent_" }) assert.res_status(404, res) end) end) end) end) end) describe("/consumers/{username_or_id}/plugins", function() before_each(function() helpers.dao.plugins:truncate() end) describe("POST", function() it_content_types("creates a plugin config using a consumer id", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers/" .. consumer.id .. "/plugins", body = { name = "rewriter", ["config.value"] = "potato", }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(201, res) local json = cjson.decode(body) assert.equal("rewriter", json.name) assert.same("potato", json.config.value) end end) it_content_types("creates a plugin config using a consumer username with a space on it", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers/" .. consumer2.username .. "/plugins", body = { name = "rewriter", ["config.value"] = "potato", }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(201, res) local json = cjson.decode(body) assert.equal("rewriter", json.name) assert.same("potato", json.config.value) end end) it_content_types("creates a plugin config using a consumer username in uuid format", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers/" .. consumer3.username .. "/plugins", body = { name = "rewriter", ["config.value"] = "potato", }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(201, res) local json = cjson.decode(body) assert.equal("rewriter", json.name) assert.same("potato", json.config.value) end end) describe("errors", function() it_content_types("handles invalid input", function(content_type) return function() local res = assert(client:send { method = "POST", path = "/consumers/" .. consumer.id .. "/plugins", body = {}, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(400, res) local json = cjson.decode(body) assert.same({ name = "name is required" }, json) end end) it_content_types("returns 409 on conflict", function(content_type) return function() -- insert initial plugin local res = assert(client:send { method = "POST", path = "/consumers/" .. consumer.id .. "/plugins", body = { name="rewriter", }, headers = {["Content-Type"] = content_type} }) assert.response(res).has.status(201) assert.response(res).has.jsonbody() -- do it again, to provoke the error local res = assert(client:send { method = "POST", path = "/consumers/" .. consumer.id .. "/plugins", body = { name="rewriter", }, headers = {["Content-Type"] = content_type} }) assert.response(res).has.status(409) local json = assert.response(res).has.jsonbody() assert.same({ name = "already exists with value 'rewriter'"}, json) end end) end) end) describe("PUT", function() it_content_types("creates if not exists", function(content_type) return function() local res = assert(client:send { method = "PUT", path = "/consumers/" .. consumer.id .. "/plugins", body = { name = "rewriter", ["config.value"] = "potato", }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(201, res) local json = cjson.decode(body) assert.equal("rewriter", json.name) assert.equal("potato", json.config.value) end end) it_content_types("replaces if exists", function(content_type) return function() local res = assert(client:send { method = "PUT", path = "/consumers/" .. consumer.id .. "/plugins", body = { name = "rewriter", ["config.value"] = "potato", created_at = 1461276890000 }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(201, res) local json = cjson.decode(body) res = assert(client:send { method = "PUT", path = "/consumers/" .. consumer.id .. "/plugins", body = { id = json.id, name = "rewriter", ["config.value"] = "carrot", created_at = 1461276890000 }, headers = {["Content-Type"] = content_type} }) body = assert.res_status(200, res) json = cjson.decode(body) assert.equal("rewriter", json.name) assert.equal("carrot", json.config.value) end end) it_content_types("prefers default values when replacing", function(content_type) return function() local plugin = assert(helpers.dao.plugins:insert { name = "rewriter", consumer_id = consumer.id, config = { value = "potato", extra = "super" } }) assert.equal("potato", plugin.config.value) assert.equal("super", plugin.config.extra) local res = assert(client:send { method = "PUT", path = "/consumers/" .. consumer.id .. "/plugins", body = { id = plugin.id, name = "rewriter", ["config.value"] = "carrot", created_at = 1461276890000 }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equal(json.config.value, "carrot") assert.equal(json.config.extra, "extra") -- changed to the default value plugin = assert(helpers.dao.plugins:find { id = plugin.id, name = plugin.name }) assert.equal(plugin.config.value, "carrot") assert.equal(plugin.config.extra, "extra") -- changed to the default value end end) it_content_types("overrides a plugin previous config if partial", function(content_type) return function() local plugin = assert(helpers.dao.plugins:insert { name = "rewriter", consumer_id = consumer.id }) assert.equal("extra", plugin.config.extra) local res = assert(client:send { method = "PUT", path = "/consumers/" .. consumer.id .. "/plugins", body = { id = plugin.id, name = "rewriter", ["config.extra"] = "super", created_at = 1461276890000 }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.same("super", json.config.extra) end end) it_content_types("updates the enabled property", function(content_type) return function() local plugin = assert(helpers.dao.plugins:insert { name = "rewriter", consumer_id = consumer.id }) assert.True(plugin.enabled) local res = assert(client:send { method = "PUT", path = "/consumers/" .. consumer.id .. "/plugins", body = { id = plugin.id, name = "rewriter", enabled = false, created_at = 1461276890000 }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.False(json.enabled) plugin = assert(helpers.dao.plugins:find { id = plugin.id, name = plugin.name }) assert.False(plugin.enabled) end end) describe("errors", function() it_content_types("handles invalid input", function(content_type) return function() local res = assert(client:send { method = "PUT", path = "/consumers/" .. consumer.id .. "/plugins", body = {}, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(400, res) local json = cjson.decode(body) assert.same({ name = "name is required" }, json) end end) end) end) describe("GET", function() it("retrieves the first page", function() assert(helpers.dao.plugins:insert { name = "rewriter", consumer_id = consumer.id }) local res = assert(client:send { method = "GET", path = "/consumers/" .. consumer.id .. "/plugins" }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equal(1, #json.data) end) it("ignores an invalid body", function() local res = assert(client:send { method = "GET", path = "/consumers/" .. consumer.id .. "/plugins", body = "this fails if decoded as json", headers = { ["Content-Type"] = "application/json", } }) assert.res_status(200, res) end) end) end) describe("/consumers/{username_or_id}/plugins/{plugin}", function() local plugin, plugin2 before_each(function() plugin = assert(helpers.dao.plugins:insert { name = "rewriter", consumer_id = consumer.id }) plugin2 = assert(helpers.dao.plugins:insert { name = "rewriter", consumer_id = consumer2.id }) end) describe("GET", function() it("retrieves by id", function() local res = assert(client:send { method = "GET", path = "/consumers/" .. consumer.id .. "/plugins/" .. plugin.id }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.same(plugin, json) end) it("retrieves by consumer id when it has spaces", function() local res = assert(client:send { method = "GET", path = "/consumers/" .. consumer2.id .. "/plugins/" .. plugin2.id }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.same(plugin2, json) end) it("only retrieves if associated to the correct consumer", function() -- Create an consumer and try to query our plugin through it local w_consumer = assert(helpers.dao.consumers:insert { custom_id = "wc", username = "wrong-consumer" }) -- Try to request the plugin through it (belongs to the fixture consumer instead) local res = assert(client:send { method = "GET", path = "/consumers/" .. w_consumer.id .. "/plugins/" .. plugin.id }) assert.res_status(404, res) end) it("ignores an invalid body", function() local res = assert(client:send { method = "GET", path = "/consumers/" .. consumer.id .. "/plugins/" .. plugin.id, body = "this fails if decoded as json", headers = { ["Content-Type"] = "application/json", } }) assert.res_status(200, res) end) end) describe("PATCH", function() it_content_types("updates if found", function(content_type) return function() local res = assert(client:send { method = "PATCH", path = "/consumers/" .. consumer.id .. "/plugins/" .. plugin.id, body = { ["config.value"] = "updated" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equal("updated", json.config.value) assert.equal(plugin.id, json.id) local in_db = assert(helpers.dao.plugins:find { id = plugin.id, name = plugin.name }) assert.same(json, in_db) end end) it_content_types("doesn't override a plugin config if partial", function(content_type) -- This is delicate since a plugin config is a text field in a DB like Cassandra return function() plugin = assert(helpers.dao.plugins:update( { config = { value = "potato" } }, { id = plugin.id, name = plugin.name } )) assert.equal("potato", plugin.config.value) assert.equal("extra", plugin.config.extra ) local res = assert(client:send { method = "PATCH", path = "/consumers/" .. consumer.id .. "/plugins/" .. plugin.id, body = { ["config.value"] = "carrot", }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.equal("carrot", json.config.value) assert.equal("extra", json.config.extra) plugin = assert(helpers.dao.plugins:find { id = plugin.id, name = plugin.name }) assert.equal("carrot", plugin.config.value) assert.equal("extra", plugin.config.extra) end end) it_content_types("updates the enabled property", function(content_type) return function() local res = assert(client:send { method = "PATCH", path = "/consumers/" .. consumer.id .. "/plugins/" .. plugin.id, body = { name = "rewriter", enabled = false }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(200, res) local json = cjson.decode(body) assert.False(json.enabled) plugin = assert(helpers.dao.plugins:find { id = plugin.id, name = plugin.name }) assert.False(plugin.enabled) end end) describe("errors", function() it_content_types("returns 404 if not found", function(content_type) return function() local res = assert(client:send { method = "PATCH", path = "/consumers/" .. consumer.id .. "/plugins/b6cca0aa-4537-11e5-af97-23a06d98af51", body = {}, headers = {["Content-Type"] = content_type} }) assert.res_status(404, res) end end) it_content_types("handles invalid input", function(content_type) return function() local res = assert(client:send { method = "PATCH", path = "/consumers/" .. consumer.id .. "/plugins/" .. plugin.id, body = { name = "foo" }, headers = {["Content-Type"] = content_type} }) local body = assert.res_status(400, res) local json = cjson.decode(body) assert.same({ config = "Plugin \"foo\" not found" }, json) end end) end) end) describe("DELETE", function() it("deletes a plugin configuration", function() local res = assert(client:send { method = "DELETE", path = "/consumers/" .. consumer.id .. "/plugins/" .. plugin.id }) assert.res_status(204, res) end) describe("errors", function() it("returns 404 if not found", function() local res = assert(client:send { method = "DELETE", path = "/consumers/" .. consumer.id .. "/plugins/fafafafa-1234-baba-5678-cececececece" }) assert.res_status(404, res) end) end) end) end) end)
apache-2.0
ibm2431/darkstar
scripts/zones/Batallia_Downs/npcs/qm4.lua
9
1106
----------------------------------- -- Area: Batallia Downs -- NPC: qm4 (???) -- ----------------------------------- local ID = require("scripts/zones/Batallia_Downs/IDs"); require("scripts/globals/missions"); require("scripts/globals/keyitems"); ----------------------------------- function onTrigger(player,npc) local missionProgress = player:getCharVar("COP_Tenzen_s_Path") if (player:getCurrentMission(COP) == dsp.mission.id.cop.THREE_PATHS and missionProgress == 5) then player:startEvent(0); elseif (player:getCurrentMission(COP) == dsp.mission.id.cop.THREE_PATHS and (missionProgress == 6 or missionProgress == 7) and player:hasKeyItem(dsp.ki.DELKFUTT_RECOGNITION_DEVICE) == false) then player:addKeyItem(dsp.ki.DELKFUTT_RECOGNITION_DEVICE); player:messageSpecial(ID.text.KEYITEM_OBTAINED,dsp.ki.DELKFUTT_RECOGNITION_DEVICE); end end; function onTrade(player,npc,trade) end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 0) then player:setCharVar("COP_Tenzen_s_Path",6); end end;
gpl-3.0
ibm2431/darkstar
scripts/globals/spells/bluemagic/regurgitation.lua
12
1960
----------------------------------------- -- Spell: Regurgitation -- Deals Water damage to an enemy. Additional Effect: Bind -- Spell cost: 69 MP -- Monster Type: Lizards -- Spell Type: Magical (Water) -- Blue Magic Points: 1 -- Stat Bonus: INT+1 MND+1 MP+3 -- Level: 68 -- Casting Time: 5 seconds -- Recast Time: 24 seconds -- Magic Bursts on: Reverberation, Distortion, and Darkness -- Combos: Resist Gravity ----------------------------------------- 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 = {} params.multiplier = 1.83 params.tMultiplier = 2.0 params.duppercap = 69 params.str_wsc = 0.0 params.dex_wsc = 0.0 params.vit_wsc = 0.0 params.agi_wsc = 0.0 params.int_wsc = 0.0 params.mnd_wsc = 0.30 params.chr_wsc = 0.0 damage = BlueMagicalSpell(caster, target, spell, params, INT_BASED) if (caster:isBehind(target, 15)) then -- guesstimating the angle at 15 degrees here damage = math.floor(damage * 1.25) -- printf("is behind mob") end damage = BlueFinalAdjustments(caster, target, spell, damage, params) --TODO: Knockback? Where does that get handled? How much knockback does it have? local params = {} params.diff = caster:getStat(dsp.mod.INT) - target:getStat(dsp.mod.INT) params.attribute = dsp.mod.INT params.skillType = dsp.skill.BLUE_MAGIC params.bonus = 1.0 local resist = applyResistance(caster, target, spell, params) if (damage > 0 and resist > 0.125) then local typeEffect = dsp.effect.BIND target:delStatusEffect(typeEffect) target:addStatusEffect(typeEffect,1,0,getBlueEffectDuration(caster,resist,typeEffect)) end return damage end
gpl-3.0
wizardbottttt/wizard
plugins/search_youtube.lua
674
1270
do local google_config = load_from_file('data/google.lua') local function httpsRequest(url) print(url) local res,code = https.request(url) if code ~= 200 then return nil end return json:decode(res) end local function searchYoutubeVideos(text) local url = 'https://www.googleapis.com/youtube/v3/search?' url = url..'part=snippet'..'&maxResults=4'..'&type=video' url = url..'&q='..URL.escape(text) if google_config.api_keys then local i = math.random(#google_config.api_keys) local api_key = google_config.api_keys[i] if api_key then url = url.."&key="..api_key end end local data = httpsRequest(url) if not data then print("HTTP Error") return nil elseif not data.items then return nil end return data.items end local function run(msg, matches) local text = '' local items = searchYoutubeVideos(matches[1]) if not items then return "Error!" end for k,item in pairs(items) do text = text..'http://youtu.be/'..item.id.videoId..' '.. item.snippet.title..'\n\n' end return text end return { description = "Search video on youtube and send it.", usage = "!youtube [term]: Search for a youtube video and send it.", patterns = { "^!youtube (.*)" }, run = run } end
gpl-2.0
ibm2431/darkstar
scripts/zones/Tavnazian_Safehold/npcs/Justinius.lua
9
1569
----------------------------------- -- Area: Tavnazian Safehold -- NPC: Justinius -- Involved in mission : COP2-3 -- !pos 76 -34 68 26 ----------------------------------- require("scripts/globals/titles"); require("scripts/globals/missions"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) if (player:getCurrentMission(COP) == dsp.mission.id.cop.DISTANT_BELIEFS and player:getCharVar("PromathiaStatus") == 3) then player:startEvent(113); elseif (player:getCurrentMission(COP) == dsp.mission.id.cop.SHELTERING_DOUBT and player:getCharVar("PromathiaStatus") == 2) then player:startEvent(109); elseif (player:getCurrentMission(COP) == dsp.mission.id.cop.THE_SAVAGE and player:getCharVar("PromathiaStatus") == 2) then player:startEvent(110); else player:startEvent(123); end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 113) then player:setCharVar("PromathiaStatus",0); player:completeMission(COP,dsp.mission.id.cop.DISTANT_BELIEFS); player:addMission(COP,dsp.mission.id.cop.AN_ETERNAL_MELODY); elseif (csid == 109) then player:setCharVar("PromathiaStatus",3); elseif (csid == 110) then player:setCharVar("PromathiaStatus",0); player:completeMission(COP,dsp.mission.id.cop.THE_SAVAGE); player:addMission(COP,dsp.mission.id.cop.THE_SECRETS_OF_WORSHIP); player:addTitle(dsp.title.NAGMOLADAS_UNDERLING); end end;
gpl-3.0
ibm2431/darkstar
scripts/globals/promyvion.lua
12
3892
require("scripts/zones/Promyvion-Dem/IDs") require("scripts/zones/Promyvion-Holla/IDs") require("scripts/zones/Promyvion-Mea/IDs") require("scripts/zones/Promyvion-Vahzl/IDs") require("scripts/globals/status") ------------------------------------ dsp = dsp or {} dsp.promyvion = dsp.promyvion or {} ------------------------------------ -- LOCAL FUNCTIONS ------------------------------------ local function maxFloor(ID) local m = 0 for _, v in pairs(ID.mob.MEMORY_RECEPTACLES) do m = math.max(m, v[1]) end return m end local function randomizeFloorExit(ID, floor) local streams = {} for _, v in pairs(ID.mob.MEMORY_RECEPTACLES) do if v[1] == floor then GetNPCByID(v[3]):setLocalVar("[promy]floorExit", 0) table.insert(streams, v[3]) end end local exitStreamId = streams[math.random(#streams)] GetNPCByID(exitStreamId):setLocalVar("[promy]floorExit", 1) end local function findMother(mob) local ID = zones[mob:getZoneID()] local mobId = mob:getID() local mother = 0 for k, v in pairs(ID.mob.MEMORY_RECEPTACLES) do if k < mobId and k > mother then mother = k end end return mother end ------------------------------------ -- PUBLIC FUNCTIONS ------------------------------------ dsp.promyvion.initZone = function(zone) local ID = zones[zone:getID()] -- register teleporter regions for k, v in pairs(ID.npc.MEMORY_STREAMS) do zone:registerRegion(k,v[1],v[2],v[3],v[4],v[5],v[6]) end -- randomize floor exits for i = 1, maxFloor(ID) do randomizeFloorExit(ID, i) end end dsp.promyvion.strayOnSpawn = function(mob) local mother = GetMobByID(findMother(mob)) if mother ~= nil and mother:isSpawned() then mob:setPos(mother:getXPos(), mother:getYPos() - 5, mother:getZPos()) mother:AnimationSub(1) end end dsp.promyvion.receptacleOnFight = function(mob, target) if os.time() > mob:getLocalVar("[promy]nextStray") then local ID = zones[mob:getZoneID()] local mobId = mob:getID() local numStrays = ID.mob.MEMORY_RECEPTACLES[mobId][2] for i = mobId + 1, mobId + numStrays do local stray = GetMobByID(i) if not stray:isSpawned() then mob:setLocalVar("[promy]nextStray", os.time() + 20) stray:spawn() stray:updateEnmity(target) break end end else mob:AnimationSub(2) end end dsp.promyvion.receptacleOnDeath = function(mob, isKiller) if isKiller then local ID = zones[mob:getZoneID()] local mobId = mob:getID() local floor = ID.mob.MEMORY_RECEPTACLES[mobId][1] local streamId = ID.mob.MEMORY_RECEPTACLES[mobId][3] local stream = GetNPCByID(streamId) mob:AnimationSub(0) -- open floor exit portal if stream:getLocalVar("[promy]floorExit") == 1 then randomizeFloorExit(ID, floor) local events = ID.npc.MEMORY_STREAMS[streamId][7] local event = events[math.random(#events)] stream:setLocalVar("[promy]destination",event) stream:openDoor(180) end end end dsp.promyvion.onRegionEnter = function(player, region) if player:getAnimation() == 0 then local ID = zones[player:getZoneID()] local regionId = region:GetRegionID() local event = nil if regionId < 100 then event = ID.npc.MEMORY_STREAMS[regionId][7][1] else local stream = GetNPCByID(regionId) if stream ~= nil and stream:getAnimation() == dsp.anim.OPEN_DOOR then event = stream:getLocalVar("[promy]destination") end end if event ~= nil then player:startEvent(event) end end end
gpl-3.0
greasydeal/darkstar
scripts/globals/status.lua
2
76144
------------------------------------ -- -- STATUSES AND MODS -- -- Contains variable-ized definitions of things like core enums for use in lua scripts. ------------------------------------ ------------------------------------ -- Job IDs ------------------------------------ JOB_NON = 0 JOB_WAR = 1 JOB_MNK = 2 JOB_WHM = 3 JOB_BLM = 4 JOB_RDM = 5 JOB_THF = 6 JOB_PLD = 7 JOB_DRK = 8 JOB_BST = 9 JOB_BRD = 10 JOB_RNG = 11 JOB_SAM = 12 JOB_NIN = 13 JOB_DRG = 14 JOB_SMN = 15 JOB_BLU = 16 JOB_COR = 17 JOB_PUP = 18 JOB_DNC = 19 JOB_SCH = 20 JOB_GEO = 21 JOB_RUN = 22 MAX_JOB_TYPE = 23 ------------------------------------ -- STATUSES ------------------------------------ STATUS_NORMAL = 0; STATUS_UPDATE = 1; STATUS_DISAPPEAR = 2; STATUS_3 = 3; STATUS_4 = 4; STATUS_CUTSCENE_ONLY = 6; STATUS_18 = 18; STATUS_SHUTDOWN = 20; ------------------------------------ -- These codes represent the subeffects for -- additional effects animations from battleentity.h ------------------------------------ -- ATTACKS SUBEFFECT_FIRE_DAMAGE = 1; -- 110000 3 SUBEFFECT_ICE_DAMAGE = 2; -- 1-01000 5 SUBEFFECT_WIND_DAMAGE = 3; -- 111000 7 SUBEFFECT_EARTH_DAMAGE = 4; -- 1-00100 9 SUBEFFECT_LIGHTNING_DAMAGE = 5; -- 110100 11 SUBEFFECT_WATER_DAMAGE = 6; -- 1-01100 13 SUBEFFECT_LIGHT_DAMAGE = 7; -- 111100 15 SUBEFFECT_DARKNESS_DAMAGE = 8; -- 1-00010 17 SUBEFFECT_SLEEP = 9; -- 110010 19 SUBEFFECT_POISON = 10; -- 1-01010 21 SUBEFFECT_PARALYSIS = 11; SUBEFFECT_BLIND = 12; -- 1-00110 25 SUBEFFECT_SILENCE = 13; SUBEFFECT_PETRIFY = 14; SUBEFFECT_PLAGUE = 15; SUBEFFECT_STUN = 16; SUBEFFECT_CURSE = 17; SUBEFFECT_DEFENSE_DOWN = 18; -- 1-01001 37 SUBEFFECT_EVASION_DOWN = 18; -- ID needs verification SUBEFFECT_ATTACK_DOWN = 18; -- ID needs verification SUBEFFECT_DEATH = 19; SUBEFFECT_SHIELD = 20; SUBEFFECT_HP_DRAIN = 21; -- 1-10101 43 SUBEFFECT_MP_DRAIN = 22; -- This is correct animation SUBEFFECT_TP_DRAIN = 22; -- Not sure this is correct, might be 21 SUBEFFECT_HASTE = 23; -- SPIKES SUBEFFECT_BLAZE_SPIKES = 1; -- 01-1000 6 SUBEFFECT_ICE_SPIKES = 2; -- 01-0100 10 SUBEFFECT_DREAD_SPIKES = 3; -- 01-1100 14 SUBEFFECT_CURSE_SPIKES = 4; -- 01-0010 18 SUBEFFECT_SHOCK_SPIKES = 5; -- 01-1010 22 SUBEFFECT_REPRISAL = 6; -- 01-0110 26 SUBEFFECT_WIND_SPIKES = 7; SUBEFFECT_STONE_SPIKES = 8; SUBEFFECT_COUNTER = 63; -- SKILLCHAINS SUBEFFECT_NONE = 0; SUBEFFECT_LIGHT = 1; SUBEFFECT_DARKNESS = 2; SUBEFFECT_GRAVITATION = 3; SUBEFFECT_FRAGMENTATION = 4; SUBEFFECT_DISTORTION = 5; SUBEFFECT_FUSION = 6; SUBEFFECT_COMPRESSION = 7; SUBEFFECT_LIQUEFACATION = 8; SUBEFFECT_INDURATION = 9; SUBEFFECT_REVERBERATION = 10; SUBEFFECT_TRANSFIXION = 11; SUBEFFECT_SCISSION = 12; SUBEFFECT_DETONATION = 13; SUBEFFECT_IMPACTION = 14; ------------------------------------ -- These codes represent the actual status effects. -- They are simply for convenience. ------------------------------------ EFFECT_KO = 0 EFFECT_WEAKNESS = 1 EFFECT_SLEEP_I = 2 EFFECT_POISON = 3 EFFECT_PARALYSIS = 4 EFFECT_BLINDNESS = 5 EFFECT_SILENCE = 6 EFFECT_PETRIFICATION = 7 EFFECT_DISEASE = 8 EFFECT_CURSE_I = 9 EFFECT_STUN = 10 EFFECT_BIND = 11 EFFECT_WEIGHT = 12 EFFECT_SLOW = 13 EFFECT_CHARM_I = 14 EFFECT_DOOM = 15 EFFECT_AMNESIA = 16 EFFECT_CHARM_II = 17 EFFECT_GRADUAL_PETRIFICATION = 18 EFFECT_SLEEP_II = 19 EFFECT_CURSE_II = 20 EFFECT_ADDLE = 21 EFFECT_INTIMIDATE = 22 EFFECT_KAUSTRA = 23 EFFECT_TERROR = 28 EFFECT_MUTE = 29 EFFECT_BANE = 30 EFFECT_PLAGUE = 31 EFFECT_FLEE = 32 EFFECT_HASTE = 33 EFFECT_BLAZE_SPIKES = 34 EFFECT_ICE_SPIKES = 35 EFFECT_BLINK = 36 EFFECT_STONESKIN = 37 EFFECT_SHOCK_SPIKES = 38 EFFECT_AQUAVEIL = 39 EFFECT_PROTECT = 40 EFFECT_SHELL = 41 EFFECT_REGEN = 42 EFFECT_REFRESH = 43 EFFECT_MIGHTY_STRIKES = 44 EFFECT_BOOST = 45 EFFECT_HUNDRED_FISTS = 46 EFFECT_MANAFONT = 47 EFFECT_CHAINSPELL = 48 EFFECT_PERFECT_DODGE = 49 EFFECT_INVINCIBLE = 50 EFFECT_BLOOD_WEAPON = 51 EFFECT_SOUL_VOICE = 52 EFFECT_EAGLE_EYE_SHOT = 53 EFFECT_MEIKYO_SHISUI = 54 EFFECT_ASTRAL_FLOW = 55 EFFECT_BERSERK = 56 EFFECT_DEFENDER = 57 EFFECT_AGGRESSOR = 58 EFFECT_FOCUS = 59 EFFECT_DODGE = 60 EFFECT_COUNTERSTANCE = 61 EFFECT_SENTINEL = 62 EFFECT_SOULEATER = 63 EFFECT_LAST_RESORT = 64 EFFECT_SNEAK_ATTACK = 65 EFFECT_COPY_IMAGE = 66 EFFECT_THIRD_EYE = 67 EFFECT_WARCRY = 68 EFFECT_INVISIBLE = 69 EFFECT_DEODORIZE = 70 EFFECT_SNEAK = 71 EFFECT_SHARPSHOT = 72 EFFECT_BARRAGE = 73 EFFECT_HOLY_CIRCLE = 74 EFFECT_ARCANE_CIRCLE = 75 EFFECT_HIDE = 76 EFFECT_CAMOUFLAGE = 77 EFFECT_DIVINE_SEAL = 78 EFFECT_ELEMENTAL_SEAL = 79 EFFECT_STR_BOOST = 80 EFFECT_DEX_BOOST = 81 EFFECT_VIT_BOOST = 82 EFFECT_AGI_BOOST = 83 EFFECT_INT_BOOST = 84 EFFECT_MND_BOOST = 85 EFFECT_CHR_BOOST = 86 EFFECT_TRICK_ATTACK = 87 EFFECT_MAX_HP_BOOST = 88 EFFECT_MAX_MP_BOOST = 89 EFFECT_ACCURACY_BOOST = 90 EFFECT_ATTACK_BOOST = 91 EFFECT_EVASION_BOOST = 92 EFFECT_DEFENSE_BOOST = 93 EFFECT_ENFIRE = 94 EFFECT_ENBLIZZARD = 95 EFFECT_ENAERO = 96 EFFECT_ENSTONE = 97 EFFECT_ENTHUNDER = 98 EFFECT_ENWATER = 99 EFFECT_BARFIRE = 100 EFFECT_BARBLIZZARD = 101 EFFECT_BARAERO = 102 EFFECT_BARSTONE = 103 EFFECT_BARTHUNDER = 104 EFFECT_BARWATER = 105 EFFECT_BARSLEEP = 106 EFFECT_BARPOISON = 107 EFFECT_BARPARALYZE = 108 EFFECT_BARBLIND = 109 EFFECT_BARSILENCE = 110 EFFECT_BARPETRIFY = 111 EFFECT_BARVIRUS = 112 EFFECT_RERAISE = 113 EFFECT_COVER = 114 EFFECT_UNLIMITED_SHOT = 115 EFFECT_PHALANX = 116 EFFECT_WARDING_CIRCLE = 117 EFFECT_ANCIENT_CIRCLE = 118 EFFECT_STR_BOOST_II = 119 EFFECT_DEX_BOOST_II = 120 EFFECT_VIT_BOOST_II = 121 EFFECT_AGI_BOOST_II = 122 EFFECT_INT_BOOST_II = 123 EFFECT_MND_BOOST_II = 124 EFFECT_CHR_BOOST_II = 125 EFFECT_SPIRIT_SURGE = 126 EFFECT_COSTUME = 127 EFFECT_BURN = 128 EFFECT_FROST = 129 EFFECT_CHOKE = 130 EFFECT_RASP = 131 EFFECT_SHOCK = 132 EFFECT_DROWN = 133 EFFECT_DIA = 134 EFFECT_BIO = 135 EFFECT_STR_DOWN = 136 EFFECT_DEX_DOWN = 137 EFFECT_VIT_DOWN = 138 EFFECT_AGI_DOWN = 139 EFFECT_INT_DOWN = 140 EFFECT_MND_DOWN = 141 EFFECT_CHR_DOWN = 142 EFFECT_LEVEL_RESTRICTION = 143 EFFECT_MAX_HP_DOWN = 144 EFFECT_MAX_MP_DOWN = 145 EFFECT_ACCURACY_DOWN = 146 EFFECT_ATTACK_DOWN = 147 EFFECT_EVASION_DOWN = 148 EFFECT_DEFENSE_DOWN = 149 EFFECT_PHYSICAL_SHIELD = 150 EFFECT_ARROW_SHIELD = 151 EFFECT_MAGIC_SHIELD = 152 EFFECT_DAMAGE_SPIKES = 153 EFFECT_SHINING_RUBY = 154 EFFECT_MEDICINE = 155 EFFECT_FLASH = 156 EFFECT_SJ_RESTRICTION = 157 EFFECT_PROVOKE = 158 EFFECT_PENALTY = 159 EFFECT_PREPARATIONS = 160 EFFECT_SPRINT = 161 EFFECT_ENCHANTMENT = 162 EFFECT_AZURE_LORE = 163 EFFECT_CHAIN_AFFINITY = 164 EFFECT_BURST_AFFINITY = 165 EFFECT_OVERDRIVE = 166 EFFECT_MAGIC_DEF_DOWN = 167 EFFECT_INHIBIT_TP = 168 EFFECT_POTENCY = 169 EFFECT_REGAIN = 170 EFFECT_PAX = 171 EFFECT_INTENSION = 172 EFFECT_DREAD_SPIKES = 173 EFFECT_MAGIC_ACC_DOWN = 174 EFFECT_MAGIC_ATK_DOWN = 175 EFFECT_QUICKENING = 176 EFFECT_ENCUMBRANCE_II = 177 EFFECT_FIRESTORM = 178 EFFECT_HAILSTORM = 179 EFFECT_WINDSTORM = 180 EFFECT_SANDSTORM = 181 EFFECT_THUNDERSTORM = 182 EFFECT_RAINSTORM = 183 EFFECT_AURORASTORM = 184 EFFECT_VOIDSTORM = 185 EFFECT_HELIX = 186 EFFECT_SUBLIMATION_ACTIVATED = 187 EFFECT_SUBLIMATION_COMPLETE = 188 EFFECT_MAX_TP_DOWN = 189 EFFECT_MAGIC_ATK_BOOST = 190 EFFECT_MAGIC_DEF_BOOST = 191 EFFECT_REQUIEM = 192 EFFECT_LULLABY = 193 EFFECT_ELEGY = 194 EFFECT_PAEON = 195 EFFECT_BALLAD = 196 EFFECT_MINNE = 197 EFFECT_MINUET = 198 EFFECT_MADRIGAL = 199 EFFECT_PRELUDE = 200 EFFECT_MAMBO = 201 EFFECT_AUBADE = 202 EFFECT_PASTORAL = 203 EFFECT_HUM = 204 EFFECT_FANTASIA = 205 EFFECT_OPERETTA = 206 EFFECT_CAPRICCIO = 207 EFFECT_SERENADE = 208 EFFECT_ROUND = 209 EFFECT_GAVOTTE = 210 EFFECT_FUGUE = 211 EFFECT_RHAPSODY = 212 EFFECT_ARIA = 213 EFFECT_MARCH = 214 EFFECT_ETUDE = 215 EFFECT_CAROL = 216 EFFECT_THRENODY = 217 EFFECT_HYMNUS = 218 EFFECT_MAZURKA = 219 EFFECT_SIRVENTE = 220 EFFECT_DIRGE = 221 EFFECT_SCHERZO = 222 EFFECT_NOCTURNE = 223 EFFECT_STORE_TP = 227 EFFECT_EMBRAVA = 228 EFFECT_MANAWELL = 229 EFFECT_SPONTANEITY = 230 EFFECT_MARCATO = 231 EFFECT_NA = 232 EFFECT_AUTO_REGEN = 233 EFFECT_AUTO_REFRESH = 234 EFFECT_FISHING_IMAGERY = 235 EFFECT_WOODWORKING_IMAGERY = 236 EFFECT_SMITHING_IMAGERY = 237 EFFECT_GOLDSMITHING_IMAGERY = 238 EFFECT_CLOTHCRAFT_IMAGERY = 239 EFFECT_LEATHERCRAFT_IMAGERY = 240 EFFECT_BONECRAFT_IMAGERY = 241 EFFECT_ALCHEMY_IMAGERY = 242 EFFECT_COOKING_IMAGERY = 243 EFFECT_IMAGERY_1 = 244 EFFECT_IMAGERY_2 = 245 EFFECT_IMAGERY_3 = 246 EFFECT_IMAGERY_4 = 247 EFFECT_IMAGERY_5 = 248 EFFECT_DEDICATION = 249 EFFECT_EF_BADGE = 250 EFFECT_FOOD = 251 EFFECT_CHOCOBO = 252 EFFECT_SIGNET = 253 EFFECT_BATTLEFIELD = 254 EFFECT_NONE = 255 EFFECT_SANCTION = 256 EFFECT_BESIEGED = 257 EFFECT_ILLUSION = 258 EFFECT_ENCUMBRANCE_I = 259 EFFECT_OBLIVISCENCE = 260 EFFECT_IMPAIRMENT = 261 EFFECT_OMERTA = 262 EFFECT_DEBILITATION = 263 EFFECT_PATHOS = 264 EFFECT_FLURRY = 265 EFFECT_CONCENTRATION = 266 EFFECT_ALLIED_TAGS = 267 EFFECT_SIGIL = 268 EFFECT_LEVEL_SYNC = 269 EFFECT_AFTERMATH_LV1 = 270 EFFECT_AFTERMATH_LV2 = 271 EFFECT_AFTERMATH_LV3 = 272 EFFECT_AFTERMATH = 273 EFFECT_ENLIGHT = 274 EFFECT_AUSPICE = 275 EFFECT_CONFRONTATION = 276 EFFECT_ENFIRE_II = 277 EFFECT_ENBLIZZARD_II = 278 EFFECT_ENAERO_II = 279 EFFECT_ENSTONE_II = 280 EFFECT_ENTHUNDER_II = 281 EFFECT_ENWATER_II = 282 EFFECT_PERFECT_DEFENSE = 283 EFFECT_EGG = 284 EFFECT_VISITANT = 285 EFFECT_BARAMNESIA = 286 EFFECT_ATMA = 287 EFFECT_ENDARK = 288 EFFECT_ENMITY_BOOST = 289 EFFECT_SUBTLE_BLOW_PLUS = 290 EFFECT_ENMITY_DOWN = 291 EFFECT_PENNANT = 292 EFFECT_NEGATE_PETRIFY = 293 EFFECT_NEGATE_TERROR = 294 EFFECT_NEGATE_AMNESIA = 295 EFFECT_NEGATE_DOOM = 296 EFFECT_NEGATE_POISON = 297 EFFECT_CRIT_HIT_EVASION_DOWN = 298 EFFECT_OVERLOAD = 299 EFFECT_FIRE_MANEUVER = 300 EFFECT_ICE_MANEUVER = 301 EFFECT_WIND_MANEUVER = 302 EFFECT_EARTH_MANEUVER = 303 EFFECT_THUNDER_MANEUVER = 304 EFFECT_WATER_MANEUVER = 305 EFFECT_LIGHT_MANEUVER = 306 EFFECT_DARK_MANEUVER = 307 EFFECT_DOUBLE_UP_CHANCE = 308 EFFECT_BUST = 309 EFFECT_FIGHTERS_ROLL = 310 EFFECT_MONKS_ROLL = 311 EFFECT_HEALERS_ROLL = 312 EFFECT_WIZARDS_ROLL = 313 EFFECT_WARLOCKS_ROLL = 314 EFFECT_ROGUES_ROLL = 315 EFFECT_GALLANTS_ROLL = 316 EFFECT_CHAOS_ROLL = 317 EFFECT_BEAST_ROLL = 318 EFFECT_CHORAL_ROLL = 319 EFFECT_HUNTERS_ROLL = 320 EFFECT_SAMURAI_ROLL = 321 EFFECT_NINJA_ROLL = 322 EFFECT_DRACHEN_ROLL = 323 EFFECT_EVOKERS_ROLL = 324 EFFECT_MAGUSS_ROLL = 325 EFFECT_CORSAIRS_ROLL = 326 EFFECT_PUPPET_ROLL = 327 EFFECT_DANCERS_ROLL = 328 EFFECT_SCHOLARS_ROLL = 329 EFFECT_BOLTERS_ROLL = 330 EFFECT_CASTERS_ROLL = 331 EFFECT_COURSERS_ROLL = 332 EFFECT_BLITZERS_ROLL = 333 EFFECT_TACTICIANS_ROLL = 334 EFFECT_ALLIES_ROLL = 335 EFFECT_MISERS_ROLL = 336 EFFECT_COMPANIONS_ROLL = 337 EFFECT_AVENGERS_ROLL = 338 -- EFFECT_NONE = 339 EFFECT_WARRIOR_S_CHARGE = 340 EFFECT_FORMLESS_STRIKES = 341 EFFECT_ASSASSIN_S_CHARGE = 342 EFFECT_FEINT = 343 EFFECT_FEALTY = 344 EFFECT_DARK_SEAL = 345 EFFECT_DIABOLIC_EYE = 346 EFFECT_NIGHTINGALE = 347 EFFECT_TROUBADOUR = 348 EFFECT_KILLER_INSTINCT = 349 EFFECT_STEALTH_SHOT = 350 EFFECT_FLASHY_SHOT = 351 EFFECT_SANGE = 352 EFFECT_HASSO = 353 EFFECT_SEIGAN = 354 EFFECT_CONVERGENCE = 355 EFFECT_DIFFUSION = 356 EFFECT_SNAKE_EYE = 357 EFFECT_LIGHT_ARTS = 358 EFFECT_DARK_ARTS = 359 EFFECT_PENURY = 360 EFFECT_PARSIMONY = 361 EFFECT_CELERITY = 362 EFFECT_ALACRITY = 363 EFFECT_RAPTURE = 364 EFFECT_EBULLIENCE = 365 EFFECT_ACCESSION = 366 EFFECT_MANIFESTATION = 367 EFFECT_DRAIN_SAMBA = 368 EFFECT_ASPIR_SAMBA = 369 EFFECT_HASTE_SAMBA = 370 EFFECT_VELOCITY_SHOT = 371 EFFECT_BUILDING_FLOURISH = 375 EFFECT_TRANCE = 376 EFFECT_TABULA_RASA = 377 EFFECT_DRAIN_DAZE = 378 EFFECT_ASPIR_DAZE = 379 EFFECT_HASTE_DAZE = 380 EFFECT_FINISHING_MOVE_1 = 381 EFFECT_FINISHING_MOVE_2 = 382 EFFECT_FINISHING_MOVE_3 = 383 EFFECT_FINISHING_MOVE_4 = 384 EFFECT_FINISHING_MOVE_5 = 385 EFFECT_LETHARGIC_DAZE_1 = 386 EFFECT_LETHARGIC_DAZE_2 = 387 EFFECT_LETHARGIC_DAZE_3 = 388 EFFECT_LETHARGIC_DAZE_4 = 389 EFFECT_LETHARGIC_DAZE_5 = 390 EFFECT_SLUGGISH_DAZE_1 = 391 EFFECT_SLUGGISH_DAZE_2 = 392 EFFECT_SLUGGISH_DAZE_3 = 393 EFFECT_SLUGGISH_DAZE_4 = 394 EFFECT_SLUGGISH_DAZE_5 = 395 EFFECT_WEAKENED_DAZE_1 = 396 EFFECT_WEAKENED_DAZE_2 = 397 EFFECT_WEAKENED_DAZE_3 = 398 EFFECT_WEAKENED_DAZE_4 = 399 EFFECT_WEAKENED_DAZE_5 = 400 EFFECT_ADDENDUM_WHITE = 401 EFFECT_ADDENDUM_BLACK = 402 EFFECT_REPRISAL = 403 EFFECT_MAGIC_EVASION_DOWN = 404 EFFECT_RETALIATION = 405 EFFECT_FOOTWORK = 406 EFFECT_KLIMAFORM = 407 EFFECT_SEKKANOKI = 408 EFFECT_PIANISSIMO = 409 EFFECT_SABER_DANCE = 410 EFFECT_FAN_DANCE = 411 EFFECT_ALTRUISM = 412 EFFECT_FOCALIZATION = 413 EFFECT_TRANQUILITY = 414 EFFECT_EQUANIMITY = 415 EFFECT_ENLIGHTENMENT = 416 EFFECT_AFFLATUS_SOLACE = 417 EFFECT_AFFLATUS_MISERY = 418 EFFECT_COMPOSURE = 419 EFFECT_YONIN = 420 EFFECT_INNIN = 421 EFFECT_CARBUNCLE_S_FAVOR = 422 EFFECT_IFRIT_S_FAVOR = 423 EFFECT_SHIVA_S_FAVOR = 424 EFFECT_GARUDA_S_FAVOR = 425 EFFECT_TITAN_S_FAVOR = 426 EFFECT_RAMUH_S_FAVOR = 427 EFFECT_LEVIATHAN_S_FAVOR = 428 EFFECT_FENRIR_S_FAVOR = 429 EFFECT_DIABOLOS_S_FAVOR = 430 EFFECT_AVATAR_S_FAVOR = 431 EFFECT_MULTI_STRIKES = 432 EFFECT_DOUBLE_SHOT = 433 EFFECT_TRANSCENDENCY = 434 EFFECT_RESTRAINT = 435 EFFECT_PERFECT_COUNTER = 436 EFFECT_MANA_WALL = 437 EFFECT_DIVINE_EMBLEM = 438 EFFECT_NETHER_VOID = 439 EFFECT_SENGIKORI = 440 EFFECT_FUTAE = 441 EFFECT_PRESTO = 442 EFFECT_CLIMACTIC_FLOURISH = 443 EFFECT_COPY_IMAGE_2 = 444 EFFECT_COPY_IMAGE_3 = 445 EFFECT_COPY_IMAGE_4 = 446 EFFECT_MULTI_SHOTS = 447 EFFECT_BEWILDERED_DAZE_1 = 448 EFFECT_BEWILDERED_DAZE_2 = 449 EFFECT_BEWILDERED_DAZE_3 = 450 EFFECT_BEWILDERED_DAZE_4 = 451 EFFECT_BEWILDERED_DAZE_5 = 452 EFFECT_DIVINE_CARESS_I = 453 EFFECT_SABOTEUR = 454 EFFECT_TENUTO = 455 EFFECT_SPUR = 456 EFFECT_EFFLUX = 457 EFFECT_EARTHEN_ARMOR = 458 EFFECT_DIVINE_CARESS_II = 459 EFFECT_BLOOD_RAGE = 460 EFFECT_IMPETUS = 461 EFFECT_CONSPIRATOR = 462 EFFECT_SEPULCHER = 463 EFFECT_ARCANE_CREST = 464 EFFECT_HAMANOHA = 465 EFFECT_DRAGON_BREAKER = 466 EFFECT_TRIPLE_SHOT = 467 EFFECT_STRIKING_FLOURISH = 468 EFFECT_PERPETUANCE = 469 EFFECT_IMMANENCE = 470 EFFECT_MIGAWARI = 471 EFFECT_TERNARY_FLOURISH = 472 -- DNC 93 EFFECT_MUDDLE = 473 -- MOB EFFECT EFFECT_PROWESS = 474 -- GROUNDS OF VALOR EFFECT_VOIDWATCHER = 475 -- VOIDWATCH EFFECT_ENSPHERE = 476 -- ATMACITE EFFECT_SACROSANCTITY = 477 -- WHM 95 EFFECT_PALISADE = 478 -- PLD 95 EFFECT_SCARLET_DELIRIUM = 479 -- DRK 95 EFFECT_SCARLET_DELIRIUM_1 = 480 -- DRK 95 -- EFFECT_NONE = 481 -- NONE EFFECT_DECOY_SHOT = 482 -- RNG 95 EFFECT_HAGAKURE = 483 -- SAM 95 EFFECT_ISSEKIGAN = 484 -- NIN 95 EFFECT_UNBRIDLED_LEARNING = 485 -- BLU 95 EFFECT_COUNTER_BOOST = 486 -- EFFECT_ENDRAIN = 487 -- FENRIR 96 EFFECT_ENASPIR = 488 -- FENRIR 96 EFFECT_AFTERGLOW = 489 -- WS AFTEREFFECT EFFECT_BRAZEN_STRENGTH = 490 -- EFFECT_INNER_STRENGTH = 491 EFFECT_ASYLUM = 492 EFFECT_SUBTLE_SORCERY = 493 EFFECT_STYMIE = 494 -- EFFECT_NONE = 495 EFFECT_INTERVENE = 496 EFFECT_SOUL_ENSLAVEMENT = 497 EFFECT_UNLEASH = 498 EFFECT_CLARION_CALL = 499 EFFECT_OVERKILL = 500 EFFECT_YAEGASUMI = 501 EFFECT_MIKAGE = 502 EFFECT_FLY_HIGH = 503 EFFECT_ASTRAL_CONDUIT = 504 EFFECT_UNBRIDLED_WISDOM = 505 -- EFFECT_NONE = 506 EFFECT_GRAND_PAS = 507 EFFECT_WIDENED_COMPASS = 508 EFFECT_ODYLLIC_SUBTERFUGE = 509 EFFECT_ERGON_MIGHT = 510 EFFECT_REIVE_MARK = 511 EFFECT_IONIS = 512 EFFECT_BOLSTER = 513 -- EFFECT_NONE = 514 EFFECT_LASTING_EMANATION = 515 EFFECT_ECLIPTIC_ATTRITION = 516 EFFECT_COLLIMATED_FERVOR = 517 EFFECT_DEMATERIALIZE = 518 EFFECT_THEURGIC_FOCUS = 519 -- EFFECT_NONE = 520 -- EFFECT_NONE = 521 EFFECT_ELEMENTAL_SFORZO = 522 EFFECT_IGNIS = 523 EFFECT_GELUS = 524 EFFECT_FLABRA = 525 EFFECT_TELLUS = 526 EFFECT_SULPOR = 527 EFFECT_UNDA = 528 EFFECT_LUX = 529 EFFECT_TENEBRAE = 530 EFFECT_VALLATION = 531 EFFECT_SWORDPLAY = 532 EFFECT_PFLUG = 533 EFFECT_EMBOLDEN = 534 EFFECT_VALIANCE = 535 EFFECT_GAMBIT = 536 EFFECT_LIEMENT = 537 EFFECT_ONE_FOR_ALL = 538 EFFECT_REGEN_II = 539 EFFECT_POISON_II = 540 EFFECT_REFRESH_II = 541 EFFECT_STR_BOOST_III = 542 EFFECT_DEX_BOOST_III = 543 EFFECT_VIT_BOOST_III = 544 EFFECT_AGI_BOOST_III = 545 EFFECT_INT_BOOST_III = 546 EFFECT_MND_BOOST_III = 547 EFFECT_CHR_BOOST_III = 548 EFFECT_ATTACK_BOOST_II = 549 EFFECT_DEFENSE_BOOST_II = 550 EFFECT_MAGIC_ATK_BOOST_II = 551 EFFECT_MAGIC_DEF_BOOST_II = 552 EFFECT_ACCURACY_BOOST_II = 553 EFFECT_EVASION_BOOST_II = 554 EFFECT_MAGIC_ACC_BOOST_II = 555 EFFECT_MAGIC_EVASION_BOOST_II = 556 EFFECT_ATTACK_DOWN_II = 557 EFFECT_DEFENSE_DOWN_II = 558 EFFECT_MAGIC_ATK_DOWN_II = 559 EFFECT_MAGIC_DEF_DOWN_II = 560 EFFECT_ACCURACY_DOWN_II = 561 EFFECT_EVASION_DOWN_II = 562 EFFECT_MAGIC_ACC_DOWN_II = 563 EFFECT_MAGIC_EVASION_DOWN_II = 564 EFFECT_SLOW_II = 565 EFFECT_PARALYSIS_II = 566 EFFECT_WEIGHT_II = 567 EFFECT_FOIL = 568 EFFECT_BLAZE_OF_GLORY = 569 EFFECT_BATTUTA = 570 EFFECT_RAYKE = 571 EFFECT_AVOIDANCE_DOWN = 572 EFFECT_DELUGE_SPIKES = 573 -- Exists in client, unused on retail? EFFECT_FAST_CAST = 574 EFFECT_GESTATION = 575 EFFECT_DOUBT = 576 -- Bully: Intimidation Enfeeble status EFFECT_CAIT_SITH_S_FAVOR = 577 EFFECT_FISHY_INTUITION = 578 EFFECT_COMMITMENT = 579 EFFECT_HASTE_II = 580 EFFECT_FLURRY_II = 581 -- Effect icons in packet can go from 0-767, so no custom effects should go in that range. -- Purchased from Cruor Prospector EFFECT_ABYSSEA_STR = 768 EFFECT_ABYSSEA_DEX = 769 EFFECT_ABYSSEA_VIT = 770 EFFECT_ABYSSEA_AGI = 771 EFFECT_ABYSSEA_INT = 772 EFFECT_ABYSSEA_MND = 773 EFFECT_ABYSSEA_CHR = 774 EFFECT_ABYSSEA_HP = 775 EFFECT_ABYSSEA_MP = 776 -- *Prowess increases not currently retail accurate. -- GoV Prowess bonus effects, real effect at ID 474 EFFECT_PROWESS_CASKET_RATE = 777 -- (Unimplemented) EFFECT_PROWESS_SKILL_RATE = 778 -- (Unimplemented) EFFECT_PROWESS_CRYSTAL_YEILD = 779 -- (Unimplemented) EFFECT_PROWESS_TH = 780 -- +1 per tier EFFECT_PROWESS_ATTACK_SPEED = 781 -- *flat 4% for now EFFECT_PROWESS_HP_MP = 782 -- Base 3% and another 1% per tier. EFFECT_PROWESS_ACC_RACC = 783 -- *flat 4% for now EFFECT_PROWESS_ATT_RATT = 784 -- *flat 4% for now EFFECT_PROWESS_MACC_MATK = 785 -- *flat 4% for now EFFECT_PROWESS_CURE_POTENCY = 786 -- *flat 4% for now EFFECT_PROWESS_WS_DMG = 787 -- (Unimplemented) 2% per tier. EFFECT_PROWESS_KILLER = 788 -- *flat +4 for now -- End GoV Prowess fakery EFFECT_FIELD_SUPPORT_FOOD = 789 -- Used by Fov/GoV food buff. EFFECT_MARK_OF_SEED = 790 -- Tracks 30 min timer in ACP mission "Those Who Lurk in Shadows (II)" EFFECT_ALL_MISS = 791 EFFECT_SUPER_BUFF = 792 EFFECT_NINJUTSU_ELE_DEBUFF = 793 EFFECT_HEALING = 794 EFFECT_LEAVEGAME = 795 EFFECT_HASTE_SAMBA_HASTE = 796 EFFECT_TELEPORT = 797 EFFECT_CHAINBOUND = 798 EFFECT_SKILLCHAIN = 799 EFFECT_DYNAMIS = 800 EFFECT_MEDITATE = 801 -- Dummy effect for SAM Meditate JA -- EFFECT_PLACEHOLDER = 802 -- Description -- 802-1022 -- EFFECT_PLACEHOLDER = 1023 -- The client dat file seems to have only this many "slots", results of exceeding that are untested. ---------------------------------- -- SC masks ---------------------------------- EFFECT_SKILLCHAIN0 = 0x200 EFFECT_SKILLCHAIN1 = 0x400 EFFECT_SKILLCHAIN2 = 0x800 EFFECT_SKILLCHAIN3 = 0x1000 EFFECT_SKILLCHAIN4 = 0x2000 EFFECT_SKILLCHAIN5 = 0x4000 EFFECT_SKILLCHAINMASK = 0x7C00 ------------------------------------ -- Effect Flags ------------------------------------ EFFECTFLAG_NONE = 0x0000 EFFECTFLAG_DISPELABLE = 0x0001 EFFECTFLAG_ERASABLE = 0x0002 EFFECTFLAG_ATTACK = 0x0004 EFFECTFLAG_DAMAGE = 0x0010 EFFECTFLAG_DEATH = 0x0020 EFFECTFLAG_MAGIC_BEGIN = 0x0040 EFFECTFLAG_MAGIC_END = 0x0080 EFFECTFLAG_ON_ZONE = 0x0100 EFFECTFLAG_NO_LOSS_MESSAGE = 0x0200 EFFECTFLAG_INVISIBLE = 0x0400 EFFECTFLAG_DETECTABLE = 0x0800 EFFECTFLAG_NO_REST = 0x1000 EFFECTFLAG_PREVENT_ACTION = 0x2000 EFFECTFLAG_WALTZABLE = 0x4000 EFFECTFLAG_FOOD = 0x8000 EFFECTFLAG_SONG = 0x10000 EFFECTFLAG_ROLL = 0x20000 ------------------------------------ function removeSleepEffects(target) target:delStatusEffect(EFFECT_SLEEP_I); target:delStatusEffect(EFFECT_SLEEP_II); target:delStatusEffect(EFFECT_LULLABY); end; function hasSleepEffects(target) if (target:hasStatusEffect(EFFECT_SLEEP_I) or target:hasStatusEffect(EFFECT_SLEEP_II) or target:hasStatusEffect(EFFECT_LULLABY)) then return true; end return false; end; ------------------------------------ -- These codes are the gateway to directly interacting with the pXI core program with status effects. -- These are NOT the actual status effects such as weakness or silence, -- but rather arbitrary codes chosen to represent different modifiers to the effected characters and mobs. -- -- Even if the particular mod is not completely (or at all) implemented yet, you can still script the effects using these codes. -- -- Example: target:getMod(MOD_STR) will get the sum of STR bonuses/penalties from gear, food, STR Etude, Absorb-STR, and any other STR-related buff/debuff. -- Note that the above will ignore base statistics, and that getStat() should be used for stats, Attack, and Defense, while getACC(), getRACC(), and getEVA() also exist. ------------------------------------ MOD_NONE = 0x00 MOD_DEF = 0x01 MOD_HP = 0x02 MOD_HPP = 0x03 MOD_CONVMPTOHP = 0x04 MOD_MP = 0x05 MOD_MPP = 0x06 MOD_CONVHPTOMP = 0x07 MOD_STR = 0x08 MOD_DEX = 0x09 MOD_VIT = 0x0A MOD_AGI = 0x0B MOD_INT = 0x0C MOD_MND = 0x0D MOD_CHR = 0x0E MOD_FIREDEF = 0x0F MOD_ICEDEF = 0x10 MOD_WINDDEF = 0x11 MOD_EARTHDEF = 0x12 MOD_THUNDERDEF = 0x13 MOD_WATERDEF = 0x14 MOD_LIGHTDEF = 0x15 MOD_DARKDEF = 0x16 MOD_ATT = 0x17 MOD_RATT = 0x18 MOD_ACC = 0x19 MOD_RACC = 0x1A MOD_ENMITY = 0x1B MOD_ENMITY_LOSS_REDUCTION = 0x1F6 MOD_MATT = 0x1C MOD_MDEF = 0x1D MOD_MACC = 0x1E MOD_MEVA = 0x1F MOD_FIREATT = 0x20 MOD_ICEATT = 0x21 MOD_WINDATT = 0x22 MOD_EARTHATT = 0x23 MOD_THUNDERATT = 0x24 MOD_WATERATT = 0x25 MOD_LIGHTATT = 0x26 MOD_DARKATT = 0x27 MOD_FIREACC = 0x28 MOD_ICEACC = 0x29 MOD_WINDACC = 0x2A MOD_EARTHACC = 0x2B MOD_THUNDERACC = 0x2C MOD_WATERACC = 0x2D MOD_LIGHTACC = 0x2E MOD_DARKACC = 0x2F MOD_WSACC = 0x30 MOD_SLASHRES = 0x31 MOD_PIERCERES = 0x32 MOD_IMPACTRES = 0x33 MOD_HTHRES = 0x34 MOD_FIRERES = 0x36 MOD_ICERES = 0x37 MOD_WINDRES = 0x38 MOD_EARTHRES = 0x39 MOD_THUNDERRES = 0x3A MOD_WATERRES = 0x3B MOD_LIGHTRES = 0x3C MOD_DARKRES = 0x3D MOD_ATTP = 0x3E MOD_DEFP = 0x3F MOD_ACCP = 0x40 MOD_EVAP = 0x41 MOD_RATTP = 0x42 MOD_RACCP = 0x43 MOD_EVA = 0x44 MOD_RDEF = 0x45 MOD_REVA = 0x46 MOD_MPHEAL = 0x47 MOD_HPHEAL = 0x48 MOD_STORETP = 0x49 MOD_HTH = 0x50 MOD_DAGGER = 0x51 MOD_SWORD = 0x52 MOD_GSWORD = 0x53 MOD_AXE = 0x54 MOD_GAXE = 0x55 MOD_SCYTHE = 0x56 MOD_POLEARM = 0x57 MOD_KATANA = 0x58 MOD_GKATANA = 0x59 MOD_CLUB = 0x5A MOD_STAFF = 0x5B MOD_AUTO_MELEE_SKILL = 0x65 MOD_AUTO_RANGED_SKILL = 0x66 MOD_AUTO_MAGIC_SKILL = 0x67 MOD_ARCHERY = 0x68 MOD_MARKSMAN = 0x69 MOD_THROW = 0x6A MOD_GUARD = 0x6B MOD_EVASION = 0x6C MOD_SHIELD = 0x6D MOD_PARRY = 0x6E MOD_DIVINE = 0x6F MOD_HEALING = 0x70 MOD_ENHANCE = 0x71 MOD_ENFEEBLE = 0x72 MOD_ELEM = 0x73 MOD_DARK = 0x74 MOD_SUMMONING = 0x75 MOD_NINJUTSU = 0x76 MOD_SINGING = 0x77 MOD_STRING = 0x78 MOD_WIND = 0x79 MOD_BLUE = 0x7A MOD_FISH = 0x7F MOD_WOOD = 0x80 MOD_SMITH = 0x81 MOD_GOLDSMITH = 0x82 MOD_CLOTH = 0x83 MOD_LEATHER = 0x84 MOD_BONE = 0x85 MOD_ALCHEMY = 0x86 MOD_COOK = 0x87 MOD_SYNERGY = 0x88 MOD_RIDING = 0x89 MOD_ANTIHQ_WOOD = 0x90 MOD_ANTIHQ_SMITH = 0x91 MOD_ANTIHQ_GOLDSMITH = 0x92 MOD_ANTIHQ_CLOTH = 0x93 MOD_ANTIHQ_LEATHER = 0x94 MOD_ANTIHQ_BONE = 0x95 MOD_ANTIHQ_ALCHEMY = 0x96 MOD_ANTIHQ_COOK = 0x97 MOD_DMG = 0xA0 MOD_DMGPHYS = 0xA1 MOD_DMGBREATH = 0xA2 MOD_DMGMAGIC = 0xA3 MOD_DMGRANGE = 0xA4 MOD_UDMGPHYS = 0x183 MOD_UDMGBREATH = 0x184 MOD_UDMGMAGIC = 0x185 MOD_UDMGRANGE = 0x186 MOD_CRITHITRATE = 0xA5 MOD_CRIT_DMG_INCREASE = 0x1A5 MOD_ENEMYCRITRATE = 0xA6 MOD_HASTE_MAGIC = 0xA7 MOD_SPELLINTERRUPT = 0xA8 MOD_MOVE = 0xA9 MOD_FASTCAST = 0xAA MOD_UFASTCAST = 0x197 MOD_CURE_CAST_TIME = 0x207 MOD_DELAY = 0xAB MOD_RANGED_DELAY = 0xAC MOD_MARTIAL_ARTS = 0xAD MOD_SKILLCHAINBONUS = 0xAE MOD_SKILLCHAINDMG = 0xAF MOD_FOOD_HPP = 0xB0 MOD_FOOD_HP_CAP = 0xB1 MOD_FOOD_MPP = 0xB2 MOD_FOOD_MP_CAP = 0xB3 MOD_FOOD_ATTP = 0xB4 MOD_FOOD_ATT_CAP = 0xB5 MOD_FOOD_DEFP = 0xB6 MOD_FOOD_DEF_CAP = 0xB7 MOD_FOOD_ACCP = 0xB8 MOD_FOOD_ACC_CAP = 0xB9 MOD_FOOD_RATTP = 0xBA MOD_FOOD_RATT_CAP = 0xBB MOD_FOOD_RACCP = 0xBC MOD_FOOD_RACC_CAP = 0xBD MOD_VERMIN_KILLER = 0xE0 MOD_BIRD_KILLER = 0xE1 MOD_AMORPH_KILLER = 0xE2 MOD_LIZARD_KILLER = 0xE3 MOD_AQUAN_KILLER = 0xE4 MOD_PLANTOID_KILLER = 0xE5 MOD_BEAST_KILLER = 0xE6 MOD_UNDEAD_KILLER = 0xE7 MOD_ARCANA_KILLER = 0xE8 MOD_DRAGON_KILLER = 0xE9 MOD_DEMON_KILLER = 0xEA MOD_EMPTY_KILLER = 0xEB MOD_HUMANOID_KILLER = 0xEC MOD_LUMORIAN_KILLER = 0xED MOD_LUMINION_KILLER = 0xEE MOD_SLEEPRES = 0xF0 MOD_POISONRES = 0xF1 MOD_PARALYZERES = 0xF2 MOD_BLINDRES = 0xF3 MOD_SILENCERES = 0xF4 MOD_VIRUSRES = 0xF5 MOD_PETRIFYRES = 0xF6 MOD_BINDRES = 0xF7 MOD_CURSERES = 0xF8 MOD_GRAVITYRES = 0xF9 MOD_SLOWRES = 0xFA MOD_STUNRES = 0xFB MOD_CHARMRES = 0xFC MOD_AMNESIARES = 0xFD -- PLACEHOLDER = 0xFE MOD_DEATHRES = 0xFF MOD_PARALYZE = 0x101 MOD_MIJIN_GAKURE = 0x102 MOD_DUAL_WIELD = 0x103 MOD_DOUBLE_ATTACK = 0x120 MOD_SUBTLE_BLOW = 0x121 MOD_COUNTER = 0x123 MOD_KICK_ATTACK = 0x124 MOD_AFFLATUS_SOLACE = 0x125 MOD_AFFLATUS_MISERY = 0x126 MOD_CLEAR_MIND = 0x127 MOD_CONSERVE_MP = 0x128 MOD_STEAL = 0x12A MOD_BLINK = 0x12B MOD_STONESKIN = 0x12C MOD_PHALANX = 0x12D MOD_TRIPLE_ATTACK = 0x12E MOD_TREASURE_HUNTER = 0x12F MOD_TAME = 0x130 MOD_RECYCLE = 0x131 MOD_ZANSHIN = 0x132 MOD_UTSUSEMI = 0x133 MOD_NINJA_TOOL = 0x134 MOD_BLUE_POINTS = 0x135 MOD_DMG_REFLECT = 0x13C MOD_ROLL_ROGUES = 0x13D MOD_ROLL_GALLANTS = 0x13E MOD_ROLL_CHAOS = 0x13F MOD_ROLL_BEAST = 0x140 MOD_ROLL_CHORAL = 0x141 MOD_ROLL_HUNTERS = 0x142 MOD_ROLL_SAMURAI = 0x143 MOD_ROLL_NINJA = 0x144 MOD_ROLL_DRACHEN = 0x145 MOD_ROLL_EVOKERS = 0x146 MOD_ROLL_MAGUS = 0x147 MOD_ROLL_CORSAIRS = 0x148 MOD_ROLL_PUPPET = 0x149 MOD_ROLL_DANCERS = 0x14A MOD_ROLL_SCHOLARS = 0x14B MOD_BUST = 0x14C MOD_FINISHING_MOVES = 0x14D MOD_SAMBA_DURATION = 0x1EA -- Samba duration bonus(modId = 490) MOD_WALTZ_POTENTCY = 0x1EB -- Waltz Potentcy Bonus(modId = 491) MOD_CHOCO_JIG_DURATION = 0x1EC -- Chocobo Jig duration bonus (modId = 492) MOD_VFLOURISH_MACC = 0x1ED -- Violent Flourish accuracy bonus (modId = 493) MOD_STEP_FINISH = 0x1EE -- Bonus finishing moves from steps (modId = 494) MOD_STEP_ACCURACY = 0x193 -- Accuracy bonus for steps (modID = 403) MOD_SPECTRAL_JIG = 0x1EF -- Spectral Jig duration modifier (percent increase) (modId = 495) MOD_WALTZ_RECAST = 0x1F1 -- (modID = 497) Waltz recast modifier (percent) MOD_SAMBA_PDURATION = 0x1F2 -- (modID = 498) Samba percent duration bonus MOD_WIDESCAN = 0x154 MOD_BARRAGE_ACC = 0x1A4 -- (modID = 420) MOD_ENSPELL = 0x155 MOD_SPIKES = 0x156 MOD_ENSPELL_DMG = 0x157 MOD_SPIKES_DMG = 0x158 MOD_TP_BONUS = 0x159 MOD_PERPETUATION_REDUCTION = 0x15A MOD_FIRE_AFFINITY = 0x15B MOD_EARTH_AFFINITY = 0x15C MOD_WATER_AFFINITY = 0x15D MOD_ICE_AFFINITY = 0x15E MOD_THUNDER_AFFINITY = 0x15F MOD_WIND_AFFINITY = 0x160 MOD_LIGHT_AFFINITY = 0x161 MOD_DARK_AFFINITY = 0x162 MOD_ADDS_WEAPONSKILL = 0x163 MOD_ADDS_WEAPONSKILL_DYN = 0x164 MOD_BP_DELAY = 0x165 MOD_STEALTH = 0x166 MOD_RAPID_SHOT = 0x167 MOD_CHARM_TIME = 0x168 MOD_JUMP_TP_BONUS = 0x169 MOD_JUMP_ATT_BONUS = 0x16A MOD_HIGH_JUMP_ENMITY_REDUCTION = 0x16B MOD_REWARD_HP_BONUS = 0x16C MOD_SNAP_SHOT = 0x16D MOD_MAIN_DMG_RATING = 0x16E MOD_SUB_DMG_RATING = 0x16F MOD_REGAIN = 0x170 MOD_REFRESH = 0x171 MOD_REGEN = 0x172 MOD_AVATAR_PERPETUATION = 0x173 MOD_WEATHER_REDUCTION = 0x174 MOD_DAY_REDUCTION = 0x175 MOD_CURE_POTENCY = 0x176 MOD_CURE_POTENCY_RCVD = 0x177 MOD_DELAYP = 0x17C MOD_RANGED_DELAYP = 0x17D MOD_EXP_BONUS = 0x17E MOD_HASTE_ABILITY = 0x17F MOD_HASTE_GEAR = 0x180 MOD_SHIELD_BASH = 0x181 MOD_KICK_DMG = 0x182 MOD_CHARM_CHANCE = 0x187 MOD_WEAPON_BASH = 0x188 MOD_BLACK_MAGIC_COST = 0x189 MOD_WHITE_MAGIC_COST = 0x18A MOD_BLACK_MAGIC_CAST = 0x18B MOD_WHITE_MAGIC_CAST = 0x18C MOD_BLACK_MAGIC_RECAST = 0x18D MOD_WHITE_MAGIC_RECAST = 0x18E MOD_ALACRITY_CELERITY_EFFECT = 0x18F MOD_LIGHT_ARTS_EFFECT = 0x14E MOD_DARK_ARTS_EFFECT = 0x14F MOD_LIGHT_ARTS_SKILL = 0x150 MOD_DARK_ARTS_SKILL = 0x151 MOD_REGEN_EFFECT = 0x152 MOD_REGEN_DURATION = 0x153 MOD_HELIX_EFFECT = 0x1DE MOD_HELIX_DURATION = 0x1DD MOD_STORMSURGE_EFFECT = 0x190 MOD_SUBLIMATION_BONUS = 0x191 MOD_GRIMOIRE_SPELLCASTING = 0x1E9 -- (modID = 489) "Grimoire: Reduces spellcasting time" bonus MOD_WYVERN_BREATH = 0x192 MOD_REGEN_DOWN = 0x194 -- poison MOD_REFRESH_DOWN = 0x195 -- plague, reduce mp MOD_REGAIN_DOWN = 0x196 -- plague, reduce tp MOD_MAGIC_DAMAGE = 0x137 -- Magic damage added directly to the spell's base damage (modId = 311) -- Gear set modifiers MOD_DA_DOUBLE_DAMAGE = 0x198 -- Double attack's double damage chance %. MOD_TA_TRIPLE_DAMAGE = 0x199 -- Triple attack's triple damage chance %. MOD_ZANSHIN_DOUBLE_DAMAGE = 0x19A -- Zanshin's double damage chance %. MOD_RAPID_SHOT_DOUBLE_DAMAGE = 0x1DF -- Rapid shot's double damage chance %. MOD_ABSORB_DMG_CHANCE = 0x1E0 -- Chance to absorb damage % MOD_EXTRA_DUAL_WIELD_ATTACK = 0x1E1 -- Chance to land an extra attack when dual wielding MOD_EXTRA_KICK_ATTACK = 0x1E2 -- Occasionally allows a second Kick Attack during an attack round without the use of Footwork. MOD_SAMBA_DOUBLE_DAMAGE = 0x19F -- Double damage chance when samba is up. MOD_NULL_PHYSICAL_DAMAGE = 0x1A0 -- Chance to null physical damage. MOD_QUICK_DRAW_TRIPLE_DAMAGE = 0x1A1 -- Chance to do triple damage with quick draw. MOD_BAR_ELEMENT_NULL_CHANCE = 0x1A2 -- Bar Elemental spells will occasionally nullify damage of the same element. MOD_GRIMOIRE_INSTANT_CAST = 0x1A3 -- Spells that match your current Arts will occasionally cast instantly, without recast. MOD_DOUBLE_SHOT_RATE = 0x1A6 -- The rate that double shot can proc MOD_VELOCITY_SNAPSHOT_BONUS = 0x1A7 -- Increases Snapshot whilst Velocity Shot is up. MOD_VELOCITY_RATT_BONUS = 0x1A8 -- Increases Ranged Attack whilst Velocity Shot is up. MOD_SHADOW_BIND_EXT = 0x1A9 -- Extends the time of shadowbind MOD_ABSORB_PHYSDMG_TO_MP = 0x1AA -- Absorbs a percentage of physical damage taken to MP. MOD_ENMITY_REDUCTION_PHYSICAL = 0x1AB -- Reduces Enmity decrease when taking physical damage MOD_SHIELD_MASTERY_TP = 0x1E5 -- Shield mastery TP bonus when blocking with a shield (modId = 485) MOD_PERFECT_COUNTER_ATT = 0x1AC -- Raises weapon damage by 20 when countering while under the Perfect Counter effect. This also affects Weapon Rank (though not if fighting barehanded). MOD_FOOTWORK_ATT_BONUS = 0x1AD -- Raises the attack bonus of Footwork. (Tantra Gaiters +2 raise 100/1024 to 152/1024) MOD_MINNE_EFFECT = 0x1B1 -- (modId = 433) MOD_MINUET_EFFECT = 0x1B2 -- (modId = 434) MOD_PAEON_EFFECT = 0x1B3 -- (modId = 435) MOD_REQUIEM_EFFECT = 0x1B4 -- (modId = 436) MOD_THRENODY_EFFECT = 0x1B5 -- (modId = 437) MOD_MADRIGAL_EFFECT = 0x1B6 -- (modId = 438) MOD_MAMBO_EFFECT = 0x1B7 -- (modId = 439) MOD_LULLABY_EFFECT = 0x1B8 -- (modId = 440) MOD_ETUDE_EFFECT = 0x1B9 -- (modId = 441) MOD_BALLAD_EFFECT = 0x1BA -- (modId = 442) MOD_MARCH_EFFECT = 0x1BB -- (modId = 443) MOD_FINALE_EFFECT = 0x1BC -- (modId = 444) MOD_CAROL_EFFECT = 0x1BD -- (modId = 445) MOD_MAZURKA_EFFECT = 0x1BE -- (modId = 446) MOD_ELEGY_EFFECT = 0x1BF -- (modId = 447) MOD_PRELUDE_EFFECT = 0x1C0 -- (modId = 448) MOD_HYMNUS_EFFECT = 0x1C1 -- (modId = 449) MOD_VIRELAI_EFFECT = 0x1C2 -- (modId = 450) MOD_SCHERZO_EFFECT = 0x1C3 -- (modId = 451) MOD_ALL_SONGS_EFFECT = 0x1C4 -- (modId = 452) MOD_MAXIMUM_SONGS_BONUS = 0x1C5 -- (modId = 453) MOD_SONG_DURATION_BONUS = 0x1C6 -- (modId = 454) MOD_QUICK_DRAW_DMG = 0x19B -- (modId = 411) MOD_QUAD_ATTACK = 0x1AE -- Quadruple attack chance. MOD_ADDITIONAL_EFFECT = 0x1AF -- All additional effects (modId = 431) MOD_ENSPELL_DMG_BONUS = 0x1B0 MOD_FIRE_ABSORB = 0x1CB -- (modId = 459) MOD_EARTH_ABSORB = 0x1CC -- (modId = 460) MOD_WATER_ABSORB = 0x1CD -- (modId = 461) MOD_WIND_ABSORB = 0x1CE -- (modId = 462) MOD_ICE_ABSORB = 0x1CF -- (modId = 463) MOD_LTNG_ABSORB = 0x1D0 -- (modId = 464) MOD_LIGHT_ABSORB = 0x1D1 -- (modId = 465) MOD_DARK_ABSORB = 0x1D2 -- (modId = 466) MOD_FIRE_NULL = 0x1D3 -- (modId = 467) MOD_EARTH_NULL = 0x1D4 -- (modId = 468) MOD_WATER_NULL = 0x1D5 -- (modId = 469) MOD_WIND_NULL = 0x1D6 -- (modId = 470) MOD_ICE_NULL = 0x1D7 -- (modId = 471) MOD_LTNG_NULL = 0x1D8 -- (modId = 472) MOD_LIGHT_NULL = 0x1D9 -- (modId = 473) MOD_DARK_NULL = 0x1DA -- (modId = 474) MOD_MAGIC_ABSORB = 0x1DB -- (modId = 475) MOD_MAGIC_NULL = 0x1DC -- (modId = 476) MOD_PHYS_ABSORB = 0x200 -- (modId = 512) MOD_ABSORB_DMG_TO_MP = 0x204 -- Unlike PLD gear mod, works on all damage types (Ethereal Earring) (modId = 516) MOD_WARCRY_DURATION = 0x1E3 -- Warcy duration bonus from gear MOD_AUSPICE_EFFECT = 0x1E4 -- Auspice Subtle Blow Bonus (modId = 484) MOD_TACTICAL_PARRY = 0x1E6 -- Tactical Parry TP Bonus (modid = 486) MOD_MAG_BURST_BONUS = 0x1E7 -- Magic Burst Bonus (modid = 487) MOD_INHIBIT_TP = 0x1E8 -- Inhibits TP Gain (percent) (modId = 488) MOD_GOV_CLEARS = 0x1F0 -- Tracks GoV page completion (for 4% bonus on rewards). -- Reraise (Auto Reraise, will be used by ATMA) MOD_RERAISE_I = 0x1C8 -- Reraise. (modId = 456) MOD_RERAISE_II = 0x1C9 -- Reraise II. (modId = 457) MOD_RERAISE_III = 0x1CA -- Reraise III. (modId = 458) MOD_ITEM_SPIKES_TYPE = 0x1F3 -- Type spikes an item has (modId = 499) MOD_ITEM_SPIKES_DMG = 0x1F4 -- Damage of an items spikes (modId = 500) MOD_ITEM_SPIKES_CHANCE = 0x1F5 -- Chance of an items spike proc (modId = 501) MOD_FERAL_HOWL_DURATION = 0x1F7 -- +20% duration per merit when wearing augmented Monster Jackcoat +2 (modId = 503) MOD_MANEUVER_BONUS = 0x1F8 -- Maneuver Stat Bonus MOD_OVERLOAD_THRESH = 0x1F9 -- Overload Threshold Bonus MOD_EXTRA_DMG_CHANCE = 0x1FA -- Proc rate of MOD_OCC_DO_EXTRA_DMG. 111 would be 11.1% (modId = 506) MOD_OCC_DO_EXTRA_DMG = 0x1FB -- Multiplier for "Occasionally do x times normal damage". 250 would be 2.5 times damage. (modId = 507) MOD_EAT_RAW_FISH = 0x19C -- (modId = 412) MOD_EAT_RAW_MEAT = 0x19D -- (modId = 413) MOD_ENHANCES_CURSNA = 0x136 -- Raises success rate of Cursna when removing effect (like Doom) that are not 100% chance to remove (modId = 310) MOD_RETALIATION = 0x19E -- Increases damage of Retaliation hits (modId = 414) MOD_AUGMENTS_THIRD_EYE = 0x1FC -- Adds counter to 3rd eye anticipates & if using Seigan counter rate is increased by 15% (modId = 508) MOD_CLAMMING_IMPROVED_RESULTS = 0x1FD -- (modId = 509) MOD_CLAMMING_REDUCED_INCIDENTS = 0x1FE -- (modId = 510) MOD_CHOCOBO_RIDING_TIME = 0x1FF -- Increases chocobo riding time (modId = 511) MOD_HARVESTING_RESULT = 0x201 -- Improves harvesting results (modId = 513) MOD_LOGGING_RESULT = 0x202 -- Improves logging results (modId = 514) MOD_MINNING_RESULT = 0x203 -- Improves mining results (modId = 515) MOD_EGGHELM = 0x205 -- Egg Helm (Chocobo Digging) MOD_SHIELDBLOCKRATE = 0x206 -- Affects shield block rate, percent based (modID = 518)) MOD_SCAVENGE_EFFECT = 0x138 -- (modId = 312) MOD_DIA_DOT = 0x139 -- Increases the DoT damage of Dia (modId = 313) MOD_SHARPSHOT = 0x13A -- Sharpshot accuracy bonus (modId = 314) MOD_ENH_DRAIN_ASPIR = 0x13B -- % damage boost to Drain and Aspir(modId = 315) MOD_TRICK_ATK_AGI = 0x208 -- % AGI boost to Trick Attack (if gear mod, needs to be equipped on hit) (modId = 520) -- The entire mod list is in desperate need of kind of some organizing. -- The spares take care of finding the next ID to use so long as we don't forget to list IDs that have been freed up by refactoring. -- MOD_SPARE = 0x209 -- (modId = 521) -- MOD_SPARE = 0x20A -- (modId = 522) ------------------------------------ -- Merit Definitions ------------------------------------ MCATEGORY_HP_MP = 0x0040 MCATEGORY_ATTRIBUTES = 0x0080 MCATEGORY_COMBAT = 0x00C0 MCATEGORY_MAGIC = 0x0100 MCATEGORY_OTHERS = 0x0140 MCATEGORY_WAR_1 = 0x0180 MCATEGORY_MNK_1 = 0x01C0 MCATEGORY_WHM_1 = 0x0200 MCATEGORY_BLM_1 = 0x0240 MCATEGORY_RDM_1 = 0x0280 MCATEGORY_THF_1 = 0x02C0 MCATEGORY_PLD_1 = 0x0300 MCATEGORY_DRK_1 = 0x0340 MCATEGORY_BST_1 = 0x0380 MCATEGORY_BRD_1 = 0x03C0 MCATEGORY_RNG_1 = 0x0400 MCATEGORY_SAM_1 = 0x0440 MCATEGORY_NIN_1 = 0x0480 MCATEGORY_DRG_1 = 0x04C0 MCATEGORY_SMN_1 = 0x0500 MCATEGORY_BLU_1 = 0x0540 MCATEGORY_COR_1 = 0x0580 MCATEGORY_PUP_1 = 0x05C0 MCATEGORY_DNC_1 = 0x0600 MCATEGORY_SCH_1 = 0x0640 MCATEGORY_WS = 0x0680 MCATEGORY_UNK_0 = 0x06C0 MCATEGORY_UNK_1 = 0x0700 MCATEGORY_UNK_2 = 0x0740 MCATEGORY_UNK_3 = 0x0780 MCATEGORY_UNK_4 = 0x07C0 MCATEGORY_WAR_2 = 0x0800 MCATEGORY_MNK_2 = 0x0840 MCATEGORY_WHM_2 = 0x0880 MCATEGORY_BLM_2 = 0x08C0 MCATEGORY_RDM_2 = 0x0900 MCATEGORY_THF_2 = 0x0940 MCATEGORY_PLD_2 = 0x0980 MCATEGORY_DRK_2 = 0x09C0 MCATEGORY_BST_2 = 0x0A00 MCATEGORY_BRD_2 = 0x0A40 MCATEGORY_RNG_2 = 0x0A80 MCATEGORY_SAM_2 = 0x0AC0 MCATEGORY_NIN_2 = 0x0B00 MCATEGORY_DRG_2 = 0x0B40 MCATEGORY_SMN_2 = 0x0B80 MCATEGORY_BLU_2 = 0x0BC0 MCATEGORY_COR_2 = 0x0C00 MCATEGORY_PUP_2 = 0x0C40 MCATEGORY_DNC_2 = 0x0C80 MCATEGORY_SCH_2 = 0x0CC0 MCATEGORY_START = 0x0040 MCATEGORY_COUNT = 0x0D00 --HP MERIT_MAX_HP = MCATEGORY_HP_MP + 0x00 MERIT_MAX_MP = MCATEGORY_HP_MP + 0x02 --ATTRIBUTES MERIT_STR = MCATEGORY_ATTRIBUTES + 0x00 MERIT_DEX = MCATEGORY_ATTRIBUTES + 0x02 MERIT_VIT = MCATEGORY_ATTRIBUTES + 0x04 MERIT_AGI = MCATEGORY_ATTRIBUTES + 0x08 MERIT_INT = MCATEGORY_ATTRIBUTES + 0x0A MERIT_MND = MCATEGORY_ATTRIBUTES + 0x0C MERIT_CHR = MCATEGORY_ATTRIBUTES + 0x0E --COMBAT SKILLS MERIT_H2H = MCATEGORY_COMBAT + 0x00 MERIT_DAGGER = MCATEGORY_COMBAT + 0x02 MERIT_SWORD = MCATEGORY_COMBAT + 0x04 MERIT_GSWORD = MCATEGORY_COMBAT + 0x06 MERIT_AXE = MCATEGORY_COMBAT + 0x08 MERIT_GAXE = MCATEGORY_COMBAT + 0x0A MERIT_SCYTHE = MCATEGORY_COMBAT + 0x0C MERIT_POLEARM = MCATEGORY_COMBAT + 0x0E MERIT_KATANA = MCATEGORY_COMBAT + 0x10 MERIT_GKATANA = MCATEGORY_COMBAT + 0x12 MERIT_CLUB = MCATEGORY_COMBAT + 0x14 MERIT_STAFF = MCATEGORY_COMBAT + 0x16 MERIT_ARCHERY = MCATEGORY_COMBAT + 0x18 MERIT_MARKSMANSHIP = MCATEGORY_COMBAT + 0x1A MERIT_THROWING = MCATEGORY_COMBAT + 0x1C MERIT_GUARDING = MCATEGORY_COMBAT + 0x1E MERIT_EVASION = MCATEGORY_COMBAT + 0x20 MERIT_SHIELD = MCATEGORY_COMBAT + 0x22 MERIT_PARRYING = MCATEGORY_COMBAT + 0x24 --MAGIC SKILLS MERIT_DIVINE = MCATEGORY_MAGIC + 0x00 MERIT_HEALING = MCATEGORY_MAGIC + 0x02 MERIT_ENHANCING = MCATEGORY_MAGIC + 0x04 MERIT_ENFEEBLING = MCATEGORY_MAGIC + 0x06 MERIT_ELEMENTAL = MCATEGORY_MAGIC + 0x08 MERIT_DARK = MCATEGORY_MAGIC + 0x0A MERIT_SUMMONING = MCATEGORY_MAGIC + 0x0C MERIT_NINJITSU = MCATEGORY_MAGIC + 0x0E MERIT_SINGING = MCATEGORY_MAGIC + 0x10 MERIT_STRING = MCATEGORY_MAGIC + 0x12 MERIT_WIND = MCATEGORY_MAGIC + 0x14 MERIT_BLUE = MCATEGORY_MAGIC + 0x16 --OTHERS MERIT_ENMITY_INCREASE = MCATEGORY_OTHERS + 0x00 MERIT_ENMITY_DECREASE = MCATEGORY_OTHERS + 0x02 MERIT_CRIT_HIT_RATE = MCATEGORY_OTHERS + 0x04 MERIT_ENEMY_CRIT_RATE = MCATEGORY_OTHERS + 0x06 MERIT_SPELL_INTERUPTION_RATE = MCATEGORY_OTHERS + 0x08 --WAR 1 MERIT_BERSERK_RECAST = MCATEGORY_WAR_1 + 0x00 MERIT_DEFENDER_RECAST = MCATEGORY_WAR_1 + 0x02 MERIT_WARCRY_RECAST = MCATEGORY_WAR_1 + 0x04 MERIT_AGGRESSOR_RECAST = MCATEGORY_WAR_1 + 0x06 MERIT_DOUBLE_ATTACK_RATE = MCATEGORY_WAR_1 + 0x08 --MNK 1 MERIT_FOCUS_RECAST = MCATEGORY_MNK_1 + 0x00 MERIT_DODGE_RECAST = MCATEGORY_MNK_1 + 0x02 MERIT_CHAKRA_RECAST = MCATEGORY_MNK_1 + 0x04 MERIT_COUNTER_RATE = MCATEGORY_MNK_1 + 0x06 MERIT_KICK_ATTACK_RATE = MCATEGORY_MNK_1 + 0x08 --WHM 1 MERIT_DIVINE_SEAL_RECAST = MCATEGORY_WHM_1 + 0x00 MERIT_CURE_CAST_TIME = MCATEGORY_WHM_1 + 0x02 MERIT_BAR_SPELL_EFFECT = MCATEGORY_WHM_1 + 0x04 MERIT_BANISH_EFFECT = MCATEGORY_WHM_1 + 0x06 MERIT_REGEN_EFFECT = MCATEGORY_WHM_1 + 0x08 --BLM 1 MERIT_ELEMENTAL_SEAL_RECAST = MCATEGORY_BLM_1 + 0x00 MERIT_FIRE_MAGIC_POTENCY = MCATEGORY_BLM_1 + 0x02 MERIT_ICE_MAGIC_POTENCY = MCATEGORY_BLM_1 + 0x04 MERIT_WIND_MAGIC_POTENCY = MCATEGORY_BLM_1 + 0x06 MERIT_EARTH_MAGIC_POTENCY = MCATEGORY_BLM_1 + 0x08 MERIT_LIGHTNING_MAGIC_POTENCY = MCATEGORY_BLM_1 + 0x0A MERIT_WATER_MAGIC_POTENCY = MCATEGORY_BLM_1 + 0x0C --RDM 1 MERIT_CONVERT_RECAST = MCATEGORY_RDM_1 + 0x00 MERIT_FIRE_MAGIC_ACCURACY = MCATEGORY_RDM_1 + 0x02 MERIT_ICE_MAGIC_ACCURACY = MCATEGORY_RDM_1 + 0x04 MERIT_WIND_MAGIC_ACCURACY = MCATEGORY_RDM_1 + 0x06 MERIT_EARTH_MAGIC_ACCURACY = MCATEGORY_RDM_1 + 0x08 MERIT_LIGHTNING_MAGIC_ACCURACY = MCATEGORY_RDM_1 + 0x0A MERIT_WATER_MAGIC_ACCURACY = MCATEGORY_RDM_1 + 0x0C --THF 1 MERIT_FLEE_RECAST = MCATEGORY_THF_1 + 0x00 MERIT_HIDE_RECAST = MCATEGORY_THF_1 + 0x02 MERIT_SNEAK_ATTACK_RECAST = MCATEGORY_THF_1 + 0x04 MERIT_TRICK_ATTACK_RECAST = MCATEGORY_THF_1 + 0x06 MERIT_TRIPLE_ATTACK_RATE = MCATEGORY_THF_1 + 0x08 --PLD 1 MERIT_SHIELD_BASH_RECAST = MCATEGORY_PLD_1 + 0x00 MERIT_HOLY_CIRCLE_RECAST = MCATEGORY_PLD_1 + 0x02 MERIT_SENTINEL_RECAST = MCATEGORY_PLD_1 + 0x04 MERIT_COVER_EFFECT_LENGTH = MCATEGORY_PLD_1 + 0x06 MERIT_RAMPART_RECAST = MCATEGORY_PLD_1 + 0x08 --DRK 1 MERIT_SOULEATER_RECAST = MCATEGORY_DRK_1 + 0x00 MERIT_ARCANE_CIRCLE_RECAST = MCATEGORY_DRK_1 + 0x02 MERIT_LAST_RESORT_RECAST = MCATEGORY_DRK_1 + 0x04 MERIT_LAST_RESORT_EFFECT = MCATEGORY_DRK_1 + 0x06 MERIT_WEAPON_BASH_EFFECT = MCATEGORY_DRK_1 + 0x08 --BST 1 MERIT_KILLER_EFFECTS = MCATEGORY_BST_1 + 0x00 MERIT_REWARD_RECAST = MCATEGORY_BST_1 + 0x02 MERIT_CALL_BEAST_RECAST = MCATEGORY_BST_1 + 0x04 MERIT_SIC_RECAST = MCATEGORY_BST_1 + 0x06 MERIT_TAME_RECAST = MCATEGORY_BST_1 + 0x08 --BRD 1 MERIT_LULLABY_RECAST = MCATEGORY_BRD_1 + 0x00 MERIT_FINALE_RECAST = MCATEGORY_BRD_1 + 0x02 MERIT_MINNE_EFFECT = MCATEGORY_BRD_1 + 0x04 MERIT_MINUET_EFFECT = MCATEGORY_BRD_1 + 0x06 MERIT_MADRIGAL_EFFECT = MCATEGORY_BRD_1 + 0x08 --RNG 1 MERIT_SCAVENGE_EFFECT = MCATEGORY_RNG_1 + 0x00 MERIT_CAMOUFLAGE_RECAST = MCATEGORY_RNG_1 + 0x02 MERIT_SHARPSHOT_RECAST = MCATEGORY_RNG_1 + 0x04 MERIT_UNLIMITED_SHOT_RECAST = MCATEGORY_RNG_1 + 0x06 MERIT_RAPID_SHOT_RATE = MCATEGORY_RNG_1 + 0x08 --SAM 1 MERIT_THIRD_EYE_RECAST = MCATEGORY_SAM_1 + 0x00 MERIT_WARDING_CIRCLE_RECAST = MCATEGORY_SAM_1 + 0x02 MERIT_STORE_TP_EFFECT = MCATEGORY_SAM_1 + 0x04 MERIT_MEDITATE_RECAST = MCATEGORY_SAM_1 + 0x06 MERIT_ZASHIN_ATTACK_RATE = MCATEGORY_SAM_1 + 0x08 --NIN 1 MERIT_SUBTLE_BLOW_EFFECT = MCATEGORY_NIN_1 + 0x00 MERIT_KATON_EFFECT = MCATEGORY_NIN_1 + 0x02 MERIT_HYOTON_EFFECT = MCATEGORY_NIN_1 + 0x04 MERIT_HUTON_EFFECT = MCATEGORY_NIN_1 + 0x06 MERIT_DOTON_EFFECT = MCATEGORY_NIN_1 + 0x08 MERIT_RAITON_EFFECT = MCATEGORY_NIN_1 + 0x0A MERIT_SUITON_EFFECT = MCATEGORY_NIN_1 + 0x0C --DRG 1 MERIT_ANCIENT_CIRCLE_RECAST = MCATEGORY_DRG_1 + 0x00 MERIT_JUMP_RECAST = MCATEGORY_DRG_1 + 0x02 MERIT_HIGH_JUMP_RECAST = MCATEGORY_DRG_1 + 0x04 MERIT_SUPER_JUMP_RECAST = MCATEGORY_DRG_1 + 0x05 MERIT_SPIRIT_LINK_RECAST = MCATEGORY_DRG_1 + 0x08 --SMN 1 MERIT_AVATAR_PHYSICAL_ACCURACY = MCATEGORY_SMN_1 + 0x00 MERIT_AVATAR_PHYSICAL_ATTACK = MCATEGORY_SMN_1 + 0x02 MERIT_AVATAR_MAGICAL_ACCURACY = MCATEGORY_SMN_1 + 0x04 MERIT_AVATAR_MAGICAL_ATTACK = MCATEGORY_SMN_1 + 0x06 MERIT_SUMMONING_MAGIC_CAST_TIME = MCATEGORY_SMN_1 + 0x08 --BLU 1 MERIT_CHAIN_AFFINITY_RECAST = MCATEGORY_BLU_1 + 0x00 MERIT_BURST_AFFINITY_RECAST = MCATEGORY_BLU_1 + 0x02 MERIT_MONSTER_CORRELATION = MCATEGORY_BLU_1 + 0x04 MERIT_PHYSICAL_POTENCY = MCATEGORY_BLU_1 + 0x06 MERIT_MAGICAL_ACCURACY = MCATEGORY_BLU_1 + 0x08 --COR 1 MERIT_PHANTOM_ROLL_RECAST = MCATEGORY_COR_1 + 0x00 MERIT_QUICK_DRAW_RECAST = MCATEGORY_COR_1 + 0x02 MERIT_QUICK_DRAW_ACCURACY = MCATEGORY_COR_1 + 0x04 MERIT_RANDOM_DEAL_RECAST = MCATEGORY_COR_1 + 0x06 MERIT_BUST_DURATION = MCATEGORY_COR_1 + 0x08 --PUP 1 MERIT_AUTOMATION_MELEE_SKILL = MCATEGORY_PUP_1 + 0x00 MERIT_AUTOMATION_RANGED_SKILL = MCATEGORY_PUP_1 + 0x02 MERIT_AUTOMATION_MAGIC_SKILL = MCATEGORY_PUP_1 + 0x04 MERIT_ACTIVATE_RECAST = MCATEGORY_PUP_1 + 0x06 MERIT_REPAIR_RECAST = MCATEGORY_PUP_1 + 0x08 --DNC 1 MERIT_STEP_ACCURACY = MCATEGORY_DNC_1 + 0x00 MERIT_HASTE_SAMBA_EFFECT = MCATEGORY_DNC_1 + 0x02 MERIT_REVERSE_FLOURISH_EFFECT = MCATEGORY_DNC_1 + 0x04 MERIT_BUILDING_FLOURISH_EFFECT = MCATEGORY_DNC_1 + 0x06 --SCH 1 MERIT_GRIMOIRE_RECAST = MCATEGORY_SCH_1 + 0x00 MERIT_MODUS_VERITAS_DURATION = MCATEGORY_SCH_1 + 0x02 MERIT_HELIX_MAGIC_ACC_ATT = MCATEGORY_SCH_1 + 0x04 MERIT_MAX_SUBLIMATION = MCATEGORY_SCH_1 + 0x06 --WEAPON SKILLS MERIT_SHIJIN_SPIRAL = MCATEGORY_WS + 0x00 MERIT_EXENTERATOR = MCATEGORY_WS + 0x02 MERIT_REQUIESCAT = MCATEGORY_WS + 0x04 MERIT_RESOLUTION = MCATEGORY_WS + 0x06 MERIT_RUINATOR = MCATEGORY_WS + 0x08 MERIT_UPHEAVAL = MCATEGORY_WS + 0x0A MERIT_ENTROPY = MCATEGORY_WS + 0x0C MERIT_STARDIVER = MCATEGORY_WS + 0x0E MERIT_BLADE_SHUN = MCATEGORY_WS + 0x10 MERIT_TACHI_SHOHA = MCATEGORY_WS + 0x12 MERIT_REALMRAZER = MCATEGORY_WS + 0x14 MERIT_SHATTERSOUL = MCATEGORY_WS + 0x16 MERIT_APEX_ARROW = MCATEGORY_WS + 0x18 MERIT_LAST_STAND = MCATEGORY_WS + 0x1A -- unknown --MERIT_UNKNOWN1 = MCATEGORY_UNK_0 + 0x00 --MERIT_UNKNOWN2 = MCATEGORY_UNK_1 + 0x00 --MERIT_UNKNOWN3 = MCATEGORY_UNK_2 + 0x00 --MERIT_UNKNOWN4 = MCATEGORY_UNK_3 + 0x00 --MERIT_UNKNOWN5 = MCATEGORY_UNK_4 + 0x00 --WAR 2 MERIT_WARRIORS_CHARGE = MCATEGORY_WAR_2 + 0x00 MERIT_TOMAHAWK = MCATEGORY_WAR_2 + 0x02 MERIT_SAVAGERY = MCATEGORY_WAR_2 + 0x04 MERIT_AGGRESSIVE_AIM = MCATEGORY_WAR_2 + 0x06 --MNK 2 MERIT_MANTRA = MCATEGORY_MNK_2 + 0x00 MERIT_FORMLESS_STRIKES = MCATEGORY_MNK_2 + 0x02 MERIT_INVIGORATE = MCATEGORY_MNK_2 + 0x04 MERIT_PENANCE = MCATEGORY_MNK_2 + 0x06 --WHM 2 MERIT_MARTYR = MCATEGORY_WHM_2 + 0x00 MERIT_DEVOTION = MCATEGORY_WHM_2 + 0x02 MERIT_PROTECTRA_V = MCATEGORY_WHM_2 + 0x04 MERIT_SHELLRA_V = MCATEGORY_WHM_2 + 0x06 --BLM 2 MERIT_FLARE_II = MCATEGORY_BLM_2 + 0x00 MERIT_FREEZE_II = MCATEGORY_BLM_2 + 0x02 MERIT_TORNADO_II = MCATEGORY_BLM_2 + 0x04 MERIT_QUAKE_II = MCATEGORY_BLM_2 + 0x06 MERIT_BURST_II = MCATEGORY_BLM_2 + 0x08 MERIT_FLOOD_II = MCATEGORY_BLM_2 + 0x0A --RDM 2 MERIT_DIA_III = MCATEGORY_RDM_2 + 0x00 MERIT_SLOW_II = MCATEGORY_RDM_2 + 0x02 MERIT_PARALYZE_II = MCATEGORY_RDM_2 + 0x04 MERIT_PHALANX_II = MCATEGORY_RDM_2 + 0x06 MERIT_BIO_III = MCATEGORY_RDM_2 + 0x08 MERIT_BLIND_II = MCATEGORY_RDM_2 + 0x0A --THF 2 MERIT_ASSASSINS_CHARGE = MCATEGORY_THF_2 + 0x00 MERIT_FEINT = MCATEGORY_THF_2 + 0x02 MERIT_AURA_STEAL = MCATEGORY_THF_2 + 0x04 MERIT_AMBUSH = MCATEGORY_THF_2 + 0x06 --PLD 2 MERIT_FEALTY = MCATEGORY_PLD_2 + 0x00 MERIT_CHIVALRY = MCATEGORY_PLD_2 + 0x02 MERIT_IRON_WILL = MCATEGORY_PLD_2 + 0x04 MERIT_GUARDIAN = MCATEGORY_PLD_2 + 0x06 --DRK 2 MERIT_DARK_SEAL = MCATEGORY_DRK_2 + 0x00 MERIT_DIABOLIC_EYE = MCATEGORY_DRK_2 + 0x02 MERIT_MUTED_SOUL = MCATEGORY_DRK_2 + 0x04 MERIT_DESPERATE_BLOWS = MCATEGORY_DRK_2 + 0x06 --BST 2 MERIT_FERAL_HOWL = MCATEGORY_BST_2 + 0x00 MERIT_KILLER_INSTINCT = MCATEGORY_BST_2 + 0x02 MERIT_BEAST_AFFINITY = MCATEGORY_BST_2 + 0x04 MERIT_BEAST_HEALER = MCATEGORY_BST_2 + 0x06 --BRD 2 MERIT_NIGHTINGALE = MCATEGORY_BRD_2 + 0x00 MERIT_TROUBADOUR = MCATEGORY_BRD_2 + 0x02 MERIT_FOE_SIRVENTE = MCATEGORY_BRD_2 + 0x04 MERIT_ADVENTURERS_DIRGE = MCATEGORY_BRD_2 + 0x06 --RNG 2 MERIT_STEALTH_SHOT = MCATEGORY_RNG_2 + 0x00 MERIT_FLASHY_SHOT = MCATEGORY_RNG_2 + 0x02 MERIT_SNAPSHOT = MCATEGORY_RNG_2 + 0x04 MERIT_RECYCLE = MCATEGORY_RNG_2 + 0x06 --SAM 2 MERIT_SHIKIKOYO = MCATEGORY_SAM_2 + 0x00 MERIT_BLADE_BASH = MCATEGORY_SAM_2 + 0x02 MERIT_IKISHOTEN = MCATEGORY_SAM_2 + 0x04 MERIT_OVERWHELM = MCATEGORY_SAM_2 + 0x06 --NIN 2 MERIT_SANGE = MCATEGORY_NIN_2 + 0x00 MERIT_NINJA_TOOL_EXPERTISE = MCATEGORY_NIN_2 + 0x02 MERIT_KATON_SAN = MCATEGORY_NIN_2 + 0x04 MERIT_HYOTON_SAN = MCATEGORY_NIN_2 + 0x06 MERIT_HUTON_SAN = MCATEGORY_NIN_2 + 0x08 MERIT_DOTON_SAN = MCATEGORY_NIN_2 + 0x0A MERIT_RAITON_SAN = MCATEGORY_NIN_2 + 0x0C MERIT_SUITON_SAN = MCATEGORY_NIN_2 + 0x0E --DRG 2 MERIT_DEEP_BREATHING = MCATEGORY_DRG_2 + 0x00 MERIT_ANGON = MCATEGORY_DRG_2 + 0x02 MERIT_EMPATHY = MCATEGORY_DRG_2 + 0x04 MERIT_STRAFE = MCATEGORY_DRG_2 + 0x06 --SMN 2 MERIT_METEOR_STRIKE = MCATEGORY_SMN_2 + 0x00 MERIT_HEAVENLY_STRIKE = MCATEGORY_SMN_2 + 0x02 MERIT_WIND_BLADE = MCATEGORY_SMN_2 + 0x04 MERIT_GEOCRUSH = MCATEGORY_SMN_2 + 0x06 MERIT_THUNDERSTORM = MCATEGORY_SMN_2 + 0x08 MERIT_GRANDFALL = MCATEGORY_SMN_2 + 0x0A --BLU 2 MERIT_CONVERGENCE = MCATEGORY_BLU_2 + 0x00 MERIT_DIFFUSION = MCATEGORY_BLU_2 + 0x02 MERIT_ENCHAINMENT = MCATEGORY_BLU_2 + 0x04 MERIT_ASSIMILATION = MCATEGORY_BLU_2 + 0x06 --COR 2 MERIT_SNAKE_EYE = MCATEGORY_COR_2 + 0x00 MERIT_FOLD = MCATEGORY_COR_2 + 0x02 MERIT_WINNING_STREAK = MCATEGORY_COR_2 + 0x04 MERIT_LOADED_DECK = MCATEGORY_COR_2 + 0x06 --PUP 2 MERIT_ROLE_REVERSAL = MCATEGORY_PUP_2 + 0x00 MERIT_VENTRILOQUY = MCATEGORY_PUP_2 + 0x02 MERIT_FINE_TUNING = MCATEGORY_PUP_2 + 0x04 MERIT_OPTIMIZATION = MCATEGORY_PUP_2 + 0x06 --DNC 2 MERIT_SABER_DANCE = MCATEGORY_DNC_2 + 0x00 MERIT_FAN_DANCE = MCATEGORY_DNC_2 + 0x02 MERIT_NO_FOOT_RISE = MCATEGORY_DNC_2 + 0x04 MERIT_CLOSED_POSITION = MCATEGORY_DNC_2 + 0x06 --SCH 2 MERIT_ALTRUISM = MCATEGORY_SCH_2 + 0x00 MERIT_FOCALIZATION = MCATEGORY_SCH_2 + 0x02 MERIT_TRANQUILITY = MCATEGORY_SCH_2 + 0x04 MERIT_EQUANIMITY = MCATEGORY_SCH_2 + 0x06 MERIT_ENLIGHTENMENT = MCATEGORY_SCH_2 + 0x08 MERIT_STORMSURGE = MCATEGORY_SCH_2 + 0x0A ------------------------------------ -- Slot Definitions ------------------------------------ SLOT_MAIN = 0 SLOT_SUB = 1 SLOT_RANGED = 2 SLOT_AMMO = 3 SLOT_HEAD = 4 SLOT_BODY = 5 SLOT_HANDS = 6 SLOT_LEGS = 7 SLOT_FEET = 8 SLOT_NECK = 9 SLOT_WAIST = 10 SLOT_EAR1 = 11 SLOT_EAR2 = 12 SLOT_RING1 = 13 SLOT_RING2 = 14 SLOT_BACK = 15 ---------------------------------- -- Objtype Definitions ---------------------------------- TYPE_PC = 0x01 TYPE_NPC = 0x02 TYPE_MOB = 0x04 TYPE_PET = 0x08 TYPE_SHIP = 0x10 ---------------------------------- -- Allegiance Definitions ---------------------------------- ALLEGIANCE_MOB = 0 ALLEGIANCE_PLAYER = 1 ALLEGIANCE_SAN_DORIA = 2 ALLEGIANCE_BASTOK = 3 ALLEGIANCE_WINDURST = 4 ------------------------------------ -- Inventory enum ------------------------------------ LOC_INVENTORY = 0 LOC_MOGSAFE = 1 LOC_STORAGE = 2 LOC_TEMPITEMS = 3 LOC_MOGLOCKER = 4 LOC_MOGSATCHEL = 5 LOC_MOGSACK = 6 ------------------------------------ -- Message enum ------------------------------------ MSGBASIC_DEFEATS_TARG = 6 -- The <player> defeats <target>. MSGBASIC_ALREADY_CLAIMED = 12 -- Cannot attack. Your target is already claimed. MSGBASIC_IS_INTERRUPTED = 16 -- The <player>'s casting is interrupted. MSGBASIC_UNABLE_TO_CAST = 18 -- Unable to cast spells at this time. MSGBASIC_CANNOT_PERFORM = 71 -- The <player> cannot perform that action. MSGBASIC_UNABLE_TO_USE_JA = 87 -- Unable to use job ability. MSGBASIC_UNABLE_TO_USE_JA2 = 88 -- Unable to use job ability. MSGBASIC_IS_PARALYZED = 29 -- The <player> is paralyzed. MSGBASIC_SHADOW_ABSORB = 31 -- .. of <target>'s shadows absorb the damage and disappear. MSGBASIC_NOT_ENOUGH_MP = 34 -- The <player> does not have enough MP to cast (NULL). MSGBASIC_NO_NINJA_TOOLS = 35 -- The <player> lacks the ninja tools to cast (NULL). MSGBASIC_UNABLE_TO_CAST_SPELLS = 49 -- The <player> is unable to cast spells. MSGBASIC_WAIT_LONGER = 94 -- You must wait longer to perform that action. MSGBASIC_USES_JA = 100 -- The <player> uses .. MSGBASIC_USES_JA2 = 101 -- The <player> uses .. MSGBASIC_USES_RECOVERS_HP = 102 -- The <player> uses .. <target> recovers .. HP. MSGBASIC_USES_JA_TAKE_DAMAGE = 317 -- The <player> uses .. <target> takes .. points of damage. MSGBASIC_IS_INTIMIDATED = 106 -- The <player> is intimidated by <target>'s presence. MSGBASIC_CANNOT_ON_THAT_TARG = 155 -- You cannot perform that action on the specified target. MSGBASIC_CANNOT_ATTACK_TARGET = 446 -- You cannot attack that target MSGBASIC_NEEDS_2H_WEAPON = 307 -- That action requires a two-handed weapon. MSGBASIC_USES_BUT_MISSES = 324 -- The <player> uses .. but misses <target>. MSGBASIC_CANT_BE_USED_IN_AREA = 316 -- That action cannot be used in this area. MSGBASIC_REQUIRES_SHIELD = 199 -- That action requires a shield. MSGBASIC_REQUIRES_COMBAT = 525 -- .. can only be performed during battle. MSGBASIC_STATUS_PREVENTS = 569 -- Your current status prevents you from using that ability. -- Distance MSGBASIC_TARG_OUT_OF_RANGE = 4 -- <target> is out of range. MSGBASIC_UNABLE_TO_SEE_TARG = 5 -- Unable to see <target>. MSGBASIC_LOSE_SIGHT = 36 -- You lose sight of <target>. MSGBASIC_TOO_FAR_AWAY = 78 -- <target> is too far away. -- Weaponskills MSGBASIC_CANNOT_USE_WS = 190 -- The <player> cannot use that weapon ability. MSGBASIC_NOT_ENOUGH_TP = 192 -- The <player> does not have enough TP. -- Pets MSGBASIC_REQUIRES_A_PET = 215 -- That action requires a pet. MSGBASIC_THAT_SOMEONES_PET = 235 -- That is someone's pet. MSGBASIC_ALREADY_HAS_A_PET = 315 -- The <player> already has a pet. MSGBASIC_NO_EFFECT_ON_PET = 336 -- No effect on that pet. MSGBASIC_NO_JUG_PET_ITEM = 337 -- You do not have the necessary item equipped to call a beast. MSGBASIC_MUST_HAVE_FOOD = 347 -- You must have pet food equipped to use that command. MSGBASIC_PET_CANNOT_DO_ACTION = 574 -- <player>'s pet is currently unable to perform that action. MSGBASIC_PET_NOT_ENOUGH_TP = 575 -- <player>'s pet does not have enough TP to perform that action. -- Items MSGBASIC_CANNOT_USE_ITEM_ON = 92 -- Cannot use the <item> on <target>. MSGBASIC_ITEM_FAILS_TO_ACTIVATE = 62 -- The <item> fails to activate. MSGBASIC_FULL_INVENTORY = 356 -- Cannot execute command. Your inventory is full. -- Ranged MSGBASIC_NO_RANGED_WEAPON = 216 -- You do not have an appropriate ranged weapon equipped. MSGBASIC_CANNOT_SEE = 217 -- You cannot see <target>. MSGBASIC_MOVE_AND_INTERRUPT = 218 -- You move and interrupt your aim. -- Charm MSGBASIC_CANNOT_CHARM = 210 -- The <player> cannot charm <target>! MSGBASIC_VERY_DIFFICULT_CHARM = 211 -- It would be very difficult for the <player> to charm <target>. MSGBASIC_DIFFICULT_TO_CHARM = 212 -- It would be difficult for the <player> to charm <target>. MSGBASIC_MIGHT_BE_ABLE_CHARM = 213 -- The <player> might be able to charm <target>. MSGBASIC_SHOULD_BE_ABLE_CHARM = 214 -- The <player> should be able to charm <target>. -- BLU MSGBASIC_LEARNS_SPELL = 419 -- <target> learns (NULL)! -- COR MSGBASIC_ROLL_MAIN = 420 -- The <player> uses .. The total comes to ..! <target> receives the effect of .. MSGBASIC_ROLL_SUB = 421 -- <target> receives the effect of .. MSGBASIC_ROLL_MAIN_FAIL = 422 -- The <player> uses .. The total comes to ..! No effect on <target>. MSGBASIC_ROLL_SUB_FAIL = 423 -- No effect on <target>. MSGBASIC_DOUBLEUP = 424 -- The <player> uses Double-Up. The total for . increases to ..! <target> receives the effect of .. MSGBASIC_DOUBLEUP_FAIL = 425 -- The <player> uses Double-Up. The total for . increases to ..! No effect on <target>. MSGBASIC_DOUBLEUP_BUST = 426 -- The <player> uses Double-Up. Bust! <target> loses the effect of .. MSGBASIC_DOUBLEUP_BUST_SUB = 427 -- <target> loses the effect of .. MSGBASIC_NO_ELIGIBLE_ROLL = 428 -- There are no rolls eligible for Double-Up. Unable to use ability. MSGBASIC_ROLL_ALREADY_ACTIVE = 429 -- The same roll is already active on the <player>. MSGBASIC_EFFECT_ALREADY_ACTIVE = 523 -- The same effect is already active on <player>. MSGBASIC_NO_FINISHINGMOVES = 524 -- You have not earned enough finishing moves to perform that action. ------------------------------------ -- Spell Groups ------------------------------------ SPELLGROUP_NONE = 0 SPELLGROUP_SONG = 1 SPELLGROUP_BLACK = 2 SPELLGROUP_BLUE = 3 SPELLGROUP_NINJUTSU = 4 SPELLGROUP_SUMMONING = 5 SPELLGROUP_WHITE = 6 ------------------------------------ -- MOBMODs ------------------------------------ MOBMOD_GIL_MIN = 1 MOBMOD_GIL_MAX = 2 MOBMOD_MP_BASE = 3 MOBMOD_SIGHT_RANGE = 4 MOBMOD_SOUND_RANGE = 5 MOBMOD_BUFF_CHANCE = 6 MOBMOD_GA_CHANCE = 7 MOBMOD_HEAL_CHANCE = 8 MOBMOD_HP_HEAL_CHANCE = 9 MOBMOD_SUBLINK = 10 MOBMOD_LINK_RADIUS = 11 MOBMOD_DRAW_IN = 12 MOBMOD_RAGE = 13 MOBMOD_SKILLS = 14 MOBMOD_MUG_GIL = 15 MOBMOD_MAIN_2HOUR = 16 MOBMOD_NO_DESPAWN = 17 MOBMOD_VAR = 18 -- Used by funguar to track skill uses. MOBMOD_SUB_2HOUR = 19 MOBMOD_TP_USE_CHANCE = 20 MOBMOD_PET_SPELL_LIST = 21 MOBMOD_NA_CHANCE = 22 MOBMOD_IMMUNITY = 23 MOBMOD_GRADUAL_RAGE = 24 MOBMOD_BUILD_RESIST = 25 MOBMOD_SUPERLINK = 26 MOBMOD_SPELL_LIST = 27 MOBMOD_EXP_BONUS = 28 MOBMOD_ASSIST = 29 MOBMOD_SPECIAL_SKILL = 30 MOBMOD_ROAM_DISTANCE = 31 MOBMOD_2HOUR_MULTI = 32 MOBMOD_SPECIAL_COOL = 33 MOBMOD_MAGIC_COOL = 34 MOBMOD_STANDBACK_TIME = 35 MOBMOD_ROAM_COOL = 36 MOBMOD_ALWAYS_AGGRO = 37 MOBMOD_NO_DROPS = 38 -- If set monster cannot drop any items, not even seals. MOBMOD_SHARE_POS = 39 MOBMOD_TELEPORT_CD = 40 MOBMOD_TELEPORT_START = 41 MOBMOD_TELEPORT_END = 42 MOBMOD_TELEPORT_TYPE = 43 MOBMOD_DUAL_WIELD = 44 MOBMOD_ADD_EFFECT = 45 MOBMOD_AUTO_SPIKES = 46 MOBMOD_SPAWN_LEASH = 47 MOBMOD_SHARE_TARGET = 48 ------------------------------------ -- Skills ------------------------------------ -- Combat Skills SKILL_NON = 0 SKILL_H2H = 1 SKILL_DAG = 2 SKILL_SWD = 3 SKILL_GSD = 4 SKILL_AXE = 5 SKILL_GAX = 6 SKILL_SYH = 7 SKILL_POL = 8 SKILL_KAT = 9 SKILL_GKT = 10 SKILL_CLB = 11 SKILL_STF = 12 -- 13~21 unused -- 22~24 pup's Automaton skills SKILL_ARC = 25 SKILL_MRK = 26 SKILL_THR = 27 -- Defensive Skills SKILL_GRD = 28 SKILL_EVA = 29 SKILL_SHL = 30 SKILL_PAR = 31 -- Magic Skills SKILL_DIV = 32 SKILL_HEA = 33 SKILL_ENH = 34 SKILL_ENF = 35 SKILL_ELE = 36 SKILL_DRK = 37 SKILL_SUM = 38 SKILL_NIN = 39 SKILL_SNG = 40 SKILL_STR = 41 SKILL_WND = 42 SKILL_BLU = 43 SKILL_GEO = 44 -- 45~47 unused -- Crafting Skills SKILL_FISHING = 48 SKILL_WOODWORKING = 49 SKILL_SMITHING = 50 SKILL_GOLDSMITHING = 51 SKILL_CLOTHCRAFT = 52 SKILL_LEATHERCRAFT = 53 SKILL_BONECRAFT = 54 SKILL_ALCHEMY = 55 SKILL_COOKING = 56 SKILL_SYNERGY = 57 -- Other Skills SKILL_RID = 58 SKILL_DIG = 59 -- 60~63 unused -- MAX_SKILLTYPE = 64 ------------------------------------ -- Recast IDs ------------------------------------ RECAST_ITEM = 0 RECAST_MAGIC = 1 RECAST_ABILITY = 2 ------------------------------------ -- ACTION IDs ------------------------------------ ACTION_NONE = 0; ACTION_ATTACK = 1; ACTION_RANGED_FINISH = 2; ACTION_WEAPONSKILL_FINISH = 3; ACTION_MAGIC_FINISH = 4; ACTION_ITEM_FINISH = 5; ACTION_JOBABILITY_FINISH = 6; ACTION_WEAPONSKILL_START = 7; ACTION_MAGIC_START = 8; ACTION_ITEM_START = 9; ACTION_JOBABILITY_START = 10; ACTION_MOBABILITY_FINISH = 11; ACTION_RANGED_START = 12; ACTION_RAISE_MENU_SELECTION = 13; ACTION_DANCE = 14; ACTION_UNKNOWN_15 = 15; ACTION_ROAMING = 16; ACTION_ENGAGE = 17; ACTION_DISENGAGE = 18; ACTION_CHANGE_TARGET = 19; ACTION_FALL = 20; ACTION_DROPITEMS = 21; ACTION_DEATH = 22; ACTION_FADE_OUT = 23; ACTION_DESPAWN = 24; ACTION_SPAWN = 25; ACTION_STUN = 26; ACTION_SLEEP = 27; ACTION_ITEM_USING = 28; ACTION_ITEM_INTERRUPT = 29; ACTION_MAGIC_CASTING = 30; ACTION_MAGIC_INTERRUPT = 31; ACTION_RANGED_INTERRUPT = 32; ACTION_MOBABILITY_START = 33; ACTION_MOBABILITY_USING = 34; ACTION_MOBABILITY_INTERRUPT = 35; ACTION_LEAVE = 36; ------------------------------------ -- ECOSYSTEM IDs ------------------------------------ SYSTEM_ERROR = 0; SYSTEM_AMORPH = 1; SYSTEM_AQUAN = 2; SYSTEM_ARCANA = 3; SYSTEM_ARCHAICMACHINE = 4; SYSTEM_AVATAR = 5; SYSTEM_BEAST = 6; SYSTEM_BEASTMEN = 7; SYSTEM_BIRD = 8; SYSTEM_DEMON = 9; SYSTEM_DRAGON = 10; SYSTEM_ELEMENTAL = 11; SYSTEM_EMPTY = 12; SYSTEM_HUMANOID = 13; SYSTEM_LIZARD = 14; SYSTEM_LUMORIAN = 15; SYSTEM_LUMINION = 16; SYSTEM_PLANTOID = 17; SYSTEM_UNCLASSIFIED = 18; SYSTEM_UNDEAD = 19; SYSTEM_VERMIN = 20; SYSTEM_VORAGEAN = 21; ------------------------------------ -- Spell AOE IDs ------------------------------------ SPELLAOE_NONE = 0; SPELLAOE_RADIAL = 1; SPELLAOE_CONAL = 2; SPELLAOE_RADIAL_MANI = 3; -- AOE when under SCH stratagem Manifestation SPELLAOE_RADIAL_ACCE = 4; -- AOE when under SCH stratagem Accession SPELLAOE_PIANISSIMO = 5; -- Single target when under BRD JA Pianissimo SPELLAOE_DIFFUSION = 6; -- AOE when under Diffusion ------------------------------------ -- Spell flag bits ------------------------------------ SPELLFLAG_NONE = 0; SPELLFLAG_HIT_ALL = 1; -- hit all targets in range regardless of party ------------------------------------ -- Behaviour bits ------------------------------------ BEHAVIOUR_NONE = 0x000; BEHAVIOUR_NO_DESPAWN = 0x001; -- mob does not despawn on death BEHAVIOUR_STANDBACK = 0x002; -- mob will standback forever BEHAVIOUR_RAISABLE = 0x004; -- mob can be raised via Raise spells BEHAVIOUR_AGGRO_AMBUSH = 0x200; -- mob aggroes by ambush BEHAVIOUR_NO_TURN = 0x400; -- mob does not turn to face target ------------------------------------ -- Elevator IDs ------------------------------------ ELEVATOR_KUFTAL_TUNNEL_DSPPRNG_RCK = 1; ELEVATOR_PORT_BASTOK_DRWBRDG = 2; ELEVATOR_DAVOI_LIFT = 3; ELEVATOR_PALBOROUGH_MINES_LIFT = 4;
gpl-3.0
LegionXI/darkstar
scripts/zones/The_Eldieme_Necropolis/npcs/_5fl.lua
14
2654
----------------------------------- -- Area: The Eldieme Necropolis -- NPC: East Plate -- @pos 231 -34 20 195 ----------------------------------- ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local state0 = 8; local state1 = 9; local DoorOffset = npc:getID() - 20; -- _5f1 if (npc:getAnimation() == 8) then state0 = 9; state1 = 8; end -- Gates -- Shiva's Gate GetNPCByID(DoorOffset):setAnimation(state0); GetNPCByID(DoorOffset+1):setAnimation(state0); GetNPCByID(DoorOffset+2):setAnimation(state0); GetNPCByID(DoorOffset+3):setAnimation(state0); GetNPCByID(DoorOffset+4):setAnimation(state0); -- Odin's Gate GetNPCByID(DoorOffset+5):setAnimation(state1); GetNPCByID(DoorOffset+6):setAnimation(state1); GetNPCByID(DoorOffset+7):setAnimation(state1); GetNPCByID(DoorOffset+8):setAnimation(state1); GetNPCByID(DoorOffset+9):setAnimation(state1); -- Leviathan's Gate GetNPCByID(DoorOffset+10):setAnimation(state0); GetNPCByID(DoorOffset+11):setAnimation(state0); GetNPCByID(DoorOffset+12):setAnimation(state0); GetNPCByID(DoorOffset+13):setAnimation(state0); GetNPCByID(DoorOffset+14):setAnimation(state0); -- Titan's Gate GetNPCByID(DoorOffset+15):setAnimation(state1); GetNPCByID(DoorOffset+16):setAnimation(state1); GetNPCByID(DoorOffset+17):setAnimation(state1); GetNPCByID(DoorOffset+18):setAnimation(state1); GetNPCByID(DoorOffset+19):setAnimation(state1); -- Plates -- East Plate GetNPCByID(DoorOffset+20):setAnimation(state0); GetNPCByID(DoorOffset+21):setAnimation(state0); -- North Plate GetNPCByID(DoorOffset+22):setAnimation(state0); GetNPCByID(DoorOffset+23):setAnimation(state0); -- West Plate GetNPCByID(DoorOffset+24):setAnimation(state0); GetNPCByID(DoorOffset+25):setAnimation(state0); -- South Plate GetNPCByID(DoorOffset+26):setAnimation(state0); GetNPCByID(DoorOffset+27):setAnimation(state0); return 0; 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/pets/wyvern.lua
12
7305
----------------------------------- -- PET: Wyvern ----------------------------------- require("scripts/globals/status") require("scripts/globals/msg") local WYVERN_OFFENSIVE = 1 local WYVERN_DEFENSIVE = 2 local WYVERN_MULTI = 3 local wyvernTypes = { [dsp.job.WAR] = WYVERN_OFFENSIVE, [dsp.job.MNK] = WYVERN_OFFENSIVE, [dsp.job.WHM] = WYVERN_DEFENSIVE, [dsp.job.BLM] = WYVERN_DEFENSIVE, [dsp.job.RDM] = WYVERN_DEFENSIVE, [dsp.job.THF] = WYVERN_OFFENSIVE, [dsp.job.PLD] = WYVERN_MULTI, [dsp.job.DRK] = WYVERN_MULTI, [dsp.job.BST] = WYVERN_OFFENSIVE, [dsp.job.BRD] = WYVERN_MULTI, [dsp.job.RNG] = WYVERN_OFFENSIVE, [dsp.job.SAM] = WYVERN_OFFENSIVE, [dsp.job.NIN] = WYVERN_MULTI, [dsp.job.DRG] = WYVERN_OFFENSIVE, [dsp.job.SMN] = WYVERN_DEFENSIVE, [dsp.job.BLU] = WYVERN_DEFENSIVE, [dsp.job.COR] = WYVERN_OFFENSIVE, [dsp.job.PUP] = WYVERN_OFFENSIVE, [dsp.job.DNC] = WYVERN_OFFENSIVE, [dsp.job.SCH] = WYVERN_DEFENSIVE, [dsp.job.GEO] = WYVERN_DEFENSIVE, [dsp.job.RUN] = WYVERN_MULTI } function doHealingBreath(player, threshold, breath) if player:getHPP() < threshold then player:getPet():useJobAbility(breath, player) else local party = player:getParty() for _,member in ipairs(party) do if member:getHPP() < threshold then player:getPet():useJobAbility(breath, member) break end end end end function onMobSpawn(mob) local master = mob:getMaster() mob:addMod(dsp.mod.DMG, -40) local wyvernType = wyvernTypes[master:getSubJob()] local healingbreath = 624 if mob:getMainLvl() >= 80 then healingbreath = 623 elseif mob:getMainLvl() >= 40 then healingbreath = 626 elseif mob:getMainLvl() >= 20 then healingbreath = 625 end if wyvernType == WYVERN_DEFENSIVE then master:addListener("WEAPONSKILL_USE", "PET_WYVERN_WS", function(player, target, skillid) local party = player:getParty() for _,member in ipairs(party) do if member:hasStatusEffect(dsp.effect.POISON) then player:getPet():useJobAbility(627, member) break elseif member:hasStatusEffect(dsp.effect.BLINDNESS) and player:getPet():getMainLvl() > 20 then player:getPet():useJobAbility(628, member) break elseif member:hasStatusEffect(dsp.effect.PARALYSIS) and player:getPet():getMainLvl() > 40 then player:getPet():useJobAbility(629, member) break elseif (member:hasStatusEffect(dsp.effect.CURSE_I) or member:hasStatusEffect(dsp.effect.DOOM)) and player:getPet():getMainLvl() > 60 then player:getPet():useJobAbility(637, member) break elseif (member:hasStatusEffect(dsp.effect.DISEASE) or member:hasStatusEffect(dsp.effect.PLAGUE)) and player:getPet():getMainLvl() > 80 then player:getPet():useJobAbility(638, member) break end end end) if master:getSubJob() ~= dsp.job.SMN then master:addListener("MAGIC_USE", "PET_WYVERN_MAGIC", function(player, target, spell, action) -- check master first! local threshold = 33 if player:getMod(dsp.mod.WYVERN_EFFECTIVE_BREATH) > 0 then threshold = 50 end doHealingBreath(player, threshold, healingbreath) end) end elseif wyvernType == WYVERN_OFFENSIVE or wyvernType == WYVERN_MULTI then master:addListener("WEAPONSKILL_USE", "PET_WYVERN_WS", function(player, target, skillid) local weaknessTargetChance = 75 local breaths = {} if player:getMod(dsp.mod.WYVERN_EFFECTIVE_BREATH) > 0 then weaknessTargetChance = 100 end if math.random(100) <= weaknessTargetChance then local weakness = 0 for mod = 0, 5 do if target:getMod(dsp.mod.FIREDEF + mod) < target:getMod(dsp.mod.FIREDEF + weakness) then breaths = {} table.insert(breaths, 630 + mod) elseif target:getMod(dsp.mod.FIREDEF + mod) == target:getMod(dsp.mod.FIREDEF + weakness) then table.insert(breaths, 630 + mod) end end else breaths = {630, 631, 632, 633, 634, 635} end player:getPet():useJobAbility(breaths[math.random(#breaths)], target) end) end if wyvernType == WYVERN_MULTI then master:addListener("MAGIC_USE", "PET_WYVERN_MAGIC", function(player, target, spell, action) -- check master first! local threshold = 25 if player:getMod(dsp.mod.WYVERN_EFFECTIVE_BREATH) > 0 then threshold = 33 end doHealingBreath(player, threshold, healingbreath) end) end master:addListener("ATTACK", "PET_WYVERN_ENGAGE", function(player, target, action) local pet = player:getPet() if pet:getTarget() == nil or target:getID() ~= pet:getTarget():getID() then player:petAttack(target) end end) master:addListener("DISENGAGE", "PET_WYVERN_DISENGAGE", function(player) player:petRetreat() end) master:addListener("EXPERIENCE_POINTS", "PET_WYVERN_EXP", function(player, exp) local pet = player:getPet() local prev_exp = pet:getLocalVar("wyvern_exp") if prev_exp < 1000 then -- cap exp at 1000 to prevent wyvern leveling up many times from large exp awards local currentExp = exp if prev_exp+exp > 1000 then currentExp = 1000 - prev_exp end local diff = math.floor((prev_exp + currentExp)/200) - math.floor(prev_exp/200) if diff ~= 0 then -- wyvern levelled up (diff is the number of level ups) pet:addMod(dsp.mod.ACC,6*diff) pet:addMod(dsp.mod.HPP,6*diff) pet:addMod(dsp.mod.ATTP,5*diff) pet:setHP(pet:getMaxHP()) player:messageBasic(dsp.msg.basic.STATUS_INCREASED, 0, 0, pet) master:addMod(dsp.mod.ATTP, 4 * diff) master:addMod(dsp.mod.DEFP, 4 * diff) master:addMod(dsp.mod.HASTE_ABILITY, 200 * diff) end pet:setLocalVar("wyvern_exp", prev_exp + exp) pet:setLocalVar("level_Ups", pet:getLocalVar("level_Ups") + diff) end end) end function onMobDeath(mob, player) local master = mob:getMaster() local numLvls = mob:getLocalVar("level_Ups") if numLvls ~= 0 then master:delMod(dsp.mod.ATTP, 4 * numLvls) master:delMod(dsp.mod.DEFP, 4 * numLvls) master:delMod(dsp.mod.HASTE_ABILITY, 200 * numLvls) end master:removeListener("PET_WYVERN_WS") master:removeListener("PET_WYVERN_MAGIC") master:removeListener("PET_WYVERN_ENGAGE") master:removeListener("PET_WYVERN_DISENGAGE") master:removeListener("PET_WYVERN_EXP") end
gpl-3.0
greasydeal/darkstar
scripts/zones/Cape_Teriggan/npcs/HomePoint#1.lua
12
1195
----------------------------------- -- Area: Cape Teriggan -- NPC: HomePoint#1 -- @pos -303 -8 526 113 ----------------------------------- package.loaded["scripts/zones/Cape_Teriggan/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/Cape_Teriggan/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fc, 91); 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
LegionXI/darkstar
scripts/zones/Lower_Jeuno/npcs/Zalsuhm.lua
18
4645
----------------------------------- -- Area: Lower Jeuno -- NPC: Zalsuhm -- Standard Info NPC ----------------------------------- require("scripts/globals/equipment"); require("scripts/globals/quests"); package.loaded["scripts/zones/Lower_Jeuno/TextIDs"] = nil; require("scripts/zones/Lower_Jeuno/TextIDs"); function getQuestId(mainJobId) return (UNLOCKING_A_MYTH_WARRIOR - 1 + mainJobId); end; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) --printf("LowerJeuno_Zalsuhm.onTrade() - "); if (trade:getItemCount() == 1) then for i, wepId in pairs(BaseNyzulWeapons) do if (trade:hasItemQty(wepId, 1)) then local unlockingAMyth = player:getQuestStatus(JEUNO, getQuestId(i)) --printf("\tUnlockingAMyth" .. i .. " = %u", unlockingAMyth); if (unlockingAMyth == QUEST_ACCEPTED) then -- TODO: Logic for checking weapons current WS points local wsPoints = 0; --printf("\twsPoints = %u", wsPoints); if (wsPoints >= 0 and wsPoints <= 49) then player:startEvent(0x276B); -- Lowest Tier Dialog elseif (wsPoints <= 200) then player:startEvent(0x276C); -- Mid Tier Dialog elseif (wsPoints <= 249) then player:startEvent(0x276D); -- High Tier Dialog elseif (wsPoints >= 250) then player:startEvent(0x2768, i); -- Quest Complete! end end return; end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) --printf("LowerJeuno_Zalsuhm.onTrigger() - "); local mainJobId = player:getMainJob(); local unlockingAMyth = player:getQuestStatus(JEUNO, getQuestId(mainJobId)) --printf("\tUnlockingAMyth" .. mainJobId .. " = %u", unlockingAMyth); local mainWeaponId = player:getEquipID(SLOT_MAIN); --printf("\tmainWeaponId: %u", mainWeaponId); local nyzulWeapon = isBaseNyzulWeapon(mainWeaponId); --printf("\tIsBaseNyzulWeapon: %s", (nyzulWeapon and "TRUE" or "FALSE")); if (unlockingAMyth == QUEST_AVAILABLE) then local zalsuhmUpset = player:getVar("Upset_Zalsuhm"); if (player:needToZone() and zalsuhmUpset > 0) then -- Zalsuhm is still angry player:startEvent(0x276A); else if (zalsuhmUpset > 0) then player:setVar("Upset_Zalsuhm", 0); end if (nyzulWeapon) then -- The player has a Nyzul weapon in the mainHand, try to initiate quest player:startEvent(0x2766, mainJobId); else player:startEvent(0x2765); -- Default dialog end end elseif (unlockingAMyth == QUEST_ACCEPTED) then -- Quest is active for current job player:startEvent(0x2767); -- Zalsuhm asks for the player to show him the weapon if they sense a change else -- Quest is complete for the current job player:startEvent(0x2769); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("LowerJeuno_Zalsuhm.onEventUpdate() - "); --printf("\tCSID: %u", csid); --printf("\tRESULT: %u", option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("LowerJeuno_Zalsuhm.onEventFinish() - "); --printf("\tCSID: %u", csid); --printf("\tRESULT: %u", option); -- Zalsuhm wants to research the player's Nyzul Weapon if (csid == 0x2766) then -- The player chose "He has shifty eyes" (turns down the quest) if (option == 53) then player:setVar("Upset_Zalsuhm", 1); player:needToZone(true); elseif (option <= JOBS["SCH"]) then -- Just to make sure we didn't get into an invalid state -- The player chose "More power" (accepts the quest) local questId = getQuestId(option); player:addQuest(JEUNO, questId); end elseif (csid == 0x2768 and option <= JOBS["SCH"]) then -- The quest is completed local questId = getQuestId(option); player:completeQuest(JEUNO, questId); end end;
gpl-3.0
greasydeal/darkstar
scripts/globals/items/flame_sword.lua
16
1029
----------------------------------------- -- ID: 16621 -- Item: Flame Sword -- Additional Effect: Fire Damage ----------------------------------------- require("scripts/globals/status"); require("scripts/globals/magic"); ----------------------------------- -- onAdditionalEffect Action ----------------------------------- function onAdditionalEffect(player,target,damage) local chance = 10; if (math.random(0,99) >= chance) then return 0,0,0; else local dmg = math.random(3,10); local params = {}; params.bonusmab = 0; params.includemab = false; dmg = addBonusesAbility(player, ELE_FIRE, target, dmg, params); dmg = dmg * applyResistanceAddEffect(player,target,ELE_FIRE,0); dmg = adjustForTarget(target,dmg,ELE_FIRE); dmg = finalMagicNonSpellAdjustments(player,target,ELE_FIRE,dmg); local message = 163; if (dmg < 0) then message = 167; end return SUBEFFECT_FIRE_DAMAGE,message,dmg; end end;
gpl-3.0
ibm2431/darkstar
scripts/globals/items/piscators_skewer.lua
11
1072
----------------------------------------- -- ID: 5983 -- Item: Piscator's Skewer -- Food Effect: 60 Mins, All Races ----------------------------------------- -- Dexterity 3 -- Vitality 4 -- Defense % 26 Cap 155 ----------------------------------------- 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,3600,5983) end function onEffectGain(target,effect) target:addMod(dsp.mod.DEX, 3) target:addMod(dsp.mod.VIT, 4) target:addMod(dsp.mod.FOOD_DEFP, 26) target:addMod(dsp.mod.FOOD_DEF_CAP, 155) end function onEffectLose(target, effect) target:delMod(dsp.mod.DEX, 3) target:delMod(dsp.mod.VIT, 4) target:delMod(dsp.mod.FOOD_DEFP, 26) target:delMod(dsp.mod.FOOD_DEF_CAP, 155) end
gpl-3.0
bittorf/luci
applications/luci-app-asterisk/luasrc/model/cbi/asterisk-mod-codec.lua
68
1959
-- 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. cbimap = Map("asterisk", "asterisk", "") module = cbimap:section(TypedSection, "module", "Modules", "") module.anonymous = true codec_a_mu = module:option(ListValue, "codec_a_mu", "A-law and Mulaw direct Coder/Decoder", "") codec_a_mu:value("yes", "Load") codec_a_mu:value("no", "Do Not Load") codec_a_mu:value("auto", "Load as Required") codec_a_mu.rmempty = true codec_adpcm = module:option(ListValue, "codec_adpcm", "Adaptive Differential PCM Coder/Decoder", "") codec_adpcm:value("yes", "Load") codec_adpcm:value("no", "Do Not Load") codec_adpcm:value("auto", "Load as Required") codec_adpcm.rmempty = true codec_alaw = module:option(ListValue, "codec_alaw", "A-law Coder/Decoder", "") codec_alaw:value("yes", "Load") codec_alaw:value("no", "Do Not Load") codec_alaw:value("auto", "Load as Required") codec_alaw.rmempty = true codec_g726 = module:option(ListValue, "codec_g726", "ITU G.726-32kbps G726 Transcoder", "") codec_g726:value("yes", "Load") codec_g726:value("no", "Do Not Load") codec_g726:value("auto", "Load as Required") codec_g726.rmempty = true codec_gsm = module:option(ListValue, "codec_gsm", "GSM/PCM16 (signed linear) Codec Translation", "") codec_gsm:value("yes", "Load") codec_gsm:value("no", "Do Not Load") codec_gsm:value("auto", "Load as Required") codec_gsm.rmempty = true codec_speex = module:option(ListValue, "codec_speex", "Speex/PCM16 (signed linear) Codec Translator", "") codec_speex:value("yes", "Load") codec_speex:value("no", "Do Not Load") codec_speex:value("auto", "Load as Required") codec_speex.rmempty = true codec_ulaw = module:option(ListValue, "codec_ulaw", "Mu-law Coder/Decoder", "") codec_ulaw:value("yes", "Load") codec_ulaw:value("no", "Do Not Load") codec_ulaw:value("auto", "Load as Required") codec_ulaw.rmempty = true return cbimap
apache-2.0
naclander/tome
game/modules/tome/data/texts/intro-halfling.lua
3
1790
-- 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 return [[Welcome #LIGHT_GREEN#@name@#WHITE#. You are a Halfling of Derth. Most people take Halflings for peaceful crop-growers that never leave the borders of their gardens. Yet history has taught that Halflings are a force to be reckoned with. They still maintain a powerful army. You have chosen a rare path for yourself: the path of adventuring, whose loneliness does not usually fit your people. Inspired by the stories of dragons, gold, and the treasures to be found in ancient ruins, you have decided to venture into the old and wild places of the world, looking for fame and glory. You have come to a land called the Derthfields on the western border of the Thaloren forest, in search of the Trollmire. It is an old forest infested with trolls and all kinds of wild animals. To the west lies another dangerous place: the old ruins of Kor'Pul. You heard the caves below it were infested by vermin and undead. After days of travel, you have found the forest and entered it. What will you find there...? ]]
gpl-3.0
greasydeal/darkstar
scripts/zones/Southern_San_dOria/npcs/Coderiant.lua
36
1471
----------------------------------- -- Area: Southern San d'Oria -- NPC: Coderiant -- General Info NPC -- @zone 230 -- @pos -111 -2 33 ------------------------------------- package.loaded["scripts/zones/Southern_San_dOria/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Southern_San_dOria/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- "Flyers for Regine" conditional script FlyerForRegine = player:getQuestStatus(SANDORIA,FLYERS_FOR_REGINE); if (FlyerForRegine == 1) then count = trade:getItemCount(); MagicFlyer = trade:hasItemQty(532,1); if (MagicFlyer == true and count == 1) then player:messageSpecial(FLYER_REFUSED); end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x247); 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/FeiYin/npcs/HomePoint#2.lua
12
1171
----------------------------------- -- Area: FeiYin -- NPC: HomePoint#2 -- @pos 102 0 269 204 ----------------------------------- package.loaded["scripts/zones/FeiYin/TextIDs"] = nil; require("scripts/globals/settings"); require("scripts/zones/FeiYin/TextIDs"); require("scripts/globals/homepoint"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) homepointMenu( player, 0x21fd, 94); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) --printf("CSID: %u",csid); --printf("RESULT: %u",option); if(csid == 0x21fd) then if (option == 1) then player:setHomePoint(); player:messageSpecial(HOMEPOINT_SET); else hpTeleport( player, option); end end end;
gpl-3.0
naclander/tome
game/modules/tome/data/gfx/particles/healing_vapour.lua
3
1473
-- 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 = 32 return { generator = function() local ad = rng.range(0, 360) local a = math.rad(ad) local dir = math.rad(ad + 90) local r = rng.range(1, 20) local dirv = math.rad(1) return { trail = 1, life = 10, size = 1, sizev = 0.5, sizea = 0, x = r * math.cos(a), xv = -0.1, xa = 0, y = r * math.sin(a), yv = -0.1, ya = 0, dir = math.rad(rng.range(0, 360)), dirv = 0, dira = 0, vel = 0.1, velv = 0, vela = 0, r = rng.range(220, 255)/255, rv = 0, ra = 0, g = rng.range(200, 230)/255, gv = 0, ga = 0, b = 0, bv = 0, ba = 0, a = rng.range(25, 220)/255, av = 0, aa = 0, } end, }, function(self) self.ps:emit(4) end, 40, "particle_torus"
gpl-3.0
ibm2431/darkstar
scripts/zones/Stellar_Fulcrum/Zone.lua
9
1365
----------------------------------- -- -- Zone: Stellar_Fulcrum -- ----------------------------------- local ID = require("scripts/zones/Stellar_Fulcrum/IDs") require("scripts/globals/conquest") require("scripts/globals/missions") ----------------------------------- function onInitialize(zone) zone:registerRegion(1, -522, -2, -49, -517, -1, -43); -- To Upper Delkfutt's Tower zone:registerRegion(2, 318, -3, 2, 322, 1, 6); -- Exit BCNM to ? end; function onConquestUpdate(zone, updatetype) dsp.conq.onConquestUpdate(zone, updatetype) end; function onZoneIn(player,prevZone) local cs = -1; if (player:getCurrentMission(ZILART) == dsp.mission.id.zilart.RETURN_TO_DELKFUTTS_TOWER and player:getCharVar("ZilartStatus") == 2) then cs = 0; end return cs; end; function onRegionEnter(player,region) switch (region:GetRegionID()): caseof { [1] = function (x) player:startEvent(8); end, [2] = function (x) player:startEvent(8); end, } end; function onRegionLeave(player,region) end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 8 and option == 1) then player:setPos(-370, -178, -40, 243, 158); elseif (csid == 0) then player:setCharVar("ZilartStatus",3); end end;
gpl-3.0
sthesing/.textadept
modules/debugger/lua/init.lua
1
10994
-- Copyright 2007-2022 Mitchell. See LICENSE. local M = {} --[[ This comment is for LuaDoc. --- -- Language debugging support for Lua. -- Requires LuaSocket to be installed for the external Lua interpreter invoked. -- This module bundles a copy of LuaSocket for use with Textadept and its version of Lua, -- which may not match the external Lua interpreter's version. -- @field logging (boolean) -- Whether or not to enable logging. Log messages are printed to stdout. -- @field show_ENV (boolean) -- Whether or not to show _ENV in the variable list. -- The default value is `false`. -- @field max_value_length (number) -- The rough maximum length of variable values displayed in the variable list. -- The default value is `100`. module('debugger.lua')]] M.logging = false M.show_ENV = false M.max_value_length = 100 local debugger = require('debugger') local orig_path, orig_cpath = package.path, package.cpath package.path = table.concat({ _HOME .. '/modules/debugger/lua/?.lua', _USERHOME .. '/modules/debugger/lua/?.lua', package.path }, ';') local so = not WIN32 and 'so' or 'dll' package.cpath = table.concat({ _HOME .. '/modules/debugger/lua/?.' .. so, _USERHOME .. '/modules/debugger/lua/?.' .. so, package.cpath }, ';') local mobdebug = require('mobdebug') local socket = require('socket') package.path, package.cpath = orig_path, orig_cpath package.loaded['socket'], package.loaded['socket.core'] = nil, nil -- clear local server, client, proc -- Invokes MobDebug to perform a debugger action, and then executes the given callback function -- with the results. -- Since communication happens over sockets, and since socket reads are non-blocking in order -- to keep Textadept responsive, use some coroutine and timeout tricks to keep MobDebug happy. -- @param action String MobDebug action to perform. -- @param callback Callback function to invoke when the action returns a result. Results are -- passed to that function. local function handle(action, callback) -- The client uses non-blocking reads. However, MobDebug expects data when it calls -- `client:receive()`. This will not happen if there is no data to read. In order to have -- `client:receive()` always return data (whenever it becomes available), the mobdebug -- call needs to be wrapped in a coroutine and `client:receive()` needs to be a coroutine -- yield. Then when data becomes available, `coroutine.resume(data)` will pass data to MobDebug. local co = coroutine.create(mobdebug.handle) local co_client = {send = function(_, ...) client:send(...) end, receive = coroutine.yield} local options = { -- MobDebug stdout handler. handler = function(output) local orig_view = view ui.print(output:find('\r?\n$') and output:match('^(.+)\r?\n') or output) if view ~= orig_view then ui.goto_view(orig_view) end end } local results = {coroutine.resume(co, action, co_client, options)} -- print(coroutine.status(co), table.unpack(results)) if coroutine.status(co) == 'suspended' then timeout(0.05, function() local arg = results[3] -- results = {true, client, arg} local data, err = client:receive(arg) -- print('textadept', data, err) if not data and err == 'timeout' then return true end -- keep waiting results = {coroutine.resume(co, data, err)} -- print(coroutine.status(co), table.unpack(results)) if coroutine.status(co) == 'suspended' then return true end -- more reads if callback then callback(table.unpack(results, 2)) end end) end end -- Current stack from MobDebug -- @class table -- @name stack local stack -- Expressions to watch in the variables list. -- @class table -- @name watches local watches -- Computes current debugger state. -- @param level Level to get the state of. 1 is for the current function, 2 for the caller, -- etc. The default value is 1. local function get_state(level) if not client then return nil end -- Fetch stack frames. client:settimeout(nil) stack = mobdebug.handle('stack', client) client:settimeout(0) if not stack then return nil end -- debugger started, but not running yet stack.pos = math.max(1, math.min(#stack, level or 1)) -- Lookup frame. local frame = stack[stack.pos][1] local file, line = frame[2], frame[4] -- Lookup stack frames. local call_stack = {} for _, frame in ipairs(stack) do frame = frame[1] call_stack[#call_stack + 1] = string.format('(%s) %s:%d', frame[1] or frame[5], frame[2], frame[4]) end call_stack.pos = stack.pos -- Lookup variables (index 2) and upvalues (index 3) from the current frame. local variables = {} for i = 2, 3 do for k, v in pairs(stack[call_stack.pos][i]) do if k == '_ENV' and not M.show_ENV then goto continue end variables[k] = mobdebug.line(v[1], {maxlength = M.max_value_length}) ::continue:: end end -- Lookup watches if possible. for _, expr in pairs(watches) do if stack.pos == 1 then client:settimeout(nil) variables[expr] = mobdebug.handle('eval ' .. expr, client) or 'nil' client:settimeout(0) else variables[expr] = '<unable to evaluate>' end end -- Return debugger state. return {file = file, line = line, call_stack = call_stack, variables = variables} end -- Helper function to update debugger state if possible. -- @param level Passed to `get_state()`. local function update_state(level) local state = get_state(level) if state then debugger.update_state(state) end end -- Handles continue, stop over, step into, and step out of events, and updates the debugger state. -- @param action MobDebug action to run. One of 'run', 'step', 'over', or 'out'. local function handle_continuation(action) handle(action, function(file, line) if not file or not line then debugger.stop('lua') return end local state = get_state() state.file, state.line = file, line -- override just to be safe debugger.update_state(state) end) end -- Starts the Lua debugger. -- Launches the given script or current script in a separate process, and connects it back -- to Textadept. -- If the given script is '-', listens for an incoming connection for up to 5 seconds by default. -- The external script should call `require('mobdebug').start()` to connect to Textadept. events.connect(events.DEBUGGER_START, function(lang, filename, args, timeout) if lang ~= 'lua' then return end if not filename then filename = buffer.filename end if not server then server = socket.bind('*', mobdebug.port) server:settimeout(timeout or 5) end if filename ~= '-' then local arg = { string.format([[-e "package.path = package.path .. ';%s;%s'"]], _HOME .. '/modules/debugger/lua/?.lua', _USERHOME .. '/modules/debugger/lua/?.lua'), [[-e "require('mobdebug').start()"]], string.format('%q', filename), args } local cmd = textadept.run.run_commands.lua:gsub('([\'"]?)%%f%1', table.concat(arg, ' ')) proc = assert(os.spawn(cmd, filename:match('^.+[/\\]'), ui.print, ui.print)) end client = assert(server:accept(), 'failed to establish debug connection') client:settimeout(0) -- non-blocking reads handle('output stdout r') watches = {} return true -- a debugger was started for this language end) -- Handle Lua debugger continuation commands. events.connect(events.DEBUGGER_CONTINUE, function(lang) if lang == 'lua' then handle_continuation('run') end end) events.connect(events.DEBUGGER_STEP_INTO, function(lang) if lang == 'lua' then handle_continuation('step') end end) events.connect(events.DEBUGGER_STEP_OVER, function(lang) if lang == 'lua' then handle_continuation('over') end end) events.connect(events.DEBUGGER_STEP_OUT, function(lang) if lang == 'lua' then handle_continuation('out') end end) -- Note: events.DEBUGGER_PAUSE not supported. events.connect(events.DEBUGGER_RESTART, function(lang) if lang == 'lua' then handle_continuation('reload') end end) -- Stops the Lua debugger. events.connect(events.DEBUGGER_STOP, function(lang) if lang ~= 'lua' then return end mobdebug.handle('exit', client) client:close() client = nil if proc and proc:status() ~= 'terminated' then proc:kill() end proc = nil server:close() server = nil stack, watches = nil, nil end) -- Add and remove breakpoints and watches. events.connect(events.DEBUGGER_BREAKPOINT_ADDED, function(lang, file, line) if lang == 'lua' then handle(string.format('setb %s %d', file, line)) end end) events.connect(events.DEBUGGER_BREAKPOINT_REMOVED, function(lang, file, line) if lang == 'lua' then handle(string.format('delb %s %d', file, line)) end end) events.connect(events.DEBUGGER_WATCH_ADDED, function(lang, expr, id, no_break) if lang ~= 'lua' then return end handle('setw ' .. expr, function() update_state() -- add watch to variables list if no_break then handle('delw ' .. id) end -- eat the ID end) watches[id] = expr end) events.connect(events.DEBUGGER_WATCH_REMOVED, function(lang, expr, id) if lang ~= 'lua' then return end handle('delw ' .. id, update_state) -- then remove watch from variables list watches[id] = nil end) -- Set the current stack frame. events.connect(events.DEBUGGER_SET_FRAME, function(lang, level) if lang ~= 'lua' then return end update_state(level) end) -- Inspect the value of a symbol/variable at a given position. events.connect(events.DEBUGGER_INSPECT, function(lang, pos) if lang ~= 'lua' then return end -- At this time, MobDebug cannot evaluate expressions at a non-current stack level using a -- non-coroutine (i.e. socket) interface. if stack.pos > 1 then return end if buffer:name_of_style(buffer.style_at[pos]) ~= 'identifier' then return end local s = buffer:position_from_line(buffer:line_from_position(pos)) local e = buffer:word_end_position(pos, true) local line_part = buffer:text_range(s, e) local symbol = line_part:match('[%w_%.]+$') handle('eval ' .. symbol, function(value) if not value then value = 'nil' end local lines = {} repeat if #lines >= 19 then lines[#lines + 1] = value:sub(1, 111) .. ' ... more' break -- too big to show in a calltip end lines[#lines + 1] = value:sub(1, 120) value = value:sub(121) until #value == 0 value = table.concat(lines, '\n') view:call_tip_show(pos, string.format('%s = %s', symbol, value)) end) end) -- Evaluate an arbitrary expression. events.connect(events.DEBUGGER_COMMAND, function(lang, text) if lang ~= 'lua' then return end if stack.pos > 1 then -- At this time, MobDebug cannot evaluate expressions at a non-current stack level using a -- non-coroutine (i.e. socket) interface. ui.dialogs.msgbox{ title = 'Error Evaluating', informative_text = 'Cannot evaluate in another stack frame.', icon = 'gtk-dialog-error' } return end handle('exec ' .. text, update_state) -- then refresh any variables that changed end) return M
mit
ibm2431/darkstar
scripts/zones/Upper_Jeuno/npcs/Souren.lua
9
1437
----------------------------------- -- Area: Upper Jeuno -- NPC: Souren -- Involved in Quests: Save the Clock Tower -- !pos -51 0 4 244 ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); ----------------------------------- function onTrade(player,npc,trade) if (trade:hasItemQty(555,1) == true and trade:getItemCount() == 1) then local a = player:getCharVar("saveTheClockTowerNPCz1"); -- NPC Part1 if (a == 0 or (a ~= 16 and a ~= 17 and a ~= 18 and a ~= 20 and a ~= 24 and a ~= 19 and a ~= 28 and a ~= 21 and a ~= 26 and a ~= 22 and a ~= 25 and a ~= 23 and a ~= 27 and a ~= 29 and a ~= 30 and a ~= 31)) then player:startEvent(182,10 - player:getCharVar("saveTheClockTowerVar")); -- "Save the Clock Tower" Quest end end end; function onTrigger(player,npc) if (player:getQuestStatus(JEUNO,dsp.quest.id.jeuno.SAVE_THE_CLOCK_TOWER) == QUEST_ACCEPTED) then player:startEvent(120); elseif (player:getQuestStatus(JEUNO,dsp.quest.id.jeuno.SAVE_THE_CLOCK_TOWER) == QUEST_COMPLETED) then player:startEvent(181); else player:startEvent(88); end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 182) then player:addCharVar("saveTheClockTowerVar", 1); player:addCharVar("saveTheClockTowerNPCz1", 16); end end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Hall_of_Transference/npcs/_0e4.lua
43
1699
----------------------------------- -- Area: Hall of Transference -- NPC: Large Apparatus (Right) - Holla -- @pos -242.301 -1.849 269.867 14 ----------------------------------- package.loaded["scripts/zones/Hall_of_Transference/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Hall_of_Transference/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:getVar("HollaChipRegistration") == 0 and player:getVar("skyShortcut") == 1 and trade:hasItemQty(478,1) and trade:getItemCount() == 1) then player:tradeComplete(); player:startEvent(0x00A6); end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:getVar("HollaChipRegistration") == 1) then player:messageSpecial(NO_RESPONSE_OFFSET+6); -- Device seems to be functioning correctly. else player:startEvent(0x00A5); -- Hexagonal Cones 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 == 0x00A6) then player:messageSpecial(NO_RESPONSE_OFFSET+4,478); -- You fit.. player:messageSpecial(NO_RESPONSE_OFFSET+5); -- Device has been repaired player:setVar("HollaChipRegistration",1); end end;
gpl-3.0
LegionXI/darkstar
scripts/zones/Norg/npcs/Spasija.lua
14
1027
---------------------------------- -- Area: Norg -- NPC: Spasija -- Type: Item Deliverer -- @zone 252 -- @pos -82.896 -5.414 55.271 -- ----------------------------------- package.loaded["scripts/zones/Norg/TextIDs"] = nil; require("scripts/zones/Norg/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc, SPASIJA_DELIVERY_DIALOG); player:openSendBox(); 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/globals/items/plate_of_beef_paella_+1.lua
12
1482
----------------------------------------- -- ID: 5973 -- Item: Plate of Beef Paella +1 -- Food Effect: 4 Hrs, All Races ----------------------------------------- -- HP 45 -- Strength 6 -- Attack % 19 Cap 95 -- Undead Killer 6 ----------------------------------------- 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,5973); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 45); target:addMod(MOD_STR, 6); target:addMod(MOD_FOOD_ATTP, 19); target:addMod(MOD_FOOD_ATT_CAP, 95); target:addMod(MOD_UNDEAD_KILLER, 6); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 45); target:delMod(MOD_STR, 6); target:delMod(MOD_FOOD_ATTP, 19); target:delMod(MOD_FOOD_ATT_CAP, 95); target:delMod(MOD_UNDEAD_KILLER, 6); end;
gpl-3.0
naclander/tome
game/thirdparty/moonscript/util.lua
5
2390
module("moonscript.util", package.seeall) moon = { is_object = function(value) return type(value) == "table" and value.__class end, type = function(value) base_type = type(value) if base_type == "table" then cls = value.__class if cls then return cls end end return base_type end } function pos_to_line(str, pos) local line = 1 for _ in str:sub(1, pos):gmatch("\n") do line = line + 1 end return line end function get_closest_line(str, line_num) local line = get_line(str, line_num) if (not line or trim(line) == "") and line_num > 1 then return get_closest_line(str, line_num - 1) end return line, line_num end function get_line(str, line_num) for line in str:gmatch("(.-)[\n$]") do if line_num == 1 then return line end line_num = line_num - 1 end end -- shallow copy function clone(tbl) local out = {} for k,v in pairs(tbl) do out[k] = v end return out end function map(tbl, fn) local out = {} for i,v in ipairs(tbl) do out[i] = fn(v) end return out end function every(tbl, fn) for i=1,#tbl do local pass if fn then pass = fn(tbl[i]) else pass = tbl[i] end if not pass then return false end end return true end function bind(obj, name) return function(...) return obj[name](obj, ...) end end function itwos(seq) n = 2 return coroutine.wrap(function() for i = 1, #seq-n+1 do coroutine.yield(i, seq[i], i+1, seq[i+1]) end end) end function reversed(seq) return coroutine.wrap(function() for i=#seq,1,-1 do coroutine.yield(i, seq[i]) end end) end function dump(what) local seen = {} local function _dump(what, depth) depth = depth or 0 local t = type(what) if t == "string" then return '"'..what..'"\n' elseif t == "table" then if seen[what] then return "recursion("..tostring(what)..")...\n" end seen[what] = true depth = depth + 1 out = "{\n" for k,v in pairs(what) do out = out..(" "):rep(depth*4).."["..tostring(k).."] = ".._dump(v, depth) end seen[what] = false return out .. (" "):rep((depth-1)*4) .. "}\n" else return tostring(what).."\n" end end return _dump(what) end function split(str, delim) if str == "" then return {} end str = str..delim local out = {} for m in str:gmatch("(.-)"..delim) do table.insert(out, m) end return out end function trim(str) return str:match("^%s*(.-)%s*$") end
gpl-3.0
alerque/sile
classes/book.lua
1
8199
local plain = require("classes.plain") local class = pl.class(plain) class._name = "book" class.defaultFrameset = { content = { left = "8.3%pw", right = "86%pw", top = "11.6%ph", bottom = "top(footnotes)" }, folio = { left = "left(content)", right = "right(content)", top = "bottom(footnotes)+3%ph", bottom = "bottom(footnotes)+5%ph" }, runningHead = { left = "left(content)", right = "right(content)", top = "top(content)-8%ph", bottom = "top(content)-3%ph" }, footnotes = { left = "left(content)", right = "right(content)", height = "0", bottom = "83.3%ph" } } function class:_init (options) plain._init(self, options) self:loadPackage("counters") self:loadPackage("masters", {{ id = "right", firstContentFrame = self.firstContentFrame, frames = self.defaultFrameset }}) self:loadPackage("twoside", { oddPageMaster = "right", evenPageMaster = "left" }) self:loadPackage("tableofcontents") self:loadPackage("footnotes", { insertInto = "footnotes", stealFrom = { "content" } }) if not SILE.scratch.headers then SILE.scratch.headers = {} end end function class:endPage () if not SILE.scratch.headers.skipthispage then if self:oddPage() and SILE.scratch.headers.right then SILE.typesetNaturally(SILE.getFrame("runningHead"), function () SILE.settings:toplevelState() SILE.settings:set("current.parindent", SILE.nodefactory.glue()) SILE.settings:set("document.lskip", SILE.nodefactory.glue()) SILE.settings:set("document.rskip", SILE.nodefactory.glue()) -- SILE.settings:set("typesetter.parfillskip", SILE.nodefactory.glue()) SILE.process(SILE.scratch.headers.right) SILE.call("par") end) elseif not self:oddPage() and SILE.scratch.headers.left then SILE.typesetNaturally(SILE.getFrame("runningHead"), function () SILE.settings:toplevelState() SILE.settings:set("current.parindent", SILE.nodefactory.glue()) SILE.settings:set("document.lskip", SILE.nodefactory.glue()) SILE.settings:set("document.rskip", SILE.nodefactory.glue()) -- SILE.settings:set("typesetter.parfillskip", SILE.nodefactory.glue()) SILE.process(SILE.scratch.headers.left) SILE.call("par") end) end end SILE.scratch.headers.skipthispage = false return plain.endPage(self) end function class:finish () local ret = plain.finish(self) return ret end function class:registerCommands () plain.registerCommands(self) self:registerCommand("left-running-head", function (_, content) local closure = SILE.settings:wrap() SILE.scratch.headers.left = function () closure(content) end end, "Text to appear on the top of the left page") self:registerCommand("right-running-head", function (_, content) local closure = SILE.settings:wrap() SILE.scratch.headers.right = function () closure(content) end end, "Text to appear on the top of the right page") self:registerCommand("book:sectioning", function (options, content) local level = SU.required(options, "level", "book:sectioning") local number if SU.boolean(options.numbering, true) then SILE.call("increment-multilevel-counter", { id = "sectioning", level = level }) number = self.packages.counters:formatMultilevelCounter(self:getMultilevelCounter("sectioning")) end if SU.boolean(options.toc, true) then SILE.call("tocentry", { level = level, number = number }, SU.subContent(content)) end if SU.boolean(options.numbering, true) then if options.msg then SILE.call("fluent", { number = number }, { options.msg }) else SILE.call("show-multilevel-counter", { id = "sectioning" }) end end end) self:registerCommand("book:chapter:post", function (_, _) SILE.call("par") end) self:registerCommand("book:section:post", function (_, _) SILE.process({ " " }) end) self:registerCommand("book:subsection:post", function (_, _) SILE.process({ " " }) end) self:registerCommand("book:left-running-head-font", function (_, content) SILE.call("font", { size = "9pt" }, content) end) self:registerCommand("book:right-running-head-font", function (_, content) SILE.call("font", { size = "9pt", style = "Italic" }, content) end) self:registerCommand("chapter", function (options, content) SILE.typesetter:leaveHmode() SILE.call("open-spread", { double = false }) SILE.call("noindent") SILE.scratch.headers.right = nil SILE.call("set-counter", { id = "footnote", value = 1 }) SILE.call("book:chapterfont", {}, function () SILE.call("book:sectioning", { numbering = options.numbering, toc = options.toc, level = 1, msg = "book-chapter-title" }, content) end) local lang = SILE.settings:get("document.language") local postcmd = "book:chapter:post" if SILE.Commands[postcmd .. ":" .. lang] then postcmd = postcmd .. ":" .. lang end SILE.call(postcmd) SILE.call("book:chapterfont", {}, content) SILE.call("left-running-head", {}, function () SILE.settings:temporarily(function () SILE.call("book:left-running-head-font", {}, content) end) end) SILE.call("bigskip") SILE.call("nofoliothispage") end, "Begin a new chapter") self:registerCommand("section", function (options, content) SILE.typesetter:leaveHmode() SILE.call("goodbreak") SILE.call("bigskip") SILE.call("noindent") SILE.call("book:sectionfont", {}, function () SILE.call("book:sectioning", { numbering = options.numbering, toc = options.toc, level = 2 }, content) local lang = SILE.settings:get("document.language") local postcmd = "book:section:post" if SILE.Commands[postcmd .. ":" .. lang] then postcmd = postcmd .. ":" .. lang end SILE.call(postcmd) SILE.process(content) end) if not SILE.scratch.counters.folio.off then SILE.call("right-running-head", {}, function () SILE.call("book:right-running-head-font", {}, function () SILE.call("rightalign", {}, function () SILE.settings:temporarily(function () if SU.boolean(options.numbering, true) then SILE.call("show-multilevel-counter", { id = "sectioning", level = 2 }) SILE.typesetter:typeset(" ") end SILE.process(content) end) end) end) end) end SILE.call("novbreak") SILE.call("bigskip") SILE.call("novbreak") SILE.typesetter:inhibitLeading() end, "Begin a new section") self:registerCommand("subsection", function (options, content) SILE.typesetter:leaveHmode() SILE.call("goodbreak") SILE.call("noindent") SILE.call("medskip") SILE.call("book:subsectionfont", {}, function () SILE.call("book:sectioning", { numbering = options.numbering, toc = options.toc, level = 3 }, content) local lang = SILE.settings:get("document.language") local postcmd = "book:subsection:post" if SILE.Commands[postcmd .. ":" .. lang] then postcmd = postcmd .. ":" .. lang end SILE.call(postcmd) SILE.process(content) end) SILE.typesetter:leaveHmode() SILE.call("novbreak") SILE.call("medskip") SILE.call("novbreak") SILE.typesetter:inhibitLeading() end, "Begin a new subsection") self:registerCommand("book:chapterfont", function (_, content) SILE.settings:temporarily(function () SILE.call("font", { weight = 800, size = "22pt" }, content) end) end) self:registerCommand("book:sectionfont", function (_, content) SILE.settings:temporarily(function () SILE.call("font", { weight = 800, size = "15pt" }, content) end) end) self:registerCommand("book:subsectionfont", function (_, content) SILE.settings:temporarily(function () SILE.call("font", { weight = 800, size = "12pt" }, content) end) end) end return class
mit
icyxp/kong
spec/01-unit/008-api_helpers_spec.lua
12
2395
local api_helpers = require "kong.api.api_helpers" local norm = api_helpers.normalize_nested_params describe("api_helpers", function() describe("normalize_nested_params()", function() it("renders table from dot notation", function() assert.same({ foo = "bar", number = 10, config = { nested = 1, nested_2 = 2 } }, norm { foo = "bar", number = 10, ["config.nested"] = 1, ["config.nested_2"] = 2 }) assert.same({ foo = 'bar', number = 10, config = { nested = { ["sub-nested"] = "hi" }, nested_1 = 1, nested_2 = 2 } }, norm { foo = "bar", number = 10, ["config.nested_1"] = 1, ["config.nested_2"] = 2, ["config.nested.sub-nested"] = "hi" }) end) it("integer indexes arrays with integer strings", function() assert.same({ foo = 'bar', number = 10, config = { nested = {"hello", "world"}, } }, norm { foo = "bar", number = 10, ["config.nested"] = {["1"]="hello", ["2"]="world"} }) end) it("complete use case", function() assert.same({ api_id = 123, name = "request-transformer", config = { add = { form = "new-form-param:some_value, another-form-param:some_value", headers = "x-new-header:some_value, x-another-header:some_value", querystring = "new-param:some_value, another-param:some_value" }, remove = { form = "formparam-toremove", headers = "x-toremove, x-another-one", querystring = "param-toremove, param-another-one" } } }, norm { api_id = 123, name = "request-transformer", ["config.add.headers"] = "x-new-header:some_value, x-another-header:some_value", ["config.add.querystring"] = "new-param:some_value, another-param:some_value", ["config.add.form"] = "new-form-param:some_value, another-form-param:some_value", ["config.remove.headers"] = "x-toremove, x-another-one", ["config.remove.querystring"] = "param-toremove, param-another-one", ["config.remove.form"] = "formparam-toremove" }) end) end) end)
apache-2.0
ibm2431/darkstar
scripts/zones/Waughroon_Shrine/bcnms/shattering_stars.lua
9
1634
----------------------------------- -- Shattering Stars -- Waughroon Shrine Maat battlefield -- !pos -345 104 -260 144 ----------------------------------- require("scripts/globals/battlefield") require("scripts/globals/npc_util") 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() player:startEvent(32001, battlefield:getArea(), clearTime, partySize, battlefield:getTimeInside(), 1, battlefield:getLocalVar("[cs]bit"), 0) 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 local pjob = player:getMainJob() local maatsCap = player:getCharVar("maatsCap") if player:getQuestStatus(JEUNO, dsp.quest.id.jeuno.SHATTERING_STARS) == QUEST_ACCEPTED then npcUtil.giveItem(player, 4181) end player:setCharVar("maatDefeated", pjob) if bit.band(maatsCap, bit.lshift(1, pjob - 1)) ~= 1 then player:setCharVar("maatsCap", bit.bor(maatsCap, bit.lshift(1, pjob - 1))) end player:addTitle(dsp.title.MAAT_MASHER) end end
gpl-3.0
greasydeal/darkstar
scripts/zones/Upper_Jeuno/npcs/Ilumida.lua
17
5044
----------------------------------- -- Area: Upper Jeuno -- NPC: Ilumida -- Starts and Finishes Quest: A Candlelight Vigil -- @pos -75 -1 58 244 ----------------------------------- package.loaded["scripts/zones/Upper_Jeuno/TextIDs"] = nil; package.loaded["scripts/globals/settings"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/titles"); require("scripts/globals/shop"); require("scripts/globals/quests"); require("scripts/zones/Upper_Jeuno/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local aCandlelightVigil = player:getQuestStatus(JEUNO,A_CANDLELIGHT_VIGIL); local SearchingForWords = player:getQuestStatus(JEUNO,SEARCHING_FOR_THE_RIGHT_WORDS); --this variable implicitly stores: JFame >= 7 and ACandlelightVigil == QUEST_COMPLETED and RubbishDay == QUEST_COMPLETED and --NeverToReturn == QUEST_COMPLETED and SearchingForTheRightWords == QUEST_AVAILABLE and prereq CS complete local SearchingForWords_prereq = player:getVar("QuestSearchRightWords_prereq"); if (player:getFameLevel(JEUNO) >= 4 and aCandlelightVigil == QUEST_AVAILABLE) then player:startEvent(0x00c0); --Start quest : Ilumida asks you to obtain a candle ... elseif (aCandlelightVigil == QUEST_ACCEPTED) then if (player:hasKeyItem(HOLY_CANDLE) == true) then player:startEvent(0x00c2); --Finish quest : CS NOT FOUND. else player:startEvent(0x00bf); --quest accepted dialog end elseif (player:getVar("QuestACandlelightVigil_denied") == 1) then player:startEvent(0x00c1); --quest denied dialog, asks again for A Candlelight Vigil elseif (SearchingForWords_prereq == 1) then --has player completed prerequisite cutscene with Kurou-Morou? player:startEvent(0x00c5); --SearchingForTheRightWords intro CS elseif (player:getVar("QuestSearchRightWords_denied") == 1) then player:startEvent(0x00c9); --asks player again, SearchingForTheRightWords accept/deny elseif (SearchingForWords == QUEST_ACCEPTED) then if (player:hasKeyItem(MOONDROP) == true) then player:startEvent(0x00c6); else player:startEvent(0x00c7); -- SearchingForTheRightWords quest accepted dialog end elseif (player:getVar("SearchingForRightWords_postcs") == -1) then player:startEvent(0x00c4); elseif(SearchingForWords == QUEST_COMPLETED) then player:startEvent(0x00c8); else player:startEvent(0x00BD); --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 == 0x00c0 and option == 1) or (csid == 0x00c1 and option == 1)) then --just start quest player:addQuest(JEUNO,A_CANDLELIGHT_VIGIL); player:setVar("QuestACandlelightVigil_denied", 0); elseif(csid == 0x00c0 and option == 0) then --quest denied, special eventIDs available player:setVar("QuestACandlelightVigil_denied", 1); elseif(csid == 0x00c2) then --finish quest if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,13094); else player:addTitle(ACTIVIST_FOR_KINDNESS); player:delKeyItem(HOLY_CANDLE); player:addItem(13094); player:messageSpecial(ITEM_OBTAINED,13094); player:needToZone(true); player:addFame(JEUNO, JEUNO_FAME*30); player:completeQuest(JEUNO,A_CANDLELIGHT_VIGIL); end elseif(csid == 0x00c5 and option == 0) then --quest denied, special eventIDs available player:setVar("QuestSearchRightWords_prereq", 0); --remove charVar from memory player:setVar("QuestSearchRightWords_denied", 1); elseif((csid == 0x00c5 and option == 1) or (csid == 0x00c9 and option == 1)) then player:setVar("QuestSearchRightWords_prereq", 0); --remove charVar from memory player:setVar("QuestSearchRightWords_denied", 0); player:addQuest(JEUNO,SEARCHING_FOR_THE_RIGHT_WORDS); elseif(csid == 0x00c6) then --finish quest, note: no title granted if (player:getFreeSlotsCount() == 0) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED,4882); else player:delKeyItem(MOONDROP); player:messageSpecial(GIL_OBTAINED, GIL_RATE*3000) player:addItem(4882); player:messageSpecial(ITEM_OBTAINED,4882); player:addFame(JEUNO, JEUNO_FAME*30); player:completeQuest(JEUNO,SEARCHING_FOR_THE_RIGHT_WORDS); player:setVar("SearchingForRightWords_postcs", -2); end elseif(csid == 0x00c4) then player:setVar("SearchingForRightWords_postcs", 0); end end;
gpl-3.0
Guard13007/ThompsonWasAClone
src/levels.lua
1
3123
local LightWorld = require "lib.LightWorld" require "lightWorldRectangleFix" local Object = {} Object.__index = Object function Object.new(x, y, w, h) local self = { x = x, y = y, w = w, h = h, shadow = lightWorldRectangleFix(lightWorld, x, y, w, h) } return self end level = { function() lightWorld = LightWorld({ drawBackground = drawBackground, drawForground = drawForeground, ambient = {80, 80, 100} --previously 60,60,60 }) lightWorld.blur = 0 bgColor = {35, 65, 85} lights = { lightWorld:newLight(love.graphics.getWidth() / 2 - 35, love.graphics.getHeight() / 2, 255, 150, 100, 650) } --x,y,r,g,b,radius thompson = { color = {255, 0, 0}, x = 30, y = love.graphics.getHeight() - 73 -15 - 27, --15 above bottom, 27 is because height of thompson w = 17, h = 27, v = {0, 0} } thompson.shadow = lightWorldRectangleFix(lightWorld, thompson.x, thompson.y, thompson.w, thompson.h) thompson.fixShadowPosition = function() thompson.shadow.x = thompson.x + thompson.w / 2 thompson.shadow.y = thompson.y + thompson.h / 2 thompson.shadow.data = { thompson.x, thompson.y, thompson.x + thompson.w, thompson.y, thompson.x + thompson.w, thompson.y + thompson.h, thompson.x, thompson.y + thompson.h } end objects = { Object.new(0, 0, love.graphics.getWidth(), 15), Object.new(0, 0, 15, love.graphics.getHeight()), Object.new(0, love.graphics.getHeight() - 15, love.graphics.getWidth(), 15), Object.new(love.graphics.getWidth() - 15, 0, 15, love.graphics.getHeight()), Object.new(100, love.graphics.getHeight() - 60 - 50, 50, 50), Object.new(420, love.graphics.getHeight() - 170 - 50, 50, 50), Object.new(431, love.graphics.getHeight() - 33 - 50, 49, 49), Object.new(276, love.graphics.getHeight() - 85 - 50, 51, 51), Object.new(27, love.graphics.getHeight() - 167 - 50, 47, 47), Object.new(677, love.graphics.getHeight() - 81 - 50, 52, 52), Object.new(628, love.graphics.getHeight() - 107 - 50, 49, 49), Object.new(597, love.graphics.getHeight() - 223 - 50, 46, 46), Object.new(311, love.graphics.getHeight() - 272 - 50, 53, 53), Object.new(700, 68, 50, 50), Object.new(140, 129, 47, 47), Object.new(503, 83, 53, 53), --remember we have 770x370 to work with (minus 30 because of walls) --[[lightWorldRectangleFix(lightWorld, x, y, w, h), lightWorldRectangleFix(lightWorld, x, y, w, h), lightWorldRectangleFix(lightWorld, x, y, w, h), lightWorldRectangleFix(lightWorld, x, y, w, h), lightWorldRectangleFix(lightWorld, x, y, w, h), lightWorldRectangleFix(lightWorld, x, y, w, h), lightWorldRectangleFix(lightWorld, x, y, w, h), lightWorldRectangleFix(lightWorld, x, y, w, h),]] } goal = { x = 711, y = 40, w = thompson.w + 2, h = thompson.h + 2 } goal.collider = { x = goal.x + goal.w / 2 - 1.5, y = goal.y + goal.h / 2 - 1.5, w = 3, h = 3 } --[[goal = lightWorldRectangleFix(lightWorld, 700, 20, thompson.w + 2, thompson.h + 2) goal.glowStrength = 5 for k,v in pairs(goal) do print(k.."="..tostring(v)) end]] end, }
mit
greasydeal/darkstar
scripts/zones/Oldton_Movalpolos/npcs/Treasure_Chest.lua
12
3003
----------------------------------- -- Area: Oldton Movalpolos -- NPC: Treasure Chest -- @zone 11 ----------------------------------- package.loaded["scripts/zones/Oldton_Movalpolos/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/keyitems"); require("scripts/globals/treasure"); require("scripts/zones/Oldton_Movalpolos/TextIDs"); local TreasureType = "Chest"; local TreasureLvL = 43; local TreasureMinLvL = 33; ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) -- trade:hasItemQty(1062,1); -- Treasure Key -- trade:hasItemQty(1115,1); -- Skeleton Key -- trade:hasItemQty(1023,1); -- Living Key -- trade:hasItemQty(1022,1); -- Thief's Tools local questItemNeeded = 0; -- Player traded a key. if((trade:hasItemQty(1062,1) or trade:hasItemQty(1115,1) or trade:hasItemQty(1023,1) or trade:hasItemQty(1022,1)) and trade:getItemCount() == 1) then local zone = player:getZoneID(); -- IMPORTANT ITEM: Map ----------- if(player:hasKeyItem(MAP_OF_OLDTON_MOVALPOLOS) == false) then questItemNeeded = 1; end -------------------------------------- local pack = openChance(player,npc,trade,TreasureType,TreasureLvL,TreasureMinLvL,questItemNeeded); local success = 0; if(pack[2] ~= nil) then player:messageSpecial(pack[2]); success = pack[1]; else success = pack[1]; end if(success ~= -2) then player:tradeComplete(); if(math.random() <= success) then -- Succeded to open the coffer player:messageSpecial(CHEST_UNLOCKED); if(questItemNeeded == 1) then player:addKeyItem(MAP_OF_OLDTON_MOVALPOLOS); player:messageSpecial(KEYITEM_OBTAINED,MAP_OF_OLDTON_MOVALPOLOS); -- Map of Oldton Movalpolos else player:setVar("["..zone.."]".."Treasure_"..TreasureType,os.time() + math.random(CHEST_MIN_ILLUSION_TIME,CHEST_MAX_ILLUSION_TIME)); local loot = chestLoot(zone,npc); -- print("loot array: "); -- debug -- print("[1]", loot[1]); -- debug -- print("[2]", loot[2]); -- debug if(loot[1]=="gil") then player:addGil(loot[2]*GIL_RATE); player:messageSpecial(GIL_OBTAINED,loot[2]*GIL_RATE); else -- Item player:addItem(loot[2]); player:messageSpecial(ITEM_OBTAINED,loot[2]); end end UpdateTreasureSpawnPoint(npc:getID()); end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:messageSpecial(CHEST_LOCKED,1062); 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/globals/items/agaricus_mushroom.lua
12
1160
----------------------------------------- -- ID: 5680 -- Item: agaricus mushroom -- Food Effect: 5 Min, All Races ----------------------------------------- -- STR -4 -- MND +2 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD)) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,5680); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_STR, -4) target:addMod(MOD_MND, 2) end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_STR, -4) target:delMod(MOD_MND, 2) end;
gpl-3.0
greasydeal/darkstar
scripts/zones/South_Gustaberg/npcs/qm2.lua
11
2570
----------------------------------- -- Area: South Gustaberg -- NPC: ??? -- Involved in Quest: Smoke on the Mountain -- @pos 461 -21 -580 107 ----------------------------------- package.loaded["scripts/zones/South_Gustaberg/TextIDs"] = nil; ----------------------------------- require("scripts/zones/South_Gustaberg/TextIDs"); require("scripts/globals/quests"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) if (player:needToZone() == false) then player:setVar("SGusta_Sausage_Timer", 0); end local SmokeOnTheMountain = player:getQuestStatus(BASTOK,SMOKE_ON_THE_MOUNTAIN); if(SmokeOnTheMountain == QUEST_ACCEPTED) then if(trade:hasItemQty(4372,1) and trade:getItemCount() == 1) then if (player:getVar("SGusta_Sausage_Timer") == 0) then -- player puts sheep meat on the fire player:messageSpecial(FIRE_PUT, 4372); player:tradeComplete(); player:setVar("SGusta_Sausage_Timer", os.time() + 3456); -- 57 minutes 36 seconds, 1 Vana'diel Day player:needToZone(true); else -- message given if sheep meat is already on the fire player:messageSpecial(MEAT_ALREADY_PUT, 4372) end end end end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:needToZone() == false) then player:setVar("SGusta_Sausage_Timer", 0); end local SmokeOnTheMountain = player:getQuestStatus(BASTOK,SMOKE_ON_THE_MOUNTAIN); local sausageTimer = player:getVar("SGusta_Sausage_Timer"); if (SmokeOnTheMountain ~= QUEST_AVAILABLE and sausageTimer ~= 0) then if (sausageTimer >= os.time()) then player:messageSpecial(FIRE_LONGER, 4372); elseif (player:getFreeSlotsCount() < 1) then player:messageSpecial(ITEM_CANNOT_BE_OBTAINED, 4395); elseif (sausageTimer < os.time()) then player:setVar("SGusta_Sausage_Timer", 0); player:messageSpecial(FIRE_TAKE, 4395); player:addItem(4395); end elseif (SmokeOnTheMountain ~= QUEST_AVAILABLE and sausageTimer == 0) then player:messageSpecial(FIRE_GOOD); else player:messageSpecial(NOTHING_OUT_OF_ORDINARY); end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/EventDispatcher.lua
10
6285
-------------------------------- -- @module EventDispatcher -- @extend Ref -- @parent_module cc -------------------------------- -- Pauses all listeners which are associated the specified target.<br> -- param target A given target node.<br> -- param recursive True if pause recursively, the default value is false. -- @function [parent=#EventDispatcher] pauseEventListenersForTarget -- @param self -- @param #cc.Node target -- @param #bool recursive -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Adds a event listener for a specified event with the priority of scene graph.<br> -- param listener The listener of a specified event.<br> -- param node The priority of the listener is based on the draw order of this node.<br> -- note The priority of scene graph will be fixed value 0. So the order of listener item<br> -- in the vector will be ' <0, scene graph (0 priority), >0'. -- @function [parent=#EventDispatcher] addEventListenerWithSceneGraphPriority -- @param self -- @param #cc.EventListener listener -- @param #cc.Node node -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Whether to enable dispatching events.<br> -- param isEnabled True if enable dispatching events. -- @function [parent=#EventDispatcher] setEnabled -- @param self -- @param #bool isEnabled -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Adds a event listener for a specified event with the fixed priority.<br> -- param listener The listener of a specified event.<br> -- param fixedPriority The fixed priority of the listener.<br> -- note A lower priority will be called before the ones that have a higher value.<br> -- 0 priority is forbidden for fixed priority since it's used for scene graph based priority. -- @function [parent=#EventDispatcher] addEventListenerWithFixedPriority -- @param self -- @param #cc.EventListener listener -- @param #int fixedPriority -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Remove a listener.<br> -- param listener The specified event listener which needs to be removed. -- @function [parent=#EventDispatcher] removeEventListener -- @param self -- @param #cc.EventListener listener -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Resumes all listeners which are associated the specified target.<br> -- param target A given target node.<br> -- param recursive True if resume recursively, the default value is false. -- @function [parent=#EventDispatcher] resumeEventListenersForTarget -- @param self -- @param #cc.Node target -- @param #bool recursive -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Removes all listeners which are associated with the specified target.<br> -- param target A given target node.<br> -- param recursive True if remove recursively, the default value is false. -- @function [parent=#EventDispatcher] removeEventListenersForTarget -- @param self -- @param #cc.Node target -- @param #bool recursive -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Sets listener's priority with fixed value.<br> -- param listener A given listener.<br> -- param fixedPriority The fixed priority value. -- @function [parent=#EventDispatcher] setPriority -- @param self -- @param #cc.EventListener listener -- @param #int fixedPriority -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Adds a Custom event listener.<br> -- It will use a fixed priority of 1.<br> -- param eventName A given name of the event.<br> -- param callback A given callback method that associated the event name.<br> -- return the generated event. Needed in order to remove the event from the dispather -- @function [parent=#EventDispatcher] addCustomEventListener -- @param self -- @param #string eventName -- @param #function callback -- @return EventListenerCustom#EventListenerCustom ret (return value: cc.EventListenerCustom) -------------------------------- -- Dispatches the event.<br> -- Also removes all EventListeners marked for deletion from the<br> -- event dispatcher list.<br> -- param event The event needs to be dispatched. -- @function [parent=#EventDispatcher] dispatchEvent -- @param self -- @param #cc.Event event -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Removes all listeners. -- @function [parent=#EventDispatcher] removeAllEventListeners -- @param self -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Removes all custom listeners with the same event name.<br> -- param customEventName A given event listener name which needs to be removed. -- @function [parent=#EventDispatcher] removeCustomEventListeners -- @param self -- @param #string customEventName -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Checks whether dispatching events is enabled.<br> -- return True if dispatching events is enabled. -- @function [parent=#EventDispatcher] isEnabled -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- Removes all listeners with the same event listener type.<br> -- param listenerType A given event listener type which needs to be removed. -- @function [parent=#EventDispatcher] removeEventListenersForType -- @param self -- @param #int listenerType -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) -------------------------------- -- Constructor of EventDispatcher. -- @function [parent=#EventDispatcher] EventDispatcher -- @param self -- @return EventDispatcher#EventDispatcher self (return value: cc.EventDispatcher) return nil
mit
LegionXI/darkstar
scripts/zones/Windurst_Woods/npcs/Retto-Marutto.lua
27
1193
----------------------------------- -- Area: Windurst Woods -- NPC: Retto-Marutto -- Guild Merchant NPC: Bonecrafting Guild -- @pos -6.142 -6.55 -132.639 241 ----------------------------------- package.loaded["scripts/zones/Windurst_Woods/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/shop"); require("scripts/zones/Windurst_Woods/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) if (player:sendGuild(5142,8,23,3)) then player:showText(npc,RETTO_MARUTTO_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); end;
gpl-3.0
ibm2431/darkstar
scripts/zones/Port_Windurst/npcs/Fennella.lua
12
2208
----------------------------------- -- Area: Port Windurst -- NPC: Fennella -- Type: Guildworker's Union Representative -- !pos -177.811 -2.835 65.639 240 ----------------------------------- require("scripts/globals/keyitems"); require("scripts/globals/crafting"); local ID = require("scripts/zones/Port_Windurst/IDs"); local keyitems = { [0] = { id = dsp.ki.FROG_FISHING, rank = 3, cost = 30000 }, [1] = { id = dsp.ki.SERPENT_RUMORS, rank = 8, cost = 95000 }, [2] = { id = dsp.ki.MOOCHING, rank = 9, cost = 115000 }, [3] = { id = dsp.ki.ANGLERS_ALMANAC, rank = 9, cost = 20000 } }; local items = { [0] = { id = 17002, -- Robber's Rig rank = 3, cost = 1500 }, [1] = { id = 15452, -- Fisherman's Belt rank = 4, cost = 10000 }, [2] = { id = 14195, -- Pair of Waders rank = 5, cost = 70000 }, [3] = { id = 14400, -- Fisherman's Apron rank = 7, cost = 100000 }, [4] = { id = 191, -- Fishing hole map rank = 9, cost = 150000 }, [5] = { id = 340, -- Fisherman's Signboard rank = 9, cost = 200000 }, [6] = { id = 3670, -- Fish and Lure rank = 7, cost = 50000 }, [7] = { id = 3330, -- Fishermen's Emblem rank = 9, cost = 15000 } }; function onTrade(player,npc,trade) unionRepresentativeTrade(player, npc, trade, 10021, 0); end; function onTrigger(player,npc) unionRepresentativeTrigger(player, 0, 10020, "guild_fishing", keyitems); end; function onEventUpdate(player,csid,option,target) if (csid == 10020) then unionRepresentativeTriggerFinish(player, option, target, 0, "guild_Fishing", keyitems, items); end end; function onEventFinish(player,csid,option,target) if (csid == 10020) then unionRepresentativeTriggerFinish(player, option, target, 0, "guild_Fishing", keyitems, items); elseif (csid == 10021) then player:messageSpecial(ID.text.GP_OBTAINED, option); end end;
gpl-3.0
ibm2431/darkstar
scripts/globals/spells/dokumori_san.lua
12
1441
----------------------------------------- -- Spell: Dokumori: San ----------------------------------------- require("scripts/globals/status") require("scripts/globals/magic") require("scripts/globals/msg") ----------------------------------------- function onMagicCastingCheck(caster,target,spell) return 0 end function onSpellCast(caster,target,spell) local effect = dsp.effect.POISON -- Base Stats local dINT = (caster:getStat(dsp.mod.INT) - target:getStat(dsp.mod.INT)) --Duration Calculation local duration = 360 local params = {} params.attribute = dsp.mod.INT params.skillType = dsp.skill.NINJUTSU params.bonus = 0 duration = duration * applyResistance(caster, target, spell, params) local power = 20 --Calculates resist chanve from Reist Blind if (target:hasStatusEffect(effect)) then spell:setMsg(dsp.msg.basic.MAGIC_NO_EFFECT) -- no effect return effect end if (math.random(0,100) >= target:getMod(dsp.mod.POISONRES)) then if (duration >= 120) then if (target:addStatusEffect(effect,power,3,duration)) then spell:setMsg(dsp.msg.basic.MAGIC_ENFEEB_IS) else spell:setMsg(dsp.msg.basic.MAGIC_NO_EFFECT) end else spell:setMsg(dsp.msg.basic.MAGIC_RESIST) end else spell:setMsg(dsp.msg.basic.MAGIC_RESIST_2) end return effect end
gpl-3.0
howard0su/cslua
tests/calls.lua
3
6998
print("testing functions and calls") local debug = require "debug" -- get the opportunity to test 'type' too ;) assert(type(1<2) == 'boolean') assert(type(true) == 'boolean' and type(false) == 'boolean') assert(type(nil) == 'nil' and type(-3) == 'number' and type'x' == 'string' and type{} == 'table' and type(type) == 'function') assert(type(assert) == type(print)) f = nil function f (x) return a:x (x) end assert(type(f) == 'function') -- testing local-function recursion fact = false do local res = 1 local function fact (n) if n==0 then return res else return n*fact(n-1) end end assert(fact(5) == 120) end assert(fact == false) -- testing declarations a = {i = 10} self = 20 function a:x (x) return x+self.i end function a.y (x) return x+self end assert(a:x(1)+10 == a.y(1)) a.t = {i=-100} a["t"].x = function (self, a,b) return self.i+a+b end assert(a.t:x(2,3) == -95) do local a = {x=0} function a:add (x) self.x, a.y = self.x+x, 20; return self end assert(a:add(10):add(20):add(30).x == 60 and a.y == 20) end local a = {b={c={}}} function a.b.c.f1 (x) return x+1 end function a.b.c:f2 (x,y) self[x] = y end assert(a.b.c.f1(4) == 5) a.b.c:f2('k', 12); assert(a.b.c.k == 12) print('+') t = nil -- 'declare' t function f(a,b,c) local d = 'a'; t={a,b,c,d} end f( -- this line change must be valid 1,2) assert(t[1] == 1 and t[2] == 2 and t[3] == nil and t[4] == 'a') f(1,2, -- this one too 3,4) assert(t[1] == 1 and t[2] == 2 and t[3] == 3 and t[4] == 'a') function fat(x) if x <= 1 then return 1 else return x*load("return fat(" .. x-1 .. ")")() end end assert(load "load 'assert(fat(6)==720)' () ")() a = load('return fat(5), 3') a,b = a() assert(a == 120 and b == 3) print('+') function err_on_n (n) if n==0 then error(); exit(1); else err_on_n (n-1); exit(1); end end do function dummy (n) if n > 0 then assert(not pcall(err_on_n, n)) dummy(n-1) end end end dummy(10) function deep (n) if n>0 then deep(n-1) end end deep(10) deep(200) -- testing tail call function deep (n) if n>0 then return deep(n-1) else return 101 end end assert(deep(30000) == 101) a = {} function a:deep (n) if n>0 then return self:deep(n-1) else return 101 end end assert(a:deep(30000) == 101) print('+') a = nil (function (x) a=x end)(23) assert(a == 23 and (function (x) return x*2 end)(20) == 40) -- testing closures -- fixed-point operator Z = function (le) local function a (f) return le(function (x) return f(f)(x) end) end return a(a) end -- non-recursive factorial F = function (f) return function (n) if n == 0 then return 1 else return n*f(n-1) end end end fat = Z(F) assert(fat(0) == 1 and fat(4) == 24 and Z(F)(5)==5*Z(F)(4)) local function g (z) local function f (a,b,c,d) return function (x,y) return a+b+c+d+a+x+y+z end end return f(z,z+1,z+2,z+3) end f = g(10) assert(f(9, 16) == 10+11+12+13+10+9+16+10) Z, F, f = nil print('+') -- testing multiple returns function unlpack (t, i) i = i or 1 if (i <= #t) then return t[i], unlpack(t, i+1) end end function equaltab (t1, t2) assert(#t1 == #t2) for i = 1, #t1 do assert(t1[i] == t2[i]) end end local pack = function (...) return (table.pack(...)) end function f() return 1,2,30,4 end function ret2 (a,b) return a,b end local a,b,c,d = unlpack{1,2,3} assert(a==1 and b==2 and c==3 and d==nil) a = {1,2,3,4,false,10,'alo',false,assert} equaltab(pack(unlpack(a)), a) equaltab(pack(unlpack(a), -1), {1,-1}) a,b,c,d = ret2(f()), ret2(f()) assert(a==1 and b==1 and c==2 and d==nil) a,b,c,d = unlpack(pack(ret2(f()), ret2(f()))) assert(a==1 and b==1 and c==2 and d==nil) a,b,c,d = unlpack(pack(ret2(f()), (ret2(f())))) assert(a==1 and b==1 and c==nil and d==nil) a = ret2{ unlpack{1,2,3}, unlpack{3,2,1}, unlpack{"a", "b"}} assert(a[1] == 1 and a[2] == 3 and a[3] == "a" and a[4] == "b") -- testing calls with 'incorrect' arguments rawget({}, "x", 1) rawset({}, "x", 1, 2) assert(math.sin(1,2) == math.sin(1)) table.sort({10,9,8,4,19,23,0,0}, function (a,b) return a<b end, "extra arg") -- test for generic load local x = "-- a comment\0\0\0\n x = 10 + \n23; \ local a = function () x = 'hi' end; \ return '\0'" function read1 (x) local i = 0 return function () collectgarbage() i=i+1 return string.sub(x, i, i) end end function cannotload (msg, a,b) assert(not a and string.find(b, msg)) end a = assert(load(read1(x), "modname", "t", _G)) assert(a() == "\0" and _G.x == 33) assert(debug.getinfo(a).source == "modname") -- cannot read text in binary mode cannotload("attempt to load a text chunk", load(read1(x), "modname", "b", {})) cannotload("attempt to load a text chunk", load(x, "modname", "b")) a = assert(load(function () return nil end)) a() -- empty chunk assert(not load(function () return true end)) -- small bug local t = {nil, "return ", "3"} f, msg = load(function () return table.remove(t, 1) end) assert(f() == nil) -- should read the empty chunk -- another small bug (in 5.2.1) f = load(string.dump(function () return 1 end), nil, "b", {}) assert(type(f) == "function" and f() == 1) x = string.dump(load("x = 1; return x")) a = assert(load(read1(x), nil, "b")) assert(a() == 1 and _G.x == 1) cannotload("attempt to load a binary chunk", load(read1(x), nil, "t")) cannotload("attempt to load a binary chunk", load(x, nil, "t")) assert(not pcall(string.dump, print)) -- no dump of C functions cannotload("unexpected symbol", load(read1("*a = 123"))) cannotload("unexpected symbol", load("*a = 123")) cannotload("hhi", load(function () error("hhi") end)) -- any value is valid for _ENV assert(load("return _ENV", nil, nil, 123)() == 123) -- load when _ENV is not first upvalue local x; XX = 123 local function h () local y=x -- use 'x', so that it becomes 1st upvalue return XX -- global name end local d = string.dump(h) x = load(d, "", "b") assert(debug.getupvalue(x, 2) == '_ENV') debug.setupvalue(x, 2, _G) assert(x() == 123) assert(assert(load("return XX + ...", nil, nil, {XX = 13}))(4) == 17) -- test generic load with nested functions x = [[ return function (x) return function (y) return function (z) return x+y+z end end end ]] a = assert(load(read1(x))) assert(a()(2)(3)(10) == 15) -- test for dump/undump with upvalues local a, b = 20, 30 x = load(string.dump(function (x) if x == "set" then a = 10+b; b = b+1 else return a end end)) assert(x() == nil) assert(debug.setupvalue(x, 1, "hi") == "a") assert(x() == "hi") assert(debug.setupvalue(x, 2, 13) == "b") assert(not debug.setupvalue(x, 3, 10)) -- only 2 upvalues x("set") assert(x() == 23) x("set") assert(x() == 24) -- test for bug in parameter adjustment assert((function () return nil end)(4) == nil) assert((function () local a; return a end)(4) == nil) assert((function (a) return a end)() == nil) print('OK') return deep
bsd-2-clause
greasydeal/darkstar
scripts/zones/Xarcabard/npcs/qm7.lua
8
1339
----------------------------------- -- Area: Xarcabard -- NPC: qm7 (???) -- Involved in Quests: RNG AF3 quest - Unbridled Passion -- @pos -295.065 -25.054 151.250 112 ----------------------------------- package.loaded["scripts/zones/Xarcabard/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/quests"); require("scripts/zones/Xarcabard/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) local UnbridledPassionCS = player:getVar("unbridledPassion"); if(UnbridledPassionCS == 4) then player:startEvent(0x0008); 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 == 0x0008) then SpawnMob(17236205,240):updateClaim(player); end end;
gpl-3.0
greasydeal/darkstar
scripts/commands/addeffect.lua
24
1711
--------------------------------------------------------------------------------------------------- -- func: addeffect -- desc: Adds the given effect to the given player. --------------------------------------------------------------------------------------------------- cmdprops = { permission = 1, parameters = "siii" }; function onTrigger(player, target, id, power, duration) -- Ensure a target is set.. if (target == nil) then player:PrintToPlayer( "Target required; cannot be nil." ); return; end local effectTarget = player; -- check if target name was entered local num = tonumber(target) if (type(num) == "number") then if (power == 0 or power == nil) then duration = 60; else duration = power; end if (id == 0 or id == nil) then power = 1; else power = id; end id = num else local pc = GetPlayerByName(target); if (pc ~= nil) then effectTarget = pc; else return; end if (power == nil) then power = 1; end if (duration == nil) then duration = 60; end if (id == 0 or id == nil) then id = 1; end end if (id == nil) then player:PrintToPlayer( "Effect id cannot be nil." ); return; end if (effectTarget:addStatusEffect(id, power, 3, duration)) then effectTarget:messagePublic(280, effectTarget, id, id); else effectTarget:messagePublic(283, effectTarget, id); end end
gpl-3.0
naclander/tome
game/engines/default/modules/boot/data/general/grids/water.lua
3
1380
-- 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 ------------------------------------------------------------ -- For outside ------------------------------------------------------------ newEntity{ define_as = "WATER_BASE", type = "floor", subtype = "water", name = "deep water", image = "terrain/water_floor.png", display = '~', color=colors.AQUAMARINE, back_color=colors.DARK_BLUE, always_remember = true, air_level = -5, air_condition="water", } ----------------------------------------- -- Water/grass ----------------------------------------- newEntity{ base="WATER_BASE", define_as = "DEEP_WATER", image="terrain/water_grass_5_1.png", }
gpl-3.0
Igalia/snabbswitch
src/lib/hash/murmur.lua
15
6965
-- Use of this source code is governed by the Apache 2.0 license; see COPYING. -- Implementation of the MurmurHash3 hash function according to the -- reference implementation -- https://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp -- -- This implementation does not include the variant MurmurMash3_x86_128. -- -- Note that these hash functions are dependent on the endianness of -- the system. The self-test as used here will only pass on -- little-endian machines. -- -- All hash functions take an optional value as seed. module(..., package.seeall) local ffi = require("ffi") local bit = require("bit") local base_hash = require("lib.hash.base") local bor, band, bxor, rshift, lshift = bit.bor, bit.band, bit.bxor, bit.rshift, bit.lshift -- Perform performance test in selftest() if set to true local perf_enable = false local murmur = {} local uint8_ptr_t = ffi.typeof("uint8_t*") local uint32_ptr_t = ffi.typeof("uint32_t*") local uint64_ptr_t = ffi.typeof("uint64_t*") do murmur.MurmurHash3_x86_32 = subClass(base_hash) local MurmurHash3_x86_32 = murmur.MurmurHash3_x86_32 MurmurHash3_x86_32._name = 'MurmurHash3_x86_32' MurmurHash3_x86_32._size = 32 local c1 = 0xcc9e2d51ULL local c2 = 0x1b873593ULL local c3 = 0x85ebca6bULL local c4 = 0xc2b2ae35ULL local c5 = 0xe6546b64ULL local max32 = 0xffffffffULL local tail = ffi.new("uint32_t[1]") function MurmurHash3_x86_32:hash (data, length, seed) local nblocks = rshift(length, 2) local h1 = (seed and seed + 0ULL) or 0ULL local data = ffi.cast(uint8_ptr_t, data) if nblocks > 0 then for i = 0, nblocks-1 do local k1 = ffi.cast(uint32_ptr_t, data)[i] k1 = band(k1*c1, max32) k1 = bxor(lshift(k1, 15), rshift(k1, 17)) k1 = band(k1*c2, max32) h1 = bxor(h1, k1) h1 = bxor(lshift(h1, 13), rshift(h1, 19)) h1 = band(h1*5 + c5, max32) end end local l = band(length, 3) if l > 0 then local k1 = 0ULL tail[0] = ffi.cast(uint32_ptr_t, data + lshift(nblocks, 2))[0] k1 = band(tail[0], rshift(0x00FFFFFF, (3-l)*8)) k1 = band(k1*c1, max32) k1 = bxor(lshift(k1, 15), rshift(k1, 17)) k1 = band(k1*c2, max32) h1 = bxor(h1, k1) end h1 = bxor(h1, length+0ULL) h1 = bxor(h1, rshift(h1, 16)) h1 = band(h1*c3, max32) h1 = bxor(h1, rshift(h1, 13)) h1 = band(h1*c4, max32) h1 = bxor(h1, rshift(h1, 16)) self.h.u32[0] = band(h1, max32) return self.h end end do murmur.MurmurHash3_x64_128 = subClass(base_hash) local MurmurHash3_x64_128 = murmur.MurmurHash3_x64_128 MurmurHash3_x64_128._name = 'MurmurHash3_x64_128' MurmurHash3_x64_128._size = 128 local c1 = 0x87c37b91114253d5ULL local c2 = 0x4cf5ad432745937fULL local c3 = 0xff51afd7ed558ccdULL local c4 = 0xc4ceb9fe1a85ec53ULL local c5 = 0x52dce729ULL local c6 = 0x38495ab5ULL local taill = ffi.new("uint64_t[1]") local tailh = ffi.new("uint64_t[1]") local masks = {} for i = 1, 15 do masks[i] = rshift(0xFFFFFFFFFFFFFFFFULL, band(16-i, 7)*8) end function MurmurHash3_x64_128:hash (data, length, seed) local nblocks = rshift(length, 4) local h1 = (seed and seed+0ULL) or 0ULL local h2 = h1 local data = ffi.cast(uint8_ptr_t, data) if nblocks > 0 then for i = 0, nblocks - 1 do local k1 = ffi.cast(uint64_ptr_t, data)[i*2]*c1 k1 = bxor(lshift(k1, 31), rshift(k1, 33)) k1 = k1*c2 h1 = bxor(h1, k1) h1 = bxor(lshift(h1, 27), rshift(h1, 37)) h1 = h1 + h2 h1 = h1*5ULL + c5 local k2 = ffi.cast(uint64_ptr_t, data)[i*2+1]*c2 k2 = bxor(lshift(k2, 33), rshift(k2, 31)) k2 = k2*c1 h2 = bxor(h2, k2) h2 = bxor(lshift(h2, 31), rshift(h2, 33)) h2 = h2 + h1 h2 = h2*5ULL + c6 end end data = data + lshift(nblocks, 4) local l = band(length, 15) if l > 8 then local k2 = 0ULL tailh[0] = ffi.cast(uint64_ptr_t, data+8)[0] k2 = band(tailh[0], masks[l]) k2 = k2*c2 k2 = bxor(lshift(k2, 33), rshift(k2, 31)) k2 = k2*c1 h2 = bxor(h2, k2) l = 8 end if l > 0 then local k1 = 0ULL taill[0] = ffi.cast(uint64_ptr_t, data)[0] k1 = band(taill[0], masks[l]) k1 = k1*c1 k1 = bxor(lshift(k1, 31), rshift(k1, 33)) k1 = k1*c2 h1 = bxor(h1, k1) end h1 = bxor(h1, length+0ULL) h2 = bxor(h2, length+0ULL) h1 = h1+h2 h2 = h2+h1 -- fmix(h1) h1 = bxor(h1, rshift(h1, 33))*c3 h1 = bxor(h1, rshift(h1, 33))*c4 h1 = bxor(h1, rshift(h1, 33)) -- fmix(h2) h2 = bxor(h2, rshift(h2, 33))*c3 h2 = bxor(h2, rshift(h2, 33))*c4 h2 = bxor(h2, rshift(h2, 33)) h1 = h1+h2 h2 = h2+h1 self.h.u64[0] = h1 self.h.u64[1] = h2 return self.h end end local function selftest_hash (hash, expected, perf) local hash = hash:new() local bytes = hash:size()/8 local key = ffi.new("uint8_t [256]") local hashes = ffi.new("uint8_t[?]", bytes*256) local seed = ffi.new("uint64_t") print("Sleftest hash "..hash:name()) for i = 0, 255 do key[i] = i seed = 256-i hash:hash(key, i, seed) ffi.copy(hashes+i*bytes, hash.h, bytes) end local check = hash:hash(hashes, ffi.sizeof(hashes)).u32[0] if check == expected then print("Passed") else error("Failed, expected 0x"..bit.tohex(expected)..", got 0x"..bit.tohex(check)) end if perf_enable and perf then print("Performance test with data blocks from "..(perf.min or 1).." to " ..perf.max.." bytes (iterations per second)") assert(perf.max < 1024) local v = ffi.new("uint8_t[1024]") for j = perf.min or 1, perf.max do jit.flush() local start = ffi.C.get_time_ns() for i = 1, perf.iter do hash:hash(v, j, 0) end local stop = ffi.C.get_time_ns() local iter_rate = perf.iter/(tonumber(stop-start)/1e9) print(j, math.floor(iter_rate)) assert(iter_rate >= perf.expect, string.format("Performance test failed " .."for %d byte blocks, " .."expected at least %d " .." iterations per second, " .."got %d", j, perf.expect, iter_rate)) end print("Passed") end end function selftest() selftest_hash(murmur.MurmurHash3_x86_32, 0xB0F57EE3, { max = 8, iter = 1e7, expect = 1e7 }) selftest_hash(murmur.MurmurHash3_x64_128, 0x6384BA69, { max = 32, iter = 1e7, expect = 4*1e7 }) end murmur.selftest = selftest return murmur
apache-2.0
ibm2431/darkstar
scripts/zones/Windurst_Waters/npcs/Chomoro-Kyotoro.lua
9
1200
----------------------------------- -- Area: Windurst Waters -- NPC: Chomoro-Kyotoro -- Involved in Quest: Making the Grade -- !pos 133 -5 167 238 ----------------------------------- require("scripts/globals/quests"); require("scripts/globals/keyitems"); require("scripts/globals/settings"); ----------------------------------- function onTrade(player,npc,trade) end; function onTrigger(player,npc) -- needs check for dsp.ki.TATTERED_TEST_SHEET then sets to var 3 if (player:getQuestStatus(WINDURST,dsp.quest.id.windurst.MAKING_THE_GRADE) == QUEST_ACCEPTED) then local prog = player:getCharVar("QuestMakingTheGrade_prog"); if (prog == 0) then player:startEvent(454); elseif (prog == 1) then player:startEvent(457); elseif (prog == 2) then player:startEvent(460); else player:startEvent(461); end else player:startEvent(432); end end; function onEventUpdate(player,csid,option) end; function onEventFinish(player,csid,option) if (csid == 460) then player:setCharVar("QuestMakingTheGrade_prog",3); player:delKeyItem(dsp.ki.TATTERED_TEST_SHEET); end end;
gpl-3.0
naclander/tome
game/modules/tome/class/WorldNPC.lua
1
7882
-- 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" local ActorAI = require "engine.interface.ActorAI" local Faction = require "engine.Faction" local Emote = require("engine.Emote") local Map = require("engine.Map") require "mod.class.Actor" module(..., package.seeall, class.inherit(mod.class.Actor, engine.interface.ActorAI)) function _M:init(t, no_default) if type(t.cant_be_moved) == "nil" then t.cant_be_moved = true end mod.class.Actor.init(self, t, no_default) ActorAI.init(self, t) -- Grab default image name if none is set if not self.image and self.name ~= "unknown actor" then self.image = "npc/"..tostring(self.type or "unknown").."_"..tostring(self.subtype or "unknown"):lower():gsub("[^a-z0-9]", "_").."_"..(self.name or "unknown"):lower():gsub("[^a-z0-9]", "_")..".png" end self.unit_power = self.unit_power or 0 self.max_unit_power = self.max_unit_power or self.unit_power end --- Checks what to do with the target -- Talk ? attack ? displace ? function _M:bumpInto(target, x, y) local reaction = self:reactionToward(target) if reaction < 0 then return self:encounterAttack(target, x, y) elseif reaction >= 0 then -- Talk ? if target.player and self.can_talk then local chat = Chat.new(self.can_talk, self, target) chat:invoke() if self.can_talk_only_once then self.can_talk = nil end elseif target.cant_be_moved and self.cant_be_moved and target.x and target.y and self.x and self.y then -- Displace local tx, ty, sx, sy = target.x, target.y, self.x, self.y target.x = nil target.y = nil self.x = nil self.y = nil target:move(sx, sy, true) self:move(tx, ty, true) end end end function _M:takeHit() return nil, 0 end --- Attach or remove a display callback -- Defines particles to display function _M:defineDisplayCallback() if not self._mo then return end local ps = self:getParticlesList() local f_self = nil local f_danger = nil local f_powerful = nil local f_friend = nil local f_enemy = nil local f_neutral = nil self._mo:displayCallback(function(x, y, w, h, zoom, on_map) -- Tactical info if game.level and game.always_target then -- Tactical life info if on_map then local dh = h * 0.1 local lp = self.unit_power / self.max_unit_power + 0.0001 if lp > .75 then -- green core.display.drawQuad(x + 3, y + h - dh, w - 6, dh, 129, 180, 57, 128) core.display.drawQuad(x + 3, y + h - dh, (w - 6) * lp, dh, 50, 220, 77, 255) elseif lp > .5 then -- yellow core.display.drawQuad(x + 3, y + h - dh, w - 6, dh, 175, 175, 10, 128) core.display.drawQuad(x + 3, y + h - dh, (w - 6) * lp, dh, 240, 252, 35, 255) elseif lp > .25 then -- orange core.display.drawQuad(x + 3, y + h - dh, w - 6, dh, 185, 88, 0, 128) core.display.drawQuad(x + 3, y + h - dh, (w - 6) * lp, dh, 255, 156, 21, 255) else -- red core.display.drawQuad(x + 3, y + h - dh, w - 6, dh, 167, 55, 39, 128) core.display.drawQuad(x + 3, y + h - dh, (w - 6) * lp, dh, 235, 0, 0, 255) end end end -- Tactical info if game.level and game.level.map.view_faction then local map = game.level.map if on_map then if not f_self then f_self = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_self) f_powerful = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_powerful) f_danger = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_danger) f_friend = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_friend) f_enemy = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_enemy) f_neutral = game.level.map.tilesTactic:get(nil, 0,0,0, 0,0,0, map.faction_neutral) end if self.faction then local friend if not map.actor_player then friend = Faction:factionReaction(map.view_faction, self.faction) else friend = map.actor_player:reactionToward(self) end if self == map.actor_player then f_self:toScreen(x, y, w, h) elseif map:faction_danger_check(self) then if friend >= 0 then f_powerful:toScreen(x, y, w, h) else f_danger:toScreen(x, y, w, h) end elseif friend > 0 then f_friend:toScreen(x, y, w, h) elseif friend < 0 then f_enemy:toScreen(x, y, w, h) else f_neutral:toScreen(x, y, w, h) end end end end local e for i = 1, #ps do e = ps[i] e:checkDisplay() if e.ps:isAlive() then e.ps:toScreen(x + w / 2, y + h / 2, true, w / (game.level and game.level.map.tile_w or w)) else self:removeParticles(e) end end return true end) end function _M:takePowerHit(val, src) self.unit_power = (self.unit_power or 0) - val if self.unit_power <= 0 then self.logCombat(src, self, "#Source# kills #Target#.") self:die(src) end end function _M:encounterAttack(target, x, y) if target.player then target:onWorldEncounter(self, self.x, self.y) return end self.unit_power = self.unit_power or 0 target.unit_power = target.unit_power or 0 if self.unit_power > target.unit_power then self.unit_power = self.unit_power - target.unit_power target.unit_power = 0 elseif self.unit_power < target.unit_power then target.unit_power = target.unit_power - self.unit_power self.unit_power = 0 else self.unit_power, target.unit_power = self.unit_power - target.unit_power, target.unit_power - self.unit_power end if self.unit_power <= 0 then self:logCombat(target, "#Target# kills #Source#.") self:die(target) end if target.unit_power <= 0 then self:logCombat(target, "#Source# kills #Target#.") target:die(src) end end function _M:act() while self:enoughEnergy() and not self.dead do -- Do basic actor stuff if not mod.class.Actor.act(self) then return end -- Compute FOV, if needed self:doFOV() -- Let the AI think .... beware of Shub ! -- If AI did nothing, use energy anyway self:doAI() if not self.energy.used then self:useEnergy() end end end function _M:doFOV() self:computeFOV(self.sight or 4, "block_sight", nil, nil, nil, true) end function _M:tooltip(x, y, seen_by) if seen_by and not seen_by:canSee(self) then return end local factcolor, factstate, factlevel = "#ANTIQUE_WHITE#", "neutral", self:reactionToward(game.player) if factlevel < 0 then factcolor, factstate = "#LIGHT_RED#", "hostile" elseif factlevel > 0 then factcolor, factstate = "#LIGHT_GREEN#", "friendly" end local rank, rank_color = self:TextRank() local ts = tstring{} ts:add({"uid",self.uid}) ts:merge(rank_color:toTString()) ts:add(self.name, {"color", "WHITE"}, true) ts:add(self.type:capitalize(), " / ", self.subtype:capitalize(), true) ts:add("Rank: ") ts:merge(rank_color:toTString()) ts:add(rank, {"color", "WHITE"}, true) ts:add(self.desc, true) ts:add("Faction: ") ts:merge(factcolor:toTString()) ts:add(("%s (%s, %d)"):format(Faction.factions[self.faction].name, factstate, factlevel), {"color", "WHITE"}, true) ts:add( ("Killed by you: "):format(killed), true, "Target: ", self.ai_target.actor and self.ai_target.actor.name or "none", true, "UID: "..self.uid ) return ts end function _M:die(src) engine.interface.ActorLife.die(self, src) end
gpl-3.0
rameplayerorg/rameplayer-backend
plugins/ffprobe.lua
1
4112
local json = require 'cjson.safe' local process = require 'cqp.process' local RAME = require 'rame.rame' local Item = require 'rame.item' local url = require 'socket.url' local Plugin = {} -- Media scanning local function ffprobe_file(fn) -- reference: https://ffmpeg.org/ffprobe.html if not fn then return nil end local out = process.popen( "ffprobe", "-probesize", "1000", "-print_format", "json", "-show_entries", "format", "-show_chapters", "-select_streams", "v:0", "-show_streams", fn) local res = out:read_all() out:close() return res end function Plugin.uri_scanner(self) RAME.log.info("Scanning", self.uri) local extract_chapters = true local only_chapter_id = nil if self.parent and self.parent.editable then -- item added to editable playlist, chapter items shouldn't be extracted extract_chapters = false end local fn,chapter_id = RAME.resolve_uri(self.uri) if chapter_id ~= nil then -- Chapter videos (#id= fragment) are expected to be ffprobed only when -- added to a playlist, in which case it's assumed the original entry -- is already available (extracted when main video was ffprobed). -- We find that first & copy the data, and only continue to actual -- ffprobe if the original was not found for some reason. local matching_fn_items = Item.search_all("filename", self.filename) for _,id in ipairs(matching_fn_items) do local i = Item.find(id) if i and i.parent and not i.parent.editable and i.starttime and i.endtime then -- found "original" chapter entry, pick the already extracted metadata -- (no need to re-ffprobe it) self.type = "chapter" self.title = i.title self.starttime = i.starttime self.endtime = i.endtime self.duration = i.duration self:touch() return end end -- didn't find the "original", flag this chapter id to be searched for in ffprobe below only_chapter_id = chapter_id end local data = ffprobe_file(fn) if data == nil then return false end local ff = json.decode(data) if ff == nil then return false end local ff_fmt = ff.format or {} local ff_tags = ff_fmt.tags or {} self.duration = tonumber(ff_fmt.duration) self.title = ff_tags.title if type(ff.streams) == "table" and type(ff.streams[1]) == "table" then self.width = ff.streams[1].width self.height = ff.streams[1].height end local ch_item_pos_id = self.id -- read through chapter info -- (possible TODO: support making of separate folder of chapters?) for _, chff in pairs(ff.chapters or {}) do local start_t = tonumber(chff.start_time) local end_t = tonumber(chff.end_time) local chid = tostring(chff.id) if extract_chapters then -- extract chapter as a new list item local i = Item.new { type = "chapter", title = chff.tags.title, parent = self.parent, chapter_parent_id = self.id, filename = self.filename.." #"..chid, -- postfix filename with chapter index info uri = self.uri.."#id="..chid, -- add fragment id to uri containing chapter index starttime = start_t, endtime = end_t, duration = end_t - start_t, scanned = true } -- for now, chapter items are added flat to same level after original whole media item: self.parent:add(i) i:move_after(ch_item_pos_id) ch_item_pos_id = i.id i:touch() -- also list chapter positions to video file itself self.chapters = self.chapters or {} table.insert(self.chapters, { id = i.id, chapterId = chid, pos = start_t, title = chff.tags.title }) end if only_chapter_id ~= nil and chid == only_chapter_id then self.type = "chapter" self.title = chff.tags.title self.starttime = start_t self.endtime = end_t self.duration = end_t - start_t break -- no need to look at the rest end end self:touch() end function Plugin.early_init() local schemes = {"http","https","file"} local exts = { "wav","mp3","flac","aac","m4a","ogg", "flv","avi","m4v","mkv","mov","mpg","mpeg","mpe","mp4", "ts", "gif", "jpg", "jpeg", "png", "tif", "tiff", } Item.uri_scanners:register(schemes, exts, 10, Plugin.uri_scanner) end return Plugin
gpl-2.0
ibm2431/darkstar
scripts/globals/items/tonosama_rice_ball.lua
11
1150
----------------------------------------- -- ID: 4277 -- Item: Tonosama Rice Ball -- Food Effect: 30Min, All Races ----------------------------------------- -- HP +15 -- Dex +3 -- Vit +3 -- Chr +3 -- Effect with enhancing equipment (Note: these are latents on gear with the effect) -- Atk +50 -- Def +30 -- Double Attack +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,4277) end function onEffectGain(target, effect) target:addMod(dsp.mod.HP, 15) target:addMod(dsp.mod.DEX, 3) target:addMod(dsp.mod.VIT, 3) target:addMod(dsp.mod.CHR, 3) end function onEffectLose(target, effect) target:delMod(dsp.mod.HP, 15) target:delMod(dsp.mod.DEX, 3) target:delMod(dsp.mod.VIT, 3) target:delMod(dsp.mod.CHR, 3) end
gpl-3.0
ricker75/Global-Server
data/movements/scripts/demon oak quest/demonOakTreeEnter.lua
2
1101
function onStepIn(cid, item, position, fromPosition) local player = Player(cid) if not player then return true end if player:getStorageValue(1010) >= 1 then player:teleportTo(DEMON_OAK_KICK_POSITION) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end if player:getLevel() < 120 then player:say("LEAVE LITTLE FISH, YOU ARE NOT WORTH IT!", TALKTYPE_MONSTER_YELL, false, cid, DEMON_OAK_POSITION) player:teleportTo(DEMON_OAK_KICK_POSITION) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) return true end if player:getStorageValue(1014) == 5 and not isPlayerInArea({x = 32706, y = 32345, z = 7, stackpos = 255}, {x = 32725, y = 32357, z = 7, stackpos = 255}) then player:teleportTo(DEMON_OAK_ENTER_POSITION) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) player:setStorageValue(1013, 1) player:say("I AWAITED YOU! COME HERE AND GET YOUR REWARD!", TALKTYPE_MONSTER_YELL, false, cid, DEMON_OAK_POSITION) else player:teleportTo(DEMON_OAK_KICK_POSITION) player:getPosition():sendMagicEffect(CONST_ME_TELEPORT) end return true end
gpl-2.0
naclander/tome
game/modules/tome/data/general/objects/egos/mindstars.lua
1
24785
-- 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 -- TODO: More greater suffix psionic; more lesser suffix and prefix psionic local Stats = require "engine.interface.ActorStats" local Talents = require "engine.interface.ActorTalents" local DamageType = require "engine.DamageType" ------------------------------------------------------- --Nature and Antimagic--------------------------------- ------------------------------------------------------- newEntity{ power_source = {nature=true}, name = "blooming ", prefix=true, instant_resolve=true, keywords = {blooming=true}, level_range = {1, 50}, rarity = 8, cost = 8, wielder = { heal_on_nature_summon = resolvers.mbonus_material(25, 5), healing_factor = resolvers.mbonus_material(20, 10, function(e, v) v=v/100 return 0, v end), }, } newEntity{ power_source = {nature=true}, name = "gifted ", prefix=true, instant_resolve=true, keywords = {gifted=true}, level_range = {1, 50}, rarity = 4, cost = 8, wielder = { combat_mindpower = resolvers.mbonus_material(10, 2), }, } newEntity{ power_source = {nature=true}, name = "nature's ", prefix=true, instant_resolve=true, keywords = {nature=true}, level_range = {1, 50}, rarity = 4, cost = 8, wielder = { inc_damage={ [DamageType.NATURE] = resolvers.mbonus_material(8, 2), }, disease_immune = resolvers.mbonus_material(15, 10, function(e, v) v=v/100 return 0, v end), resists={ [DamageType.BLIGHT] = resolvers.mbonus_material(8, 2), }, }, } newEntity{ power_source = {nature=true}, name = " of balance", suffix=true, instant_resolve=true, keywords = {balance=true}, level_range = {1, 50}, rarity = 4, cost = 8, wielder = { combat_physresist = resolvers.mbonus_material(8, 2), combat_spellresist = resolvers.mbonus_material(8, 2), combat_mentalresist = resolvers.mbonus_material(8, 2), equilibrium_regen_when_hit = resolvers.mbonus_material(20, 5, function(e, v) v=v/10 return 0, v end), }, } newEntity{ power_source = {nature=true}, name = " of life", suffix=true, instant_resolve=true, keywords = {life=true}, level_range = {1, 50}, rarity = 4, cost = 8, wielder = { max_life = resolvers.mbonus_material(40, 10), life_regen = resolvers.mbonus_material(15, 5, function(e, v) v=v/10 return 0, v end), }, } newEntity{ power_source = {antimagic=true}, name = " of slime", suffix=true, instant_resolve=true, keywords = {slime=true}, level_range = {1, 50}, rarity = 8, cost = 8, wielder = { on_melee_hit={ [DamageType.SLIME] = resolvers.mbonus_material(8, 2), }, inc_damage={ [DamageType.NATURE] = resolvers.mbonus_material(8, 2), }, }, } ------------------------------------------------------- --Psionic---------------------------------------------- ------------------------------------------------------- newEntity{ power_source = {psionic=true}, name = "horrifying ", prefix=true, instant_resolve=true, keywords = {horrifying=true}, level_range = {1, 50}, rarity = 4, cost = 8, wielder = { on_melee_hit={ [DamageType.MIND] = resolvers.mbonus_material(8, 2), [DamageType.DARKNESS] = resolvers.mbonus_material(8, 2), }, inc_damage={ [DamageType.MIND] = resolvers.mbonus_material(8, 2), [DamageType.DARKNESS] = resolvers.mbonus_material(8, 2), }, }, } newEntity{ power_source = {psionic=true}, name = "radiant ", prefix=true, instant_resolve=true, keywords = {radiant=true}, level_range = {1, 50}, rarity = 4, cost = 8, combat = { melee_project = { [DamageType.LIGHT] = resolvers.mbonus_material(8, 2), }, }, wielder = { combat_mindpower = resolvers.mbonus_material(4, 1), combat_mindcrit = resolvers.mbonus_material(4, 1), lite = resolvers.mbonus_material(1, 1), }, } newEntity{ power_source = {psionic=true}, name = " of clarity", suffix=true, instant_resolve=true, keywords = {clarity=true}, level_range = {1, 50}, rarity = 8, cost = 8, wielder = { combat_mentalresist = resolvers.mbonus_material(8, 2), max_psi = resolvers.mbonus_material(40, 10), }, } newEntity{ power_source = {psionic=true}, name = "hungering ", prefix=true, instant_resolve=true, keywords = {hungering=true}, level_range = {30, 50}, greater_ego = 1, rarity = 30, cost = 40, wielder = { talents_types_mastery = { ["psionic/voracity"] = resolvers.mbonus_material(1, 1, function(e, v) v=v/10 return 0, v end), ["cursed/dark-sustenance"] = resolvers.mbonus_material(1, 1, function(e, v) v=v/10 return 0, v end), }, hate_per_kill = resolvers.mbonus_material(4, 1), psi_per_kill = resolvers.mbonus_material(4, 1), }, charm_power = resolvers.mbonus_material(80, 20), charm_power_def = {add=5, max=10, floor=true}, resolvers.charm("inflict mind damage; gain psi and hate", 20, function(self, who) local tg = {type="hit", range=10,} local x, y, target = who:getTarget(tg) if not x or not y then return nil end if target then if target:checkHit(who:combatMindpower(), target:combatMentalResist(), 0, 95, 5) then local damage = self:getCharmPower(who) + (who:combatMindpower() * (1 + self.material_level/5)) who:project(tg, x, y, engine.DamageType.MIND, {dam=damage, alwaysHit=true}, {type="mind"}) who:incPsi(damage/10) who:incHate(damage/10) else game.logSeen(target, "%s resists the mind attack!", target.name:capitalize()) end end return {id=true, used=true} end ), } newEntity{ power_source = {psionic=true}, name = " of nightfall", suffix=true, instant_resolve=true, keywords = {nightfall=true}, level_range = {30, 50}, rarity = 30, cost = 40, wielder = { inc_damage={ [DamageType.DARKNESS] = resolvers.mbonus_material(8, 2), }, resists_pen={ [DamageType.DARKNESS] = resolvers.mbonus_material(8, 2), }, resists={ [DamageType.DARKNESS] = resolvers.mbonus_material(8, 2), }, blind_immune = resolvers.mbonus_material(15, 10, function(e, v) v=v/100 return 0, v end), talents_types_mastery = { ["cursed/darkness"] = resolvers.mbonus_material(1, 1, function(e, v) v=v/10 return 0, v end), }, }, } ------------------------------------------------ -- Mindstar Sets ------------------------------- ------------------------------------------------ -- Wild Cards: Capable of completing other sets newEntity{ power_source = {nature=true}, name = "harmonious ", prefix=true, instant_resolve=true, keywords = {harmonious=true}, level_range = {30, 50}, greater_ego = 1, rarity = 35, cost = 40, wielder = { equilibrium_regen_when_hit = resolvers.mbonus_material(20, 5, function(e, v) v=v/10 return 0, v end), talents_types_mastery = { ["wild-gift/harmony"] = resolvers.mbonus_material(1, 1, function(e, v) v=v/10 return 0, v end), }, inc_damage={ [DamageType.NATURE] = resolvers.mbonus_material(8, 2), }, resists_pen={ [DamageType.NATURE] = resolvers.mbonus_material(8, 2), }, resists={ [DamageType.NATURE] = resolvers.mbonus_material(8, 2), }, }, resolvers.charm("completes a nature powered mindstar set", 20, function(self, who, ms_inven) if who:getInven("PSIONIC_FOCUS") and who:getInven("PSIONIC_FOCUS")[1] == self then game.logPlayer(who, "You cannot use %s while using it as a psionic focus.", self.name) return end who:showEquipment("Harmonize with which mindstar?", function(o) return o.subtype == "mindstar" and o.set_list and o ~= self and o.power_source and o.power_source.nature and not o.set_complete end, function(o) -- remove any existing set properties self.define_as =nil self.set_list = nil self.on_set_complete = nil -- define the mindstar so it matches the set list of the target mindstar self.define_as = o.set_list[1][2] -- then set the mindstar's set list as the definition of the target mindstar self.set_list = { {"define_as", o.define_as} } -- and copies the target mindstar's on set complete self.on_set_complete = o.on_set_complete -- remove the mindstar and rewear it to trigger set bonuses local obj = who:takeoffObject(ms_inven, 1) who:wearObject(obj, true) return true end) return {id=true, used=true} end ), } newEntity{ power_source = {psionic=true}, name = "resonating ", prefix=true, instant_resolve=true, keywords = {resonating=true}, level_range = {30, 50}, greater_ego = 1, rarity = 35, cost = 40, wielder = { damage_resonance = resolvers.mbonus_material(20, 5), psi_regen_when_hit = resolvers.mbonus_material(20, 5, function(e, v) v=v/10 return 0, v end), inc_damage={ [DamageType.MIND] = resolvers.mbonus_material(8, 2), }, resists_pen={ [DamageType.MIND] = resolvers.mbonus_material(8, 2), }, resists={ [DamageType.MIND] = resolvers.mbonus_material(8, 2), }, }, resolvers.charm("completes a psionic powered mindstar set", 20, function(self, who, ms_inven) if who:getInven("PSIONIC_FOCUS") and who:getInven("PSIONIC_FOCUS")[1] == self then game.logPlayer(who, "You cannot use %s while using it as a psionic focus.", self.name) return end who:showEquipment("Resonate with which mindstar?", function(o) return o.subtype == "mindstar" and o.set_list and o ~= self and o.power_source and o.power_source.psionic and not o.set_complete end, function(o) -- remove any existing set properties self.define_as =nil self.set_list = nil self.on_set_complete = nil -- define the mindstar so it matches the set list of the target mindstar self.define_as = o.set_list[1][2] -- then set the mindstar's set list as the definition of the target mindstar self.set_list = { {"define_as", o.define_as} } -- and copies the target mindstar's on set complete self.on_set_complete = o.on_set_complete -- remove the mindstar and rewear it to trigger set bonuses local obj = who:takeoffObject(ms_inven, 1) who:wearObject(obj, true) return true end) return {id=true, used=true} end ), } -- Caller's Set: For summoners! newEntity{ power_source = {nature=true}, define_as = "MS_EGO_SET_CALLERS", name = "caller's ", prefix=true, instant_resolve=true, keywords = {callers=true}, level_range = {30, 50}, greater_ego = 1, rarity = 40, cost = 40, wielder = { inc_damage = { [DamageType.FIRE] = resolvers.mbonus_material(10, 5), [DamageType.ACID] = resolvers.mbonus_material(10, 5), [DamageType.COLD] = resolvers.mbonus_material(10, 5), [DamageType.PHYSICAL] = resolvers.mbonus_material(10, 5), }, resists_pen = { [DamageType.FIRE] = resolvers.mbonus_material(8, 2), [DamageType.ACID] = resolvers.mbonus_material(8, 2), [DamageType.COLD] = resolvers.mbonus_material(8, 2), [DamageType.PHYSICAL] = resolvers.mbonus_material(8, 2), }, }, set_list = { {"define_as", "MS_EGO_SET_SUMMONERS"} }, on_set_complete = function(self, who) game.logPlayer(who, "#GREEN#Your mindstars resonate with Nature's purity.") self:specialSetAdd({"wielder","nature_summon_regen"}, self.material_level) end, on_set_broken = function(self, who) game.logPlayer(who, "#SLATE#The link between the mindstars is broken.") end } newEntity{ power_source = {nature=true}, define_as = "MS_EGO_SET_SUMMONERS", name = "summoner's ", prefix=true, instant_resolve=true, keywords = {summoners=true}, level_range = {30, 50}, greater_ego = 1, rarity = 30, cost = 40, wielder = { combat_mindpower = resolvers.mbonus_material(10, 2), combat_mindcrit = resolvers.mbonus_material(5, 1), }, set_list = { {"define_as", "MS_EGO_SET_CALLERS"} }, on_set_complete = function(self, who) game.logPlayer(who, "#GREEN#Your mindstars resonate with Nature's purity.") self:specialSetAdd({"wielder","nature_summon_max"}, 1) end, on_set_broken = function(self, who) game.logPlayer(who, "#SLATE#The link between the mindstars is broken.") end } -- Drake sets; these may seem odd but they're designed to keep sets from over writing each other when resolved -- Basically it allows a set on suffix without a set_list, keeps the drop tables balanced without being bloated, and allows one master item to complete multiple subsets newEntity{ power_source = {nature=true}, define_as = "MS_EGO_SET_WYRM", name = "wyrm's ", prefix=true, instant_resolve=true, keywords = {wyrms=true}, level_range = {30, 50}, greater_ego = 1, rarity = 35, cost = 40, wielder = { on_melee_hit={ [DamageType.PHYSICAL] = resolvers.mbonus_material(8, 2), [DamageType.COLD] = resolvers.mbonus_material(8, 2), [DamageType.FIRE] = resolvers.mbonus_material(8, 2), [DamageType.LIGHTNING] = resolvers.mbonus_material(8, 2), [DamageType.ACID] = resolvers.mbonus_material(8, 2), }, resists={ [DamageType.PHYSICAL] = resolvers.mbonus_material(8, 2), [DamageType.COLD] = resolvers.mbonus_material(8, 2), [DamageType.FIRE] = resolvers.mbonus_material(8, 2), [DamageType.LIGHTNING] = resolvers.mbonus_material(8, 2), [DamageType.ACID] = resolvers.mbonus_material(8, 2), }, }, set_list = { {"define_as", "MS_EGO_SET_DRAKE_STAR"} }, on_set_complete = function(self, who) game.logPlayer(who, "#PURPLE#You feel the spirit of the wyrm stirring inside you!") self:specialSetAdd({"wielder","blind_immune"}, self.material_level / 10) self:specialSetAdd({"wielder","stun_immune"}, self.material_level / 10) end, on_set_broken = function(self, who) game.logPlayer(who, "#SLATE#The link between the mindstars is broken.") end, resolvers.charm("call the drake in an elemental mindstar (this will remove other set bonuses)", 20, function(self, who, ms_inven) if who:getInven("PSIONIC_FOCUS") and who:getInven("PSIONIC_FOCUS")[1] == self then game.logPlayer(who, "You cannot use %s while using it as a psionic focus.", self.name) return end who:showEquipment("Call the drake in which mindstar (this will destroy other set bonuses)?", function(o) return o.subtype == "mindstar" and o.is_drake_star and o ~= self end, function(o) -- remove any existing sets from the mindstar o.set_list = nil o.on_set_complete = nil o.on_set_broken = nil o.define_as = nil -- create the set list o.define_as = "MS_EGO_SET_DRAKE_STAR" o.set_list = { {"define_as", "MS_EGO_SET_WYRM"} } -- define on_set_complete based on keywords if o.keywords.flames then o.on_set_complete = function(self, who) self:specialSetAdd({"wielder","global_speed_add"}, self.material_level / 100) end elseif o.keywords.frost then o.on_set_complete = function(self, who) self:specialSetAdd({"wielder","combat_armor"}, self.material_level * 3) end elseif o.keywords.sand then o.on_set_complete = function(self, who) self:specialSetAdd({"wielder","combat_physresist"}, self.material_level * 2) self:specialSetAdd({"wielder","combat_spellresist"}, self.material_level * 2) self:specialSetAdd({"wielder","combat_mentalresist"}, self.material_level * 2) end elseif o.keywords.storms then o.on_set_complete = function(self, who) local Stats = require "engine.interface.ActorStats" self:specialSetAdd({"wielder","inc_stats"}, { [Stats.STAT_STR] = self.material_level, [Stats.STAT_DEX] = self.material_level, [Stats.STAT_CON] = self.material_level, [Stats.STAT_MAG] = self.material_level, [Stats.STAT_WIL] = self.material_level, [Stats.STAT_CUN] = self.material_level, }) end end -- rewear the wyrm star to trigger set bonuses local obj = who:takeoffObject(ms_inven, 1) who:wearObject(obj, true, true) return true end) return {id=true, used=true} end ), } newEntity{ power_source = {nature=true}, is_drake_star = true, name = " of flames", suffix=true, instant_resolve=true, keywords = {flames=true}, level_range = {30, 50}, greater_ego = 1, rarity = 40, cost = 40, wielder = { on_melee_hit={ [DamageType.FIRE] = resolvers.mbonus_material(16, 4), }, inc_damage={ [DamageType.FIRE] = resolvers.mbonus_material(16, 4), }, resists_pen={ [DamageType.FIRE] = resolvers.mbonus_material(16, 4), }, resists={ [DamageType.FIRE] = resolvers.mbonus_material(16, 4), }, global_speed_add = resolvers.mbonus_material(5, 1, function(e, v) v=v/100 return 0, v end), }, } newEntity{ power_source = {nature=true}, is_drake_star = true, name = " of frost", suffix=true, instant_resolve=true, keywords = {frost=true}, level_range = {30, 50}, greater_ego = 1, rarity = 40, cost = 40, wielder = { combat_armor = resolvers.mbonus_material(5, 5), on_melee_hit={ [DamageType.ICE] = resolvers.mbonus_material(16, 4), }, inc_damage={ [DamageType.COLD] = resolvers.mbonus_material(16, 4), }, resists_pen={ [DamageType.COLD] = resolvers.mbonus_material(16, 4), }, resists={ [DamageType.COLD] = resolvers.mbonus_material(16, 4), }, }, } newEntity{ power_source = {nature=true}, is_drake_star = true, name = " of sand", suffix=true, instant_resolve=true, keywords = {sand=true}, level_range = {30, 50}, greater_ego = 1, rarity = 40, cost = 40, wielder = { on_melee_hit={ [DamageType.PHYSICAL] = resolvers.mbonus_material(8, 2), }, inc_damage={ [DamageType.PHYSICAL] = resolvers.mbonus_material(8, 2), }, resists_pen={ [DamageType.PHYSICAL] = resolvers.mbonus_material(8, 2), }, resists={ [DamageType.PHYSICAL] = resolvers.mbonus_material(8, 2), }, }, } newEntity{ power_source = {nature=true}, is_drake_star = true, name = " of storms", suffix=true, instant_resolve=true, keywords = {storms=true}, level_range = {30, 50}, greater_ego = 1, rarity = 40, cost = 40, wielder = { on_melee_hit={ [DamageType.LIGHTNING] = resolvers.mbonus_material(16, 4), }, inc_damage={ [DamageType.LIGHTNING] = resolvers.mbonus_material(16, 4), }, resists_pen={ [DamageType.LIGHTNING] = resolvers.mbonus_material(16, 4), }, resists={ [DamageType.LIGHTNING] = resolvers.mbonus_material(16, 4), }, inc_stats = { [Stats.STAT_STR] = resolvers.mbonus_material(3, 1), [Stats.STAT_DEX] = resolvers.mbonus_material(3, 1), [Stats.STAT_MAG] = resolvers.mbonus_material(3, 1), [Stats.STAT_WIL] = resolvers.mbonus_material(3, 1), [Stats.STAT_CUN] = resolvers.mbonus_material(3, 1), [Stats.STAT_CON] = resolvers.mbonus_material(3, 1), }, }, } -- Mentalist Set: For a yet to be written psi class and/or Mindslayers newEntity{ power_source = {psionic=true}, define_as = "MS_EGO_SET_DREAMERS", name = "dreamer's ", prefix=true, instant_resolve=true, keywords = {dreamers=true}, level_range = {30, 50}, greater_ego = 1, rarity = 40, cost = 40, wielder = { combat_mentalresist = resolvers.mbonus_material(8, 2), max_psi = resolvers.mbonus_material(40, 10), resists = { [DamageType.MIND] = resolvers.mbonus_material(20, 5), } }, set_list = { {"define_as", "MS_EGO_SET_EPIPHANOUS"} }, on_set_complete = function(self, who) game.logPlayer(who, "#YELLOW#Your mindstars resonate with psionic energy.") self:specialSetAdd({"wielder","psi_regen"}, self.material_level / 10) end, on_set_broken = function(self, who) game.logPlayer(who, "#SLATE#The link between the mindstars is broken.") end } newEntity{ power_source = {psionic=true}, define_as = "MS_EGO_SET_EPIPHANOUS", name = "epiphanous ", prefix=true, instant_resolve=true, keywords = {epiphanous=true}, level_range = {30, 50}, greater_ego = 1, rarity = 30, cost = 40, wielder = { combat_mindpower = resolvers.mbonus_material(5, 1), combat_mindcrit = resolvers.mbonus_material(5, 1), inc_damage = { [DamageType.MIND] = resolvers.mbonus_material(20, 5), }, }, set_list = { {"define_as", "MS_EGO_SET_DREAMERS"} }, on_set_complete = function(self, who) game.logPlayer(who, "#YELLOW#Your mindstars resonate with psionic energy.") self:specialSetAdd({"wielder","psi_on_crit"}, self.material_level) end, on_set_broken = function(self, who) game.logPlayer(who, "#SLATE#The link between the mindstars is broken.") end } -- Mitotic Set: Single Mindstar that splits in two newEntity{ power_source = {nature=true}, name = "mitotic ", prefix=true, instant_resolve=true, keywords = {mitotic=true}, level_range = {30, 50}, greater_ego = 1, rarity = 45, -- Rarity is high because melee based mindstar use is rare and you get two items out of one drop cost = 10, -- cost is very low to discourage players from splitting them to make extra gold.. because that would be tedious and unfun combat = { physcrit = resolvers.mbonus_material(10, 2), melee_project = { [DamageType.ACID_BLIND]= resolvers.mbonus_material(15, 5), [DamageType.SLIME]= resolvers.mbonus_material(15, 5),}, }, resolvers.charm("divide the mindstar in two", 1, function(self, who) -- Check for free slot first if who:getFreeHands() == 0 then game.logPlayer(who, "You must have a free hand to divide %s", self.name) return end if who:getInven("PSIONIC_FOCUS") and who:getInven("PSIONIC_FOCUS")[1] == self then game.logPlayer(who, "You cannot split %s while using it as a psionic focus.", self.name) return end local o = self -- Remove some properties before cloning o.cost = self.cost / 2 -- more don't split for extra gold discouragement o.max_power = nil o.power_regen = nil o.use_power = nil local o2 = o:clone() -- Build the item set o.define_as = "MS_EGO_SET_MITOTIC_ACID" o2.define_as = "MS_EGO_SET_MITOTIC_SLIME" o.set_list = { {"define_as", "MS_EGO_SET_MITOTIC_SLIME"} } o2.set_list = { {"define_as", "MS_EGO_SET_MITOTIC_ACID"} } o.on_set_complete = function(self, who) self:specialWearAdd({"combat","burst_on_crit"}, { [engine.DamageType.ACID_BLIND] = 10 * self.material_level } ) game.logPlayer(who, "#GREEN#The mindstars pulse with life.") end o.on_set_broken = function(self, who) game.logPlayer(who, "#SLATE#The link between the mindstars is broken.") end o2.on_set_complete = function(self, who) self:specialWearAdd({"combat","burst_on_crit"}, { [engine.DamageType.SLIME] = 10 * self.material_level } ) end -- Wearing the second mindstar will complete the set and thus update the first mindstar who:wearObject(o2, true, true) -- Because we're removing the use_power we're not returning that it was used; instead we'll have the actor use energy manually who:useEnergy() end ), } -- Wrathful Set: Geared towards Afflicted newEntity{ power_source = {psionic=true}, define_as = "MS_EGO_SET_HATEFUL", name = "hateful ", prefix=true, instant_resolve=true, keywords = {hateful=true}, level_range = {30, 50}, greater_ego =1, rarity = 35, cost = 35, wielder = { inc_damage={ [DamageType.MIND] = resolvers.mbonus_material(20, 5), [DamageType.DARKNESS] = resolvers.mbonus_material(20, 5), }, resists_pen={ [DamageType.MIND] = resolvers.mbonus_material(10, 5), [DamageType.DARKNESS] = resolvers.mbonus_material(10, 5), }, inc_damage_type = {humanoid=resolvers.mbonus_material(20, 5)}, }, set_list = { {"define_as", "MS_EGO_SET_WRATHFUL"} }, on_set_complete = function(self, who) self:specialSetAdd({"wielder","combat_mindpower"}, 2 * self.material_level) game.logPlayer(who, "#GREY#You feel a swell of hatred from your mindstars.") end, on_set_broken = function(self, who) game.logPlayer(who, "#SLATE#The mindstar resonance has faded.") end, } newEntity{ power_source = {psionic=true}, define_as = "MS_EGO_SET_WRATHFUL", name = "wrathful ", prefix=true, instant_resolve=true, keywords = {wrath=true}, level_range = {30, 50}, greater_ego = 1, rarity = 40, cost = 40, wielder = { psi_on_crit = resolvers.mbonus_material(5, 1), hate_on_crit = resolvers.mbonus_material(5, 1), combat_mindcrit = resolvers.mbonus_material(10, 2), }, set_list = { {"define_as", "MS_EGO_SET_HATEFUL"} }, on_set_complete = function(self, who) self:specialSetAdd({"wielder","max_hate"}, 2 * self.material_level) game.logPlayer(who, "#GREY#You feel a swell of hatred from your mindstars.") end, on_set_broken = function(self, who) game.logPlayer(who, "#SLATE#The mindstar resonance has faded.") end, }
gpl-3.0
LegionXI/darkstar
scripts/globals/items/bowl_of_yayla_corbasi.lua
12
1478
----------------------------------------- -- ID: 5579 -- Item: bowl_of_yayla_corbasi -- Food Effect: 3Hrs, All Races ----------------------------------------- -- HP 20 -- Dexterity -1 -- Vitality 2 -- HP Recovered While Healing 3 -- MP Recovered While Healing 1 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,10800,5579); end; ----------------------------------------- -- onEffectGain Action ----------------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 20); target:addMod(MOD_DEX, -1); target:addMod(MOD_VIT, 2); target:addMod(MOD_HPHEAL, 3); target:addMod(MOD_MPHEAL, 1); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 20); target:delMod(MOD_DEX, -1); target:delMod(MOD_VIT, 2); target:delMod(MOD_HPHEAL, 3); target:delMod(MOD_MPHEAL, 1); end;
gpl-3.0
LegionXI/darkstar
scripts/zones/Kazham/npcs/Mamerie.lua
17
1410
----------------------------------- -- Area: Kazham -- NPC: Mamerie -- Standard Merchant NPC ----------------------------------- require("scripts/globals/shop"); package.loaded["scripts/zones/Kazham/TextIDs"] = nil; require("scripts/zones/Kazham/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,MAMERIE_SHOP_DIALOG); stock = {0x11C1,62, -- Gysahl Greens 0x0348,7, -- Chocobo Feather 0x4278,11, -- Pet Food Alpha Biscuit 0x4279,82, -- Pet Food Beta Biscuit 0x45C4,82, -- Carrot Broth 0x45C6,695, -- Bug Broth 0x45C8,126, -- Herbal Broth 0x45CA,695, -- Carrion Broth 0x13D1,50784} -- Scroll of Chocobo Mazurka showShop(player, STATIC, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
ibm2431/darkstar
scripts/zones/Promyvion-Vahzl/Zone.lua
9
1386
----------------------------------- -- -- Zone: Promyvion-Vahzl (22) -- ----------------------------------- local ID = require("scripts/zones/Promyvion-Vahzl/IDs") require("scripts/globals/promyvion") require("scripts/globals/missions") require("scripts/globals/settings") require("scripts/globals/status") ----------------------------------- function onInitialize(zone) dsp.promyvion.initZone(zone) end function onZoneIn(player, prevZone) local cs = -1 if player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0 then player:setPos(-14.744, 0.036, -119.736, 1) -- To Floor 1 {R} end if player:getCurrentMission(COP) == dsp.mission.id.cop.DESIRES_OF_EMPTINESS and player:getCharVar("PromathiaStatus") == 0 then cs = 50 end return cs end function afterZoneIn(player) if ENABLE_COP_ZONE_CAP == 1 then player:addStatusEffect(dsp.effect.LEVEL_RESTRICTION, 50, 0, 0) end end function onRegionEnter(player, region) dsp.promyvion.onRegionEnter(player, region) end function onRegionLeave(player, region) end function onEventUpdate(player, csid, option) end function onEventFinish(player, csid, option) if csid == 50 then player:setCharVar("PromathiaStatus", 1) elseif csid == 45 and option == 1 then player:setPos(-379.947, 48.045, 334.059, 192, 9) -- To Pso'Xja {R} end end
gpl-3.0
LegionXI/darkstar
scripts/zones/Abyssea-Konschtat/npcs/Atma_Fabricant.lua
33
1061
----------------------------------- -- Zone: Abyssea - Konschtat -- NPC: Atma Fabricant -- ----------------------------------- package.loaded["scripts/zones/Abyssea-Konschtat/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/globals/abyssea"); require("scripts/zones/Abyssea-Konschtat/TextIDs"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0886); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
NebronTM/TeleBot
plugins/monshi.lua
4
1364
--Start By @Tele_Sudo local function run(msg, matches) if matches[1] == "setpm" then if not is_sudo(msg) then return 'شما سودو نیستید' end local pm = matches[2] redis:set('bot:pm',pm) return 'متن پاسخ گویی ثبت شد' end if matches[1] == "pm" and is_sudo(msg) then local hash = ('bot:pm') local pm = redis:get(hash) if not pm then return ' ثبت نشده' else return tdcli.sendMessage(msg.chat_id_ , 0, 1, 'پیغام کنونی منشی:\n\n'..pm, 0, 'html') end end if matches[1]=="monshi" then if not is_sudo(msg) then return 'شما سودو نیستید' end if matches[2]=="on"then redis:set("bot:pm", "no pm") return "منشی فعال شد لطفا دوباره پیغام را تنظیم کنید" end if matches[2]=="off"then redis:del("bot:pm") return "منشی غیرفعال شد" end end if gp_type(msg.chat_id_) == "pv" and msg.content_.text_ then local hash = ('bot:pm') local pm = redis:get(hash) if gp_type(msg.chat_id_) == "channel" or gp_type(msg.chat_id_) == "chat" then return else return tdcli.sendMessage(msg.chat_id_ , 0, 1, pm, 0, 'html') end end end return { patterns ={ "^[!#/](setpm) (.*)$", "^[!#/](monshi) (on)$", "^[!#/](monshi) (off)$", "^[!#/](pm)$", "^(.*)$", }, run = run } --End By @Tele_Sudo --Channel @LuaError
gpl-3.0
greasydeal/darkstar
scripts/zones/Aht_Urhgan_Whitegate/npcs/Koyol-Futenol.lua
15
3803
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Koyol-Futenol -- Title Change NPC -- @pos -129 2 -20 50 ----------------------------------- require("scripts/globals/titles"); local title2 = { DARK_RESISTANT , BEARER_OF_THE_MARK_OF_ZAHAK , SEAGULL_PHRATRIE_CREW_MEMBER , PROUD_AUTOMATON_OWNER , WILDCAT_PUBLICIST , SCENIC_SNAPSHOTTER , BRANDED_BY_THE_FIVE_SERPENTS , IMMORTAL_LION , PARAGON_OF_BLUE_MAGE_EXCELLENCE , PARAGON_OF_CORSAIR_EXCELLENCE , PARAGON_OF_PUPPETMASTER_EXCELLENCE , MASTER_OF_AMBITION , MASTER_OF_CHANCE , SKYSERPENT_AGGRANDIZER , GALESERPENT_GUARDIAN , STONESERPENT_SHOCKTROOPER , PHOTOPTICATOR_OPERATOR , SPRINGSERPENT_SENTRY , FLAMESERPENT_FACILITATOR , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title3 = { PRIVATE_SECOND_CLASS , PRIVATE_FIRST_CLASS , SUPERIOR_PRIVATE , LANCE_CORPORAL , CORPORAL , SERGEANT , SERGEANT_MAJOR , CHIEF_SERGEANT , SECOND_LIEUTENANT , FIRST_LIEUTENANT , AGENT_OF_THE_ALLIED_FORCES , OVJANGS_ERRAND_RUNNER , KARABABAS_TOUR_GUIDE , KARABABAS_BODYGUARD , KARABABAS_SECRET_AGENT , APHMAUS_MERCENARY , NASHMEIRAS_MERCENARY , SALAHEEMS_RISK_ASSESSOR , TREASURE_TROVE_TENDER , GESSHOS_MERCY , EMISSARY_OF_THE_EMPRESS , ENDYMION_PARATROOPER , NAJAS_COMRADEINARMS , NASHMEIRAS_LOYALIST , PREVENTER_OF_RAGNAROK , CHAMPION_OF_AHT_URHGAN , ETERNAL_MERCENARY , CAPTAIN } local title4 = { SUBDUER_OF_THE_MAMOOL_JA , SUBDUER_OF_THE_TROLLS , SUBDUER_OF_THE_UNDEAD_SWARM , CERBERUS_MUZZLER , HYDRA_HEADHUNTER , SHINING_SCALE_RIFLER , TROLL_SUBJUGATOR , GORGONSTONE_SUNDERER , KHIMAIRA_CARVER , ELITE_EINHERJAR , STAR_CHARIOTEER , SUN_CHARIOTEER , COMET_CHARIOTEER , MOON_CHARIOTEER , BLOODY_BERSERKER , THE_SIXTH_SERPENT , OUPIRE_IMPALER , HEIR_OF_THE_BLESSED_RADIANCE , HEIR_OF_THE_BLIGHTED_GLOOM , SWORN_TO_THE_DARK_DIVINITY , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title5 = { 0 , SUPERNAL_SAVANT , SOLAR_SAGE , BOLIDE_BARON , MOON_MAVEN , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title6 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title7 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0284,npcUtil.genTmask(player,title2),npcUtil.genTmask(player,title3),npcUtil.genTmask(player,title4),npcUtil.genTmask(player,title5),npcUtil.genTmask(player,title6),npcUtil.genTmask(player,title7),1 ,player:getGil()); 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==0x0284) then if(option > 0 and option <29) then if (player:delGil(200)) then player:setTitle( title2[option] ) end elseif(option > 256 and option <285) then if (player:delGil(300)) then player:setTitle( title3[option - 256] ) end elseif(option > 512 and option < 541) then if (player:delGil(400)) then player:setTitle( title4[option - 512] ) end elseif(option > 768 and option <797) then if (player:delGil(500)) then player:setTitle( title5[option - 768] ) end end end end;
gpl-3.0
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/MenuItemImage.lua
6
1676
-------------------------------- -- @module MenuItemImage -- @extend MenuItemSprite -- @parent_module cc -------------------------------- -- Sets the sprite frame for the disabled image. -- @function [parent=#MenuItemImage] setDisabledSpriteFrame -- @param self -- @param #cc.SpriteFrame frame -- @return MenuItemImage#MenuItemImage self (return value: cc.MenuItemImage) -------------------------------- -- Sets the sprite frame for the selected image. -- @function [parent=#MenuItemImage] setSelectedSpriteFrame -- @param self -- @param #cc.SpriteFrame frame -- @return MenuItemImage#MenuItemImage self (return value: cc.MenuItemImage) -------------------------------- -- Sets the sprite frame for the normal image. -- @function [parent=#MenuItemImage] setNormalSpriteFrame -- @param self -- @param #cc.SpriteFrame frame -- @return MenuItemImage#MenuItemImage self (return value: cc.MenuItemImage) -------------------------------- -- -- @function [parent=#MenuItemImage] init -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- Initializes a menu item with a normal, selected and disabled image with a callable object. -- @function [parent=#MenuItemImage] initWithNormalImage -- @param self -- @param #string normalImage -- @param #string selectedImage -- @param #string disabledImage -- @param #function callback -- @return bool#bool ret (return value: bool) -------------------------------- -- js ctor -- @function [parent=#MenuItemImage] MenuItemImage -- @param self -- @return MenuItemImage#MenuItemImage self (return value: cc.MenuItemImage) return nil
mit
ibm2431/darkstar
scripts/globals/items/plate_of_octopus_sushi_+1.lua
11
1300
----------------------------------------- -- ID: 5694 -- Item: plate_of_octopus_sushi_+1 -- Food Effect: 60Min, All Races ----------------------------------------- -- Strength 2 -- Accuracy % 15 (cap 72) -- Ranged Accuracy % 15 (cap 72) -- Resist Sleep +2 ----------------------------------------- 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,3600,5694) end function onEffectGain(target, effect) target:addMod(dsp.mod.STR, 2) target:addMod(dsp.mod.FOOD_ACCP, 15) target:addMod(dsp.mod.FOOD_ACC_CAP, 72) target:addMod(dsp.mod.FOOD_RACCP, 15) target:addMod(dsp.mod.FOOD_RACC_CAP, 72) target:addMod(dsp.mod.SLEEPRES, 2) end function onEffectLose(target, effect) target:delMod(dsp.mod.STR, 2) target:delMod(dsp.mod.FOOD_ACCP, 15) target:delMod(dsp.mod.FOOD_ACC_CAP, 72) target:delMod(dsp.mod.FOOD_RACCP, 15) target:delMod(dsp.mod.FOOD_RACC_CAP, 72) target:delMod(dsp.mod.SLEEPRES, 2) end
gpl-3.0
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/external/lua/luasocket/script/socket/headers.lua
31
3706
----------------------------------------------------------------------------- -- Canonic header field capitalization -- LuaSocket toolkit. -- Author: Diego Nehab ----------------------------------------------------------------------------- local socket = require("socket.socket") socket.headers = {} local _M = socket.headers _M.canonic = { ["accept"] = "Accept", ["accept-charset"] = "Accept-Charset", ["accept-encoding"] = "Accept-Encoding", ["accept-language"] = "Accept-Language", ["accept-ranges"] = "Accept-Ranges", ["action"] = "Action", ["alternate-recipient"] = "Alternate-Recipient", ["age"] = "Age", ["allow"] = "Allow", ["arrival-date"] = "Arrival-Date", ["authorization"] = "Authorization", ["bcc"] = "Bcc", ["cache-control"] = "Cache-Control", ["cc"] = "Cc", ["comments"] = "Comments", ["connection"] = "Connection", ["content-description"] = "Content-Description", ["content-disposition"] = "Content-Disposition", ["content-encoding"] = "Content-Encoding", ["content-id"] = "Content-ID", ["content-language"] = "Content-Language", ["content-length"] = "Content-Length", ["content-location"] = "Content-Location", ["content-md5"] = "Content-MD5", ["content-range"] = "Content-Range", ["content-transfer-encoding"] = "Content-Transfer-Encoding", ["content-type"] = "Content-Type", ["cookie"] = "Cookie", ["date"] = "Date", ["diagnostic-code"] = "Diagnostic-Code", ["dsn-gateway"] = "DSN-Gateway", ["etag"] = "ETag", ["expect"] = "Expect", ["expires"] = "Expires", ["final-log-id"] = "Final-Log-ID", ["final-recipient"] = "Final-Recipient", ["from"] = "From", ["host"] = "Host", ["if-match"] = "If-Match", ["if-modified-since"] = "If-Modified-Since", ["if-none-match"] = "If-None-Match", ["if-range"] = "If-Range", ["if-unmodified-since"] = "If-Unmodified-Since", ["in-reply-to"] = "In-Reply-To", ["keywords"] = "Keywords", ["last-attempt-date"] = "Last-Attempt-Date", ["last-modified"] = "Last-Modified", ["location"] = "Location", ["max-forwards"] = "Max-Forwards", ["message-id"] = "Message-ID", ["mime-version"] = "MIME-Version", ["original-envelope-id"] = "Original-Envelope-ID", ["original-recipient"] = "Original-Recipient", ["pragma"] = "Pragma", ["proxy-authenticate"] = "Proxy-Authenticate", ["proxy-authorization"] = "Proxy-Authorization", ["range"] = "Range", ["received"] = "Received", ["received-from-mta"] = "Received-From-MTA", ["references"] = "References", ["referer"] = "Referer", ["remote-mta"] = "Remote-MTA", ["reply-to"] = "Reply-To", ["reporting-mta"] = "Reporting-MTA", ["resent-bcc"] = "Resent-Bcc", ["resent-cc"] = "Resent-Cc", ["resent-date"] = "Resent-Date", ["resent-from"] = "Resent-From", ["resent-message-id"] = "Resent-Message-ID", ["resent-reply-to"] = "Resent-Reply-To", ["resent-sender"] = "Resent-Sender", ["resent-to"] = "Resent-To", ["retry-after"] = "Retry-After", ["return-path"] = "Return-Path", ["sender"] = "Sender", ["server"] = "Server", ["smtp-remote-recipient"] = "SMTP-Remote-Recipient", ["status"] = "Status", ["subject"] = "Subject", ["te"] = "TE", ["to"] = "To", ["trailer"] = "Trailer", ["transfer-encoding"] = "Transfer-Encoding", ["upgrade"] = "Upgrade", ["user-agent"] = "User-Agent", ["vary"] = "Vary", ["via"] = "Via", ["warning"] = "Warning", ["will-retry-until"] = "Will-Retry-Until", ["www-authenticate"] = "WWW-Authenticate", ["x-mailer"] = "X-Mailer", } return _M
mit
LegionXI/darkstar
scripts/globals/mobskills/Mijin_Gakure.lua
32
1342
--------------------------------------------------- -- Mijin Gakure --------------------------------------------------- require("scripts/globals/settings"); require("scripts/globals/status"); require("scripts/globals/monstertpmoves"); --------------------------------------------------- function onMobSkillCheck(target,mob,skill) if (mob:getMobMod(MOBMOD_SCRIPTED_2HOUR) == 1) then return 0; elseif (skill:getParam() == 2 and math.random() <= 0.5) then -- not always used return 1; elseif (mob:getHPP() <= mob:getMobMod(MOBMOD_2HOUR_PROC)) then return 0; end return 1; end; function onMobWeaponSkill(target, mob, skill) local dmgmod = 1; local hpmod = skill:getHPP() / 100; local basePower = 6; -- Maat has a weaker Mijin if (mob:getFamily() == 335) then basePower = 4; end local power = hpmod * 10 + basePower; local baseDmg = mob:getWeaponDmg() * power; local info = MobMagicalMove(mob,target,skill,baseDmg,ELE_NONE,dmgmod,TP_MAB_BONUS,1); local dmg = MobFinalAdjustments(info.dmg,mob,skill,target,MOBSKILL_MAGICAL,MOBPARAM_NONE,MOBPARAM_IGNORE_SHADOWS); if (mob:isInDynamis()) then -- dynamis mobs will kill themselves -- other mobs might not mob:setHP(0); end target:delHP(dmg); return dmg; end;
gpl-3.0
ibm2431/darkstar
scripts/globals/items/skewer_of_m&p_chicken.lua
11
1088
----------------------------------------- -- ID: 5639 -- Item: Skewer of M&P Chicken -- Food Effect: 3Min, All Races ----------------------------------------- -- Strength 5 -- Intelligence -5 -- Attack % 25 -- Attack Cap 154 ----------------------------------------- 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,180,5639) end function onEffectGain(target, effect) target:addMod(dsp.mod.STR, 5) target:addMod(dsp.mod.INT, -5) target:addMod(dsp.mod.FOOD_ATTP, 25) target:addMod(dsp.mod.FOOD_ATT_CAP, 154) end function onEffectLose(target, effect) target:delMod(dsp.mod.STR, 5) target:delMod(dsp.mod.INT, -5) target:delMod(dsp.mod.FOOD_ATTP, 25) target:delMod(dsp.mod.FOOD_ATT_CAP, 154) end
gpl-3.0
Tommy228/TTTDamagelogs
lua/damagelogs/client/listview.lua
1
12352
local color_what = Color(255, 0, 0, 100) local color_darkblue = Color(25, 25, 220) local color_orange = Color(255, 128, 0) function Damagelog:SetLineMenu(item, infos, tbl, roles, text, old_logs) item.ShowTooLong = function(_, b) item.ShowLong = b end item.ShowCopy = function(_, b, steamid1, steamid2) item.Copy = b item.steamid1 = steamid1 item.steamid2 = steamid2 end item.ShowDamageInfos = function(_, ply1, ply2) item.DamageInfos = true item.ply1 = ply1 item.ply2 = ply2 end item.ShowDeathScene = function(_, ply1, ply2, id) item.DeathScene = true item.ply1 = ply1 item.ply2 = ply2 item.sceneid = id end item.text = text item.old_logs = old_logs item.OnRightClick = function() if not item.ShowLong and not item.Copy and not item.DamageInfos then return end local menu = DermaMenu() local pnl = vgui.Create("DMenuOption", menu) local copy = DermaMenu(menu) copy:SetVisible(false) pnl:SetSubMenu(copy) pnl:SetText(TTTLogTranslate(GetDMGLogLang, "Copy")) pnl:SetImage("icon16/tab_edit.png") menu:AddPanel(pnl) copy:AddOption(TTTLogTranslate(GetDMGLogLang, "Lines"), function() local full_text = "" local append = false for _, line in pairs(item:GetListView():GetSelected()) do if append then full_text = full_text .. "\n" end full_text = full_text .. "[" .. line:GetColumnText(1) .. "] " .. line:GetColumnText(3) append = true end SetClipboardText(full_text) end) if item.Copy then copy:AddOption(TTTLogTranslate(GetDMGLogLang, "SteamIDof") .. item.steamid1[1], function() SetClipboardText(item.steamid1[2]) end) if item.steamid2 then copy:AddOption(TTTLogTranslate(GetDMGLogLang, "SteamIDof") .. item.steamid2[1], function() SetClipboardText(item.steamid2[2]) end) end end if item.DamageInfos then menu:AddOption(TTTLogTranslate(GetDMGLogLang, "ShowDamageInfos"), function() if item.old_logs then local found, result = self:FindFromOldLogs(tbl.time, item.ply1, item.ply2) self:SetDamageInfosLV(self.OldDamageInfo, roles, tbl.ply1, tbl.ply2, tbl.time, tbl.time - 10, found and result) self.DamageInfoForm:Toggle() else net.Start("DL_AskDamageInfos") net.WriteUInt(tbl.time, 32) net.WriteUInt(item.ply1, 32) net.WriteUInt(item.ply2, 32) if not tbl.round then net.WriteUInt(self.SelectedRound, 32) else net.WriteUInt(tbl.round, 32) end net.SendToServer() end end):SetImage("icon16/gun.png") end if item.DeathScene then menu:AddOption(TTTLogTranslate(GetDMGLogLang, "ShowDeathScene"), function() net.Start("DL_AskDeathScene") net.WriteUInt(item.sceneid, 32) net.WriteUInt(item.ply1, 32) net.WriteUInt(item.ply2, 32) net.SendToServer() end):SetImage("icon16/television.png") end if item.ShowLong then menu:AddOption(TTTLogTranslate(GetDMGLogLang, "FullDisplay"), function() Derma_Message(item.text, TTTLogTranslate(GetDMGLogLang, "FullDisplay"), TTTLogTranslate(GetDMGLogLang, "Close")) end):SetImage("icon16/eye.png") end menu:Open() end infos:RightClick(item, tbl.infos, roles, text) end function Damagelog:AddLogsLine(listview, tbl, roles, nofilters, old) if type(tbl) ~= "table" then return end local infos = self.events[tbl.id] if not infos then return end if not nofilters and not infos:IsAllowed(tbl.infos, roles) then return end local text = infos:ToString(tbl.infos, roles) local item = listview:AddLine(util.SimpleTime(tbl.time, "%02i:%02i"), infos.Type, text, "") if tbl.infos.icon then if tbl.infos.icon[1] then local image = vgui.Create("DImage", item.Columns[4]) image:SetImage(tbl.infos.icon[1]) image:SetSize(16, 16) image:SetPos(6, 1) end if tbl.infos.icon[2] then item:SetTooltip(TTTLogTranslate(GetDMGLogLang, "VictimShotFirst")) end end function item:PaintOver(w, h) if not self:IsSelected() and infos:Highlight(item, tbl.infos, text) then surface.SetDrawColor(color_what) surface.DrawRect(0, 0, w, h) else for _, v in pairs(item.Columns) do v:SetTextColor(infos:GetColor(tbl.infos, roles)) end end end self:SetLineMenu(item, infos, tbl, roles, text, old) return true end function Damagelog:SetListViewTable(listview, tbl, nofilters, old) if not tbl or not tbl.logs then return end if #tbl.logs > 0 then local added = false for _, v in ipairs(tbl.logs) do local line_added = self:AddLogsLine(listview, v, tbl.roles, nofilters, old) if not added and line_added then added = true end end if not added then listview:AddLine("", "", TTTLogTranslate(GetDMGLogLang, "EmptyLogsFilters")) end else listview:AddLine("", "", TTTLogTranslate(GetDMGLogLang, "EmptyLogs")) end end function Damagelog:SetRolesListView(listview, tbl) listview:Clear() if not tbl then return end for _, v in pairs(tbl) do if v.role ~= ROLE_INNOCENT or GetConVar("ttt_dmglogs_showinnocents"):GetBool() then self:AddRoleLine(listview, v.nick, v.role) end end end local role_colors = { [1] = Color(0, 200, 0), [2] = Color(200, 0, 0), [3] = Color(0, 0, 200), ["disconnected"] = Color(0, 0, 0) } function Damagelog:AddRoleLine(listview, nick, role) if role ~= -3 then local item = listview:AddLine(nick, self:StrRole(role), "") function item:PaintOver() for _, v in pairs(item.Columns) do if role < 0 then v:SetTextColor(role_colors["disconnected"]) else if not ROLES then v:SetTextColor(role_colors[role]) else v:SetTextColor(GetRoleByIndex(role).color) end end end end item.Nick = nick item.Round = self.SelectedRound local sync_ent = self:GetSyncEnt() item.Think = function(panel) if GetRoundState() == ROUND_ACTIVE and sync_ent:GetPlayedRounds() == panel.Round then local ent = self.RoleNicks and self.RoleNicks[panel.Nick] if IsValid(ent) then panel:SetColumnText(3, ent:Alive() and not (ent.IsGhost and ent:IsGhost()) and not ent:IsSpec() and TTTLogTranslate(GetDMGLogLang, "Yes") or TTTLogTranslate(GetDMGLogLang, "No")) else panel:SetColumnText(3, TTTLogTranslate(GetDMGLogLang, "ChatDisconnected")) end else panel:SetColumnText(3, TTTLogTranslate(GetDMGLogLang, "RoundEnded")) end end end -- TODO what is with role == -1 and -2 ? or "disconnected" ? end local shoot_colors = { [Color(46, 46, 46)] = true, [Color(66, 66, 66)] = true, [Color(125, 125, 125)] = true, [Color(255, 6, 13)] = true, [Color(0, 0, 128)] = true, [Color(0, 0, 205)] = true, [Color(79, 209, 204)] = true, [Color(165, 42, 42)] = true, [Color(238, 59, 59)] = true, [Color(210, 105, 30)] = true, [Color(255, 165, 79)] = true, [Color(107, 66, 38)] = true, [Color(166, 128, 100)] = true, [Color(0, 100, 0)] = true, [Color(34, 139, 34)] = true, [Color(124, 252, 0)] = true, [Color(78, 328, 148)] = true, [Color(139, 10, 80)] = true, [Color(205, 16, 118)] = true, [Color(205, 85, 85)] = true, [Color(110, 6, 250)] = true, [Color(30, 235, 0)] = true, [Color(205, 149, 12)] = true, [Color(0, 0, 250)] = true, [Color(219, 150, 50)] = true, [Color(255, 36, 0)] = true, [Color(205, 104, 57)] = true, [Color(191, 62, 255)] = true, [Color(99, 86, 126)] = true, [Color(133, 99, 99)] = true } function Damagelog:SetDamageInfosLV(listview, roles, att, victim, beg, t, result) if not IsValid(self.Menu) then return end for k in pairs(shoot_colors) do shoot_colors[k] = true end if beg then beg = string.FormattedTime(math.Clamp(beg, 0, 999), "%02i:%02i") end if t then t = string.FormattedTime(t, "%02i:%02i") end listview:Clear() if victim and att then listview:AddLine(string.format(TTTLogTranslate(GetDMGLogLang, "DamageInfosBetween"), victim, att, beg, t)) end if not result or table.Count(result) <= 0 then listview:AddLine(TTTLogTranslate(GetDMGLogLang, "EmptyLogs")) -- Currently unused -- Currently unused else local nums = {} local used_nicks = {} for k in pairs(result) do table.insert(nums, k) end table.sort(nums) local players = {} for _, v in ipairs(nums) do local info = result[v] local color for _, i in pairs(info) do if att and victim then if not players[1] then players[1] = i[1] elseif not players[2] then players[2] = i[1] end else if not used_nicks[i[1]] then local found = false for k, v2 in RandomPairs(shoot_colors) do if v2 and not found then color = k found = true end end if found then shoot_colors[color] = false used_nicks[i[1]] = color else used_nicks[i[1]] = COLOR_WHITE end else color = used_nicks[i[1]] end end local item if i[2] == "crowbartir" then item = listview:AddLine(string.format(TTTLogTranslate(GetDMGLogLang, "CrowbarSwung"), string.FormattedTime(v, "%02i:%02i"), self:InfoFromID(roles, i[1]).nick)) elseif i[2] == "crowbarpouss" then item = listview:AddLine(string.format(TTTLogTranslate(GetDMGLogLang, "HasPushed"), string.FormattedTime(v, "%02i:%02i"), self:InfoFromID(roles, i[1]).nick, self:InfoFromID(roles, i[3]).nick)) else wep = Damagelog:GetWeaponName(i[2]) or TTTLogTranslate(GetDMGLogLang, "UnknownWeapon") item = listview:AddLine(string.format(TTTLogTranslate(GetDMGLogLang, "HasShot"), string.FormattedTime(v, "%02i:%02i"), self:InfoFromID(roles, i[1]).nick, wep)) end item.PaintOver = function() if att and victim then if i[1] == players[1] then item.Columns[1]:SetTextColor(color_darkblue) elseif i[1] == players[2] then item.Columns[1]:SetTextColor(color_orange) end else item.Columns[1]:SetTextColor(color) end end end end end self.DamageInfoBox:Toggle() end
gpl-3.0
LegionXI/darkstar
scripts/zones/Aht_Urhgan_Whitegate/npcs/Gavrie.lua
17
1534
----------------------------------- -- Area: Aht Urhgan Whitegate -- NPC: Gavrie -- Standard Merchant NPC ----------------------------------- package.loaded["scripts/zones/Aht_Urhgan_Whitegate/TextIDs"] = nil; ----------------------------------- require("scripts/zones/Aht_Urhgan_Whitegate/TextIDs"); require("scripts/globals/shop"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:showText(npc,GAVRIE_SHOP_DIALOG); stock = {0x1036,2595, -- Eye Drops 0x1034,316, -- Antidote 0x1037,800, -- Echo Drops 0x1010,910, -- Potion 0x1020,4832, -- Ether 0x103B,3360, -- Remedy 0x119D,12, -- Distilled Water 0x492B,50, -- Automaton Oil 0x492C,250, -- Automaton Oil +1 0x492D,500, -- Automaton Oil +2 0x4AF1,1000} -- Automaton Oil +3 showShop(player, STATIC, stock); end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); end;
gpl-3.0
lajoll1/sipml5
asterisk/etc/extensions.lua
317
5827
CONSOLE = "Console/dsp" -- Console interface for demo --CONSOLE = "DAHDI/1" --CONSOLE = "Phone/phone0" IAXINFO = "guest" -- IAXtel username/password --IAXINFO = "myuser:mypass" TRUNK = "DAHDI/G2" TRUNKMSD = 1 -- TRUNK = "IAX2/user:pass@provider" -- -- Extensions are expected to be defined in a global table named 'extensions'. -- The 'extensions' table should have a group of tables in it, each -- representing a context. Extensions are defined in each context. See below -- for examples. -- -- Extension names may be numbers, letters, or combinations thereof. If -- an extension name is prefixed by a '_' character, it is interpreted as -- a pattern rather than a literal. In patterns, some characters have -- special meanings: -- -- X - any digit from 0-9 -- Z - any digit from 1-9 -- N - any digit from 2-9 -- [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9) -- . - wildcard, matches anything remaining (e.g. _9011. matches -- anything starting with 9011 excluding 9011 itself) -- ! - wildcard, causes the matching process to complete as soon as -- it can unambiguously determine that no other matches are possible -- -- For example the extension _NXXXXXX would match normal 7 digit -- dialings, while _1NXXNXXXXXX would represent an area code plus phone -- number preceded by a one. -- -- If your extension has special characters in it such as '.' and '!' you must -- explicitly make it a string in the tabale definition: -- -- ["_special."] = function; -- ["_special!"] = function; -- -- There are no priorities. All extensions to asterisk appear to have a single -- priority as if they consist of a single priority. -- -- Each context is defined as a table in the extensions table. The -- context names should be strings. -- -- One context may be included in another context using the 'includes' -- extension. This extension should be set to a table containing a list -- of context names. Do not put references to tables in the includes -- table. -- -- include = {"a", "b", "c"}; -- -- Channel variables can be accessed thorugh the global 'channel' table. -- -- v = channel.var_name -- v = channel["var_name"] -- v.value -- v:get() -- -- channel.var_name = "value" -- channel["var_name"] = "value" -- v:set("value") -- -- channel.func_name(1,2,3):set("value") -- value = channel.func_name(1,2,3):get() -- -- channel["func_name(1,2,3)"]:set("value") -- channel["func_name(1,2,3)"] = "value" -- value = channel["func_name(1,2,3)"]:get() -- -- Note the use of the ':' operator to access the get() and set() -- methods. -- -- Also notice the absence of the following constructs from the examples above: -- channel.func_name(1,2,3) = "value" -- this will NOT work -- value = channel.func_name(1,2,3) -- this will NOT work as expected -- -- -- Dialplan applications can be accessed through the global 'app' table. -- -- app.Dial("DAHDI/1") -- app.dial("DAHDI/1") -- -- More examples can be found below. -- -- An autoservice is automatically run while lua code is executing. The -- autoservice can be stopped and restarted using the autoservice_stop() and -- autoservice_start() functions. The autservice should be running before -- starting long running operations. The autoservice will automatically be -- stopped before executing applications and dialplan functions and will be -- restarted afterwards. The autoservice_status() function can be used to -- check the current status of the autoservice and will return true if an -- autoservice is currently running. -- function outgoing_local(c, e) app.dial("DAHDI/1/" .. e, "", "") end function demo_instruct() app.background("demo-instruct") app.waitexten() end function demo_congrats() app.background("demo-congrats") demo_instruct() end -- Answer the chanel and play the demo sound files function demo_start(context, exten) app.wait(1) app.answer() channel.TIMEOUT("digit"):set(5) channel.TIMEOUT("response"):set(10) -- app.set("TIMEOUT(digit)=5") -- app.set("TIMEOUT(response)=10") demo_congrats(context, exten) end function demo_hangup() app.playback("demo-thanks") app.hangup() end extensions = { demo = { s = demo_start; ["2"] = function() app.background("demo-moreinfo") demo_instruct() end; ["3"] = function () channel.LANGUAGE():set("fr") -- set the language to french demo_congrats() end; ["1000"] = function() app.goto("demo", "s", 1) end; ["1234"] = function() app.playback("transfer", "skip") -- do a dial here end; ["1235"] = function() app.voicemail("1234", "u") end; ["1236"] = function() app.dial("Console/dsp") app.voicemail(1234, "b") end; ["#"] = demo_hangup; t = demo_hangup; i = function() app.playback("invalid") demo_instruct() end; ["500"] = function() app.playback("demo-abouttotry") app.dial("IAX2/guest@misery.digium.com/s@default") app.playback("demo-nogo") demo_instruct() end; ["600"] = function() app.playback("demo-echotest") app.echo() app.playback("demo-echodone") demo_instruct() end; ["8500"] = function() app.voicemailmain() demo_instruct() end; }; default = { -- by default, do the demo include = {"demo"}; }; public = { -- ATTENTION: If your Asterisk is connected to the internet and you do -- not have allowguest=no in sip.conf, everybody out there may use your -- public context without authentication. In that case you want to -- double check which services you offer to the world. -- include = {"demo"}; }; ["local"] = { ["_NXXXXXX"] = outgoing_local; }; } hints = { demo = { [1000] = "SIP/1000"; [1001] = "SIP/1001"; }; default = { ["1234"] = "SIP/1234"; }; }
bsd-3-clause
cspyb/sipml5
asterisk/etc/extensions.lua
317
5827
CONSOLE = "Console/dsp" -- Console interface for demo --CONSOLE = "DAHDI/1" --CONSOLE = "Phone/phone0" IAXINFO = "guest" -- IAXtel username/password --IAXINFO = "myuser:mypass" TRUNK = "DAHDI/G2" TRUNKMSD = 1 -- TRUNK = "IAX2/user:pass@provider" -- -- Extensions are expected to be defined in a global table named 'extensions'. -- The 'extensions' table should have a group of tables in it, each -- representing a context. Extensions are defined in each context. See below -- for examples. -- -- Extension names may be numbers, letters, or combinations thereof. If -- an extension name is prefixed by a '_' character, it is interpreted as -- a pattern rather than a literal. In patterns, some characters have -- special meanings: -- -- X - any digit from 0-9 -- Z - any digit from 1-9 -- N - any digit from 2-9 -- [1235-9] - any digit in the brackets (in this example, 1,2,3,5,6,7,8,9) -- . - wildcard, matches anything remaining (e.g. _9011. matches -- anything starting with 9011 excluding 9011 itself) -- ! - wildcard, causes the matching process to complete as soon as -- it can unambiguously determine that no other matches are possible -- -- For example the extension _NXXXXXX would match normal 7 digit -- dialings, while _1NXXNXXXXXX would represent an area code plus phone -- number preceded by a one. -- -- If your extension has special characters in it such as '.' and '!' you must -- explicitly make it a string in the tabale definition: -- -- ["_special."] = function; -- ["_special!"] = function; -- -- There are no priorities. All extensions to asterisk appear to have a single -- priority as if they consist of a single priority. -- -- Each context is defined as a table in the extensions table. The -- context names should be strings. -- -- One context may be included in another context using the 'includes' -- extension. This extension should be set to a table containing a list -- of context names. Do not put references to tables in the includes -- table. -- -- include = {"a", "b", "c"}; -- -- Channel variables can be accessed thorugh the global 'channel' table. -- -- v = channel.var_name -- v = channel["var_name"] -- v.value -- v:get() -- -- channel.var_name = "value" -- channel["var_name"] = "value" -- v:set("value") -- -- channel.func_name(1,2,3):set("value") -- value = channel.func_name(1,2,3):get() -- -- channel["func_name(1,2,3)"]:set("value") -- channel["func_name(1,2,3)"] = "value" -- value = channel["func_name(1,2,3)"]:get() -- -- Note the use of the ':' operator to access the get() and set() -- methods. -- -- Also notice the absence of the following constructs from the examples above: -- channel.func_name(1,2,3) = "value" -- this will NOT work -- value = channel.func_name(1,2,3) -- this will NOT work as expected -- -- -- Dialplan applications can be accessed through the global 'app' table. -- -- app.Dial("DAHDI/1") -- app.dial("DAHDI/1") -- -- More examples can be found below. -- -- An autoservice is automatically run while lua code is executing. The -- autoservice can be stopped and restarted using the autoservice_stop() and -- autoservice_start() functions. The autservice should be running before -- starting long running operations. The autoservice will automatically be -- stopped before executing applications and dialplan functions and will be -- restarted afterwards. The autoservice_status() function can be used to -- check the current status of the autoservice and will return true if an -- autoservice is currently running. -- function outgoing_local(c, e) app.dial("DAHDI/1/" .. e, "", "") end function demo_instruct() app.background("demo-instruct") app.waitexten() end function demo_congrats() app.background("demo-congrats") demo_instruct() end -- Answer the chanel and play the demo sound files function demo_start(context, exten) app.wait(1) app.answer() channel.TIMEOUT("digit"):set(5) channel.TIMEOUT("response"):set(10) -- app.set("TIMEOUT(digit)=5") -- app.set("TIMEOUT(response)=10") demo_congrats(context, exten) end function demo_hangup() app.playback("demo-thanks") app.hangup() end extensions = { demo = { s = demo_start; ["2"] = function() app.background("demo-moreinfo") demo_instruct() end; ["3"] = function () channel.LANGUAGE():set("fr") -- set the language to french demo_congrats() end; ["1000"] = function() app.goto("demo", "s", 1) end; ["1234"] = function() app.playback("transfer", "skip") -- do a dial here end; ["1235"] = function() app.voicemail("1234", "u") end; ["1236"] = function() app.dial("Console/dsp") app.voicemail(1234, "b") end; ["#"] = demo_hangup; t = demo_hangup; i = function() app.playback("invalid") demo_instruct() end; ["500"] = function() app.playback("demo-abouttotry") app.dial("IAX2/guest@misery.digium.com/s@default") app.playback("demo-nogo") demo_instruct() end; ["600"] = function() app.playback("demo-echotest") app.echo() app.playback("demo-echodone") demo_instruct() end; ["8500"] = function() app.voicemailmain() demo_instruct() end; }; default = { -- by default, do the demo include = {"demo"}; }; public = { -- ATTENTION: If your Asterisk is connected to the internet and you do -- not have allowguest=no in sip.conf, everybody out there may use your -- public context without authentication. In that case you want to -- double check which services you offer to the world. -- include = {"demo"}; }; ["local"] = { ["_NXXXXXX"] = outgoing_local; }; } hints = { demo = { [1000] = "SIP/1000"; [1001] = "SIP/1001"; }; default = { ["1234"] = "SIP/1234"; }; }
bsd-3-clause
greasydeal/darkstar
scripts/zones/Tavnazian_Safehold/npcs/Aligi-Kufongi.lua
15
2993
----------------------------------- -- Area: Tavnazian Safehold -- NPC: Aligi-Kufongi -- Title Change NPC -- @pos -23 -21 15 26 ----------------------------------- require("scripts/globals/titles"); local title2 = { TAVNAZIAN_SQUIRE ,PUTRID_PURVEYOR_OF_PUNGENT_PETALS , MONARCH_LINN_PATROL_GUARD , SIN_HUNTER_HUNTER , DISCIPLE_OF_JUSTICE , DYNAMISTAVNAZIA_INTERLOPER , CONFRONTER_OF_NIGHTMARES , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title3 = { DEAD_BODY , FROZEN_DEAD_BODY , DREAMBREAKER , MIST_MELTER , DELTA_ENFORCER , OMEGA_OSTRACIZER , ULTIMA_UNDERTAKER , ULMIAS_SOULMATE , TENZENS_ALLY , COMPANION_OF_LOUVERANCE , TRUE_COMPANION_OF_LOUVERANCE , PRISHES_BUDDY , NAGMOLADAS_UNDERLING , ESHANTARLS_COMRADE_IN_ARMS , THE_CHEBUKKIS_WORST_NIGHTMARE , UNQUENCHABLE_LIGHT , WARRIOR_OF_THE_CRYSTAL , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title4 = { ANCIENT_FLAME_FOLLOWER , TAVNAZIAN_TRAVELER , TRANSIENT_DREAMER , THE_LOST_ONE , TREADER_OF_AN_ICY_PAST , BRANDED_BY_LIGHTNING , SEEKER_OF_THE_LIGHT , AVERTER_OF_THE_APOCALYPSE , BANISHER_OF_EMPTINESS , BREAKER_OF_THE_CHAINS , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title5 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title6 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } local title7 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 } ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(0x0156,npcUtil.genTmask(player,title2),npcUtil.genTmask(player,title3),npcUtil.genTmask(player,title4),npcUtil.genTmask(player,title5),npcUtil.genTmask(player,title6),npcUtil.genTmask(player,title7),1 ,player:getGil()); 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 == 0x0156) then if(option > 0 and option <29) then if (player:delGil(200)) then player:setTitle( title2[option] ) end elseif(option > 256 and option <285) then if (player:delGil(300)) then player:setTitle( title3[option - 256] ) end elseif(option > 512 and option < 541) then if (player:delGil(400)) then player:setTitle( title4[option - 512] ) end end end end;
gpl-3.0
LegionXI/darkstar
scripts/globals/items/plate_of_urchin_sushi_+1.lua
12
1643
----------------------------------------- -- ID: 5160 -- Item: plate_of_urchin_sushi_+1 -- Food Effect: 60Min, All Races ----------------------------------------- -- Health 40 -- Strength 1 -- Vitality 6 -- Accuracy % 16 (cap 76) -- Ranged ACC % 16 (cap 76) ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,3600,5160); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_HP, 40); target:addMod(MOD_STR, 1); target:addMod(MOD_VIT, 6); target:addMod(MOD_FOOD_ACCP, 16); target:addMod(MOD_FOOD_ACC_CAP, 76); target:addMod(MOD_FOOD_RACCP, 16); target:addMod(MOD_FOOD_RACC_CAP, 76); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_HP, 40); target:delMod(MOD_STR, 1); target:delMod(MOD_VIT, 6); target:delMod(MOD_FOOD_ACCP, 16); target:delMod(MOD_FOOD_ACC_CAP, 76); target:delMod(MOD_FOOD_RACCP, 16); target:delMod(MOD_FOOD_RACC_CAP, 76); end;
gpl-3.0
greasydeal/darkstar
scripts/zones/Port_Jeuno/TextIDs.lua
4
3021
-- Variable TextID Description text -- General Texts ITEM_CANNOT_BE_OBTAINED = 6379; -- You cannot obtain the item <item>. Come back after sorting your inventory. ITEM_OBTAINED = 6383; -- Obtained: <item>. GIL_OBTAINED = 6384; -- Obtained <number> gil. KEYITEM_OBTAINED = 6386; -- Obtained key item: <keyitem>. HOMEPOINT_SET = 6627; -- Home point set! FISHING_MESSAGE_OFFSET = 6875; -- You can't fish here. MOGHOUSE_EXIT = 7141; -- You have learned your way through the back alleys of Jeuno! Now you can exit to any area from your residence. WEATHER_DIALOG = 6827; -- Your fate rides on the changing winds of Vana'diel. I can give you insight on the local weather.<Prompt> -- Shop Texts LEYLA_SHOP_DIALOG = 6987; -- Hello. All goods are duty-free. GEKKO_SHOP_DIALOG = 6987; -- Hello. All goods are duty-free. CHALLOUX_SHOP_DIALOG = 6988; -- Good day! -- Other Texts GUIDE_STONE = 6986; -- Up: Lower Jeuno (Selection Dialogfacing Bastok) Down: Qufim Island CUMETOUFLAIX_DIALOG = 7026; -- This underground tunnel leads to the island of Qufim. Everyone is advised to stay out. But of course you adventurers never listen. OLD_BOX = 7261; -- You find a grimy old box. ITEM_DELIVERY_DIALOG = 7348; -- Delivering goods to residences everywhere! VEUJAIE_DIALOG = 7348; -- Delivering goods to residences everywhere! DIGAGA_DIALOG = 7348; -- Delivering goods to residences everywhere! CHEST_IS_EMPTY = 8622; -- The chest is empty. -- Conquest system CONQUEST = 7358; -- You've earned conquest points! -- NPC Dialog TSOLAG_DIALOG = 7347; -- This is the departure gate for airship passengers. If you have any questions, please inquire with Guddal. GAVIN_DIALOG = 7329; -- This is the counter for the air route to the Outlands. Our airships connect Jeuno with the southeastern island of Elshimo. DAPOL_DIALOG = 7057; -- Welcome to Port Jeuno, the busiest airship hub anywhere! You can't miss the awe-inspiring view of airships in flight! SECURITY_DIALOG = 7060; -- Port Jeuno must remain secure. After all, if anything happened to the archduke, it would change the world! ARRIVAL_NPC = 7044; -- Enjoy your stay in Jeuno! COUNTER_NPC = 7034; -- I think the airships are a subtle form of pressure on the other three nations. That way, Jeuno can maintain the current balance of power. COUNTER_NPC_2 = 7032; -- With the airships connecting Jeuno with the three nations, the flow of goods has become much more consistent. Nowadays, everything comes through Jeuno! CHOCOBO_DIALOG = 7163; -- ... GET_LOST = 8123; -- You want somethin' from me? Well, too bad. I don't want nothin' from you. Get lost. DRYEYES_1 = 8132; -- Then why you waste my time? Get lost DRYEYES_2 = 8133; -- Done deal. Deal is done. DRYEYES_3 = 8134; -- Hey, you already got . What you tryin' to pull here? Save some for my other customers, eh -- conquest Base CONQUEST_BASE = 6466; -- Tallying conquest results...
gpl-3.0
greasydeal/darkstar
scripts/globals/items/quus.lua
17
1313
----------------------------------------- -- ID: 5793 -- Item: quus -- Food Effect: 5Min, Mithra only ----------------------------------------- -- Dexterity 2 -- Mind -4 ----------------------------------------- require("scripts/globals/status"); ----------------------------------------- -- OnItemCheck ----------------------------------------- function onItemCheck(target) local result = 0; if (target:getRace() ~= 7) then result = 247; end if(target:getMod(MOD_EAT_RAW_FISH) == 1) then result = 0; end if (target:hasStatusEffect(EFFECT_FOOD) == true or target:hasStatusEffect(EFFECT_FIELD_SUPPORT_FOOD) == true) then result = 246; end return result; end; ----------------------------------------- -- OnItemUse ----------------------------------------- function onItemUse(target) target:addStatusEffect(EFFECT_FOOD,0,0,300,5793); end; ----------------------------------- -- onEffectGain Action ----------------------------------- function onEffectGain(target,effect) target:addMod(MOD_DEX, 2); target:addMod(MOD_MND, -4); end; ----------------------------------------- -- onEffectLose Action ----------------------------------------- function onEffectLose(target,effect) target:delMod(MOD_DEX, 2); target:delMod(MOD_MND, -4); end;
gpl-3.0
whd/data-pipeline
hindsight/io_modules/derived_stream/tsv.lua
5
1274
-- This Source Code Form is subject to the terms of the Mozilla Public -- License, v. 2.0. If a copy of the MPL was not distributed with this -- file, You can obtain one at http://mozilla.org/MPL/2.0/. local M = {} local ipairs = ipairs local tostring = tostring local type = type local read_message = read_message local encode_message = encode_message local gsub = require "string".gsub setfenv(1, M) -- Remove external access to contain everything in the module local esc_chars = { ["\t"] = "\\t", ["\r"] = "\\r", ["\n"] = "\\n", ["\\"] = "\\\\" } function esc_str(v) return gsub(v, "[\t\r\n\\]", esc_chars) end function write_message(fh, schema, nil_value) for i,v in ipairs(schema) do local value if type(v[5]) == "function" then value = v[5]() elseif type(v[5]) == "string" then value = read_message(v[5]) end if value == nil then value = nil_value else value = tostring(value) end if v[2] == "CHAR" or v[2] == "VARCHAR" then value = esc_str(value) end if i > 1 then fh:write("\t", value) else fh:write(value) end end fh:write("\n") end return M
mpl-2.0
LegionXI/darkstar
scripts/globals/weaponskills/ukkos_fury.lua
19
1877
----------------------------------- -- Ukko's Fury -- Great Axe Weapon Skill -- Skill Level: N/A -- Description: Delivers a twofold attack that slows target. Chance of params.critical hit varies with TP. Ukonvasara: Aftermath. -- Available only when equipped with Ukonvasara (85), Ukonvasara (90), Ukonvasara (95), Maschu +1, Maschu +2. -- Aligned with the Light Gorget, Breeze Gorget & Thunder Gorget. -- Aligned with the Light Belt, Breeze Belt & Thunder Belt. -- Element: None -- Skillchain Properties: Light/Fragmentation -- Modifiers: STR:80% -- Damage Multipliers by TP: -- 100%TP 200%TP 300%TP -- 2.0 2.0 2.0 -- params.critical Chance added with TP: -- 100%TP 200%TP 300%TP -- 20% 35% 55% ----------------------------------- require("scripts/globals/status"); require("scripts/globals/settings"); require("scripts/globals/weaponskills"); ----------------------------------- function onUseWeaponSkill(player, target, wsID, tp, primary, action, taChar) local params = {}; params.numHits = 2; params.ftp100 = 2; params.ftp200 = 2; params.ftp300 = 2; params.str_wsc = 0.6; params.dex_wsc = 0.0; params.vit_wsc = 0.0; params.agi_wsc = 0.0; params.int_wsc = 0.0; params.mnd_wsc = 0.0; params.chr_wsc = 0.0; params.crit100 = 0.20; params.crit200 = 0.35; params.crit300 = 0.55; params.canCrit = true; params.acc100 = 0.0; params.acc200= 0.0; params.acc300= 0.0; params.atkmulti = 1; local damage, criticalHit, tpHits, extraHits = doPhysicalWeaponskill(player, target, wsID, tp, primary, action, taChar, params); if (USE_ADOULIN_WEAPON_SKILL_CHANGES == true) then params.str_wsc = 0.8; end if (damage > 0 and target:hasStatusEffect(EFFECT_SLOW) == false) then target:addStatusEffect(EFFECT_SLOW, 150, 0, 60); end return tpHits, extraHits, criticalHit, damage; end
gpl-3.0
alerque/sile
languages/jv.lua
1
2022
local lpeg = require("lpeg") local types = { "Bi", "Bi","CSR", "Vs", "VI", "VI", "VI", "VI", "VI", "C", "C", "C", "VI", "VI", "VI", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "C", "N", "M", "M", "M", "M", "M", "M", "M", "M", "M", "CS", "CM", "CM", "V", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "x", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "Nd", "x", "x", "x", "x", "x", "x" } local jv = {} local P8 = function (c) return lpeg.P(luautf8.char(c)) end for i = 1, #types do local cp = i - 1 + 0xA980 local match = P8(cp) jv[types[i]] = jv[types[i]] and (jv[types[i]]+match) or match end jv.medial_ra = P8(0xA9BF) jv.medial_ya = P8(0xA9BE) jv.tarung = P8(0xA9B4) jv.consonant = ((jv.C * jv.N) + jv.C + jv.VI) jv.consonant_sign = jv.Bi + jv.CSR + jv.Vs + jv.CM jv.syllable = (jv.consonant * jv.V)^-1 * jv.consonant * ((jv.medial_ra^-1) * jv.medial_ya)^-1 * (jv.M * jv.tarung^-1)^-1 * jv.consonant_sign^0 SILE.nodeMakers.jv = pl.class(SILE.nodeMakers.unicode) function SILE.nodeMakers.jv:iterator (items) return coroutine.wrap(function () local chunk = "" for i = 1, #items do local char = items[i].text chunk = chunk .. char end local i = 1 local total = 0 while total < #chunk do local syll = (lpeg.P(total) * lpeg.C(jv.syllable)):match(chunk) if syll then while i < #items do if items[i].index >= total + #syll then break end self:addToken(items[i].text, items[i]) i = i + 1 end total = total + #syll self:makeToken() self:makePenalty(0) else self:dealWith(items[i]) i = i + 1 if i > #items then break end total = items[i].index end end self:makeToken() end) end
mit
LegionXI/darkstar
scripts/zones/Jugner_Forest/Zone.lua
11
4038
----------------------------------- -- -- Zone: Jugner_Forest (104) -- ----------------------------------- package.loaded[ "scripts/zones/Jugner_Forest/TextIDs"] = nil; package.loaded["scripts/globals/chocobo_digging"] = nil; ----------------------------------- require("scripts/zones/Jugner_Forest/TextIDs"); require("scripts/globals/zone"); require("scripts/globals/icanheararainbow"); require("scripts/globals/conquest"); require("scripts/globals/chocobo_digging"); ----------------------------------- -- Chocobo Digging vars ----------------------------------- local itemMap = { -- itemid, abundance, requirement { 4504, 152, DIGREQ_NONE }, { 688, 182, DIGREQ_NONE }, { 697, 83, DIGREQ_NONE }, { 4386, 3, DIGREQ_NONE }, { 17396, 129, DIGREQ_NONE }, { 691, 144, DIGREQ_NONE }, { 918, 8, DIGREQ_NONE }, { 699, 76, DIGREQ_NONE }, { 4447, 38, DIGREQ_NONE }, { 695, 45, DIGREQ_NONE }, { 4096, 100, DIGREQ_NONE }, -- all crystals { 690, 15, DIGREQ_BORE }, { 1446, 8, DIGREQ_BORE }, { 702, 23, DIGREQ_BORE }, { 701, 8, DIGREQ_BORE }, { 696, 30, DIGREQ_BORE }, { 4570, 10, DIGREQ_MODIFIER }, { 4487, 11, DIGREQ_MODIFIER }, { 4409, 12, DIGREQ_MODIFIER }, { 1188, 10, DIGREQ_MODIFIER }, { 4532, 12, DIGREQ_MODIFIER }, }; local messageArray = { DIG_THROW_AWAY, FIND_NOTHING, ITEM_OBTAINED }; ----------------------------------- -- onChocoboDig ----------------------------------- function onChocoboDig(player, precheck) return chocoboDig(player, itemMap, precheck, messageArray); end; ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) zone:registerRegion(1, -484, 10, 292, 0, 0, 0); -- Sets Mark for "Under Oath" Quest cutscene. -- Fraelissa SetRespawnTime(17203447, 900, 10800); SetRegionalConquestOverseers(zone:getRegionID()); end; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn( player, prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos( 342, -5, 15.117, 169); end if (triggerLightCutscene(player)) then -- Quest: I Can Hear A Rainbow cs = 0x000f; 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) if (region:GetRegionID() == 1) then if (player:getVar("UnderOathCS") == 7) then -- Quest: Under Oath - PLD AF3 player:startEvent(0x000E); end end end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x000f) then lightCutsceneUpdate(player); -- Quest: I Can Hear A Rainbow end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish( player, csid, option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid == 0x000f) then lightCutsceneFinish(player); -- Quest: I Can Hear A Rainbow elseif (csid == 0x000E) then player:setVar("UnderOathCS",8); -- Quest: Under Oath - PLD AF3 end end;
gpl-3.0
alireza1998/mega1
plugins/admin.lua
60
6680
local function set_bot_photo(msg, success, result) local receiver = get_receiver(msg) if success then local file = 'data/photos/bot.jpg' print('File downloaded to:', result) os.rename(result, file) print('File moved to:', file) set_profile_photo(file, ok_cb, false) send_large_msg(receiver, 'Photo changed!', ok_cb, false) redis:del("bot:photo") else print('Error downloading: '..msg.id) send_large_msg(receiver, 'Failed, please try again!', ok_cb, false) end end local function parsed_url(link) local parsed_link = URL.parse(link) local parsed_path = URL.parse_path(parsed_link.path) return parsed_path[2] end local function get_contact_list_callback (cb_extra, success, result) local text = " " for k,v in pairs(result) do if v.print_name and v.id and v.phone then text = text..string.gsub(v.print_name , "_" , " ").." ["..v.id.."] = "..v.phone.."\n" end end local file = io.open("contact_list.txt", "w") file:write(text) file:flush() file:close() send_document("user#id"..cb_extra.target,"contact_list.txt", ok_cb, false)--.txt format local file = io.open("contact_list.json", "w") file:write(json:encode_pretty(result)) file:flush() file:close() send_document("user#id"..cb_extra.target,"contact_list.json", ok_cb, false)--json format end local function user_info_callback(cb_extra, success, result) result.access_hash = nil result.flags = nil result.phone = nil if result.username then result.username = '@'..result.username end result.print_name = result.print_name:gsub("_","") local text = serpent.block(result, {comment=false}) text = text:gsub("[{}]", "") text = text:gsub('"', "") text = text:gsub(",","") if cb_extra.msg.to.type == "chat" then send_large_msg("chat#id"..cb_extra.msg.to.id, text) else send_large_msg("user#id"..cb_extra.msg.to.id, text) end end local function get_dialog_list_callback(cb_extra, success, result) local text = "" for k,v in pairs(result) do if v.peer then if v.peer.type == "chat" then text = text.."group{"..v.peer.title.."}["..v.peer.id.."]("..v.peer.members_num..")" else if v.peer.print_name and v.peer.id then text = text.."user{"..v.peer.print_name.."}["..v.peer.id.."]" end if v.peer.username then text = text.."("..v.peer.username..")" end if v.peer.phone then text = text.."'"..v.peer.phone.."'" end end end if v.message then text = text..'\nlast msg >\nmsg id = '..v.message.id if v.message.text then text = text .. "\n text = "..v.message.text end if v.message.action then text = text.."\n"..serpent.block(v.message.action, {comment=false}) end if v.message.from then if v.message.from.print_name then text = text.."\n From > \n"..string.gsub(v.message.from.print_name, "_"," ").."["..v.message.from.id.."]" end if v.message.from.username then text = text.."( "..v.message.from.username.." )" end if v.message.from.phone then text = text.."' "..v.message.from.phone.." '" end end end text = text.."\n\n" end local file = io.open("dialog_list.txt", "w") file:write(text) file:flush() file:close() send_document("user#id"..cb_extra.target,"dialog_list.txt", ok_cb, false)--.txt format local file = io.open("dialog_list.json", "w") file:write(json:encode_pretty(result)) file:flush() file:close() send_document("user#id"..cb_extra.target,"dialog_list.json", ok_cb, false)--json format end local function run(msg,matches) local data = load_data(_config.moderation.data) local receiver = get_receiver(msg) local group = msg.to.id if not is_admin(msg) then return end if msg.media then if msg.media.type == 'photo' and redis:get("bot:photo") then if redis:get("bot:photo") == 'waiting' then load_photo(msg.id, set_bot_photo, msg) end end end if matches[1] == "setbotphoto" then redis:set("bot:photo", "waiting") return 'Please send me bot photo now' end if matches[1] == "markread" then if matches[2] == "on" then redis:set("bot:markread", "on") return "Mark read > on" end if matches[2] == "off" then redis:del("bot:markread") return "Mark read > off" end return end if matches[1] == "pm" then send_large_msg("user#id"..matches[2],matches[3]) return "Msg sent" end if matches[1] == "block" then if is_admin2(matches[2]) then return "You can't block admins" end block_user("user#id"..matches[2],ok_cb,false) return "User blocked" end if matches[1] == "unblock" then unblock_user("user#id"..matches[2],ok_cb,false) return "User unblocked" end if matches[1] == "import" then--join by group link local hash = parsed_url(matches[2]) import_chat_link(hash,ok_cb,false) end if matches[1] == "contactlist" then get_contact_list(get_contact_list_callback, {target = msg.from.id}) return "I've sent contact list with both json and text format to your private" end if matches[1] == "delcontact" then del_contact("user#id"..matches[2],ok_cb,false) return "User "..matches[2].." removed from contact list" end if matches[1] == "dialoglist" then get_dialog_list(get_dialog_list_callback, {target = msg.from.id}) return "I've sent dialog list with both json and text format to your private" end if matches[1] == "whois" then user_info("user#id"..matches[2],user_info_callback,{msg=msg}) end return end return { usage = { "pm: Send Pm To Priavate Chat.", "block: Block User [id].", "unblock: Unblock User [id].", "markread on: Reads Messages agancy Bot.", "markread off: Don't Reads Messages agancy Bot.", "setbotphoto: Set New Photo For Bot Account.", "contactlist: Send A List Of Bot Contacts.", "dialoglist: Send A Dialog Of Chat.", "delcontact: Delete Contact.", "import: Added Bot In Group With Link.", }, patterns = { "^(pm) (%d+) (.*)$", "^(import) (.*)$", "^(unblock) (%d+)$", "^(block) (%d+)$", "^(markread) (on)$", "^(markread) (off)$", "^(setbotphoto)$", "%[(photo)%]", "^(contactlist)$", "^(dialoglist)$", "^(delcontact) (%d+)$", "^(whois) (%d+)$" }, run = run, }
gpl-2.0
LegionXI/darkstar
scripts/zones/Apollyon/mobs/Cornu.lua
17
1256
----------------------------------- -- Area: Apollyon NE -- NPC: Sirins ----------------------------------- package.loaded["scripts/zones/Apollyon/TextIDs"] = nil; ----------------------------------- require("scripts/globals/limbus"); require("scripts/zones/Apollyon/TextIDs"); ----------------------------------- -- onMobSpawn Action ----------------------------------- function onMobSpawn(mob) end; ----------------------------------- -- onMobEngaged ----------------------------------- function onMobEngaged(mob,target) end; ----------------------------------- -- onMobDeath ----------------------------------- function onMobDeath(mob, player, isKiller) end; ----------------------------------- -- onMobDespawn ----------------------------------- function onMobDespawn(mob) local mobID = mob:getID(); -- print(mobID); local mobX = mob:getXPos(); local mobY = mob:getYPos(); local mobZ = mob:getZPos(); if (mobID ==16933066) then -- time T3 GetNPCByID(16932864+84):setPos(mobX,mobY,mobZ); GetNPCByID(16932864+84):setStatus(STATUS_NORMAL); elseif (mobID ==16933069) then -- recover GetNPCByID(16932864+127):setPos(mobX,mobY,mobZ); GetNPCByID(16932864+127):setStatus(STATUS_NORMAL); end end;
gpl-3.0
destroyerdust/Class-Hall
ClassHall.lua
1
6131
--------------------------------------------- -- Local Ace3 Declarations --------------------------------------------- local name = "ClassHall" ClassHall = LibStub("AceAddon-3.0"):NewAddon(name, "AceConsole-3.0", "AceEvent-3.0") local L = LibStub("AceLocale-3.0"):GetLocale("ClassHall") local icon = LibStub("LibDBIcon-1.0", true) local ldb = LibStub:GetLibrary("LibDataBroker-1.1") local dataobj = ldb:NewDataObject("ClassHall", {label = "ClassHall", type = "data source", icon = "Interface\\Icons\\Spell_Lightning_LightningBolt01", text = "n/a"}) --------------------------------------------- -- Options --------------------------------------------- ClassHall.options = { name = "ClassHall", handler = ClassHall, type = 'group', args = { debug = { type = "toggle", name = L["Enable/Disable Debug"], desc = L["Enables or Disables Debug Printouts"], get = function() return ClassHall.db.profile.debug end, set = function(_, value) ClassHall.db.profile.debug = value end, order = 1, }, icon = { type = "toggle", name = L["Show/Hide Icon"], desc = L["Shows or Hides minimap icon"], get = function() return ClassHall.db.profile.icon.hide end, set = function(_, value) ClassHall.db.profile.icon.hide = value end, order = 1, } }, } --------------------------------------------- -- Message and enable option defaults --------------------------------------------- ClassHall.defaults = { profile = { debug = false, icon = { hide = true, } }, } --------------------------------------------- -- Initilize --------------------------------------------- function ClassHall:OnInitialize() self.db = LibStub("AceDB-3.0"):New("ClassHallDB", self.defaults, true) LibStub("AceConfig-3.0"):RegisterOptionsTable("ClassHall", self.options, {"ClassHall", "ClassHall"}) self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("ClassHall", "ClassHall") --icon:Register("ClassHall", dataobj, self.db.profile.icon) self:RegisterChatCommand("ch", "HideTheIcon") self:RegisterChatCommand("classhall", "ChatCommand") self:Debug("Initialized") end --------------------------------------------- -- Enable Event Registration --------------------------------------------- function ClassHall:OnEnable() -- Minimap button. if icon and not icon:IsRegistered("ClassHall") then icon:Register("ClassHall", dataobj, self.db.profile.icon) end self.db.char.followers = C_Garrison.GetFollowers() self:Debug("OnEnable - Followers Loaded") self:DisableOrderHallBar() self:Debug("OnEnable - Disabled Class Hall Bar") self:Debug("OnEnable - Enabled") end --------------------------------------------- -- OnClick for Minimap Icon & ElvUI Datatext --------------------------------------------- function dataobj:OnClick() GarrisonLandingPage_Toggle() end --------------------------------------------- -- Unregister Events --------------------------------------------- function ClassHall:DisableOrderHallBar() -- Hide Bar local f = CreateFrame("Frame") f:SetScript("OnUpdate", function(self,...) if OrderHallCommandBar then OrderHallCommandBar:Hide() OrderHallCommandBar:UnregisterAllEvents() OrderHallCommandBar.Show = function() end end OrderHall_CheckCommandBar = function () end self:SetScript("OnUpdate", nil) end) self:Debug("DisableOrderHallBar - Disabled Class Hall Bar") end --------------------------------------------- -- Unregister Events --------------------------------------------- function ClassHall:OnDisable() self:Debug("OnDisable - Unregistered Events") end --------------------------------------------- -- Debug Printout Function --------------------------------------------- function ClassHall:Debug(string) if self.db.profile.debug then self:Print(string) end end --------------------------------------------- -- Slash Command Function --------------------------------------------- function ClassHall:HideTheIcon(input) self.db.profile.icon.hide = not self.db.profile.icon.hide if self.db.profile.icon.hide then icon:Hide("ClassHall") else icon:Show("ClassHall") end end --------------------------------------------- -- Slash Command Function --------------------------------------------- function ClassHall:ChatCommand(input) if not input or input:trim() == "" then InterfaceOptionsFrame_OpenToCategory(self.optionsFrame) else LibStub("AceConfigCmd-3.0"):HandleCommand("ch", "ClassHall", input) end end function dataobj:OnEnter() ClassHall:Debug("dataobj:OnEnter - Mouse In") GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetPoint("TOPLEFT", self, "BOTTOMLEFT") GameTooltip:ClearLines() -- Orderhall Resources local name, amount = GetCurrencyInfo(1220) --local name, amount, texturePath, earnedThisWeek, weeklyMax, totalMax, isDiscovered, quality = GetCurrencyInfo(1220) GameTooltip:AddLine("ClassHall Information", 0, 1, 0) GameTooltip:AddLine("Order Resources - " .. amount) ClassHall.db.char.followers = C_Garrison.GetFollowers() ClassHall:Debug("dataobj:OnEnter - Loaded Followers") GameTooltip:AddLine(" ") GameTooltip:AddLine("Followers: ") for i, follower in ipairs(ClassHall.db.char.followers) do --ClassHall:Print(follower.name) if follower.isCollected then if follower.followerTypeID == 4 then if follower.isTroop then GameTooltip:AddLine(follower.name .. " - Durability: " .. follower.durability .. "/" .. follower.maxDurability) else GameTooltip:AddLine(follower.name) end end end end GameTooltip:Show() end function dataobj:OnLeave() GameTooltip:Hide() ClassHall:Debug("dataobj:OnLeave - Mouse Out") end
mit
LegionXI/darkstar
scripts/zones/Abyssea-Konschtat/npcs/qm21.lua
10
1347
----------------------------------- -- Zone: Abyssea-Konschtat -- NPC: qm21 (???) -- Spawns Sarcophilus -- @pos ? ? ? 15 ----------------------------------- require("scripts/globals/status"); ----------------------------------- -- onTrade Action ----------------------------------- function onTrade(player,npc,trade) --[[ if (trade:hasItemQty(2911,1) and trade:getItemCount() == 1) then -- Player has all the required items. if (GetMobAction(16838767) == ACTION_NONE) then -- Mob not already spawned from this SpawnMob(16838767):updateClaim(player); -- Spawn NM, Despawn after inactive for 5 minutes (pt has to reclaim within 5 of a wipe) player:tradeComplete(); end end ]] end; ----------------------------------- -- onTrigger Action ----------------------------------- function onTrigger(player,npc) player:startEvent(1010, 2911); -- Inform payer what items they need. 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
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/EventAssetsManagerEx.lua
11
1975
-------------------------------- -- @module EventAssetsManagerEx -- @extend EventCustom -- @parent_module cc -------------------------------- -- -- @function [parent=#EventAssetsManagerEx] getAssetsManagerEx -- @param self -- @return AssetsManagerEx#AssetsManagerEx ret (return value: cc.AssetsManagerEx) -------------------------------- -- -- @function [parent=#EventAssetsManagerEx] getAssetId -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#EventAssetsManagerEx] getCURLECode -- @param self -- @return int#int ret (return value: int) -------------------------------- -- -- @function [parent=#EventAssetsManagerEx] getMessage -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#EventAssetsManagerEx] getCURLMCode -- @param self -- @return int#int ret (return value: int) -------------------------------- -- -- @function [parent=#EventAssetsManagerEx] getPercentByFile -- @param self -- @return float#float ret (return value: float) -------------------------------- -- -- @function [parent=#EventAssetsManagerEx] getEventCode -- @param self -- @return int#int ret (return value: int) -------------------------------- -- -- @function [parent=#EventAssetsManagerEx] getPercent -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Constructor -- @function [parent=#EventAssetsManagerEx] EventAssetsManagerEx -- @param self -- @param #string eventName -- @param #cc.AssetsManagerEx manager -- @param #int code -- @param #float percent -- @param #float percentByFile -- @param #string assetId -- @param #string message -- @param #int curle_code -- @param #int curlm_code -- @return EventAssetsManagerEx#EventAssetsManagerEx self (return value: cc.EventAssetsManagerEx) return nil
mit
evrooije/beerarchy
mods/00_bt_mobs/fishing/prizes.lua
2
3645
fishing_setting.prizes["rivers"] = {} fishing_setting.prizes["rivers"]["little"] = { {"fishing", "fish_raw", 0, "a Fish."}, {"fishing", "carp_raw", 0, "a Carp."}, } fishing_setting.prizes["rivers"]["big"] = { {"fishing", "pike_raw", 0, "a Northern Pike."}, {"fishing", "perch_raw", 0, "a Perch."}, {"fishing", "catfish_raw", 0, "a Catfish."}, } fishing_setting.prizes["sea"] = {} fishing_setting.prizes["sea"]["little"] = { {"fishing", "clownfish_raw", 0, "a Clownfish."}, {"fishing", "bluewhite_raw", 0, "a Bluewhite."}, {"fishing", "exoticfish_raw", 0, "a Exoticfish."}, } fishing_setting.prizes["sea"]["big"] = { {"fishing", "shark_raw", 0, "a small Shark."}, } if (minetest.get_modpath("flowers_plus")) then -- exception flowers_plus register flowers:* minetest.register_alias("flowers_plus:seaweed", "flowers:seaweed") end local stuff = { -- mod item wear message ("You caught "..) chance {"flowers_plus", "seaweed", 0, "some Seaweed.", 10}, {"farming", "string", 0, "a String.", 5}, {"trunks", "twig_1", 0, "a Twig.", 5}, {"mobs", "rat", 0, "a Rat.", 5}, {"default", "stick", 0, "a Twig.", 5}, {"seaplants", "kelpgreen", 0, "a Green Kelp.", 5}, {"3d_armor", "boots_steel", "random", "some very old Boots.", 2}, {"3d_armor", "leggings_gold", "random", "some very old Leggings.", 5}, {"3d_armor", "chestplate_bronze", "random", "a very old ChestPlate.", 5}, {"fishing", "pole_wood", "randomtools", "an old Fishing Pole.", 10}, {"3d_armor", "boots_wood", "random", "some very old Boots.", 5}, {"maptools", "gold_coin", 0, "a Gold Coin.", 1}, {"3d_armor", "helmet_diamond", "random", "a very old Helmet.", 1}, {"shields", "shield_enhanced_cactus", "random", "a very old Shield.", 2}, {"default", "sword_bronze", "random", "a very old Sword.", 2}, {"default", "sword_mese", "random", "a very old Sword.", 2}, {"default", "sword_nyan", "random", "a very old Sword.", 2}, } fishing_setting.prizes["stuff"] = {} local nrmin = 1 for i,v in ipairs(stuff) do if minetest.get_modpath(v[1]) ~= nil and minetest.registered_items[v[1]..":"..v[2]] ~= nil then table.insert(fishing_setting.prizes["stuff"], {v[1], v[2], v[3], v[4], nrmin, v[5]}) nrmin = nrmin + v[5] end end local treasure = { {"default", "mese", 0, "a mese block."}, {"default", "nyancat", 0, "a Nyan Cat."}, {"default", "diamondblock", 0, "a Diamond Block."}, } fishing_setting.prizes["treasure"] = fishing_setting.func.ignore_mod(treasure) -- to true fish mobs fishing_setting.prizes["true_fish"] = {little = {}, big = {}} --to mobs_fish modpack if (minetest.get_modpath("mobs_fish")) then fishing_setting.prizes["true_fish"]["little"]["mobs_fish:clownfish"] = {"mobs_fish", "clownfish", 0, "a Clownfish."} fishing_setting.prizes["true_fish"]["little"]["mobs_fish:tropical"] = {"mobs_fish", "tropical", 0, "a tropical fish."} end --to mobs_fish modpack if (minetest.get_modpath("mobs_sharks")) then fishing_setting.prizes["true_fish"]["big"]["mobs_sharks:shark_lg"] = {"mobs_sharks", "shark_lg", 0, "a small Shark."} fishing_setting.prizes["true_fish"]["big"]["mobs_sharks:shark_md"] = {"mobs_sharks", "shark_md", 0, "a small Shark."} fishing_setting.prizes["true_fish"]["big"]["mobs_sharks:shark_sm"] = {"mobs_sharks", "shark_sm", 0, "a small Shark."} end
lgpl-2.1
LegionXI/darkstar
scripts/zones/Grand_Palace_of_HuXzoi/Zone.lua
20
4585
----------------------------------- -- -- Zone: Grand_Palace_of_HuXzoi (34) -- ----------------------------------- package.loaded["scripts/zones/Grand_Palace_of_HuXzoi/TextIDs"] = nil; ----------------------------------- require("scripts/globals/settings"); require("scripts/zones/Grand_Palace_of_HuXzoi/TextIDs"); require("scripts/zones/Grand_Palace_of_HuXzoi/MobIDs"); ----------------------------------- -- onInitialize ----------------------------------- function onInitialize(zone) zone:registerRegion(1, -102, -4, 541, -97, 4, 546); -- elvaan tower L-6 52?? zone:registerRegion(2, 737, -4, 541, 742, 4, 546); -- elvaan tower L-6 52?? zone:registerRegion(3, 661, -4, 87, 667, 4, 103); zone:registerRegion(4, -178, -4, 97, -173, 4, 103); zone:registerRegion(5, 340, -4, 97, 347, 4, 102); zone:registerRegion(6, -497, -4, 97, -492, 4, 102); zone:registerRegion(7, 97, -4, 372, 103, 4, 378); zone:registerRegion(8, -742, -4, 372, -736, 4, 379); zone:registerRegion(9, 332, -4, 696, 338, 4, 702); zone:registerRegion(10, -507, -4, 697, -501, 4, 702); -- Give Temperance a random PH local JoT_PH = math.random(1,5); SetServerVariable("[SEA]Jailer_of_Temperance_PH", Jailer_of_Temperance_PH[JoT_PH]); 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; ----------------------------------- -- onZoneIn ----------------------------------- function onZoneIn(player,prevZone) local cs = -1; if (player:getXPos() == 0 and player:getYPos() == 0 and player:getZPos() == 0) then player:setPos(-20,-1.5,-355.482,192); end player:setVar("Hu-Xzoi-TP",0); return cs; end; ----------------------------------- -- afterZoneIn ----------------------------------- function afterZoneIn(player) player:entityVisualPacket("door"); player:entityVisualPacket("dtuk"); player:entityVisualPacket("2dor"); player:entityVisualPacket("cryq"); end; ----------------------------------- -- onRegionEnter ----------------------------------- function onRegionEnter(player,region) if (player:getVar("Hu-Xzoi-TP") == 0 and player:getAnimation() == 0) then -- prevent 2cs at same time switch (region:GetRegionID()): caseof { [1] = function (x) player:startEvent(0x0097); end, [2] = function (x) player:startEvent(0x009c); end, [3] = function (x) player:startEvent(0x009D); end, [4] = function (x) player:startEvent(0x0098); end, [5] = function (x) player:startEvent(0x009E); end, [6] = function (x) player:startEvent(0x0099); end, [7] = function (x) player:startEvent(0x009F); end, [8] = function (x) player:startEvent(0x009A); end, [9] = function (x) player:startEvent(0x009B); end, [10] = function (x) player:startEvent(0x0096); end, } end end; ----------------------------------- -- onRegionLeave ----------------------------------- function onRegionLeave(player,region) end; ----------------------------------- -- onEventUpdate ----------------------------------- function onEventUpdate(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid >0x0095 and csid < 0x00A0) then player:setVar("Hu-Xzoi-TP",1); end end; ----------------------------------- -- onEventFinish ----------------------------------- function onEventFinish(player,csid,option) -- printf("CSID: %u",csid); -- printf("RESULT: %u",option); if (csid >0x0095 and csid < 0x00A0) then player:setVar("Hu-Xzoi-TP",0); end end; ----------------------------------- -- onGameHour ----------------------------------- function onGameHour(npc, mob, player) local VanadielHour = VanadielHour(); if (VanadielHour % 6 == 0) then -- Change the Jailer of Temperance PH every 6 hours (~15 mins). JoT_ToD = GetServerVariable("[SEA]Jailer_of_Temperance_POP"); if (GetMobAction(Jailer_of_Temperance) == 0 and JoT_ToD <= os.time(t)) then -- Don't want to set a PH if it's already up; also making sure it's been 15 mins since it died last local JoT_PH = math.random(1,5); SetServerVariable("[SEA]Jailer_of_Temperance_PH", Jailer_of_Temperance_PH[JoT_PH]); end end end;
gpl-3.0
lache/RacingKingLee
crazyclient/frameworks/cocos2d-x/cocos/scripting/lua-bindings/auto/api/PageView.lua
2
6202
-------------------------------- -- @module PageView -- @extend Layout -- @parent_module ccui -------------------------------- -- brief Query the custom scroll threshold of the PageView.<br> -- return Custom scroll threshold in float. -- @function [parent=#PageView] getCustomScrollThreshold -- @param self -- @return float#float ret (return value: float) -------------------------------- -- Gets current displayed page index.<br> -- return current page index. -- @function [parent=#PageView] getCurPageIndex -- @param self -- @return long#long ret (return value: long) -------------------------------- -- Add a widget as a page of PageView in a given index.<br> -- param widget Widget to be added to pageview.<br> -- param pageIdx A given index.<br> -- param forceCreate If `forceCreate` is true and `widget` isn't exists, pageview would create a default page and add it. -- @function [parent=#PageView] addWidgetToPage -- @param self -- @param #ccui.Widget widget -- @param #long pageIdx -- @param #bool forceCreate -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- brief Query whether use user defined scroll page threshold or not.<br> -- return True if using custom scroll threshold, false otherwise. -- @function [parent=#PageView] isUsingCustomScrollThreshold -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- brief Get a page at a given index<br> -- param index A given index.<br> -- return A layout pointer in PageView container. -- @function [parent=#PageView] getPage -- @param self -- @param #long index -- @return Layout#Layout ret (return value: ccui.Layout) -------------------------------- -- Remove a page of PageView.<br> -- param page Page to be removed. -- @function [parent=#PageView] removePage -- @param self -- @param #ccui.Layout page -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- brief Add a page turn callback to PageView, then when one page is turning, the callback will be called.<br> -- param callback A page turning callback. -- @function [parent=#PageView] addEventListener -- @param self -- @param #function callback -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- brief Set using user defined scroll page threshold or not.<br> -- If you set it to false, then the default scroll threshold is pageView.width / 2<br> -- param flag True if using custom scroll threshold, false otherwise. -- @function [parent=#PageView] setUsingCustomScrollThreshold -- @param self -- @param #bool flag -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- brief If you don't specify the value, the pageView will turn page when scrolling at the half width of a page.<br> -- param threshold A threshold in float. -- @function [parent=#PageView] setCustomScrollThreshold -- @param self -- @param #float threshold -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- Insert a page into PageView at a given index.<br> -- param page Page to be inserted.<br> -- param idx A given index. -- @function [parent=#PageView] insertPage -- @param self -- @param #ccui.Layout page -- @param #int idx -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- Scroll to a page with a given index.<br> -- param idx A given index in the PageView. -- @function [parent=#PageView] scrollToPage -- @param self -- @param #long idx -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- Remove a page at a given index of PageView.<br> -- param index A given index. -- @function [parent=#PageView] removePageAtIndex -- @param self -- @param #long index -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- brief Get all the pages in the PageView.<br> -- return A vector of Layout pionters. -- @function [parent=#PageView] getPages -- @param self -- @return array_table#array_table ret (return value: array_table) -------------------------------- -- brief Remove all pages of the PageView. -- @function [parent=#PageView] removeAllPages -- @param self -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- Insert a page into the end of PageView.<br> -- param page Page to be inserted. -- @function [parent=#PageView] addPage -- @param self -- @param #ccui.Layout page -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- Create an empty PageView.<br> -- return A PageView instance. -- @function [parent=#PageView] create -- @param self -- @return PageView#PageView ret (return value: ccui.PageView) -------------------------------- -- -- @function [parent=#PageView] createInstance -- @param self -- @return Ref#Ref ret (return value: cc.Ref) -------------------------------- -- -- @function [parent=#PageView] getLayoutType -- @param self -- @return int#int ret (return value: int) -------------------------------- -- -- @function [parent=#PageView] getDescription -- @param self -- @return string#string ret (return value: string) -------------------------------- -- -- @function [parent=#PageView] update -- @param self -- @param #float dt -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- -- @function [parent=#PageView] init -- @param self -- @return bool#bool ret (return value: bool) -------------------------------- -- -- @function [parent=#PageView] setLayoutType -- @param self -- @param #int type -- @return PageView#PageView self (return value: ccui.PageView) -------------------------------- -- Default constructor<br> -- js ctor<br> -- lua new -- @function [parent=#PageView] PageView -- @param self -- @return PageView#PageView self (return value: ccui.PageView) return nil
mit
edwinhollen/StationIsLife
src/utf8.lua
1
7645
-- $Id: utf8.lua 179 2009-04-03 18:10:03Z pasta $ -- -- Provides UTF-8 aware string functions implemented in pure lua: -- * string.utf8len(s) -- * string.utf8sub(s, i, j) -- * string.utf8reverse(s) -- -- If utf8data.lua (containing the lower<->upper case mappings) is loaded, these -- additional functions are available: -- * string.utf8upper(s) -- * string.utf8lower(s) -- -- All functions behave as their non UTF-8 aware counterparts with the exception -- that UTF-8 characters are used instead of bytes for all units. --[[ Copyright (c) 2006-2007, Kyle Smith All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the author nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --]] -- ABNF from RFC 3629 -- -- UTF8-octets = *( UTF8-char ) -- UTF8-char = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4 -- UTF8-1 = %x00-7F -- UTF8-2 = %xC2-DF UTF8-tail -- UTF8-3 = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / -- %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) -- UTF8-4 = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / -- %xF4 %x80-8F 2( UTF8-tail ) -- UTF8-tail = %x80-BF -- -- returns the number of bytes used by the UTF-8 character at byte i in s -- also doubles as a UTF-8 character validator local function utf8charbytes (s, i) -- argument defaults i = i or 1 -- argument checking if type(s) ~= "string" then error("bad argument #1 to 'utf8charbytes' (string expected, got ".. type(s).. ")") end if type(i) ~= "number" then error("bad argument #2 to 'utf8charbytes' (number expected, got ".. type(i).. ")") end local c = s:byte(i) -- determine bytes needed for character, based on RFC 3629 -- validate byte 1 if c > 0 and c <= 127 then -- UTF8-1 return 1 elseif c >= 194 and c <= 223 then -- UTF8-2 local c2 = s:byte(i + 1) if not c2 then error("UTF-8 string terminated early") end -- validate byte 2 if c2 < 128 or c2 > 191 then error("Invalid UTF-8 character") end return 2 elseif c >= 224 and c <= 239 then -- UTF8-3 local c2 = s:byte(i + 1) local c3 = s:byte(i + 2) if not c2 or not c3 then error("UTF-8 string terminated early") end -- validate byte 2 if c == 224 and (c2 < 160 or c2 > 191) then error("Invalid UTF-8 character") elseif c == 237 and (c2 < 128 or c2 > 159) then error("Invalid UTF-8 character") elseif c2 < 128 or c2 > 191 then error("Invalid UTF-8 character") end -- validate byte 3 if c3 < 128 or c3 > 191 then error("Invalid UTF-8 character") end return 3 elseif c >= 240 and c <= 244 then -- UTF8-4 local c2 = s:byte(i + 1) local c3 = s:byte(i + 2) local c4 = s:byte(i + 3) if not c2 or not c3 or not c4 then error("UTF-8 string terminated early") end -- validate byte 2 if c == 240 and (c2 < 144 or c2 > 191) then error("Invalid UTF-8 character") elseif c == 244 and (c2 < 128 or c2 > 143) then error("Invalid UTF-8 character") elseif c2 < 128 or c2 > 191 then error("Invalid UTF-8 character") end -- validate byte 3 if c3 < 128 or c3 > 191 then error("Invalid UTF-8 character") end -- validate byte 4 if c4 < 128 or c4 > 191 then error("Invalid UTF-8 character") end return 4 else error("Invalid UTF-8 character") end end -- returns the number of characters in a UTF-8 string local function utf8len (s) -- argument checking if type(s) ~= "string" then error("bad argument #1 to 'utf8len' (string expected, got ".. type(s).. ")") end local pos = 1 local bytes = s:len() local len = 0 while pos <= bytes do len = len + 1 pos = pos + utf8charbytes(s, pos) end return len end -- functions identically to string.sub except that i and j are UTF-8 characters -- instead of bytes local function utf8sub (s, i, j) -- argument defaults j = j or -1 local pos = 1 local bytes = s:len() local len = 0 -- only set l if i or j is negative local l = (i >= 0 and j >= 0) or s:utf8len() local startChar = (i >= 0) and i or l + i + 1 local endChar = (j >= 0) and j or l + j + 1 -- can't have start before end! if startChar > endChar then return "" end -- byte offsets to pass to string.sub local startByte, endByte = 1, bytes while pos <= bytes do len = len + 1 if len == startChar then startByte = pos end pos = pos + utf8charbytes(s, pos) if len == endChar then endByte = pos - 1 break end end return s:sub(startByte, endByte) end -- replace UTF-8 characters based on a mapping table local function utf8replace (s, mapping) -- argument checking if type(s) ~= "string" then error("bad argument #1 to 'utf8replace' (string expected, got ".. type(s).. ")") end if type(mapping) ~= "table" then error("bad argument #2 to 'utf8replace' (table expected, got ".. type(mapping).. ")") end local pos = 1 local bytes = s:len() local charbytes local newstr = "" while pos <= bytes do charbytes = utf8charbytes(s, pos) local c = s:sub(pos, pos + charbytes - 1) newstr = newstr .. (mapping[c] or c) pos = pos + charbytes end return newstr end -- identical to string.upper except it knows about unicode simple case conversions local function utf8upper (s) return utf8replace(s, utf8_lc_uc) end -- identical to string.lower except it knows about unicode simple case conversions local function utf8lower (s) return utf8replace(s, utf8_uc_lc) end -- identical to string.reverse except that it supports UTF-8 local function utf8reverse (s) -- argument checking if type(s) ~= "string" then error("bad argument #1 to 'utf8reverse' (string expected, got ".. type(s).. ")") end local bytes = s:len() local pos = bytes local charbytes local newstr = "" while pos > 0 do c = s:byte(pos) while c >= 128 and c <= 191 do pos = pos - 1 c = s:byte(pos) end charbytes = utf8charbytes(s, pos) newstr = newstr .. s:sub(pos, pos + charbytes - 1) pos = pos - 1 end return newstr end string.utf8len = utf8len string.utf8sub = utf8sub string.utf8reverse = utf8reverse
gpl-3.0
naclander/tome
game/modules/tome/data/gfx/shockbolt/attachements.lua
1
40371
tiles={} dolls={} tiles["npc/humanoid_shalore_elven_guard.png"] = { base=64, feet = {x=33, y=61}, belly = {x=32, y=28}, hand1 = {x=13, y=31}, back = {x=32, y=15}, head = {x=31, y=5}, } tiles["npc/humanoid_player_default.png"] = { base=64, feet = {x=33, y=60}, hand1 = {x=21, y=35}, hand2 = {x=44, y=36}, back = {x=32, y=14}, belly = {x=33, y=28}, head = {x=32, y=5}, } tiles["npc/humanoid_human_high_gladiator.png"] = { base=64, feet = {x=30, y=61}, hand1 = {x=8, y=13}, hand2 = {x=55, y=33}, belly = {x=33, y=30}, back = {x=34, y=17}, head = {x=30, y=7}, } tiles["npc/humanoid_shalore_elvala_guard.png"] = { base=64, feet = {x=32, y=61}, belly = {x=31, y=27}, hand1 = {x=13, y=30}, back = {x=31, y=15}, head = {x=31, y=5}, } tiles["npc/humanoid_naga_slasul.png"] = { base=64, feet = {x=32, y=61}, hand1 = {x=11, y=30}, hand2 = {x=46, y=-2}, back = {x=23, y=3}, belly = {x=23, y=14}, head = {x=24, y=-12}, } tiles["npc/humanoid_human_human_citizen.png"] = { base=64, feet = {x=35, y=59}, hand1 = {x=11, y=13}, hand2 = {x=47, y=30}, belly = {x=36, y=28}, back = {x=36, y=16}, head = {x=36, y=5}, } tiles["npc/humanoid_yeek_yeek_psionic.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=31, y=38}, hand2 = {x=33, y=38}, back = {x=32, y=23}, belly = {x=32, y=34}, head = {x=32, y=12}, } tiles["npc/humanoid_orc_vor__grand_geomancer_of_the_pride.png"] = { base=64, feet = {x=32, y=60}, hand1 = {x=4, y=34}, hand2 = {x=58, y=39}, back = {x=33, y=20}, belly = {x=32, y=35}, head = {x=34, y=9}, } tiles["npc/humanoid_human_ziguranth_wyrmic.png"] = { base=64, feet = {x=32, y=59}, hand1 = {x=12, y=32}, hand2 = {x=51, y=34}, back = {x=32, y=16}, belly = {x=33, y=30}, head = {x=32, y=4}, } tiles["npc/humanoid_shalore_elven_warrior.png"] = { base=64, feet = {x=32, y=61}, belly = {x=31, y=26}, hand1 = {x=13, y=31}, back = {x=31, y=14}, head = {x=31, y=5}, } tiles["npc/humanoid_shalore_elandar.png"] = { base=64, feet = {x=34, y=59}, hand1 = {x=13, y=26}, hand2 = {x=50, y=-12}, back = {x=30, y=8}, belly = {x=33, y=22}, head = {x=29, y=-2}, } tiles["npc/humanoid_human_high_sun_paladin_rodmour.png"] = { base=64, feet = {x=32, y=59}, hand1 = {x=12, y=35}, hand2 = {x=48, y=36}, belly = {x=32, y=29}, back = {x=32, y=15}, head = {x=32, y=3}, } dolls.race_runic_golem = dolls.race_runic_golem or {} dolls.race_runic_golem.all = { base=64, feet = {x=54, y=43}, hand1 = {x=29, y=18}, hand2 = {x=22, y=28}, back = {x=28, y=48}, belly = {x=43, y=49}, head = {x=39, y=29}, } tiles["npc/humanoid_human_assassin_lord.png"] = { base=64, feet = {x=35, y=61}, hand1 = {x=10, y=10}, hand2 = {x=56, y=34}, belly = {x=32, y=28}, back = {x=31, y=16}, head = {x=32, y=5}, } tiles["npc/humanoid_human_rogue.png"] = { base=64, feet = {x=36, y=58}, hand1 = {x=8, y=36}, hand2 = {x=55, y=29}, back = {x=30, y=21}, belly = {x=30, y=31}, head = {x=27, y=7}, } tiles["npc/humanoid_dwarf_norgan.png"] = { base=64, feet = {x=41, y=57}, hand1 = {x=15, y=40}, hand2 = {x=47, y=19}, belly = {x=35, y=37}, back = {x=32, y=23}, head = {x=27, y=8}, } dolls.race_human = dolls.race_human or {} dolls.race_human.male = { base=64, feet = {x=32, y=60}, hand1 = {x=15, y=32}, hand2 = {x=48, y=34}, back = {x=32, y=15}, belly = {x=32, y=28}, head = {x=30, y=3}, } tiles["npc/humanoid_yaech_murgol__the_yaech_lord.png"] = { base=64, feet = {x=56, y=58}, hand1 = {x=7, y=28}, hand2 = {x=20, y=32}, back = {x=38, y=31}, belly = {x=38, y=39}, head = {x=32, y=16}, } tiles["npc/humanoid_human_the_possessed.png"] = { base=64, feet = {x=30, y=62}, hand1 = {x=9, y=17}, hand2 = {x=47, y=37}, back = {x=33, y=17}, belly = {x=33, y=35}, head = {x=33, y=4}, } tiles["npc/humanoid_halfling_master_slinger.png"] = { base=64, feet = {x=39, y=59}, hand1 = {x=15, y=42}, hand2 = {x=47, y=10}, belly = {x=32, y=38}, back = {x=31, y=27}, head = {x=28, y=14}, } tiles["npc/humanoid_thalore_mindworm.png"] = { base=64, feet = {x=32, y=62}, hand1 = {x=21, y=36}, hand2 = {x=44, y=35}, back = {x=31, y=13}, belly = {x=32, y=30}, head = {x=31, y=6}, } tiles["npc/humanoid_shalore_grand_corruptor.png"] = { base=64, feet = {x=25, y=61}, hand1 = {x=11, y=34}, hand2 = {x=53, y=17}, back = {x=28, y=19}, belly = {x=28, y=31}, head = {x=28, y=10}, } tiles["npc/humanoid_human_harno__herald_of_last_hope.png"] = { base=64, feet = {x=32, y=61}, hand1 = {x=16, y=37}, hand2 = {x=45, y=36}, belly = {x=31, y=31}, back = {x=30, y=15}, head = {x=29, y=4}, } tiles["npc/humanoid_human_slave_combatant.png"] = { base=64, feet = {x=33, y=60}, hand1 = {x=18, y=37}, hand2 = {x=47, y=32}, back = {x=30, y=17}, belly = {x=31, y=29}, head = {x=29, y=6}, } dolls.race_elf = dolls.race_elf or {} dolls.race_elf.male = { base=64, feet = {x=32, y=61}, hand1 = {x=19, y=32}, hand2 = {x=44, y=34}, back = {x=32, y=15}, belly = {x=33, y=27}, head = {x=30, y=4}, } tiles["npc/humanoid_male_sluttymaid.png"] = { base=64, feet = {x=30, y=60}, hand1 = {x=24, y=30}, hand2 = {x=41, y=21}, back = {x=35, y=11}, belly = {x=35, y=24}, head = {x=35, y=0}, } tiles["npc/humanoid_elf_limmir_the_jeweler.png"] = { base=64, feet = {x=31, y=60}, hand1 = {x=11, y=37}, hand2 = {x=49, y=9}, belly = {x=31, y=30}, back = {x=31, y=19}, head = {x=32, y=4}, } tiles["npc/canine_warg.png"] = { base=64, feet = {x=15, y=18}, hand1 = {x=48, y=22}, hand2 = {x=46, y=48}, back = {x=26, y=51}, belly = {x=12, y=32}, head = {x=33, y=13}, } tiles["npc/humanoid_human_cryomancer.png"] = { base=64, feet = {x=37, y=59}, hand1 = {x=22, y=6}, hand2 = {x=44, y=32}, belly = {x=36, y=28}, back = {x=35, y=16}, head = {x=34, y=5}, } tiles["npc/acid_ant.png"] = { base=64, feet = {x=36, y=57}, back = {x=45, y=37}, hand2 = {x=51, y=17}, belly = {x=11, y=33}, hand1 = {x=32, y=22}, head = {x=15, y=13}, } tiles["npc/humanoid_shalore_elven_corruptor.png"] = { base=64, feet = {x=34, y=60}, hand1 = {x=12, y=17}, hand2 = {x=48, y=34}, back = {x=31, y=20}, belly = {x=31, y=33}, head = {x=31, y=10}, } tiles["npc/humanoid_human_townsfolk_village_idiot01_64.png"] = { base=64, belly = {x=37, y=34}, feet = {x=35, y=58}, back = {x=33, y=24}, head = {x=32, y=8}, } dolls.race_halfling = dolls.race_halfling or {} dolls.race_halfling.female = { base=64, feet = {x=34, y=62}, hand1 = {x=12, y=38}, hand2 = {x=50, y=40}, belly = {x=34, y=36}, back = {x=32, y=24}, head = {x=32, y=12}, } tiles["npc/humanoid_elf_elven_sun_mage.png"] = { base=64, feet = {x=35, y=62}, hand1 = {x=13, y=28}, hand2 = {x=50, y=37}, belly = {x=34, y=35}, back = {x=32, y=16}, head = {x=31, y=4}, } dolls.race_halfling = dolls.race_halfling or {} dolls.race_halfling.male = { base=64, feet = {x=34, y=61}, hand1 = {x=14, y=39}, hand2 = {x=50, y=39}, belly = {x=33, y=36}, back = {x=32, y=25}, head = {x=32, y=14}, } tiles["npc/humanoid_human_storm_wyrmic.png"] = { base=64, feet = {x=34, y=60}, hand1 = {x=15, y=32}, hand2 = {x=53, y=37}, back = {x=31, y=21}, belly = {x=31, y=31}, head = {x=27, y=9}, } dolls.race_ghoul = dolls.race_ghoul or {} dolls.race_ghoul.all = { base=64, feet = {x=33, y=61}, hand1 = {x=20, y=37}, hand2 = {x=48, y=38}, back = {x=34, y=20}, belly = {x=33, y=38}, head = {x=33, y=8}, } tiles["npc/animal_feline_snow_cat.png"] = { base=64, head = {x=17, y=18}, } tiles["npc/humanoid_human_master_alchemist.png"] = { base=64, feet = {x=35, y=59}, hand1 = {x=7, y=18}, hand2 = {x=57, y=35}, back = {x=34, y=18}, belly = {x=37, y=28}, head = {x=29, y=8}, } tiles["npc/humanoid_human_riala_shalarak.png"] = { base=64, feet = {x=33, y=59}, hand1 = {x=17, y=7}, hand2 = {x=58, y=30}, back = {x=35, y=17}, belly = {x=34, y=27}, head = {x=33, y=5}, } tiles["npc/humanoid_human_fire_wyrmic.png"] = { base=64, feet = {x=31, y=60}, hand1 = {x=12, y=30}, hand2 = {x=49, y=36}, belly = {x=28, y=28}, back = {x=28, y=19}, head = {x=24, y=9}, } tiles["npc/humanoid_shalore_elven_elite_warrior.png"] = { base=64, feet = {x=33, y=62}, belly = {x=31, y=27}, hand1 = {x=13, y=32}, back = {x=31, y=15}, head = {x=32, y=6}, } tiles["npc/humanoid_orc_orc_assassin.png"] = { base=64, feet = {x=36, y=60}, hand1 = {x=4, y=30}, hand2 = {x=40, y=3}, back = {x=33, y=20}, belly = {x=42, y=29}, head = {x=24, y=11}, } tiles["npc/humanoid_yaech_slaver.png"] = { base=64, feet = {x=46, y=58}, hand1 = {x=16, y=28}, hand2 = {x=51, y=10}, back = {x=37, y=25}, belly = {x=38, y=34}, head = {x=28, y=17}, } dolls.race_human = dolls.race_human or {} dolls.race_human.female = { base=64, feet = {x=33, y=60}, hand1 = {x=20, y=33}, hand2 = {x=46, y=33}, belly = {x=34, y=28}, back = {x=33, y=16}, head = {x=32, y=3}, } tiles["npc/humanoid_orc_orc_mage_hunter.png"] = { base=64, feet = {x=32, y=61}, hand1 = {x=6, y=34}, hand2 = {x=57, y=31}, back = {x=28, y=20}, belly = {x=29, y=32}, head = {x=27, y=8}, } tiles["npc/humanoid_yeek_yeek_commoner_03.png"] = { base=64, feet = {x=32, y=59}, hand1 = {x=17, y=42}, hand2 = {x=50, y=44}, back = {x=32, y=24}, belly = {x=33, y=36}, head = {x=31, y=12}, } dolls.race_dwarf = dolls.race_dwarf or {} dolls.race_dwarf.male = { base=64, feet = {x=34, y=61}, back = {x=32, y=25}, hand2 = {x=55, y=39}, belly = {x=34, y=34}, hand1 = {x=10, y=39}, head = {x=32, y=10}, } dolls.race_dwarf = dolls.race_dwarf or {} dolls.race_dwarf.female = { base=64, feet = {x=33, y=59}, back = {x=33, y=25}, hand2 = {x=55, y=39}, belly = {x=33, y=37}, hand1 = {x=9, y=39}, head = {x=33, y=9}, } dolls.race_skeleton = dolls.race_skeleton or {} dolls.race_skeleton.all = { base=64, feet = {x=32, y=62}, hand1 = {x=15, y=33}, hand2 = {x=47, y=34}, belly = {x=32, y=26}, back = {x=31, y=16}, head = {x=30, y=4}, } dolls.race_yeek = dolls.race_yeek or {} dolls.race_yeek.all = { base=64, feet = {x=32, y=62}, hand1 = {x=16, y=39}, hand2 = {x=46, y=40}, belly = {x=32, y=36}, back = {x=31, y=26}, head = {x=31, y=12}, } tiles["npc/humanoid_orc_orc_cryomancer.png"] = { base=64, feet = {x=35, y=60}, hand1 = {x=5, y=14}, hand2 = {x=57, y=30}, back = {x=29, y=17}, belly = {x=36, y=31}, head = {x=23, y=7}, } tiles["npc/humanoid_human_aluin_the_fallen.png"] = { base=64, feet = {x=31, y=60}, hand1 = {x=18, y=36}, hand2 = {x=41, y=38}, belly = {x=29, y=29}, back = {x=29, y=18}, head = {x=28, y=5}, } tiles["npc/humanoid_human_tempest.png"] = { base=64, feet = {x=26, y=59}, hand1 = {x=19, y=31}, hand2 = {x=41, y=6}, back = {x=27, y=16}, belly = {x=26, y=30}, head = {x=28, y=4}, } tiles["npc/humanoid_orc_orc_soldier.png"] = { base=64, feet = {x=36, y=62}, hand1 = {x=9, y=39}, hand2 = {x=58, y=36}, back = {x=29, y=21}, belly = {x=34, y=34}, head = {x=25, y=9}, } tiles["npc/humanoid_human_linaniil_supreme_archmage.png"] = { base=64, feet = {x=38, y=60}, hand1 = {x=10, y=7}, hand2 = {x=49, y=29}, belly = {x=37, y=19}, back = {x=35, y=1}, head = {x=31, y=-13}, } tiles["npc/humanoid_elf_elven_archer.png"] = { base=64, feet = {x=32, y=61}, hand1 = {x=13, y=32}, hand2 = {x=51, y=32}, belly = {x=32, y=28}, back = {x=32, y=15}, head = {x=32, y=5}, } tiles["npc/humanoid_human_trickster.png"] = { base=64, feet = {x=36, y=60}, back = {x=35, y=17}, hand2 = {x=5, y=32}, belly = {x=37, y=29}, head = {x=30, y=6}, } tiles["npc/humanoid_orc_orc_master_assassin.png"] = { base=64, feet = {x=31, y=60}, hand1 = {x=4, y=39}, hand2 = {x=59, y=32}, back = {x=29, y=18}, belly = {x=30, y=30}, head = {x=28, y=8}, } tiles["npc/humanoid_human_derth_guard.png"] = { base=64, feet = {x=37, y=59}, hand1 = {x=10, y=18}, hand2 = {x=48, y=33}, belly = {x=36, y=29}, back = {x=34, y=17}, head = {x=34, y=5}, } tiles["npc/humanoid_shalore_elven_cultist.png"] = { base=64, feet = {x=29, y=60}, hand1 = {x=8, y=9}, hand2 = {x=52, y=9}, back = {x=30, y=16}, belly = {x=31, y=28}, head = {x=31, y=6}, } tiles["npc/humanoid_human_spectator03.png"] = { base=64, feet = {x=32, y=61}, hand1 = {x=16, y=38}, hand2 = {x=44, y=38}, back = {x=30, y=19}, belly = {x=30, y=30}, head = {x=30, y=4}, } tiles["npc/humanoid_orc_orc_archer.png"] = { base=64, feet = {x=30, y=60}, hand1 = {x=20, y=29}, hand2 = {x=56, y=30}, back = {x=30, y=20}, belly = {x=31, y=34}, head = {x=31, y=10}, } tiles["npc/humanoid_yeek_yeek_commoner_06.png"] = { base=64, feet = {x=30, y=61}, hand1 = {x=10, y=22}, hand2 = {x=23, y=36}, back = {x=31, y=22}, belly = {x=31, y=36}, head = {x=30, y=13}, } tiles["npc/humanoid_halfling_sm_halfling.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=10, y=14}, hand2 = {x=52, y=11}, belly = {x=30, y=35}, back = {x=30, y=23}, head = {x=31, y=7}, } tiles["npc/humanoid_orc_orc_master_wyrmic.png"] = { base=64, feet = {x=39, y=60}, hand1 = {x=16, y=40}, hand2 = {x=58, y=36}, back = {x=33, y=21}, belly = {x=36, y=32}, head = {x=30, y=13}, } tiles["npc/humanoid_human_reaver.png"] = { base=64, feet = {x=34, y=59}, hand1 = {x=8, y=37}, hand2 = {x=52, y=31}, back = {x=29, y=17}, belly = {x=29, y=29}, head = {x=28, y=6}, } tiles["npc/humanoid_elf_star_crusader.png"] = { base=64, feet = {x=34, y=60}, hand1 = {x=11, y=30}, hand2 = {x=51, y=33}, belly = {x=34, y=30}, back = {x=34, y=17}, head = {x=34, y=4}, } tiles["npc/humanoid_elf_high_chronomancer_zemekkys.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=11, y=36}, hand2 = {x=51, y=38}, belly = {x=32, y=29}, back = {x=32, y=19}, head = {x=30, y=6}, } tiles["npc/humanoid_yaech_yaech_psion.png"] = { base=64, feet = {x=5, y=58}, hand1 = {x=55, y=27}, hand2 = {x=42, y=32}, back = {x=23, y=31}, belly = {x=25, y=40}, head = {x=33, y=15}, } tiles["npc/humanoid_orc_orc_corruptor.png"] = { base=64, feet = {x=35, y=61}, hand1 = {x=15, y=39}, hand2 = {x=51, y=37}, back = {x=31, y=17}, belly = {x=34, y=36}, head = {x=28, y=6}, } tiles["npc/humanoid_halfling_halfling_gardener.png"] = { base=64, feet = {x=33, y=58}, hand1 = {x=17, y=36}, hand2 = {x=48, y=38}, belly = {x=31, y=32}, back = {x=31, y=22}, head = {x=29, y=8}, } tiles["npc/humanoid_human_cutpurse.png"] = { base=64, feet = {x=36, y=59}, hand1 = {x=9, y=34}, hand2 = {x=46, y=34}, belly = {x=30, y=29}, back = {x=29, y=18}, head = {x=28, y=7}, } tiles["npc/humanoid_orc_fiery_orc_wyrmic.png"] = { base=64, feet = {x=33, y=60}, hand1 = {x=20, y=20}, hand2 = {x=57, y=36}, back = {x=30, y=21}, belly = {x=32, y=31}, head = {x=25, y=9}, } tiles["npc/humanoid_orc_ukruk_the_fierce.png"] = { base=64, feet = {x=34, y=60}, belly = {x=29, y=33}, hand1 = {x=10, y=38}, back = {x=28, y=17}, head = {x=25, y=8}, } tiles["npc/humanoid_human_rej_arkatis.png"] = { base=64, feet = {x=34, y=59}, hand1 = {x=24, y=17}, hand2 = {x=38, y=19}, back = {x=33, y=15}, belly = {x=33, y=26}, head = {x=32, y=4}, } tiles["npc/humanoid_orc_young_orc.png"] = { base=64, feet = {x=35, y=60}, hand1 = {x=14, y=10}, hand2 = {x=52, y=40}, back = {x=32, y=19}, belly = {x=35, y=32}, head = {x=30, y=8}, } tiles["npc/humanoid_elenulach_thief.png"] = { base=64, feet = {x=30, y=60}, hand1 = {x=18, y=37}, hand2 = {x=42, y=37}, belly = {x=30, y=32}, back = {x=30, y=17}, head = {x=30, y=6}, } tiles["npc/humanoid_human_lumberjack.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=17, y=37}, hand2 = {x=44, y=37}, back = {x=32, y=17}, belly = {x=33, y=31}, head = {x=32, y=4}, } tiles["npc/humanoid_human_pyromancer.png"] = { base=64, feet = {x=35, y=59}, hand1 = {x=19, y=7}, hand2 = {x=41, y=32}, back = {x=32, y=17}, belly = {x=34, y=29}, head = {x=32, y=4}, } tiles["npc/humanoid_dwarf_dwarven_guard.png"] = { base=64, feet = {x=30, y=59}, hand1 = {x=13, y=40}, hand2 = {x=40, y=22}, back = {x=29, y=23}, belly = {x=29, y=36}, head = {x=28, y=6}, } tiles["npc/humanoid_human_ice_wyrmic.png"] = { base=64, feet = {x=30, y=61}, back = {x=32, y=19}, hand2 = {x=58, y=17}, belly = {x=32, y=33}, hand1 = {x=9, y=36}, head = {x=36, y=11}, } tiles["npc/humanoid_yaech_yaech_mindslayer.png"] = { base=64, feet = {x=58, y=58}, hand1 = {x=7, y=28}, hand2 = {x=21, y=32}, back = {x=37, y=31}, belly = {x=39, y=40}, head = {x=28, y=19}, } tiles["npc/humanoid_human_townsfolk_meanlooking_mercenary01_64.png"] = { base=64, feet = {x=35, y=58}, belly = {x=36, y=30}, hand1 = {x=8, y=29}, back = {x=36, y=19}, head = {x=33, y=6}, } tiles["npc/humanoid_orc_brotoq_the_reaver.png"] = { base=64, feet = {x=38, y=59}, hand1 = {x=14, y=31}, hand2 = {x=58, y=33}, back = {x=38, y=15}, belly = {x=38, y=26}, head = {x=35, y=3}, } tiles["npc/humanoid_yeek_yeek_commoner_05.png"] = { base=64, feet = {x=31, y=61}, hand1 = {x=12, y=22}, hand2 = {x=24, y=35}, back = {x=30, y=21}, belly = {x=32, y=34}, head = {x=30, y=12}, } tiles["npc/humanoid_shalore_shalore_rune_master.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=17, y=34}, hand2 = {x=48, y=34}, back = {x=32, y=14}, belly = {x=33, y=30}, head = {x=32, y=4}, } tiles["npc/humanoid_thalore_thalore_hunter.png"] = { base=64, feet = {x=31, y=59}, hand1 = {x=18, y=38}, hand2 = {x=52, y=31}, back = {x=33, y=18}, belly = {x=33, y=30}, head = {x=32, y=8}, } tiles["npc/humanoid_orc_rak_shor_cultist.png"] = { base=64, feet = {x=32, y=61}, hand1 = {x=5, y=39}, hand2 = {x=58, y=34}, back = {x=29, y=19}, belly = {x=30, y=35}, head = {x=29, y=8}, } tiles["npc/humanoid_halfling_halfling_slinger.png"] = { base=64, feet = {x=27, y=57}, hand1 = {x=16, y=15}, hand2 = {x=55, y=30}, belly = {x=31, y=42}, back = {x=33, y=32}, head = {x=36, y=19}, } tiles["npc/humanoid_human_slinger.png"] = { base=64, feet = {x=38, y=59}, hand1 = {x=10, y=18}, hand2 = {x=50, y=36}, back = {x=34, y=17}, belly = {x=37, y=27}, head = {x=34, y=5}, } tiles["npc/humanoid_human_human_guard.png"] = { base=64, feet = {x=33, y=60}, hand1 = {x=19, y=29}, hand2 = {x=46, y=25}, belly = {x=31, y=30}, back = {x=30, y=17}, head = {x=28, y=5}, } tiles["npc/humanoid_elf_fillarel_aldaren.png"] = { base=64, feet = {x=25, y=59}, hand1 = {x=10, y=28}, hand2 = {x=49, y=7}, belly = {x=24, y=15}, back = {x=24, y=3}, head = {x=23, y=-12}, } tiles["npc/humanoid_orc_grushnak__battlemaster_of_the_pride.png"] = { base=64, feet = {x=30, y=61}, hand1 = {x=10, y=40}, hand2 = {x=56, y=36}, back = {x=30, y=18}, belly = {x=30, y=32}, head = {x=30, y=11}, } tiles["npc/humanoid_yaech_yaech_hunter.png"] = { base=64, feet = {x=6, y=7}, hand1 = {x=33, y=50}, hand2 = {x=59, y=37}, back = {x=34, y=29}, belly = {x=23, y=29}, head = {x=46, y=19}, } tiles["npc/humanoid_human_melnela.png"] = { base=64, feet = {x=33, y=59}, hand1 = {x=17, y=8}, hand2 = {x=58, y=30}, back = {x=35, y=19}, belly = {x=35, y=31}, head = {x=33, y=6}, } tiles["npc/humanoid_yeek_yeek_commoner_01.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=14, y=39}, hand2 = {x=48, y=38}, back = {x=30, y=19}, belly = {x=33, y=32}, head = {x=30, y=10}, } tiles["npc/humanoid_human_spectator.png"] = { base=64, feet = {x=37, y=59}, belly = {x=36, y=29}, hand1 = {x=50, y=37}, back = {x=35, y=17}, head = {x=34, y=5}, } tiles["npc/humanoid_naga_naga_tidecaller.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=12, y=15}, hand2 = {x=47, y=-14}, back = {x=27, y=-6}, belly = {x=30, y=7}, head = {x=26, y=-17}, } tiles["npc/humanoid_yeek_yeek_summoner.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=14, y=38}, hand2 = {x=48, y=37}, back = {x=31, y=23}, belly = {x=32, y=36}, head = {x=30, y=10}, } tiles["npc/humanoid_thalore_ziguranth_summoner.png"] = { base=64, feet = {x=35, y=61}, hand1 = {x=12, y=17}, hand2 = {x=49, y=39}, back = {x=34, y=15}, belly = {x=33, y=26}, head = {x=32, y=4}, } tiles["npc/humanoid_orc_orc_warrior.png"] = { base=64, feet = {x=35, y=61}, hand1 = {x=8, y=38}, hand2 = {x=57, y=35}, back = {x=29, y=20}, belly = {x=34, y=34}, head = {x=25, y=9}, } tiles["npc/humanoid_thalore_thalore_wilder.png"] = { base=64, feet = {x=27, y=59}, hand1 = {x=11, y=31}, hand2 = {x=44, y=30}, back = {x=29, y=11}, belly = {x=28, y=23}, head = {x=29, y=-1}, } tiles["npc/humanoid_orc_orc_pyromancer.png"] = { base=64, feet = {x=28, y=61}, hand1 = {x=6, y=30}, hand2 = {x=59, y=15}, back = {x=30, y=17}, belly = {x=28, y=30}, head = {x=40, y=5}, } tiles["npc/humanoid_orc_orc_fighter.png"] = { base=64, feet = {x=30, y=60}, hand1 = {x=7, y=8}, hand2 = {x=57, y=39}, back = {x=35, y=20}, belly = {x=31, y=34}, head = {x=39, y=10}, } tiles["npc/humanoid_naga_lady_zoisla_the_tidebringer.png"] = { base=64, feet = {x=36, y=61}, hand1 = {x=9, y=-28}, hand2 = {x=49, y=-20}, back = {x=30, y=-19}, belly = {x=30, y=-6}, head = {x=30, y=-33}, } tiles["npc/humanoid_yeek_yeek_mindslayer.png"] = { base=64, feet = {x=31, y=60}, hand1 = {x=23, y=34}, hand2 = {x=24, y=41}, back = {x=31, y=22}, belly = {x=30, y=37}, head = {x=31, y=11}, } tiles["npc/humanoid_human_great_gladiator.png"] = { base=64, feet = {x=30, y=60}, hand1 = {x=17, y=35}, hand2 = {x=47, y=32}, belly = {x=31, y=25}, back = {x=29, y=11}, head = {x=29, y=0}, } tiles["npc/humanoid_orc_gorbat__supreme_wyrmic_of_the_pride.png"] = { base=64, feet = {x=38, y=60}, hand1 = {x=18, y=14}, hand2 = {x=53, y=45}, back = {x=34, y=25}, belly = {x=36, y=38}, head = {x=33, y=12}, } tiles["npc/humanoid_human_townsfolk_singing_happy_drunk01_64.png"] = { base=64, feet = {x=36, y=58}, hand1 = {x=9, y=40}, hand2 = {x=52, y=16}, back = {x=27, y=21}, belly = {x=30, y=31}, head = {x=23, y=10}, } tiles["npc/humanoid_human_human_farmer.png"] = { base=64, feet = {x=32, y=60}, hand1 = {x=11, y=20}, hand2 = {x=44, y=38}, belly = {x=31, y=31}, back = {x=29, y=18}, head = {x=29, y=5}, } tiles["npc/humanoid_human_lost_merchant.png"] = { base=64, feet = {x=35, y=59}, belly = {x=35, y=36}, hand1 = {x=16, y=47}, back = {x=32, y=24}, head = {x=30, y=5}, } dolls.race_orc = dolls.race_orc or {} dolls.race_orc.all = { base=64, feet = {x=34, y=62}, hand1 = {x=13, y=37}, hand2 = {x=52, y=38}, belly = {x=33, y=34}, back = {x=32, y=23}, head = {x=32, y=9}, } tiles["npc/humanoid_orc_krogar.png"] = { base=64, feet = {x=32, y=59}, hand1 = {x=14, y=0}, hand2 = {x=53, y=13}, back = {x=29, y=25}, belly = {x=29, y=35}, head = {x=30, y=11}, } tiles["npc/humanoid_halfling_halfling_citizen.png"] = { base=64, feet = {x=31, y=58}, hand1 = {x=13, y=38}, hand2 = {x=48, y=41}, belly = {x=31, y=33}, back = {x=30, y=22}, head = {x=30, y=8}, } tiles["npc/humanoid_naga_naga_tidewarden.png"] = { base=64, feet = {x=32, y=61}, belly = {x=32, y=9}, hand1 = {x=31, y=12}, back = {x=32, y=-3}, head = {x=34, y=-15}, } tiles["npc/humanoid_orc_orc_greatmother.png"] = { base=64, feet = {x=35, y=59}, hand1 = {x=4, y=-4}, hand2 = {x=58, y=2}, back = {x=32, y=-40}, belly = {x=30, y=-3}, head = {x=33, y=-55}, } tiles["npc/humanoid_human_arcane_blade.png"] = { base=64, feet = {x=26, y=61}, hand1 = {x=17, y=3}, hand2 = {x=38, y=35}, belly = {x=27, y=29}, back = {x=27, y=22}, head = {x=29, y=13}, } tiles["npc/humanoid_shalore_rhaloren_inquisitor.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=9, y=17}, hand2 = {x=56, y=22}, back = {x=30, y=14}, belly = {x=31, y=26}, head = {x=28, y=6}, } tiles["npc/humanoid_human_multihued_wyrmic.png"] = { base=64, feet = {x=33, y=59}, hand1 = {x=13, y=39}, hand2 = {x=49, y=38}, back = {x=30, y=17}, belly = {x=31, y=30}, head = {x=30, y=8}, } tiles["npc/humanoid_human_agrimley_the_hermit.png"] = { base=64, feet = {x=35, y=60}, hand1 = {x=23, y=36}, hand2 = {x=54, y=22}, belly = {x=35, y=30}, back = {x=35, y=17}, head = {x=35, y=5}, } tiles["npc/humanoid_human_meranas__herald_of_angolwen.png"] = { base=64, feet = {x=34, y=60}, hand1 = {x=16, y=40}, hand2 = {x=52, y=39}, back = {x=34, y=21}, belly = {x=35, y=31}, head = {x=31, y=4}, } tiles["npc/humanoid_orc_orc_elite_fighter.png"] = { base=64, feet = {x=31, y=60}, hand1 = {x=11, y=37}, hand2 = {x=53, y=29}, back = {x=29, y=16}, belly = {x=31, y=33}, head = {x=29, y=4}, } tiles["npc/humanoid_orc_kra_tor_the_gluttonous.png"] = { base=64, feet = {x=38, y=57}, hand1 = {x=20, y=18}, hand2 = {x=38, y=-2}, back = {x=27, y=14}, belly = {x=29, y=27}, head = {x=23, y=1}, } tiles["npc/humanoid_halfling_halfling_guard.png"] = { base=64, feet = {x=38, y=59}, hand1 = {x=8, y=28}, hand2 = {x=54, y=43}, belly = {x=36, y=36}, back = {x=33, y=24}, head = {x=30, y=10}, } tiles["npc/humanoid_human_necromancer.png"] = { base=64, feet = {x=27, y=61}, hand1 = {x=18, y=16}, hand2 = {x=40, y=41}, back = {x=34, y=17}, belly = {x=32, y=32}, head = {x=36, y=3}, } tiles["npc/humanoid_human_townsfolk_filthy_street_urchin01_64.png"] = { base=64, feet = {x=35, y=59}, hand1 = {x=12, y=32}, hand2 = {x=49, y=40}, back = {x=31, y=21}, belly = {x=33, y=32}, head = {x=27, y=7}, } tiles["npc/humanoid_orc_icy_orc_wyrmic.png"] = { base=64, feet = {x=34, y=61}, hand1 = {x=21, y=21}, hand2 = {x=57, y=36}, back = {x=32, y=20}, belly = {x=32, y=32}, head = {x=26, y=7}, } tiles["npc/humanoid_human_urkis__the_high_tempest.png"] = { base=64, feet = {x=35, y=60}, hand1 = {x=13, y=32}, hand2 = {x=51, y=29}, back = {x=33, y=9}, belly = {x=33, y=24}, head = {x=33, y=-4}, } tiles["npc/humanoid_halfling_protector_myssil.png"] = { base=64, feet = {x=32, y=60}, hand1 = {x=16, y=43}, hand2 = {x=45, y=39}, belly = {x=31, y=34}, back = {x=30, y=22}, head = {x=30, y=7}, } tiles["npc/humanoid_human_bandit.png"] = { base=64, feet = {x=39, y=56}, hand1 = {x=8, y=40}, hand2 = {x=51, y=26}, belly = {x=33, y=28}, back = {x=30, y=16}, head = {x=29, y=5}, } tiles["npc/humanoid_yaech_blood_master.png"] = { base=64, feet = {x=22, y=60}, hand1 = {x=6, y=17}, hand2 = {x=50, y=27}, back = {x=29, y=25}, belly = {x=31, y=32}, head = {x=36, y=14}, } tiles["npc/humanoid_dwarf_dwarven_summoner.png"] = { base=64, feet = {x=38, y=59}, hand1 = {x=14, y=44}, hand2 = {x=54, y=44}, back = {x=39, y=24}, belly = {x=39, y=41}, head = {x=39, y=7}, } tiles["npc/humanoid_human_sand_wyrmic.png"] = { base=64, feet = {x=29, y=60}, hand1 = {x=10, y=38}, hand2 = {x=58, y=17}, back = {x=32, y=19}, belly = {x=31, y=30}, head = {x=37, y=8}, } tiles["npc/humanoid_human_townsfolk_boilcovered_wretch01_64.png"] = { base=64, feet = {x=35, y=58}, hand1 = {x=19, y=38}, hand2 = {x=50, y=39}, back = {x=34, y=21}, belly = {x=34, y=34}, head = {x=28, y=10}, } tiles["npc/humanoid_dwarf_dwarven_earthwarden.png"] = { base=64, feet = {x=34, y=58}, back = {x=36, y=22}, hand2 = {x=51, y=36}, belly = {x=35, y=37}, hand1 = {x=20, y=37}, head = {x=35, y=7}, } tiles["npc/humanoid_orc_orc_high_cryomancer.png"] = { base=64, feet = {x=36, y=60}, hand1 = {x=7, y=17}, hand2 = {x=57, y=31}, back = {x=33, y=22}, belly = {x=37, y=32}, head = {x=26, y=8}, } tiles["npc/humanoid_human_hexer.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=26, y=25}, hand2 = {x=37, y=25}, belly = {x=32, y=37}, back = {x=31, y=16}, head = {x=31, y=3}, } tiles["npc/humanoid_orc_orc_elite_berserker.png"] = { base=64, feet = {x=34, y=61}, hand1 = {x=19, y=21}, hand2 = {x=54, y=31}, back = {x=33, y=17}, belly = {x=30, y=32}, head = {x=33, y=7}, } tiles["npc/humanoid_human_enthralled_slave.png"] = { base=64, feet = {x=33, y=58}, hand1 = {x=16, y=35}, hand2 = {x=47, y=36}, belly = {x=32, y=29}, back = {x=32, y=18}, head = {x=31, y=5}, } tiles["npc/humanoid_shalore_elven_tempest.png"] = { base=64, feet = {x=35, y=60}, hand1 = {x=11, y=9}, hand2 = {x=49, y=36}, back = {x=32, y=16}, belly = {x=31, y=28}, head = {x=33, y=7}, } tiles["npc/humanoid_human_townsfolk_pitiful_looking_beggar01_64.png"] = { base=64, feet = {x=41, y=60}, back = {x=40, y=20}, hand1 = {x=25, y=32}, belly = {x=41, y=33}, head = {x=31, y=10}, } tiles["npc/humanoid_dwarf_ziguranth_warrior.png"] = { base=64, feet = {x=34, y=59}, hand1 = {x=18, y=43}, hand2 = {x=50, y=44}, belly = {x=35, y=36}, back = {x=35, y=22}, head = {x=35, y=7}, } tiles["npc/humanoid_human_high_slinger.png"] = { base=64, feet = {x=29, y=59}, hand1 = {x=15, y=36}, hand2 = {x=57, y=18}, belly = {x=30, y=27}, back = {x=31, y=15}, head = {x=33, y=6}, } tiles["npc/humanoid_human_celia.png"] = { base=64, feet = {x=28, y=59}, hand1 = {x=15, y=16}, hand2 = {x=50, y=-20}, belly = {x=28, y=2}, back = {x=29, y=-16}, head = {x=29, y=-33}, } tiles["npc/humanoid_shalore_archmage_tarelion.png"] = { base=64, feet = {x=33, y=59}, hand1 = {x=17, y=26}, hand2 = {x=45, y=26}, back = {x=31, y=0}, belly = {x=33, y=18}, head = {x=30, y=-11}, } tiles["npc/humanoid_human_blood_mage.png"] = { base=64, feet = {x=32, y=61}, hand1 = {x=13, y=42}, hand2 = {x=51, y=18}, belly = {x=30, y=30}, back = {x=29, y=19}, head = {x=28, y=5}, } tiles["npc/humanoid_human_geomancer.png"] = { base=64, feet = {x=26, y=59}, hand1 = {x=19, y=31}, hand2 = {x=42, y=6}, belly = {x=27, y=28}, back = {x=28, y=15}, head = {x=28, y=2}, } tiles["npc/humanoid_shalore_elven_mage.png"] = { base=64, feet = {x=31, y=61}, hand1 = {x=11, y=35}, hand2 = {x=50, y=39}, back = {x=31, y=18}, belly = {x=31, y=30}, head = {x=30, y=6}, } tiles["npc/humanoid_orc_orc_summoner.png"] = { base=64, feet = {x=35, y=61}, hand1 = {x=9, y=35}, hand2 = {x=57, y=34}, back = {x=28, y=18}, belly = {x=32, y=34}, head = {x=27, y=7}, } tiles["npc/humanoid_human_fallen_sun_paladin_aeryn.png"] = { base=64, feet = {x=33, y=58}, hand1 = {x=15, y=20}, hand2 = {x=45, y=25}, belly = {x=32, y=14}, back = {x=32, y=0}, head = {x=31, y=-12}, } tiles["npc/humanoid_yeek_yeek_commoner_07.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=14, y=39}, hand2 = {x=48, y=36}, back = {x=30, y=23}, belly = {x=33, y=37}, head = {x=31, y=11}, } tiles["npc/humanoid_human_assassin.png"] = { base=64, feet = {x=35, y=59}, hand1 = {x=12, y=16}, hand2 = {x=51, y=33}, belly = {x=34, y=32}, back = {x=31, y=16}, head = {x=29, y=5}, } tiles["npc/humanoid_human_bandit_lord.png"] = { base=64, feet = {x=34, y=59}, hand1 = {x=20, y=20}, hand2 = {x=38, y=21}, belly = {x=32, y=30}, back = {x=31, y=16}, head = {x=30, y=5}, } tiles["npc/humanoid_orc_warmaster_gnarg.png"] = { base=64, feet = {x=40, y=60}, hand1 = {x=60, y=27}, hand2 = {x=58, y=28}, back = {x=32, y=18}, belly = {x=43, y=29}, head = {x=21, y=9}, } tiles["npc/humanoid_yeek_yeek_wayist.png"] = { base=64, feet = {x=37, y=59}, hand1 = {x=14, y=34}, hand2 = {x=58, y=36}, back = {x=37, y=24}, belly = {x=37, y=35}, head = {x=38, y=13}, } tiles["npc/humanoid_human_thief.png"] = { base=64, feet = {x=27, y=60}, hand1 = {x=8, y=27}, hand2 = {x=43, y=30}, back = {x=24, y=19}, belly = {x=27, y=30}, head = {x=18, y=7}, } tiles["npc/humanoid_shalore_mean_looking_elven_guard.png"] = { base=64, feet = {x=33, y=60}, belly = {x=32, y=27}, hand1 = {x=14, y=31}, back = {x=31, y=14}, head = {x=31, y=6}, } tiles["npc/humanoid_human_subject_z.png"] = { base=64, feet = {x=32, y=59}, hand1 = {x=8, y=11}, hand2 = {x=55, y=11}, back = {x=31, y=15}, belly = {x=31, y=27}, head = {x=32, y=3}, } tiles["npc/humanoid_human_townsfolk_battlescarred_veteran01_64.png"] = { base=64, feet = {x=35, y=57}, hand1 = {x=16, y=39}, hand2 = {x=52, y=39}, back = {x=33, y=19}, belly = {x=33, y=30}, head = {x=32, y=7}, } tiles["npc/humanoid_yeek_yeek_commoner_02.png"] = { base=64, feet = {x=31, y=59}, hand1 = {x=10, y=20}, hand2 = {x=23, y=35}, back = {x=30, y=21}, belly = {x=32, y=35}, head = {x=31, y=11}, } tiles["npc/humanoid_orc_orc_baby.png"] = { base=64, feet = {x=41, y=40}, hand1 = {x=12, y=43}, hand2 = {x=30, y=44}, back = {x=31, y=21}, belly = {x=39, y=26}, head = {x=19, y=22}, } tiles["npc/humanoid_human_argoniel.png"] = { base=64, feet = {x=30, y=59}, hand1 = {x=9, y=2}, hand2 = {x=57, y=9}, belly = {x=32, y=22}, back = {x=32, y=10}, head = {x=32, y=-3}, } tiles["npc/humanoid_human_last_hope_guard.png"] = { base=64, feet = {x=31, y=60}, hand1 = {x=15, y=32}, hand2 = {x=45, y=28}, back = {x=31, y=15}, belly = {x=30, y=26}, head = {x=31, y=5}, } tiles["npc/humanoid_orc_orc_child.png"] = { base=64, feet = {x=31, y=55}, hand1 = {x=8, y=36}, hand2 = {x=48, y=35}, back = {x=29, y=24}, belly = {x=30, y=32}, head = {x=25, y=12}, } tiles["npc/humanoid_orc_orc_high_pyromancer.png"] = { base=64, feet = {x=29, y=60}, hand1 = {x=9, y=32}, hand2 = {x=58, y=18}, back = {x=30, y=20}, belly = {x=28, y=33}, head = {x=39, y=10}, } tiles["npc/humanoid_shalore_elven_blood_mage.png"] = { base=64, feet = {x=32, y=59}, hand1 = {x=15, y=36}, hand2 = {x=46, y=36}, back = {x=30, y=17}, belly = {x=30, y=33}, head = {x=30, y=7}, } tiles["npc/humanoid_dwarf_dwarven_paddlestriker.png"] = { base=64, feet = {x=39, y=60}, hand1 = {x=15, y=37}, hand2 = {x=57, y=33}, back = {x=33, y=22}, belly = {x=35, y=35}, head = {x=33, y=6}, } tiles["npc/humanoid_human_alchemist.png"] = { base=64, feet = {x=35, y=59}, hand1 = {x=10, y=32}, hand2 = {x=51, y=34}, belly = {x=34, y=32}, back = {x=33, y=19}, head = {x=33, y=5}, } tiles["npc/humanoid_human_martyr.png"] = { base=64, feet = {x=37, y=60}, hand1 = {x=17, y=29}, hand2 = {x=46, y=31}, back = {x=29, y=14}, belly = {x=30, y=27}, head = {x=28, y=3}, } tiles["npc/humanoid_human_apprentice_mage.png"] = { base=64, feet = {x=30, y=61}, hand1 = {x=15, y=38}, hand2 = {x=42, y=34}, belly = {x=29, y=29}, back = {x=29, y=16}, head = {x=29, y=5}, } tiles["npc/humanoid_human_townsfolk_squinteyed_rogue01_64.png"] = { base=64, feet = {x=33, y=57}, hand1 = {x=11, y=28}, hand2 = {x=53, y=38}, back = {x=33, y=20}, belly = {x=33, y=33}, head = {x=30, y=7}, } tiles["npc/humanoid_human_townsfolk_aimless_looking_merchant01_64.png"] = { base=64, feet = {x=37, y=58}, hand1 = {x=14, y=48}, hand2 = {x=52, y=23}, back = {x=31, y=24}, belly = {x=35, y=38}, head = {x=29, y=6}, } tiles["npc/humanoid_orc_orc_mother.png"] = { base=64, feet = {x=33, y=59}, hand1 = {x=10, y=37}, hand2 = {x=53, y=35}, back = {x=30, y=9}, belly = {x=30, y=31}, head = {x=28, y=-6}, } tiles["npc/humanoid_dwarf_lumberjack.png"] = { base=64, feet = {x=34, y=60}, hand1 = {x=17, y=16}, hand2 = {x=49, y=41}, back = {x=34, y=27}, belly = {x=35, y=38}, head = {x=34, y=8}, } tiles["npc/humanoid_human_spectator02.png"] = { base=64, feet = {x=30, y=59}, hand1 = {x=18, y=37}, hand2 = {x=41, y=37}, back = {x=30, y=16}, belly = {x=31, y=30}, head = {x=30, y=5}, } tiles["npc/humanoid_human_fryjia_loren.png"] = { base=64, feet = {x=32, y=58}, hand1 = {x=17, y=31}, hand2 = {x=45, y=41}, belly = {x=29, y=32}, back = {x=29, y=21}, head = {x=29, y=8}, } tiles["npc/humanoid_human_townsfolk_blubbering_idiot01_64.png"] = { base=64, feet = {x=33, y=59}, hand1 = {x=19, y=41}, hand2 = {x=47, y=40}, back = {x=31, y=19}, belly = {x=31, y=33}, head = {x=29, y=7}, } tiles["npc/humanoid_human_valfred_loren.png"] = { base=64, feet = {x=29, y=57}, hand1 = {x=19, y=36}, hand2 = {x=45, y=22}, back = {x=29, y=17}, belly = {x=29, y=25}, head = {x=28, y=6}, } tiles["npc/humanoid_elf_anorithil.png"] = { base=64, feet = {x=39, y=60}, hand1 = {x=12, y=15}, hand2 = {x=55, y=30}, belly = {x=40, y=29}, back = {x=38, y=18}, head = {x=29, y=4}, } tiles["npc/humanoid_orc_golbug_the_destroyer.png"] = { base=64, feet = {x=29, y=58}, hand1 = {x=9, y=35}, hand2 = {x=51, y=33}, back = {x=30, y=12}, belly = {x=29, y=25}, head = {x=32, y=-1}, } tiles["npc/humanoid_yeek_yeek_commoner_08.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=14, y=39}, hand2 = {x=48, y=36}, back = {x=31, y=21}, belly = {x=33, y=34}, head = {x=31, y=11}, } tiles["npc/humanoid_orc_orc_blood_mage.png"] = { base=64, feet = {x=34, y=59}, hand1 = {x=11, y=36}, hand2 = {x=57, y=37}, back = {x=33, y=17}, belly = {x=34, y=32}, head = {x=32, y=5}, } tiles["npc/humanoid_human_shady_cornac_man.png"] = { base=64, feet = {x=35, y=60}, hand1 = {x=19, y=35}, hand2 = {x=49, y=35}, back = {x=32, y=17}, belly = {x=33, y=29}, head = {x=29, y=4}, } tiles["npc/humanoid_orc_orc_grand_master_assassin.png"] = { base=64, feet = {x=33, y=61}, hand1 = {x=4, y=32}, hand2 = {x=60, y=39}, back = {x=35, y=18}, belly = {x=34, y=30}, head = {x=37, y=7}, } tiles["npc/humanoid_orc_orc_grand_summoner.png"] = { base=64, feet = {x=29, y=60}, hand1 = {x=9, y=8}, hand2 = {x=55, y=35}, back = {x=34, y=18}, belly = {x=32, y=30}, head = {x=36, y=7}, } tiles["npc/humanoid_orc_rak_shor__grand_necromancer_of_the_pride.png"] = { base=64, feet = {x=29, y=60}, hand1 = {x=6, y=39}, hand2 = {x=54, y=32}, back = {x=28, y=20}, belly = {x=28, y=35}, head = {x=27, y=7}, } tiles["npc/humanoid_human_high_sun_paladin_aeryn.png"] = { base=64, feet = {x=33, y=58}, hand1 = {x=15, y=19}, hand2 = {x=45, y=25}, belly = {x=33, y=16}, back = {x=32, y=1}, head = {x=31, y=-12}, } tiles["npc/humanoid_human_ben_cruthdar__the_cursed.png"] = { base=64, feet = {x=36, y=61}, hand1 = {x=17, y=33}, hand2 = {x=46, y=19}, belly = {x=30, y=32}, back = {x=29, y=17}, head = {x=28, y=4}, } tiles["npc/humanoid_yeek_yeek_commoner_04.png"] = { base=64, feet = {x=33, y=60}, hand1 = {x=17, y=40}, hand2 = {x=50, y=44}, back = {x=32, y=25}, belly = {x=32, y=36}, head = {x=32, y=8}, } tiles["npc/humanoid_orc_orc_necromancer.png"] = { base=64, feet = {x=32, y=59}, hand1 = {x=7, y=39}, hand2 = {x=53, y=36}, back = {x=28, y=17}, belly = {x=30, y=32}, head = {x=29, y=6}, } dolls.race_elf = dolls.race_elf or {} dolls.race_elf.female = { base=64, feet = {x=34, y=61}, hand1 = {x=19, y=33}, hand2 = {x=46, y=33}, back = {x=33, y=14}, belly = {x=34, y=27}, head = {x=31, y=3}, } tiles["npc/humanoid_naga_naga_nereid.png"] = { base=64, feet = {x=32, y=62}, hand1 = {x=25, y=40}, hand2 = {x=59, y=31}, back = {x=37, y=17}, belly = {x=38, y=28}, head = {x=35, y=5}, } tiles["npc/humanoid_human_townsfolk_mangy_looking_leper01_64.png"] = { base=64, feet = {x=36, y=57}, hand1 = {x=17, y=23}, hand2 = {x=18, y=35}, back = {x=32, y=18}, belly = {x=36, y=31}, head = {x=28, y=5}, } tiles["npc/humanoid_human_homeless_fighter.png"] = { base=64, feet = {x=35, y=61}, hand1 = {x=6, y=34}, hand2 = {x=57, y=34}, belly = {x=33, y=34}, back = {x=33, y=25}, head = {x=32, y=9}, } tiles["npc/humanoid_human_townsfolk_farmer_maggot01_64.png"] = { base=64, feet = {x=36, y=60}, hand1 = {x=11, y=31}, hand2 = {x=51, y=25}, back = {x=35, y=25}, belly = {x=36, y=37}, head = {x=34, y=11}, } tiles["npc/humanoid_orc_orc_berserker.png"] = { base=64, feet = {x=45, y=60}, hand1 = {x=11, y=36}, hand2 = {x=40, y=17}, back = {x=20, y=19}, belly = {x=30, y=31}, head = {x=17, y=9}, } tiles["npc/humanoid_yaech_yaech_diver.png"] = { base=64, feet = {x=52, y=3}, hand1 = {x=9, y=56}, hand2 = {x=40, y=57}, back = {x=30, y=36}, belly = {x=39, y=31}, head = {x=16, y=39}, } tiles["npc/humanoid_human_tannen.png"] = { base=64, feet = {x=37, y=60}, hand1 = {x=10, y=16}, hand2 = {x=56, y=14}, back = {x=31, y=15}, belly = {x=35, y=28}, head = {x=29, y=4}, } tiles["npc/humanoid_female_sluttymaid.png"] = { base=64, feet = {x=31, y=59}, hand1 = {x=24, y=30}, hand2 = {x=41, y=20}, belly = {x=35, y=23}, back = {x=35, y=12}, head = {x=36, y=0}, } tiles["npc/humanoid_halfling_derth_guard.png"] = { base=64, feet = {x=28, y=60}, hand1 = {x=22, y=13}, hand2 = {x=47, y=44}, belly = {x=33, y=40}, back = {x=34, y=31}, head = {x=37, y=16}, } tiles["npc/humanoid_orc_massok_the_dragonslayer.png"] = { base=64, feet = {x=34, y=58}, hand1 = {x=13, y=33}, hand2 = {x=55, y=35}, back = {x=32, y=12}, belly = {x=33, y=28}, head = {x=29, y=-3}, } tiles["npc/humanoid_human_gladiator.png"] = { base=64, feet = {x=35, y=58}, hand1 = {x=13, y=35}, hand2 = {x=53, y=36}, belly = {x=35, y=31}, back = {x=34, y=19}, head = {x=32, y=7}, } tiles["npc/humanoid_human_human_sun_paladin.png"] = { base=64, feet = {x=32, y=60}, hand1 = {x=14, y=32}, hand2 = {x=46, y=32}, belly = {x=31, y=29}, back = {x=31, y=17}, head = {x=31, y=5}, } tiles["npc/humanoid_human_shadowblade.png"] = { base=64, feet = {x=33, y=59}, hand1 = {x=8, y=15}, hand2 = {x=56, y=40}, back = {x=34, y=21}, belly = {x=28, y=31}, head = {x=37, y=9}, } tiles["npc/humanoid_human_sun_paladin_guren.png"] = { base=64, feet = {x=35, y=60}, belly = {x=31, y=29}, hand1 = {x=21, y=35}, back = {x=30, y=15}, head = {x=30, y=3}, }
gpl-3.0
LocutusOfBorg/ettercap
src/lua/share/core/base64.lua
12
2550
-- Base64-encoding -- Sourced from http://en.wikipedia.org/wiki/Base64 require('math') local __author__ = 'Daniel Lindsley' local __version__ = 'scm-1' local __license__ = 'BSD' local index_table = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/' function to_binary(integer) local remaining = tonumber(integer) local bin_bits = '' for i = 7, 0, -1 do local current_power = math.pow(2, i) if remaining >= current_power then bin_bits = bin_bits .. '1' remaining = remaining - current_power else bin_bits = bin_bits .. '0' end end return bin_bits end function from_binary(bin_bits) return tonumber(bin_bits, 2) end function to_base64(to_encode) local bit_pattern = '' local encoded = '' local trailing = '' for i = 1, string.len(to_encode) do bit_pattern = bit_pattern .. to_binary(string.byte(string.sub(to_encode, i, i))) end -- Check the number of bytes. If it's not evenly divisible by three, -- zero-pad the ending & append on the correct number of ``=``s. if math.mod(string.len(bit_pattern), 3) == 2 then trailing = '==' bit_pattern = bit_pattern .. '0000000000000000' elseif math.mod(string.len(bit_pattern), 3) == 1 then trailing = '=' bit_pattern = bit_pattern .. '00000000' end for i = 1, string.len(bit_pattern), 6 do local byte = string.sub(bit_pattern, i, i+5) local offset = tonumber(from_binary(byte)) encoded = encoded .. string.sub(index_table, offset+1, offset+1) end return string.sub(encoded, 1, -1 - string.len(trailing)) .. trailing end function from_base64(to_decode) local padded = to_decode:gsub("%s", "") local unpadded = padded:gsub("=", "") local bit_pattern = '' local decoded = '' for i = 1, string.len(unpadded) do local char = string.sub(to_decode, i, i) local offset, _ = string.find(index_table, char) if offset == nil then error("Invalid character '" .. char .. "' found.") end bit_pattern = bit_pattern .. string.sub(to_binary(offset-1), 3) end for i = 1, string.len(bit_pattern), 8 do local byte = string.sub(bit_pattern, i, i+7) decoded = decoded .. string.char(from_binary(byte)) end local padding_length = padded:len()-unpadded:len() if (padding_length == 1 or padding_length == 2) then decoded = decoded:sub(1,-2) end return decoded end
gpl-2.0