public static void ApplySuicideBuff(TriggerBuff buff, BuffTriggerType trigger, object token)
        {
            var target = buff.Target as SummonedMonster;

            InventoryHandler.SendSpellListMessage(target.Summoner.CharacterContainer.Clients.FirstOrDefault(), true);
            ShortcutHandler.SendShortcutBarContentMessage(target.Summoner.CharacterContainer.Clients.FirstOrDefault(), ShortcutBarEnum.SPELL_SHORTCUT_BAR);
            //ContextHandler.SendSlaveSwitchContextMessage(buff.Target.s);
            target.Die();
        }
        public static void CommonCharacterBasicInformations(WorldClient client)
        {
            CharacterHandler.SendCharacterSelectedSuccessMessage(client);
            ContextHandler.SendNotificationListMessage(client, new int[] { 2147483647 });
            InventoryHandler.SendInventoryContentMessage(client);
            ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR);
            ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.SPELL_SHORTCUT_BAR);
            ContextRoleplayHandler.SendEmoteListMessage(client, (
                                                            from entry in Enumerable.Range(0, 21)
                                                            select(byte) entry).ToList <byte>());

            PvPHandler.SendAlignmentRankUpdateMessage(client);
            if (client.Character.Guild != null)
            {
                GuildHandler.SendGuildMembershipMessage(client, client.Character.GuildMember);
                GuildHandler.SendGuildInformationsGeneralMessage(client, client.Character.Guild);
                GuildHandler.SendGuildInformationsMembersMessage(client, client.Character.Guild);
                if (client.Character.Guild.Alliance != null)
                {
                    AllianceHandler.SendAllianceMembershipMessage(client, client.Character.Guild.Alliance);
                    AllianceHandler.SendAllianceInsiderInfoMessage(client, client.Character.Guild.Alliance);
                }
            }
            ChatHandler.SendEnabledChannelsMessage(client, new sbyte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13 }, new sbyte[0]);
            InventoryHandler.SendSpellListMessage(client, true);
            InitializationHandler.SendSetCharacterRestrictionsMessage(client);
            InventoryHandler.SendInventoryWeightMessage(client);
            FriendHandler.SendFriendWarnOnConnectionStateMessage(client, client.Character.FriendsBook.WarnOnConnection);
            FriendHandler.SendFriendWarnOnLevelGainStateMessage(client, client.Character.FriendsBook.WarnOnLevel);
            GuildHandler.SendGuildMemberWarnOnConnectionStateMessage(client, client.Character.WarnOnGuildConnection);
            AchievementHandler.SendAchievementListMessage(client, client.Character.Record.FinishedAchievements, client.Character.Achievement.GetRewardableAchievements());
            client.Character.SendConnectionMessages();
            ContextRoleplayHandler.SendGameRolePlayArenaUpdatePlayerInfosMessage(client);
            CharacterHandler.SendCharacterCapabilitiesMessage(client);

            client.WorldAccount.LastConnection     = new System.DateTime?(System.DateTime.Now);
            client.WorldAccount.LastIp             = client.IP;
            client.WorldAccount.ConnectedCharacter = new int?(client.Character.Id);

            client.Character.Record.LastUsage = new System.DateTime?(System.DateTime.Now);
            ServerBase <WorldServer> .Instance.DBAccessor.Database.Update(client.WorldAccount);

            ServerBase <WorldServer> .Instance.DBAccessor.Database.Update(client.Character.Record);
        }
