示例#1
0
        public void SendConsortiaUserPass(int playerid, string playerName, ConsortiaUserInfo info, bool isInvite, int consortiaRepute, string loginName, int fightpower, int achievementpoint, string honor)
        {
            GSPacketIn pkg = new GSPacketIn(128, playerid);

            pkg.WriteByte(1);
            pkg.WriteInt(info.ID);
            pkg.WriteBoolean(isInvite);
            pkg.WriteInt(info.ConsortiaID);
            pkg.WriteString(info.ConsortiaName);
            pkg.WriteInt(info.UserID);
            pkg.WriteString(info.UserName);
            pkg.WriteInt(playerid);
            pkg.WriteString(playerName);
            pkg.WriteInt(info.DutyID);
            pkg.WriteString(info.DutyName);
            pkg.WriteInt(info.Offer);
            pkg.WriteInt(info.RichesOffer);
            pkg.WriteInt(info.RichesRob);
            pkg.WriteDateTime(info.LastDate);
            pkg.WriteInt(info.Grade);
            pkg.WriteInt(info.Level);
            pkg.WriteInt(info.State);
            pkg.WriteBoolean(info.Sex);
            pkg.WriteInt(info.Right);
            pkg.WriteInt(info.Win);
            pkg.WriteInt(info.Total);
            pkg.WriteInt(info.Escape);
            pkg.WriteInt(consortiaRepute);
            pkg.WriteString(loginName);
            pkg.WriteInt(fightpower);
            pkg.WriteInt(achievementpoint);
            pkg.WriteString(honor);

            this.SendTCP(pkg);
        }
示例#2
0
        public GSPacketIn SendMarryRoomInfoUpdateToScenePlayers(MarryRoom room)
        {
            GSPacketIn pkg    = new GSPacketIn((short)ePackageType.MARRY_ROOM_UPDATE);
            bool       result = room != null;

            pkg.WriteBoolean(result);
            if (result)
            {
                pkg.WriteInt(room.Info.ID);
                pkg.WriteBoolean(room.Info.IsHymeneal);
                pkg.WriteString(room.Info.Name);
                pkg.WriteBoolean(room.Info.Pwd == "" ? false : true);
                pkg.WriteInt(room.Info.MapIndex);
                pkg.WriteInt(room.Info.AvailTime);
                pkg.WriteInt(room.Count);
                pkg.WriteInt(room.Info.PlayerID);
                pkg.WriteString(room.Info.PlayerName);
                pkg.WriteInt(room.Info.GroomID);
                pkg.WriteString(room.Info.GroomName);
                pkg.WriteInt(room.Info.BrideID);
                pkg.WriteString(room.Info.BrideName);
                pkg.WriteDateTime(room.Info.BeginTime);
                pkg.WriteByte((byte)room.RoomState);
                pkg.WriteString(room.Info.RoomIntroduction);
            }

            SendToScenePlayer(pkg);
            return(pkg);
        }
示例#3
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn pkg             = new GSPacketIn(0xc6);
            PlayerInfo playerCharacter = client.Player.PlayerCharacter;

            pkg.WriteInt(playerCharacter.ID);
            pkg.WriteInt(playerCharacter.Grade);
            pkg.WriteInt(playerCharacter.Hide);
            pkg.WriteInt(playerCharacter.Repute);
            pkg.WriteString(playerCharacter.NickName);
            pkg.WriteBoolean(true);
            pkg.WriteInt(5);
            pkg.WriteBoolean(playerCharacter.Sex);
            pkg.WriteString(playerCharacter.Style);
            pkg.WriteString(playerCharacter.Colors);
            pkg.WriteString(playerCharacter.Skin);
            pkg.WriteInt(300);
            pkg.WriteInt(400);
            pkg.WriteInt(playerCharacter.FightPower);
            pkg.WriteInt(playerCharacter.Win);
            pkg.WriteInt(playerCharacter.Total);
            pkg.WriteInt(1);
            client.SendTCP(pkg);
            return(0);
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //GSPacketIn pkg = packet.Clone();
            //pkg.ClearContext();

            int id       = packet.ReadInt();
            int senderID = 0;

            using (PlayerBussiness db = new PlayerBussiness())
            {
                if (db.CancelPaymentMail(client.Player.PlayerCharacter.ID, id, ref senderID))
                {
                    client.Out.SendMailResponse(senderID, eMailRespose.Receiver);
                    packet.WriteBoolean(true);
                }
                else
                {
                    packet.WriteBoolean(false);
                }
            }

            client.Out.SendTCP(packet);

            return(1);
        }
