--该lua不可在线重载,每组顺序也不可更改
local delflagpassword = "ftmoli0527" --退回形象密码(不退任何东西 只删除标记)
local metamo_npctab_zuobiao = {} --NPC坐标
local metamo_npctab_xingxiang = {} -- NPC形象
local jilunpctap = {} -- 记录NPC表
--metamo_npctab_zuobiao[1] = {1地图,2X,3Y,4itemid,5item数量,6item名字,7flag}
metamo_npctab_zuobiao[1] = {60068,39,42,50385,10,"美容卷",184}-- 第一组NPC坐标
metamo_npctab_zuobiao[2] = {60069,17,33,50385,20,"美容卷",184}-- 第二组NPC坐标
metamo_npctab_zuobiao[3] = {60070,17,32,50385,50,"美容卷",184}
metamo_npctab_zuobiao[4] = {60071,18,37,50385,100,"美容卷",184}
metamo_npctab_zuobiao[5] = {60070,17,39,50385,50,"美容卷",184}
metamo_npctab_zuobiao[6] = {60068,39,62,50385,10,"美容卷",184}
metamo_npctab_zuobiao[7] = {60071,18,35,50385,100,"美容卷",184}
metamo_npctab_zuobiao[8] = {60071,18,39,50385,100,"美容卷",184}
metamo_npctab_zuobiao[9] = {60071,18,33,50385,100,"美容卷",184}
metamo_npctab_zuobiao[10] = {60071,18,41,50385,100,"美容卷",184}
metamo_npctab_zuobiao[11] = {60071,18,43,50385,100,"美容卷",184}
metamo_npctab_zuobiao[12] = {60071,18,45,50385,100,"美容卷",184}
metamo_npctab_zuobiao[13] = {60071,18,47,50385,100,"美容卷",184}
metamo_npctab_zuobiao[14] = {60071,18,31,50385,100,"美容卷",184}
metamo_npctab_zuobiao[15] = {60071,18,29,50385,100,"美容卷",184}
----20210210开服形象
metamo_npctab_zuobiao[16] = {38083,2,11,91066,1,"贵宾美容证",-1}
metamo_npctab_zuobiao[17] = {38083,2,13,91066,1,"贵宾美容证",-1}
metamo_npctab_zuobiao[18] = {38083,16,11,91067,1,"贵宾美容证",-1}
metamo_npctab_zuobiao[19] = {38083,16,13,91067,1,"贵宾美容证",-1}
metamo_npctab_zuobiao[20] = {60071,18,49,91072,1,"妹子美容证",-1}
--20210226元宵
metamo_npctab_zuobiao[21] = {38085,2,11,91086,1,"贵宾美容证",-1}
metamo_npctab_zuobiao[22] = {38085,2,13,91086,1,"贵宾美容证",-1}
metamo_npctab_zuobiao[23] = {38085,16,11,91087,1,"贵宾美容证",-1}
metamo_npctab_zuobiao[24] = {38085,16,13,91087,1,"贵宾美容证",-1}
metamo_npctab_xingxiang[1] = {100002,100008,100014,100020,100027,100033,100039,100045,100052,100058,100064,100070,100077,100083,100089,100095,100102,100108,100114,100120,100252,100258,100264,100270,100277,100283,100289,100295,100302,100308,100314,100320,100327,100333,100339,100345,100352,100358,100364,100370,100377,100383,100389,100395,100402,100408,100414,100420,105002,105008,105014,105020,105027,105033,105039,105045,105052,105058,105064,105070,105077,105083,105089,105095,105102,105108,105114,105120,105127,105133,105139,105145,105152,105158,105164,105170,105252,105258,105264,105270}-- 建立第一组
metamo_npctab_xingxiang[2] = {105502,105508,105514,105520,105527,105533,105539,105545,104402,104408,104414,104420,104426,104438,104444,104456,104468,104474,104480,104486,104492,104498,104504,104510,104516}-- 建立第二组
metamo_npctab_xingxiang[3] = {100527,100552,100577,100602,100627,100652,100677,100702,100727,100752,100802,106427,106452,106477,106502,106677,106702,106727,106752,104450,104462}-- 建立第三组
metamo_npctab_xingxiang[4] = {100656,100657,100658,100659,100660,100661}
metamo_npctab_xingxiang[5] = {106625,106626,106627,106628,106629,106630,106650,106651,106652,106653,106654,106655,106525,106526,106527,106528,106529,106530,106550,106551,106552,106553,106554,106555,106575,106576,106577,106578,106579,106580,106600,106601,106602,106603,106604,106605}
metamo_npctab_xingxiang[6] = {105277,105283,105289,105295,105302,105308,105314,105320,105327,105333,105339,105345,105352,105358,105364,105370,105377,105383,105389,105395,105402,105408,105414,105420,106002,106008,106014,106020,106027,106033,106039,106045,106052,106058,106064,106070,106077,106083,106089,106095,106102,106108,106114,106120,106127,106133,106139,106145,106152,106158,106164,106170,106252,106258,106264,106270,106277,106283,106289,106295,106302,106308,106314,106320,106327,106333,106339,106345,106352,106358,106364,106370,106377,106383,106389,106395,106402,106408,106414,106420}
metamo_npctab_xingxiang[7] = {100888,100889,100890,100891,100892,100893}
metamo_npctab_xingxiang[8] = {100903,100904,100905,100906,100907,100908}
metamo_npctab_xingxiang[9] = {100921,100922,100923,100924,100925,100926}
metamo_npctab_xingxiang[10] = {100951,100952,100953,100954,100955,100956}
metamo_npctab_xingxiang[11] = {100933,100934,100935,100936,100937,100938}
metamo_npctab_xingxiang[12] = {100204,100205,100206,100207,100208,100209}
metamo_npctab_xingxiang[13] = {100769,106582,100987,105991,100193,106491}
metamo_npctab_xingxiang[14] = {100486,100534,100546,100566,100570,100586}
metamo_npctab_xingxiang[15] = {100641,100647,100667,100683,100691,100697}
----开服形象
metamo_npctab_xingxiang[16] = {106782,106741,100544}
metamo_npctab_xingxiang[17] = {106222,100201,106186}
metamo_npctab_xingxiang[18] = {100639,100672,100689}
metamo_npctab_xingxiang[19] = {100709,100714,100723}
metamo_npctab_xingxiang[20] = {100194,100195,100196,100197,100198,100200}
--20210226元宵
metamo_npctab_xingxiang[21] = {106236,106219,105741}
metamo_npctab_xingxiang[22] = {100823,100228,105664}
metamo_npctab_xingxiang[23] = {100719,100731,100759}
metamo_npctab_xingxiang[24] = {100763,100767,100778}
--field存储格式( player,metamo_x_形象编号,1)
function metamo_npc_dh(img,map,x,y,k,b)
local npc = -1
if npc == nil or npc < 0 then
npc = NL.CreateNpc(nil,"metamo_npc_dh2")
end
Char.SetData(npc,1,img)
Char.SetData(npc,2,img)
Char.SetData(npc,4,map)
Char.SetData(npc,5,x)
Char.SetData(npc,6,y)
Char.SetData(npc,7,4)
Char.SetData(npc,2000,"形象修改")
NLG.UpChar(npc)
jilunpctap[npc] = {k,b} --记录形象表位置
return true
end
function metamo_npc_dh2(npc)
Char.SetTalkedEvent(nil, "metamo_npc_gn",npc)--功能函数
Char.SetWindowTalkedEvent(nil,"metamo_npc_ck",npc)--窗口功能函数
return true;
end
function metamo_npc_gn(npc,player)
if NLG.CanTalk(npc,player) then
local x = jilunpctap[npc][1]
local y = jilunpctap[npc][2]
local plfield = Field.Get(player,"metamo_"..x.."_"..y)
if plfield == "1" then
NLG.ShowWindowTalked(player,0,23,444,"\n您已购买过此形象\n点击【是】即可更换为此形象的当前形象\n点击【确定】可查看动作",npc)--有field
else
local itemname = metamo_npctab_zuobiao[jilunpctap[npc][1]][6]
local pay = metamo_npctab_zuobiao[jilunpctap[npc][1]][5]
NLG.ShowWindowTalked(player,0,7,555,"您尚未购买过此形象。\n此形象可修改的个性化设置。\n购买需要"..pay.."个"..itemname.."\n\n*点击【确定】可查看动作\n\n*点击【是】可购买此",npc) -- 没filed
end
end
end
function metamo_npc_ck(npc,player,Seqno,Select,Data)
--NLG.SystemMessage(-1,"\n Seqno是:"..(Seqno or "空").."它的类型是"..type(Seqno).."\n Select是:".. (Select or "空").."它的类型是"..type(Select).."\n Data是:"..(Data or "空").."它的类型是"..type(Data))
if NLG.CanTalk(npc,player) then
local x = jilunpctap[npc][1] --NPC分组
local y = jilunpctap[npc][2] --形象编号
if Seqno == 555 then --没有field
if Select == 1 then --选择确定-动作
local msg = "2\n请选择你要查看的动作:\n\n1.攻击\n2.防御\n3.跑步\n4.魔法\n5.受伤\n6.死亡\n7.坐下"
NLG.ShowWindowTalked(player,2,2,1100,msg,npc) -- 显示动作窗口
elseif Select == 4 then -- 选择是-购买
local pay = metamo_npctab_zuobiao[jilunpctap[npc][1]][5]
local itemname = metamo_npctab_zuobiao[jilunpctap[npc][1]][6]
local msg = "\n\n你确定购买此形象吗?\n\n点击【确定】花费【"..pay.."】个【"..itemname.."】购买"
NLG.ShowWindowTalked(player,1,3,666,msg,npc)
end
elseif Seqno == 666 then --确定购买形象
local itemid = metamo_npctab_zuobiao[jilunpctap[npc][1]][4] --获取购买道具ID
local itempay = metamo_npctab_zuobiao[jilunpctap[npc][1]][5] --获取购买道具数量
local haveitem = Char.ItemNum(player, itemid) -- 拥有道具数量
local endevent = Char.EndEvent(player, metamo_npctab_zuobiao[jilunpctap[npc][1]][7])--获取是否有endevent
if endevent == 1 then
itempay = itempay/2
if haveitem >= itempay then
NLG.DelItem(player, itemid, itempay)
Field.Set(player,"metamo_"..x.."_"..y,"1") --设置field,最终格式metamo_x_形象编号,1
NLG.SystemMessage(player,"购买形象成功。")
elseif haveitem < itempay then --判断拥有道具大于需要购买道具数量
NLG.SystemMessage(player,"身上道具不足。")
end
elseif haveitem >= itempay then --判断拥有道具大于需要购买道具数量
NLG.DelItem(player, itemid, itempay)
Field.Set(player,"metamo_"..x.."_"..y,"1") --设置field,最终格式metamo_x_形象编号,1
NLG.SystemMessage(player,"购买形象成功。")
elseif haveitem < itempay then --判断拥有道具大于需要购买道具数量
NLG.SystemMessage(player,"身上道具不足。")
else
NLG.SystemMessage(player,"发生错误,请联系GM")
end
elseif Seqno == 444 then --有field
if Select == 4 then -- 修改形象
local plfield = Field.Get(player,"metamo_"..x.."_"..y)
if plfield == "1" then
Char.SetData(player,1,y)
Char.SetData(player,2,y)
Char.SetData(player,158,y)
NLG.UpChar(player)
if NLG.Get_Char_Date(player,145) > 0 then
NLG.SystemMessage(player,"赋予玩家的形象编号:"..y.."。")
end
else
NLG.SystemMessage(player,"您尚未购买此形象。")
end
elseif Select == 1 then -- 显示动作
local msg = "2\n请选择你要查看的动作:\n\n1.攻击\n2.防御\n3.跑步\n4.魔法\n5.受伤\n6.死亡\n7.坐下"
NLG.ShowWindowTalked(player,2,2,1100,msg,npc) -- 显示动作窗口
elseif Select == 16 then -- 返回上一步删除形象操作
local msg = "\n特殊调试功能,玩家请勿使用。\n\n请输入密码:"
NLG.ShowWindowTalked(player,1,3,1200,msg,npc)
end
elseif Seqno == 1100 then --动作显示
if tonumber(Data) == 0 then
NLG.SetAction(npc,0)
elseif tonumber(Data) == 1 then
NLG.SetAction(npc,5)
elseif tonumber(Data) == 2 then
NLG.SetAction(npc,9)
elseif tonumber(Data) == 3 then
NLG.SetAction(npc,3)
elseif tonumber(Data) == 4 then
NLG.SetAction(npc,6)
elseif tonumber(Data) == 5 then
NLG.SetAction(npc,8)
elseif tonumber(Data) == 6 then
NLG.SetAction(npc,10)
elseif tonumber(Data) == 7 then
NLG.SetAction(npc,11)
end
NLG.ShowWindowTalked(player,2,2,1100,msg,npc)
elseif Seqno == 1200 then --删除形象
if Select == 1 then
if Data == delflagpassword then
Field.Set(player,"metamo_"..x.."_"..y,"0") --设置field为0
NLG.SystemMessage(player,"修改成功。")
else
NLG.SystemMessage(player,"密码错误。")
end
end
end
end
end
function metamo_npc_zhizuo()--制作NPC
for k,v in pairs(metamo_npctab_zuobiao) do
for a,b in pairs(metamo_npctab_xingxiang[k] ) do
local map = metamo_npctab_zuobiao[k][1]--地图
local x = metamo_npctab_zuobiao [k][2]--x坐标
local y = metamo_npctab_zuobiao [k][3]--y坐标
local img = b--npc形象
local d = math.mod(a,8) --每行余数
local e = math.floor(a/8) --取第几行
if d == 0 then
metamo_npc_dh (img,map,x+(2*(d+8)),y+(2*(e-1)),k,b)
else
metamo_npc_dh (img,map,x+(2*d),y+(2*e),k,b)
end
end
end
end
metamo_npc_zhizuo()
|
|