コード例 #1
0
 // Token: 0x06001CFC RID: 7420 RVA: 0x00087090 File Offset: 0x00085290
 private static void ProcessDeathEvents()
 {
     while (StatManager.deathEvents.Count > 0)
     {
         StatManager.DamageEvent damageEvent = StatManager.deathEvents.Dequeue();
         StatSheet statSheet  = PlayerStatsComponent.FindBodyStatSheet(damageEvent.victim);
         StatSheet statSheet2 = PlayerStatsComponent.FindBodyStatSheet(damageEvent.attacker);
         if (statSheet != null)
         {
             statSheet.PushStatValue(StatDef.totalDeaths, 1UL);
             statSheet.PushStatValue(PerBodyStatDef.deathsAs, damageEvent.victimName, 1UL);
             if (damageEvent.attackerName != null)
             {
                 statSheet.PushStatValue(PerBodyStatDef.deathsFrom, damageEvent.attackerName, 1UL);
             }
         }
         if (statSheet2 != null)
         {
             statSheet2.PushStatValue(StatDef.totalKills, 1UL);
             statSheet2.PushStatValue(PerBodyStatDef.killsAs, damageEvent.attackerName, 1UL);
             if (damageEvent.victimName != null)
             {
                 statSheet2.PushStatValue(PerBodyStatDef.killsAgainst, damageEvent.victimName, 1UL);
                 if (damageEvent.victimIsElite)
                 {
                     statSheet2.PushStatValue(PerBodyStatDef.killsAgainstElite, damageEvent.victimName, 1UL);
                 }
             }
         }
     }
 }
コード例 #2
0
        private static void CCPrintStats(ConCommandArgs args)
        {
            GameObject senderMasterObject = args.senderMasterObject;
            StatSheet  statSheet;

            if (senderMasterObject == null)
            {
                statSheet = null;
            }
            else
            {
                PlayerStatsComponent component = senderMasterObject.GetComponent <PlayerStatsComponent>();
                statSheet = ((component != null) ? component.currentStats : null);
            }
            StatSheet statSheet2 = statSheet;

            if (statSheet2 == null)
            {
                return;
            }
            string[] array = new string[statSheet2.fields.Length];
            for (int i = 0; i < array.Length; i++)
            {
                array[i] = string.Format("[\"{0}\"]={1}", statSheet2.fields[i].name, statSheet2.fields[i].ToString());
            }
            Debug.Log(string.Join("\n", array));
        }
コード例 #3
0
 // Token: 0x06001CFB RID: 7419 RVA: 0x00086FB0 File Offset: 0x000851B0
 private static void ProcessDamageEvents()
 {
     while (StatManager.damageEvents.Count > 0)
     {
         StatManager.DamageEvent damageEvent = StatManager.damageEvents.Dequeue();
         ulong     statValue  = (ulong)damageEvent.damageDealt;
         StatSheet statSheet  = PlayerStatsComponent.FindBodyStatSheet(damageEvent.victim);
         StatSheet statSheet2 = PlayerStatsComponent.FindBodyStatSheet(damageEvent.attacker);
         if (statSheet != null)
         {
             statSheet.PushStatValue(StatDef.totalDamageTaken, statValue);
             if (damageEvent.attackerName != null)
             {
                 statSheet.PushStatValue(PerBodyStatDef.damageTakenFrom, damageEvent.attackerName, statValue);
             }
             if (damageEvent.victimName != null)
             {
                 statSheet.PushStatValue(PerBodyStatDef.damageTakenAs, damageEvent.victimName, statValue);
             }
         }
         if (statSheet2 != null)
         {
             statSheet2.PushStatValue(StatDef.totalDamageDealt, statValue);
             statSheet2.PushStatValue(StatDef.highestDamageDealt, statValue);
             if (damageEvent.attackerName != null)
             {
                 statSheet2.PushStatValue(PerBodyStatDef.damageDealtAs, damageEvent.attackerName, statValue);
             }
             if (damageEvent.victimName != null)
             {
                 statSheet2.PushStatValue(PerBodyStatDef.damageDealtTo, damageEvent.victimName, statValue);
             }
         }
     }
 }
