Exemplo n.º 1
0
        private void HandlePlayerConsortiaFight(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);
            Dictionary <int, Player> players = new Dictionary <int, Player>();
            int consortiaWin  = pkg.ReadInt();
            int consortiaLose = pkg.ReadInt();
            int count         = pkg.ReadInt();
            int offer         = 0;

            for (int i = 0; i < count; i++)
            {
                GamePlayer Temp = WorldMgr.GetPlayerById(pkg.ReadInt());
                if (Temp != null)
                {
                    Player Tempplayer = new Player(Temp, 0, null, 0);
                    players.Add(i, Tempplayer);
                }
            }
            eRoomType roomtype        = (eRoomType)pkg.ReadByte();
            eGameType gametype        = (eGameType)pkg.ReadByte();
            int       totalKillHealth = pkg.ReadInt();

            if (player != null)
            {
                offer = player.ConsortiaFight(consortiaWin, consortiaLose, players, roomtype, gametype, totalKillHealth, count);
            }

            if (offer != 0)
            {
            }
        }
Exemplo n.º 2
0
        public void SendToRoom(int roomId, GSPacketIn pkg, int exceptId, int exceptGameId)
        {
            BaseRoom baseRoom = this.FindRoom(roomId);

            if (baseRoom != null)
            {
                if (exceptId != 0)
                {
                    GamePlayer playerById = WorldMgr.GetPlayerById(exceptId);
                    if (playerById != null)
                    {
                        if (playerById.GamePlayerId == exceptGameId)
                        {
                            baseRoom.SendToAll(pkg, playerById);
                            return;
                        }
                        baseRoom.SendToAll(pkg);
                        return;
                    }
                }
                else
                {
                    baseRoom.SendToAll(pkg);
                }
            }
        }
Exemplo n.º 3
0
        private void HandlePlayerConsortiaFight(GSPacketIn pkg)
        {
            GamePlayer playerById = WorldMgr.GetPlayerById(pkg.ClientID);
            Dictionary <int, Player> dictionary = new Dictionary <int, Player>();
            int consortiaWin  = pkg.ReadInt();
            int consortiaLose = pkg.ReadInt();
            int num           = pkg.ReadInt();

            for (int i = 0; i < num; i++)
            {
                GamePlayer playerById2 = WorldMgr.GetPlayerById(pkg.ReadInt());
                if (playerById2 != null)
                {
                    Player value = new Player(playerById2, 0, null, 0, playerById2.PlayerCharacter.hp);
                    dictionary.Add(i, value);
                }
            }
            eRoomType roomType        = (eRoomType)pkg.ReadByte();
            eGameType gameClass       = (eGameType)pkg.ReadByte();
            int       totalKillHealth = pkg.ReadInt();

            if (playerById != null)
            {
                int num2 = playerById.ConsortiaFight(consortiaWin, consortiaLose, dictionary, roomType, gameClass, totalKillHealth, num);
            }
        }
Exemplo n.º 4
0
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE)
            {
                return(false);
            }
            if (!player.CurrentMarryRoom.Info.GuestInvite && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID)
            {
                return(false);
            }
            GSPacketIn gSPacketIn = packet.Clone();

            gSPacketIn.ClearContext();
            int        playerId   = packet.ReadInt();
            GamePlayer playerById = WorldMgr.GetPlayerById(playerId);

            if (playerById != null && playerById.CurrentRoom == null && playerById.CurrentMarryRoom == null)
            {
                gSPacketIn.WriteByte(4);
                gSPacketIn.WriteInt(player.PlayerCharacter.ID);
                gSPacketIn.WriteString(player.PlayerCharacter.NickName);
                gSPacketIn.WriteInt(player.CurrentMarryRoom.Info.ID);
                gSPacketIn.WriteString(player.CurrentMarryRoom.Info.Name);
                gSPacketIn.WriteString(player.CurrentMarryRoom.Info.Pwd);
                gSPacketIn.WriteInt(player.MarryMap);
                playerById.Out.SendTCP(gSPacketIn);
                return(true);
            }
            return(false);
        }
Exemplo n.º 5
0
        public void SendToRoom(int roomId, GSPacketIn pkg, int exceptId, int exceptGameId)
        {
            BaseRoom room = FindRoom(roomId);

            if (room != null)
            {
                if (exceptId != 0)
                {
                    GamePlayer player = WorldMgr.GetPlayerById(exceptId);
                    if (player != null)
                    {
                        if (player.GamePlayerId == exceptGameId)
                        {
                            room.SendToAll(pkg, player);
                        }
                        else
                        {
                            room.SendToAll(pkg);
                        }
                    }
                }
                else
                {
                    room.SendToAll(pkg);
                }
            }
        }
