コード例 #1
0
        void c_ClientChannelChangeInfo(object sender, ClientChannelChangeEventArgs e)
        {
            Client            c   = (Client)sender;
            ChannelChangeInfo cci = e.Info;

            Client[] nearbyClients = GetNearByClients(c, false);

            switch (cci.Something2)
            {
            case 1:
                byte[] bufferSendChannelChange = PacketManager.SendChannelChange(cci.Something, cci.Something2);
                c.Send(bufferSendChannelChange);

                byte[] bufferRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter);
                SendSpecific(nearbyClients, bufferRemoveCharacter);
                break;

            case 0:
                accountManager.ExitGame(c.AccountID);

                bufferRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter);
                SendSpecific(nearbyClients, bufferRemoveCharacter);
                break;
            }
        }
コード例 #2
0
        void c_ClientChannelChangeInfo(object sender, ClientChannelChangeEventArgs e)
        {
            Client c = (Client)sender;
            ChannelChangeInfo cci = e.Info;

            Client[] nearbyClients = GetNearByClients(c, false);

            switch (cci.Something2)
            {
                case 1:
                    byte[] bufferSendChannelChange = PacketManager.SendChannelChange(cci.Something, cci.Something2);
                    c.Send(bufferSendChannelChange);

                    byte[] bufferRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter);
                    SendSpecific(nearbyClients, bufferRemoveCharacter);
                    break;

                case 0:
                    accountManager.ExitGame(c.AccountID);

                    bufferRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter);
                    SendSpecific(nearbyClients, bufferRemoveCharacter);
                    break;
            }
        }
コード例 #3
0
        void c_ClientChannelChangeInfo(object sender, ClientChannelChangeEventArgs e)
        {
            Client c = (Client)sender;
            ChannelChangeInfo cci = e.Info;

            if (c.MyCharacter != null && c.MyCharacter.Online)
            {
                MapEngine mapEngine = GetMapEngine(c.MyCharacter.MapId);
                Client[] clients = GetClientsForChars(mapEngine.GetCharactersInRange(c.MyCharacter.Position, 150).ToArray());

                switch (cci.Something2)
                {
                    case 1:
                        c.MyCharacter.Online = false;
                        mapEngine.ActiveClientEntities.Remove(c.MyCharacter);
                        UpdateFriendsStatus(c);
                        if (c.MyCharacter.Guild != null)
                        {
                            GuildMember g = c.MyCharacter.Guild.Members.Single(x => x.Character.CharacterId == c.MyCharacter.CharacterId);
                            g.Online = false;
                            SendToGuild(c.MyCharacter.Guild, PacketManager.SendGuildMemberInfo(g));
                        }
                        if (c.MyCharacter.Party != null)
                        {
                            LeavePartyInfo i = new LeavePartyInfo
                            {
                                PartyID = c.MyCharacter.Party.PartyID
                            };

                            ClientLeaveParty(c);
                        }

                        ClientConnectionChanged(null, new PlayerConnectionChangedEventArgs(c.MyCharacter, false));
                        // send friends i has quit the game

                        byte[] bufferSendChannelChange = PacketManager.SendChannelChange(cci.Something, cci.Something2);
                        c.Send(bufferSendChannelChange);

                        byte[] bufferRemoveCharacter = null;

                        bufferRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter, RemoveCharacterEffect.None);
                        SendToClients(bufferRemoveCharacter, clients);

                        if (c.MyCharacter.Pet != null && !c.MyCharacter.Pet.IsSealed)
                        {
                            mapEngine.ActiveClientEntities.Remove(c.MyCharacter.Pet);
                            byte[] bufferRemovePet = PacketManager.SendRemovePet(c.MyCharacter.Pet);
                            SendToClients(bufferRemovePet, clients);
                        }

                        break;

                    case 0:
                        c.MyCharacter.Online = false;
                        mapEngine.ActiveClientEntities.Remove(c.MyCharacter);
                        UpdateFriendsStatus(c);
                        if (c.MyCharacter.Guild != null)
                        {
                            GuildMember g = c.MyCharacter.Guild.Members.Single(x => x.Character.CharacterId == c.MyCharacter.CharacterId);
                            g.Online = false;
                            SendToGuild(c.MyCharacter.Guild, PacketManager.SendGuildMemberInfo(g));
                        }
                        if (c.MyCharacter.Party != null)
                        {
                            LeavePartyInfo i = new LeavePartyInfo
                            {
                                PartyID = c.MyCharacter.Party.PartyID
                            };
                            ClientLeaveParty(c);
                        }

                        ClientConnectionChanged(null, new PlayerConnectionChangedEventArgs(c.MyCharacter, false));
                        // send friends i has quit the game

                        accountManager.ExitGame(c.AccountID);

                        bufferRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter, RemoveCharacterEffect.None);
                        SendToClients(bufferRemoveCharacter, clients);

                        if (c.MyCharacter.Pet != null && !c.MyCharacter.Pet.IsSealed)
                        {
                            mapEngine.ActiveClientEntities.Remove(c.MyCharacter.Pet);
                            byte[] bufferRemovePet = PacketManager.SendRemovePet(c.MyCharacter.Pet);
                            SendToClients(bufferRemovePet, clients);
                        }

                        break;
                }
            }
        }