Global_Reg.RegMoveEquipItem("shoushicashi_item")--移动一件道具到另一个格子事件
function shoushicashi_item(player, OldItemPos, NewItemPos)--移动一件道具到另一个格子事件
local cashiindex = Char.GetItemIndex(player,NewItemPos);--拿起的index
local cashiItem_ID = Item.GetData(cashiindex,0) or -1--拿起的道具ID
if cashiItem_ID == 79781 then
local shoushiindex = Char.GetItemIndex(player,OldItemPos);--目标index
local shoushiItem_ID = Item.GetData(shoushiindex,0) or -1--目标道具ID
local shoushiItem_type = Item.GetData(shoushiindex,%道具_类型%) or -1 --目标首饰类型
if (shoushiItem_type >= 15 and shoushiItem_type <= 21) or shoushiItem_type == 55 then --若是首饰
local shoushiItem_name = Item.GetData(shoushiindex,%道具_已鉴定名%) --目标首饰名称
local a = string.sub(shoushiItem_name,1,6)--获取前6字符
if a and a == "秘宝·"then
local shoushiItem_naijiu = Item.GetData(shoushiindex,%道具_最大耐久%) --目标首饰最大耐久
NLG.DelItem(player, cashiItem_ID, 1) --扣除道具
Item.SetData(shoushiindex,%道具_耐久%,shoushiItem_naijiu)
Item.UpItem(player,OldItemPos)
NLG.SystemMessage(player,"秘宝首饰已擦拭,如新的一样。")
elseif a and a == "精致·" then
local shoushiItem_naijiu = Item.GetData(shoushiindex,%道具_最大耐久%) --目标首饰最大耐久
NLG.DelItem(player, cashiItem_ID, 1) --扣除道具
Item.SetData(shoushiindex,%道具_耐久%,shoushiItem_naijiu)
Item.UpItem(player,OldItemPos)
NLG.SystemMessage(player,"精致首饰已擦拭,如新的一样。")
else
NLG.SystemMessage(player,"该首饰不是秘宝或精致首饰,不可擦拭。")
end
else
NLG.SystemMessage(player,"该道具并不是首饰类别,不可擦拭。")
end
end
return 0
end
|
|