1779 lines
60 KiB
Lua
1779 lines
60 KiB
Lua
------------------------------------------------
|
||
-- 作者: 陈宇
|
||
-- 日期: 2019-07-18
|
||
-- 文件: XianPoSystem.lua
|
||
-- 模块: XianPoSystem
|
||
-- 描述: 仙魄系统
|
||
------------------------------------------------
|
||
local XianPoData = require("Logic.XianPo.XianPoData")
|
||
local XianPoSyntheticData = require("Logic.XianPo.XianPoSyntheticData")
|
||
local L_JianCore = require "Logic.XianPo.JianCoreData"
|
||
local L_BattlePropTools = CS.Thousandto.Code.Logic.BattlePropTools
|
||
local RedPointItemCondition = CS.Thousandto.Code.Logic.RedPointItemCondition
|
||
|
||
local XianPoSystem = {
|
||
EquipedXianPoDic = Dictionary:New(), -- 已装备的仙魄字典,key = 位置,value = XianPoData
|
||
BagXianPoDic = Dictionary:New(), -- 背包内的仙魄字典,key = uid,value = XianPoData
|
||
XianPoOverviewDic = Dictionary:New(), -- 仙魄预览字典,key = 解锁层数,value = 配置表id
|
||
XianPoExchangeDic = Dictionary:New(), -- 仙魄兑换字典,key = 排序,value = 配置表id
|
||
XianPoSyntheticTypeDic = Dictionary:New(), -- 仙魄合成类型字典,key = 大分类id,value = List<合成表id>
|
||
XianPoSyntheticDic = Dictionary:New(), -- 仙魄合成字典,key = 合成id,value = XianPoSyntheticData
|
||
GetXianPoConditionType = 0, -- 获取仙魄所需条件的类型(functionVariable表中的类型)
|
||
HoleDataDic = nil, -- 镶嵌孔数据
|
||
|
||
XianPoMaxInlayIndex = 10, -- 仙魄最大镶嵌位置
|
||
MaxBagCount = 200, -- 最大背包格子
|
||
|
||
-- 当前请求合成的CfgId
|
||
ReqCompoundCfgId = 0,
|
||
|
||
-- 红点索引Id
|
||
ListRedPointIds = List:New(),
|
||
-- 通关剑灵阁层数
|
||
JianLingGeLevel = 0,
|
||
-- 每个剑灵可镶嵌的格子总数
|
||
HoleCount = 7,
|
||
-- 剑灵列表 (暂时只包含名字)
|
||
JianLingList = List:New(),
|
||
JianLingModelIdList = List:New(),
|
||
-- 可以升级的镶嵌孔列表
|
||
CanLvList = List:New(),
|
||
-- 可镶嵌(替换)的剑灵列表
|
||
ValidJianLingList = List:New(),
|
||
-- 总揽数据
|
||
ViewDic = Dictionary:New(),
|
||
-- 是否显示合成红点
|
||
preShowSynRedPoint = false,
|
||
IsShowSynRedPoint = false,
|
||
-- 背包灵魄是否改变了
|
||
IsLingPoChange = false,
|
||
-- update检测红点时间
|
||
CheckTime = 1,
|
||
-- 剑灵总数量
|
||
JianLingCount = 6,
|
||
|
||
--剑是否显示的条件
|
||
DicJianCore = nil,
|
||
--背包灵魄总数
|
||
BagSoulCount = 0,
|
||
--配置id对应灵魄在背包中的数量
|
||
SoulBagDic = Dictionary:New(),
|
||
}
|
||
|
||
function XianPoSystem:Initialize()
|
||
self.BagSoulCount = 0
|
||
self.SoulBagDic:Clear()
|
||
-- 消息注册
|
||
GameCenter.RegFixEventHandle(LogicLuaEventDefine.EID_EVEMT_UPDATE_SWORDMANDATE, self.SwordChange, self)
|
||
self.MaxBagCount = DataConfig.DataGlobal[1581].Params
|
||
DataConfig.DataImmortalSoulAttribute:Foreach(function(key, value)
|
||
-- 非经验仙魄,预览用仙魄
|
||
if value.Type ~= 2 then
|
||
if self.GetXianPoConditionType == 0 then
|
||
if value.ExchangeConditions ~= "" then
|
||
local _condition = Utils.SplitNumber(value.ExchangeConditions, "_")
|
||
self.GetXianPoConditionType = _condition[1]
|
||
end
|
||
end
|
||
if not self.XianPoOverviewDic:ContainsKey(value.OverviewConditions) then
|
||
local _cfgIdList = List:New()
|
||
_cfgIdList:Add(key)
|
||
self.XianPoOverviewDic:Add(value.OverviewConditions, _cfgIdList)
|
||
else
|
||
local _cfgIdList = self.XianPoOverviewDic[value.OverviewConditions]
|
||
_cfgIdList:Add(key)
|
||
end
|
||
end
|
||
-- 可兑换仙魄
|
||
if value.ExchangeRanking > 0 then
|
||
if not self.XianPoExchangeDic:ContainsKey(value.ExchangeRanking) then
|
||
self.XianPoExchangeDic:Add(value.ExchangeRanking, key)
|
||
end
|
||
end
|
||
end)
|
||
-- 兑换仙魄字典排序
|
||
self.XianPoExchangeDic:SortKey(function(a, b)
|
||
return a < b
|
||
end)
|
||
|
||
DataConfig.DataImmortalSoulSynthesis:Foreach(function(key, value)
|
||
if not self.XianPoSyntheticTypeDic:ContainsKey(value.Type) then
|
||
local _idList = List:New()
|
||
_idList:Add(key)
|
||
self.XianPoSyntheticTypeDic:Add(value.Type, _idList)
|
||
else
|
||
local _idList = self.XianPoSyntheticTypeDic[value.Type]
|
||
_idList:Add(key)
|
||
end
|
||
if not self.XianPoSyntheticDic:ContainsKey(key) then
|
||
local _data = XianPoSyntheticData:New()
|
||
_data:SetAllData(value)
|
||
self.XianPoSyntheticDic:Add(key, _data)
|
||
end
|
||
end)
|
||
GameCenter.RegFixEventHandle(LogicEventDefine.EVENT_COIN_CHANGE_UPDATE, self.CoinChange, self)
|
||
|
||
-- 灵魄抽取红点
|
||
local _huntCfg = DataConfig.DataImmortalSoulHunt[2]
|
||
if _huntCfg ~= nil then
|
||
local _costItems = Utils.SplitNumber(_huntCfg.BasicAttributes, '_')
|
||
GameCenter.RedPointSystem:AddFuncCondition(FunctionStartIdCode.LingPoLottery, 0,
|
||
RedPointItemCondition(_costItems[1], _costItems[2]))
|
||
end
|
||
end
|
||
|
||
function XianPoSystem:UnInitialize()
|
||
self.BagSoulCount = 0
|
||
self.SoulBagDic:Clear()
|
||
self.EquipedXianPoDic:Clear()
|
||
self.BagXianPoDic:Clear()
|
||
GameCenter.UnRegFixEventHandle(LogicLuaEventDefine.EID_EVEMT_UPDATE_SWORDMANDATE, self.SwordChange, self)
|
||
GameCenter.UnRegFixEventHandle(LogicEventDefine.EVENT_COIN_CHANGE_UPDATE, self.CoinChange, self)
|
||
end
|
||
|
||
function XianPoSystem:CoinChange(obj, sender)
|
||
if obj == ItemTypeCode.LingPoSw then
|
||
self:LingPoChange()
|
||
end
|
||
end
|
||
|
||
-- 剑阁层数改变
|
||
function XianPoSystem:SwordChange(obj, sender)
|
||
self.JianLingGeLevel = GameCenter.SwordMandateSystem.CurLevel
|
||
self.IsShowSynRedPoint = self:SetXianPoSyntheticRedPoint()
|
||
if self.preShowSynRedPoint ~= self.IsShowSynRedPoint then
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.XianPoSynthetic, self.IsShowSynRedPoint)
|
||
self.preShowSynRedPoint = self.IsShowSynRedPoint
|
||
end
|
||
end
|
||
|
||
-- 获取剑灵名字列表
|
||
function XianPoSystem:GetNameList()
|
||
if #self.JianLingList == 0 then
|
||
local dic = GameCenter.FlySowardSystem:GetTypeDic()
|
||
if dic ~= nil then
|
||
local list = dic:GetKeys()
|
||
for i = 1, #list do
|
||
local cfg = GameCenter.FlySowardSystem:GetActiveCfgByType(list[i])
|
||
if cfg ~= nil then
|
||
self.JianLingList:Add(cfg.Name)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return self.JianLingList
|
||
end
|
||
|
||
-- 获取剑灵模型ID列表
|
||
function XianPoSystem:GetModelList()
|
||
if #self.JianLingModelIdList == 0 then
|
||
local dic = GameCenter.FlySowardSystem:GetTypeDic()
|
||
if dic ~= nil then
|
||
local list = dic:GetKeys()
|
||
for i = 1, #list do
|
||
local cfg = GameCenter.FlySowardSystem:GetActiveCfgByType(list[i])
|
||
if cfg ~= nil then
|
||
self.JianLingModelIdList:Add(cfg.Id)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return self.JianLingModelIdList
|
||
end
|
||
|
||
-- 获取激活的剑灵最大索引
|
||
function XianPoSystem:GetActiveJianlingIndex()
|
||
local index = 1
|
||
local dic = GameCenter.FlySowardSystem:GetTypeDic()
|
||
if dic ~= nil then
|
||
local list = dic:GetKeys()
|
||
for i = 1, #list do
|
||
local type = list[i]
|
||
for m = 1, self.HoleCount do
|
||
local holeId = i * 100 + m
|
||
if self:GetJianValid(i) then
|
||
local isValid = self:GetHoleIsValid(holeId)
|
||
if isValid then
|
||
index = type
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return index
|
||
end
|
||
|
||
-- 获取镶嵌孔数据
|
||
function XianPoSystem:GetHoleDataDic()
|
||
if self.HoleDataDic == nil then
|
||
self.HoleDataDic = Dictionary:New()
|
||
local nameList = self:GetNameList()
|
||
local isActive = false
|
||
for i = 1, #nameList do
|
||
local index = i
|
||
for m = 1, self.HoleCount do
|
||
local holeId = i * 100 + m
|
||
local data = self.HoleDataDic[holeId]
|
||
if data == nil then
|
||
local cfg = DataConfig.DataImmortalSoulIattice[holeId]
|
||
if cfg ~= nil then
|
||
local list = Utils.SplitNumber(cfg.Condition, '_')
|
||
local level = list[2]
|
||
data = {
|
||
ActiveLv = level
|
||
}
|
||
end
|
||
self.HoleDataDic[holeId] = data
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return self.HoleDataDic
|
||
end
|
||
|
||
function XianPoSystem:Sort(list)
|
||
if list ~= nil then
|
||
list:Sort(function(a, b)
|
||
return a.SortId < b.SortId
|
||
end)
|
||
end
|
||
end
|
||
|
||
-- 排序
|
||
function XianPoSystem:SortUid(uidlist)
|
||
local list = List:New()
|
||
local retList = List:New()
|
||
for i = 1, #uidlist do
|
||
local data = self:GetBagXianPoDataByUID(uidlist[i])
|
||
if data ~= nil then
|
||
data.SortId = self:GetSortId(data)
|
||
list:Add(data)
|
||
end
|
||
end
|
||
list:Sort(function(a, b)
|
||
return a.SortId < b.SortId
|
||
end)
|
||
for i = 1, #list do
|
||
local data = list[i]
|
||
if data ~= nil then
|
||
retList:Add(data.Uid)
|
||
end
|
||
end
|
||
return retList
|
||
end
|
||
|
||
function XianPoSystem:SortUid2(uidlist, holeId, index)
|
||
local list = List:New()
|
||
local retList = List:New()
|
||
for i = 1, #uidlist do
|
||
local data = self:GetBagXianPoDataByUID(uidlist[i])
|
||
if data ~= nil then
|
||
data.SortId = self:GetSortId2(data, holeId, index)
|
||
list:Add(data)
|
||
end
|
||
end
|
||
list:Sort(function(a, b)
|
||
return a.SortId < b.SortId
|
||
end)
|
||
for i = 1, #list do
|
||
local data = list[i]
|
||
if data ~= nil then
|
||
retList:Add(data.Uid)
|
||
end
|
||
end
|
||
return retList
|
||
end
|
||
|
||
function XianPoSystem:GetSortId(data)
|
||
local sortId = 0
|
||
if data.Quality == XianPoQuality.Blue then
|
||
sortId = 1000000000000
|
||
elseif data.Quality == XianPoQuality.Purple then
|
||
sortId = 2000000000000
|
||
elseif data.Quality == XianPoQuality.Gold then
|
||
sortId = 3000000000000
|
||
elseif data.Quality == XianPoQuality.Red then
|
||
sortId = 4000000000000
|
||
end
|
||
sortId = sortId + data.CfgId - data.Level
|
||
return sortId
|
||
end
|
||
|
||
function XianPoSystem:GetSortId2(data, holeId, index)
|
||
local sortId = 0
|
||
if data.Quality == XianPoQuality.Blue then
|
||
sortId = 4000000000000
|
||
elseif data.Quality == XianPoQuality.Purple then
|
||
sortId = 3000000000000
|
||
elseif data.Quality == XianPoQuality.Gold then
|
||
sortId = 2000000000000
|
||
elseif data.Quality == XianPoQuality.Red then
|
||
sortId = 1000000000000
|
||
end
|
||
local visable, equal = self:CanEquipOrRepalce(data.Uid, holeId, index)
|
||
if equal then
|
||
sortId = sortId + 4000000000000
|
||
end
|
||
sortId = sortId + data.CfgId - data.Level * 10000000000 - data.Star * 100000000000
|
||
return sortId
|
||
end
|
||
|
||
-- 判断指定ID的仙魄是否可以替换或者镶嵌
|
||
function XianPoSystem:CanEquipOrRepalce(uid, holeId, index)
|
||
local ret = false
|
||
local haveEqualAtt = false
|
||
local data = self.BagXianPoDic[uid]
|
||
if data == nil then
|
||
return false
|
||
end
|
||
if not self:GetHoleIsValid(holeId) then
|
||
-- 这个空无效
|
||
return false
|
||
end
|
||
-- 先检查所有剑灵项是否有可镶嵌的孔
|
||
ret = self:HaveFreeHole(holeId)
|
||
if ret then
|
||
-- 判断当前孔是否可以镶嵌
|
||
ret = false
|
||
for n = 1, self.HoleCount do
|
||
local otherHole = index * 100 + n
|
||
if otherHole ~= holeId then
|
||
local otherEquiptItem = self.EquipedXianPoDic[otherHole]
|
||
if otherEquiptItem ~= nil and otherEquiptItem.Type2 == data.Type2 then
|
||
-- 如果属性相同 并且不是同一个孔
|
||
haveEqualAtt = true
|
||
end
|
||
end
|
||
end
|
||
if not haveEqualAtt then
|
||
-- 如果没有相同的属性 就可以替换
|
||
ret = true
|
||
end
|
||
end
|
||
if not ret then
|
||
-- 不能镶嵌 就检查是否可以替换
|
||
local equipItem = self.EquipedXianPoDic[holeId]
|
||
if equipItem ~= nil then
|
||
ret, haveEqualAtt = self:CanReplace(data, equipItem, index, holeId)
|
||
end
|
||
end
|
||
return ret, haveEqualAtt
|
||
end
|
||
|
||
-- 获取可以升级灵魄的孔
|
||
function XianPoSystem:GetCanLvHole()
|
||
self.CanLvList:Clear()
|
||
local nameList = self:GetNameList()
|
||
local isActive = false
|
||
for i = 1, #nameList do
|
||
local index = i
|
||
for m = 1, self.HoleCount do
|
||
local holeId = i * 100 + m
|
||
local isValid = self:GetHoleIsValid(holeId)
|
||
if isValid then
|
||
-- 激活了
|
||
isActive = true
|
||
break
|
||
end
|
||
end
|
||
if isActive then
|
||
for m = 1, self.HoleCount do
|
||
local holeId = index * 100 + m
|
||
if self:GetHoleIsValid(holeId) then
|
||
if self:IsIndexXianPoCanUpgrade(holeId) then
|
||
self.CanLvList:Add(holeId)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return self.CanLvList
|
||
end
|
||
|
||
-- 判断当前孔是否有可替换的灵魄
|
||
function XianPoSystem:HaveReplaceItem(index, holeId)
|
||
local ret = false
|
||
if self:GetHoleIsValid(holeId) then
|
||
local equipItem = self.EquipedXianPoDic[holeId]
|
||
-- 从未灵魄背包中获取等级比当前孔等级更高的灵魄
|
||
local bagKeys = self.BagXianPoDic:GetKeys()
|
||
for i = 1, #bagKeys do
|
||
local key = bagKeys[i]
|
||
local bagItem = self.BagXianPoDic[key]
|
||
ret = self:CanReplace(bagItem, equipItem, index, holeId)
|
||
if ret then
|
||
break
|
||
end
|
||
end
|
||
end
|
||
return ret
|
||
end
|
||
|
||
function XianPoSystem:CanReplace(bagItem, equipItem, index, holeId)
|
||
local ret = false
|
||
local haveEqualAtt = false
|
||
if bagItem ~= nil and bagItem.Typ ~= 2 then
|
||
-- 如果是属性灵魄
|
||
if equipItem == nil or (bagItem.Level > equipItem.Level and bagItem.Quality > equipItem.Quality) then
|
||
-- 如果背包中的该仙魄等级更高 判断其他格子里面是否有相同属性的仙魄
|
||
for n = 1, self.HoleCount do
|
||
local otherHole = index * 100 + n
|
||
if otherHole ~= holeId then
|
||
local otherEquiptItem = self.EquipedXianPoDic[otherHole]
|
||
if otherEquiptItem ~= nil and otherEquiptItem.Type2 == bagItem.Type2 then
|
||
-- 如果属性相同 并且不是同一个孔
|
||
haveEqualAtt = true
|
||
end
|
||
end
|
||
end
|
||
if not haveEqualAtt then
|
||
-- 如果没有相同的属性 就可以替换
|
||
ret = true
|
||
end
|
||
end
|
||
if equipItem == nil or bagItem.Quality > equipItem.Quality or (bagItem.Quality == equipItem.Quality and bagItem.Star > equipItem.Star) then
|
||
-- 如果背包中的该仙魄品质更高 判断其他格子里面是否有相同属性的仙魄
|
||
|
||
for n = 1, self.HoleCount do
|
||
local otherHole = index * 100 + n
|
||
if otherHole ~= holeId then
|
||
local otherEquiptItem = self.EquipedXianPoDic[otherHole]
|
||
if otherEquiptItem ~= nil and otherEquiptItem.Type2 == bagItem.Type2 then
|
||
-- 如果属性相同 并且不是同一个孔
|
||
haveEqualAtt = true
|
||
end
|
||
end
|
||
end
|
||
if not haveEqualAtt then
|
||
-- 如果没有相同的属性 就可以替换
|
||
ret = true
|
||
end
|
||
end
|
||
if not haveEqualAtt then
|
||
for n = 1, self.HoleCount do
|
||
local otherHole = index * 100 + n
|
||
if otherHole ~= holeId then
|
||
local otherEquiptItem = self.EquipedXianPoDic[otherHole]
|
||
if otherEquiptItem ~= nil and otherEquiptItem.Type2 == bagItem.Type2 then
|
||
-- 如果属性相同 并且不是同一个孔
|
||
haveEqualAtt = true
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return ret, haveEqualAtt
|
||
end
|
||
|
||
-- 判断传入剑灵index对应的剑灵是否有可以替换或者镶嵌的灵魄
|
||
function XianPoSystem:GetEquiptHoleList(index)
|
||
local holeList = List:New()
|
||
local ret = false
|
||
for i = 1, self.HoleCount do
|
||
-- 格子id
|
||
-- 先判断是否有格子没有镶嵌
|
||
local haveHole = false
|
||
local holeId = index * 100 + i
|
||
haveHole = self:GetHoleIsValid(holeId)
|
||
if haveHole then
|
||
haveHole = self.EquipedXianPoDic:ContainsKey(holeId)
|
||
if haveHole then
|
||
-- 镶嵌了灵魄 判断是否有可以替换的灵魄
|
||
local equipItem = self.EquipedXianPoDic[holeId]
|
||
-- 从未灵魄背包中获取等级比当前孔等级更高的灵魄
|
||
local bagKeys = self.BagXianPoDic:GetKeys()
|
||
for m = 1, #bagKeys do
|
||
local key = bagKeys[m]
|
||
local item = self.BagXianPoDic[key]
|
||
if item ~= nil and item.Typ ~= 2 then
|
||
haveHole = self:CanReplace(item, equipItem, index, holeId)
|
||
if haveHole then
|
||
holeList:Add(holeId)
|
||
end
|
||
end
|
||
end
|
||
else
|
||
-- 没有镶嵌灵魄 检查背包里面的灵魄是否可以镶嵌
|
||
local bagKeys = self.BagXianPoDic:GetKeys()
|
||
for k = 1, #bagKeys do
|
||
local key = bagKeys[k]
|
||
local item = self.BagXianPoDic[key]
|
||
if item ~= nil and item.Typ ~= 2 then
|
||
-- 如果是属性灵魄 判断和其他孔是否有属性冲突
|
||
haveHole = true
|
||
for m = 1, self.HoleCount do
|
||
if i ~= m then
|
||
local otherEquipItem = self.EquipedXianPoDic[index * 100 + m]
|
||
if otherEquipItem ~= nil and otherEquipItem.Type2 == item.Type2 then
|
||
haveHole = false
|
||
end
|
||
end
|
||
end
|
||
if haveHole then
|
||
holeList:Add(holeId)
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return holeList
|
||
end
|
||
|
||
-- 一次性返回有可镶嵌的剑灵序号
|
||
function XianPoSystem:GetValidJianLingIndexs()
|
||
self.ValidJianLingList:Clear()
|
||
local bagKeys = self.BagXianPoDic:GetKeys()
|
||
-- 先检查所有剑灵项是否有可镶嵌的孔
|
||
local nameList = self:GetNameList()
|
||
local activeIndex = self:GetActiveJianlingIndex()
|
||
for i = 1, #nameList do
|
||
local index = i
|
||
if activeIndex >= index then
|
||
local ret = false
|
||
for m = 1, self.HoleCount do
|
||
local holeId = index * 100 + i
|
||
ret = self:HaveFreeHole(holeId)
|
||
if ret then
|
||
-- 没有镶嵌灵魄 检查背包里面的灵魄是否可以镶嵌
|
||
for k = 1, #bagKeys do
|
||
local key = bagKeys[k]
|
||
local item = self.BagXianPoDic[key]
|
||
if item ~= nil and item.Typ ~= 2 then
|
||
-- 如果是属性灵魄 判断和其他孔是否有属性冲突
|
||
for n = 1, self.HoleCount do
|
||
if i ~= n then
|
||
local otherEquipItem = self.EquipedXianPoDic[index * 100 + n]
|
||
if otherEquipItem ~= nil and otherEquipItem.Type2 == item.Type2 then
|
||
ret = false
|
||
end
|
||
end
|
||
end
|
||
if ret then
|
||
self.ValidJianLingList:Add(index)
|
||
break
|
||
end
|
||
end
|
||
end
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
for i = 1, #bagKeys do
|
||
local bagKey = bagKeys[i]
|
||
local bagItem = self.BagXianPoDic[bagKey]
|
||
-- 和所有的剑灵项比较
|
||
for m = 1, #nameList do
|
||
local index = m
|
||
if activeIndex >= index then
|
||
local ret = false
|
||
if not self.ValidJianLingList:Contains(m) then
|
||
-- 如果没有可镶嵌的孔 检查是否可以替换
|
||
ret = self:HaveBetterItem(index, bagItem)
|
||
if ret then
|
||
self.ValidJianLingList:Add(m)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return self.ValidJianLingList
|
||
end
|
||
|
||
function XianPoSystem:GetValidJianLingStateList()
|
||
local bagKeys = self.BagXianPoDic:GetKeys()
|
||
local bagCount = #bagKeys
|
||
-- 先检查所有剑灵项是否有可镶嵌的孔
|
||
local activeIndex = self:GetActiveJianlingIndex()
|
||
for i = 1, self.JianLingCount do
|
||
local index = i
|
||
if activeIndex >= index then
|
||
local ret = false
|
||
-- 获取可镶嵌孔列表
|
||
local freeHoleList = self:GetFreeHoleList(index)
|
||
if #freeHoleList > 0 then
|
||
-- 有可镶嵌的孔
|
||
ret = true
|
||
for k = 1, bagCount do
|
||
local key = bagKeys[k]
|
||
local item = self.BagXianPoDic[key]
|
||
if item ~= nil and item.Typ ~= 2 then
|
||
-- 如果是属性灵魄 判断和其他孔是否有属性冲突
|
||
for m = 1, self.HoleCount do
|
||
local otherEquipItem = self.EquipedXianPoDic[index * 100 + m]
|
||
if otherEquipItem ~= nil and otherEquipItem.Type2 == item.Type2 then
|
||
ret = false
|
||
break
|
||
end
|
||
end
|
||
if ret then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
if not ret then
|
||
--不能镶嵌 判断是否有更好的灵魄
|
||
for k = 1, bagCount do
|
||
local bagKey = bagKeys[k]
|
||
local bagItem = self.BagXianPoDic[bagKey]
|
||
ret = self:HaveBetterItem(index, bagItem)
|
||
if ret then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
else
|
||
-- 没有可镶嵌的孔
|
||
for k = 1, bagCount do
|
||
local bagKey = bagKeys[k]
|
||
local bagItem = self.BagXianPoDic[bagKey]
|
||
ret = self:HaveBetterItem(index, bagItem)
|
||
if ret then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
-- 判断是否有可以升级的
|
||
for m = 1, self.HoleCount do
|
||
local holeId = index * 100 + m
|
||
if self:GetHoleIsValid(holeId) then
|
||
if self:IsIndexXianPoCanUpgrade(holeId) then
|
||
return true
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return false
|
||
end
|
||
|
||
-- 获取可镶嵌孔列表
|
||
function XianPoSystem:GetFreeHoleList(index)
|
||
local list = List:New()
|
||
for m = 1, self.HoleCount do
|
||
local holeId = index * 100 + m
|
||
local ret = self:HaveFreeHole(holeId)
|
||
if ret then
|
||
list:Add(holeId)
|
||
end
|
||
end
|
||
return list
|
||
end
|
||
|
||
-- 判断是否有空闲的孔洞
|
||
function XianPoSystem:HaveFreeHole(holeId)
|
||
local ret = false
|
||
-- 先判断该孔是否可用
|
||
ret = self:GetHoleIsValid(holeId)
|
||
if ret then
|
||
-- 如果该孔有效 判断是否装备了灵魄
|
||
if self.EquipedXianPoDic:ContainsKey(holeId) then
|
||
ret = false
|
||
end
|
||
end
|
||
return ret
|
||
end
|
||
|
||
-- 判断是否有更高级的灵魄
|
||
function XianPoSystem:HaveBetterItem(index, bagItem)
|
||
local ret = false
|
||
for k = 1, self.HoleCount do
|
||
local holeId = index * 100 + k
|
||
-- 判断当前孔是否激活
|
||
if self:GetHoleIsValid(holeId) then
|
||
local equipItem = self.EquipedXianPoDic[holeId]
|
||
-- 从未灵魄背包中获取等级比当前孔等级更高的灵魄
|
||
if bagItem ~= nil and bagItem.Typ ~= 2 then
|
||
-- 如果是属性灵魄
|
||
ret = self:CanReplace(bagItem, equipItem, index, holeId)
|
||
if ret then
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return ret
|
||
end
|
||
|
||
-- 判断是否有更好品质的灵魄
|
||
function XianPoSystem:HaveBetterQualityItem(index, bagItem)
|
||
local ret = false
|
||
for k = 1, self.HoleCount do
|
||
local holeId = index * 100 + k
|
||
-- 判断当前孔是否激活
|
||
if self:GetHoleIsValid(holeId) then
|
||
local equipItem = self.EquipedXianPoDic[holeId]
|
||
-- 从未灵魄背包中获取等级比当前孔等级更高的灵魄
|
||
if bagItem ~= nil and bagItem.Typ ~= 2 then
|
||
-- 如果是属性灵魄
|
||
if bagItem.Quality > equipItem.Quality then
|
||
-- 如果背包中的该仙魄等级更高 判断其他格子里面是否有相同属性的仙魄
|
||
local haveEqualAtt = false
|
||
local equipedKeys = self.EquipedXianPoDic:GetKeys()
|
||
for n = 1, self.HoleCount do
|
||
if n ~= k then
|
||
local otherEquiptItem = self.EquipedXianPoDic[equipedKeys[n]]
|
||
if otherEquiptItem ~= nil and otherEquiptItem.Type2 == bagItem.Type2 then
|
||
-- 如果属性相同 并且不是同一个孔
|
||
haveEqualAtt = true
|
||
end
|
||
end
|
||
end
|
||
if not haveEqualAtt then
|
||
-- 如果没有相同的属性 就可以替换
|
||
ret = true
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return ret
|
||
end
|
||
|
||
-- 获取灵魄镶嵌格子是否激活
|
||
function XianPoSystem:GetHoleIsValid(holeId)
|
||
local ret = false
|
||
local dic = self:GetHoleDataDic()
|
||
if dic ~= nil then
|
||
local data = dic[holeId]
|
||
if data ~= nil then
|
||
ret = self.JianLingGeLevel > data.ActiveLv
|
||
end
|
||
end
|
||
return ret
|
||
end
|
||
|
||
-- 获取总揽数据
|
||
function XianPoSystem:GetViewData()
|
||
if self.ViewDic:Count() == 0 then
|
||
DataConfig.DataImmortalSoulAttribute:Foreach(function(key, value)
|
||
if value.OverviewConditions ~= nil and value.OverviewConditions ~= "" then
|
||
local params = Utils.SplitNumber(value.OverviewConditions, "_")
|
||
local floor = params[1]
|
||
local row = params[2]
|
||
local col = params[3]
|
||
local subDic = self.ViewDic[floor]
|
||
if subDic ~= nil then
|
||
local list = subDic[row]
|
||
if list ~= nil then
|
||
list:Add(key)
|
||
else
|
||
list = List:New()
|
||
list:Add(key)
|
||
subDic:Add(row, list)
|
||
end
|
||
else
|
||
local list = List:New()
|
||
list:Add(key)
|
||
subDic = Dictionary:New()
|
||
subDic:Add(row, list)
|
||
self.ViewDic:Add(floor, subDic)
|
||
end
|
||
end
|
||
end)
|
||
end
|
||
return self.ViewDic
|
||
end
|
||
|
||
function XianPoSystem:GetAllItemDic()
|
||
local index = 0
|
||
local retDic = Dictionary:New()
|
||
local dic = self:GetViewData()
|
||
local keys = dic:GetKeys()
|
||
keys:Sort(function(a, b)
|
||
return a < b
|
||
end)
|
||
for i = 1, #keys do
|
||
if self.JianLingGeLevel > keys[i] then
|
||
local floorDic = dic[keys[i]]
|
||
if floorDic ~= nil then
|
||
local floorKeys = floorDic:GetKeys()
|
||
for m = 1, #floorKeys do
|
||
local list = floorDic[floorKeys[m]]
|
||
if list ~= nil then
|
||
retDic:Add(index, list)
|
||
index = index + 1
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return retDic
|
||
end
|
||
|
||
function XianPoSystem:AddBag(uId, data)
|
||
if data == nil then
|
||
return
|
||
end
|
||
local _soul = self.BagXianPoDic[uId]
|
||
if _soul == nil then
|
||
self.BagXianPoDic:Add(uId, data)
|
||
self.BagSoulCount = self.BagSoulCount + 1
|
||
else
|
||
self.BagXianPoDic[uId] = data
|
||
end
|
||
local _soulCount = self.SoulBagDic[data.CfgId]
|
||
if _soulCount == nil then
|
||
self.SoulBagDic[data.CfgId] = 1
|
||
else
|
||
self.SoulBagDic[data.CfgId] = _soulCount + 1
|
||
end
|
||
end
|
||
|
||
function XianPoSystem:RemoveBag(uId)
|
||
local _soul = self.BagXianPoDic[uId]
|
||
if _soul ~= nil then
|
||
self.BagXianPoDic:Remove(uId)
|
||
self.BagSoulCount = self.BagSoulCount - 1
|
||
local _soulCount = self.SoulBagDic[_soul.CfgId]
|
||
if _soulCount ~= nil and _soulCount > 0 then
|
||
self.SoulBagDic[_soul.CfgId] = _soulCount - 1
|
||
end
|
||
end
|
||
end
|
||
|
||
function XianPoSystem:GetAnalyseXianPo()
|
||
local _list = List:New()
|
||
if self.BagXianPoDic ~= nil then
|
||
local _keys = self.BagXianPoDic:GetKeys()
|
||
if _keys ~= nil then
|
||
for i = 1, #_keys do
|
||
local _xianPo = self.BagXianPoDic[_keys[i]]
|
||
if _xianPo.Quality >= 4 and _xianPo.Star >= 2 then
|
||
_list:Add(_xianPo)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return _list
|
||
end
|
||
|
||
function XianPoSystem:GetDecomposeXianPo()
|
||
local _list = List:New()
|
||
if self.BagXianPoDic ~= nil then
|
||
local _keys = self.BagXianPoDic:GetKeys()
|
||
if _keys ~= nil then
|
||
for i = 1, #_keys do
|
||
local _xianPo = self.BagXianPoDic[_keys[i]]
|
||
if _xianPo.Quality >= 4 and _xianPo.Star >= 2 then
|
||
else
|
||
_list:Add(_xianPo)
|
||
end
|
||
end
|
||
end
|
||
end
|
||
return _list
|
||
end
|
||
|
||
-- 心跳
|
||
function XianPoSystem:Update(dt)
|
||
local isShow = false
|
||
-- 每0.5秒检查一次是否有激活的剑灵
|
||
if self.CheckTime > 0 then
|
||
self.CheckTime = self.CheckTime - dt
|
||
else
|
||
self.CheckTime = 1
|
||
-- 检查灵魄镶嵌是否有红点
|
||
local isShow = self:GetValidJianLingStateList()
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.XianPoInlay, isShow)
|
||
end
|
||
|
||
if self.IsLingPoChange then
|
||
self.IsShowSynRedPoint = self:SetXianPoSyntheticRedPoint()
|
||
if self.preShowSynRedPoint ~= self.IsShowSynRedPoint then
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.XianPoSynthetic, self.IsShowSynRedPoint)
|
||
self.preShowSynRedPoint = self.IsShowSynRedPoint
|
||
end
|
||
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPO_EXCHANGE)
|
||
self:SetXianPoDecompositionRedPoint()
|
||
local isShow = self:GetValidJianLingStateList()
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.XianPoInlay, isShow)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_LINGPO_EXCHANGE)
|
||
self.IsLingPoChange = false
|
||
end
|
||
|
||
-- 检查分解
|
||
-- 检查对话
|
||
-- 检查合成
|
||
end
|
||
|
||
-- 上线初始化所有仙魂
|
||
function XianPoSystem:ResAllImmortalSoul(msg)
|
||
if msg.soulEquipmentList then
|
||
for i = 1, #msg.soulEquipmentList do
|
||
local _xianPoInfos = msg.soulEquipmentList[i]
|
||
local _data = XianPoData:New()
|
||
_data:SetAllData(_xianPoInfos)
|
||
if not self.EquipedXianPoDic:ContainsKey(_xianPoInfos.location) then
|
||
self.EquipedXianPoDic:Add(_xianPoInfos.location, _data)
|
||
end
|
||
end
|
||
end
|
||
if msg.soulBagList then
|
||
for i = 1, #msg.soulBagList do
|
||
local _xianPoInfos = msg.soulBagList[i]
|
||
local _data = XianPoData:New()
|
||
_data:SetAllData(_xianPoInfos)
|
||
if not self.BagXianPoDic:ContainsKey(_xianPoInfos.uid) then
|
||
self:AddBag(_xianPoInfos.uid, _data)
|
||
end
|
||
end
|
||
end
|
||
-- self:SetXianPoDecompositionRedPoint()
|
||
self:LingPoChange()
|
||
end
|
||
|
||
-- 请求镶嵌仙魄,location = 位置
|
||
function XianPoSystem:ReqInlaySoul(uid, location)
|
||
local _req = ReqMsg.MSG_ImmortalSoul.ReqInlaySoul:New()
|
||
_req.soulUID = uid
|
||
_req.location = location
|
||
_req:Send()
|
||
end
|
||
|
||
-- 镶嵌仙魂结果反馈
|
||
function XianPoSystem:ResInlaySoulReuslt(msg)
|
||
if msg.isSucceed then
|
||
local _inlayIndex = -1
|
||
for i = 1, #msg.soulInlayList do
|
||
local _xianPoInfos = msg.soulInlayList[i]
|
||
local _data = XianPoData:New()
|
||
_data:SetAllData(_xianPoInfos)
|
||
if _xianPoInfos.location ~= 0 then
|
||
_inlayIndex = _xianPoInfos.location
|
||
-- 如果不在背包(穿在身上的)
|
||
-- 先替换身上的仙魄
|
||
if self.EquipedXianPoDic:ContainsKey(_xianPoInfos.location) then
|
||
self.EquipedXianPoDic[_xianPoInfos.location] = _data
|
||
else
|
||
self.EquipedXianPoDic:Add(_xianPoInfos.location, _data)
|
||
end
|
||
-- 在删除背包内的仙魄
|
||
if self.BagXianPoDic:ContainsKey(_xianPoInfos.uid) then
|
||
self:RemoveBag(_xianPoInfos.uid)
|
||
end
|
||
else
|
||
-- 如果是背包里的,那就加到背包里去
|
||
if not self.BagXianPoDic:ContainsKey(_xianPoInfos.uid) then
|
||
self:AddBag(_xianPoInfos.uid, _data)
|
||
end
|
||
end
|
||
-- 发送背包中仙魄改变的消息
|
||
-- GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_XIANPO_BAG_ITEM_CHANGED, _xianPoInfos.CfgId)
|
||
end
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPOINFO_REFRESH, _inlayIndex)
|
||
Utils.ShowPromptByEnum("InlaySucced")
|
||
-- self:SortBagXianPoDic()
|
||
-- self:SetXianPoInlayRedPoint()
|
||
-- self:SetXianPoDecompositionRedPoint()
|
||
self:LingPoChange()
|
||
end
|
||
end
|
||
|
||
-- 请求分解仙魄
|
||
function XianPoSystem:ReqResolveSoul(uidList)
|
||
local _req = ReqMsg.MSG_ImmortalSoul.ReqResolveSoul:New()
|
||
_req.uids = uidList
|
||
_req:Send()
|
||
end
|
||
|
||
-- 分解仙魄返回
|
||
function XianPoSystem:ResResolveSoulReuslt(msg)
|
||
if msg.isSucceed then
|
||
for i = 1, #msg.uids do
|
||
local _data = self.BagXianPoDic[msg.uids[i]]
|
||
if _data ~= nil then
|
||
local _cfgId = _data.CfgId
|
||
self:RemoveBag(msg.uids[i])
|
||
-- GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_XIANPO_BAG_ITEM_CHANGED, _cfgId)
|
||
end
|
||
end
|
||
Utils.ShowPromptByEnum("ResolveSucceed")
|
||
-- self:SortBagXianPoDic()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPO_DECOMPOSITION)
|
||
-- self:SetXianPoInlayRedPoint()
|
||
-- self:SetXianPoDecompositionRedPoint()
|
||
self:LingPoChange()
|
||
end
|
||
end
|
||
|
||
-- 请求仙魄升级
|
||
function XianPoSystem:ReqUpSoul(location)
|
||
local _req = ReqMsg.MSG_ImmortalSoul.ReqUpSoul:New()
|
||
_req.location = location
|
||
_req:Send()
|
||
end
|
||
|
||
-- 仙魄升级返回
|
||
function XianPoSystem:ResUpSoulReuslt(msg)
|
||
if msg.isSucceed then
|
||
local _data = XianPoData:New()
|
||
_data:SetAllData(msg.soul)
|
||
if self.EquipedXianPoDic:ContainsKey(_data.Location) then
|
||
self.EquipedXianPoDic[_data.Location] = _data
|
||
end
|
||
Utils.ShowPromptByEnum("LevelUpSucceed")
|
||
-- self:SortBagXianPoDic()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPOINFO_REFRESH, _data.Location)
|
||
-- self:SetXianPoInlayRedPoint()
|
||
self:LingPoChange()
|
||
end
|
||
end
|
||
|
||
-- 请求兑换仙魄
|
||
function XianPoSystem:ReqExchangeSoul(cfgId, num)
|
||
local _req = ReqMsg.MSG_ImmortalSoul.ReqExchangeSoul:New()
|
||
_req.itemId = cfgId
|
||
_req.num = num
|
||
_req:Send()
|
||
end
|
||
|
||
-- 仙魄兑换返回
|
||
function XianPoSystem:ResExchangeSoulReuslt(msg)
|
||
if msg.isSucceed then
|
||
local _reason = msg.reason or 0
|
||
local _data = XianPoData:New()
|
||
_data:SetAllData(msg.soul)
|
||
if not self.BagXianPoDic:ContainsKey(_data.Uid) then
|
||
self:AddBag(_data.Uid, _data)
|
||
-- 增加灵魄获取效果
|
||
GameCenter.GetNewItemSystem:AddShowItem(_reason, nil, _data.CfgId, 1);
|
||
end
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPOINFO_REFRESH, 0)
|
||
self:LingPoChange()
|
||
end
|
||
end
|
||
|
||
-- 请求合成仙魄
|
||
function XianPoSystem:ReqCompoundSoul(cfgId)
|
||
self.ReqCompoundCfgId = cfgId
|
||
local _req = ReqMsg.MSG_ImmortalSoul.ReqCompoundSoul:New()
|
||
_req.itemId = cfgId
|
||
_req:Send()
|
||
end
|
||
|
||
-- 合成仙魄返回
|
||
function XianPoSystem:ResCompoundSoulReuslt(msg)
|
||
if msg.isSucceed then
|
||
local _data = XianPoData:New()
|
||
_data:SetAllData(msg.soul)
|
||
if not self.BagXianPoDic:ContainsKey(_data.Uid) then
|
||
self:AddBag(_data.Uid, _data)
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_XIANPO_BAG_ITEM_CHANGED, _data.CfgId)
|
||
end
|
||
for i = 1, #msg.deleteUid do
|
||
if self.BagXianPoDic:ContainsKey(msg.deleteUid[i]) then
|
||
local _cfgId = self.BagXianPoDic:Get(msg.deleteUid[i]).CfgId
|
||
self:RemoveBag(msg.deleteUid[i])
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_XIANPO_BAG_ITEM_CHANGED, _cfgId)
|
||
end
|
||
end
|
||
Utils.ShowPromptByEnum("CompoundSucceed", _data.Name)
|
||
self:SortBagXianPoDic()
|
||
-- self:SetXianPoDecompositionRedPoint()
|
||
-- GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPO_SYNTHETIC, _data.CfgId)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPO_SYNTHETIC, {
|
||
id = _data.CfgId,
|
||
success = true
|
||
})
|
||
-- self:SetXianPoInlayRedPoint()
|
||
else
|
||
for i = 1, #msg.deleteUid do
|
||
if self.BagXianPoDic:ContainsKey(msg.deleteUid[i]) then
|
||
local _cfgId = self.BagXianPoDic:Get(msg.deleteUid[i]).CfgId
|
||
self:RemoveBag(msg.deleteUid[i])
|
||
GameCenter.PushFixEvent(LogicEventDefine.EID_EVENT_XIANPO_BAG_ITEM_CHANGED, _cfgId)
|
||
end
|
||
end
|
||
self:SortBagXianPoDic()
|
||
-- self:SetXianPoDecompositionRedPoint()
|
||
-- GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPO_SYNTHETIC, self.ReqCompoundCfgId)
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPO_SYNTHETIC, {
|
||
id = self.ReqCompoundCfgId,
|
||
success = false
|
||
})
|
||
-- self:SetXianPoInlayRedPoint()
|
||
end
|
||
self:LingPoChange()
|
||
|
||
end
|
||
|
||
-- 请求脱下仙魄
|
||
function XianPoSystem:ReqGetOffSoul(location)
|
||
local _req = ReqMsg.MSG_ImmortalSoul.ReqGetOffSoul:New()
|
||
_req.location = location
|
||
_req:Send()
|
||
end
|
||
|
||
-- 脱下仙魄返回
|
||
function XianPoSystem:ResGetOffReuslt(msg)
|
||
end
|
||
|
||
-- =============红点函数=============--
|
||
-- 灵魄背包改变
|
||
function XianPoSystem:LingPoChange()
|
||
if not self.IsLingPoChange then
|
||
self.IsLingPoChange = true
|
||
end
|
||
end
|
||
-- 设置仙魄镶嵌的红点
|
||
function XianPoSystem:SetXianPoInlayRedPoint()
|
||
local _haveRedPoint = false
|
||
self.ListRedPointIds:Clear()
|
||
if self:IsCanInlayXianPo() or self:IsEquipXianPoCanUpgrade() then
|
||
_haveRedPoint = true
|
||
end
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.XianPoInlay, _haveRedPoint)
|
||
self:SetXianPoSyntheticRedPoint()
|
||
end
|
||
|
||
-- 设置仙魄合成的红点
|
||
function XianPoSystem:SetXianPoSyntheticRedPoint()
|
||
local _haveRedPoint = false
|
||
local _cache = Dictionary:New()
|
||
local _synKeys = self.XianPoSyntheticDic:GetKeys()
|
||
for m = 1, #_synKeys do
|
||
local _value = self.XianPoSyntheticDic[_synKeys[m]]
|
||
local _needList = _value.NeedXianPoIdCountList
|
||
local _isShow = true
|
||
for i = 1, #_needList do
|
||
local _cfgId = _needList[i].Id
|
||
local _haveCount = 0
|
||
local _needNum = _needList[i].NeedNum
|
||
local _cacheData = _cache[_needList[i].Id]
|
||
if _cacheData == nil then
|
||
_cacheData = {Id = _cfgId, Left = self:GetXianPoCountByCfgId(_cfgId)}
|
||
_cache:Add(_cfgId, _cacheData)
|
||
end
|
||
_haveCount = _cacheData.Left
|
||
if _haveCount < _needNum then
|
||
_isShow = false
|
||
break
|
||
end
|
||
_cacheData.Left = _haveCount > _needNum and _haveCount - _needNum or 0
|
||
end
|
||
if _isShow then
|
||
local _itemCount = GameCenter.ItemContianerSystem:GetItemCountFromCfgId(_value.NeedItemId)
|
||
if _itemCount < _value.NeedItemNum then
|
||
_isShow = false
|
||
end
|
||
if self.JianLingGeLevel <= _value.Limit then
|
||
_isShow = false
|
||
end
|
||
end
|
||
if _isShow then
|
||
_haveRedPoint = true
|
||
break
|
||
end
|
||
end
|
||
return _haveRedPoint
|
||
end
|
||
|
||
function XianPoSystem:GetSyntheticRedPointList()
|
||
local list = List:New()
|
||
local _cache = Dictionary:New()
|
||
local _haveRedPoint = false
|
||
self.XianPoSyntheticDic:ForeachCanBreak(function(_, _value)
|
||
local id = _
|
||
local _needList = _value.NeedXianPoIdCountList
|
||
local isShow = true
|
||
for i = 1, #_needList do
|
||
local _haveCount = 0
|
||
local _cacheData = _cache[_needList[i].Id]
|
||
if _cacheData == nil then
|
||
_cacheData = {Id = _needList[i].Id, Left = self:GetXianPoCountByCfgId(_needList[i].Id)}
|
||
_cache:Add(_needList[i].Id, _cacheData)
|
||
end
|
||
_haveCount = _cacheData.Left
|
||
if _haveCount < _needList[i].NeedNum then
|
||
isShow = false
|
||
end
|
||
_cacheData.Left = _haveCount > _needList[i].NeedNum and _haveCount - _needList[i].NeedNum or 0
|
||
end
|
||
local _haveCount = GameCenter.ItemContianerSystem:GetItemCountFromCfgId(_value.NeedItemId)
|
||
if _haveCount < _value.NeedItemNum then
|
||
isShow = false
|
||
end
|
||
if self.JianLingGeLevel <= _value.Limit then
|
||
isShow = false
|
||
end
|
||
if isShow then
|
||
_haveRedPoint = true
|
||
list:Add(id)
|
||
end
|
||
end)
|
||
return list
|
||
end
|
||
|
||
-- 判定所有位置是否为空,并有可镶嵌仙魄
|
||
function XianPoSystem:IsCanInlayXianPo()
|
||
local _ret = false
|
||
for i = 1, self.XianPoMaxInlayIndex do
|
||
if self:IsIndexEmptyCanInlay(i) then
|
||
_ret = true
|
||
break
|
||
end
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
-- 判定一个位置是否为空,并且背包内有对应仙魄可镶嵌
|
||
function XianPoSystem:IsIndexEmptyCanInlay(index)
|
||
local _canInlay = false
|
||
if self:IsIndexUnlock(index) then
|
||
-- 该位置已解锁
|
||
if self:GetXianPoDataByIndex(index) == nil then
|
||
-- 该位置没有镶嵌仙魄,遍历背包内的仙魄
|
||
self.BagXianPoDic:ForeachCanBreak(function(key, value)
|
||
if value.CanInlayLocationList:Contains(index) then
|
||
-- 如果这个仙魄可以镶嵌到这个格子
|
||
_canInlay = true
|
||
return true
|
||
end
|
||
end)
|
||
end
|
||
end
|
||
return _canInlay
|
||
end
|
||
|
||
-- 判定所有位置的仙魄是否可升级
|
||
function XianPoSystem:IsEquipXianPoCanUpgrade()
|
||
local _ret = false
|
||
for i = 1, self.XianPoMaxInlayIndex do
|
||
if self:IsIndexXianPoCanUpgrade(i) then
|
||
_ret = true
|
||
break
|
||
end
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
-- 判定一个位置的仙魄是否可升级
|
||
function XianPoSystem:IsIndexXianPoCanUpgrade(index)
|
||
local _canUpgrade = false
|
||
local _data = self:GetXianPoDataByIndex(index)
|
||
if _data then
|
||
local _nextLvNeedExp = self:GetNextLvNeedExp(_data.Quality, _data.Level)
|
||
local _myExp = GameCenter.ItemContianerSystem:GetEconomyWithType(ItemTypeCode.LingPoJc)
|
||
if _myExp >= _nextLvNeedExp and _data.Level < _data.MaxLevel then
|
||
_canUpgrade = true
|
||
self.ListRedPointIds:Add(_data.CfgId)
|
||
end
|
||
end
|
||
return _canUpgrade
|
||
end
|
||
|
||
-- 设置仙魄分解的红点
|
||
function XianPoSystem:SetXianPoDecompositionRedPoint()
|
||
local _haveRedPoint = false
|
||
self.BagXianPoDic:ForeachCanBreak(function(key, value)
|
||
if value.Typ == 2 then
|
||
-- 是经验仙魄
|
||
_haveRedPoint = true
|
||
return true
|
||
else
|
||
-- 不是经验仙魄,判断是不是蓝色
|
||
if value.Quality == XianPoQuality.Blue then
|
||
_haveRedPoint = true
|
||
return true
|
||
end
|
||
end
|
||
end)
|
||
GameCenter.MainFunctionSystem:SetAlertFlag(FunctionStartIdCode.XianPoDecomposition, _haveRedPoint)
|
||
end
|
||
|
||
-- =============接口函数=============--
|
||
-- 根据位置获取 该位置是否已镶嵌仙魄
|
||
-- function XianPoSystem:IsHaveXianPoByIndex(index)
|
||
-- local _ret = false
|
||
-- if self.EquipedXianPoDic:ContainsKey(index) then
|
||
-- if self.EquipedXianPoDic[index].Uid > 0 then
|
||
-- _ret = true
|
||
-- end
|
||
-- end
|
||
-- return _ret
|
||
-- end
|
||
|
||
-- 判断该位置是否已解锁
|
||
function XianPoSystem:IsIndexUnlock(index)
|
||
local _unLockCfg = DataConfig.DataImmortalSoulIattice[index]
|
||
if _unLockCfg then
|
||
local _variableSystem = GameCenter.VariableSystem
|
||
local _unLockCondition = Utils.SplitNumber(_unLockCfg.Condition, "_")
|
||
return _variableSystem.IsVariableReach(_unLockCondition[1], _unLockCondition[2])
|
||
end
|
||
return false
|
||
end
|
||
|
||
-- 根据位置获取该位置的仙魄
|
||
function XianPoSystem:GetXianPoDataByIndex(index)
|
||
local _ret = nil
|
||
if self.EquipedXianPoDic:ContainsKey(index) then
|
||
_ret = self.EquipedXianPoDic[index]
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
-- 根据uid获取背包内的某个仙魄
|
||
function XianPoSystem:GetBagXianPoDataByUID(uid)
|
||
local _ret = nil
|
||
if self.BagXianPoDic:ContainsKey(uid) then
|
||
_ret = self.BagXianPoDic[uid]
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
-- 根据配置表id,获取背包内有多少个这个id的仙魄
|
||
function XianPoSystem:GetXianPoCountByCfgId(cfgId)
|
||
local _count = self.SoulBagDic[cfgId]
|
||
if _count == nil then
|
||
_count = 0
|
||
end
|
||
return _count
|
||
end
|
||
|
||
-- 根据配置表id,判定当前身上是否已有相同属性的仙魄
|
||
-- prams:cfgId 背包中的仙魄配置表ID
|
||
function XianPoSystem:IsHaveSameAttrXianPo(cfgId, selectIndex)
|
||
if selectIndex == nil then
|
||
return false
|
||
end
|
||
local _have = false
|
||
-- 根据配置表Type2再加一个判断,用于仙魄互斥的判定,type2相等那么就是同一类型的仙魄,不能穿戴
|
||
local _cfg = DataConfig.DataImmortalSoulAttribute
|
||
-- 经验仙魄
|
||
local _curType1 = 1
|
||
-- 道具仙魄
|
||
local _curType2 = 0
|
||
if _cfg:IsContainKey(cfgId) then
|
||
_curType1 = _cfg[cfgId].Type
|
||
_curType2 = _cfg[cfgId].Type2
|
||
end
|
||
local _selectedData = self:GetXianPoDataByIndex(selectIndex)
|
||
-- 装备了的仙魄
|
||
self.EquipedXianPoDic:ForeachCanBreak(function(key, value)
|
||
-- 1. 有互斥ID,不能装备
|
||
if value.MutexIdList:Contains(cfgId) then
|
||
_have = true
|
||
return true
|
||
end
|
||
-- 3. 未镶嵌格子的点击,单独处理两个特殊位置,不是9和10的只要背包里面没有就不能点击
|
||
if _selectedData == nil then
|
||
if selectIndex == 9 and _curType2 ~= 9 then
|
||
_have = true
|
||
return true
|
||
elseif selectIndex == 10 and _curType2 ~= 10 then
|
||
_have = true
|
||
return true
|
||
end
|
||
-- 镶嵌的时候判断下是否是特殊仙魄
|
||
if selectIndex < 9 and _curType2 >= 9 then
|
||
_have = true
|
||
return true
|
||
end
|
||
if value.Type2 == _curType2 then
|
||
_have = true
|
||
return true
|
||
end
|
||
else
|
||
-- 4. 选中的需要替换的这个和背包中的对比
|
||
if _selectedData.Type2 == _curType2 then
|
||
-- 没有属性更高的了
|
||
if not self:CheckChangeBtnRedPoint(cfgId) then
|
||
_have = true
|
||
return true
|
||
end
|
||
-- 5. 中间两个特殊的类型单独判断下
|
||
elseif _selectedData.Type2 == 9 or _selectedData.Type2 == 10 and value.Type2 < _selectedData.Type2 then
|
||
_have = true
|
||
return true
|
||
-- 6. 替换的时候判断下是否是特殊的仙魄
|
||
elseif selectIndex < 9 and _curType2 >= 9 then
|
||
_have = true
|
||
return true
|
||
-- 已装备的这个和背包中有相同类型的仙魄
|
||
elseif value.Type2 == _curType2 then
|
||
_have = true
|
||
return true
|
||
end
|
||
end
|
||
end)
|
||
-- 7. 经验仙魄不能被装备
|
||
if _curType1 > 1 then
|
||
_have = true
|
||
end
|
||
-- 8. 什么都还没装备,判断下特定的
|
||
if _selectedData == nil then
|
||
if selectIndex == 9 and _curType2 ~= 9 then
|
||
_have = true
|
||
elseif selectIndex == 10 and _curType2 ~= 10 then
|
||
_have = true
|
||
end
|
||
-- 镶嵌的时候判断下是否是特殊仙魄
|
||
if selectIndex < 9 and _curType2 >= 9 then
|
||
_have = true
|
||
return true
|
||
end
|
||
end
|
||
return _have
|
||
end
|
||
|
||
-- 替换按钮的红点
|
||
function XianPoSystem:CheckChangeBtnRedPoint(cfgId)
|
||
local _cfg = DataConfig.DataImmortalSoulAttribute
|
||
local _curCfg = nil
|
||
if _cfg:IsContainKey(cfgId) then
|
||
_curCfg = _cfg[cfgId]
|
||
end
|
||
local _haveRedPoint = false
|
||
local _totalAttr = 0
|
||
local _curTotalAttr = 0
|
||
self.BagXianPoDic:ForeachCanBreak(function(key, _bagValue)
|
||
-- 相同类型的仙魄对比属性看是否可以替换
|
||
if _bagValue.Type2 == _curCfg.Type2 then
|
||
_bagValue.TotalAddAttrDic:Foreach(function(_id, _attr)
|
||
_totalAttr = _totalAttr + _attr
|
||
end)
|
||
local _cfgId = _curCfg.Id
|
||
self.EquipedXianPoDic:ForeachCanBreak(function(key, _equipedValue)
|
||
if _equipedValue.CfgId == _curCfg.Id then
|
||
_equipedValue.TotalAddAttrDic:ForeachCanBreak(
|
||
function(_id, _attr)
|
||
_curTotalAttr = _curTotalAttr + _attr
|
||
-- return true
|
||
end)
|
||
return true
|
||
end
|
||
end)
|
||
if _totalAttr > _curTotalAttr then
|
||
_haveRedPoint = true
|
||
return true
|
||
end
|
||
end
|
||
end)
|
||
return _haveRedPoint
|
||
end
|
||
|
||
-- 未镶嵌的卡槽红点处理
|
||
function XianPoSystem:CheckUnEquipXianPoRedPoint()
|
||
local _count = 0
|
||
-- 装备了的仙魄
|
||
local _equipDict = GameCenter.XianPoSystem.EquipedXianPoDic
|
||
-- 背包里面的仙魄
|
||
local _bagDict = GameCenter.XianPoSystem.BagXianPoDic
|
||
local _typeList = List:New()
|
||
-- 装备仙魄的所有type
|
||
_equipDict:Foreach(function(_key, _value)
|
||
if not _typeList:Contains(_value.Type2) then
|
||
_typeList:Add(_value.Type2)
|
||
end
|
||
end)
|
||
_bagDict:ForeachCanBreak(function(_key, _value)
|
||
-- 非已装备的仙魄并且非经验仙魄
|
||
if not _typeList:Contains(_value.Type2) and _value.Typ ~= 2 then
|
||
_count = _count + 1
|
||
end
|
||
end)
|
||
return _count
|
||
end
|
||
|
||
-- 获取预览界面的条件名称
|
||
function XianPoSystem:GetOverviewFormConditionName(value)
|
||
if value == 0 then
|
||
return DataConfig.DataMessageString.Get("UnlockDefault")
|
||
else
|
||
local _text = GameCenter.VariableSystem.GetVariableShowText(self.GetXianPoConditionType, value)
|
||
return UIUtils.CSFormat(DataConfig.DataMessageString.Get("UnlockByThroughPass"), _text)
|
||
end
|
||
end
|
||
|
||
-- 根据品质、等级,获取升到下一级所需经验
|
||
function XianPoSystem:GetNextLvNeedExp(quality, level)
|
||
local _ret = 0
|
||
local _cfg = DataConfig.DataImmortalSoulExp[level]
|
||
if _cfg then
|
||
if quality == XianPoQuality.Blue then
|
||
-- 蓝色
|
||
local _exp = Utils.SplitNumber(_cfg.BlueExp, "_")
|
||
_ret = _exp[1]
|
||
elseif quality == XianPoQuality.Purple then
|
||
-- 紫色
|
||
local _exp = Utils.SplitNumber(_cfg.VioletExp, "_")
|
||
_ret = _exp[1]
|
||
elseif quality == XianPoQuality.Gold then
|
||
-- 金色
|
||
local _exp = Utils.SplitNumber(_cfg.GoldenExp, "_")
|
||
_ret = _exp[1]
|
||
elseif quality == XianPoQuality.Red then
|
||
-- 红色
|
||
local _exp = Utils.SplitNumber(_cfg.GulesExp, "_")
|
||
_ret = _exp[1]
|
||
end
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
-- 根据品质、等级,获取当前等级总经验
|
||
function XianPoSystem:GetCurLvTotalExp(quality, level)
|
||
local _ret = 0
|
||
local _cfg = DataConfig.DataImmortalSoulExp[level]
|
||
if _cfg then
|
||
if quality == XianPoQuality.Blue then
|
||
-- 蓝色
|
||
local _exp = Utils.SplitNumber(_cfg.BlueExp, "_")
|
||
_ret = _exp[2]
|
||
elseif quality == XianPoQuality.Purple then
|
||
-- 紫色
|
||
local _exp = Utils.SplitNumber(_cfg.VioletExp, "_")
|
||
_ret = _exp[2]
|
||
elseif quality == XianPoQuality.Gold then
|
||
-- 金色
|
||
local _exp = Utils.SplitNumber(_cfg.GoldenExp, "_")
|
||
_ret = _exp[2]
|
||
elseif quality == XianPoQuality.Red then
|
||
-- 红色
|
||
local _exp = Utils.SplitNumber(_cfg.GulesExp, "_")
|
||
_ret = _exp[2]
|
||
end
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
-- 根据类型获取该种类型仙魄的类型名,1:属性仙魄,2:经验仙魄
|
||
function XianPoSystem:GetXianPoTypeName(typ)
|
||
if typ == 1 then
|
||
return "PropertyXianPo"
|
||
elseif typ == 2 then
|
||
return "PropertyExp"
|
||
else
|
||
return "PropertyXianPo"
|
||
end
|
||
end
|
||
|
||
-- =============功能函数=============--
|
||
-- 对背包里的仙魄排序
|
||
function XianPoSystem:SortBagXianPoDic()
|
||
self.BagXianPoDic:SortValue(function(a, b)
|
||
if a.Quality == b.Quality then
|
||
if a.Level == b.Level then
|
||
return a.CfgId < b.CfgId
|
||
else
|
||
return a.Level > b.Level
|
||
end
|
||
else
|
||
return a.Quality > b.Quality
|
||
end
|
||
end)
|
||
end
|
||
|
||
-- 设置仙魄的图标
|
||
function XianPoSystem:SetXianPoIcons(trans, cfgId)
|
||
-- 后面可能会增加背景品质框
|
||
local _cfg = DataConfig.DataImmortalSoulAttribute[cfgId]
|
||
local _uiIcon = UIUtils.RequireUIIconBase(trans)
|
||
local _qualitySpr = UIUtils.FindSpr(trans, "Quality")
|
||
if _uiIcon and _cfg then
|
||
_uiIcon:UpdateIcon(_cfg.Icon)
|
||
_qualitySpr.spriteName = Utils.GetQualitySpriteName(tonumber(_cfg.Quality))
|
||
end
|
||
end
|
||
|
||
-- 设置仙魄的tips
|
||
function XianPoSystem:SetXianPoTips(trans, cfgId)
|
||
local _tipsRoot = UIUtils.FindTrans(trans, "Tips")
|
||
local _iconTrs = UIUtils.FindTrans(_tipsRoot, "Icon")
|
||
self:SetXianPoIcons(_iconTrs, cfgId)
|
||
local _cfg = DataConfig.DataImmortalSoulAttribute[cfgId]
|
||
if _cfg then
|
||
-- 名字
|
||
local _nameLab = UIUtils.FindLabel(_tipsRoot, "Name")
|
||
UIUtils.SetTextByStringDefinesID(_nameLab, _cfg._Name)
|
||
-- 等级
|
||
-- local _levelLab = UIUtils.FindLabel(_tipsRoot, "Level")
|
||
-- 类型
|
||
local _typeLab = UIUtils.FindLabel(_tipsRoot, "Type")
|
||
UIUtils.SetTextByEnum(_typeLab, self:GetXianPoTypeName(_cfg.Type))
|
||
-- 属性
|
||
local _attrCloneGo = UIUtils.FindGo(_tipsRoot, "AttrClone")
|
||
local _attrCloneRoot = UIUtils.FindTrans(_tipsRoot, "AttrCloneGrid")
|
||
local _attrCloneRootGrid = UIUtils.FindGrid(_tipsRoot, "AttrCloneGrid")
|
||
-- 先隐藏所有属性
|
||
for i = 0, _attrCloneRoot.childCount - 1 do
|
||
_attrCloneRoot:GetChild(i).gameObject:SetActive(false)
|
||
end
|
||
if _cfg.DemandValue and _cfg.DemandValue ~= "" then
|
||
local _attrList = Utils.SplitStrByTableS(_cfg.DemandValue)
|
||
for i = 1, #_attrList do
|
||
local _go
|
||
if i - 1 < _attrCloneRoot.childCount then
|
||
_go = _attrCloneRoot:GetChild(i - 1).gameObject
|
||
else
|
||
_go = UnityUtils.Clone(_attrCloneGo, _attrCloneRoot)
|
||
end
|
||
local _label = UIUtils.FindLabel(_go.transform)
|
||
UIUtils.SetTextByPropNameAndValue(_label, _attrList[i][1], _attrList[i][2])
|
||
_go:SetActive(true)
|
||
end
|
||
end
|
||
_attrCloneRootGrid.repositionNow = true
|
||
-- 获得方式
|
||
local _getMethodLab = UIUtils.FindLabel(_tipsRoot, "GetMethod")
|
||
UIUtils.SetTextByString(_getMethodLab, self:GetOverviewFormConditionName(_cfg.OverviewConditions))
|
||
end
|
||
end
|
||
|
||
function XianPoSystem:GetCoreDic()
|
||
if self.DicJianCore == nil then
|
||
self.DicJianCore = Dictionary:New()
|
||
DataConfig.DataImmortalSoulCore:Foreach(function(k, v)
|
||
local _data = L_JianCore:New()
|
||
_data.JianId = k
|
||
self.DicJianCore:Add(k,_data)
|
||
end)
|
||
end
|
||
return self.DicJianCore
|
||
end
|
||
|
||
function XianPoSystem:GetJianCoreData(index)
|
||
local _ret = nil
|
||
local _dic = self:GetCoreDic()
|
||
if _dic ~= nil then
|
||
_ret = _dic[index]
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
function XianPoSystem:GetJianValid(index)
|
||
local _ret = false
|
||
local _jianCore = nil
|
||
local _dic = self:GetCoreDic()
|
||
if _dic ~= nil then
|
||
_jianCore = _dic[index]
|
||
if _jianCore ~= nil then
|
||
_ret = _jianCore:GetJianValid()
|
||
end
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
function XianPoSystem:GetJianName(index)
|
||
local _ret = ""
|
||
for i = 1, #self.JianLingList do
|
||
if index == i then
|
||
_ret = self.JianLingList[i]
|
||
break
|
||
end
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
--获取所有装备仙魄的等级
|
||
function XianPoSystem:GetAllEquipLv(index)
|
||
local _ret = 0
|
||
local _keys = self.EquipedXianPoDic:GetKeys()
|
||
for i = 1, #_keys do
|
||
local _key = _keys[i]
|
||
if math.floor( _key / 100 ) == index then
|
||
local _data = self.EquipedXianPoDic[_key]
|
||
if _data ~= nil then
|
||
_ret = _ret + _data.Level
|
||
end
|
||
end
|
||
end
|
||
return _ret
|
||
end
|
||
|
||
--获取激活条件
|
||
function XianPoSystem:GetJianActiveDes(index)
|
||
local _ret = ""
|
||
local _lv = 0
|
||
local _jianName = ""
|
||
local _preJianName = ""
|
||
local _coreName = ""
|
||
local _cfg = DataConfig.DataGlobal[GlobalName.immortal_soul_core_limit]
|
||
if _cfg ~= nil then
|
||
local _list = Utils.SplitStr(_cfg.Params, ';')
|
||
if _list ~= nil then
|
||
for i = 1, #_list do
|
||
local _values = Utils.SplitNumber(_list[i], '_')
|
||
if _values ~= nil then
|
||
if _values[1] == index then
|
||
_lv = _values[2]
|
||
break
|
||
end
|
||
end
|
||
end
|
||
end
|
||
end
|
||
local _nameList = self:GetNameList()
|
||
if _nameList ~= nil then
|
||
if index <= #_nameList then
|
||
_jianName = _nameList[index]
|
||
end
|
||
if index - 1 > 0 and index - 1 <= #_nameList then
|
||
_preJianName = _nameList[index - 1]
|
||
end
|
||
end
|
||
local _preCfg = DataConfig.DataImmortalSoulCore[index - 1]
|
||
if _preCfg ~= nil then
|
||
_coreName = _preCfg.Name
|
||
end
|
||
_ret = UIUtils.CSFormat(DataConfig.DataMessageString.Get("LING_PO_CORE_open_next"), _coreName, _lv, _jianName)
|
||
return _ret
|
||
end
|
||
|
||
function XianPoSystem:ResSoulCore(msg)
|
||
if msg == nil then
|
||
return
|
||
end
|
||
local _dic = self:GetCoreDic()
|
||
if _dic ~= nil then
|
||
if msg.info ~= nil then
|
||
for i = 1, #msg.info do
|
||
local _data = _dic[i]
|
||
_data.JianId = i
|
||
_data.CoreId = msg.info[i].core
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
function XianPoSystem:ResSoulCoreUpdate(msg)
|
||
if msg == nil then
|
||
return
|
||
end
|
||
local _dic = self:GetCoreDic()
|
||
if _dic == nil then
|
||
return
|
||
end
|
||
local _data = _dic[msg.info.type]
|
||
if _data ~= nil then
|
||
_data.CoreId = msg.info.core
|
||
end
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_LINGPO_CORE_LV_RESULT)
|
||
end
|
||
|
||
function XianPoSystem:ReqDismountingSoul(id)
|
||
GameCenter.Network.Send("MSG_ImmortalSoul.ReqDismountingSoul", {
|
||
uid = id
|
||
})
|
||
end
|
||
|
||
function XianPoSystem:ResDismountingSoulReuslt(msg)
|
||
if msg == nil then
|
||
return
|
||
end
|
||
if msg.isSucceed then
|
||
self:RemoveBag(msg.uid)
|
||
end
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_XIANPO_DECOMPOSITION)
|
||
end
|
||
|
||
return XianPoSystem
|