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);
                }
            }
        }