Exemplo n.º 1
0
        // Token: 0x060000E8 RID: 232 RVA: 0x00003D8C File Offset: 0x00001F8C
        public static FameStats Read(byte[] statsData)
        {
            FameStats  fameStats  = new FameStats();
            ByteBuffer byteBuffer = new ByteBuffer(statsData, 0, statsData.Length);

            while (!byteBuffer.IsEnd)
            {
                byte key = byteBuffer.ReadByte();
                FameStats.statList[key].Item2(fameStats, (int)byteBuffer.ReadUInt32());
            }
            return(fameStats);
        }
Exemplo n.º 2
0
        // Token: 0x060000EB RID: 235 RVA: 0x00004070 File Offset: 0x00002270
        static FameStats()
        {
            // Note: this type is marked as 'beforefieldinit'.
            Dictionary <byte, Tuple <Func <FameStats, int>, Action <FameStats, int> > > dictionary = new Dictionary <byte, Tuple <Func <FameStats, int>, Action <FameStats, int> > >();

            dictionary.Add(0, FameStats.Entry((FameStats s) => s.Shots, delegate(FameStats s, int val)
            {
                s.Shots = val;
            }));
            dictionary.Add(1, FameStats.Entry((FameStats s) => s.ShotsThatDamage, delegate(FameStats s, int val)
            {
                s.ShotsThatDamage = val;
            }));
            dictionary.Add(2, FameStats.Entry((FameStats s) => s.SpecialAbilityUses, delegate(FameStats s, int val)
            {
                s.SpecialAbilityUses = val;
            }));
            dictionary.Add(3, FameStats.Entry((FameStats s) => s.TilesUncovered, delegate(FameStats s, int val)
            {
                s.TilesUncovered = val;
            }));
            dictionary.Add(4, FameStats.Entry((FameStats s) => s.Teleports, delegate(FameStats s, int val)
            {
                s.Teleports = val;
            }));
            dictionary.Add(5, FameStats.Entry((FameStats s) => s.PotionsDrunk, delegate(FameStats s, int val)
            {
                s.PotionsDrunk = val;
            }));
            dictionary.Add(6, FameStats.Entry((FameStats s) => s.MonsterKills, delegate(FameStats s, int val)
            {
                s.MonsterKills = val;
            }));
            dictionary.Add(7, FameStats.Entry((FameStats s) => s.MonsterAssists, delegate(FameStats s, int val)
            {
                s.MonsterAssists = val;
            }));
            dictionary.Add(8, FameStats.Entry((FameStats s) => s.GodKills, delegate(FameStats s, int val)
            {
                s.GodKills = val;
            }));
            dictionary.Add(9, FameStats.Entry((FameStats s) => s.GodAssists, delegate(FameStats s, int val)
            {
                s.GodAssists = val;
            }));
            dictionary.Add(10, FameStats.Entry((FameStats s) => s.CubeKills, delegate(FameStats s, int val)
            {
                s.CubeKills = val;
            }));
            dictionary.Add(11, FameStats.Entry((FameStats s) => s.OryxKills, delegate(FameStats s, int val)
            {
                s.OryxKills = val;
            }));
            dictionary.Add(12, FameStats.Entry((FameStats s) => s.QuestsCompleted, delegate(FameStats s, int val)
            {
                s.QuestsCompleted = val;
            }));
            dictionary.Add(13, FameStats.Entry((FameStats s) => s.PirateCavesCompleted, delegate(FameStats s, int val)
            {
                s.PirateCavesCompleted = val;
            }));
            dictionary.Add(14, FameStats.Entry((FameStats s) => s.UndeadLairsCompleted, delegate(FameStats s, int val)
            {
                s.UndeadLairsCompleted = val;
            }));
            dictionary.Add(15, FameStats.Entry((FameStats s) => s.AbyssOfDemonsCompleted, delegate(FameStats s, int val)
            {
                s.AbyssOfDemonsCompleted = val;
            }));
            dictionary.Add(16, FameStats.Entry((FameStats s) => s.SnakePitsCompleted, delegate(FameStats s, int val)
            {
                s.SnakePitsCompleted = val;
            }));
            dictionary.Add(17, FameStats.Entry((FameStats s) => s.SpiderDensCompleted, delegate(FameStats s, int val)
            {
                s.SpiderDensCompleted = val;
            }));
            dictionary.Add(18, FameStats.Entry((FameStats s) => s.SpriteWorldsCompleted, delegate(FameStats s, int val)
            {
                s.SpriteWorldsCompleted = val;
            }));
            dictionary.Add(19, FameStats.Entry((FameStats s) => s.LevelUpAssists, delegate(FameStats s, int val)
            {
                s.LevelUpAssists = val;
            }));
            dictionary.Add(20, FameStats.Entry((FameStats s) => s.MinutesActive, delegate(FameStats s, int val)
            {
                s.MinutesActive = val;
            }));
            dictionary.Add(21, FameStats.Entry((FameStats s) => s.TombsCompleted, delegate(FameStats s, int val)
            {
                s.TombsCompleted = val;
            }));
            dictionary.Add(22, FameStats.Entry((FameStats s) => s.TrenchesCompleted, delegate(FameStats s, int val)
            {
                s.TrenchesCompleted = val;
            }));
            dictionary.Add(23, FameStats.Entry((FameStats s) => s.JunglesCompleted, delegate(FameStats s, int val)
            {
                s.JunglesCompleted = val;
            }));
            dictionary.Add(24, FameStats.Entry((FameStats s) => s.ManorsCompleted, delegate(FameStats s, int val)
            {
                s.ManorsCompleted = val;
            }));
            FameStats.statList = dictionary;
        }
