protected internal override void write() { Clan clan = ClanManager.getInstance().get(this._player.getClanId()); SLOT roomSlotByPlayer = this.r.getRoomSlotByPlayer(this._player); this._player.setExp(this._player.getExp() + roomSlotByPlayer.exp); this._player.setGP(this._player.getGP() + roomSlotByPlayer.gp); base.writeH(3336); bool flag = this.r.room_type == 1; if (flag) { bool flag2 = this.r.getBlueKills() > this.r.getRedKills(); if (flag2) { base.writeC(1); } bool flag3 = this.r.getRedKills() > this.r.getBlueKills(); if (flag3) { base.writeC(0); } bool flag4 = this.r.getRedKills() == this.r.getBlueKills(); if (flag4) { base.writeC(2); } } bool flag5 = this.r.room_type == 2; if (flag5) { bool flag6 = this.r.getBlueWinRounds() > this.r.getRedWinRounds(); if (flag6) { base.writeC(1); } bool flag7 = this.r.getRedWinRounds() > this.r.getBlueWinRounds(); if (flag7) { base.writeC(0); } bool flag8 = this.r.getRedWinRounds() == this.r.getBlueWinRounds(); if (flag8) { base.writeC(2); } } bool flag9 = this.r.room_type == 4; if (flag9) { bool flag10 = this.r.getBlueWinRounds() > this.r.getRedWinRounds(); if (flag10) { base.writeC(1); } bool flag11 = this.r.getRedWinRounds() > this.r.getBlueWinRounds(); if (flag11) { base.writeC(0); } bool flag12 = this.r.getRedWinRounds() == this.r.getBlueWinRounds(); if (flag12) { base.writeC(2); } } bool flag13 = this._player != null && this.r.getLeader() != null; if (flag13) { this.r.stopBattle(this._player); base.writeH(3); base.writeH(2); for (int i = 0; i < 16; i++) { SLOT slot = this.r.getSlot(i); base.writeH((short)slot.exp); } for (int j = 0; j < 16; j++) { SLOT slot2 = this.r.getSlot(j); base.writeH((short)slot2.gp); } for (int k = 0; k < 16; k++) { bool flag14 = this.r.special == 6; if (flag14) { SLOT slot3 = this.r.getSlot(k); int botScore = slot3.getBotScore(); base.writeH((short)botScore); } else { base.writeH(0); } } base.writeB(new byte[32]); base.writeB(new byte[] { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 }); base.writeS(this._player.getPlayerName(),33); base.writeD(this._player.getExp()); base.writeD(this._player.getRank()); base.writeD(this._player.getRank()); base.writeD(this._player.getGP()); base.writeD(this._player.getMoney()); base.writeD((this._player == null || clan == null) ? 0 : clan.getClanId()); base.writeD((int)((short)((this._player == null || clan == null) ? 0 : clan.getLogoColor()))); base.writeD(0); base.writeD(0); base.writeH((short)this._player.getPcCafe()); base.writeC((byte)this._player.getNameColor()); base.writeS((this._player == null || clan == null) ? "" : clan.getClanName(),17); base.writeH((short)((this._player == null || clan == null) ? 0 : clan.getClanRank())); base.writeC(Convert.ToByte((this._player == null || clan == null) ? 255 : clan.getLogo1())); base.writeC(Convert.ToByte((this._player == null || clan == null) ? 255 : clan.getLogo2())); base.writeC(Convert.ToByte((this._player == null || clan == null) ? 255 : clan.getLogo3())); base.writeC(Convert.ToByte((this._player == null || clan == null) ? 255 : clan.getLogo4())); base.writeC(Convert.ToByte((this._player == null || clan == null) ? 0 : clan.getLogoColor())); base.writeC(0); base.writeD(0); base.writeD(0); base.writeD(0); base.writeD(this._player._statistic.getFights_s()); base.writeD(this._player._statistic.getWinFights_s()); base.writeD(this._player._statistic.getLostFights_s()); base.writeD(0); base.writeD(this._player._statistic.getKills_s()); base.writeD(this._player._statistic.getHeadShotKills()); base.writeD(this._player._statistic.getDeaths_s()); base.writeD(0); base.writeD(this._player._statistic.getKills_s()); base.writeD(this._player._statistic.getEscapes_s()); base.writeD(this._player._statistic.getFights_s()); base.writeD(this._player._statistic.getWinFights_s()); base.writeD(this._player._statistic.getLostFights_s()); base.writeD(0); base.writeD(this._player._statistic.getKills_s()); base.writeD(this._player._statistic.getHeadShotKills()); base.writeD(this._player._statistic.getDeaths_s()); base.writeD(0); base.writeD(this._player._statistic.getKills_s()); base.writeD(this._player._statistic.getEscapes_s()); bool flag15 = this.r.isBomb() || this.r.isEliminate() || this.r.isEscape() || this.r.isCrossCounter(); if (flag15) { base.writeH((short)this.r.getRedWinRounds()); base.writeH((short)this.r.getBlueWinRounds()); SLOT[] slots = this.r._slots; for (int l = 0; l < slots.Length; l++) { SLOT sLOT = slots[l]; base.writeC(0); } } bool flag16 = this.r.isAI(); if (flag16) { SLOT[] slots2 = this.r._slots; for (int m = 0; m < slots2.Length; m++) { SLOT sLOT2 = slots2[m]; base.writeH((short)sLOT2.getBotScore()); } } base.writeB(new byte[49]); } }
public override void WriteImpl() { WriteH(0xD1B); WriteC((byte)fragInfos.getVicTimIdx()); // WTF? WriteC((byte)fragInfos.getKillsCount()); // Всего померло. WriteC((byte)fragInfos.getKiller()); // Слот убитого. WriteD(fragInfos.getKillWeaapon()); // Орудие убийства. WriteB(fragInfos.getUnkBytes()); // Хз что там. SLOT killer = room.getRoomSlot(fragInfos.getKiller()); for (int i = 1; i <= fragInfos.getKillsCount(); i++) { Frag frag = fragInfos.getFrag(i); WriteC((byte)frag.getUnkC1()); WriteC((byte)frag.getDeathMask()); // switch (killer.getKillMessage()) { case 0: WriteH(0); //обычный килл Logger.Warn("Type: 0"); break; case 1: WriteH(1); //в голову по идее Logger.Warn("Type: 1"); break; case 2: WriteH(2); //головорез? Logger.Warn("Type: 2"); break; case 3: WriteH(4); //эт мастер Logger.Warn("Type: 4"); break; case 4: WriteH(8); Logger.Warn("Type: 8"); break; case 5: WriteH(16); Logger.Warn("Type: 9"); break; case 6: WriteH(32); Logger.Warn("Type: 32"); break; case 7: WriteH(64); Logger.Warn("Type: 64"); break; case 8: WriteH(128); Logger.Warn("Type: 128"); break; default: WriteH(0); Logger.Warn("Type: 0"); break; } WriteB(frag.getUnk13bytes()); } WriteD(room.getRedKills()); WriteD(room.getBlueKills()); foreach (SLOT member in room.getRoomSlots()) { WriteH((short)member.getAllKills()); WriteH((short)member.getAllDeath()); } if (killer.getOneTimeKills() == 1) { WriteC(0); // кол-вол игроков? } else if (killer.getOneTimeKills() == 2) { WriteC(1); // кол-вол игроков? } else if (killer.getOneTimeKills() == 3) { WriteC(2); // кол-вол игроков? } else if (killer.getOneTimeKills() > 3) { WriteC(3); // кол-вол игроков? } WriteH((short)killer.getBotScore()); }
public override void RunImpl() { Room room = getClient().getPlayer().getRoom(); Player player = getClient().getPlayer(); if (room != null && player != null) { SLOT killer = room.getRoomSlot(fragInfos.getKiller()); for (int i = 1; i <= fragInfos.getKillsCount(); i++) { Frag frag = fragInfos.getFrag(i); if (frag != null) { bool suicide = frag.getDeatSlot() == fragInfos.getKiller(); SLOT death = room.getRoomSlot(frag.getDeatSlot()); if (!suicide) { killer.setAllKills(killer.getAllKills() + 1); /* Подсчет опыта и очков */ killer.setAllExp(killer.getAllExp() + 9); //сохраняем опыт killer.setAllGP(killer.getAllGp() + 5); //сохраняем очки killer.setOneTimeKills(killer.getOneTimeKills() + 1); int weaponHeadNum = fragInfos.getWeaponHeadNum(); killer.setKillMessage(0); if (fragInfos.getKillsCount() > 1) { if ((weaponHeadNum == 8030) || (weaponHeadNum == 9030)) { killer.setKillMessage(2); } else { killer.setKillMessage(1); } } else { int killMessage = 0; if (frag.getDeathMask() >> 4 == 3) { //TODO:: понять что это и всунуть в Frag! killMessage = 4; } else if ((frag.getDeathMask() >> 4 == 1) && (frag.getDeathMask() >> 2 == 1) && (weaponHeadNum == 7020)) { killMessage = 6; } if (killMessage > 0) { int lastMessage = killer.lastKillState >> 12; if (killMessage == 4) { if (lastMessage != 4) { killer.repeatLastState = false; //killer.setOneTimeKills(0); } killer.setOneTimeKills(killer.getOneTimeKills() + 1); killer.lastKillState = killMessage << 12 | killer.getOneTimeKills(); int countedKill = killer.lastKillState & 0xF; if (killer.repeatLastState) { if (countedKill > 1) { killer.setKillMessage(5); } else { killer.setKillMessage(4); } } else { killer.setKillMessage(4); killer.repeatLastState = true; } } else if (killMessage == 6) { if (lastMessage != 6) { killer.repeatLastState = false; // killer.setOneTimeKills(0); } killer.setOneTimeKills(killer.getOneTimeKills() + 1); killer.lastKillState = killMessage << 12 | killer.getOneTimeKills(); int countedKill = killer.lastKillState & 0xF; if (killer.repeatLastState) { if (countedKill > 1) { killer.setKillMessage(6); } } else { killer.repeatLastState = true; } } } else { killer.lastKillState = 0; killer.repeatLastState = false; } } // } //Добавляем общий счет команде if (frag.getDeatSlot() % 2 == 0) { // Если помер красный room.setBlueKills(room.getBlueKills() + 1); room.setRedDeaths(room.getRedDeaths() + 1); } else { room.setRedKills(room.getRedKills() + 1); room.setBlueDeaths(room.getBlueDeaths() + 1); } death.setOneTimeKills(0); death.setKillMessage(0); death.setLastKillMessage(0); death.lastKillState = 0; death.setAllDeahts(death.getAllDeath() + 1); //Добавляем очки в бою с ботами if (room.getSpecial() == 6) { SLOT slot = room.getRoomSlot(fragInfos.getKiller()); int AILevel = room.getRoomSlotByPlayer(room.getLeader()).getId() % 2 == 0 ? room.getAiLevel() + room.getBlueDeaths() / 20 : room.getAiLevel() + room.getRedDeaths() / 20; int AIScore = 10 + room.getRoomSlot(fragInfos.getKiller()).getOneTimeKills() * AILevel; slot.setBotScore(slot.getBotScore() + AIScore); } /* Миссии */ if (room.getSpecial() != 6) { SLOT killer2 = room.getRoomSlot(fragInfos.getKiller()); if (getClient().getPlayer() == killer2.getPlayer()) { for (int count = 0; count < fragInfos.getKillsCount(); count++) { getClient().SendPacket(new PROTOCOL_BASE_MISSION_COMPLETE_ACK(242, 1));//убийство } if (killer2.getKillMessage() == 8) { getClient().SendPacket(new PROTOCOL_BASE_MISSION_COMPLETE_ACK(244, 1));//хедшот } if (killer2.getKillMessage() == 9) { getClient().SendPacket(new PROTOCOL_BASE_MISSION_COMPLETE_ACK(244, 1));//тож хедшот } } if (death == room.getRoomSlotByPlayer(getClient().getPlayer())) { getClient().SendPacket(new PROTOCOL_BASE_MISSION_COMPLETE_ACK(241, 1));//смерть } } if (room.getType() == 2) { if (room.getBlueKills() == room.redTeamCount) { TeamWin = 1; } else if (room.getRedKills() == room.blueTeamCount) { TeamWin = 0; } } /* Уничтожение */ if (room.getType() == 4) { if (room.getBlueKills() == room.redTeamCount) { TeamWin = 1; } else if (room.getRedKills() == room.blueTeamCount) { TeamWin = 0; } } } } foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { if (SLOT_STATE.SLOT_STATE_BATTLE == room.getRoomSlotByPlayer(member).getState()) { member.getClient().SendPacket(new PROTOCOL_BATTLE_FRAG_INFO_ACK(room, fragInfos)); } } if (TeamWin >= 0) { //TeamWin = -1; if (!(TeamWin == 1 && room.getBombState() == 1)) { room.setRedKills(0); room.setBlueKills(0); if (TeamWin == 1) { room.setBlueWinRounds(room.getBlueWinRounds() + 1); } else { room.setRedWinRounds(room.getRedWinRounds() + 1); } if ((TeamWin == 1 ? room.getBlueWinRounds() : room.getRedWinRounds()) == room.getKillsByMask()) { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); member.getClient().SendPacket(new PROTOCOL_BATTLE_END_ACK(member,room)); slot.setKillMessage(0); slot.setLastKillMessage(0); slot.setOneTimeKills(0); slot.setAllKills(0); slot.setAllDeahts(0); } room.setRedKills(0); room.setRedDeaths(0); room.setBlueKills(0); room.setBlueDeaths(0); room.setFigth(0); room.setBlueWinRounds(0); room.setRedWinRounds(0); room.setBombState(0); } else { foreach (Player member in getClient().getPlayer().getRoom().getPlayers().Values) { SLOT slot = room.getRoomSlotByPlayer(member); slot.setKillMessage(0); slot.setLastKillMessage(0); slot.setOneTimeKills(0); slot.lastKillState = 0; room.setRedKills(0); room.setRedDeaths(0); room.setBlueKills(0); room.setBlueDeaths(0); room.setBombState(0); member.getClient().SendPacket(new PROTOCOL_BATTLE_ROUND_END_ACK(TeamWin,4,getClient().getPlayer().getRoom())); } Thread.Sleep(8000); 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())); } } //TeamWin = -1; } TeamWin = -1; } } }