Пример #3
0
        public static void CommonCharacterSelection(WorldClient client, CharacterRecord character)
        {
            if (character.IsDeleted)
            {
                return;
            }

            // Check if we also have a world account
            if (client.WorldAccount == null)
            {
                var account = AccountManager.Instance.FindById(client.Account.Id) ??
                              AccountManager.Instance.CreateWorldAccount(client);
                client.WorldAccount = account;
            }

            // update tokens
            if (client.WorldAccount.Tokens + client.WorldAccount.NewTokens <= 0)
            {
                client.WorldAccount.Tokens = 0;
            }
            else
            {
                client.WorldAccount.Tokens += client.WorldAccount.NewTokens;
            }

            client.WorldAccount.NewTokens = 0;

            client.Character = new Character(character, client);
            client.Character.LoadRecord();

            ContextHandler.SendNotificationListMessage(client, new[] { 0x7FFFFFFF });
            BasicHandler.SendBasicTimeMessage(client);

            SendCharacterSelectedSuccessMessage(client);

            if (client.Character.Inventory.Presets.Any())
            {
                InventoryHandler.SendInventoryContentAndPresetMessage(client);
            }
            else
            {
                InventoryHandler.SendInventoryContentMessage(client);
            }

            ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.GENERAL_SHORTCUT_BAR);

            ContextRoleplayHandler.SendEmoteListMessage(client, client.Character.Emotes.Select(x => (byte)x));

            // Jobs
            ContextRoleplayHandler.SendJobDescriptionMessage(client, client.Character);
            ContextRoleplayHandler.SendJobExperienceMultiUpdateMessage(client, client.Character);
            ContextRoleplayHandler.SendJobCrafterDirectorySettingsMessage(client, client.Character);

            PvPHandler.SendAlignmentRankUpdateMessage(client, client.Character);

            ChatHandler.SendEnabledChannelsMessage(client, new sbyte[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13 }, new sbyte[] { });
            ChatHandler.SendChatSmileyExtraPackListMessage(client, client.Character.SmileyPacks.ToArray());

            InventoryHandler.SendSpellListMessage(client, true);
            ShortcutHandler.SendShortcutBarContentMessage(client, ShortcutBarEnum.SPELL_SHORTCUT_BAR);

            InitializationHandler.SendSetCharacterRestrictionsMessage(client, client.Character);

            InventoryHandler.SendInventoryWeightMessage(client);

            FriendHandler.SendFriendWarnOnConnectionStateMessage(client, client.Character.FriendsBook.WarnOnConnection);
            FriendHandler.SendFriendWarnOnLevelGainStateMessage(client, client.Character.FriendsBook.WarnOnLevel);
            GuildHandler.SendGuildMemberWarnOnConnectionStateMessage(client, client.Character.WarnOnGuildConnection);

            //Guild
            if (client.Character.GuildMember != null)
            {
                GuildHandler.SendGuildMembershipMessage(client, client.Character.GuildMember);
            }

            //Mount
            if (client.Character.EquippedMount != null)
            {
                MountHandler.SendMountSetMessage(client, client.Character.EquippedMount.GetMountClientData());
                MountHandler.SendMountXpRatioMessage(client, client.Character.EquippedMount.GivenExperience);

                if (client.Character.IsRiding)
                {
                    MountHandler.SendMountRidingMessage(client, client.Character.IsRiding);
                }
            }

            client.Character.SendConnectionMessages();

            //Don't know why ?
            ActionsHandler.SendSequenceNumberRequestMessage(client);

            //Start Cinematic
            if ((DateTime.Now - client.Character.Record.CreationDate).TotalSeconds <= 30)
            {
                BasicHandler.SendCinematicMessage(client, 10);
            }

            ContextRoleplayHandler.SendGameRolePlayArenaUpdatePlayerInfosMessage(client, client.Character);

            SendCharacterCapabilitiesMessage(client);

            ContextRoleplayHandler.SendAlmanachCalendarDateMessage(client);

            //Loading complete
            SendCharacterLoadingCompleteMessage(client);

            BasicHandler.SendServerExperienceModificatorMessage(client);

            // Update LastConnection and Last Ip
            client.WorldAccount.LastConnection     = DateTime.Now;
            client.WorldAccount.LastIp             = client.IP;
            client.WorldAccount.ConnectedCharacter = character.Id;

            WorldServer.Instance.DBAccessor.Database.Execute(string.Format(WorldAccountRelator.UpdateNewTokens, 0));
            WorldServer.Instance.DBAccessor.Database.Update(client.WorldAccount);
        }