Exemplo n.º 3
0
        public static FameStats CalculateStats(AccountModel acc, CharacterModel character, string killer = "")
        {
            int baseFame  = character.Fame;
            int totalFame = baseFame;

            FameStats stats = new FameStats
            {
                BaseFame = baseFame,
                Bonuses  = new List <FameBonus>()
            }; ClassStatsInfo classStats = acc.Stats.GetClassStats(character.ClassType);

            //Ancestor
            if (acc.Stats.GetClassStats(character.ClassType).BestLevel == 0)
            {
                int bonus = (int)(baseFame * .2f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Ancestor", Fame = bonus
                });
            }

            //First Born
            if (acc.Stats.BestCharFame < baseFame)
            {
                int bonus = (int)(baseFame * .2f);
                totalFame += bonus;
                acc.Stats.BestCharFame = baseFame;
                stats.Bonuses.Add(new FameBonus {
                    Name = "First Born", Fame = bonus
                });
            }

            //Pacifist
            if (character.FameStats.DamageDealt == 0 && character.Level == 20)
            {
                int bonus = (int)(baseFame * .25f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Pacifist", Fame = bonus
                });
            }

            //Thirsty
            if (character.FameStats.PotionsDrank == 0 && character.Level == 20)
            {
                int bonus = (int)(baseFame * .25f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Thirsty", Fame = bonus
                });
            }

            //Mundane
            if (character.FameStats.AbilitiesUsed == 0 && character.Level == 20)
            {
                int bonus = (int)(baseFame * .25f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Mundane", Fame = bonus
                });
            }

            //Boots On The Ground
            if (character.FameStats.Teleports == 0 && character.Level == 20)
            {
                int bonus = (int)(baseFame * .25f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Boots On The Ground", Fame = bonus
                });
            }

            //Tunnel Rat
            if (character.FameStats.PirateCavesCompleted >= 1 &&
                character.FameStats.AbyssOfDemonsCompleted >= 1 &&
                character.FameStats.SnakePitsCompleted >= 1 &&
                character.FameStats.SpiderDensCompleted >= 1 &&
                character.FameStats.SpriteWorldsCompleted >= 1 &&
                character.FameStats.TombsCompleted >= 1 &&
                character.FameStats.UndeadLairsCompleted >= 1)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Tunnel Rat", Fame = bonus
                });
            }

            //Dungeon Master
            if (character.FameStats.PirateCavesCompleted >= 20 &&
                character.FameStats.AbyssOfDemonsCompleted >= 20 &&
                character.FameStats.SnakePitsCompleted >= 20 &&
                character.FameStats.SpiderDensCompleted >= 20 &&
                character.FameStats.SpriteWorldsCompleted >= 20 &&
                character.FameStats.TombsCompleted >= 20 &&
                character.FameStats.UndeadLairsCompleted >= 20)
            {
                int bonus = (int)(baseFame * .2f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Dungeon Master", Fame = bonus
                });
            }

            //Enemy Of The Gods
            if (((float)character.FameStats.GodKills / character.FameStats.MonsterKills) >= 0.1f)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Enemy Of The Gods", Fame = bonus
                });
            }

            //Slayer Of The Gods
            if (((float)character.FameStats.GodKills / character.FameStats.MonsterKills) >= 0.5f)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Slayer Of The Gods", Fame = bonus
                });
            }

            //Oryx Slayer
            if (character.FameStats.OryxKills >= 1)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Oryx Slayer", Fame = bonus
                });
            }

            //Dominator Of Realms
            if (character.FameStats.OryxKills >= 1000)
            {
                int bonus = (int)(baseFame * .25f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Dominator Of Realms", Fame = bonus
                });
            }

            //Accurate
            if (((float)character.FameStats.ShotsThatDamage / character.FameStats.Shots) >= .25f)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Accurate", Fame = bonus
                });
            }

            //Sharpshooter
            if (((float)character.FameStats.ShotsThatDamage / character.FameStats.Shots) >= .5f)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Sharpshooter", Fame = bonus
                });
            }

            //Sniper
            if (((float)character.FameStats.ShotsThatDamage / character.FameStats.Shots) >= .75f)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Sniper", Fame = bonus
                });
            }

            //Explorer
            if (character.FameStats.TilesUncovered >= 1000000)
            {
                int bonus = (int)(baseFame * .05f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Explorer", Fame = bonus
                });
            }

            //Cartographer
            if (character.FameStats.TilesUncovered >= 4000000)
            {
                int bonus = (int)(baseFame * .05f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Cartographer", Fame = bonus
                });
            }

            //Pathfinder
            if (character.FameStats.TilesUncovered >= 20000000)
            {
                int bonus = (int)(baseFame * .05f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Pathfinder", Fame = bonus
                });
            }

            //Team Player
            if (character.FameStats.LevelUpAssists >= 100)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Team Player", Fame = bonus
                });
            }

            //Leader Of Men
            if (character.FameStats.LevelUpAssists >= 1000)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Leader Of Men", Fame = bonus
                });
            }

            //Friend Of The Cubes
            if (character.FameStats.CubeKills == 0 && character.Level == 20)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Friend Of The Cubes", Fame = bonus
                });
            }

            //Careless
            if (character.FameStats.DamageTaken >= 100000)
            {
                int bonus = (int)(baseFame * .05f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Careless", Fame = bonus
                });
            }

            //Expert Manoeuvres
            if (character.FameStats.DamageTaken == 0 && character.Level == 20)
            {
                int bonus = (int)(baseFame * .5f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Expert Manoeuvres", Fame = bonus
                });
            }

            //Beginner's Luck
            if (character.FameStats.NearDeathEscapes >= 1)
            {
                int bonus = (int)(baseFame * .05f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Beginner's Luck", Fame = bonus
                });
            }

            //Living On The Edge
            if (character.FameStats.NearDeathEscapes >= 50)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Living On The Edge", Fame = bonus
                });
            }

            //Living In The Nexus
            if (character.FameStats.Escapes >= 1000)
            {
                int bonus = (int)(baseFame * .05f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Living In The Nexus", Fame = bonus
                });
            }

            //Seal The Deal
            if (((float)character.FameStats.MonsterKills / (character.FameStats.MonsterKills + character.FameStats.MonsterAssists) >= 0.5f) && character.Level == 20)
            {
                int bonus = (int)(baseFame * .1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Seal The Deal", Fame = bonus
                });
            }

            //Realm Riches
            if (character.FameStats.WhiteBags >= 100)
            {
                int bonus = (int)(baseFame * .15f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Realm Riches", Fame = bonus
                });
            }

            //Devil's Advocate
            if (character.FameStats.AbyssOfDemonsCompleted >= 1000 &&
                character.FameStats.CubeKills >= 50000 &&
                character.FameStats.OryxKills >= 666 &&
                killer == "Lava")
            {
                int bonus = (int)(baseFame * 1f);
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Devil's Advocate", Fame = bonus
                });
            }

            //Well Equipped
            int wellEquipped = 0;

            for (int k = 0; k < 4; k++)
            {
                if (character.Inventory[k] != -1)
                {
                    wellEquipped += Resources.Type2Item[(ushort)character.Inventory[k]].FameBonus;
                    wellEquipped += (int)ItemDesc.GetStat(character.ItemDatas[k], ItemData.FameBonus, 1);
                }
            }
            if (wellEquipped > 0)
            {
                int bonus = (int)(baseFame * (wellEquipped / 100.0f));
                totalFame += bonus;
                stats.Bonuses.Add(new FameBonus {
                    Name = "Well Equipped", Fame = bonus
                });
            }

            stats.TotalFame = totalFame;
            return(stats);
        }