示例#5
0
        public void SendConsortiaUserPass(int playerid, string playerName, ConsortiaUserInfo info, bool isInvite, int consortiaRepute, string loginName, int fightpower)
        {
            GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.CONSORTIA_RESPONSE, playerid);

            pkg.WriteByte(1);
            pkg.WriteInt(info.ID);
            pkg.WriteBoolean(isInvite);
            pkg.WriteInt(info.ConsortiaID);
            pkg.WriteString(info.ConsortiaName);
            pkg.WriteInt(info.UserID);
            pkg.WriteString(info.UserName);
            pkg.WriteInt(playerid);
            pkg.WriteString(playerName);
            pkg.WriteInt(info.DutyID);
            pkg.WriteString(info.DutyName);
            pkg.WriteInt(info.Offer);
            pkg.WriteInt(info.RichesOffer);
            pkg.WriteInt(info.RichesRob);
            pkg.WriteDateTime(info.LastDate);
            pkg.WriteInt(info.Grade);
            pkg.WriteInt(info.Level);
            pkg.WriteInt(info.State);
            pkg.WriteBoolean(info.Sex);
            pkg.WriteInt(info.Right);
            pkg.WriteInt(info.Win);
            pkg.WriteInt(info.Total);
            pkg.WriteInt(info.Escape);
            pkg.WriteInt(consortiaRepute);
            pkg.WriteString(loginName);
            pkg.WriteInt(fightpower);
            pkg.WriteInt(500);
            //New
            pkg.WriteString("Honor");
            SendTCP(pkg);
        }
        //修改:  Xiaov
        //时间:  2009-11-4
        //描述:  修改邮件的已读未读标志<已测试>
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();

            int id = packet.ReadInt();

            using (PlayerBussiness db = new PlayerBussiness())
            {
                MailInfo mes = db.GetMailSingle(client.Player.PlayerCharacter.ID, id);
                if (mes != null && !mes.IsRead)
                {
                    mes.IsRead = true;
                    if (mes.Type < 100)
                    {
                        mes.ValidDate = 3 * 24;
                        mes.SendTime  = DateTime.Now;
                    }
                    db.UpdateMail(mes, mes.Money);
                    pkg.WriteBoolean(true);
                }
                else
                {
                    pkg.WriteBoolean(false);
                }
            }

            client.Out.SendTCP(pkg);

            return(0);
        }
示例#7
0
        public GSPacketIn SendMarryRoomInfoUpdateToScenePlayers(MarryRoom room)
        {
            GSPacketIn gSPacketIn = new GSPacketIn(255);
            bool       flag       = room != null;

            gSPacketIn.WriteBoolean(flag);
            if (flag)
            {
                gSPacketIn.WriteInt(room.Info.ID);
                gSPacketIn.WriteBoolean(room.Info.IsHymeneal);
                gSPacketIn.WriteString(room.Info.Name);
                gSPacketIn.WriteBoolean(!(room.Info.Pwd == ""));
                gSPacketIn.WriteInt(room.Info.MapIndex);
                gSPacketIn.WriteInt(room.Info.AvailTime);
                gSPacketIn.WriteInt(room.Count);
                gSPacketIn.WriteInt(room.Info.PlayerID);
                gSPacketIn.WriteString(room.Info.PlayerName);
                gSPacketIn.WriteInt(room.Info.GroomID);
                gSPacketIn.WriteString(room.Info.GroomName);
                gSPacketIn.WriteInt(room.Info.BrideID);
                gSPacketIn.WriteString(room.Info.BrideName);
                gSPacketIn.WriteDateTime(room.Info.BeginTime);
                gSPacketIn.WriteByte((byte)room.RoomState);
                gSPacketIn.WriteString(room.Info.RoomIntroduction);
            }
            this.SendToScenePlayer(gSPacketIn);
            return(gSPacketIn);
        }