Exemplo n.º 6
0
        private void HandlePlayerAddTemplate(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);

            if (player != null)
            {
                ItemTemplateInfo template = ItemMgr.FindItemTemplate(pkg.ReadInt());
                eBageType        type     = (eBageType)pkg.ReadByte();
                if (template != null)
                {
                    int      Count = pkg.ReadInt();
                    ItemInfo item  = ItemInfo.CreateFromTemplate(template, Count, 118);
                    item.Count     = Count;
                    item.ValidDate = pkg.ReadInt();
                    item.IsBinds   = pkg.ReadBoolean();
                    item.IsUsed    = pkg.ReadBoolean();
                    item.IsTips    = pkg.ReadBoolean();
                    item.IsLogs    = pkg.ReadBoolean();
                    int check = pkg.ReadInt();
                    if (check == template.TemplateID + Count)
                    {
                        if (!player.AddTemplate(item, type, item.Count, item.IsTips))
                        {
                        }
                    }
                    else
                    {
                        FightServerConnector.log.ErrorFormat("add template item error: userid {0} template id {1} count {2}", pkg.ClientID, template.TemplateID, Count);
                    }
                }
            }
        }
Exemplo n.º 7
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int                  num        = packet.ReadInt();
            GamePlayer           playerById = WorldMgr.GetPlayerById(num);
            PlayerInfo           playerInfo;
            List <UsersCardInfo> list;

            if (playerById != null)
            {
                playerInfo = playerById.PlayerCharacter;
                list       = playerById.CardBag.GetItems(0, 5);
            }
            else
            {
                using (PlayerBussiness playerBussiness = new PlayerBussiness())
                {
                    playerInfo = playerBussiness.GetUserSingleByUserID(num);
                    list       = playerBussiness.GetUserCardEuqip(num);
                }
            }
            if (list != null && playerInfo != null)
            {
                client.Player.Out.SendPlayerCardSlot(playerInfo, list);
            }
            return(0);
        }
Exemplo n.º 8
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int             id     = packet.ReadInt();
            GamePlayer      player = WorldMgr.GetPlayerById(id);
            PlayerInfo      info;
            List <ItemInfo> items;

            if (player != null)
            {
                info  = player.PlayerCharacter;
                items = player.MainBag.GetItems(0, 31);
            }
            else
            {
                using (PlayerBussiness pb = new PlayerBussiness())
                {
                    info  = pb.GetUserSingleByUserID(id);
                    items = pb.GetUserEuqip(id);
                }
            }
            if (info != null && items != null)
            {
                client.Out.SendUserEquip(info, items);
            }
            return(0);
        }
Exemplo n.º 9
0
        public void SendGoodManCard(string receiverName, int receiverID, string senderName, int senderID, PlayerBussiness db)
        {
            ItemTemplateInfo goodMan     = ItemMgr.FindItemTemplate(11105);
            ItemInfo         goodManCard = ItemInfo.CreateFromTemplate(goodMan, 1, 112);

            goodManCard.IsBinds = true;
            GamePlayer player = WorldMgr.GetPlayerById(receiverID);

            goodManCard.UserID = 0;
            db.AddGoods(goodManCard);
            MailInfo mail = new MailInfo();

            mail.Annex1     = goodManCard.ItemID.ToString();
            mail.Content    = LanguageMgr.GetTranslation("MarryApplyReplyHandler.Content", new object[0]);
            mail.Gold       = 0;
            mail.IsExist    = true;
            mail.Money      = 0;
            mail.GiftToken  = 0;
            mail.Receiver   = receiverName;
            mail.ReceiverID = receiverID;
            mail.Sender     = senderName;
            mail.SenderID   = senderID;
            mail.Title      = LanguageMgr.GetTranslation("MarryApplyReplyHandler.Title", new object[0]);
            mail.Type       = 14;
            if (db.SendMail(mail) && player != null)
            {
                player.Out.SendMailResponse(mail.ReceiverID, eMailRespose.Receiver);
            }
        }
Exemplo n.º 10
0
        private void HandlePlayerRemoveGP(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);

            if (player != null)
            {
                player.RemoveGP(pkg.Parameter1);
            }
        }
Exemplo n.º 11
0
        private void HandlePlayerAddGold(GSPacketIn pkg)
        {
            GamePlayer playerById = WorldMgr.GetPlayerById(pkg.ClientID);

            if (playerById != null)
            {
                playerById.AddGold(pkg.Parameter1);
            }
        }
Exemplo n.º 12
0
        private void HandlePlayerRemoveMoney(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);

            if (player != null)
            {
                player.RemoveMoney(pkg.ReadInt());
            }
        }
Exemplo n.º 13
0
        public void SendToUser(int playerid, GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(playerid);

            if (player != null)
            {
                player.SendTCP(pkg);
            }
        }
Exemplo n.º 14
0
        private void HandleDisconnectPlayer(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);

            if (player != null)
            {
                player.Disconnect();
            }
        }
