Files
mtgodot-poc/tools/server/hunt-set/hunt_set.quest
T

95 lines
3.9 KiB
Plaintext

-- 小狩猎套装礼包 50307 (README.md): a level-1 +9 set for the player's class, five full attributes per piece.
-- 50307 is the unused 40250 任务执行书(初级) (ITEM_QUEST, so using it is `when 50307.use`).
-- item.set_attribute(index, apply, value) is not 40250: server.patch adds it to game.
-- UTF-8 here; install.sh converts it to GBK for qc.
quest hunt_set begin
state start begin
-- Gives one item and writes attributes 0..4 (a list of {apply, value}); 5 and 6 are cleared.
function give(vnum, attrs)
pc.give_item2_select(vnum)
-- Without a free cell nothing is given and the selected item is still the previous one.
if item.get_vnum() ~= vnum then
return
end
for i = 1, 7 do
local attr = attrs[i]
if attr then
item.set_attribute(i - 1, attr[1], attr[2])
else
item.set_attribute(i - 1, 0, 0)
end
end
end
when 50307.use begin
-- EApplyTypes (common/length.h)
local MAX_HP, INT, STR, DEX, ATT_SPEED, MOV_SPEED, CAST_SPEED = 1, 4, 5, 6, 7, 8, 9
local CRITICAL, PENETRATE, ANIMAL, ORC, MILGYO, UNDEAD, DEVIL = 15, 16, 18, 19, 20, 21, 22
local STEAL_HP, REFLECT_MELEE, EXP, GOLD, DROP = 23, 39, 43, 44, 45
local IMMUNE_STUN, IMMUNE_SLOW, ATT_GRADE = 48, 49, 53
-- One set per character (quest flag hunt_set.opened); the box stays in the bag.
if pc.getqf("opened") == 1 then
syschat("每个角色只能打开一次小狩猎套装礼包。")
return
end
if pc.get_empty_inventory_count() < 15 then
syschat("背包空位不足,请至少留出15格再打开礼包。")
return
end
local job = pc.get_job()
local weapon, arrows
say_title("小狩猎套装礼包")
if job == 0 then
say("请选择武器:")
local s = select("武士刀+9(单手剑)", "混铁斩+9(双手剑)")
local weapons = { 19, 3009 }
weapon = weapons[s]
elseif job == 1 then
say("请选择武器:")
local s = select("白铁双刀+9(双刀)", "藤竹弓+9(弓,附木箭200支)", "武士刀+9(单手剑)")
local weapons = { 1009, 2009, 19 }
weapon = weapons[s]
arrows = s == 2
elseif job == 2 then
say("武器:武士刀+9")
weapon = 19
else
say("武器:纸折扇+9")
weapon = 7009
end
say("确定打开礼包吗?")
local ok = select("打开", "取消")
if ok ~= 1 then
return
end
-- The dialog waited; check again that the box is still there and the bag has room.
if pc.getqf("opened") == 1 or pc.count_item(50307) < 1 or pc.get_empty_inventory_count() < 15 then
syschat("背包空位不足,请至少留出15格再打开礼包。")
return
end
local mains = { STR, DEX, INT, INT }
local armors = { 11209, 11409, 11609, 11809 }
local helmets = { 12209, 12349, 12489, 12629 }
local main, armor, helmet = mains[job + 1], armors[job + 1], helmets[job + 1]
pc.setqf("opened", 1)
pc.remove_item(50307, 1)
hunt_set.give(weapon, { { CRITICAL, 10 }, { PENETRATE, 10 }, { main, 12 }, { DEVIL, 20 }, { UNDEAD, 20 } })
hunt_set.give(armor, { { MAX_HP, 2000 }, { STEAL_HP, 10 }, { ATT_GRADE, 50 }, { REFLECT_MELEE, 10 }, { CAST_SPEED, 20 } })
hunt_set.give(helmet, { { ATT_SPEED, 8 }, { ANIMAL, 20 }, { ORC, 20 }, { MILGYO, 20 }, { UNDEAD, 20 } })
hunt_set.give(13009, { { EXP, 20 }, { GOLD, 20 }, { IMMUNE_STUN, 1 }, { IMMUNE_SLOW, 1 }, { DEVIL, 20 } })
hunt_set.give(14009, { { DROP, 20 }, { MAX_HP, 2000 }, { PENETRATE, 10 }, { STEAL_HP, 10 }, { ANIMAL, 20 } })
hunt_set.give(15009, { { MOV_SPEED, 20 }, { ATT_SPEED, 8 }, { CRITICAL, 10 }, { EXP, 20 }, { GOLD, 20 } })
hunt_set.give(16009, { { MAX_HP, 2000 }, { CRITICAL, 10 }, { PENETRATE, 10 }, { EXP, 20 }, { GOLD, 20 } })
hunt_set.give(17009, { { MOV_SPEED, 20 }, { DROP, 20 }, { ORC, 20 }, { MILGYO, 20 }, { UNDEAD, 20 } })
if arrows then
pc.give_item2(8000, 200)
end
syschat("小狩猎套装已放入背包。")
end
end
end