示例#8
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            if (WorldMgr.SpaScene.AddPlayer(player))
            {
                pkg.WriteBoolean(true);
            }
            else
            {
                pkg.WriteBoolean(false);
            }
            player.Out.SendTCP(pkg);
            DateTime lastTimeLeaveSpaRoom = player.PlayerCharacter.LastSpaDate;

            //bool flag = 1 == 0;
            if (lastTimeLeaveSpaRoom.Year != DateTime.Now.Year || lastTimeLeaveSpaRoom.Month != DateTime.Now.Month || lastTimeLeaveSpaRoom.Day != DateTime.Now.Day)
            {
                player.UpdateSpaPubGoldRoomLimit(SpaRoomMgr.pubGoldRoom_MinLimit);
                player.UpdateSpaPubMoneyRoomLimit(SpaRoomMgr.pubMoneyRoom_MinLimit);
                player.UpdateIsInSpaPubGoldToday(false);
                player.UpdateIsInSpaPubMoneyToday(false);
            }
            if (player.CurrentSpaRoom != null)
            {
                player.CurrentSpaRoom.RemovePlayer(player);
            }
            SpaRoom[] list = SpaRoomMgr.GetAllSpaRoom();
            player.Out.SendSpaRoomList(player, list);
            return(0);
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn gSPacketIn = new GSPacketIn(69, client.Player.PlayerCharacter.ID);
            byte       b          = packet.ReadByte();
            byte       b2         = packet.ReadByte();

            GamePlayer[] allPlayersNoGame = WorldMgr.GetAllPlayersNoGame();
            int          num = allPlayersNoGame.Length;
            byte         b3  = (num > (int)b2) ? b2 : ((byte)num);

            gSPacketIn.WriteByte(b3);
            for (int i = (int)(b * b2); i < (int)(b * b2 + b3); i++)
            {
                PlayerInfo playerCharacter = allPlayersNoGame[i % num].PlayerCharacter;
                gSPacketIn.WriteInt(playerCharacter.ID);
                gSPacketIn.WriteString(playerCharacter.NickName);
                gSPacketIn.WriteByte(playerCharacter.typeVIP);
                gSPacketIn.WriteInt(playerCharacter.VIPLevel);
                gSPacketIn.WriteBoolean(playerCharacter.Sex);
                gSPacketIn.WriteInt(playerCharacter.Grade);
                gSPacketIn.WriteInt(playerCharacter.ConsortiaID);
                gSPacketIn.WriteString(playerCharacter.ConsortiaName);
                gSPacketIn.WriteInt(playerCharacter.Offer);
                gSPacketIn.WriteInt(playerCharacter.Win);
                gSPacketIn.WriteInt(playerCharacter.Total);
                gSPacketIn.WriteInt(playerCharacter.Escape);
                gSPacketIn.WriteInt(playerCharacter.Repute);
                gSPacketIn.WriteInt(playerCharacter.FightPower);
                gSPacketIn.WriteBoolean(playerCharacter.IsOldPlayer);
            }
            client.Out.SendTCP(gSPacketIn);
            return(0);
        }
示例#10
0
        private void RefreshData(GamePlayer player, GSPacketIn packet)
        {
            int moneyLamMS = DiceSystemMgr.MoneyLamMS;

            if (player.RemoveMoney(moneyLamMS) == moneyLamMS)
            {
                player.DicePlace.ItemDice = DiceSystemMgr.TaoMoidiem();
                ThreadSafeRandom threadSafeRandom = new ThreadSafeRandom();
                int num = threadSafeRandom.Next(6, 9);
                player.DicePlace.LuckIntegral += num;
            }
            GSPacketIn gSPacketIn = new GSPacketIn(134);

            gSPacketIn.WriteByte(3);
            gSPacketIn.WriteBoolean(player.DicePlace.UserFirstCell);
            gSPacketIn.WriteInt(player.DicePlace.CurrentPosition);
            gSPacketIn.WriteInt(player.DicePlace.LuckIntegralLevel);
            gSPacketIn.WriteInt(player.DicePlace.LuckIntegral);
            gSPacketIn.WriteInt(0);
            gSPacketIn.WriteInt(player.DicePlace.ItemDice.Count);
            foreach (DiceSystemItem current in player.DicePlace.ItemDice)
            {
                gSPacketIn.WriteInt(current.TemplateID);
                gSPacketIn.WriteInt(current.Position);
                gSPacketIn.WriteInt(current.StrengthLevel);
                gSPacketIn.WriteInt(current.Count);
                gSPacketIn.WriteInt(current.Validate);
                gSPacketIn.WriteBoolean(current.IsBind);
            }
            player.Out.SendTCP(gSPacketIn);
        }
