public override void RunImpl() { Channel channel = getClient().getPlayer().getChannel(); Room room = getClient().getPlayer().getRoom(); Player player = getClient().getPlayer(); if (room.getLeader().Equals(getClient().getPlayer())) { if (room.isFigth() == 0) { room.setFigth(1); room.setTimeLost(room.getKillTime() * 60); } if (room.getPlayers() != null) { if (getClient().getPlayer().getRoom().getPlayers() != null) { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); if (slot.getState() == SLOT_STATE.SLOT_STATE_READY && !room.getLeader().Equals(member)) { slot.setState(SLOT_STATE.SLOT_STATE_LOAD); member.getClient().SendPacket(new PROTOCOL_BATTLE_READYBATTLE_ACK(room,getClient().getPlayer())); } else if (room.getLeader().Equals(member)) { slot.setState(SLOT_STATE.SLOT_STATE_LOAD); member.getClient().SendPacket(new PROTOCOL_BATTLE_READYBATTLE_ACK(room,member)); } } } } } else { SLOT slotLeader = room.getRoomSlotByPlayer(room.getLeader()); SLOT slot = room.getRoomSlotByPlayer(getClient().getPlayer()); if (slotLeader.getState() == SLOT_STATE.SLOT_STATE_LOAD || slotLeader.getState() == SLOT_STATE.SLOT_STATE_RENDEZVOUS || slotLeader.getState() == SLOT_STATE.SLOT_STATE_PRESTART || slotLeader.getState() == SLOT_STATE.SLOT_STATE_BATTLE_READY || slotLeader.getState() == SLOT_STATE.SLOT_STATE_BATTLE) { slot.setState(SLOT_STATE.SLOT_STATE_LOAD); getClient().SendPacket(new PROTOCOL_BATTLE_READYBATTLE_ACK(room,getClient().getPlayer())); } if (slot.getState() == SLOT_STATE.SLOT_STATE_READY) { slot.setState(SLOT_STATE.SLOT_STATE_NORMAL); } else if (slot.getState() == SLOT_STATE.SLOT_STATE_NORMAL) { slot.setState(SLOT_STATE.SLOT_STATE_READY); } } // слать пакет ROOM_INFO всем игрокам foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); } }
public override void RunImpl() { Player player = getClient().getPlayer(); Room room = player.getRoom(); SLOT slot = room.getRoomSlotByPlayer(getClient().getPlayer()); getClient().SendPacket(new opcode_3890_ACK(room)); getClient().SendPacket(new PROTOCOL_BATTLE_ROOMINFO_ACK(room)); // if (room.getLeader().Equals(getClient().getPlayer())) // { getClient().getPlayer().getRoom().getRoomSlotByPlayer(getClient().getPlayer()).setState(SLOT_STATE.SLOT_STATE_BATTLE_READY); room.RoomTask(getClient().getPlayer().ChannelId, room); // } //room.RoomTask(getClient().getPlayer().ChannelId, room); Logger.Info("START {0}", slot.getState()); foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); Thread.Sleep(2000); getClient().SendPacket(new PROTOCOL_MESSAGE_ALL_PLAYERS_ACK()); } //TODO: Доделать if (room.getSpecial() != 6) { //getClient().SendPacket(new PROTOCOL_BASE_MISSION_COMPLETE_ACK((int)Mission.MISSION_ENTER, 1));//миссия выполнена - вход в бой getClient().SendPacket(new PROTOCOL_BASE_MISSION_COMPLETE_ACK(243, 1));//миссия выполнена - смерть } }
public override void WriteImpl() { WriteH(0xf45); WriteD(playerSlot.getId()); WriteC((byte)playerSlot.getState()); WriteH((byte)playerSlot.getPlayer().getRank()); WriteB(new byte[8]); if (playerSlot.getPlayer().getClanID() == 0) { WriteC(0xff); WriteC(0xff); WriteC(0xff); WriteC(0xff); WriteC(0); WriteS("",0x16); } else { WriteC((byte)playerSlot.getPlayer().getClan().getLogo1()); WriteC((byte)playerSlot.getPlayer().getClan().getLogo2()); WriteC((byte)playerSlot.getPlayer().getClan().getLogo3()); WriteC((byte)playerSlot.getPlayer().getClan().getLogo4()); WriteC((byte)playerSlot.getPlayer().getClan().getColor()); WriteS(playerSlot.getPlayer().getClan().getName(),Clan.CLAN_NAME_SIZE); } WriteC((byte)playerSlot.getId()); WriteC((byte)playerSlot.getPlayer().PlayerName.Length); WriteC(0); WriteH((byte)(playerSlot.getPlayer().PlayerName.Length + 1)); WriteS(playerSlot.getPlayer().PlayerName,Player.MAX_NAME_SIZE); WriteC(0); }
public override void RunImpl() { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = getClient().getPlayer().getRoom().getRoomSlotByPlayer(member); if ((int)slot.getState() > 8) { member.getClient().SendPacket(new PROTOCOL_BATTLE_RESPAWN_ACK(getClient().getPlayer().getRoom().getRoomSlotByPlayer(getClient().getPlayer()).getId(),first,second,third,fourth,fifth,id,red,blue,head,beret,dino)); } } }
public override void WriteImpl() { WriteH(0xF25); WriteC(0); WriteC((byte)leaderSlot.getId()); WriteC(1);//(byte)slotcount if (slotcount > 1) { foreach (int slot in Room.RED_TEAM) { SLOT oldSlot = room.getRoomSlots()[slot]; SLOT newSlot = room.getRoomSlots()[slot + 1]; SLOT_STATE oldState = oldSlot.getState(); oldSlot.setState(newSlot.getState()); newSlot.setState(oldState); Player oldPlayer = oldSlot.getPlayer(); oldSlot.setPlayer(newSlot.getPlayer()); newSlot.setPlayer(oldPlayer); WriteC((byte)oldSlot.getId()); WriteC((byte)newSlot.getId()); WriteC((byte)(int)oldSlot.getState()); WriteC((byte)(int)newSlot.getState()); } } else { SLOT oldSlot = room.getRoomSlotByPlayer(sender); SLOT newSlot = room.changeTeam(sender,newTeam); WriteC((byte)oldSlot.getId()); WriteC((byte)newSlot.getId()); WriteC((byte)(int)oldSlot.getState()); WriteC((byte)(int)newSlot.getState()); } }
public override void RunImpl() { Player player = getClient().getPlayer(); Room room = player.getRoom(); if (getClient().getPlayer().getRoom().getPlayers() != null) { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); if (slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE) { member.getClient().SendPacket(new opcode_3860_ACK(_bytes)); } } } }
public override void RunImpl() { SLOT slot = getClient().getPlayer().getRoom().getRoomSlots()[slotId]; if (slot.getState() == SLOT_STATE.SLOT_STATE_CLOSE) { slot.setState(SLOT_STATE.SLOT_STATE_EMPTY); } else { slot.setState(SLOT_STATE.SLOT_STATE_CLOSE); } foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(getClient().getPlayer().getRoom())); } }
public override void RunImpl() { Player player = getClient().getPlayer(); Room room = player.getRoom(); SLOT slot = room.getRoomSlotByPlayer(getClient().getPlayer()); if (room == null) { return; } Player leader = player.getRoom().getLeader(); room.getRoomSlotByPlayer(player).setState(SLOT_STATE.SLOT_STATE_PRESTART); getClient().SendPacket(new PROTOCOL_BATTLE_PRESTARTBATTLE_ACK(room, player)); if (player.PlayerID != leader.PlayerID) { leader.getClient().SendPacket(new PROTOCOL_BATTLE_PRESTARTBATTLE_ACK(room, player)); // лидер } Logger.Info("PRESTART {0}", slot.getState()); if (Array.BinarySearch(Room.RED_TEAM, slot.getId()) >= 0) { room.redTeamCount = room.redTeamCount + 1; } else { room.blueTeamCount = room.blueTeamCount + 1; } if (!room.getLeader().Equals(player) && (int)room.getRoomSlotByPlayer(room.getLeader()).getState() > 8) { BattleHandler.AddPlayer(player); } foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); } }
public override void RunImpl() { getClient().SendPacket(new PACKET_LEVEL_UP_ACK(getClient().getPlayer().getRank())); Player player = getClient().getPlayer(); Room room = player.getRoom(); stats = PlayersStatsTable.statistics[player.PlayerID]; room.getRoomSlotByPlayer(player).setState(SLOT_STATE.SLOT_STATE_NORMAL); if (coupon == 0) { PlayersStatsTable.UpdateEscapes(player.PlayerID, stats.getSeasonEscapes() + 1);//записываем побег } getClient().getPlayer().getRoom().getRoomSlotByPlayer(getClient().getPlayer()).setState(SLOT_STATE.SLOT_STATE_NORMAL); // статус слота if (player == room.getLeader() & room.getPlayers().Count == 1) //если игрок лидер и он один в комнате { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); if (slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE || slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE_READY || slot.getState() == SLOT_STATE.SLOT_STATE_PRESTART || slot.getState() == SLOT_STATE.SLOT_STATE_LOAD || slot.getState() == SLOT_STATE.SLOT_STATE_RENDEZVOUS) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); //отправляем инфу о комнате member.getClient().SendPacket(new PROTOCOL_BATTLE_LEAVE_ACK(room.getRoomSlotByPlayer(player).getId())); //инфа о том,что игрок вышел из боя } } for (int i = 0; i < 16; i++) { SLOT slot = room.getRoomSlot(i); slot.setKillMessage(0); slot.setLastKillMessage(0); slot.setOneTimeKills(0); slot.setAllKills(0); slot.setAllDeahts(0); slot.setBotScore(0); } room.setRedKills(0); room.setRedDeaths(0); room.setBlueKills(0); room.setBlueDeaths(0); room.setFigth(0); player.getClient().SendPacket(new PROTOCOL_BATTLE_END_ACK(player,room)); } if (player != room.getLeader())//если игрок не лидер { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); if (slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE || slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE_READY || slot.getState() == SLOT_STATE.SLOT_STATE_PRESTART || slot.getState() == SLOT_STATE.SLOT_STATE_LOAD || slot.getState() == SLOT_STATE.SLOT_STATE_RENDEZVOUS) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); //отправляем инфу о комнате member.getClient().SendPacket(new PROTOCOL_BATTLE_LEAVE_ACK(room.getRoomSlotByPlayer(player).getId())); //инфа о том,что игрок вышел из боя } } } if (player == room.getLeader() & room.getPlayers().Count > 1) //если игрок лидер и игроков в комнате больше одного { room.setNewLeader(); //выбираем нового лидера BattleHandler.ChangeHost(room,room.getLeader()); //отправляем на боевой сервер информацию о новом лидере комнаты foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); if (slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE || slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE_READY || slot.getState() == SLOT_STATE.SLOT_STATE_PRESTART || slot.getState() == SLOT_STATE.SLOT_STATE_LOAD || slot.getState() == SLOT_STATE.SLOT_STATE_RENDEZVOUS) { member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); //отправляем инфу о комнате member.getClient().SendPacket(new PROTOCOL_BATTLE_LEAVE_ACK(room.getRoomSlotByPlayer(player).getId())); //инфа о том,что игрок вышел из боя member.getClient().SendPacket(new PROTOCOL_BATTLE_CHANGE_NETWORK_ACK(room)); //отправляем пакет с инфой о смене адреса } } } }
/*public static void ChangeRoomState(ROOM_STATE RoomState, Player p, Room room) * { * if (room.getState() == ROOM_STATE.ROOM_STATE_PRE_BATTLE) * { * if (p.PlayerID == room.getLeader().PlayerID) * { * // фраги * } * * for (int slot = 0; slot < 15; ++slot) * { * Player playerBySlot = room.getPlayerBySlot(slot); * GameNetwork playerFromPlayerId2 = RoomManager.getPlayer(playerBySlot.getRoom().getRoomId(), playerBySlot.PlayerID); * if (room.Slots[slot].State == SLOT_STATE.SLOT_STATE_BATTLE_READY && room.Slots[slot].PlayerID > 0 && playerBySlot != null) * { * room.СhangeSlotState(slot, SLOT_STATE.SLOT_STATE_BATTLE); * // GameNetwork playerFromPlayerId2 = RoomManager.getPlayer(playerBySlot.getRoom().getRoomId(), playerBySlot.PlayerID); * playerFromPlayerId2.SendPacket(new opcode_3879_ACK(playerBySlot.getRoom())); * playerFromPlayerId2.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK()); * if (p.PlayerID != playerBySlot.PlayerID) * { * playerFromPlayerId2.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK()); * } * playerFromPlayerId2.SendPacket(new opcode_3865_ACK()); * playerFromPlayerId2.SendPacket(new opcode_3867_ACK()); * } * } * room.setState(ROOM_STATE.ROOM_STATE_BATTLE); * } * else * { * GameNetwork player = RoomManager.getPlayer(p.getRoom().getRoomId(), p.PlayerID); * room.СhangeSlotState(p.getSlot(), SLOT_STATE.SLOT_STATE_BATTLE); * player.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK()); // TODO: Player * for (int slot = 0; slot < 15; ++slot) * { * Player playerBySlot = room.getPlayerBySlot(slot); * GameNetwork playerFromPlayerId2 = RoomManager.getPlayer(playerBySlot.getRoom().getRoomId(), playerBySlot.PlayerID); * if (room.Slots[slot].State == SLOT_STATE.SLOT_STATE_BATTLE_READY && room.Slots[slot].PlayerID > 0) * { * if (p.PlayerID != playerBySlot.PlayerID) * { * playerFromPlayerId2.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK()); * } * player.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK()); * } * * } * player.SendPacket(new opcode_3865_ACK()); * player.SendPacket(new opcode_3867_ACK()); * } * }*/ public static void RoomTask(int channel, Room room) { int countPlayerPrestart = 0; foreach (GameNetwork player in getPlayers(room.getId()).ToArray()) { SLOT slot = room.ROOM_SLOT[player.getPlayer().getSlot()]; if ((int)slot.getState() > 8 && (int)slot.getState() < 12) { countPlayerPrestart++; } } SLOT leader = room.ROOM_SLOT[room.getLeader().getSlot()]; if ((int)leader.getState() < 13) { if (countPlayerPrestart == 0) { if ((int)leader.getState() < 13) { foreach (GameNetwork member in getPlayers(room.getId()).ToArray()) { SLOT playerSlot = room.ROOM_SLOT[member.getPlayer().getSlot()]; if (playerSlot.getState() == SLOT_STATE.SLOT_STATE_BATTLE_READY) { playerSlot.setState(SLOT_STATE.SLOT_STATE_BATTLE); member.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(room,member.getPlayer())); foreach (GameNetwork toSend in getPlayers(room.getId()).ToArray()) { if (!toSend.Equals(member)) { SLOT toSendplayerSlot = room.ROOM_SLOT[toSend.getPlayer().getSlot()]; if ((int)toSendplayerSlot.getState() > 11) { member.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(room,toSend.getPlayer())); } } } member.SendPacket(new opcode_3865_ACK()); member.SendPacket(new PROTOCOL_BATTLE_ROUND_START(room)); } } } } } else { foreach (GameNetwork player in getPlayers(room.getId()).ToArray()) { SLOT playerSlot = room.ROOM_SLOT[player.getPlayer().getSlot()]; if ((int)playerSlot.getState() == 12) { player.SendPacket(new opcode_3890_ACK(room)); playerSlot.setState(SLOT_STATE.SLOT_STATE_BATTLE); player.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(room,player.getPlayer())); foreach (GameNetwork player1 in getPlayers(room.getId()).ToArray()) { SLOT why = room.ROOM_SLOT[player1.getPlayer().getSlot()]; if ((int)why.getState() == 13 && !player.Equals(player1)) { player1.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(room,player.getPlayer())); player.SendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(room,player1.getPlayer())); } } player.SendPacket(new opcode_3865_ACK()); player.SendPacket(new PROTOCOL_BATTLE_ROUND_START(room)); } } } }
public override void RunImpl() { Room room = getClient().getPlayer().getRoom(); room.setTimeLost(timeLost); Player player = getClient().getPlayer(); if (room != null) { if (timeLost < 1 & getClient().getPlayer().getRoom().getBombState() == 0) { if (room.getLeader().Equals(player)) { if (room.getType() == 2) { room.setBlueWinRounds(room.getBlueWinRounds() + 1); } if (room.getType() == 2 && room.getBlueWinRounds() != room.getKillsByMask()) { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); slot.setKillMessage(0); slot.setLastKillMessage(0); slot.setOneTimeKills(0); member.getClient().SendPacket(new PROTOCOL_BATTLE_ROUND_END_ACK(1,2,getClient().getPlayer().getRoom())); } Thread.Sleep(10000); foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { member.getClient().SendPacket(new opcode_3865_ACK()); member.getClient().SendPacket(new PROTOCOL_BATTLE_ROUND_START(member.getRoom())); } } else { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); if (slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE || slot.getState() == SLOT_STATE.SLOT_STATE_BATTLE_READY || slot.getState() == SLOT_STATE.SLOT_STATE_PRESTART || slot.getState() == SLOT_STATE.SLOT_STATE_LOAD || slot.getState() == SLOT_STATE.SLOT_STATE_RENDEZVOUS) { slot.setState(SLOT_STATE.SLOT_STATE_NORMAL); /* Подсчет статистики */ stats = PlayersStatsTable.statistics[member.getClient().getPlayer().AccountID]; stats.setSeasonKills(stats.getSeasonKills() + slot.getAllKills()); //подсчет убийств stats.setSeasonDeaths(stats.getSeasonDeaths() + slot.getAllDeath()); //подсчет смертей stats.setHeadshots(stats.getHeadshots() + slot.getHeadshots()); //подсчет попаданий в голову PlayersStatsTable.UpdateStats(member.getClient().getPlayer().PlayerID,stats.getSeasonKills(),stats.getHeadshots(),stats.getSeasonDeaths()); member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); member.getClient().SendPacket(new PROTOCOL_BATTLE_END_ACK(member,getClient().getPlayer().getRoom())); member.getClient().SendPacket(new PROTOCOL_ROOM_INFO_ACK(room)); } } for (int i = 0; i < 16; i++) { SLOT slot = room.getRoomSlot(i); slot.setKillMessage(0); slot.setLastKillMessage(0); slot.setOneTimeKills(0); slot.setAllKills(0); slot.setAllDeahts(0); slot.setBotScore(0); } room.setRedKills(0); room.setRedDeaths(0); room.setBlueKills(0); room.setBlueDeaths(0); room.setFigth(0); } } } } }
public override void WriteImpl() { try { if (room != null) { WriteH(3861); if (room.getRoomSlotByPlayer(room.getLeader()) == null) { room.setNewLeader(); } WriteD(room.getRoomSlotByPlayer(room.getLeader()).getId()); for (int slotId = 0; slotId < 16; ++slotId) { Player player = room.getRoomSlot(slotId).getPlayer(); SLOT roomSlot = room.getRoomSlot(slotId); if (player != null) { WriteC((byte)roomSlot.getState()); WriteC((byte)roomSlot.getPlayer().getRank()); WriteB(new byte[9]); WriteC(roomSlot.getPlayer() == null || roomSlot.getPlayer().ClanID == 0 ? (byte)255 : (byte)roomSlot.getPlayer().Clan.Logo1); WriteC(roomSlot.getPlayer() == null || roomSlot.getPlayer().ClanID == 0 ? (byte)255 : (byte)roomSlot.getPlayer().Clan.Logo2); WriteC(roomSlot.getPlayer() == null || roomSlot.getPlayer().ClanID == 0 ? (byte)255 : (byte)roomSlot.getPlayer().Clan.Logo3); WriteC(roomSlot.getPlayer() == null || roomSlot.getPlayer().ClanID == 0 ? (byte)255 : (byte)roomSlot.getPlayer().Clan.Logo4); WriteC(roomSlot.getPlayer() == null || roomSlot.getPlayer().ClanID == 0 ? (byte)255 : (byte)roomSlot.getPlayer().Clan.Color); WriteD(roomSlot.getPlayer() == null || roomSlot.getPlayer().ClanID == 0 ? 0 : roomSlot.getPlayer().getPCCafe()); //пк_кафе WriteH(roomSlot.getPlayer() == null || roomSlot.getPlayer().ClanID == 0 ? (short)0 : (short)roomSlot.getPlayer().getEmblem()); //Лычка WriteS(roomSlot.getPlayer() == null || roomSlot.getPlayer().ClanID == 0 ? "" : roomSlot.getPlayer().Clan.Name,Clan.CLAN_NAME_SIZE); WriteC((byte)roomSlot.getPlayer().getEffect1()); WriteC((byte)roomSlot.getPlayer().getEffect2()); WriteC((byte)roomSlot.getPlayer().getEffect3()); WriteC((byte)roomSlot.getPlayer().getEffect4()); WriteC((byte)roomSlot.getPlayer().getEffect5()); WriteC(0); WriteC(0); } else { WriteC((byte)roomSlot.getState()); WriteC(0); WriteB(new byte[9]); WriteC(0xff); WriteC(0xff); WriteC(0xff); WriteC(0xff); WriteC(0); WriteB(new byte[6]); WriteS("",0x11); WriteH(0); WriteC(0); WriteC(0); } } } else { WriteH((short)3861); WriteD(0); WriteB(new byte[10] { (byte)1, (byte)2, (byte)3, (byte)4, (byte)5, (byte)6, (byte)7, (byte)8, (byte)9, (byte)10 }); } } catch (Exception e) { Logger.Error(e.ToString()); } }