public int HandlePacket(GameClient client, GSPacketIn packet) { //type可能的值为 -2, -1, 1, 3, 4 //当type = 1, 3, 4时,分别指快速加入组队战,Boss战,夺宝战 //当type = -1时,房间ID为所点的房间ID,无密码时也传空字符串 //当type = -2时,表示PVE游戏中的邀请 bool isInvite = packet.ReadBoolean(); int type = packet.ReadInt(); int isRoundID = packet.ReadInt(); int roomId = -1; string pwd = null; if (isRoundID == -1) { roomId = packet.ReadInt(); pwd = packet.ReadString(); } if (type == 1) { type = 0; } else if (type == 2) { type = 4; } RoomMgr.EnterRoom(client.Player, roomId, pwd, type); return(0); }
public override int HandlePacket(GamePlayer player, GSPacketIn packet) { bool isInvite = packet.ReadBoolean(); int hallType = packet.ReadInt(); int type = packet.ReadInt(); int roomId = -1; string pwd = null; int num = type; if (num == -1) { roomId = packet.ReadInt(); pwd = packet.ReadString(); } RoomMgr.EnterRoom(player, roomId, pwd, type, hallType, isInvite); return(0); }
public int HandlePacket(GameClient client, GSPacketIn packet) { //type可能的值为 -2, -1, 1, 3, 4 //当type = 1, 3, 4时,分别指快速加入组队战,Boss战,夺宝战 //当type = -1时,房间ID为所点的房间ID,无密码时也传空字符串 //当type = -2时,表示PVE游戏中的邀请 bool isInvite = packet.ReadBoolean(); int type = packet.ReadInt(); int isRoundID = packet.ReadInt(); int roomId = -1; string pwd = null; if (isRoundID == -1) { roomId = packet.ReadInt(); pwd = packet.ReadString(); } if (type == 1) { type = 0; } else if (type == 2) { type = 4; } //string pwd = null; //switch (type) //{ // case -1: // roomId = packet.ReadInt(); // pwd = packet.ReadString(); // break; // default: // break; //} //TrieuLSL //GSPacketIn pkg2 = new GSPacketIn((byte)ePackageType.SYS_NOTICE); //pkg2.WriteInt(1); //pkg2.WriteString("Bạn đang sử dụng gunny phiên bản do smallwind1912 phát triển mọi thắc mắc xin liên hệ [email protected] hoặc truy cập wohzoo.com "); //client.Out.SendTCP(pkg2); RoomMgr.EnterRoom(client.Player, roomId, pwd, type); return(0); }
public int HandlePacket(GameClient client, GSPacketIn packet) { var game_room = packet.ReadInt(); switch (game_room) { case (int)GameRoomPackageType.GAME_ROOM_SETUP_CHANGE: { if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host && !client.Player.CurrentRoom.IsPlaying) { int mapId = packet.ReadInt(); if (mapId == 10000) { return(0); } eRoomType roomType = (eRoomType)packet.ReadByte(); bool isOpenBoss = packet.ReadBoolean(); //_loc_12.isOpenBoss.writeBoolean(param3); string roomPass = packet.ReadString(); //_current.roomPass = event.pkg.readUTF(); string roomName = packet.ReadString(); //_current.roomName = event.pkg.readUTF(); byte timeType = packet.ReadByte(); byte hardLevel = packet.ReadByte(); int levelLimits = packet.ReadInt(); bool isCrossZone = packet.ReadBoolean(); //_current.isCrossZone = event.pkg.readBoolean(); int mapId2 = packet.ReadInt(); //client.Player.SendMessage("MapID: " + mapId.ToString() + "|" + roomType.ToString()); RoomMgr.UpdateRoomGameType(client.Player.CurrentRoom, roomType, timeType, (eHardLevel)hardLevel, levelLimits, mapId, roomPass, roomName, isCrossZone, isOpenBoss); } break; } case (int)GameRoomPackageType.GAME_ROOM_REMOVEPLAYER: { if (client.Player.CurrentRoom != null) { RoomMgr.ExitRoom(client.Player.CurrentRoom, client.Player); } //RoomMgr.ExitWaitingRoom(client.Player); break; } case (int)GameRoomPackageType.GAME_ROOM_UPDATE_PLACE: { if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host) { byte playerPlace = packet.ReadByte(); int place = packet.ReadInt(); bool isOpen = packet.ReadBoolean(); int placeView = packet.ReadInt(); //client.Player.SendMessage("GAME_ROOM_UPDATE_PLACE: " + // playerPlace.ToString() + "|" + place.ToString() + "|" + // isOpen.ToString() + "|" + // placeView.ToString()); RoomMgr.UpdateRoomPos(client.Player.CurrentRoom, playerPlace, isOpen, place, placeView); } break; } case (int)GameRoomPackageType.GAME_PICKUP_CANCEL: { // GAME_AWIT_CANCEL RoomMgr.CancelPickup(client.Player.CurrentRoom.BattleServer, client.Player.CurrentRoom); //GSPacketIn pkg = client.Player.Out.SendRoomPairUpCancel(client.Player.CurrentRoom); //client.Player.CurrentRoom.SendToAll(pkg, client.Player); break; } case (int)GameRoomPackageType.GAME_PICKUP_STYLE: { //_loc_2.writeInt(param1); 2 opton sendGameStyle and sendGameMode //GMAE_STYLE_RECV FREE_MODE:int = 0; GUILD_MODE:int = 1; int game = packet.ReadInt(); if (client.Player.CurrentRoom != null) { int GameStyle = packet.ReadInt(); switch (GameStyle) { case 0: client.Player.CurrentRoom.GameType = eGameType.Free; break; default: client.Player.CurrentRoom.GameType = eGameType.Guild; break; } GSPacketIn pkg = client.Player.Out.SendRoomType(client.Player, client.Player.CurrentRoom); client.Player.CurrentRoom.SendToAll(pkg, client.Player); } break; } case (int)GameRoomPackageType.GAME_PLAYER_STATE_CHANGE: { if (client.Player.MainWeapon == null) { client.Player.SendMessage(LanguageMgr.GetTranslation("Game.Server.SceneGames.NoEquip")); return(0); } if (client.Player.CurrentRoom != null) { RoomMgr.UpdatePlayerState(client.Player, packet.ReadByte()); } break; } case (int)GameRoomPackageType.GAME_ROOM_CREATE: { byte roomType = packet.ReadByte(); byte timeType = packet.ReadByte(); string roomName = packet.ReadString(); string pwd = packet.ReadString(); RoomMgr.CreateRoom(client.Player, roomName, pwd, (eRoomType)roomType, timeType); break; } case (int)GameRoomPackageType.GAME_ROOM_KICK: { //_loc_2.writeByte(param1); if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host) { RoomMgr.KickPlayer(client.Player.CurrentRoom, packet.ReadByte()); } break; } case (int)GameRoomPackageType.GAME_ROOM_LOGIN: { bool isInvite = packet.ReadBoolean(); int type = packet.ReadInt(); int isRoundID = packet.ReadInt(); int roomId = -1; string pwd = null; if (isRoundID == -1) { roomId = packet.ReadInt(); pwd = packet.ReadString(); } if (type == 1) { type = 0; } else if (type == 2) { type = 4; } RoomMgr.EnterRoom(client.Player, roomId, pwd, type); break; } case (int)GameRoomPackageType.GAME_START: { BaseRoom room = client.Player.CurrentRoom; if (room != null && room.Host == client.Player) { if (client.Player.MainWeapon == null) { client.Player.SendMessage(LanguageMgr.GetTranslation("Game.Server.SceneGames.NoEquip")); return(0); } if (room.RoomType == eRoomType.Dungeon) { if (!client.Player.IsPvePermission(room.MapId, room.HardLevel)) { //TODO 写入语言包中,以便多语言转换 client.Player.SendMessage("Do not PvePermission enter this map!"); return(0); } } RoomMgr.StartGame(client.Player.CurrentRoom); } break; } case (int)GameRoomPackageType.GAME_TEAM: { //_loc_2.writeByte(param1); if (client.Player.CurrentRoom == null || client.Player.CurrentRoom.RoomType == eRoomType.Match) { return(0); } RoomMgr.SwitchTeam(client.Player); break; } case (int)GameRoomPackageType.ROOMLIST_UPDATE: { int hallType = packet.ReadInt(); int updateType = packet.ReadInt(); int pveMapRoom = 10000; int pveHardLeve = 1011; if (updateType == -2) { pveMapRoom = packet.ReadInt(); pveHardLeve = packet.ReadInt(); } BaseRoom[] list = RoomMgr.Rooms; List <BaseRoom> tempList = new List <BaseRoom>(); for (int i = 0; i < list.Length; i++) { if (!list[i].IsEmpty) { tempList.Add(list[i]); } } if (tempList.Count > 0) { client.Out.SendUpdateRoomList(tempList); } break; } } return(0); }
public int HandlePacket(GameClient client, GSPacketIn packet) { switch (packet.ReadInt()) { case 0: { byte roomType = packet.ReadByte(); byte timeType = packet.ReadByte(); string name = packet.ReadString(); string password = packet.ReadString(); RoomMgr.CreateRoom(client.Player, name, password, (eRoomType)roomType, timeType); break; } case 1: { packet.ReadBoolean(); int num = packet.ReadInt(); int num2 = packet.ReadInt(); int roomId = -1; string pwd = null; if (num2 == -1) { roomId = packet.ReadInt(); pwd = packet.ReadString(); } if (num == 1) { num = 0; } else { if (num == 2) { num = 4; } } RoomMgr.EnterRoom(client.Player, roomId, pwd, num); break; } case 2: if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host && !client.Player.CurrentRoom.IsPlaying) { int num3 = packet.ReadInt(); eRoomType roomType2 = (eRoomType)packet.ReadByte(); bool isOpenBoss = packet.ReadBoolean(); string password2 = packet.ReadString(); string roomname = packet.ReadString(); byte timeMode = packet.ReadByte(); byte hardLevel = packet.ReadByte(); int levelLimits = packet.ReadInt(); bool isCrosszone = packet.ReadBoolean(); packet.ReadInt(); Console.WriteLine("=====>MapID: " + num3.ToString() + " |roomType: " + roomType2.ToString()); if (num3 == 0) { num3 = 401; //ME CUNG } RoomMgr.UpdateRoomGameType(client.Player.CurrentRoom, roomType2, timeMode, (eHardLevel)hardLevel, levelLimits, num3, password2, roomname, isCrosszone, isOpenBoss); //log.Error("=====>1: " + client.Player.CurrentRoom + " |2: " + roomType2 + " |3: " + timeMode + " |4: " + (eHardLevel)hardLevel + " |5: " + levelLimits + " |6: " + num3 + " |7: " + password2 + " |8: " + roomname + " |9: " + isCrosszone + " |10: " + isOpenBoss); } break; case 3: if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host) { RoomMgr.KickPlayer(client.Player.CurrentRoom, packet.ReadByte()); } break; case 5: if (client.Player.CurrentRoom != null) { RoomMgr.ExitRoom(client.Player.CurrentRoom, client.Player); } break; case 6: if (client.Player.CurrentRoom == null || client.Player.CurrentRoom.RoomType == eRoomType.Match) { return(0); } RoomMgr.SwitchTeam(client.Player); break; case 7: { BaseRoom currentRoom = client.Player.CurrentRoom; if (currentRoom != null && currentRoom.Host == client.Player) { if (client.Player.MainWeapon == null) { client.Player.SendMessage(LanguageMgr.GetTranslation("Game.Server.SceneGames.NoEquip", new object[0])); return(0); } if (currentRoom.RoomType == eRoomType.Dungeon && !client.Player.IsPvePermission(currentRoom.MapId, currentRoom.HardLevel)) { client.Player.SendMessage("Do not PvePermission enter this map!"); return(0); } RoomMgr.StartGame(client.Player.CurrentRoom); } break; } case 9: { packet.ReadInt(); int num4 = packet.ReadInt(); int num5 = 1011; if (num4 == -2) { packet.ReadInt(); num5 = packet.ReadInt(); } BaseRoom[] rooms = RoomMgr.Rooms; List <BaseRoom> list = new List <BaseRoom>(); for (int i = 0; i < rooms.Length; i++) { if (!rooms[i].IsEmpty) { switch (num4) { case 3: if (rooms[i].RoomType == eRoomType.Match || rooms[i].RoomType == eRoomType.Freedom) { list.Add(rooms[i]); } break; case 4: if (rooms[i].RoomType == eRoomType.Match) { list.Add(rooms[i]); } break; case 5: if (rooms[i].RoomType == eRoomType.Freedom) { list.Add(rooms[i]); } break; default: if (rooms[i].RoomType == eRoomType.Dungeon) { switch (num5) { case 1007: if (rooms[i].HardLevel == eHardLevel.Simple) { list.Add(rooms[i]); } break; case 1008: if (rooms[i].HardLevel == eHardLevel.Normal) { list.Add(rooms[i]); } break; case 1009: if (rooms[i].HardLevel == eHardLevel.Hard) { list.Add(rooms[i]); } break; case 1010: if (rooms[i].HardLevel == eHardLevel.Terror) { list.Add(rooms[i]); } break; default: list.Add(rooms[i]); break; } } break; } } } if (list.Count > 0) { client.Out.SendUpdateRoomList(list); } break; } case 10: if (client.Player.CurrentRoom != null && client.Player == client.Player.CurrentRoom.Host) { byte pos = packet.ReadByte(); int place = packet.ReadInt(); bool isOpened = packet.ReadBoolean(); int placeView = packet.ReadInt(); RoomMgr.UpdateRoomPos(client.Player.CurrentRoom, (int)pos, isOpened, place, placeView); } break; case 11: if (client.Player.CurrentRoom != null && client.Player.CurrentRoom.BattleServer != null) { client.Player.CurrentRoom.BattleServer.RemoveRoom(client.Player.CurrentRoom); if (client.Player != client.Player.CurrentRoom.Host) { client.Player.CurrentRoom.Host.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Game.Server.SceneGames.PairUp.Failed", new object[0])); RoomMgr.UpdatePlayerState(client.Player, 0); } else { RoomMgr.UpdatePlayerState(client.Player, 2); } } break; case 12: packet.ReadInt(); if (client.Player.CurrentRoom != null) { int num6 = packet.ReadInt(); int num7 = num6; if (num7 == 0) { client.Player.CurrentRoom.GameType = eGameType.Free; } else { client.Player.CurrentRoom.GameType = eGameType.Guild; } GSPacketIn pkg = client.Player.Out.SendRoomType(client.Player, client.Player.CurrentRoom); client.Player.CurrentRoom.SendToAll(pkg, client.Player); } break; case 15: if (client.Player.MainWeapon == null) { client.Player.SendMessage(LanguageMgr.GetTranslation("Game.Server.SceneGames.NoEquip", new object[0])); return(0); } if (client.Player.CurrentRoom != null) { RoomMgr.UpdatePlayerState(client.Player, packet.ReadByte()); } break; } return(0); }