Exemplo n.º 4
0
        public static void Death(string killer, AccountModel acc, CharacterModel character)
        {
#if DEBUG
            if (character == null)
            {
                throw new Exception("Undefined character model");
            }
#endif
            acc.AliveChars.Remove(character.Id);
            if (acc.DeadChars.Count == AccountModel.MaxDeadCharsStored)
            {
                acc.DeadChars.RemoveAt(AccountModel.MaxDeadCharsStored - 1);
            }
            acc.DeadChars.Insert(0, character.Id);

            int deathTime = UnixTime();
            int baseFame  = character.Fame;
            int totalFame = character.Fame;

            XElement fame = new XElement("Fame");
            XElement ce   = character.ExportFame();
            ce.Add(new XAttribute("id", character.Id));
            ce.Add(new XElement("Account", new XElement("Name", acc.Name)));
            fame.Add(ce);
            character.FameStats.ExportTo(fame);

            ClassStatsInfo classStats = acc.Stats.GetClassStats(character.ClassType);
            FameStats      fameStats  = CalculateStats(acc, character, killer);
            totalFame = fameStats.TotalFame;
            foreach (FameBonus bonus in fameStats.Bonuses)
            {
                fame.Add(new XElement("Bonus", new XAttribute("id", bonus.Name), bonus.Fame));
            }

            fame.Add(new XElement("CreatedOn", character.CreationTime));
            fame.Add(new XElement("KilledOn", deathTime));
            fame.Add(new XElement("KilledBy", killer));
            fame.Add(new XElement("BaseFame", baseFame));
            fame.Add(new XElement("TotalFame", totalFame));

            if (classStats.BestFame < baseFame)
            {
                classStats.BestFame = baseFame;
            }

            if (classStats.BestLevel < character.Level)
            {
                classStats.BestLevel = character.Level;
            }


            character.Dead      = true;
            character.DeathTime = UnixTime();
            character.DeathFame = totalFame;
            character.Save();

            acc.Stats.Fame         += totalFame;
            acc.Stats.TotalCredits += totalFame;
            acc.Save();

            if (character.Fame >= MinFameRequiredToEnterLegends)
            {
                PushLegend(acc.Id, character.Id, totalFame, deathTime);
            }

            CreateKey($"death.{acc.Id}.{character.Id}", fame.ToString());
        }