Exemplo n.º 1
0
 public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
 {
     if (player.IsAttacking)
     {
         GSPacketIn pkg = packet.Clone();
         pkg.ClientID   = player.PlayerDetail.PlayerCharacter.ID;
         pkg.Parameter1 = player.Id;
         game.SendToAll(pkg, player.PlayerDetail);
         byte type     = packet.ReadByte();
         int  tx       = packet.ReadInt();
         int  ty       = packet.ReadInt();
         byte dir      = packet.ReadByte();
         bool isLiving = packet.ReadBoolean();
         switch (type)
         {
         case 0:
         case 1:
             player.SetXY(tx, ty);
             player.StartFalling(true);
             if (player.Y - ty > 1 || player.IsLiving != isLiving)
             {
                 game.SendPlayerMove(player, 3, player.X, player.Y, 0, player.IsLiving, null);
             }
             break;
         }
     }
 }
        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);
        }
Exemplo n.º 3
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.º 4
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            ItemInfo item = player.PropBag.GetItemByCategoryID(0, 11, 4);

            if (item != null)
            {
                player.PropBag.RemoveCountFromStack(item, 1, eItemRemoveType.Use);
                player.OnUsingItem(item.TemplateID);
                int        senderID   = packet.ReadInt();
                string     senderName = packet.ReadString();
                string     msg        = packet.ReadString();
                GSPacketIn pkg        = packet.Clone();
                pkg.ClearContext();
                pkg.ClientID = player.PlayerCharacter.ID;
                pkg.WriteInt(player.PlayerCharacter.ID);
                pkg.WriteString(player.PlayerCharacter.NickName);
                pkg.WriteString(msg);
                GamePlayer[] players = WorldMgr.GetAllPlayers();
                GamePlayer[] array   = players;
                for (int i = 0; i < array.Length; i++)
                {
                    GamePlayer p = array[i];
                    p.Out.SendTCP(pkg);
                }
            }
            return(0);
        }
Exemplo n.º 5
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            client.SendTCP(pkg);
            return(0);
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public void ReturnPacketForScene(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn gSPacketIn = packet.Clone();

            gSPacketIn.ClientID = player.PlayerCharacter.ID;
            this.SendToPlayerExceptSelfForScene(gSPacketIn, player);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        public void ReturnPacket(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            pkg.ClientID = player.PlayerCharacter.ID;
            SendToAll(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);
        }
Exemplo n.º 12
0
        public void ReturnPacket(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            pkg.ClientID = player.PlayerCharacter.ID;
            this.SendToPlayerExceptSelf(pkg, player);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();
            byte page  = packet.ReadByte();
            byte count = packet.ReadByte();

            GamePlayer[] players = WorldMgr.GetAllPlayersNoGame();
            int          total   = players.Length;
            byte         length  = (total > (int)count) ? count : ((byte)total);

            pkg.WriteByte(length);
            for (int i = (int)(page * count); i < (int)(page * count + length); i++)
            {
                PlayerInfo info = players[i % total].PlayerCharacter;
                pkg.WriteInt(info.ID);
                pkg.WriteString((info.NickName == null) ? "" : info.NickName);
                pkg.WriteBoolean(info.Sex);
                pkg.WriteInt(info.Grade);
                pkg.WriteInt(info.ConsortiaID);
                pkg.WriteString((info.ConsortiaName == null) ? "" : info.ConsortiaName);
                pkg.WriteInt(info.Offer);
                pkg.WriteInt(info.Win);
                pkg.WriteInt(info.Total);
                pkg.WriteInt(info.Escape);
                pkg.WriteInt(info.Repute);
                pkg.WriteInt(info.FightPower);
            }
            player.Out.SendTCP(pkg);
            return(0);
        }
Exemplo n.º 15
0
        public void ReturnPacketForScene(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            pkg.ClientID = player.PlayerCharacter.ID;
            SendToPlayerExceptSelfForScene(pkg, player);
            //SendToAll(pkg);
        }
Exemplo n.º 16
0
        //修改:  Xiaov
        //时间:  2009-11-7
        //描述:  用户与用户之间私聊<已测试>
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            int receiverID = packet.ReadInt();
            //int senderID = packet.ReadInt();
            string receiver    = packet.ReadString();
            string sender      = packet.ReadString();
            string msg         = packet.ReadString();
            bool   isAutoReply = packet.ReadBoolean();

            if (receiverID == 0)
            {
                using (PlayerBussiness db = new PlayerBussiness())
                {
                    PlayerInfo info = db.GetUserSingleByNickName(receiver);
                    if (info != null)
                    {
                        receiverID = info.ID;
                    }
                }
            }

            if (receiverID != 0)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                pkg.WriteInt(receiverID);
                pkg.ClientID = (client.Player.PlayerCharacter.ID);
                //pkg.WriteInt(senderID);
                pkg.WriteString(receiver);
                pkg.WriteString(sender);
                pkg.WriteString(msg);
                pkg.WriteBoolean(false);

                GamePlayer player = Managers.WorldMgr.GetPlayerById(receiverID);

                if (player != null)
                {
                    if (player.IsBlackFriend(client.Player.PlayerCharacter.ID))
                    {
                        return(1);
                    }
                    player.Out.SendTCP(pkg);
                }
                else
                {
                    GameServer.Instance.LoginServer.SendPacket(pkg);
                }
                client.Out.SendTCP(pkg);
            }
            else
            {
                client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserPrivateChatHandler.NoUser"));
            }



            return(1);
        }
