local systrannpcmetamo = 106152 --寄售Npc形象
local systrannpcmap = 60005 --寄售Npc所在地图
local systrannpcposx = 42 --寄售Npc x坐标
local systrannpcposy = 20 --寄售Npc y坐标
local systrannpcdir = 6 --寄售Npc方向
local systrannpcname = "木材箱寄售商人" --寄售Npc名字
local maxgold = 100000000 --服务器最大金币数量
local filetree = "./lua/luatxt/caiji/systran2.txt" --文件路径
local inta = { --可寄售的物品列表
--{物品名,物品id,基准收购价,收购数量上限,是否启动自动调价,是否允许NPC无库存销售,是否允许NPC满库存收购,单次售购数量}
{"装满『印度轻木』的盒子",39572,2000,100,1,0,0,1},
{"装满『枞』的盒子",39573,2250,100,1,0,0,1},
{"装满『黄月木』的盒子",39574,2750,100,1,0,0,1},
{"装满『铁杉木』的盒子",39575,4000,100,1,0,0,1},
{"装满『琵琶木』的盒子",39576,4500,100,1,0,0,1},
{"装满『茱萸木』的盒子",39583,4500,100,1,0,0,1},
{"装满『赤松』的盒子",39577,6000,100,1,0,0,1},
{"装满『朴』的盒子",39578,12800,100,1,0,0,1},
{"装满『杉木』的盒子",39579,14400,100,1,0,0,1},
{"装满『丝柏』的盒子",39580,40000,100,1,0,0,1},
{"装满『梣』盒子",39581,52000,100,1,0,0,1},
{"装满『单木』的盒子",39582,14400,100,1,0,0,1},
}
----------------------------------
Global_Reg.RegInit("systranvalue252A");
function systranvalue252A()
systranvalue252B();
return 0;
end
function systranvalue252B(npc)
if npc == nil or npc < 0 then
npc = NL.CreateNpc(nil,"systranvalue252C")
end
Char.SetData(npc,%对象_形象%,systrannpcmetamo)
Char.SetData(npc,%对象_原形%,systrannpcmetamo)
Char.SetData(npc,%对象_地图%,systrannpcmap)
Char.SetData(npc,%对象_X%,systrannpcposx)
Char.SetData(npc,%对象_Y%,systrannpcposy)
Char.SetData(npc,%对象_方向%,systrannpcdir)
Char.SetData(npc,%对象_原名%,systrannpcname)
NLG.UpChar(npc)
LuaNpcIndex["systranvalue252"]=npc;
InstallNpc("systranvalue252",npc);
Char.SetTalkedEvent(nil, "systranvalue172",npc)
Char.SetWindowTalkedEvent(nil,"systranvalue192",npc)
return true
end
function systranvalue252C(index)
return true;
end
function systranvalue172(npc,player)
if NLG.CanTalk(npc,player) == false then
return
end
local systranvalue18 = "2\n这些是从玩家手中采购到的木材,便宜卖了~\n"
for i = 1,6 do
if type(inta[i]) == "table" then
systranvalue18 = systranvalue18.."\n"..i..". "..inta[i][1].."("..systranvalue4(inta[i][2]).."/"..inta[i][4]..")"
else
systranvalue18 = systranvalue18.."\n"..i..". 无"
end
end
NLG.ShowWindowTalked(player,2,34,1000,systranvalue18,npc)
end
function systranvalue192(npc,player,Seqno,Select,Data)
if NLG.CanTalk(npc,player) == false then
return
end
if Select ~= 2 then
if Seqno < 1000 then
local systranvalue20 = Seqno
if type(inta[systranvalue20]) == "table" then
if tonumber(Data) ~= nil then
local systranvalue21 = systranvalue4(inta[systranvalue20][2])
local systranvalue22
local systranvalue23
if inta[systranvalue20][5] == 1 then
systranvalue22 = math.floor(systranvalue15(systranvalue21,inta[systranvalue20][4])*inta[systranvalue20][3])
systranvalue23 = math.floor(systranvalue16(systranvalue21,inta[systranvalue20][4])*inta[systranvalue20][3])
else
systranvalue22 = inta[systranvalue20][3]
systranvalue23 = inta[systranvalue20][3]
end
if tonumber(Data) == 1 then
if systranvalue12(player,systranvalue23) >= 0 then
if Char.ItemNum(player,inta[systranvalue20][2]) >= inta[systranvalue20][8] then
if systranvalue21 < inta[systranvalue20][4] then
systranvalue9(inta[systranvalue20][2],systranvalue21+1)
elseif inta[systranvalue20][7] ~= 1 then
NLG.SystemMessage(player,"此道具不支持满库存收购。")
return
end
Char.DelItem(player,inta[systranvalue20][2],inta[systranvalue20][8])
systranvalue1(player,systranvalue23)
else
NLG.SystemMessage(player,"你没有可出售的道具。")
end
else
NLG.SystemMessage(player,"你的钱太多了。")
end
elseif tonumber(Data) == 2 then
if systranvalue12(player,-systranvalue22) >= 0 then
if Char.FindEmptyItemBox(player) > 0 then
if systranvalue21 > 0 then
systranvalue9(inta[systranvalue20][2],systranvalue21-1)
elseif inta[systranvalue20][6] ~= 1 then
NLG.SystemMessage(player,"此道具不支持无库存出售。")
return
end
systranvalue1(player,-systranvalue22)
Char.GiveItem(player,inta[systranvalue20][2],inta[systranvalue20][8])
else
NLG.SystemMessage(player,"你的东西太多了。")
end
else
NLG.SystemMessage(player,"你的钱不够。")
end
end
end
else
NLG.SystemMessage(player,"请您重新选择正确的内容。")
end
else
if tonumber(Data) == -2 then
local systranvalue18 = "2\n这些是从玩家手中采购到的木材,便宜卖了~\n"
local systranvalue20 = math.floor(Seqno/1000)
local systranvalue24 = 50
if Select == 32 then
systranvalue20 = systranvalue20+1
if systranvalue20*6 >= #inta then
systranvalue24 = 18
end
elseif Select == 16 then
systranvalue20 = systranvalue20-1
if systranvalue20 == 1 then
systranvalue24 = 34
end
end
for i = 1,6 do
if type(inta[(i+(systranvalue20-1)*6)]) == "table" then
systranvalue18 = systranvalue18.."\n"..(i+(systranvalue20-1)*6)..". "..inta[(i+(systranvalue20-1)*6)][1].."("..systranvalue4(inta[(i+(systranvalue20-1)*6)][2]).."/"..inta[(i+(systranvalue20-1)*6)][4]..")"
else
systranvalue18 = systranvalue18.."\n"..(i+(systranvalue20-1)*6)..". 无"
end
end
NLG.ShowWindowTalked(player,2,systranvalue24,systranvalue20*1000,systranvalue18,npc)
else
if tonumber(Data) ~= nil and tonumber(Data) > 0 then
local systranvalue20 = (math.floor(Seqno/1000)-1)*6 + tonumber(Data)
if type(inta[systranvalue20]) == "table" then
local systranvalue21 = systranvalue4(inta[systranvalue20][2])
local systranvalue22
local systranvalue23
if inta[systranvalue20][5] == 1 then
systranvalue22 = math.floor(systranvalue15(systranvalue21,inta[systranvalue20][4])*inta[systranvalue20][3])
systranvalue23 = math.floor(systranvalue16(systranvalue21,inta[systranvalue20][4])*inta[systranvalue20][3])
else
systranvalue22 = inta[systranvalue20][3]
systranvalue23 = inta[systranvalue20][3]
end
local systranvalue18 = "6\n您选择了:"..inta[systranvalue20][1].."(每份"..inta[systranvalue20][8].."个) \n当前库存:"..systranvalue21.."份(上限"..inta[systranvalue20][4].."份)\n系统收购价:"..systranvalue23.." 系统售价:"..systranvalue22.."\n"
if inta[systranvalue20][6] == 1 then
systranvalue18 = systranvalue18.."本物品无库存也可以购买,"
else
systranvalue18 = systranvalue18.."本物品只在有库存时销售,"
end
if inta[systranvalue20][7] == 1 then
systranvalue18 = systranvalue18.."满库存也继续收购。\n"
else
systranvalue18 = systranvalue18.."满库存时停止收购。\n"
end
if inta[systranvalue20][5] == 1 then
systranvalue18 = systranvalue18.."*价格随存货数量自动调整。"
else
systranvalue18 = systranvalue18.."*价格固定不变。"
end
systranvalue18 = systranvalue18.."\n\n我确认将其出售给系统\n我确认购买此物品"
NLG.ShowWindowTalked(player,2,2,systranvalue20,systranvalue18,npc)
else
NLG.SystemMessage(player,"请您重新选择正确的内容。")
end
end
end
end
end
end
|
|