2023-03-24 11:08:03 +08:00
|
|
|
|
GodWeaponManager = {};
|
|
|
|
|
local this = GodWeaponManager
|
2023-03-28 13:57:59 +08:00
|
|
|
|
local shenBingConfig=ConfigManager.GetConfig(ConfigName.ShenBing)
|
|
|
|
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local allGodWeapons={}
|
|
|
|
|
local godWeaponTeamInfo={}
|
|
|
|
|
local handBook={}
|
2023-03-24 11:08:03 +08:00
|
|
|
|
|
|
|
|
|
function this.Initialize()
|
2023-03-28 13:57:59 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.InitAllGodWeaponData(msg)
|
|
|
|
|
|
|
|
|
|
LogError("#msg.infos============"..#msg.infos)
|
|
|
|
|
for i = 1, #msg.infos do
|
|
|
|
|
local GodWeapon={}
|
|
|
|
|
GodWeapon.Did=msg.infos[i].id
|
|
|
|
|
local staticId=msg.infos[i].tmpId
|
|
|
|
|
GodWeapon.id=staticId
|
|
|
|
|
GodWeapon.staticId=staticId
|
|
|
|
|
GodWeapon.dynamicId=msg.infos[i].id
|
|
|
|
|
GodWeapon.lv=msg.infos[i].level
|
|
|
|
|
GodWeapon.star=msg.infos[i].star
|
|
|
|
|
local pos=msg.infos[i].point
|
|
|
|
|
GodWeapon.point=pos
|
|
|
|
|
GodWeapon.live=shenBingConfig[staticId].Painting
|
|
|
|
|
GodWeapon.scale=shenBingConfig[staticId].Scale
|
|
|
|
|
GodWeapon.position=shenBingConfig[staticId].Position
|
|
|
|
|
GodWeapon.config=shenBingConfig[staticId]
|
|
|
|
|
allGodWeapons[GodWeapon.Did]=GodWeapon
|
|
|
|
|
if pos~=0 then
|
|
|
|
|
LogError("pos============================="..pos)
|
|
|
|
|
godWeaponTeamInfo[pos]=GodWeapon
|
|
|
|
|
end
|
|
|
|
|
LogError("static=="..staticId)
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #msg.book do
|
|
|
|
|
LogError("msg.book[i]====="..msg.book[i])
|
|
|
|
|
handBook[msg.book[i]]=msg.book[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
function this.GetAllWeapon()
|
|
|
|
|
return allGodWeapons
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetAllTeamWeapon()
|
|
|
|
|
return godWeaponTeamInfo
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetAllTeamWeaponId()
|
|
|
|
|
local list={}
|
|
|
|
|
for key, value in pairs(godWeaponTeamInfo) do
|
|
|
|
|
table.insert(list,value.staticId)
|
|
|
|
|
end
|
|
|
|
|
return list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.InitSingleGodWeaponData(data)
|
|
|
|
|
local GodWeapon={}
|
|
|
|
|
local GodWeapon={}
|
|
|
|
|
GodWeapon.Did=data.id
|
|
|
|
|
local staticId=data.tmpId
|
|
|
|
|
GodWeapon.id=staticId
|
|
|
|
|
GodWeapon.staticId=staticId
|
|
|
|
|
GodWeapon.dynamicId=data.id
|
|
|
|
|
GodWeapon.lv=data.level
|
|
|
|
|
GodWeapon.star=data.star
|
|
|
|
|
local pos=data.point
|
|
|
|
|
GodWeapon.point=pos
|
|
|
|
|
GodWeapon.live=shenBingConfig[staticId].Painting
|
|
|
|
|
GodWeapon.scale=shenBingConfig[staticId].Scale
|
|
|
|
|
GodWeapon.position=shenBingConfig[staticId].Position
|
|
|
|
|
GodWeapon.config=shenBingConfig[staticId]
|
|
|
|
|
allGodWeapons[GodWeapon.Did]=GodWeapon
|
|
|
|
|
handBook[staticId]=staticId
|
|
|
|
|
LogError("single static=="..staticId)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetSingleWeaponData(_id)
|
|
|
|
|
if allGodWeapons[_id] then
|
|
|
|
|
return allGodWeapons[_id]
|
|
|
|
|
end
|
|
|
|
|
return nil
|
|
|
|
|
end
|
|
|
|
|
|
2023-03-24 11:08:03 +08:00
|
|
|
|
|
|
|
|
|
|
2023-03-28 13:57:59 +08:00
|
|
|
|
--获取当前可上阵的所有灵兽数据 curUpZhenPokemonData 如果不为空就时替换上阵操作
|
|
|
|
|
function this.GetCanUpZhenWeapons()
|
|
|
|
|
local upZhenSidList = this.GetAllTeamWeaponId()
|
|
|
|
|
local curAllPokemonList = {}
|
|
|
|
|
for key, value in pairs(allGodWeapons) do
|
|
|
|
|
if not CheckListIsContainValue1(upZhenSidList,value.staticId) then
|
|
|
|
|
table.insert(curAllPokemonList,value)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return curAllPokemonList
|
2023-03-24 11:08:03 +08:00
|
|
|
|
end
|
|
|
|
|
|
2023-03-28 13:57:59 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--碎片可以合成红点
|
|
|
|
|
function this.WeaponChipCompoundRedPoint()
|
|
|
|
|
local isOpen = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.POKEMON)
|
|
|
|
|
if not isOpen then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
local pokemonChipList = BagManager.GetDataByItemType(ItemType.GodWeaponChip)
|
|
|
|
|
if #pokemonChipList > 0 then
|
|
|
|
|
for i = 1, #pokemonChipList do
|
|
|
|
|
if BagManager.GetItemCountById(pokemonChipList[i].id) >= itemConfig[pokemonChipList[i].id].UsePerCount then
|
|
|
|
|
-- LogPink("碎片可以合成红点true")
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- LogPink("碎片可以合成红点false")
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置神兵上阵下阵
|
|
|
|
|
function this.SetWeaponUpZhen(id,pos)
|
|
|
|
|
if allGodWeapons[id] then
|
|
|
|
|
if pos~=0 then
|
2023-03-28 17:51:43 +08:00
|
|
|
|
local point1=allGodWeapons[id].point
|
|
|
|
|
if point1~=0 then
|
|
|
|
|
godWeaponTeamInfo[point1]=nil
|
|
|
|
|
end
|
2023-03-28 13:57:59 +08:00
|
|
|
|
allGodWeapons[id].point=pos
|
|
|
|
|
godWeaponTeamInfo[pos]=allGodWeapons[id]
|
|
|
|
|
else
|
|
|
|
|
allGodWeapons[id].point=pos
|
2023-03-28 17:51:43 +08:00
|
|
|
|
godWeaponTeamInfo[pos]=nil
|
2023-03-28 13:57:59 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2023-03-28 17:51:43 +08:00
|
|
|
|
--改变神兵位置
|
|
|
|
|
function this.ChangeWeaponPos(id1,id2)
|
|
|
|
|
if allGodWeapons[id1] and allGodWeapons[id2] then
|
|
|
|
|
local pos1=allGodWeapons[id1].point
|
|
|
|
|
local pos2=allGodWeapons[id2].point
|
|
|
|
|
allGodWeapons[id1].point=pos2
|
|
|
|
|
allGodWeapons[id2].point=pos1
|
|
|
|
|
godWeaponTeamInfo[pos1]=allGodWeapons[id2]
|
|
|
|
|
godWeaponTeamInfo[pos2]=allGodWeapons[id1]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2023-03-28 13:57:59 +08:00
|
|
|
|
|
|
|
|
|
--获取灵兽编队属性
|
|
|
|
|
function this.GetPokemonFormationAddPro()
|
|
|
|
|
local allPro = {}
|
|
|
|
|
for key, value in pairs(godWeaponTeamInfo) do
|
|
|
|
|
if key and allGodWeapons[value.Did] then
|
|
|
|
|
local curPokemonAddPro = this.GetSinglePokemonAddProData(value.Did)
|
|
|
|
|
HeroManager.DoubleTableCompound(allPro, curPokemonAddPro)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return allPro
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--获取单个神兵属性 (灵兽属性/编队人数 神兵属性会平分给上阵的所有神将)
|
|
|
|
|
function this.GetSinglePokemonAddProData(_did,_star)--_star 传值的话就用此星级计算属性
|
|
|
|
|
-- LogPink("_did 1 ".._did)
|
|
|
|
|
if not allGodWeapons[_did] then return end
|
|
|
|
|
-- LogPink("_did 2 ".._did)
|
|
|
|
|
local addAllProVal = {}
|
|
|
|
|
local curPokeonData = allGodWeapons[_did]
|
|
|
|
|
local curPokemonConFig = ConfigManager.GetConfigData(ConfigName.ShenBing,curPokeonData.id)
|
|
|
|
|
local curPokemonLvConFig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.ShenBingLevel,"Quality",curPokemonConFig.Quality,"Level",curPokeonData.lv)
|
|
|
|
|
local curPokemonStarConFig = ConfigManager.GetConfigDataByDoubleKey(ConfigName.ShenbingStar,"Quality",curPokemonConFig.Quality,"Star",_star and _star or curPokeonData.star)
|
|
|
|
|
--基础
|
|
|
|
|
addAllProVal[HeroProType.Hp] = curPokemonConFig.Hp
|
|
|
|
|
addAllProVal[HeroProType.Attack] = curPokemonConFig.Attack
|
|
|
|
|
addAllProVal[HeroProType.PhysicalDefence] = curPokemonConFig.PhysicalDefence
|
|
|
|
|
addAllProVal[HeroProType.MagicDefence] = curPokemonConFig.MagicDefence
|
|
|
|
|
--升级
|
|
|
|
|
for i = 1, #curPokemonLvConFig.CharacterLevelPara do
|
|
|
|
|
local curPro = curPokemonLvConFig.CharacterLevelPara[i]
|
|
|
|
|
if curPro[2] > 0 then
|
|
|
|
|
if addAllProVal[curPro[1]] then
|
|
|
|
|
addAllProVal[curPro[1]]=addAllProVal[curPro[1]]+curPro[2]
|
|
|
|
|
else
|
|
|
|
|
addAllProVal[curPro[1]]=curPro[2]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--升星 属性=(基础属性+等级属性)*(1+星级倍率)
|
|
|
|
|
local StarPara = curPokemonStarConFig.StarPara/10000
|
|
|
|
|
local addEndAllProVal = {}
|
|
|
|
|
for key, value in pairs(addAllProVal) do
|
|
|
|
|
addEndAllProVal[key] = math.floor(value * (1 + StarPara))
|
|
|
|
|
end
|
|
|
|
|
return addEndAllProVal
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-24 11:08:03 +08:00
|
|
|
|
return this
|