Exemplo n.º 15
0
        private void HandlePlayerChatSend(GSPacketIn pkg)
        {
            GamePlayer playerById = WorldMgr.GetPlayerById(pkg.ClientID);

            if (playerById != null)
            {
                playerById.SendMessage(pkg.ReadString());
            }
        }
Exemplo n.º 16
0
        private void HandlePlayerOnGameOver(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);

            if (player != null && player.CurrentRoom != null && player.CurrentRoom.Game != null)
            {
                player.OnGameOver(player.CurrentRoom.Game, pkg.ReadBoolean(), pkg.ReadInt(), pkg.ReadBoolean(), pkg.ReadBoolean());
            }
        }
Exemplo n.º 17
0
        private void HandlePlayerSendConsortiaFight(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);

            if (player != null)
            {
                player.SendConsortiaFight(pkg.ReadInt(), pkg.ReadInt(), pkg.ReadString());
            }
        }
Exemplo n.º 18
0
        private void HandlePlayerAddGiftToken(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);

            if (player != null)
            {
                player.AddGiftToken(pkg.Parameter1);
            }
        }
Exemplo n.º 19
0
        private void HandlePlayerRemoveOffer(GSPacketIn pkg)
        {
            GamePlayer playerById = WorldMgr.GetPlayerById(pkg.ClientID);

            if (playerById != null)
            {
                playerById.RemoveOffer(pkg.ReadInt());
            }
        }
Exemplo n.º 20
0
        private void HandlePlayerAddMedal(GSPacketIn pkg)  //trminhpc
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);

            if (player != null)
            {
                player.AddMedal(pkg.Parameter1);
            }
        }
Exemplo n.º 21
0
        public void UpdatePlayerGameId(int playerid, int gamePlayerId)
        {
            GamePlayer player = WorldMgr.GetPlayerById(playerid);

            if (player != null)
            {
                player.GamePlayerId = gamePlayerId;
            }
        }
Exemplo n.º 22
0
        /// <summary>
        /// 私聊
        /// </summary>
        /// <param name="packet"></param>
        protected void HandleChatPersonal(GSPacketIn packet)
        {
            int        playerID = packet.ReadInt();
            GamePlayer client   = WorldMgr.GetPlayerById(playerID);

            if (client != null && !client.IsBlackFriend(packet.ClientID))
            {
                client.Out.SendTCP(packet);
            }
        }
Exemplo n.º 23
0
        private void HandlePlayerRemoveGold(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);
            int        check  = pkg.ReadInt();

            if (player != null && check == pkg.Parameter1)
            {
                player.RemoveGold(pkg.Parameter1);
            }
        }
Exemplo n.º 24
0
        public void HandleMailResponse(GSPacketIn packet)
        {
            int        playerID = packet.ReadInt();
            GamePlayer client   = WorldMgr.GetPlayerById(playerID);

            if (client != null)
            {
                client.Out.SendTCP(packet);
            }
        }
Exemplo n.º 25
0
        private void HandPlayerAddRobRiches(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);
            int        check  = pkg.ReadInt();

            if (player != null && check == pkg.Parameter1)
            {
                player.AddRobRiches(pkg.Parameter1);
            }
        }
Exemplo n.º 26
0
        private void HandlePlayerOnMissionOver(GSPacketIn pkg)
        {
            GamePlayer   player = WorldMgr.GetPlayerById(pkg.ClientID);
            AbstractGame game   = player.CurrentRoom.Game;

            if (player != null)
            {
                player.OnMissionOver(game, pkg.ReadBoolean(), pkg.ReadInt(), pkg.ReadInt());
            }
        }
Exemplo n.º 27
0
        private void HandlePlayerOnKillingLiving(GSPacketIn pkg)
        {
            GamePlayer   playerById = WorldMgr.GetPlayerById(pkg.ClientID);
            AbstractGame game       = playerById.CurrentRoom.Game;

            if (playerById != null)
            {
                playerById.OnKillingLiving(game, pkg.ReadInt(), pkg.ClientID, pkg.ReadBoolean(), pkg.ReadInt());
            }
        }
Exemplo n.º 28
0
        private void HandlePlayerAddOffer(GSPacketIn pkg)
        {
            GamePlayer player = WorldMgr.GetPlayerById(pkg.ClientID);
            int        check  = pkg.ReadInt();

            if (player != null && check == pkg.Parameter1)
            {
                player.AddOffer(pkg.Parameter1, false);
            }
        }
Exemplo n.º 29
0
        public void HandleChargeMoney(GSPacketIn packet)
        {
            int        clientID   = packet.ClientID;
            GamePlayer playerById = WorldMgr.GetPlayerById(clientID);

            if (playerById != null)
            {
                playerById.ChargeToUser();
            }
        }
Exemplo n.º 30
0
        public void HandleChargeMoney(GSPacketIn packet)
        {
            int        playerID = packet.ClientID;
            GamePlayer client   = WorldMgr.GetPlayerById(playerID);

            if (client != null)
            {
                client.ChargeToUser();
            }
        }