コード例 #4
0
 // Token: 0x06001C7E RID: 7294 RVA: 0x00079B60 File Offset: 0x00077D60
 public static PlayerStatsComponent FindBodyStatsComponent(GameObject bodyObject)
 {
     if (!bodyObject)
     {
         return(null);
     }
     return(PlayerStatsComponent.FindBodyStatsComponent(bodyObject.GetComponent <CharacterBody>()));
 }
コード例 #5
0
        // Token: 0x06001D00 RID: 7424 RVA: 0x00087330 File Offset: 0x00085530
        public static void OnEquipmentActivated(EquipmentSlot activator, EquipmentIndex equipmentIndex)
        {
            StatSheet statSheet = PlayerStatsComponent.FindBodyStatSheet(activator.characterBody);

            if (statSheet == null)
            {
                return;
            }
            statSheet.PushStatValue(PerEquipmentStatDef.totalTimesFired.FindStatDef(equipmentIndex), 1UL);
        }
コード例 #6
0
        // Token: 0x06001C7D RID: 7293 RVA: 0x00079B4D File Offset: 0x00077D4D
        public static StatSheet FindMasterStatSheet(CharacterMaster master)
        {
            PlayerStatsComponent playerStatsComponent = PlayerStatsComponent.FindMasterStatsComponent(master);

            if (playerStatsComponent == null)
            {
                return(null);
            }
            return(playerStatsComponent.currentStats);
        }
コード例 #7
0
 // Token: 0x06001CFA RID: 7418 RVA: 0x00086F68 File Offset: 0x00085168
 private static void ProcessHealingEvents()
 {
     while (StatManager.healingEvents.Count > 0)
     {
         StatManager.HealingEvent healingEvent = StatManager.healingEvents.Dequeue();
         ulong     statValue = (ulong)healingEvent.healAmount;
         StatSheet statSheet = PlayerStatsComponent.FindBodyStatSheet(healingEvent.healee);
         if (statSheet != null)
         {
             statSheet.PushStatValue(StatDef.totalHealthHealed, statValue);
         }
     }
 }
コード例 #8
0
        private static void HandleStatsUpdate(NetworkMessage netMsg)
        {
            GameObject gameObject = netMsg.reader.ReadGameObject();

            if (gameObject)
            {
                PlayerStatsComponent component = gameObject.GetComponent <PlayerStatsComponent>();
                if (component)
                {
                    component.InstanceHandleStatsUpdate(netMsg.reader);
                }
            }
        }
コード例 #9
0
 private static void Init()
 {
     GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport)
     {
         if (NetworkServer.active)
         {
             PlayerStatsComponent playerStatsComponent = PlayerStatsComponent.FindBodyStatsComponent(damageReport.victim.gameObject);
             if (playerStatsComponent)
             {
                 playerStatsComponent.serverTransmitTimer = 0f;
             }
         }
     };
 }
コード例 #10
0
 // Token: 0x06001D04 RID: 7428 RVA: 0x000874B4 File Offset: 0x000856B4
 private static void ProcessItemCollectedEvents()
 {
     while (StatManager.itemCollectedEvents.Count > 0)
     {
         StatManager.ItemCollectedEvent itemCollectedEvent = StatManager.itemCollectedEvents.Dequeue();
         if (itemCollectedEvent.inventory)
         {
             PlayerStatsComponent component = itemCollectedEvent.inventory.GetComponent <PlayerStatsComponent>();
             StatSheet            statSheet = (component != null) ? component.currentStats : null;
             if (statSheet != null)
             {
                 statSheet.PushStatValue(StatDef.totalItemsCollected, (ulong)((long)itemCollectedEvent.quantity));
                 statSheet.PushStatValue(StatDef.highestItemsCollected, statSheet.GetStatValueULong(StatDef.totalItemsCollected));
                 statSheet.PushStatValue(PerItemStatDef.totalCollected.FindStatDef(itemCollectedEvent.itemIndex), (ulong)((long)itemCollectedEvent.quantity));
                 statSheet.PushStatValue(PerItemStatDef.highestCollected.FindStatDef(itemCollectedEvent.itemIndex), (ulong)((long)itemCollectedEvent.newCount));
             }
         }
     }
 }
