Delegate.RegInit("KJDW_Init");
NL.RegItemString(nil, "KJDW_ItemUse", "LUA_useKJDW");
local PlayerMapArr = {};
function new_PlayerMap(player)
local PlayerMap =
{
MapType = Char.GetData(player,%对象_MAP%);
Map = Char.GetData(player,%对象_地图%);
XStr = Char.GetData(player,%对象_X%);
YStr = Char.GetData(player,%对象_Y%);
};
return PlayerMap;
end
function KJDW_ItemUse(player,toPlayer,slot)
local MapType = Char.GetData(player,%对象_MAP%);
if MapType~=0 then
NLG.SystemMessage(player,"当前地图不能使用!");
return
end
if(Char.PartyNum(player) > 1)then
NLG.SystemMessage(player,"请先离开队伍!");
return;
end
local _itemindex = Char.GetItemIndex(player,slot);
local duidie = Item.GetData(_itemindex,%道具_堆叠数%);
if duidie == 1 then
Item.Kill(player, _itemindex, slot);
Item.UpItem(player, slot);
else
Item.SetData(_itemindex,%道具_堆叠数%,duidie-1);
Item.UpItem(player, slot);
end
PlayerMapArr[Playerkey(player)] = new_PlayerMap(player);
Char.Warp(player,0,23102,27,32);
return;
end
function initKJDWNpc_Init(index)
return 1;
end
function initKJDWNpc()
if (KJDWNpc == nil) then
KJDWNpc = NL.CreateNpc("lua/Module/KJDW.lua", "initKJDWNpc_Init");
Char.SetData(KJDWNpc,%对象_形象%,103012);
Char.SetData(KJDWNpc,%对象_原形%,103012);
Char.SetData(KJDWNpc,%对象_X%,23);
Char.SetData(KJDWNpc,%对象_Y%,25);
Char.SetData(KJDWNpc,%对象_地图%,23102);
Char.SetData(KJDWNpc,%对象_方向%,6);
Char.SetData(KJDWNpc,%对象_原名%,"出口");
NLG.UpChar(KJDWNpc);
Char.SetTalkedEvent("lua/Module/KJDW.lua","KJDWMsg", KJDWNpc);
end
end
function KJDWMsg(_me,_tome)
if (NLG.CanTalk(_me,_tome) == true) then
if (PlayerMapArr[Playerkey(_tome)] == nil) then
Char.Warp(_tome,0,278,27,22);
return;
else
Char.DischargeParty(_tome);
Char.Warp(_tome,PlayerMapArr[Playerkey(_tome)].MapType,PlayerMapArr[Playerkey(_tome)].Map,PlayerMapArr[Playerkey(_tome)].XStr,PlayerMapArr[Playerkey(_tome)].YStr);
return;
end
end
end
function KJDW_Init()
initKJDWNpc();
end
|
|