Exemplo n.º 1
0
        private bool ListenKilled(EvtKilled evt)
        {
            switch (Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.targetID))
            {
            case 3:
            {
                AvatarStastics avatarStastics = this.GetAvatarStastics(evt.targetID);
                if (avatarStastics == null)
                {
                    return(true);
                }
                avatarStastics.isAlive = 0;
                break;
            }

            case 4:
            {
                MonsterStastics monsterStastics = this.GetMonsterStastics(evt.targetID);
                if (monsterStastics != null)
                {
                    monsterStastics.isAlive = false;
                }
                break;
            }
            }
            return(false);
        }
Exemplo n.º 2
0
 public void ShowResult()
 {
     if (!Singleton <LevelScoreManager> .Instance.useDebugFunction)
     {
         List <AvatarStastics>  avatarInfoList  = new List <AvatarStastics>();
         List <MonsterStastics> monsterInfoList = new List <MonsterStastics>();
         foreach (KeyValuePair <int, AvatarStastics> pair in this._avatarStasticsDict)
         {
             AvatarStastics item = pair.Value;
             item.dps = (item.battleTime <= 0f) ? 0f : (item.avatarDamage / item.battleTime);
             item.restrictionDamageRatio  = (item.avatarDamage <= 0f) ? 0f : (item.restrictionDamage / item.avatarDamage);
             item.beRestrictedDamageRatio = (item.avatarDamage <= 0f) ? 0f : (item.beRestrictedDamage / item.avatarDamage);
             item.normalDamageRatio       = (item.avatarDamage <= 0f) ? 0f : (item.normalDamage / item.avatarDamage);
             avatarInfoList.Add(item);
         }
         foreach (KeyValuePair <uint, MonsterStastics> pair2 in this._monsterStasticsDict)
         {
             MonsterStastics stastics2 = pair2.Value;
             stastics2.dps = stastics2.damage / stastics2.aliveTime;
             if (!this._monsterAverageStasticsDict.ContainsKey(stastics2.key))
             {
                 this._monsterAverageStasticsDict[stastics2.key] = new MonsterStastics(stastics2.key.monsterName, stastics2.key.configType, stastics2.key.level);
             }
             MonsterStastics stastics3 = this._monsterAverageStasticsDict[stastics2.key];
             stastics3.monsterCount      = SafeInt32.op_Increment(stastics3.monsterCount);
             stastics3.damage           += stastics2.damage;
             stastics3.aliveTime        += stastics2.aliveTime;
             stastics3.hitAvatarTimes   += stastics2.hitAvatarTimes;
             stastics3.breakAvatarTimes += stastics2.breakAvatarTimes;
             stastics3.dps += stastics2.dps;
         }
         foreach (KeyValuePair <MonsterKey, MonsterStastics> pair3 in this._monsterAverageStasticsDict)
         {
             MonsterStastics stastics4 = pair3.Value;
             stastics4.damage         /= (float)stastics4.monsterCount;
             stastics4.aliveTime      /= (float)stastics4.monsterCount;
             stastics4.hitAvatarTimes /= stastics4.monsterCount;
             stastics4.dps            /= (float)stastics4.monsterCount;
             monsterInfoList.Add(stastics4);
         }
         PlayerStastics playerData = this._playerStastics;
         Singleton <NetworkManager> .Instance.RequestStageInnerDataReport(avatarInfoList, monsterInfoList, playerData);
     }
 }
Exemplo n.º 3
0
 public override void Core()
 {
     if (!this._isInit)
     {
         this.InitDate();
     }
     if (this.isStageCreated && (this._playerStastics != null))
     {
         this.stageTime += Time.deltaTime;
         this._playerStastics.stageTime += Time.deltaTime;
     }
     if (this.isUpdating)
     {
         this._updateTimer += Time.deltaTime;
         foreach (KeyValuePair <int, AvatarStastics> pair in this._avatarStasticsDict)
         {
             AvatarStastics stastics = pair.Value;
             if ((stastics.isAlive != 0) && (stastics.isOnStage != 0))
             {
                 stastics.battleTime  += Time.deltaTime;
                 stastics.onStageTime += Time.deltaTime;
             }
         }
         Dictionary <uint, MonsterStastics> .Enumerator enumerator2 = this._monsterStasticsDict.GetEnumerator();
         try
         {
             while (enumerator2.MoveNext())
             {
                 KeyValuePair <uint, MonsterStastics> current = enumerator2.Current;
                 MonsterStastics stastics2 = current.Value;
                 if (stastics2.isAlive)
                 {
                     stastics2.aliveTime += Time.deltaTime;
                 }
             }
         }
         finally
         {
             Dictionary <int, AvatarStastics> .Enumerator enumerator;
             enumerator.Dispose();
         }
     }
 }
