Exemplo n.º 1
0
        public static void AddMastery(GameSession session, FishMetadata fish, bool newFish)
        {
            if (newFish)
            {
                int exp = fish.Rarity * 2;
                session.Player.Levels.GainMasteryExp(MasteryType.Fishing, exp);
                session.Send(FishingPacket.IncreaseMastery(MasteryType.Fishing, fish.Id, exp));
                return;
            }

            int                 expChance;
            Random              rnd         = new Random();
            MasteryExp          masteryExp  = session.Player.Levels.MasteryExp.FirstOrDefault(x => x.Type == MasteryType.Fishing);
            FishingSpotMetadata fishingSpot = FishingSpotMetadataStorage.GetMetadata(session.Player.MapId);

            if (masteryExp.CurrentExp > fishingSpot.MaxMastery)
            {
                expChance = rnd.Next(0, 200); // decrease chance of gaining mastery by half
            }
            else
            {
                expChance = rnd.Next(0, 100);
            }

            if (expChance <= 10)
            {
                int exp = rnd.Next(1, 3);
                session.Player.Levels.GainMasteryExp(MasteryType.Fishing, exp);
                session.Send(FishingPacket.IncreaseMastery(MasteryType.Fishing, fish.Id, exp));
            }
        }
Exemplo n.º 2
0
        public void GainMasteryExp(MasteryType type, long amount)
        {
            MasteryExp masteryExp = MasteryExp.FirstOrDefault(x => x.Type == (byte)type);

            if (masteryExp == null) // add mastery to list
            {
                MasteryExp.Add(new MasteryExp(type, amount));
                Player.Session.Send(MasteryPacket.SetExp(type, amount));
            }
            else
            {
                // user already has some exp in mastery, so simply update it
                Player.Session.Send(MasteryPacket.SetExp(type, masteryExp.CurrentExp += amount));
            }
        }
Exemplo n.º 3
0
        public void GainMasteryExp(MasteryType type, long amount)
        {
            MasteryExp masteryExp = MasteryExp.FirstOrDefault(x => x.Type == type);

            if (masteryExp == null) // add mastery to list
            {
                masteryExp = new MasteryExp(type);
                MasteryExp.Add(masteryExp);
            }
            if (amount <= 0)
            {
                return;
            }
            // user already has some exp in mastery, so simply update it
            Player.Session.Send(MasteryPacket.SetExp(type, masteryExp.CurrentExp += amount));
            int currLevel = MasteryMetadataStorage.GetGradeFromXP(type, masteryExp.CurrentExp);

            if (currLevel > masteryExp.Level)
            {
                masteryExp.Level = currLevel;
                switch (type)
                {
                case MasteryType.Mining:
                    Player.TrophyUpdate(23100238, 1);
                    Player.TrophyUpdate(23100239, 1);
                    Player.TrophyUpdate(23100240, 1);
                    Player.TrophyUpdate(23100241, 1);
                    Player.TrophyUpdate(23100330, 1);
                    break;

                case MasteryType.Foraging:
                    Player.TrophyUpdate(23100257, 1);
                    Player.TrophyUpdate(23100258, 1);
                    Player.TrophyUpdate(23100259, 1);
                    Player.TrophyUpdate(23100260, 1);
                    Player.TrophyUpdate(23100334, 1);
                    break;

                case MasteryType.Ranching:
                    Player.TrophyUpdate(23100242, 1);
                    Player.TrophyUpdate(23100243, 1);
                    Player.TrophyUpdate(23100244, 1);
                    Player.TrophyUpdate(23100245, 1);
                    Player.TrophyUpdate(23100331, 1);
                    break;

                case MasteryType.Farming:
                    Player.TrophyUpdate(23100261, 1);
                    Player.TrophyUpdate(23100262, 1);
                    Player.TrophyUpdate(23100263, 1);
                    Player.TrophyUpdate(23100264, 1);
                    Player.TrophyUpdate(23100335, 1);
                    break;

                case MasteryType.Smithing:
                    Player.TrophyUpdate(23100246, 1);
                    Player.TrophyUpdate(23100247, 1);
                    Player.TrophyUpdate(23100248, 1);
                    Player.TrophyUpdate(23100249, 1);
                    Player.TrophyUpdate(23100332, 1);
                    break;

                case MasteryType.Handicraft:
                    Player.TrophyUpdate(23100250, 1);
                    Player.TrophyUpdate(23100251, 1);
                    Player.TrophyUpdate(23100252, 1);
                    Player.TrophyUpdate(23100253, 1);
                    Player.TrophyUpdate(23100333, 1);
                    break;

                case MasteryType.Alchemy:
                    Player.TrophyUpdate(23100265, 1);
                    Player.TrophyUpdate(23100266, 1);
                    Player.TrophyUpdate(23100267, 1);
                    Player.TrophyUpdate(23100268, 1);
                    Player.TrophyUpdate(23100336, 1);
                    break;

                case MasteryType.Cooking:
                    Player.TrophyUpdate(23100269, 1);
                    Player.TrophyUpdate(23100270, 1);
                    Player.TrophyUpdate(23100271, 1);
                    Player.TrophyUpdate(23100272, 1);
                    Player.TrophyUpdate(23100337, 1);
                    break;

                case MasteryType.PetTaming:
                    Player.TrophyUpdate(23100273, 1);
                    break;

                default:
                    break;
                }
            }
        }