示例#11
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int result;

            if (player.PlayerCharacter.HasBagPassword && player.PlayerCharacter.IsLocked)
            {
                player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0]));
                result = 0;
            }
            else
            {
                int        mailId = packet.ReadInt();
                GSPacketIn pkg    = packet.Clone();
                using (PlayerBussiness db = new PlayerBussiness())
                {
                    MailInfo mail = db.GetMailSingle(player.PlayerCharacter.ID, mailId);
                    //LogMgr.LogMailDelete(player.PlayerCharacter.ID, mail);
                    int senderID;
                    if (db.DeleteMail(player.PlayerCharacter.ID, mailId, out senderID))
                    {
                        player.Out.SendMailResponse(senderID, eMailRespose.Receiver);
                        pkg.WriteBoolean(true);
                    }
                    else
                    {
                        pkg.WriteBoolean(false);
                    }
                }
                player.Out.SendTCP(pkg);
                result = 0;
            }
            return(result);
        }
示例#12
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int num  = packet.ReadInt();
            int num2 = num;

            if (num2 == 2)
            {
                GSPacketIn gSPacketIn = new GSPacketIn(131, client.Player.PlayerCharacter.ID);
                gSPacketIn.WriteByte(2);
                gSPacketIn.WriteInt(1);
                gSPacketIn.WriteInt(1);
                gSPacketIn.WriteBoolean(false);
                gSPacketIn.WriteInt(0);
                gSPacketIn.WriteInt(0);
                gSPacketIn.WriteInt(0);
                gSPacketIn.WriteInt(0);
                gSPacketIn.WriteInt(0);
                gSPacketIn.WriteBoolean(true);
                gSPacketIn.WriteBoolean(false);
                gSPacketIn.WriteBoolean(false);
                gSPacketIn.WriteBoolean(false);
                client.Player.Out.SendTCP(gSPacketIn);
            }
            else
            {
                Console.WriteLine("???labyrinth_cmd: " + (LabyrinthPackageType)num);
            }
            return(0);
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn gSPacketIn = new GSPacketIn(240, client.Player.PlayerCharacter.ID);

            if (WorldMgr.MarryScene.AddPlayer(client.Player))
            {
                gSPacketIn.WriteBoolean(true);
            }
            else
            {
                gSPacketIn.WriteBoolean(false);
            }
            client.Out.SendTCP(gSPacketIn);
            if (client.Player.CurrentMarryRoom == null)
            {
                MarryRoom[] allMarryRoom = MarryRoomMgr.GetAllMarryRoom();
                MarryRoom[] array        = allMarryRoom;
                for (int i = 0; i < array.Length; i++)
                {
                    MarryRoom room = array[i];
                    client.Player.Out.SendMarryRoomInfo(client.Player, room);
                }
            }
            return(0);
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked", new object[0]));
                return(0);
            }
            int        mailID     = packet.ReadInt();
            GSPacketIn gSPacketIn = packet.Clone();

            using (PlayerBussiness playerBussiness = new PlayerBussiness())
            {
                int playerID;
                if (playerBussiness.DeleteMail(client.Player.PlayerCharacter.ID, mailID, out playerID))
                {
                    client.Out.SendMailResponse(playerID, eMailRespose.Receiver);
                    gSPacketIn.WriteBoolean(true);
                }
                else
                {
                    gSPacketIn.WriteBoolean(false);
                }
            }
            client.Out.SendTCP(gSPacketIn);
            return(0);
        }
示例#15
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            if (WorldMgr.MarryScene.AddPlayer(player))
            {
                pkg.WriteBoolean(true);
            }
            else
            {
                pkg.WriteBoolean(false);
            }
            player.Out.SendTCP(pkg);
            if (player.CurrentMarryRoom == null)
            {
                MarryRoom[] list  = MarryRoomMgr.GetAllMarryRoom();
                MarryRoom[] array = list;
                for (int i = 0; i < array.Length; i++)
                {
                    MarryRoom g = array[i];
                    player.Out.SendMarryRoomInfo(player, g);
                }
            }
            return(0);
        }