コード例 #11
0
        // Token: 0x06001CF5 RID: 7413 RVA: 0x00086D30 File Offset: 0x00084F30
        private static void OnBodyFirstStart(CharacterBody body)
        {
            CharacterMaster master = body.master;

            if (master)
            {
                master.onBodyStart -= StatManager.OnBodyFirstStart;
                PlayerCharacterMasterController component = master.GetComponent <PlayerCharacterMasterController>();
                if (component)
                {
                    PlayerStatsComponent component2 = component.GetComponent <PlayerStatsComponent>();
                    if (component2)
                    {
                        StatSheet currentStats = component2.currentStats;
                        currentStats.PushStatValue(PerBodyStatDef.timesPicked.FindStatDef(body.name), 1UL);
                        currentStats.PushStatValue(StatDef.totalGamesPlayed, 1UL);
                    }
                }
            }
        }
コード例 #12
0
        // Token: 0x06001C7C RID: 7292 RVA: 0x00079B2A File Offset: 0x00077D2A
        public static StatSheet FindBodyStatSheet(CharacterBody characterBody)
        {
            if (characterBody == null)
            {
                return(null);
            }
            CharacterMaster master = characterBody.master;

            if (master == null)
            {
                return(null);
            }
            PlayerStatsComponent component = master.GetComponent <PlayerStatsComponent>();

            if (component == null)
            {
                return(null);
            }
            return(component.currentStats);
        }
コード例 #13
0
 // Token: 0x06001CFE RID: 7422 RVA: 0x0008719C File Offset: 0x0008539C
 private static void ProcessGoldEvents()
 {
     while (StatManager.goldCollectedEvents.Count > 0)
     {
         StatManager.GoldEvent goldEvent       = StatManager.goldCollectedEvents.Dequeue();
         CharacterMaster       characterMaster = goldEvent.characterMaster;
         StatSheet             statSheet;
         if (characterMaster == null)
         {
             statSheet = null;
         }
         else
         {
             PlayerStatsComponent component = characterMaster.GetComponent <PlayerStatsComponent>();
             statSheet = ((component != null) ? component.currentStats : null);
         }
         StatSheet statSheet2 = statSheet;
         if (statSheet2 != null)
         {
             statSheet2.PushStatValue(StatDef.goldCollected, goldEvent.amount);
             statSheet2.PushStatValue(StatDef.maxGoldCollected, statSheet2.GetStatValueULong(StatDef.goldCollected));
         }
     }
 }
コード例 #14
0
        // Token: 0x06001CFF RID: 7423 RVA: 0x0008720C File Offset: 0x0008540C
        public static void OnPurchase <T>(CharacterBody characterBody, CostType costType, T statDefsToIncrement) where T : IEnumerable <StatDef>
        {
            StatSheet statSheet = PlayerStatsComponent.FindBodyStatSheet(characterBody);

            if (statSheet == null)
            {
                return;
            }
            StatDef statDef  = null;
            StatDef statDef2 = null;

            switch (costType)
            {
            case CostType.Money:
                statDef  = StatDef.totalGoldPurchases;
                statDef2 = StatDef.highestGoldPurchases;
                break;

            case CostType.PercentHealth:
                statDef  = StatDef.totalBloodPurchases;
                statDef2 = StatDef.highestBloodPurchases;
                break;

            case CostType.Lunar:
                statDef  = StatDef.totalLunarPurchases;
                statDef2 = StatDef.highestLunarPurchases;
                break;

            case CostType.WhiteItem:
                statDef  = StatDef.totalTier1Purchases;
                statDef2 = StatDef.highestTier1Purchases;
                break;

            case CostType.GreenItem:
                statDef  = StatDef.totalTier2Purchases;
                statDef2 = StatDef.highestTier2Purchases;
                break;

            case CostType.RedItem:
                statDef  = StatDef.totalTier3Purchases;
                statDef2 = StatDef.highestTier3Purchases;
                break;
            }
            statSheet.PushStatValue(StatDef.totalPurchases, 1UL);
            statSheet.PushStatValue(StatDef.highestPurchases, statSheet.GetStatValueULong(StatDef.totalPurchases));
            if (statDef != null)
            {
                statSheet.PushStatValue(statDef, 1UL);
                if (statDef2 != null)
                {
                    statSheet.PushStatValue(statDef2, statSheet.GetStatValueULong(statDef));
                }
            }
            if (statDefsToIncrement != null)
            {
                foreach (StatDef statDef3 in statDefsToIncrement)
                {
                    if (statDef3 != null)
                    {
                        statSheet.PushStatValue(statDef3, 1UL);
                    }
                }
            }
        }
