local SqlGold = "AddGold" --出售魔币储存Sql字段
local SqlCash = "AddMoney" --出售道具储存Sql字段
local MaxGold = 10000000 --最大魔币
local MaxCash = 99999 --最大点券道具堆叠
local CashItem = {79500,"阿尔卡迪亚金币"} --{RMB道具id,RMB道具名字}
local BuyShopNpc = {100500,"摆摊收购",4,777,23,23}
local btshijian = 172800
local SetWantBuyMsg = "\n 由于武器、防具等道具含有随机属性等因素,玩家在收购和出卖时的设置选项会极为繁琐,因此摆摊收购系统只允许收购可以堆叠的道具,如矿条、水晶碎片、古钱等。最多可以同时收购5种不同的物品。\n 请将需要收购的道具依次放置于道具栏第1-5格,并至少空余5个道具栏后点击【下一步】,系统将自动引导您设置收购价格和数量。"
local buyitemid = 79500 --人民币道具id
local buyitemmax = 99999 --人民币道具堆叠
local buyitemname = "$4金币$0" --人民币道具名字
local buyitemlook = 26574 --人民币道具的图档
local buygoldlook = 27403 --魔币图档
--local buyshopcallmsg = "P|/收购" --呼出指令
local sevelmaxgold = 100000000 --服务器最大魔币
local HeadIcon = 8 --摆摊收购头顶图标
local AbleBuyShop = 1 --是否开启摆摊收购 1开启 否则不开
--
local RepairShopClass1 = 370 --武器修理职业
local RepairShopClass2 = 380 --防具修理职业
local RepairSkill1 = 217 --武器修理技能
local RepairSkill2 = 218 --防具修理技能
local AbleDropDelItem = 1 --是否允许修理丢地消失道具 1为允许 否则不允许
local GiveSkillExp = 1 --是否给予技能经验 1为给予 其他不给
local SkillLevelMax = 10 --技能等级上限
local BaseSkillExp = {}
BaseSkillExp[1] = 45 --武器修理基础技能经验
BaseSkillExp[2] = 30 --防具修理基础技能经验
local AbleRepairShop = 1 --是否开启摆摊修理 1开启 否则不开
--local RepairShopCallMsg = "P|/修理" --摆摊修理呼出指令
local SetRepairShopMsg = "\n 您正在准备摆摊修理。摆摊修理会自动判断您的职业进行相应摆摊。收取的费用由系统设定为固定值,且相对较高。摆摊修理无需等待时间,也无需消耗魔力。"
local RepairIcon = 12 --摆摊修理头顶图标
local NoRepairShopTimeStart = 24 --摆摊修理失效时间开始
local NoRepairShopTimeEnd = 25 --摆摊修理失效时间结束
local RepairCost = {100,200,300,400,500,600,1400,1600,1800,2000} --摆摊修理需要花费的魔币
local RepairCharge = {50,100,150,200,250,300,700,800,900,1000} --摆摊修理可以赚取的魔币
local AppraisalShopClass = 390 --鉴定职业
local AppraisalSkill = 219 --鉴定技能
local AbleAppraisalDropDelItem = 0 --是否允许鉴定丢地消失道具 1为允许 否则不允许
local GiveAppraisalSkillExp = 0 --是否给予鉴定技能经验 1为给予 其他不给
local AppraisalSkillLevelMax = 10 --技能等级上限
local AppraisalBaseSkillExp = 20 --鉴定技能经验
local AbleAppraisalShop = 1 --是否开启摆摊鉴定 1开启 否则不开
--local AppraisalShopCallMsg = "P|/鉴定" --摆摊鉴定呼出指令
local SetAppraisalShopMsg = "\n 您正在准备摆摊鉴定。摆摊鉴定收取的费用由系统设定为固定值,且相对较高。摆摊鉴定无需等待时间,也无需消耗魔力。"
local AppraisalIcon = 11 --摆摊鉴定头顶图标 13治疗
local NoAppraisalShopTimeStart = 24 --摆摊鉴定失效时间开始
local NoAppraisalShopTimeEnd = 25 --摆摊鉴定失效时间结束
local AppraisalCost = {100,200,300,400,500,600,1400,1600,1800,2000} --摆摊鉴定需要花费的魔币
local AppraisalCharge = {50,100,150,200,250,300,700,800,900,1000} --摆摊鉴定可以赚取的魔币
local HealShopClass = 440 --医生职业
local HealSkill = 224 --治疗技能
local GiveHealSkillExp = 0 --是否给予治疗技能经验 1为给予 其他不给
local HealSkillLevelMax = 10 --治疗技能等级上限
local HealBaseSkillExp = 10 --治疗技能经验
local AbleHealShop = 1 --是否开启摆摊治疗 1开启 否则不开
--local HealShopCallMsg = "P|/治疗" --摆摊治疗呼出指令
local SetHealShopMsg = "\n 您正在准备摆摊治疗。摆摊治疗收取的费用由系统设定为固定值,且相对较高。\n 摆摊治疗无需等待时间,也无需消耗魔力。"
local HealIcon = 13 --摆摊治疗头顶图标
local NoHealShopTimeStart = 24 --摆摊治疗失效时间开始
local NoHealShopTimeEnd = 25 --摆摊治疗失效时间结束
local HealCost = 20 --摆摊治疗(每点伤势)需要花费的魔币
local HealCharge = 10 --摆摊治疗(每点伤势)可以赚取的魔币
local HeartShopClass = {430,440} --带内心职业
local HeartShopClassRankLimet = 1 --带内心职阶
local AbleHeartShop = 0 --是否开启摆摊带内心 1开启 否则不开
local HeartShopCallMsg = "/内心" --摆摊带内心呼出指令
local SetHeartShopMsg = "\n 您正在准备摆摊带内心。摆摊带内心收取的费用由系统设定为固定值。"
local HeartIcon = 13 --摆摊带内心头顶图标
local NoHeartShopTimeStart = 24 --摆摊带内心失效时间开始
local NoHeartShopTimeEnd = 25 --摆摊带内心失效时间结束
local HeartCost = 1500 --摆摊带内心需要花费的魔币
local HeartCharge = 800 --摆摊带内心可以赚取的魔币
local HeartWarp = {0,30192,8,9} --内心坐标
-----------------------------------------------------------
Global_Reg.RegLoginEvent("BuyShopExit");
Global_Reg.RegLogoutEvent("BuyShopExit");
Global_Reg.RegLoginGateEvent("BuyShopExit");
Global_Reg.RegInit("BuyShopzhuceNPC")
Global_Reg.CharRightclick("btyj")
BuyShopAbleFlag = BuyShopAbleFlag or {}
BuyShopGoodsLib = BuyShopGoodsLib or {}
RepairShopAbleFlag = RepairShopAbleFlag or {}
AppraisalShopAbleFlag = AppraisalShopAbleFlag or {}
HealAbleFlag = HealAbleFlag or {}
HeartAbleFlag = HeartAbleFlag or {}
BuyShopRightClickList = BuyShopRightClickList or {}
function BigLib()
--道具数据中文名
ItemValuesName = {}
--ItemValuesName[] = ""
ItemValuesName[9] = "数量"
ItemValuesName[10] = "堆叠"
ItemValuesName[11] = "等级"
ItemValuesName[13] = "耐久上限"
ItemValuesName[65] = "耐久度"
ItemValuesName[18] = "攻击"
ItemValuesName[19] = "防御"
ItemValuesName[20] = "敏捷"
ItemValuesName[21] = "精神"
ItemValuesName[22] = "回复"
ItemValuesName[23] = "必杀"
ItemValuesName[24] = "反击"
ItemValuesName[25] = "命中"
ItemValuesName[26] = "闪躲"
ItemValuesName[27] = "生命"
ItemValuesName[28] = "魔法"
ItemValuesName[39] = "抗毒"
ItemValuesName[40] = "抗睡"
ItemValuesName[41] = "抗石"
ItemValuesName[42] = "抗醉"
ItemValuesName[43] = "抗混"
ItemValuesName[44] = "抗忘"
ItemValuesName[55] = "抗魔"
ItemValuesName[72] = "魔攻"
--道具类型中文名
ItemTypeName = {}
ItemTypeName[0] = "剑"
ItemTypeName[1] = "斧头"
ItemTypeName[2] = "枪"
ItemTypeName[3] = "法杖"
ItemTypeName[4] = "弓"
ItemTypeName[5] = "小刀"
ItemTypeName[6] = "回力镖"
ItemTypeName[7] = "盾"
ItemTypeName[8] = "头盔"
ItemTypeName[9] = "帽子"
ItemTypeName[10] = "铠甲"
ItemTypeName[11] = "衣服"
ItemTypeName[12] = "长袍"
ItemTypeName[13] = "长靴"
ItemTypeName[14] = "鞋子"
ItemTypeName[15] = "手环"
ItemTypeName[16] = "乐器"
ItemTypeName[17] = "项链"
ItemTypeName[18] = "戒指"
ItemTypeName[19] = "头带"
ItemTypeName[20] = "耳环"
ItemTypeName[21] = "护符"
ItemTypeName[22] = "水晶"
ItemTypeName[23] = "料理"
ItemTypeName[24] = "家具"
ItemTypeName[25] = "特殊"
ItemTypeName[26] = "不明"
ItemTypeName[27] = "宝箱"
ItemTypeName[28] = "钥匙"
ItemTypeName[29] = "矿石"
ItemTypeName[30] = "木材"
ItemTypeName[31] = "布"
ItemTypeName[32] = "肉类"
ItemTypeName[33] = "食品"
ItemTypeName[34] = "蔬菜"
ItemTypeName[35] = "食材"
ItemTypeName[36] = "香草"
ItemTypeName[37] = "距檬"
ItemTypeName[38] = "宝石"
ItemTypeName[39] = "证件"
ItemTypeName[40] = "封印卡"
ItemTypeName[41] = "其他卡片"
ItemTypeName[42] = "料理"
ItemTypeName[43] = "药"
ItemTypeName[44] = "书"
ItemTypeName[45] = "瘤档"
ItemTypeName[46] = "不明"
ItemTypeName[47] = "彩票"
ItemTypeName[48] = "不明"
ItemTypeName[49] = "特殊"
ItemTypeName[50] = "不明"
ItemTypeName[51] = "炸弹"
ItemTypeName[52] = "览"
ItemTypeName[53] = "小吃"
ItemTypeName[54] = "?"
ItemTypeName[55] = "头带饰品"
for i = 56,99 do
ItemTypeName[i] = "不明"
end
--种族中文名
SpeciesName = {}
SpeciesName[0] = "人形系"
SpeciesName[1] = "龙系"
SpeciesName[2] = "不死系"
SpeciesName[3] = "飞行系"
SpeciesName[4] = "昆虫系"
SpeciesName[5] = "植物系"
SpeciesName[6] = "野兽系"
SpeciesName[7] = "特殊系"
SpeciesName[8] = "金属系"
SpeciesName[9] = "邪魔系"
end
function GetItemValueString(itemindex,k)
--print("\nLuaState %x %X BuyShop 1")
local itemuse = Item.GetData(itemindex,65)
local itemusemax = Item.GetData(itemindex,13)
local itemlv = Item.GetData(itemindex,11)
local itemtype = Item.GetData(itemindex,3)
local itemhand = Item.GetData(itemindex,5)
local item = {}
item[18] = Item.GetData(itemindex,18)
item[19] = Item.GetData(itemindex,19)
item[20] = Item.GetData(itemindex,20)
item[21] = Item.GetData(itemindex,21)
item[22] = Item.GetData(itemindex,22)
item[23] = Item.GetData(itemindex,23)
item[24] = Item.GetData(itemindex,24)
item[25] = Item.GetData(itemindex,25)
item[26] = Item.GetData(itemindex,26)
item[27] = Item.GetData(itemindex,27)
item[28] = Item.GetData(itemindex,28)
item[39] = Item.GetData(itemindex,39)
item[40] = Item.GetData(itemindex,40)
item[41] = Item.GetData(itemindex,41)
item[42] = Item.GetData(itemindex,42)
item[43] = Item.GetData(itemindex,43)
item[44] = Item.GetData(itemindex,44)
item[55] = Item.GetData(itemindex,55)
item[72] = Item.GetData(itemindex,72)
local turnoff = 0
local iteminfo = ""
for i = 18,22 do
if item[i] ~= 0 then
if k ~= 1 then
iteminfo = iteminfo.."$1"
end
iteminfo = iteminfo..string.format("%s %+d ",ItemValuesName[i],item[i])
turnoff = turnoff + 1
if turnoff >= 3 then
turnoff = 0
iteminfo = iteminfo.."\n"
end
end
end
for i = 39,44 do
if item[i] ~= 0 then
if k ~= 1 then
iteminfo = iteminfo.."$2"
end
iteminfo = iteminfo..string.format("%s %+d ",ItemValuesName[i],item[i])
turnoff = turnoff + 1
if turnoff >= 3 then
turnoff = 0
iteminfo = iteminfo.."\n"
end
end
end
for i = 23,28 do
if item[i] ~= 0 then
if k ~= 1 then
iteminfo = iteminfo.."$8"
end
iteminfo = iteminfo..string.format("%s %+d ",ItemValuesName[i],item[i])
turnoff = turnoff + 1
if turnoff >= 3 then
turnoff = 0
iteminfo = iteminfo.."\n"
end
end
end
if item[72] ~= 0 then
if k ~= 1 then
iteminfo = iteminfo.."$8"
end
iteminfo = iteminfo..string.format("%s %+d ",ItemValuesName[72],item[72])
turnoff = turnoff + 1
if turnoff >= 3 then
turnoff = 0
iteminfo = iteminfo.."\n"
end
end
if item[55] ~= 0 then
if k ~= 1 then
iteminfo = iteminfo.."$8"
end
iteminfo = iteminfo..string.format("%s %+d ",ItemValuesName[55],item[55])
turnoff = turnoff + 1
if turnoff >= 3 then
turnoff = 0
iteminfo = iteminfo.."\n"
end
end
if k ~= 1 then
iteminfo = iteminfo.."$4"
end
iteminfo = iteminfo.."等级 "..itemlv.."\n"
if itemtype >= 0 and itemtype <= 22 then
if k ~= 1 then
iteminfo = iteminfo.."$4"
end
iteminfo = iteminfo.."耐久"..itemuse.."/"..itemusemax.." "
end
if k ~= 1 then
iteminfo = iteminfo.."$0"
end
iteminfo = iteminfo.."种类 "
if itemtype == 0 then
if itemhand == 0 then
iteminfo = iteminfo.."单手"..string.sub(ItemTypeName[itemtype],1,2)
elseif itemhand == 1 then
iteminfo = iteminfo.."双手"..string.sub(ItemTypeName[itemtype],1,2)
end
elseif itemtype == 1 then
if itemhand == 0 then
iteminfo = iteminfo..ItemTypeName[itemtype]
elseif itemhand == 1 then
iteminfo = iteminfo.."双手斧"
end
else
iteminfo = iteminfo..ItemTypeName[itemtype]
end
--print("\nLuaState %x %X BuyShop 2")
return iteminfo
end
function Win_Offstall(fd,packet,player)
if packet=="StallPanCall 1 " then--按下领取售款按钮
local cdkey = Char.GetData(player,%对象_帐号%)
local nowgold = Char.GetData(player,%对象_金币%)
local sqlgold = tonumber(GetUserSql(cdkey,SqlGold))
local sqlcash = tonumber(GetUserSql(cdkey,SqlCash))
if sqlgold and sqlgold > 0 then
if nowgold < MaxGold then
if nowgold + sqlgold <= MaxGold then
SetUserSql(cdkey,SqlGold,0)
NLG.AddGold(player,sqlgold)
sqlgold = 0
else
local getgold = MaxGold - nowgold
sqlgold = sqlgold - getgold
SetUserSql(cdkey,SqlGold,sqlgold)
NLG.AddGold(player,getgold)
NLG.SystemMessage(player,"[系统]:你的金币已经满了。无法领取剩余的"..sqlgold.."金币。")
end
else
NLG.SystemMessage(player,"[系统]:你的金币已经满了。无法领取剩余的"..sqlgold.."金币。")
end
else
NLG.SystemMessage(player,"[系统]:你没有尚未领取的金币。")
end
if sqlcash and sqlcash > 0 then
if Char.FindEmptyItemBox(player) >= 1 then
if sqlcash > MaxCash then
sqlcash = sqlcash - MaxCash
SetUserSql(cdkey,SqlCash,sqlcash)
NLG.GiveItem(player,CashItem[1],MaxCash)
NLG.SystemMessage(player,"[系统]:因限制每次只能领取"..MaxCash..CashItem[2]..",剩余"..sqlcash..CashItem[2].."未领。")
else
SetUserSql(cdkey,SqlCash,0)
NLG.GiveItem(player,CashItem[1],sqlcash)
sqlcash = 0
end
else
NLG.SystemMessage(player,"[系统]:你的东西太多了。无法领取剩余的"..sqlcash..CashItem[2].."。")
end
else
NLG.SystemMessage(player,"[系统]:你没有尚未领取的"..CashItem[2].."。")
end
elseif packet=="StallPanCall 2 " then--按下摆摊收购按钮
--print("\nLuaState %x %X BuyShop 3")
if AbleBuyShop == 1 then
BuyShopStart(player)
end
--print("\nLuaState %x %X BuyShop 4")
elseif packet=="StallPanCall 4 " then--按下摆摊修理按钮
--print("\nLuaState %x %X BuyShop 5")
if AbleRepairShop == 1 then
local hours = tonumber(os.date("%H"))
if hours >= NoRepairShopTimeStart and hours < NoRepairShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoRepairShopTimeEnd.."点之后和"..NoRepairShopTimeStart.."点之前进行摆摊修理。")
else
RepairShopStart(player)
end
end
--print("\nLuaState %x %X BuyShop 6")
elseif packet=="StallPanCall 5 " then--按下摆摊鉴定按钮
--print("\nLuaState %x %X BuyShop 7")
if AbleAppraisalShop == 1 then
local hours = tonumber(os.date("%H"))
if hours >= NoAppraisalShopTimeStart and hours < NoAppraisalShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoAppraisalShopTimeEnd.."点之后和"..NoAppraisalShopTimeStart.."点之前进行摆摊鉴定。")
else
AppraisalShopStart(player)
end
end
--print("\nLuaState %x %X BuyShop 8")
elseif packet=="StallPanCall 3 " then--按下摆摊治疗按钮
--print("\nLuaState %x %X BuyShop 9")
if AbleHealShop == 1 then
local hours = tonumber(os.date("%H"))
if hours >= NoHealShopTimeStart and hours < NoHealShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoHealShopTimeEnd.."点之后和"..NoHealShopTimeStart.."点之前进行摆摊治疗。")
else
HealShopStart(player)
end
end
--print("\nLuaState %x %X BuyShop 10")
elseif msg == HeartShopCallMsg then
--print("\nLuaState %x %X BuyShop 11")
if AbleHeartShop == 1 then
local hours = tonumber(os.date("%H"))
if hours >= NoHeartShopTimeStart and hours < NoHeartShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoHeartShopTimeEnd.."点之后和"..NoHeartShopTimeStart.."点之前进行摆摊带内心。")
else
HeartShopStart(player)
end
end
end
end
function BuyShopExit(player)
--print("\nLuaState %x %X BuyShop 13")
if BuyShopAbleFlag[player] or RepairShopAbleFlag[player] or AppraisalShopAbleFlag[player] or HealAbleFlag[player] or HeartAbleFlag[player] then
Char.sendAction(player,0)
-- Char.SetData(player,4004,1)
BuyShopGoodsLib[player] = nil
BuyShopAbleFlag[player] = nil
RepairShopAbleFlag[player] = nil
AppraisalShopAbleFlag[player] = nil
HealAbleFlag[player] = nil
HeartAbleFlag[player] = nil
end
if BuyShopRightClickList[player] then
BuyShopRightClickList[player] = nil
end
for k,v in pairs(BuyShopRightClickList) do
if v == player then
BuyShopRightClickList[k] = nil
end
end
--print("\nLuaState %x %X BuyShop 14")
end
function BuyShopStart(player)
local msg = SetWantBuyMsg
NLG.ShowWindowTalked(player,0,34,0,msg,LuaNpcIndex["BuyShopNpcIndex"])
end
function RepairShopStart(player)
local zhiye = Char.GetData(player,51)
if zhiye == RepairShopClass1 then
NLG.ShowWindowTalked(player,2,2,150,"3\n\n您正在准备摆摊修理。请您选择摆摊种类:\n\n武器修理摆摊\n\n防具修理摆摊",LuaNpcIndex["BuyShopNpcIndex"])
else
NLG.SystemMessage(player,"您不是修理工职业。")
end
-- local msg = SetRepairShopMsg
-- NLG.ShowWindowTalked(player,0,34,150,msg,LuaNpcIndex["BuyShopNpcIndex"])
end
function AppraisalShopStart(player)
local msg = SetAppraisalShopMsg
NLG.ShowWindowTalked(player,0,34,180,msg,LuaNpcIndex["BuyShopNpcIndex"])
end
function HealShopStart(player)
local msg = SetHealShopMsg
NLG.ShowWindowTalked(player,0,34,210,msg,LuaNpcIndex["BuyShopNpcIndex"])
end
function HeartShopStart(player)
local msg = SetHeartShopMsg
NLG.ShowWindowTalked(player,0,34,230,msg,LuaNpcIndex["BuyShopNpcIndex"])
end
function btyj(player,target)
BuyShopRightClick(player,target)
end
function BuyShopRightClick(player,target)
if BuyShopAbleFlag[target] then
--print("\nLuaState %x %X BuyShop 15")
BuyShopRightClickList[player] = target
local targetname = Char.GetData(target,2000)
local msg = "3\n这里是"..targetname.."的收购摊位\n您将以此价格将相应道具出售给"..targetname.."\n请选择您要出售的道具:"
for i = 1,5 do
msg = msg.."\n"
if BuyShopGoodsLib[target][i] then
local valuetype = ""
if BuyShopGoodsLib[target][i][3] > 0 then
valuetype = "$1魔币$0"
elseif BuyShopGoodsLib[target][i][3] < 0 then
valuetype = buyitemname
end
msg = msg..BuyShopGoodsLib[target][i][2].." "..math.abs(BuyShopGoodsLib[target][i][3])..valuetype.."/收"..BuyShopGoodsLib[target][i][4].."个"
else
msg = msg.."无收购"
end
end
NLG.ShowWindowTalked(player,2,2,100,msg,LuaNpcIndex["BuyShopNpcIndex"])
--print("\nLuaState %x %X BuyShop 16")
return true
elseif RepairShopAbleFlag[target] then
local hours = tonumber(os.date("%H"))
if hours >= NoRepairShopTimeStart and hours < NoRepairShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoRepairShopTimeEnd.."点之后和"..NoRepairShopTimeStart.."点之前进行摆摊修理。")
return false
else
--print("\nLuaState %x %X BuyShop 17")
BuyShopRightClickList[player] = target
local skillslot = -1
local skilllv = 0
if RepairShopAbleFlag[target] == 1 then
skillslot = Char.HaveSkill(target,RepairSkill1)
elseif RepairShopAbleFlag[target] == 2 then
skillslot = Char.HaveSkill(target,RepairSkill2)
end
if skillslot >= 0 then
skilllv = Char.GetSkillLevel(target,skillslot) or 0
end
if skilllv >= 1 then
local targetname = Char.GetData(target,2000)
local repairtype
if RepairShopAbleFlag[target] == 1 then
repairtype = "武器"
elseif RepairShopAbleFlag[target] == 2 then
repairtype = "防具"
end
local msg = "\n这里是"..targetname.."的修理摊位\n$4[修理魔法装备不会损耗耐久上限]$0\n您将以如下价格修理一件【"..repairtype.."】:"
local tempint = {}
for i = 1,10 do
if i <= skilllv then
tempint[i] = string.format("Lv%2s:%6sG",i,RepairCost[i])
else
tempint[i] = "摊主技能等级不足"
end
end
for i = 1,5 do
msg = msg.."\n"..tempint[i].." "..tempint[i+5]
end
msg = msg.."\n点击【确定】开始选择需要修理的"..repairtype.."。"
NLG.ShowWindowTalked(player,0,3,160,msg,LuaNpcIndex["BuyShopNpcIndex"])
end
--print("\nLuaState %x %X BuyShop 18")
return true
end
elseif AppraisalShopAbleFlag[target] then
local hours = tonumber(os.date("%H"))
if hours >= NoAppraisalShopTimeStart and hours < NoAppraisalShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoAppraisalShopTimeEnd.."点之后和"..NoAppraisalShopTimeStart.."点之前进行摆摊修理。")
return false
else
--print("\nLuaState %x %X BuyShop 19")
BuyShopRightClickList[player] = target
local skillslot = Char.HaveSkill(target,AppraisalSkill)
local skilllv = 0
if skillslot >= 0 then
skilllv = Char.GetSkillLevel(target,skillslot) or 0
end
if skilllv >= 1 then
local targetname = Char.GetData(target,2000)
local msg = "\n这里是"..targetname.."的鉴定摊位\n您将以如下价格鉴定道具:\n"
local tempint = {}
for i = 1,10 do
if i <= skilllv then
tempint[i] = string.format("Lv%2s:%6sG",i,AppraisalCost[i])
else
tempint[i] = "摊主技能等级不足"
end
end
for i = 1,5 do
msg = msg.."\n"..tempint[i].." "..tempint[i+5]
end
msg = msg.."\n\n点击【确定】开始选择需要鉴定的道具。"
NLG.ShowWindowTalked(player,0,3,190,msg,LuaNpcIndex["BuyShopNpcIndex"])
end
--print("\nLuaState %x %X BuyShop 20")
return true
end
elseif HealAbleFlag[target] then
local hours = tonumber(os.date("%H"))
if hours >= NoHealShopTimeStart and hours < NoHealShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoHealShopTimeEnd.."点之后和"..NoHealShopTimeStart.."点之前进行摆摊治疗。")
return false
else
--print("\nLuaState %x %X BuyShop 21")
BuyShopRightClickList[player] = target
local skillslot = Char.HaveSkill(target,HealSkill)
local skilllv = 0
if skillslot >= 0 then
skilllv = Char.GetSkillLevel(target,skillslot) or 0
end
if skilllv >= 1 then
local targetname = Char.GetData(target,2000)
local healstate = Char.GetData(player,38)
local msg = "\n这里是"..targetname.."的治疗摊位\n治疗您的伤势需要:"..(HealCost*healstate).."$1魔币$0。"
msg = msg.."\n\n点击【确定】立即治疗所有伤势"
NLG.ShowWindowTalked(player,0,3,220,msg,LuaNpcIndex["BuyShopNpcIndex"])
end
--print("\nLuaState %x %X BuyShop 22")
return true
end
elseif HeartAbleFlag[target] then
local hours = tonumber(os.date("%H"))
if hours >= NoHeartShopTimeStart and hours < NoHeartShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoHeartShopTimeEnd.."点之后和"..NoHeartShopTimeStart.."点之前进行摆摊带内心。")
return false
else
--print("\nLuaState %x %X BuyShop 23")
BuyShopRightClickList[player] = target
local targetname = Char.GetData(target,2000)
local msg = "\n这里是"..targetname.."的带内心摊位\n\n收费"..HeartCost.."$1魔币$0。"
msg = msg.."\n\n点击【确定】立即传送至内心\n\n*内心怪物为61-65级"
NLG.ShowWindowTalked(player,0,3,240,msg,LuaNpcIndex["BuyShopNpcIndex"])
--print("\nLuaState %x %X BuyShop 24")
return true
end
else
return false
end
end
function BuyShopNpcWindowTalkedCallBack(npc,player,Seqno,Select,Data)
--NLG.SystemMessage(player,"Seqno="..Seqno.." Select="..Select.." Data="..Data)
if Select ~= 2 then
if Seqno == 0 then
--print("\nLuaState %x %X BuyShop 25")
local msg = ""
local itemindex = Char.GetItemIndex(player,8)
if itemindex >= 0 then
local itemid = Item.GetData(itemindex,0)
local itemmaxnum = Item.GetData(itemindex,10) or 1
local itemname = Item.GetData(itemindex,2001)
local itemtrading1 = Item.GetData(itemindex,52)
local itemtrading2 = Item.GetData(itemindex,53)
local itemtrading3 = Item.GetData(itemindex,54)
if itemmaxnum > 1 and itemtrading1 == 0 and itemtrading2 == 0 and itemtrading3 == 1 and item_cir_limit_tab[itemid] == nil then
msg = "请输入【"..itemname.."】的收购价格和数量:\n例1:500/20 500魔币每个收购20个\n例2:-50/40 50"..buyitemname.."每个收购40个\n\n保存并开始收购请点击【确定】\n放弃收购点击【取消】\n放弃并设置下一件收购道具点击【否】\n保存并设置下一件收购道具点击【下一步】"
NLG.ShowWindowTalked(player,1,43,1,msg,npc)
else
msg = "\n不能摆摊收购【"..itemname.."】,是否取消收购?\n设置下一件收购道具点击【否】\n放弃收购点击【取消】"
NLG.ShowWindowTalked(player,1,10,1,msg,npc)
end
else
msg = "\n道具栏第一格没有道具,是否取消收购?\n设置下一件收购道具点击【否】\n放弃收购点击【取消】"
NLG.ShowWindowTalked(player,1,10,1,msg,npc)
end
--print("\nLuaState %x %X BuyShop 26")
elseif Seqno >= 1 and Seqno <= 5 then
--print("\nLuaState %x %X BuyShop 27")
if Select == 1 or Select == 32 then
if BuyShopGoodsLib[player] == nil then
BuyShopGoodsLib[player] = {}
end
local itemindex = Char.GetItemIndex(player,7+Seqno)
if itemindex >= 0 then
local itemid = Item.GetData(itemindex,0)
local itemmaxnum = Item.GetData(itemindex,10) or 1
local itemname = Item.GetData(itemindex,2001)
local itemtrading1 = Item.GetData(itemindex,52)
local itemtrading2 = Item.GetData(itemindex,53)
local itemtrading3 = Item.GetData(itemindex,54)
if itemmaxnum > 1 and itemtrading1 == 0 and itemtrading2 == 0 and itemtrading3 == 1 and item_cir_limit_tab[itemid] == nil then
local tempint = splitplus(Data,"/")
local value = tonumber(tempint[1]) or 0
local number = tonumber(tempint[2]) or 0
if value ~= 0 and math.floor(value) == value then
if number >= 1 and math.floor(number) == number then
BuyShopGoodsLib[player][Seqno] = {itemid,itemname,value,number}
local valuetype = ""
if value > 0 then
valuetype = "魔币"
elseif value < 0 then
valuetype = buyitemname
end
BuyShopAbleFlag[player] = nil
NLG.SystemMessage(player,"设置成功:收购道具"..Seqno..":"..itemname.." 价格:"..math.abs(value)..valuetype.." 收购"..number.."个。")
else
BuyShopGoodsLib[player][Seqno] = nil
NLG.SystemMessage(player,"收购设置失败,收购数量小于1或为小数。")
end
else
BuyShopGoodsLib[player][Seqno] = nil
NLG.SystemMessage(player,"收购设置失败,价格不能为0或小数。")
end
else
BuyShopGoodsLib[player][Seqno] = nil
NLG.SystemMessage(player,"收购设置失败,道具栏第"..Seqno.."格道具不可摆摊收购。")
end
else
BuyShopGoodsLib[player][Seqno] = nil
NLG.SystemMessage(player,"收购设置失败,道具栏第"..Seqno.."格道具获取错误。")
end
end
if (Select == 8 or Select == 32) and Seqno <= 4 then
local msg = ""
local itemindex = Char.GetItemIndex(player,8+Seqno)
if itemindex >= 0 then
local itemid = Item.GetData(itemindex,0)
local itemmaxnum = Item.GetData(itemindex,10) or 1
local itemname = Item.GetData(itemindex,2001)
if itemmaxnum > 1 then
msg = "请输入【"..itemname.."】的收购价格和数量:\n例1:500/20 500魔币每个收购20个\n例2:-50/40 50"..buyitemname.."每个收购40个\n\n保存并开始收购请点击【确定】\n放弃收购点击【取消】\n放弃并设置下一件收购道具点击【否】\n保存并设置下一件收购道具点击【下一步】"
NLG.ShowWindowTalked(player,1,43,1+Seqno,msg,npc)
else
msg = "\n不能摆摊收购【"..itemname.."】,是否取消收购?\n设置下一件收购道具点击【否】\n放弃收购点击【取消】"
NLG.ShowWindowTalked(player,1,10,1+Seqno,msg,npc)
end
else
msg = "\n道具栏第一格没有道具,是否取消收购?\n设置下一件收购道具点击【否】\n放弃收购点击【取消】"
NLG.ShowWindowTalked(player,1,10,1+Seqno,msg,npc)
end
elseif Seqno == 5 or Select == 1 then
if BuyShopGoodsLib[player] ~= {} then
if Char.ItemSlot(player) <= 35 then
local msg = "请确认您的收购列表:\n"
for i = 1,5 do
msg = msg.."\n"..i.."."
if BuyShopGoodsLib[player][i] then
local valuetype = ""
if BuyShopGoodsLib[player][i][3] > 0 then
valuetype = "$1魔币$0"
elseif BuyShopGoodsLib[player][i][3] < 0 then
valuetype = buyitemname
end
msg = msg..BuyShopGoodsLib[player][i][2].." "..math.abs(BuyShopGoodsLib[player][i][3])..valuetype.." 收购"..BuyShopGoodsLib[player][i][4].."个"
else
msg = msg.."无收购"
end
end
msg = msg.."\n\n点击【确定】开始摆摊\n摆摊过程中请勿移动、转身或登出。"
NLG.ShowWindowTalked(player,0,3,6,msg,npc)
else
BuyShopExit(player)
NLG.SystemMessage(player,"您需要至少5个空道具栏。")
end
else
BuyShopExit(player)
NLG.SystemMessage(player,"您没有设置任何收购道具。")
end
end
--print("\nLuaState %x %X BuyShop 28")
elseif Seqno == 6 then
--print("\nLuaState %x %X BuyShop 29")
if Select == 1 then
BuyShopAbleFlag[player] = 1
RepairShopAbleFlag[player] = nil
Char.sendAction(player,HeadIcon)
Char.SetWalkPostEvent(nil,"BuyShopExit",player)
for k,v in pairs(BuyShopRightClickList) do
if v == player then
NLG.TalkToCli(k,player,"我更新了收购列表,重新刷新看看吧。不然会卖错东西哦~",2,2)
end
end
NLG.ShowWindowTalked(player,0,0,999,"\n\n\n 正在摆摊收购\n\n 移动、转身或登出都会取消摆摊",npc)
Off.CharLine(player,btshijian)
end
--print("\nLuaState %x %X BuyShop 30")
elseif Seqno == 100 then
--print("\nLuaState %x %X BuyShop 31")
local target = BuyShopRightClickList[player]
if BuyShopAbleFlag[target] then
local goodstype = tonumber(Data)
if goodstype and goodstype == math.floor(goodstype) and goodstype >= 1 and goodstype <= 5 then
if BuyShopGoodsLib[target][goodstype] then
local targetmetamo = Char.GetData(target,1)
local targetname = Char.GetData(target,2000)
local windowmsg1 = "需要"..BuyShopGoodsLib[target][goodstype][2].."来交换"
local windowmsg2 = "你的"..BuyShopGoodsLib[target][goodstype][2].."不足"
local windowmsg3 = "你的道具栏满了。"
local msg = targetmetamo.."|"..targetname.."|"..windowmsg1.."|"..windowmsg2.."|"..windowmsg3.."|"..BuyShopGoodsLib[target][goodstype][1].."|"..BuyShopGoodsLib[target][goodstype][2].."|"
if BuyShopGoodsLib[target][goodstype][3] > 0 then
msg = msg..BuyShopGoodsLib[target][goodstype][3].."魔币".."|"..buygoldlook.."|1|999999|每个"..BuyShopGoodsLib[target][goodstype][2].."可出售获得"..BuyShopGoodsLib[target][goodstype][3].."$1魔币$0|"
elseif BuyShopGoodsLib[target][goodstype][3] < 0 then
msg = msg..math.abs(BuyShopGoodsLib[target][goodstype][3])..buyitemname.."|"..buyitemlook.."|1|"..buyitemmax.."|每个"..BuyShopGoodsLib[target][goodstype][2].."可出售获得"..math.abs(BuyShopGoodsLib[target][goodstype][3])..buyitemname.."|"
end
NLG.ShowWindowTalked(player,28,2,100+goodstype,msg,npc)
else
NLG.SystemMessage(player,"请选择正确的选项。")
end
else
NLG.SystemMessage(player,"请选择正确的选项。")
end
else
NLG.SystemMessage(player,"对方已经停止收购。")
end
--print("\nLuaState %x %X BuyShop 32")
elseif Seqno >= 101 and Seqno <= 105 then
--print("\nLuaState %x %X BuyShop 33")
local target = BuyShopRightClickList[player]
if BuyShopAbleFlag[target] then
local goodstype = Seqno - 100
if goodstype and goodstype == math.floor(goodstype) and goodstype >= 1 and goodstype <= 5 then
if BuyShopGoodsLib[target][goodstype] then
local sellnumber = tonumber(splitplus(Data,"|")[2])
if sellnumber and sellnumber > 0 and math.floor(sellnumber) == sellnumber then
if BuyShopGoodsLib[target][goodstype][4] < sellnumber then
sellnumber = BuyShopGoodsLib[target][goodstype][4]
end
if Char.ItemNum(player,BuyShopGoodsLib[target][goodstype][1]) >= sellnumber then
local goodsmaxnum = 0
for i = 8,27 do
local itemindex = Char.GetItemIndex(player,i)
if itemindex >= 0 then
local itemid = Item.GetData(itemindex,0)
if itemid == BuyShopGoodsLib[target][goodstype][1] then
goodsmaxnum = Item.GetData(itemindex,10) or 1
break
end
end
end
if goodsmaxnum >= 1 then
local sellable = 0
local pay = math.abs(BuyShopGoodsLib[target][goodstype][3])*sellnumber
if BuyShopGoodsLib[target][goodstype][3] > 0 then
if Char.GetData(target,53) >= pay and Char.GetData(player,53) + pay <= sevelmaxgold then
sellable = 1
end
elseif BuyShopGoodsLib[target][goodstype][3] < 0 then
if Char.ItemNum(target,buyitemid) >= pay then
sellable = 1
end
end
if sellable == 1 then
if Char.ItemSlot(target) + math.ceil(sellnumber/goodsmaxnum) <= 40 then
if BuyShopGoodsLib[target][goodstype][3] > 0 or (Char.ItemSlot(player) + math.ceil(pay/buyitemmax) <= 40) then
sellable = 2
end
end
end
if sellable == 2 then
local paytype = ""
if BuyShopGoodsLib[target][goodstype][3] > 0 then
paytype = "$1魔币$0"
Char.SetData(target,53,Char.GetData(target,53) - pay)
Char.SetData(player,53,Char.GetData(player,53) + pay)
Char.DelItem(player,BuyShopGoodsLib[target][goodstype][1],sellnumber)
local giveitemway = sellnumber
for i = 8,27 do
local targetitemindextemp = Char.GetItemIndex(target,i)
if targetitemindextemp >= 0 then
local itemidtemp = Item.GetData(targetitemindextemp,0)
if itemidtemp == BuyShopGoodsLib[target][goodstype][1] then
local itemnumtemp = Item.GetData(targetitemindextemp,9)
local itemnummaxtemp = Item.GetData(targetitemindextemp,10)
if itemnummaxtemp - itemnumtemp > 0 then
if giveitemway > (itemnummaxtemp - itemnumtemp) then
Item.SetData(targetitemindextemp,9,itemnummaxtemp)
giveitemway = giveitemway - (itemnummaxtemp - itemnumtemp)
else
Item.SetData(targetitemindextemp,9,(itemnumtemp+giveitemway))
giveitemway = 0
Item.UpItem(target,i)
break
end
Item.UpItem(target,i)
end
end
end
end
if giveitemway > 0 then
Char.GiveItem(target,BuyShopGoodsLib[target][goodstype][1],giveitemway)
end
NLG.UpChar(player)
-- NLG.UpChar(target)
elseif BuyShopGoodsLib[target][goodstype][3] < 0 then
paytype = buyitemname
Char.DelItem(target,buyitemid,pay)
Char.DelItem(player,BuyShopGoodsLib[target][goodstype][1],sellnumber)
--Char.GiveItem(target,BuyShopGoodsLib[target][goodstype][1],sellnumber)
Char.GiveItem(player,buyitemid,pay)
local giveitemway = sellnumber
for i = 8,27 do
if giveitemway > 0 then
local targetitemindextemp = Char.GetItemIndex(target,i)
if targetitemindextemp >= 0 then
local itemidtemp = Item.GetData(targetitemindextemp,0)
if itemidtemp == BuyShopGoodsLib[target][goodstype][1] then
local itemnumtemp = Item.GetData(targetitemindextemp,9)
local itemnummaxtemp = Item.GetData(targetitemindextemp,10)
if itemnummaxtemp - itemnumtemp > 0 then
if giveitemway > (itemnummaxtemp - itemnumtemp) then
Item.SetData(targetitemindextemp,9,itemnummaxtemp)
giveitemway = giveitemway - (itemnummaxtemp - itemnumtemp)
else
Item.SetData(targetitemindextemp,9,(itemnumtemp+giveitemway))
giveitemway = 0
Item.UpItem(target,i)
break
end
Item.UpItem(target,i)
end
end
end
end
end
if giveitemway > 0 then
Char.GiveItem(target,BuyShopGoodsLib[target][goodstype][1],giveitemway)
end
end
AddGoldLog(player,"BuyShop摆摊收购 收入"..pay..paytype)
AddGoldLog(target,"BuyShop摆摊收购 支出"..pay..paytype)
NLG.SystemMessage(player,"交易成功!售出"..sellnumber.."个"..BuyShopGoodsLib[target][goodstype][2].."。得到"..pay..paytype.."。")
NLG.SystemMessage(target,"交易成功!收购"..sellnumber.."个"..BuyShopGoodsLib[target][goodstype][2].."。花费"..pay..paytype.."。")
BuyShopGoodsLib[target][goodstype][4] = BuyShopGoodsLib[target][goodstype][4] - sellnumber
if BuyShopGoodsLib[target][goodstype][4] <= 0 then
BuyShopGoodsLib[target][goodstype] = nil
local temp = 0
for k,v in pairs(BuyShopGoodsLib[target]) do
temp = temp + 1
end
if temp == 0 then
BuyShopExit(target)
end
end
elseif sellable == 0 then
NLG.SystemMessage(player,"无法交易。可能是对方的钱不够或者你的钱太多了。")
elseif sellable == 1 then
NLG.SystemMessage(player,"无法交易。可能是对方的或你的道具栏不足。")
end
else
NLG.SystemMessage(player,"货物堆叠上限获取失败。")
end
else
NLG.SystemMessage(player,"你的东西不够。")
end
else
NLG.SystemMessage(player,"出售数量错误。")
end
else
NLG.SystemMessage(player,"请选择正确的选项。")
end
else
NLG.SystemMessage(player,"请选择正确的选项。")
end
else
NLG.SystemMessage(player,"对方已经停止收购。")
end
BuyShopRightClickList[player] = nil
--print("\nLuaState %x %X BuyShop 34")
elseif Seqno == 150 then
print("\n Seqno是:"..(Seqno or "空").."它的类型是"..type(Seqno).."\n Select是:".. (Select or "空").."它的类型是"..type(Select).."\n Data是:"..(Data or "空").."它的类型是"..type(Data))
--print("\nLuaState %x %X BuyShop 35")
if Select == 0 then
local playerclass = Char.GetData(player,51)
local skillslot = -1
local jineng1 = Char.HaveSkill(player,RepairSkill1)
local jineng2 = Char.HaveSkill(player,RepairSkill2)
if Data == "1" and jineng1 ~= nil then
skillslot = Char.HaveSkill(player,RepairSkill1)
playerclass = 370
elseif Data == "3" and jineng2 ~= nil then
skillslot = Char.HaveSkill(player,RepairSkill2)
playerclass = 380
end
if skillslot >= 0 then
local skilllv = Char.GetSkillLevel(player,skillslot) or 0
if skilllv >= 1 then
BuyShopExit(player)
if playerclass == 370 then
RepairShopAbleFlag[player] = 1
elseif playerclass == 380 then
RepairShopAbleFlag[player] = 2
end
Char.sendAction(player,RepairIcon)
Char.SetWalkPostEvent(nil,"BuyShopExit",player)
NLG.ShowWindowTalked(player,0,0,999,"\n\n\n 正在摆摊修理\n\n 移动、转身或登出都会取消摆摊",npc)
Off.CharLine(player,btshijian)
else
NLG.SystemMessage(player,"摆摊失败,您的技能等级太低。")
end
else
NLG.SystemMessage(player,"摆摊失败,您不是修理工或没有相应的技能。")
end
end
--print("\nLuaState %x %X BuyShop 36")
elseif Seqno == 160 then
--print("\nLuaState %x %X BuyShop 37")
local hours = tonumber(os.date("%H"))
if hours >= NoRepairShopTimeStart and hours < NoRepairShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoRepairShopTimeEnd.."点之后和"..NoRepairShopTimeStart.."点之前进行摆摊修理。")
else
if Select == 1 then
local target = BuyShopRightClickList[player]
if RepairShopAbleFlag[target] then
local skillslot = -1
local skilllv = 0
if RepairShopAbleFlag[target] == 1 then
skillslot = Char.HaveSkill(target,RepairSkill1)
elseif RepairShopAbleFlag[target] == 2 then
skillslot = Char.HaveSkill(target,RepairSkill2)
end
if skillslot >= 0 then
skilllv = Char.GetSkillLevel(target,skillslot) or 0
end
if skilllv >= 1 then
local targetname = Char.GetData(target,2000)
local targetmetamo = Char.GetData(target,2)
local msg = targetmetamo.."|"..targetname.."|未知1|未知2|未知3|未知4|未知5|未知6|未知7|"
for i = 8,27 do
local itemindex = Char.GetItemIndex(player,i)
if itemindex >= 0 then
local itemtype = Item.GetData(itemindex,3)
if (RepairShopAbleFlag[target] == 1 and itemtype >= 0 and itemtype <= 6) or (RepairShopAbleFlag[target] == 2 and itemtype >= 7 and itemtype <= 14) then
local itemlv = Item.GetData(itemindex,11)
if skilllv >= itemlv then
local itemvalue1 = Item.GetData(itemindex,52)
if itemvalue1 == 0 then
local itemvalue2 = Item.GetData(itemindex,53)
if itemvalue2 == 0 or AbleDropDelItem == 1 then
local itemuse = Item.GetData(itemindex,65)
local itemusemax = Item.GetData(itemindex,13)
if itemusemax > itemuse then
local itemjd = Item.GetData(itemindex,63)
local itemname = Item.GetData(itemindex,2001)
local itemmetamo = Item.GetData(itemindex,1)
local repaircost = RepairCost[itemlv]
local itemmsg1 = Item.GetData(itemindex,57)
local itemmsg2 = Item.GetData(itemindex,58)
local itemmsg = GetItemValueString(itemindex)
if itemjd == 1 then
msg = msg ..itemname.."|"..itemmetamo.."|"..repaircost.."|"..i.."|0|0|"..itemmsg.."|"
end
end
end
end
end
end
end
end
NLG.ShowWindowTalked(player,22,2,170,msg,npc)
end
end
end
end
--print("\nLuaState %x %X BuyShop 38")
elseif Seqno == 170 then
--print("\nLuaState %x %X BuyShop 39")
local hours = tonumber(os.date("%H"))
if hours >= NoRepairShopTimeStart and hours < NoRepairShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoRepairShopTimeEnd.."点之后和"..NoRepairShopTimeStart.."点之前进行摆摊修理。")
return
else
local int = splitplus(Data,"|")
local target = BuyShopRightClickList[player]
if RepairShopAbleFlag[target] then
local skillslot = -1
local skilllv = 0
if RepairShopAbleFlag[target] == 1 then
skillslot = Char.HaveSkill(target,RepairSkill1)
elseif RepairShopAbleFlag[target] == 2 then
skillslot = Char.HaveSkill(target,RepairSkill2)
end
if skillslot >= 0 then
skilllv = Char.GetSkillLevel(target,skillslot) or 0
end
if skilllv >= 1 then
for k,v in pairs(int) do
local itemindex = Char.GetItemIndex(player,tonumber(v))
if itemindex >= 0 then
local itemtype = Item.GetData(itemindex,3)
if (RepairShopAbleFlag[target] == 1 and itemtype >= 0 and itemtype <= 6) or (RepairShopAbleFlag[target] == 2 and itemtype >= 7 and itemtype <= 14) then
local itemlv = Item.GetData(itemindex,11)
if skilllv >= itemlv then
local itemvalue1 = Item.GetData(itemindex,52)
if itemvalue1 == 0 then
local itemvalue2 = Item.GetData(itemindex,53)
if itemvalue2 == 0 or AbleDropDelItem == 1 then
local repaircost = RepairCost[itemlv]
local repaircharge = RepairCharge[itemlv]
local playergold = Char.GetData(player,53)
local targetgold = Char.GetData(target,53)
if playergold >= repaircost and targetgold + repaircharge <= sevelmaxgold then
local itemuse = Item.GetData(itemindex,65)
local itemusemax = Item.GetData(itemindex,13)
local newuse = math.floor((itemuse + itemusemax)/2)
local Itemname = Item.GetData(itemindex,%道具_已鉴定名%);
local ifvalitem = string.find(Itemname,"%$")
if ifvalitem then
newuse = Item.GetData(itemindex,13)
end
Char.SetData(player,53,playergold-repaircost)
Char.SetData(target,53,targetgold+repaircharge)
Item.SetData(itemindex,65,newuse)
Item.SetData(itemindex,13,newuse)
Item.UpItem(player,tonumber(v))
AddGoldLog(player,"BuyShop摆摊修理 支出"..repaircost.."魔币")
AddGoldLog(target,"BuyShop摆摊修理 收入"..repaircharge.."魔币")
NLG.SystemMessage(player,"花费了"..repaircost.."金币对"..Item.GetData(itemindex,2001).."进行了修理。")
NLG.SystemMessage(target,"为"..(Char.GetData(player,2000)).."修理了"..Item.GetData(itemindex,2001)..",赚取了"..repaircharge.."魔币。")
if GiveSkillExp == 1 and skilllv < SkillLevelMax then
local oldskillexp = Char.GetSkillExp(target,skillslot)
local getskillexp = math.ceil(BaseSkillExp[RepairShopAbleFlag[target]]*(itemlv/skilllv))
if Char.IsFeverTime(target) == 1 then
getskillexp = getskillexp * 2
end
Char.SetSkillExp(target,skillslot,oldskillexp+getskillexp)
NLG.SystemMessage(target,"得到了"..getskillexp.."技能经验。")
end
-- NLG.UpChar(target)
NLG.UpChar(player)
else
NLG.SystemMessage(player,"你的钱不够,无法修理"..Item.GetData(itemindex,2001).."。")
break
end
end
end
end
end
end
end
end
end
end
--print("\nLuaState %x %X BuyShop 40")
elseif Seqno == 180 then
--print("\nLuaState %x %X BuyShop 41")
if Select == 32 then
local playerclass = Char.GetData(player,51)
if playerclass == AppraisalShopClass then
local skillslot = Char.HaveSkill(player,AppraisalSkill)
if skillslot >= 0 then
local skilllv = Char.GetSkillLevel(player,skillslot) or 0
if skilllv >= 1 then
BuyShopExit(player)
AppraisalShopAbleFlag[player] = 1
Char.sendAction(player,AppraisalIcon)
Char.SetWalkPostEvent(nil,"BuyShopExit",player)
NLG.ShowWindowTalked(player,0,0,999,"\n\n\n 正在摆摊鉴定\n\n 移动、转身或登出都会取消摆摊",npc)
Off.CharLine(player,btshijian)
else
NLG.SystemMessage(player,"摆摊失败,您的技能等级太低。")
end
else
NLG.SystemMessage(player,"摆摊失败,您没有相应的技能。")
end
else
NLG.SystemMessage(player,"摆摊失败,您不是鉴定师。")
end
end
--print("\nLuaState %x %X BuyShop 42")
elseif Seqno == 190 then
--print("\nLuaState %x %X BuyShop 34")
local hours = tonumber(os.date("%H"))
if hours >= NoAppraisalShopTimeStart and hours < NoAppraisalShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoAppraisalShopTimeEnd.."点之后和"..NoAppraisalShopTimeStart.."点之前进行摆摊鉴定。")
else
if Select == 1 then
local target = BuyShopRightClickList[player]
if AppraisalShopAbleFlag[target] then
local skillslot = Char.HaveSkill(target,AppraisalSkill)
local skilllv = Char.GetSkillLevel(target,skillslot) or 0
if skilllv >= 1 then
local targetname = Char.GetData(target,2000)
local targetmetamo = Char.GetData(target,2)
local msg = targetmetamo.."|"..targetname.."|"
for i = 8,27 do
local itemindex = Char.GetItemIndex(player,i)
if itemindex >= 0 then
local itemtype = Item.GetData(itemindex,3)
local itemlv = Item.GetData(itemindex,11)
if skilllv >= itemlv then
local itemvalue1 = Item.GetData(itemindex,52)
if itemvalue1 == 0 then
local itemvalue2 = Item.GetData(itemindex,53)
if itemvalue2 == 0 or AbleAppraisalDropDelItem == 1 then
local itemjd = Item.GetData(itemindex,63)
if itemjd == 0 then
local itemname = Item.GetData(itemindex,2001)
local itemmetamo = Item.GetData(itemindex,1)
local appraisalcost = AppraisalCost[itemlv]
msg = msg ..itemname.."|"..itemmetamo.."|"..appraisalcost.."|"..i.."|0|||"
end
end
end
end
end
end
NLG.ShowWindowTalked(player,20,2,200,msg,npc)
end
end
end
end
--print("\nLuaState %x %X BuyShop 44")
elseif Seqno == 200 then
--print("\nLuaState %x %X BuyShop 45")
local hours = tonumber(os.date("%H"))
if hours >= NoAppraisalShopTimeStart and hours < NoAppraisalShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoAppraisalShopTimeEnd.."点之后和"..NoAppraisalShopTimeStart.."点之前进行摆摊鉴定。")
return
else
local int = splitplus(Data,"|")
local target = BuyShopRightClickList[player]
if AppraisalShopAbleFlag[target] then
local skillslot = Char.HaveSkill(target,AppraisalSkill)
local skilllv = Char.GetSkillLevel(target,skillslot) or 0
if skilllv >= 1 then
for k,v in pairs(int) do
local itemindex = Char.GetItemIndex(player,tonumber(v))
if itemindex >= 0 then
local itemtype = Item.GetData(itemindex,3)
local itemlv = Item.GetData(itemindex,11)
if skilllv >= itemlv then
local itemvalue1 = Item.GetData(itemindex,52)
if itemvalue1 == 0 then
local itemvalue2 = Item.GetData(itemindex,53)
if itemvalue2 == 0 or AbleAppraisalDropDelItem == 1 then
local repaircost = AppraisalCost[itemlv]
local repaircharge = AppraisalCharge[itemlv]
local playergold = Char.GetData(player,53)
local targetgold = Char.GetData(target,53)
if playergold >= repaircost and targetgold + repaircharge <= sevelmaxgold then
Char.SetData(player,53,playergold-repaircost)
Char.SetData(target,53,targetgold+repaircharge)
Item.SetData(itemindex,63,1)
Item.UpItem(player,tonumber(v))
AddGoldLog(player,"BuyShop摆摊鉴定 支出"..repaircost.."魔币")
AddGoldLog(target,"BuyShop摆摊鉴定 收入"..repaircharge.."魔币")
NLG.SystemMessage(player,"花费了"..repaircost.."金币对"..Item.GetData(itemindex,2001).."进行了鉴定。")
NLG.SystemMessage(target,"为"..(Char.GetData(player,2000)).."鉴定了"..Item.GetData(itemindex,2001)..",赚取了"..repaircharge.."魔币。")
if GiveAppraisalSkillExp == 1 and skilllv < AppraisalSkillLevelMax then
local oldskillexp = Char.GetSkillExp(target,skillslot)
local getskillexp = math.ceil(AppraisalBaseSkillExp*(itemlv/skilllv))
if Char.IsFeverTime(target) == 1 then
getskillexp = getskillexp * 2
end
Char.SetSkillExp(target,skillslot,oldskillexp+getskillexp)
NLG.SystemMessage(target,"得到了"..getskillexp.."技能经验。")
end
-- NLG.UpChar(target)
NLG.UpChar(player)
else
NLG.SystemMessage(player,"你的钱不够,无法鉴定"..Item.GetData(itemindex,2001).."。")
break
end
end
end
end
end
end
end
end
end
--print("\nLuaState %x %X BuyShop 46")
elseif Seqno == 210 then
--print("\nLuaState %x %X BuyShop 47")
if Select == 32 then
local playerclass = Char.GetData(player,51)
if playerclass == HealShopClass then
local skillslot = Char.HaveSkill(player,HealSkill)
if skillslot >= 0 then
local skilllv = Char.GetSkillLevel(player,skillslot) or 0
if skilllv >= 1 then
BuyShopExit(player)
HealAbleFlag[player] = 1
Char.sendAction(player,HealIcon)
Char.SetWalkPostEvent(nil,"BuyShopExit",player)
NLG.ShowWindowTalked(player,0,0,999,"\n\n\n 正在摆摊治疗\n\n 移动、转身或登出都会取消摆摊",npc)
Off.CharLine(player,btshijian)
else
NLG.SystemMessage(player,"摆摊失败,您的技能等级太低。")
end
else
NLG.SystemMessage(player,"摆摊失败,您没有相应的技能。")
end
else
NLG.SystemMessage(player,"摆摊失败,您不是医生。")
end
end
--print("\nLuaState %x %X BuyShop 48")
elseif Seqno == 220 then
--print("\nLuaState %x %X BuyShop 49")
local hours = tonumber(os.date("%H"))
if hours >= NoHealShopTimeStart and hours < NoHealShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoHealShopTimeEnd.."点之后和"..NoHealShopTimeStart.."点之前进行摆摊治疗。")
else
if Select == 1 then
local target = BuyShopRightClickList[player]
if HealAbleFlag[target] then
local skillslot = Char.HaveSkill(target,HealSkill)
local skilllv = Char.GetSkillLevel(target,skillslot) or 0
if skilllv >= 1 then
local healstate = Char.GetData(player,38)
if healstate >= 1 then
local playergold = Char.GetData(player,53)
local targetgold = Char.GetData(target,53)
local healcost = HealCost*healstate
local healcharge = HealCharge*healstate
if playergold >= healcost and targetgold+healcharge <= sevelmaxgold then
local targetname = Char.GetData(target,2000)
local playername = Char.GetData(player,2000)
Char.SetData(player,53,playergold-healcost)
Char.SetData(target,53,targetgold+healcharge)
Char.SetData(player,38,0)
AddGoldLog(player,"BuyShop摆摊治疗 支出"..healcost.."魔币")
AddGoldLog(target,"BuyShop摆摊治疗 收入"..healcharge.."魔币")
NLG.SystemMessage(player,"接受了"..targetname.."的治疗。花费了"..healcost.."魔币。(登出可消除头顶图标)")
NLG.SystemMessage(target,"为"..playername.."治疗了伤势。赚取了"..healcharge.."魔币。")
if GiveHealSkillExp == 1 and skilllv < HealSkillLevelMax then
local oldskillexp = Char.GetSkillExp(target,skillslot)
local getskillexp = HealBaseSkillExp
if Char.IsFeverTime(target) == 1 then
getskillexp = getskillexp * 2
end
Char.SetSkillExp(target,skillslot,oldskillexp+getskillexp)
NLG.SystemMessage(target,"得到了"..getskillexp.."技能经验。")
end
NLG.UpChar(player)
-- NLG.UpChar(target)
else
NLG.SystemMessage(player,"您的钱不够。")
end
else
NLG.SystemMessage(player,"您没有受伤。")
end
end
end
end
end
--print("\nLuaState %x %X BuyShop 50")
elseif Seqno == 230 then --带内心
--print("\nLuaState %x %X BuyShop 51")
local hours = tonumber(os.date("%H"))
if hours >= NoHeartShopTimeStart and hours < NoHeartShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoHeartShopTimeEnd.."点之后和"..NoHeartShopTimeStart.."点之前进行摆摊带内心。")
else
if Select == 32 then
local playerclass = Char.GetData(player,51)
if playerclass == HeartShopClass[1] or playerclass == HeartShopClass[2] then
local playerclassrank = Char.GetData(player,50)
if playerclassrank >= HeartShopClassRankLimet then
BuyShopExit(player)
HeartAbleFlag[player] = 1
Char.sendAction(player,HeartIcon)
Char.SetWalkPostEvent(nil,"BuyShopExit",player)
NLG.ShowWindowTalked(player,0,0,999,"\n\n\n 正在摆摊带内心\n\n 移动、转身或登出都会取消摆摊",npc)
Off.CharLine(player,btshijian)
else
NLG.SystemMessage(player,"您不是正职医生或者护士。")
end
else
NLG.SystemMessage(player,"您不是医生或者护士。")
end
end
end
--print("\nLuaState %x %X BuyShop 52")
elseif Seqno == 240 then
--print("\nLuaState %x %X BuyShop 53")
local hours = tonumber(os.date("%H"))
if hours >= NoHeartShopTimeStart and hours < NoHeartShopTimeEnd then
NLG.SystemMessage(player,"只允许在每天的"..NoHeartShopTimeEnd.."点之后和"..NoHeartShopTimeStart.."点之前进行摆摊带内心。")
else
if Select == 1 then
local target = BuyShopRightClickList[player]
if HeartAbleFlag[target] then
local playergold = Char.GetData(player,53)
local targetgold = Char.GetData(target,53)
if playergold >= HeartCost and targetgold+HeartCharge <= sevelmaxgold then
local targetname = Char.GetData(target,2000)
local playername = Char.GetData(player,2000)
Char.SetData(player,53,playergold-HeartCost)
Char.SetData(target,53,targetgold+HeartCharge)
AddGoldLog(player,"BuyShop摆摊内心 支出"..HeartCost.."魔币")
AddGoldLog(target,"BuyShop摆摊内心 收入"..HeartCharge.."魔币")
NLG.SystemMessage(player,"在"..targetname.."的帮助下进入内心。花费了"..HeartCost.."魔币。")
NLG.SystemMessage(target,"带领"..playername.."进入内心。赚取了"..HeartCharge.."魔币。")
NLG.UpChar(player)
-- NLG.UpChar(target)
Char.DischargeParty(player)
Char.Warp(player,HeartWarp[1],HeartWarp[2],HeartWarp[3],HeartWarp[4])
end
end
end
end
--print("\nLuaState %x %X BuyShop 54")
end
else
BuyShopExit(player)
BuyShopRightClickList[player] = nil
end
end
function BuyShopzhuceNPC()
BuyShopNpc_Init()
return 0
end
function BuyShopNpc_Init(npc)
if npc == nil then
npc = NL.CreateNpc(nil,"BuyShopNpc_zhizuo")
BigLib()
end
Char.SetData(npc,1,BuyShopNpc[1])
Char.SetData(npc,2,BuyShopNpc[1])
Char.SetData(npc,4,BuyShopNpc[4])
Char.SetData(npc,5,BuyShopNpc[5])
Char.SetData(npc,6,BuyShopNpc[6])
Char.SetData(npc,7,BuyShopNpc[3])
Char.SetData(npc,2000,BuyShopNpc[2])
Char.SetWindowTalkedEvent(nil,"BuyShopNpcWindowTalkedCallBack",npc)
NLG.UpChar(npc)
LuaNpcIndex["BuyShopNpcIndex"]=npc;
InstallNpc("BuyShopNpcIndex",npc);
return true
end
function BuyShopNpc_zhizuo(index)
return true;
end
|
|