示例#16
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            //pkg.ClearContext();
            if (client.Player.PlayerCharacter.HasBagPassword && client.Player.PlayerCharacter.IsLocked)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("Bag.Locked"));

                return(0);
            }
            int id = packet.ReadInt();
            int senderID;

            using (PlayerBussiness db = new PlayerBussiness())
            {
                if (db.DeleteMail(client.Player.PlayerCharacter.ID, id, out senderID))
                {
                    client.Out.SendMailResponse(senderID, eMailRespose.Receiver);
                    pkg.WriteBoolean(true);
                }
                else
                {
                    pkg.WriteBoolean(false);
                }
            }

            client.Out.SendTCP(pkg);

            return(0);
        }
示例#17
0
        public void SendConfigState()
        {
            GSPacketIn gSPacketIn = new GSPacketIn(8);

            gSPacketIn.WriteBoolean(this.ASSState);
            gSPacketIn.WriteBoolean(this.DailyAwardState);
            this.SendToALL(gSPacketIn);
        }
示例#18
0
        public void SendConfigState()
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.UPDATE_CONFIG_STATE);

            pkg.WriteBoolean(ASSState);
            pkg.WriteBoolean(DailyAwardState);
            SendToALL(pkg);
        }
示例#19
0
        public void SendPlayerOnKillingLiving(int playerId, AbstractGame game, int type, int id, bool isLiving, int demage, bool isSpanArea)
        {
            GSPacketIn pkg = new GSPacketIn(40, playerId);

            pkg.WriteInt(type);
            pkg.WriteBoolean(isLiving);
            pkg.WriteInt(demage);
            pkg.WriteBoolean(isSpanArea);
            this.SendTCP(pkg);
        }
示例#20
0
        public void SendPlayerOnGameOver(int playerId, int gameId, bool isWin, int gainXp, bool isSpanArea, bool isCouple)
        {
            GSPacketIn pkg = new GSPacketIn(35, playerId);

            pkg.Parameter1 = gameId;
            pkg.WriteBoolean(isWin);
            pkg.WriteInt(gainXp);
            pkg.WriteBoolean(isSpanArea);
            pkg.WriteBoolean(isCouple);
            this.SendTCP(pkg);
        }
示例#21
0
 public void SendPlayerAddTemplate(int playerId, ItemInfo cloneItem, eBageType bagType, int count)
 {
     if (cloneItem != null)
     {
         GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.PLAYER_ADD_TEMPLATE1, playerId);
         pkg.WriteInt(cloneItem.TemplateID);
         pkg.WriteByte((byte)bagType);
         pkg.WriteInt(count);
         pkg.WriteInt(cloneItem.ValidDate);
         pkg.WriteBoolean(cloneItem.IsBinds);
         pkg.WriteBoolean(cloneItem.IsUsed);
         SendTCP(pkg);
     }
 }
示例#22
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int Type = packet.ReadInt();

            if (Type == 2)
            {
                int ItemID = packet.ReadInt();

                using (PlayerBussiness db = new PlayerBussiness())
                {
                    ItemInfo Item = db.GetUserItemSingle(ItemID);
                    if (Item != null)
                    {
                        GSPacketIn pkg = new GSPacketIn((byte)ePackageType.LINKREQUEST_GOODS, client.Player.PlayerCharacter.ID);
                        pkg.WriteInt(Item.TemplateID);
                        pkg.WriteInt(Item.ItemID);

                        pkg.WriteInt(Item.StrengthenLevel);

                        pkg.WriteInt(Item.AttackCompose);

                        pkg.WriteInt(Item.AgilityCompose);

                        pkg.WriteInt(Item.LuckCompose);

                        pkg.WriteInt(Item.DefendCompose);
                        pkg.WriteInt(Item.ValidDate);
                        pkg.WriteBoolean(Item.IsBinds);
                        pkg.WriteBoolean(Item.IsJudge);
                        pkg.WriteBoolean(Item.IsUsed);
                        if (Item.IsUsed)
                        {
                            pkg.WriteString(Item.BeginDate.ToString());
                        }
                        pkg.WriteInt(Item.Hole1);
                        pkg.WriteInt(Item.Hole2);
                        pkg.WriteInt(Item.Hole3);
                        pkg.WriteInt(Item.Hole4);
                        pkg.WriteInt(Item.Hole5);
                        pkg.WriteInt(Item.Hole6);

                        pkg.WriteString(Item.Template.Hole);

                        client.Out.SendTCP(pkg);
                    }
                    return(1);
                }
            }
            return(0);
        }
