public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result2;

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                int    id       = packet.ReadInt();
                bool   result   = false;
                string nickName = "";
                string msg      = (id == player.PlayerCharacter.ID) ? "ConsortiaUserDeleteHandler.ExitFailed" : "ConsortiaUserDeleteHandler.KickFailed";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    if (db.DeleteConsortiaUser(player.PlayerCharacter.ID, id, player.PlayerCharacter.ConsortiaID, ref msg, ref nickName))
                    {
                        msg = ((id == player.PlayerCharacter.ID) ? "ConsortiaUserDeleteHandler.ExitSuccess" : "ConsortiaUserDeleteHandler.KickSuccess");
                        int consortiaID = player.PlayerCharacter.ConsortiaID;
                        if (id == player.PlayerCharacter.ID)
                        {
                            player.ClearConsortia(true);
                        }
                        GameServer.Instance.LoginServer.SendConsortiaUserDelete(id, consortiaID, id != player.PlayerCharacter.ID, nickName, player.PlayerCharacter.NickName);
                        result = true;
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
Beispiel #2
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(0);
            }

            int    id       = packet.ReadInt();
            bool   result   = false;
            string nickName = "";
            string msg      = id == client.Player.PlayerCharacter.ID ? "ConsortiaUserDeleteHandler.ExitFailed" : "ConsortiaUserDeleteHandler.KickFailed";

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.DeleteConsortiaUser(client.Player.PlayerCharacter.ID, id, client.Player.PlayerCharacter.ConsortiaID, ref msg, ref nickName))
                {
                    msg = id == client.Player.PlayerCharacter.ID ? "ConsortiaUserDeleteHandler.ExitSuccess" : "ConsortiaUserDeleteHandler.KickSuccess";
                    int consortiaID = client.Player.PlayerCharacter.ConsortiaID;
                    if (id == client.Player.PlayerCharacter.ID)
                    {
                        client.Player.ClearConsortia();
                        client.Out.SendMailResponse(client.Player.PlayerCharacter.ID, eMailRespose.Receiver);
                    }

                    // client.Player.StoreBag.SendStoreToMail();
                    GameServer.Instance.LoginServer.SendConsortiaUserDelete(id, consortiaID, id != client.Player.PlayerCharacter.ID, nickName, client.Player.PlayerCharacter.NickName);
                    result = true;
                }
            }

            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return(0);
        }