魔力宝贝

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz

[GP] JSSR-systran3.lua--材料寄售商人(花箱)

[复制链接]
发表于 5 天前 | 显示全部楼层 |阅读模式
local systrannpcmetamo = 106152 --寄售Npc形象
local systrannpcmap = 60005 --寄售Npc所在地图
local systrannpcposx = 42 --寄售Npc x坐标
local systrannpcposy = 19 --寄售Npc y坐标
local systrannpcdir = 6 --寄售Npc方向
local systrannpcname = "花箱寄售商人" --寄售Npc名字
local maxgold = 100000000 --服务器最大金币数量
local filetree = "./lua/luatxt/caiji/systran3.txt" --文件路径

local inta = { --可寄售的物品列表
                        --{物品名,物品id,基准收购价,收购数量上限,是否启动自动调价,是否允许NPC无库存销售,是否允许NPC满库存收购,单次售购数量}
                                {"装满『苹果薄荷』的盒子",39587,2000,100,1,0,0,1},
                                {"装满『柠檬草』的盒子",39588,2250,100,1,0,0,1},
                                {"装满『蝴蝶花』的盒子",39589,2750,100,1,0,0,1},
                                {"装满『果梨』的盒子",39590,4000,100,1,0,0,1},
                                {"装满『桃木』的盒子",39591,4500,100,1,0,0,1},
                                {"装满『番红花』的盒子",39592,6000,100,1,0,0,1},
                                {"装满『百里香』的盒子",39593,12800,100,1,0,0,1},
                                {"装满『瞿麦』的盒子",39594,14400,100,1,0,0,1},
                                {"装满『茴香』的盒子",39595,40000,100,1,0,0,1},
                                {"装满『七叶树』的盒子",39596,52000,100,1,0,0,1},
                                {"装满『香草』的盒子",39597,14400,100,1,0,0,1},
}

----------------------------------
Global_Reg.RegInit("systranvalue253A");

function systranvalue253A()
        systranvalue253B();
        return 0;
end

function systranvalue253B(npc)
        if npc == nil or npc < 0 then
        npc = NL.CreateNpc(nil,"systranvalue253C")
        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["systranvalue253"]=npc;
        InstallNpc("systranvalue253",npc);
        Char.SetTalkedEvent(nil, "systranvalue173",npc)
        Char.SetWindowTalkedEvent(nil,"systranvalue193",npc)
        return true
end

function systranvalue253C(index)
        return true;
end

function systranvalue173(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 systranvalue193(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

回复

使用道具 举报

Archiver|魔力研究社

GMT+8, 2025-5-15 18:16 , Processed in 0.104599 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表