示例#23
0
 public void SendPlayerAddTemplate(int playerId, ItemInfo cloneItem, eBageType bagType, int count)
 {
     if (cloneItem != null)
     {
         GSPacketIn gSPacketIn = new GSPacketIn(48, playerId);
         gSPacketIn.WriteInt(cloneItem.TemplateID);
         gSPacketIn.WriteByte((byte)bagType);
         gSPacketIn.WriteInt(count);
         gSPacketIn.WriteInt(cloneItem.ValidDate);
         gSPacketIn.WriteBoolean(cloneItem.IsBinds);
         gSPacketIn.WriteBoolean(cloneItem.IsUsed);
         this.SendTCP(gSPacketIn);
     }
 }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(0);
            }

            int    id     = packet.ReadInt();
            string remark = packet.ReadString();

            if (string.IsNullOrEmpty(remark) || System.Text.Encoding.Default.GetByteCount(remark) > 100)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaUserRemarkHandler.Long"));
                return(1);
            }
            bool   result = false;
            string msg    = "ConsortiaUserRemarkHandler.Failed";

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.UpdateConsortiaUserRemark(id, client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, remark, ref msg))
                {
                    msg    = "ConsortiaUserRemarkHandler.Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return(0);
        }
示例#25
0
        public void SendCanPickUpNpc()
        {
            GSPacketIn pkg = new GSPacketIn(50);

            pkg.WriteBoolean(true);
            this.SendToAll(pkg);
        }
示例#26
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            string placard = packet.ReadString();
            int    result2;

            if (Encoding.Default.GetByteCount(placard) > 300)
            {
                player.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaPlacardUpdateHandler.Long", new object[0]));
                result2 = 1;
            }
            else
            {
                bool   result = false;
                string msg    = "ConsortiaPlacardUpdateHandler.Failed";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    if (db.UpdateConsortiaPlacard(player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, placard, ref msg))
                    {
                        msg    = "ConsortiaPlacardUpdateHandler.Success";
                        result = true;
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
示例#27
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            string description = packet.ReadString();

            if (System.Text.Encoding.Default.GetByteCount(description) > 300)
            {
                client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaDescriptionUpdateHandler.Long"));
                return(1);
            }
            bool   result = false;
            string msg    = "ConsortiaDescriptionUpdateHandler.Failed";

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.UpdateConsortiaDescription(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, description, ref msg))
                {
                    msg    = "ConsortiaDescriptionUpdateHandler.Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

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

            if (player.PlayerCharacter.ConsortiaID == 0)
            {
                result2 = 0;
            }
            else
            {
                int    banUserID = packet.ReadInt();
                bool   isBanChat = packet.ReadBoolean();
                int    userID    = 0;
                string userName  = "";
                bool   result    = false;
                string msg       = "ConsortiaIsBanChatHandler.Failed";
                using (ConsortiaBussiness db = new ConsortiaBussiness())
                {
                    if (db.UpdateConsortiaIsBanChat(banUserID, player.PlayerCharacter.ConsortiaID, player.PlayerCharacter.ID, isBanChat, ref userID, ref userName, ref msg))
                    {
                        msg    = "ConsortiaIsBanChatHandler.Success";
                        result = true;
                        GameServer.Instance.LoginServer.SendConsortiaBanChat(userID, userName, player.PlayerCharacter.ID, player.PlayerCharacter.NickName, isBanChat);
                    }
                }
                packet.WriteBoolean(result);
                packet.WriteString(LanguageMgr.GetTranslation(msg, new object[0]));
                player.Out.SendTCP(packet);
                result2 = 0;
            }
            return(result2);
        }
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
            {
                return(0);
            }

            int    id     = packet.ReadInt();
            bool   isAlly = packet.ReadBoolean();
            bool   result = false;
            string msg    = "ConsortiaApplyAllyAddHandler.Add_Failed";

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaApplyAllyInfo info = new ConsortiaApplyAllyInfo();
                info.Consortia1ID = client.Player.PlayerCharacter.ConsortiaID;
                info.Consortia2ID = id;
                info.Date         = DateTime.Now;
                info.State        = 0;// isAlly ? 1 : 0;
                info.Remark       = "";
                info.IsExist      = true;
                if (db.AddConsortiaApplyAlly(info, client.Player.PlayerCharacter.ID, ref msg))
                {
                    msg    = "ConsortiaApplyAllyAddHandler.Add_Success";
                    result = true;
                }
            }
            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return(0);
        }
        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);
        }