public static void HandleAchievementDetailsRequestMessage(WorldClient client, AchievementDetailsRequestMessage message) { var template = Singleton <AchievementManager> .Instance.TryGetAchievement((uint)message.achievementId); if (template != null) { AchievementHandler.SendAchievementDetailsMessage(client, template.GetAchievement(client.Character.Achievement)); } }
public static void HandleAchievementDetailedListRequestMessage(WorldClient client, AchievementDetailedListRequestMessage message) { var category = Singleton <AchievementManager> .Instance.TryGetAchievementCategory(message.categoryId); if (category != null) { AchievementHandler.SendAchievementDetailedListMessage(client, new Achievement[0], client.Character.Achievement.TryGetFinishedAchievements(category)); } }
public static void HandleStartupActionsAllAttributionMessage(WorldClient client, StartupActionsAllAttributionMessage message) { if (client.LastMessage is AchievementRewardRequestMessage) { client.Character.Achievement.RewardAllAchievements(new Action <AchievementTemplate, bool>((achievement, success) => { if (success) { AchievementHandler.SendAchievementRewardSuccessMessage(client, (short)achievement.Id); } else { AchievementHandler.SendAchievementRewardErrorMessage(client, (short)achievement.Id); } })); } }
public static void HandleAchievementRewardRequestMessage(WorldClient client, AchievementRewardRequestMessage message) { if (message.achievementId > 0) { var achievement = client.Character.Achievement.TryGetFinishedAchievement(message.achievementId); if (achievement != null) { int experience; int guildExperience; if (client.Character.Achievement.RewardAchievement(achievement, out experience, out guildExperience)) { AchievementHandler.SendAchievementRewardSuccessMessage(client, (short)message.achievementId); if (experience > 0) { client.Character.AddExperience(experience); } else { experience = 0; } if (client.Character.GuildMember != null && guildExperience > 0) { client.Character.GuildMember.AddXP(guildExperience); } else { guildExperience = 0; } CharacterHandler.SendCharacterExperienceGainMessage(client, (ulong)experience, 0L, (ulong)guildExperience, 0L); } else { AchievementHandler.SendAchievementRewardErrorMessage(client, (short)message.achievementId); } } else { AchievementHandler.SendAchievementRewardErrorMessage(client, (short)message.achievementId); } } }