Exemplo n.º 4
0
        private bool ListenBeingHit(EvtBeingHit evt)
        {
            if (evt.attackData.rejected)
            {
                return(false);
            }
            if (this.isUpdating)
            {
                if (!evt.attackData.IsFinalResolved())
                {
                    return(false);
                }
                if (!evt.attackData.isAnimEventAttack)
                {
                    return(false);
                }
                this.allDamage += evt.attackData.GetTotalDamage();
                ushort num = Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.targetID);

                ushort num2 = Singleton <RuntimeIDManager> .Instance.ParseCategory(evt.sourceID);

                switch (num)
                {
                case 3:
                {
                    if (num2 == 4)
                    {
                        MonsterStastics monsterStastics = this.GetMonsterStastics(evt.sourceID);
                        if (monsterStastics != null)
                        {
                            monsterStastics.damage        += evt.attackData.GetTotalDamage();
                            monsterStastics.hitAvatarTimes = SafeInt32.op_Increment(monsterStastics.hitAvatarTimes);
                            if (evt.attackData.hitEffect > AttackResult.AnimatorHitEffect.Light)
                            {
                                monsterStastics.breakAvatarTimes = SafeInt32.op_Increment(monsterStastics.breakAvatarTimes);
                            }
                        }
                    }
                    AvatarStastics avatarStastics = this.GetAvatarStastics(evt.targetID);
                    if (avatarStastics == null)
                    {
                        return(true);
                    }
                    avatarStastics.avatarBeDamaged    += evt.attackData.GetTotalDamage();
                    avatarStastics.avatarBeingHitTimes = SafeInt32.op_Increment(avatarStastics.avatarBeingHitTimes);
                    if (evt.attackData.hitEffect > AttackResult.AnimatorHitEffect.Light)
                    {
                        avatarStastics.avatarBeingBreakTimes = SafeInt32.op_Increment(avatarStastics.avatarBeingBreakTimes);
                    }
                    this.monsterDamage += evt.attackData.GetTotalDamage();
                    this.avatarBeingHitTimes++;
                    if (evt.attackData.attackerAniDamageRatio > evt.attackData.attackeeAniDefenceRatio)
                    {
                        this.avatarBeingHitTimes++;
                    }
                    if (evt.attackData.hitLevel == AttackResult.ActorHitLevel.Normal)
                    {
                        avatarStastics.behitNormalDamageMax = Mathf.Max(evt.attackData.GetTotalDamage(), (float)avatarStastics.behitNormalDamageMax);
                    }
                    else if (evt.attackData.hitLevel == AttackResult.ActorHitLevel.Critical)
                    {
                        avatarStastics.behitCriticalDamageMax = Mathf.Max(evt.attackData.GetTotalDamage(), (float)avatarStastics.behitCriticalDamageMax);
                    }
                    break;
                }

                case 4:
                {
                    MonsterActor attackee = Singleton <EventManager> .Instance.GetActor <MonsterActor>(evt.targetID);

                    if (num2 == 3)
                    {
                        AvatarStastics stastics3 = this.GetAvatarStastics(evt.sourceID);
                        if (stastics3 == null)
                        {
                            return(true);
                        }
                        float a = DamageModelLogic.GetNatureDamageBonusRatio(evt.attackData.attackerNature, evt.attackData.attackeeNature, attackee);
                        if (a > 1f)
                        {
                            stastics3.restrictionDamage += evt.attackData.GetTotalDamage();
                        }
                        else if (a < 1f)
                        {
                            stastics3.beRestrictedDamage += evt.attackData.GetTotalDamage();
                        }
                        else if (Mathf.Approximately(a, 1f))
                        {
                            stastics3.normalDamage += evt.attackData.GetTotalDamage();
                        }
                        if (evt.attackData.attackCategoryTag.ContainsTag(AttackResult.AttackCategoryTag.Weapon))
                        {
                            stastics3.avatarActiveWeaponSkillDamage += evt.attackData.GetTotalDamage();
                            this.avatarWeaponDdamage += evt.attackData.GetTotalDamage();
                        }
                        if (evt.attackData.hitEffect > AttackResult.AnimatorHitEffect.Light)
                        {
                            stastics3.avatarBreakTimes = SafeInt32.op_Increment(stastics3.avatarBreakTimes);
                        }
                        stastics3.avatarDamage  += evt.attackData.GetTotalDamage();
                        stastics3.avatarHitTimes = SafeInt32.op_Increment(stastics3.avatarHitTimes);
                        if (evt.attackData.isInComboCount)
                        {
                            stastics3.avatarEffectHitTimes = SafeInt32.op_Increment(stastics3.avatarEffectHitTimes);
                        }
                        if (evt.attackData.hitLevel == AttackResult.ActorHitLevel.Normal)
                        {
                            stastics3.hitNormalDamageMax = Mathf.Max(evt.attackData.GetTotalDamage(), (float)stastics3.hitNormalDamageMax);
                        }
                        else if (evt.attackData.hitLevel == AttackResult.ActorHitLevel.Critical)
                        {
                            stastics3.hitCriticalDamageMax = Mathf.Max(evt.attackData.GetTotalDamage(), (float)stastics3.hitCriticalDamageMax);
                        }
                    }
                    this.avatarDamage += evt.attackData.GetTotalDamage();
                    if (evt.attackData.isInComboCount)
                    {
                        this.avatarEffectHitTimes++;
                    }
                    this.monstersBeingHitTimes++;
                    if (evt.attackData.attackerAniDamageRatio > evt.attackData.attackeeAniDefenceRatio)
                    {
                        this.avatarBreakTimes++;
                    }
                    break;
                }
                }
            }
            return(true);
        }