Exemplo n.º 17
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            int    id         = packet.ReadInt();
            string nickName   = packet.ReadString();
            string senderName = packet.ReadString();
            string msg        = packet.ReadString();

            if (id == 0)
            {
                using (PlayerBussiness db = new PlayerBussiness())
                {
                    PlayerInfo info = db.GetUserSingleByNickName(nickName);
                    if (info != null)
                    {
                        id = info.ID;
                    }
                }
            }
            int result;

            if (id != 0)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                pkg.ClientID = player.PlayerCharacter.ID;
                pkg.WriteInt(id);
                pkg.WriteString(nickName);
                pkg.WriteString(player.PlayerCharacter.NickName);
                pkg.WriteString(msg);
                GamePlayer other = WorldMgr.GetPlayerById(id);
                if (other != null)
                {
                    if (other.IsBlackFriend(player.PlayerCharacter.ID))
                    {
                        result = 1;
                        return(result);
                    }
                    other.Out.SendTCP(pkg);
                }
                else
                {
                    GameServer.Instance.LoginServer.SendPacket(pkg);
                }
                player.Out.SendTCP(pkg);
            }
            else
            {
                player.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("UserPrivateChatHandler.NoUser", new object[0]));
            }
            result = 1;
            return(result);
        }
Exemplo n.º 18
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            //if (DateTime.Now.Date != client.Player.PlayerCharacter.LastDate.Date)
            //{
            pkg.WriteBoolean(true);
            //}
            //else
            //{
            //    pkg.WriteBoolean(false);
            //}
            client.SendTCP(pkg);
            return(0);
        }
Exemplo n.º 19
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            packet = packet.Clone();
            packet.ClearContext();
            int num  = packet.ReadInt();
            int num2 = packet.ReadInt();
            int num3 = packet.ReadInt();
            int num4 = packet.ReadInt();
            int num5 = packet.ReadInt();
            int num6 = packet.ReadInt();
            int num7 = packet.ReadInt();

            client.Player.CurrentHotSpringRoom = new HotSpringRoom(new HotSpringRoomInfo(), new TankHotSpringLogicProcessor());
            client.Player.CurrentHotSpringRoom.ProcessData(client.Player, packet);
            return(0);
        }
Exemplo n.º 20
0
        public override int HandlePacket(GamePlayer player, GSPacketIn packet)
        {
            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();
            Dictionary <int, int> infos = ShopMgr.GetLimitShopItemInfo();

            pkg.WriteInt(infos.Count);
            foreach (int key in infos.Keys)
            {
                pkg.WriteInt(key);
                pkg.WriteInt(infos[key]);
            }
            player.SendTCP(pkg);
            return(0);
        }
