Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }