diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index d6346202..ecabc15a 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -160,6 +160,13 @@ BIReport.MAIL_OPT_TYPE = { CLAIM = "Claim", } +BIReport.HERO_OPT_TYPE = { + UNLOCK = "Unlock", + ACTIVE = "Active", + LEVEL_UP = "LevelUp", + FORMATION = "Formation", +} + -- b6 local EVENT_NAME_EXIT = "client_exit" local EVENT_NAME_FIGHT = "client_fight" @@ -179,6 +186,7 @@ local EVENT_NAME_VIT_USE = "client_vit_use" local EVENT_NAME_VIT_GET = "client_vit_get" local EVENT_NAME_DAILY_TASK = "client_daily_task" local EVENT_NAME_MAIL_OPT = "client_mail_opt" +local EVENT_NAME_HERO_OPT = "client_hero_opt" function BIReport:setIsNewPlayer(isNewPlayer) self.isNewPlayer = isNewPlayer @@ -825,4 +833,32 @@ function BIReport:postAccountChangeFinish(loginType, success) self:report(EVENT_NAME_ACCOUNT_OPT, args) end +function BIReport:postHeroOpt(heroId, optType) + local heroEntity = DataManager.HeroData:getHeroById(heroId) + if not heroEntity then + return + end + + local args = { + hero_id = heroId, + level = heroEntity:getLv(), + event_type = optType + } + + local formation = DataManager.FormationData:getStageFormation() + for matchType, heroId in pairs(formation) do + local entity = DataManager.HeroData:getHeroById(heroId) + if entity then + if args.fomation then + args.fomation = args.fomation .. "|" + else + args.fomation = GConst.EMPTY_STRING + end + args.fomation = args.fomation .. heroId .. ":" .. entity:getLv() + end + end + + self:report(EVENT_NAME_HERO_OPT, args) +end + return BIReport \ No newline at end of file diff --git a/lua/app/module/formation/formation_manager.lua b/lua/app/module/formation/formation_manager.lua index 5a690988..2d0e6b21 100644 --- a/lua/app/module/formation/formation_manager.lua +++ b/lua/app/module/formation/formation_manager.lua @@ -17,6 +17,7 @@ function FormationManager:upHeroToStageFormationFinish(result) if result.err_code == GConst.ERROR_STR.SUCCESS then DataManager.FormationData:init(result) DataManager.HeroData:setDirty() + BIReport:postHeroOpt(result.reqData.id, BIReport.HERO_OPT_TYPE.FORMATION) end end diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua index 32f6be65..b9308fdd 100644 --- a/lua/app/userdata/hero/hero_data.lua +++ b/lua/app/userdata/hero/hero_data.lua @@ -9,6 +9,7 @@ function HeroData:ctor() self.maxHeroLvOnInit = 0 self.showHeroUnlockChapter = 0 self.heroChapterUnlockMap = {} + self.heroChapterUnlockMapBi = {} end function HeroData:clear() @@ -20,6 +21,9 @@ function HeroData:init(data) for k, v in pairs(self.heroChapterUnlockMap) do self.heroChapterUnlockMap[k] = false end + for k, v in pairs(self.heroChapterUnlockMapBi) do + self.heroChapterUnlockMapBi[k] = false + end if data then for id, heroInfo in pairs(data) do self:addHero(heroInfo.id, heroInfo.level) @@ -42,6 +46,9 @@ function HeroData:init(data) if info.unlock_chapter and info.is_show == 1 then self.heroChapterUnlockMap[info.unlock_chapter] = true end + if info.unlock_chapter then + self.heroChapterUnlockMapBi[info.unlock_chapter] = true + end end self.showHeroUnlockChapter = 0 end @@ -105,9 +112,11 @@ end function HeroData:setHeroLv(id, lv) local entity = self:getHeroById(id) + local activeBefore = true if not entity:isActived() then self.data.activeCount = self.data.activeCount + 1 ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_NEW_HERO_GOT) + activeBefore = false end entity:setLv(lv) if entity:isActived() then @@ -117,6 +126,15 @@ function HeroData:setHeroLv(id, lv) end self.matchActiveHeroMap[matchType][entity:getCfgId()] = true end + + if activeBefore then + BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.LEVEL_UP) + else + if not entity:getUnlcokChapter() then + BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.UNLOCK) + end + BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.ACTIVE) + end end function HeroData:getMatchActiveHeroMap() @@ -159,6 +177,14 @@ function HeroData:markShowHeroUnlock() end function HeroData:checkIfCanShowHeroUnlock(chapterId) + if self.heroChapterUnlockMapBi[chapterId] then -- 日志上报 + for id, entity in pairs(self.heroes) do + if not entity:isActived() and entity:getUnlcokChapter() == chapterId then + BIReport:postHeroOpt(id, BIReport.HERO_OPT_TYPE.UNLOCK) + end + end + end + if not self.heroChapterUnlockMap[chapterId] then return end