Exemplo n.º 21
0
        public bool HandleCommand(TankGameLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            if (player.CurrentGame.Data.CurrentIndex == player || player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClientID = player.PlayerCharacter.ID;
                player.CurrentGame.SendToPlayerExceptSelf(pkg, player);

                byte   type     = packet.ReadByte();
                int    tx       = packet.ReadInt();
                int    ty       = packet.ReadInt();
                byte   dir      = packet.ReadByte();
                bool   isLiving = packet.ReadBoolean();
                Player p        = player.CurrentGame.Data.Players[player];

                switch (type)
                {
                case 0:
                case 1:
                    //p.X = tx;
                    //p.Y = ty;
                    p.SetXY(tx, ty);
                    if (player.CurrentGame != null)
                    {
                        p.StartMoving();
                        if (p.Y - ty > 1 || p.IsLiving != isLiving)
                        {
                            //GameServer.log.Error(string.Format("修正掉落: 动作类型  {0}    原始Y:{1}     最新Y:{2}", type, ty, p.Y));
                            //把服务器修正的掉落指令和客户掉落指令加以区分。
                            pkg = player.Out.SendPlayerMove(3, p.X, p.Y, 0, p.IsLiving);
                            player.CurrentGame.SendToPlayerExceptSelf(pkg, player);
                        }
                    }
                    break;

                case 2:
                    if (player.CurrentGame.Data.Players[player].State == TankGameState.DEAD)
                    {
                        p.EndX = tx;
                        p.EndY = ty;
                    }
                    break;
                }
                return(true);
            }
            return(false);
        }
Exemplo n.º 22
0
        public bool HandleCommand(GamePlayer player, GSPacketIn packet)
        {
            bool result;

            if (player.CurrentSpaRoom == null)
            {
                result = false;
            }
            else
            {
                if (player.CurrentSpaRoom.Spa_Room_Info.PlayerID != player.PlayerCharacter.ID)
                {
                    result = false;
                }
                else
                {
                    if (player.CurrentSpaRoom.Count >= player.CurrentSpaRoom.Spa_Room_Info.MaxCount)
                    {
                        result = false;
                    }
                    else
                    {
                        GSPacketIn pkg = packet.Clone();
                        pkg.ClearContext();
                        int        id           = packet.ReadInt();
                        GamePlayer invitePlayer = WorldMgr.GetPlayerById(id);
                        if (invitePlayer != null && invitePlayer.CurrentRoom == null && invitePlayer.CurrentMarryRoom == null && invitePlayer.CurrentSpaRoom == null)
                        {
                            pkg.WriteByte(4);
                            pkg.WriteInt(player.PlayerCharacter.ID);
                            pkg.WriteString(player.PlayerCharacter.NickName);
                            pkg.WriteInt(player.CurrentSpaRoom.Spa_Room_Info.RoomID);
                            pkg.WriteString(player.CurrentSpaRoom.Spa_Room_Info.RoomName);
                            pkg.WriteString(player.CurrentSpaRoom.Spa_Room_Info.Pwd);
                            invitePlayer.Out.SendTCP(pkg);
                            result = true;
                        }
                        else
                        {
                            result = false;
                        }
                    }
                }
            }
            return(result);
        }
Exemplo n.º 23
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            byte unknow = packet.ReadByte();
            int  id     = packet.ReadInt();

            if (client.Player.PlayerCharacter.AnswerSite < id)
            {
                List <ItemInfo> infos = null;
                client.Player.PlayerCharacter.AnswerSite = id;
                if (DropInventory.AnswerDrop(id, ref infos))
                {
                    int gold      = 0;
                    int money     = 0;
                    int giftToken = 0;
                    int medal     = 0;
                    foreach (ItemInfo info in infos)
                    {
                        ItemInfo.FindSpecialItemInfo(info, ref gold, ref money, ref giftToken, ref medal);
                        //if ((info != null) && (info.Template.BagType == eBageType.PropBag))
                        //{
                        client.Player.MainBag.AddTemplate(info, info.Count);
                        //}
                        client.Player.AddGold(gold);
                        client.Player.AddMoney(money);
                        client.Player.AddGiftToken(giftToken);
                        client.Player.AddMedal(medal);
                        LogMgr.LogMoneyAdd(LogMoneyType.Award, LogMoneyType.Award_Answer, client.Player.PlayerCharacter.ID, giftToken, client.Player.PlayerCharacter.Money, money, 0, 0, 0, "", "", "");
                    }
                }
            }

            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();
            pkg.WriteInt(client.Player.PlayerCharacter.AnswerSite);
            for (int i = 0; i < client.Player.PlayerCharacter.AnswerSite; i++)
            {
                pkg.WriteByte(unknow);
            }

            client.Player.Out.SendTCP(pkg);
            return(1);
        }
