public static void OnGainMasteryLevel(Player player, MasteryType masteryExpType)
    {
        IEnumerable <TrophyMetadata> masteryTrophies = GetRelevantTrophies(TrophyTypes.MasteryGrade)
                                                       .Concat(GetRelevantTrophies(TrophyTypes.SetMasteryGrade))
                                                       .Where(t => ConditionHelper.IsMatching(t.ConditionCodes, (byte)masteryExpType));

        UpdateMatchingTrophies(player, masteryTrophies, 1);
    }
        public static Packet IncreaseMastery(MasteryType type, int fishId, int exp)
        {
            PacketWriter pWriter = PacketWriter.Of(SendOp.FISHING);

            pWriter.WriteEnum(FishingPacketMode.IncreaseMastery);
            pWriter.WriteInt(fishId);
            pWriter.WriteInt(exp);
            pWriter.WriteInt((int)type);
            return(pWriter);
        }
    public static PacketWriter SetExp(MasteryType type, long totalExp)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.MASTERY);

        pWriter.Write(MasteryMode.SetMasteryExp);
        pWriter.Write(type);
        pWriter.WriteLong(totalExp);

        return(pWriter);
    }
    public static PacketWriter GetCraftedItem(MasteryType type, Item item)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.MASTERY);

        pWriter.Write(MasteryMode.GetCraftedItem);
        pWriter.WriteShort((short)type);
        pWriter.WriteInt(item.Amount);
        pWriter.WriteInt(item.Id);
        pWriter.WriteShort((short)item.Rarity);
        return(pWriter);
    }
Beispiel #5
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));
            }
        }
Beispiel #6
0
    public void GainMasteryExp(MasteryType type, long amount)
    {
        MasteryExp masteryExp = MasteryExp.FirstOrDefault(x => x.Type == type);

        if (masteryExp == null || amount <= 0)
        {
            return;
        }

        // user already has some exp in mastery, so simply update it
        Session.Send(MasteryPacket.SetExp(type, masteryExp.CurrentExp += amount));
        int currLevel = MasteryMetadataStorage.GetGradeFromXP(type, masteryExp.CurrentExp);

        if (currLevel <= masteryExp.Level)
        {
            return;
        }

        masteryExp.Level = currLevel;
        TrophyManager.OnGainMasteryLevel(Player, masteryExp.Type);
    }
Beispiel #7
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;
                }
            }
        }
Beispiel #8
0
 public MasteryExp(MasteryType type, int level = 0, long currentExp = 0)
 {
     Type       = type;
     Level      = level;
     CurrentExp = currentExp;
 }
 public static int GetGradeFromXP(MasteryType type, long xp)
 {
     return(GetMastery((int)type).Grades.Count(x => x.Value <= xp));
 }
Beispiel #10
0
 public Mastery(int _level, MasteryType _type)
 {
     Level = _level;
     Type = _type;
 }
Beispiel #11
0
 public MasteryExp(MasteryType type, long currentExp)
 {
     Type       = type;
     CurrentExp = currentExp;
 }