public static void Build_Burn_BattleParam(COMDT_SINGLE_GAME_PARAM param, bool bClickGameOver) { param.bGameType = 7; PlayerKDA hostKDA = Singleton <BattleStatistic> .GetInstance().m_playerKDAStat.GetHostKDA(); if (hostKDA == null) { DebugHelper.Assert(hostKDA != null, "Failed find player kda"); Singleton <BattleStatistic> .instance.m_playerKDAStat.DumpDebugInfo(); } else { IEnumerator <HeroKDA> enumerator = hostKDA.GetEnumerator(); if (!bClickGameOver) { while (enumerator.MoveNext()) { int configId = enumerator.Current.actorHero.handle.TheActorMeta.ConfigId; Singleton <BurnExpeditionController> .GetInstance().model.SetHero_Hp((uint)configId, (int)Get_BloodTH(enumerator.Current.actorHero.handle)); } } param.stGameDetail.stBurning = new COMDT_BURNING_ENEMY_HERO_DETAIL(); COMDT_BURNING_HERO_INFO[] astHeroList = param.stGameDetail.stBurning.astHeroList; List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .GetInstance().HeroActors; int index = 0; for (int i = 0; i < heroActors.Count; i++) { PoolObjHandle <ActorRoot> handle = heroActors[i]; ActorRoot actor = handle.handle; if (!actor.IsHostCamp()) { astHeroList[index].dwHeroID = (uint)actor.TheActorMeta.ConfigId; bool flag = actor.ValueComponent.actorHp == 0; uint blood = 0; byte num5 = 0; if (flag) { blood = 0; num5 = 1; } else { blood = Get_BloodTH(actor); num5 = 0; } astHeroList[index].dwBloodTTH = blood; astHeroList[index].bIsDead = num5; if (!bClickGameOver) { Record_EnemyHero_HPInfo(actor.TheActorMeta.ConfigId, blood); } index++; } } param.stGameDetail.stBurning.bHeroNum = (byte)index; } }
public static void Build_Burn_BattleParam(COMDT_SINGLE_GAME_PARAM param, bool bClickGameOver) { param.bGameType = 7; PlayerKDA hostKDA = Singleton <BattleStatistic> .GetInstance().m_playerKDAStat.GetHostKDA(); if (hostKDA == null) { DebugHelper.Assert(hostKDA != null, "Failed find player kda"); Singleton <BattleStatistic> .instance.m_playerKDAStat.DumpDebugInfo(); return; } ListView <HeroKDA> .Enumerator enumerator = hostKDA.GetEnumerator(); if (!bClickGameOver) { while (enumerator.MoveNext()) { int configId = enumerator.Current.actorHero.handle.TheActorMeta.ConfigId; Singleton <BurnExpeditionController> .GetInstance().model.SetHero_Hp((uint)configId, (int)BurnExpeditionUT.Get_BloodTH(enumerator.Current.actorHero.handle)); } } param.stGameDetail.stBurning = new COMDT_BURNING_ENEMY_HERO_DETAIL(); COMDT_BURNING_HERO_INFO[] astHeroList = param.stGameDetail.stBurning.astHeroList; List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .GetInstance().HeroActors; int num = 0; for (int i = 0; i < heroActors.get_Count(); i++) { ActorRoot handle = heroActors.get_Item(i).handle; if (!handle.IsHostCamp()) { astHeroList[num].dwHeroID = (uint)handle.TheActorMeta.ConfigId; bool flag = handle.ValueComponent.actorHp == 0; uint num2; byte bIsDead; if (flag) { num2 = 0u; bIsDead = 1; } else { num2 = BurnExpeditionUT.Get_BloodTH(handle); bIsDead = 0; } astHeroList[num].dwBloodTTH = num2; astHeroList[num].bIsDead = bIsDead; if (!bClickGameOver) { BurnExpeditionUT.Record_EnemyHero_HPInfo(handle.TheActorMeta.ConfigId, num2); } num++; } } param.stGameDetail.stBurning.bHeroNum = (byte)num; }
private void GetTeamKDA(DictionaryView <uint, PlayerKDA> playerKDAStat) { if (playerKDAStat != null) { DictionaryView <uint, PlayerKDA> .Enumerator enumerator = playerKDAStat.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <uint, PlayerKDA> current = enumerator.Current; PlayerKDA kda = current.Value; this.GetTeamInfoByPlayerKda(kda); } } }
private void GetTeamKDA(DictionaryView <uint, PlayerKDA> playerKDAStat) { if (playerKDAStat == null) { return; } DictionaryView <uint, PlayerKDA> .Enumerator enumerator = playerKDAStat.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <uint, PlayerKDA> current = enumerator.Current; PlayerKDA value = current.get_Value(); this.GetTeamInfoByPlayerKda(value); } }
public uint GetBestPlayer() { DictionaryView <uint, PlayerKDA> .Enumerator enumerator = Singleton <BattleStatistic> .instance.m_playerKDAStat.GetEnumerator(); float num = ((float)GameDataMgr.GetGlobeValue(RES_GLOBAL_CONF_TYPE.RES_GLOBAL_CONF_TYPE_HONOR_KILL_FACTOR)) / 10000f; float num2 = ((float)GameDataMgr.GetGlobeValue(RES_GLOBAL_CONF_TYPE.RES_GLOBAL_CONF_TYPE_HONOR_ASSIST_FACTOR)) / 10000f; float num3 = ((float)GameDataMgr.GetGlobeValue(RES_GLOBAL_CONF_TYPE.RES_GLOBAL_CONF_TYPE_HONOR_DEAD_FACTOR)) / 10000f; uint lastBestPlayer = this.m_lastBestPlayer; float b = 0f; int numKill = 0; PlayerKDA rkda = null; while (enumerator.MoveNext()) { KeyValuePair <uint, PlayerKDA> current = enumerator.Current; rkda = current.Value; float a = ((rkda.numKill * num) + (rkda.numAssist * num2)) - (rkda.numDead * num3); if (Mathf.Approximately(a, b)) { KeyValuePair <uint, PlayerKDA> pair2 = enumerator.Current; if (pair2.Value.numKill >= numKill) { if (rkda.PlayerId != this.m_lastBestPlayer) { lastBestPlayer = rkda.PlayerId; } b = a; KeyValuePair <uint, PlayerKDA> pair3 = enumerator.Current; numKill = pair3.Value.numKill; } } else if (a >= b) { lastBestPlayer = rkda.PlayerId; b = a; KeyValuePair <uint, PlayerKDA> pair4 = enumerator.Current; numKill = pair4.Value.numKill; } } if (Mathf.Approximately(b, 0f)) { this.m_lastBestPlayer = 0; return(0); } this.m_lastBestPlayer = lastBestPlayer; return(lastBestPlayer); }
private void GetTeamInfoByPlayerKda(PlayerKDA kda) { if ((kda != null) && ((kda.PlayerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) || (kda.PlayerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_2))) { ListView <HeroKDA> .Enumerator enumerator = kda.GetEnumerator(); while (enumerator.MoveNext()) { HeroKDA current = enumerator.Current; if (current != null) { this.m_campTotalDamage[((int)kda.PlayerCamp) - 1] += (uint)current.hurtToEnemy; this.m_campTotalTakenDamage[((int)kda.PlayerCamp) - 1] += (uint)current.hurtTakenByEnemy; this.m_campTotalToHeroDamage[((int)kda.PlayerCamp) - 1] += (uint)current.hurtToHero; } } } }
public uint GetBestPlayer() { DictionaryView <uint, PlayerKDA> .Enumerator enumerator = Singleton <BattleStatistic> .instance.m_playerKDAStat.GetEnumerator(); float num = GameDataMgr.GetGlobeValue(RES_GLOBAL_CONF_TYPE.RES_GLOBAL_CONF_TYPE_HONOR_KILL_FACTOR) / 10000f; float num2 = GameDataMgr.GetGlobeValue(RES_GLOBAL_CONF_TYPE.RES_GLOBAL_CONF_TYPE_HONOR_ASSIST_FACTOR) / 10000f; float num3 = GameDataMgr.GetGlobeValue(RES_GLOBAL_CONF_TYPE.RES_GLOBAL_CONF_TYPE_HONOR_DEAD_FACTOR) / 10000f; uint num4 = this.m_lastBestPlayer; float num5 = 0f; int num6 = 0; while (enumerator.MoveNext()) { KeyValuePair <uint, PlayerKDA> current = enumerator.Current; PlayerKDA value = current.get_Value(); float num7 = (float)value.numKill * num + (float)value.numAssist * num2 - (float)value.numDead * num3; if (Mathf.Approximately(num7, num5)) { KeyValuePair <uint, PlayerKDA> current2 = enumerator.Current; if (current2.get_Value().numKill >= num6) { if (value.PlayerId != this.m_lastBestPlayer) { num4 = value.PlayerId; } num5 = num7; KeyValuePair <uint, PlayerKDA> current3 = enumerator.Current; num6 = current3.get_Value().numKill; } } else if (num7 >= num5) { num4 = value.PlayerId; num5 = num7; KeyValuePair <uint, PlayerKDA> current4 = enumerator.Current; num6 = current4.get_Value().numKill; } } if (Mathf.Approximately(num5, 0f)) { this.m_lastBestPlayer = 0u; return(0u); } this.m_lastBestPlayer = num4; return(num4); }
private void initialize() { List <Player> allPlayers = Singleton <GamePlayerCenter> .instance.GetAllPlayers(); List <Player> .Enumerator enumerator = allPlayers.GetEnumerator(); while (enumerator.MoveNext()) { Player current = enumerator.get_Current(); if (current != null) { PlayerKDA playerKDA = new PlayerKDA(); playerKDA.initialize(current); this.m_PlayerKDA.Add(current.PlayerId, playerKDA); } } this.m_LastRecordTick = 0u; Singleton <EventRouter> .GetInstance().AddEventHandler <PoolObjHandle <ActorRoot>, sbyte, uint>("HeroLearnTalent", new Action <PoolObjHandle <ActorRoot>, sbyte, uint>(this.OnHeroLearnTalent)); Singleton <EventRouter> .GetInstance().AddEventHandler <PoolObjHandle <ActorRoot>, int>("HeroSoulLevelChange", new Action <PoolObjHandle <ActorRoot>, int>(this.OnHeroSoulLvlChange)); Singleton <EventRouter> .GetInstance().AddEventHandler <uint, stEquipInfo[], bool, int>("HeroEquipInBattleChange", new Action <uint, stEquipInfo[], bool, int>(this.OnHeroBattleEquipChange)); Singleton <GameEventSys> .instance.AddEventHandler <GameDeadEventParam>(GameEventDef.Event_ActorDead, new RefAction <GameDeadEventParam>(this.OnActorDead)); Singleton <GameEventSys> .instance.AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_GameEnd, new RefAction <DefaultGameEventParam>(this.OnGameEnd)); Singleton <GameEventSys> .instance.AddEventHandler <HurtEventResultInfo>(GameEventDef.Event_ActorDamage, new RefAction <HurtEventResultInfo>(this.OnActorDamage)); Singleton <GameEventSys> .instance.AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_DoubleKill, new RefAction <DefaultGameEventParam>(this.OnActorDoubleKill)); Singleton <GameEventSys> .instance.AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_TripleKill, new RefAction <DefaultGameEventParam>(this.OnActorTripleKill)); Singleton <GameEventSys> .instance.AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_QuataryKill, new RefAction <DefaultGameEventParam>(this.OnActorQuataryKill)); Singleton <GameEventSys> .instance.AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_PentaKill, new RefAction <DefaultGameEventParam>(this.OnActorPentaKill)); Singleton <GameEventSys> .instance.AddEventHandler <DefaultGameEventParam>(GameEventDef.Event_Odyssey, new RefAction <DefaultGameEventParam>(this.OnActorOdyssey)); Singleton <GameEventSys> .instance.AddEventHandler <SkillChooseTargetEventParam>(GameEventDef.Event_ActorBeChosenAsTarget, new RefAction <SkillChooseTargetEventParam>(this.OnActorBeChosen)); Singleton <GameEventSys> .instance.AddEventHandler <SkillChooseTargetEventParam>(GameEventDef.Event_HitTrigger, new RefAction <SkillChooseTargetEventParam>(this.OnHitTrigger)); Singleton <EventRouter> .GetInstance().AddEventHandler <PoolObjHandle <ActorRoot>, int, bool, PoolObjHandle <ActorRoot> >("HeroGoldCoinInBattleChange", new Action <PoolObjHandle <ActorRoot>, int, bool, PoolObjHandle <ActorRoot> >(this.OnActorBattleCoinChanged)); Singleton <GameEventSys> .instance.AddEventHandler <HemophagiaEventResultInfo>(GameEventDef.Event_Hemophagia, new RefAction <HemophagiaEventResultInfo>(this.OnActorHemophagia)); }
private void GetTeamInfoByPlayerKda(PlayerKDA kda) { if (kda == null) { return; } if (kda.PlayerCamp != 1 && kda.PlayerCamp != 2) { return; } ListView <HeroKDA> .Enumerator enumerator = kda.GetEnumerator(); while (enumerator.MoveNext()) { HeroKDA current = enumerator.get_Current(); if (current != null) { this.m_campTotalDamage[kda.PlayerCamp - 1] += (uint)current.hurtToEnemy; this.m_campTotalTakenDamage[kda.PlayerCamp - 1] += (uint)current.hurtTakenByEnemy; this.m_campTotalToHeroDamage[kda.PlayerCamp - 1] += (uint)current.hurtToHero; } } }
public static void OnRecvServerReqClientInfo(CSPkg msg) { if (Singleton <BattleLogic> .instance.isRuning) { CSPkg cSPkg = NetworkModule.CreateDefaultCSPKG(5607u); if (cSPkg != null) { List <Player> allPlayers = Singleton <GamePlayerCenter> .instance.GetAllPlayers(); if (allPlayers != null) { byte b = 0; int count = allPlayers.get_Count(); for (int i = 0; i < count; i++) { if (!allPlayers.get_Item(i).Computer) { cSPkg.stPkgData.stCltUploadDataRsp.astMemberData[(int)b].dwAcntObjID = allPlayers.get_Item(i).PlayerId; PlayerKDA playerKDA = Singleton <BattleStatistic> .GetInstance().m_playerKDAStat.GetPlayerKDA(allPlayers.get_Item(i).PlayerId); if (playerKDA != null) { cSPkg.stPkgData.stCltUploadDataRsp.astMemberData[(int)b].wAssistCnt = (ushort)playerKDA.numAssist; cSPkg.stPkgData.stCltUploadDataRsp.astMemberData[(int)b].wDeadCnt = (ushort)playerKDA.numDead; cSPkg.stPkgData.stCltUploadDataRsp.astMemberData[(int)b].wKillCnt = (ushort)playerKDA.numKill; } if (allPlayers.get_Item(i).Captain&& allPlayers.get_Item(i).Captain.handle.ValueComponent != null) { cSPkg.stPkgData.stCltUploadDataRsp.astMemberData[(int)b].dwBattleCoin = (uint)allPlayers.get_Item(i).Captain.handle.ValueComponent.GetGoldCoinIncomeInBattle(); } b += 1; } } cSPkg.stPkgData.stCltUploadDataRsp.bMemberNum = b; } Singleton <NetworkModule> .GetInstance().SendGameMsg(ref cSPkg, 0u); } } }
public uint GetMvpPlayer(COM_PLAYERCAMP camp, bool bWin) { if ((this.m_winMvpId != 0) || (this.m_loseMvpId != 0)) { if (bWin) { return(this.m_winMvpId); } return(this.m_loseMvpId); } SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext(); int bMaxAcntNum = 0; if (curLvelContext != null) { if (((curLvelContext.GameType == COM_GAME_TYPE.COM_SINGLE_GAME_OF_COMBAT) || (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_MATCH)) || ((curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_PVP_ROOM) || (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_ENTERTAINMENT))) { ResAcntBattleLevelInfo dataByKey = GameDataMgr.pvpLevelDatabin.GetDataByKey((uint)curLvelContext.iLevelID); ResCounterPartLevelInfo info2 = null; if (dataByKey == null) { info2 = GameDataMgr.cpLevelDatabin.GetDataByKey((uint)curLvelContext.iLevelID); } if (dataByKey != null) { bMaxAcntNum = dataByKey.stLevelCommonInfo.bMaxAcntNum; } else { bMaxAcntNum = info2.stLevelCommonInfo.bMaxAcntNum; } } else if (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_LADDER) { ResRankLevelInfo info3 = GameDataMgr.rankLevelDatabin.GetDataByKey((uint)curLvelContext.iLevelID); if (info3 != null) { bMaxAcntNum = info3.stLevelCommonInfo.bMaxAcntNum; } } else if (curLvelContext.GameType == COM_GAME_TYPE.COM_MULTI_GAME_OF_REWARDMATCH) { ResRewardMatchLevelInfo info4 = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey((uint)curLvelContext.iLevelID); if (info4 != null) { bMaxAcntNum = info4.stLevelCommonInfo.bMaxAcntNum; } } } if (bMaxAcntNum <= 2) { return(0); } uint playerId = 0; float num3 = 0f; int numKill = 0; DictionaryView <uint, PlayerKDA> .Enumerator enumerator = Singleton <BattleStatistic> .instance.m_playerKDAStat.GetEnumerator(); PlayerKDA rkda = null; float num5 = ((float)GameDataMgr.globalInfoDatabin.GetDataByKey((uint)0xb1).dwConfValue) / 10000f; while (enumerator.MoveNext()) { KeyValuePair <uint, PlayerKDA> current = enumerator.Current; rkda = current.Value; if ((!rkda.bHangup && !rkda.bRunaway) && !rkda.bDisconnect) { float scoreValue = rkda.GetScoreValue(); if ((rkda.PlayerCamp == camp) && (scoreValue >= num3)) { if (scoreValue == num3) { KeyValuePair <uint, PlayerKDA> pair2 = enumerator.Current; if (pair2.Value.numKill < numKill) { continue; } } if (bWin || (scoreValue >= num5)) { KeyValuePair <uint, PlayerKDA> pair3 = enumerator.Current; playerId = pair3.Value.PlayerId; num3 = scoreValue; KeyValuePair <uint, PlayerKDA> pair4 = enumerator.Current; numKill = pair4.Value.numKill; } } } } return(playerId); }
public uint GetMvpPlayer(COM_PLAYERCAMP camp, bool bWin) { if (this.m_winMvpId != 0u || this.m_loseMvpId != 0u) { if (bWin) { return(this.m_winMvpId); } return(this.m_loseMvpId); } else { SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext(); int num = 0; if (curLvelContext != null && curLvelContext.IsMobaModeWithOutGuide()) { num = curLvelContext.m_pvpPlayerNum; } if (num <= 2) { return(0u); } uint result = 0u; float num2 = 0f; int num3 = 0; DictionaryView <uint, PlayerKDA> .Enumerator enumerator = Singleton <BattleStatistic> .instance.m_playerKDAStat.GetEnumerator(); float num4 = GameDataMgr.globalInfoDatabin.GetDataByKey(177u).dwConfValue / 10000f; while (enumerator.MoveNext()) { KeyValuePair <uint, PlayerKDA> current = enumerator.Current; PlayerKDA value = current.get_Value(); if (!value.bHangup && !value.bRunaway && !value.bDisconnect) { float mvpValue = value.MvpValue; float kDAValue = value.KDAValue; if (value.PlayerCamp == camp && mvpValue >= num2) { if (mvpValue == num2) { KeyValuePair <uint, PlayerKDA> current2 = enumerator.Current; if (current2.get_Value().numKill < num3) { continue; } } if ((bWin || mvpValue >= num4) && (bWin || kDAValue >= 3f)) { KeyValuePair <uint, PlayerKDA> current3 = enumerator.Current; result = current3.get_Value().PlayerId; num2 = mvpValue; KeyValuePair <uint, PlayerKDA> current4 = enumerator.Current; num3 = current4.get_Value().numKill; } } } } return(result); } }
public uint GetMvpPlayer(COM_PLAYERCAMP camp, bool bWin) { if ((this.m_winMvpId != 0) || (this.m_loseMvpId != 0)) { if (bWin) { return(this.m_winMvpId); } return(this.m_loseMvpId); } SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext(); int pvpPlayerNum = 0; if ((curLvelContext != null) && curLvelContext.IsMobaModeWithOutGuide()) { pvpPlayerNum = curLvelContext.m_pvpPlayerNum; } if (pvpPlayerNum <= 2) { return(0); } uint playerId = 0; float num3 = 0f; int numKill = 0; DictionaryView <uint, PlayerKDA> .Enumerator enumerator = Singleton <BattleStatistic> .instance.m_playerKDAStat.GetEnumerator(); PlayerKDA rkda = null; float num5 = ((float)GameDataMgr.globalInfoDatabin.GetDataByKey((uint)0xb1).dwConfValue) / 10000f; while (enumerator.MoveNext()) { KeyValuePair <uint, PlayerKDA> current = enumerator.Current; rkda = current.Value; if ((!rkda.bHangup && !rkda.bRunaway) && !rkda.bDisconnect) { float scoreValue = rkda.GetScoreValue(); if ((rkda.PlayerCamp == camp) && (scoreValue >= num3)) { if (scoreValue == num3) { KeyValuePair <uint, PlayerKDA> pair2 = enumerator.Current; if (pair2.Value.numKill < numKill) { continue; } } if (bWin || (scoreValue >= num5)) { KeyValuePair <uint, PlayerKDA> pair3 = enumerator.Current; playerId = pair3.Value.PlayerId; num3 = scoreValue; KeyValuePair <uint, PlayerKDA> pair4 = enumerator.Current; numKill = pair4.Value.numKill; } } } } return(playerId); }