Exemplo n.º 24
0
        public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
        {
            if (player.IsAttacking)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClientID   = player.PlayerDetail.PlayerCharacter.ID;
                pkg.Parameter1 = player.Id;
                game.SendToAll(pkg, player.PlayerDetail);

                byte type     = packet.ReadByte();
                int  tx       = packet.ReadInt();
                int  ty       = packet.ReadInt();
                byte dir      = packet.ReadByte();
                bool isLiving = packet.ReadBoolean();
                //Console.WriteLine("isLiving : {0}, tx : {1}, ty : {2}, type : {3}, playerId : {4}", isLiving, tx, ty, type, player.Id);
                switch (type)
                {
                case 0:
                case 1:
                    //p.X = tx;
                    //p.Y = ty;
                    // if (player.PlayerDetail.PlayerCharacter.NickName == "jacken123")
                    // Console.WriteLine(player.PlayerDetail.PlayerCharacter.NickName + "X坐标" + player.X.ToString() + "Y坐标" + player.Y.ToString());
                    player.SetXY(tx, ty);
                    player.StartMoving();
                    // if (player.PlayerDetail.PlayerCharacter.NickName == "jacken123")
                    // Console.WriteLine(string.Format("修正掉落: 动作类型  {0}    原始Y:{1}     最新Y:{2}", type, ty, player.Y));
                    if (player.Y - ty > 1 || player.IsLiving != isLiving)
                    {
                        //Console.WriteLine("player.IsLiving : {0}, playerId : {1}", player.IsLiving, player.Id);
                        //把服务器修正的掉落指令和客户掉落指令加以区分。
                        Console.WriteLine("玩家移动掉落:" + player.IsLiving.ToString());
                        game.SendPlayerMove(player, 3, player.X, player.Y, 0, player.IsLiving, null);
                    }
                    break;

                case 2:
                    break;
                }
            }
        }
Exemplo n.º 25
0
        public bool HandleCommand(TankMarryLogicProcessor process, GamePlayer player, GSPacketIn packet)
        {
            bool result;

            if (player.CurrentMarryRoom == null || player.CurrentMarryRoom.RoomState != eRoomState.FREE)
            {
                result = false;
            }
            else
            {
                if (!player.CurrentMarryRoom.Info.GuestInvite)
                {
                    if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID)
                    {
                        result = false;
                        return(result);
                    }
                }
                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                int        id            = packet.ReadInt();
                GamePlayer invitedplayer = WorldMgr.GetPlayerById(id);
                if (invitedplayer != null && invitedplayer.CurrentRoom == null && invitedplayer.CurrentMarryRoom == null && invitedplayer.CurrentSpaRoom == null)
                {
                    pkg.WriteByte(4);
                    pkg.WriteInt(player.PlayerCharacter.ID);
                    pkg.WriteString(player.PlayerCharacter.NickName);
                    pkg.WriteInt(player.CurrentMarryRoom.Info.ID);
                    pkg.WriteString(player.CurrentMarryRoom.Info.Name);
                    pkg.WriteString(player.CurrentMarryRoom.Info.Pwd);
                    pkg.WriteInt(player.MarryMap);
                    invitedplayer.Out.SendTCP(pkg);
                    result = true;
                }
                else
                {
                    result = false;
                }
            }
            return(result);
        }