コード例 #15
0
 // Token: 0x06001CDB RID: 7387 RVA: 0x0007B78C File Offset: 0x0007998C
 private static void ProcessDeathEvents()
 {
     while (StatManager.deathEvents.Count > 0)
     {
         StatManager.DeathEvent deathEvent   = StatManager.deathEvents.Dequeue();
         DamageReport           damageReport = deathEvent.damageReport;
         StatSheet statSheet  = PlayerStatsComponent.FindMasterStatSheet(damageReport.victimMaster);
         StatSheet statSheet2 = PlayerStatsComponent.FindMasterStatSheet(damageReport.attackerMaster);
         StatSheet statSheet3 = PlayerStatsComponent.FindMasterStatSheet(damageReport.attackerOwnerMaster);
         if (statSheet != null)
         {
             statSheet.PushStatValue(StatDef.totalDeaths, 1UL);
             statSheet.PushStatValue(PerBodyStatDef.deathsAs, damageReport.victimBodyIndex, 1UL);
             if (damageReport.attackerBodyIndex != -1)
             {
                 statSheet.PushStatValue(PerBodyStatDef.deathsFrom, damageReport.attackerBodyIndex, 1UL);
             }
             if (damageReport.dotType != DotController.DotIndex.None)
             {
                 DotController.DotIndex dotType = damageReport.dotType;
                 if (dotType - DotController.DotIndex.Burn <= 2)
                 {
                     statSheet.PushStatValue(StatDef.totalBurnDeaths, 1UL);
                 }
             }
             if (deathEvent.victimWasBurning)
             {
                 statSheet.PushStatValue(StatDef.totalDeathsWhileBurning, 1UL);
             }
         }
         if (statSheet2 != null)
         {
             statSheet2.PushStatValue(StatDef.totalKills, 1UL);
             statSheet2.PushStatValue(PerBodyStatDef.killsAs, damageReport.attackerBodyIndex, 1UL);
             if (damageReport.victimBodyIndex != -1)
             {
                 statSheet2.PushStatValue(PerBodyStatDef.killsAgainst, damageReport.victimBodyIndex, 1UL);
                 if (damageReport.victimIsElite)
                 {
                     statSheet2.PushStatValue(StatDef.totalEliteKills, 1UL);
                     statSheet2.PushStatValue(PerBodyStatDef.killsAgainstElite, damageReport.victimBodyIndex, 1UL);
                 }
             }
         }
         if (statSheet3 != null)
         {
             statSheet3.PushStatValue(StatDef.totalMinionKills, 1UL);
             if (damageReport.attackerOwnerBodyIndex != -1)
             {
                 statSheet3.PushStatValue(PerBodyStatDef.minionKillsAs, damageReport.attackerOwnerBodyIndex, 1UL);
             }
         }
         if (damageReport.victimIsBoss)
         {
             int i     = 0;
             int count = PlayerStatsComponent.instancesList.Count;
             while (i < count)
             {
                 PlayerStatsComponent playerStatsComponent = PlayerStatsComponent.instancesList[i];
                 if (playerStatsComponent.characterMaster.alive)
                 {
                     playerStatsComponent.currentStats.PushStatValue(StatDef.totalTeleporterBossKillsWitnessed, 1UL);
                 }
                 i++;
             }
         }
     }
 }