local bditemdorp_NPCxq = {100905,"丢地NPC",6,7777,22,22} --NPC详情
local tab_dorpitem = tab_dorpitem or {}
local tab_dorpitem_close = tab_dorpitem_close or {}
----------
Global_Reg.RegInit("bditemdorp_zhuce");--全局注册
--Global_Reg.RegDropItem("bditemdorp_itemdorp");--丢出道具注册
Global_Reg.RegTalkEvent ("bditemdorp_speak");--玩家说话
Global_Reg.RegLogoutEvent ("bditemdorp_longin")--登出
function bditemdorp_itemdorp(player, Itemindex, ItemPos)
if tab_dorpitem_close[player]==nil then
local ddxs = Item.GetData(Itemindex, 53)--丢地消失
if ddxs == 1 then
local playerCDK = Char.GetData(player,2002)
local RegistNumber = Char.GetData(player,48)
local tkey=playerCDK..RegistNumber
tab_dorpitem [tkey] = ItemPos
NLG.ShowWindowTalked(player,0,14,212,"\n\n该道具为绑定道具,是否要丢弃\n\n选$1[是]$0丢弃,选$1[否]$0放弃,点击$4[取消]$0将会关闭绑定道具丢地提示功能\n(直到下次登录,或者输入指令$4/安全丢地 $0开启)",LuaNpcIndex.bditemdorp_npc)
return -1
end
end
return 0
end
function bditemdorp_zhuce() --NPC注册
bditemdorp_NPC()
return 0
end
function bditemdorp_NPC(npc) --NPC设置
if npc == nil then
npc = NL.CreateNpc(nil,"bditemdorp_NPCzhizuo")
end
Char.SetData(npc,1,bditemdorp_NPCxq[1])
Char.SetData(npc,2,bditemdorp_NPCxq[1])
Char.SetData(npc,2000,bditemdorp_NPCxq[2])
Char.SetData(npc,7,bditemdorp_NPCxq[3])
Char.SetData(npc,4,bditemdorp_NPCxq[4])
Char.SetData(npc,5,bditemdorp_NPCxq[5])
Char.SetData(npc,6,bditemdorp_NPCxq[6])
LuaNpcIndex["bditemdorp_npc"]=npc;--读取使用用 LuaNpcIndex.bditemdorp_npc 就可以读取对应NPC index
InstallNpc("bditemdorp_npc",npc);
NLG.UpChar(npc)
Char.SetTalkedEvent(nil,"bditemdorp_chuangkou",npc)
Char.SetWindowTalkedEvent(nil,"bditemdorp_gongneng",npc)
return true
end
function bditemdorp_NPCzhizuo(index)
return true;
end
function bditemdorp_chuangkou(npc,player) --窗口
if NLG.CanTalk(npc,player) then
NLG.ShowWindowTalked(player,0,12,212,"\n\n该道具为绑定道具,是否要丢弃",npc)
end
end
function bditemdorp_speak(player, Msg, color, range, size,channeltype)
if Msg=="P|/安全丢地" then
if tab_dorpitem_close[player] then
tab_dorpitem_close[player]=nil
NLG.SystemMessage(player,"[系统]您开启了绑定道具丢地提示功能")
end
end
end
function bditemdorp_longin(player)
if tab_dorpitem_close[player] then
tab_dorpitem_close[player]=nil
end
return 0;
end
function bditemdorp_gongneng(npc,player,_SqeNo,_select,_data) --功能
--NLG.SystemMessage(player,"\n _SqeNo是:"..(_SqeNo or "空").."它的类型是"..type(_SqeNo).."\n _select是:".. (_select or "空").."它的类型是"..type(_select).."\n _data是:"..(_data or "空").."它的类型是"..type(_data))
if _SqeNo == 212 then
if _select == 2 then
tab_dorpitem_close[player]=1
NLG.SystemMessage(player,"[系统]您关闭了绑定道具丢地提示功能,重新登录或输入/安全丢地可再次开启该功能")
elseif _select == 4 then
local playerCDK = Char.GetData(player,2002)
local RegistNumber = Char.GetData(player,48)
local tkey=playerCDK..RegistNumber
Char.DropItem(player, tab_dorpitem [tkey])
tab_dorpitem [tkey] = nil
end
end
end
|
|