Exemplo n.º 26
0
 public bool HandleCommand(TankHotSpringLogicProcessor process, GamePlayer player, GSPacketIn packet)
 {
     if ((player.CurrentHotSpringRoom != null) && (player.CurrentHotSpringRoom.RoomState == eRoomState.FREE))
     {
         if (player.PlayerCharacter.ID != player.CurrentHotSpringRoom.Info.PlayerID)
         {
             return(false);
         }
         GSPacketIn pkg = packet.Clone();
         pkg.ClearContext();
         GamePlayer playerById = WorldMgr.GetPlayerById(packet.ReadInt());
         if (((playerById != null) && (playerById.CurrentRoom == null)) && (playerById.CurrentHotSpringRoom == null))
         {
             pkg.WriteByte((byte)HotSpringCmdType.HOTSPRING_ROOM_INVITE);
             pkg.WriteInt(player.CurrentHotSpringRoom.Info.RoomID);
             playerById.Out.SendTCP(pkg);
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 27
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 == false)
            {
                if (player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.GroomID && player.PlayerCharacter.ID != player.CurrentMarryRoom.Info.BrideID)
                {
                    return(false);
                }
            }

            GSPacketIn pkg = packet.Clone();

            pkg.ClearContext();

            int        id            = packet.ReadInt();
            GamePlayer invitedplayer = Managers.WorldMgr.GetPlayerById(id);

            if (invitedplayer != null && invitedplayer.CurrentRoom == null && invitedplayer.CurrentMarryRoom == null)
            {
                pkg.WriteByte((byte)MarryCmdType.INVITE);
                pkg.WriteInt(player.PlayerCharacter.ID);
                pkg.WriteString(player.PlayerCharacter.NickName);
                pkg.WriteInt(player.CurrentMarryRoom.Info.ID);
                //pkg.WriteInt(player.CurrentMarryRoom.Info.MapIndex);
                pkg.WriteString(player.CurrentMarryRoom.Info.Name);
                pkg.WriteString(player.CurrentMarryRoom.Info.Pwd);
                pkg.WriteInt(player.MarryMap);

                invitedplayer.Out.SendTCP(pkg);

                return(true);
            }

            return(false);
        }
Exemplo n.º 28
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            //修改:  Xiaov
            //时间:  2009-11-4
            //描述:  小喇叭<未测试>

            ItemInfo item = client.Player.PropBag.GetItemByCategoryID(0, 11, 4);

            if (item != null)
            {
                //item.Count--;
                //if (item.Count <= 0)
                //{
                //    client.Player.RemoveItem(item);
                //}
                //else
                //{
                client.Player.PropBag.RemoveCountFromStack(item, 1);
                //  }
                int        senderID   = packet.ReadInt();
                string     senderName = packet.ReadString();
                string     msg        = packet.ReadString();
                GSPacketIn pkg        = packet.Clone();
                pkg.ClearContext();
                pkg.ClientID = (client.Player.PlayerCharacter.ID);
                pkg.WriteInt(client.Player.PlayerCharacter.ID);
                pkg.WriteString(client.Player.PlayerCharacter.NickName);
                pkg.WriteString(msg);


                GamePlayer[] players = Managers.WorldMgr.GetAllPlayers();

                foreach (GamePlayer p in players)
                {
                    p.Out.SendTCP(pkg);
                }
            }

            return(0);
        }
Exemplo n.º 29
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            ItemInfo item = client.Player.PropBag.GetItemByCategoryID(0, 11, 5);

            if (item != null)
            {
                //item.Count--;
                //if (item.Count <= 0)
                //{
                //    //client.Player.RemoveAllItem(item, false, Game.Server.Statics.ItemRemoveType.Use, item.GetBagType());
                //    client.Player.RemoveItem(item);
                //}
                //else
                //{
                // client.Player.PropBag.RefreshItem(item);
                client.Player.PropBag.RemoveCountFromStack(item, 1);


                //  }
                int    senderID   = packet.ReadInt();
                string senderName = packet.ReadString();
                string msg        = packet.ReadString();

                GSPacketIn pkg = packet.Clone();
                pkg.ClearContext();
                pkg.ClientID = (client.Player.PlayerCharacter.ID);
                pkg.WriteInt(client.Player.PlayerCharacter.ID);
                pkg.WriteString(client.Player.PlayerCharacter.NickName);
                pkg.WriteString(msg);

                GameServer.Instance.LoginServer.SendPacket(pkg);

                GamePlayer[] players = Managers.WorldMgr.GetAllPlayers();
                foreach (GamePlayer p in players)
                {
                    p.Out.SendTCP(pkg);
                }
            }
            return(0);
        }
Exemplo n.º 30
0
        public void HandleCommand(BaseGame game, Player player, GSPacketIn packet)
        {
            if (player.IsLiving || player.IsAttacking)
            {
                GSPacketIn pkg = packet.Clone();
                pkg.ClientID = player.Id;
                game.SendToAll(pkg, player.PlayerDetail);

                byte type     = packet.ReadByte();
                int  tx       = packet.ReadInt();
                int  ty       = packet.ReadInt();
                byte dir      = packet.ReadByte();
                bool isLiving = packet.ReadBoolean();

                switch (type)
                {
                case 0:
                case 1:
                    //p.X = tx;
                    //p.Y = ty;
                    player.SetXY(tx, ty);
                    player.StartMoving();
                    if (player.Y - ty > 1 || player.IsLiving != isLiving)
                    {
                        //GameServer.log.Error(string.Format("修正掉落: 动作类型  {0}    原始Y:{1}     最新Y:{2}", type, ty, p.Y));
                        //把服务器修正的掉落指令和客户掉落指令加以区分。
                        pkg = player.PlayerDetail.Out.SendPlayerMove(player, 3, player.X, player.Y, 0, player.IsLiving);
                        game.SendToAll(pkg, player.PlayerDetail);
                    }
                    break;

                case 2:
                    if (player.IsLiving == false)
                    {
                        player.TargetPoint = new Point(tx, ty);
                    }
                    break;
                }
            }
        }