private void HandleRewardBox(GameSession session, PacketReader packet) { int rewardBoxDetails = packet.ReadInt(); int type = rewardBoxDetails / 1000; int grade = rewardBoxDetails % 100; // get the reward box item ID MasteryMetadata mastery = MasteryMetadataStorage.GetMastery(type); if (mastery == null) { Logger.LogError($"Unknown mastery type {type} from user: {session.Player.Name}"); return; } int rewardBoxItemId = mastery.Grades[grade - 1].RewardJobItemID; Item rewardBox = new Item(rewardBoxItemId) { Amount = 1 }; // give player the reward box item InventoryController.Add(session, rewardBox, true); // mark reward box as claimed session.Send(MasteryPacket.ClaimReward(rewardBoxDetails, 1, (int)rewardBoxItemId)); }
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); }
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; } } }