| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- Platform = {}
- local this = Platform;
- PLATFORMSYSDATA = "R$platform_sys_data"
- local MonthCardType = 40
- local PlatformType = {
- KaiYing = "kaiying"
- }
- function Platform.init()
- local data = {}
- data.channel = ConfigDataManager.getTableValue("cfg_global", "value", "id", 500)
- setsysvar(PLATFORMSYSDATA, data)
- end
- function Platform.putIntoBag(actor, itemId)
- local data = getsysvar(PLATFORMSYSDATA)
- if data == nil then
- return
- end
- -- if data.channel == PlatformType.KaiYing then
- if PrivilegeMonth.hasPrivilegeType(actor, MonthCardType) ~= true then
- Platform.setItemBind(actor, itemId, 1)
- else
- local item = getbagiteminfo(actor, itemId, 1)
- if item == nil then
- return
- end
- local lockItem = ConfigDataManager.getTableValue("cfg_item", "lockItem", "id", item.cfgid)
- if lockItem ~= "" and lockItem == "1" then
- Platform.setItemBind(actor, itemId, 0)
- end
- end
- -- end
- end
- function Platform.monthPrivilegeActivation(actor, p_type)
- -- 解锁了月卡.道具也不能恢复到绑定状态
- -- -- 月卡激活
- -- if p_type == 72 then
- -- -- 降低消耗
- -- local data = getsysvar(PLATFORMSYSDATA)
- -- if data == nil then
- -- return
- -- end
- -- -- if data.channel ~= PlatformType.KaiYing then
- -- -- return
- -- -- end
- -- -- 把玩家穿戴.背包.仓库的东西.变为可交易状态
- -- local equips = getallbagiteminfo(actor)
- -- for k, v in pairs(equips) do
- -- local lockItem = ConfigDataManager.getTableValue("cfg_item", "lockItem", "id", v.cfgid)
- -- if lockItem ~= nil and lockItem == "1" then
- -- Platform.setItemBind(actor, v.id, 0)
- -- end
- -- end
- -- for i = 1, 10 do
- -- local equips = getalliteminfoinstore(actor, i)
- -- for k, v in pairs(equips) do
- -- local lockItem = ConfigDataManager.getTableValue("cfg_item", "lockItem", "id", v.cfgid)
- -- if lockItem ~= nil and lockItem == "1" then
- -- local isbind = API.GetItemData(actor, v.id, "isbind")
- -- if isbind ~= 1 then
- -- -- 没办法修改仓库中物品的数据.只能打上标签.让他显示为可交易状态
- -- API.SetItemData(actor, v.id, "isbind", 0)
- -- end
- -- -- Platform.setItemBind(actor, v.id, 0)
- -- end
- -- end
- -- end
- -- local equips = getputonequipinfo(actor)
- -- for k, v in pairs(equips) do
- -- local lockItem = ConfigDataManager.getTableValue("cfg_item", "lockItem", "id", v.cfgid)
- -- if lockItem ~= nil and lockItem == "1" then
- -- Platform.setItemBind(actor, v.id, 0)
- -- end
- -- end
- -- end
- end
- function Platform.setItemBind(actor, itemId, bind)
- local isbind = API.GetItemData(actor, itemId, "isbind")
- if isbind == 1 then
- return
- end
- changeitembindstate(actor, itemId, bind)
- local res = {
- itemId = itemId,
- bindId = bind == 1 and true or false
- }
- sendluamsg(actor, LuaMessageIdToClient.RES_EQUIP_BIND_DATA_CHANGE, res)
- end
- function Platform.isLimitPick(actor)
- if PrivilegeMonth.hasPrivilegeType(actor, MonthCardType) ~= true then
- return true
- end
- return false
- end
- function Platform.pickUpItem(actor, items)
- local allow = {}
- local rid = getbaseinfo(actor, "rid")
- local tip = false
- for k, v in pairs(items) do
- if v.luaextdata ~= nil and v.luaextdata.onlypick ~= nil and v.luaextdata.onlypick ~= tonumber(rid) then
- tip = true
- allow[v.id] = {
- allow = false,
- }
- else
- allow[v.id] = {
- allow = true,
- }
- end
- end
- if tip then
- messagebox(actor, "该物品归属为无公爵特权玩家,其他玩家无法拾取!")
- end
- return allow
- end
- function Platform.resetPick(actor, items, allow)
- local rid = getbaseinfo(actor, "rid")
- local tip = false
- for k, v in pairs(allow) do
- local index, item = table.findByCondi(items, function(a)
- return a.id == k
- end)
- if item and item.luaextdata and item.luaextdata.onlypick ~= nil and item.luaextdata.onlypick ~= tonumber(rid) then
- tip = true
- allow[k].allow = false
- end
- end
- if tip then
- messagebox(actor, "该物品归属为无公爵特权玩家,其他玩家无法拾取!")
- end
- return allow
- end
|