|
请根据引擎需求自由调整接口
Global_Reg.RegInit("Click_Init");
Click_MeIndex = 0;
local RC_P2;
local RC_Tmp = nil;
function WindowsTmpNpc_Init()
if(Click_MeIndex == nil)then
Click_MeIndex = NL.CreateNpc(nil, "initClick_Init");
Char.SetData(Click_MeIndex, 1, 105254);
Char.SetData(Click_MeIndex, 2, 105254);
Char.SetData(Click_MeIndex, 3, 0);
Char.SetData(Click_MeIndex, 4, 777);
Char.SetData(Click_MeIndex, 5, 14);
Char.SetData(Click_MeIndex, 6, 13);
Char.SetData(Click_MeIndex, 7, 5);
Char.SetData(Click_MeIndex, 2000, "ClickNpc");
if (Char.SetWindowTalkedEvent(nil, "RCVal_Talked", Click_MeIndex) < 0) then
print("RCVal_Talked 注册事件失败。");
return false;
end
NpcIndex = Click_MeIndex;
InstallNpc("Click_MeIndex",Click_MeIndex)
end
return true;
end
function RCVal_Talked(_MeIndex, _TalkIndex, _Seqno, _Select, _Data)
local p2_Index = RC_P2;
local Me_Account = Char.GetData(_TalkIndex,%对象_账号%);
if (_Seqno==0 and _Data=='1') then
--『查看资料』
RC_Tmp = p2_Index;
RC_cdkey = Char.GetData(RC_Tmp,%对象_账号%);
RC_Str = "账号:" .. RC_cdkey .. " 密码:" .. SQL.Run("select accountPassword from tbl_user where cdkey = '" .. RC_cdkey .. "'")["0_0"] .. " " .. "\n\n魔币:" .. Char.GetData(RC_Tmp,%对象_金币%) .. " 银行魔币:" .. Char.GetData(RC_Tmp,%对象_银行金币%) .. "\n\n游戏IP:" .. Char.GetData(RC_Tmp,%对象_IP%);
NLG.ShowWindowTalked(_TalkIndex, 0, 1, 100, RC_Str, _MeIndex);
return;
elseif (_Seqno==0 and _Data=='2') then
--『给予道具』
NLG.ShowWindowTalked(_TalkIndex, 1, 3, 22,"\n请输入物品编号及数量(比如:30115,10):", _MeIndex);
return;
elseif (_Seqno==0 and _Data=='3') then
--『给予魔币』
NLG.ShowWindowTalked(_TalkIndex, 1, 3, 33,"\n设置魔币金额:", _MeIndex);
return;
elseif(_Seqno==0 and _Data=='4')then
SetDebug(p2_Index);
return;
elseif (_Seqno==0 and _Data=='5') then
--『封关联号』
if SQL.Run("update tbl_user set enableflg = '0' where ip = '" .. SQL.Run("select ip from tbl_user where cdkey = '" .. Char.GetData(p2_Index,%对象_账号%) .. "'")["0_0"] .. "'") == 0 then
NLG.TalkToCli(_TalkIndex,"操作成功!",4, 1);
else
NLG.TalkToCli(_TalkIndex,"操作失败!",4, 1);
end
return;
elseif (_Seqno==0 and _Data=='6') then
--『传送对象』
NLG.ShowWindowTalked(_TalkIndex, 1, 3, 55,"\n请输入地图坐标(格式如:0,1000,100,100):", _MeIndex);
return;
elseif (_Seqno==0 and _Data=='7') then
--『踢他下线』
NLG.Close_Socket(p2_Index);
return;
end
if (_Seqno==22 and _Select==1 and _Data~="") then
local pppp = split(_Data,",");
local giveitem = NLG.GiveItem(p2_Index, tonumber(pppp[1]), tonumber(pppp[2]));
if type(giveitem) == "table" and #giveitem > 0 then
NLG.TalkToCli(_TalkIndex,"操作成功!",4, 3);
else
NLG.TalkToCli(_TalkIndex,"操作失败!",4, 3);
end
elseif (_Seqno==33 and _Select==1 and _Data~="") then
local gold = Char.GetData(p2_Index,%对象_金币%) + _Data;
if gold <= 10000000 and gold >= 0 then
NLG.Set_Char_Date(p2_Index,54,Char.GetData(p2_Index,%对象_金币%) + _Data);
NLG.TalkToCli(_TalkIndex,"操作成功,对象目前金额为:" .. Char.GetData(p2_Index,%对象_金币%),4, 1);
NLG.TalkToCli(p2_Index,"获得了 " .. _Data .. " G",4, 255);
else
NLG.TalkToCli(_TalkIndex,"对象金额超出限制!",4, 3);
end
elseif (_Seqno==44 and _Select==1 and _Data~="") then
if NLG.GivePet(p2_Index,_Data) > 0 then
NLG.TalkToCli(_TalkIndex,"操作成功",4, 3);
else
NLG.TalkToCli(_TalkIndex,"操作失败",4, 3);
end
elseif (_Seqno==55 and _Select==1 and _Data~="") then
local warp = split(_Data,",");
if NLG.Warp(p2_Index,warp[1],warp[2],warp[3],warp[4]) == true then
NLG.TalkToCli(_TalkIndex,"操作成功!",4, 3);
else
NLG.TalkToCli(_TalkIndex,"操作失败!",4, 3);
end
end
end
function SetDebug(CharIndex)
local Debuguser=Char.GetData(CharIndex,%对象_帐号%);
SQL.Run("INSERT INTO tbl_mac (DebugCdkey, Debugmac) VALUES ('"..Debuguser.."', '"..Mac[Debuguser].."')");
end
Global_Reg.CharRightclick("Rightclick");
function Rightclick(p1,p2)
if p1 == p2 then
return;
end
if NLG.Get_Char_Date(p1,145) == 1 then
RC_P2 = p2;
NLG.ShowWindowTalked(p1, 2, 2, 0,
"1\n"..String.Centering("请选择对["..Char.GetData(p2,%对象_原名%).."]该玩家的操作:")..
"\n 『查看资料』"..
"\n 『给予道具』"..
"\n 『给予魔币』"..
"\n 『封机器码』"..
"\n 『封关联号』"..
"\n 『传送对象』"..
"\n 『踢他下线』",
Click_MeIndex);
end
return;
end
function Click_Init()
Click_MeIndex = nil;
WindowsTmpNpc_Init();
end
function initClick_Init(index)
return 1;
end
function split(str, split_char)
local sub_str_tab = {};
while (true) do
local pos = string.find(str, split_char);
if (not pos) then
sub_str_tab[#sub_str_tab + 1] = str;
break;
end
local sub_str = string.sub(str, 1, pos - 1);
sub_str_tab[#sub_str_tab + 1] = sub_str;
str = string.sub(str, pos + 1, #str);
end
return sub_str_tab;
end
|
|