|
|
@@ -27,6 +27,25 @@ local function getDB(human)
|
|
|
return human.db.jiban
|
|
|
end
|
|
|
|
|
|
+-- 获取全部设置的羁绊位置英雄ID
|
|
|
+local function getDB_AllJibanHeroID(human)
|
|
|
+ human.db.jibanheroid = human.db.jibanheroid or {}
|
|
|
+ return human.db.jibanheroid
|
|
|
+end
|
|
|
+
|
|
|
+-- 获取某个羁绊位置英雄ID
|
|
|
+local function getDB_JibanHeroIDByIndex(human, nIndex)
|
|
|
+ local jibanheroid = getDB_AllJibanHeroID(human)
|
|
|
+ return jibanheroid[nIndex] and jibanheroid[nIndex] or -1
|
|
|
+end
|
|
|
+
|
|
|
+-- 设置羁绊位置英雄ID
|
|
|
+local function setDB_JibanHeroID(human, nIndex, nHeroID)
|
|
|
+ local jibanheroid = getDB_AllJibanHeroID(human)
|
|
|
+ jibanheroid[nIndex] = nHeroID
|
|
|
+end
|
|
|
+
|
|
|
+
|
|
|
local function fontJibanInfo(net,id)
|
|
|
local conf = JibanExcel.jiban[id]
|
|
|
net.id = id
|
|
|
@@ -129,7 +148,19 @@ function query(human,combatType,heroID)
|
|
|
if jibanDB[k] and jibanDB[k] ~= "" and jibanDB[k] ~= "0" then
|
|
|
heroGrid = HeroLogic.getHeroGridByUuid(human, jibanDB[k])
|
|
|
end
|
|
|
- index = heroGrid and heroGrid.bagIndex or 0
|
|
|
+
|
|
|
+ if not heroGrid then
|
|
|
+ local nHeroID = getDB_JibanHeroIDByIndex(human, k)
|
|
|
+ if -1 ~= nHeroID then
|
|
|
+ local heroGridList = HeroLogic.getHeroListById(human, nHeroID)
|
|
|
+ if nil ~= _G.next(heroGridList) then
|
|
|
+ local nHeroIndex = heroGridList[1]
|
|
|
+ heroGrid = HeroLogic.getHeroGrid(human, nHeroID, nHeroIndex)
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ local index = heroGrid and heroGrid.bagIndex or 0
|
|
|
HeroGrid.makeHeroSimple(net.hero, heroGrid, index)
|
|
|
end
|
|
|
msgRet.posList[0] = len
|
|
|
@@ -155,7 +186,19 @@ function sendQuery(human,combatType, teamType)
|
|
|
if jibanDB[k] and jibanDB[k] ~= "" and jibanDB[k] ~= "0" then
|
|
|
heroGrid = HeroLogic.getHeroGridByUuid(human, jibanDB[k])
|
|
|
end
|
|
|
- index = heroGrid and heroGrid.bagIndex or 0
|
|
|
+
|
|
|
+ if not heroGrid then
|
|
|
+ local nHeroID = getDB_JibanHeroIDByIndex(human, k)
|
|
|
+ if -1 ~= nHeroID then
|
|
|
+ local heroGridList = HeroLogic.getHeroListById(human, nHeroID)
|
|
|
+ if nil ~= _G.next(heroGridList) then
|
|
|
+ local nHeroIndex = heroGridList[1]
|
|
|
+ heroGrid = HeroLogic.getHeroGrid(human, nHeroID, nHeroIndex)
|
|
|
+ end
|
|
|
+ end
|
|
|
+ end
|
|
|
+
|
|
|
+ local index = heroGrid and heroGrid.bagIndex or 0
|
|
|
HeroGrid.makeHeroSimple(net.hero, heroGrid, index)
|
|
|
end
|
|
|
msgRet.posList[0] = len
|
|
|
@@ -227,9 +270,14 @@ function getJibanHero(human,combatHeroDB)
|
|
|
if combatHeroDB.jiban then
|
|
|
for k, uuid in pairs(combatHeroDB.jiban) do
|
|
|
if uuid ~= "0" and uuid ~= "" then
|
|
|
- heroGrid = HeroLogic.getHeroGridByUuid(human, uuid)
|
|
|
+ local heroGrid = HeroLogic.getHeroGridByUuid(human, uuid)
|
|
|
if heroGrid then
|
|
|
jibanHero[k] = heroGrid.id
|
|
|
+ else
|
|
|
+ local nHeroID = getDB_JibanHeroIDByIndex(human, k)
|
|
|
+ if -1 ~= nHeroID then
|
|
|
+ jibanHero[k] = nHeroID
|
|
|
+ end
|
|
|
end
|
|
|
end
|
|
|
end
|
|
|
@@ -298,6 +346,8 @@ function update(human,combatType,jibanListStr)
|
|
|
if not posList[k] then return end
|
|
|
local heroGrid = HeroLogic.getHeroGridByUuid(human, uuid)
|
|
|
if not heroGrid then return end
|
|
|
+
|
|
|
+ setDB_JibanHeroID(human, k, heroGrid.id)
|
|
|
end
|
|
|
end
|
|
|
combatHeroDB.jiban = jibanList
|