Рейтинг темы:
  • 0 Голос(ов) - 0 в среднем
  • 1
  • 2
  • 3
  • 4
  • 5
Помогите мне с раундами
#1
http://hkar.ru/IGru
сделал раунды но ошибка в том что выигрывает синяя комнада
http://hkar.ru/IGru
код фраг инфо:
Код:
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;
                            }
                        }
                    }
                
                

            for (Player member : room.getPlayers().values()) {
                if (SlotState.SLOT_STATE_BATTLE == room.getRoomSlotByPlayer(member).getState()) {
                    member.getConnection().sendPacket(new SM_BATTLE_FRAG_INFO(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 == 0 ? room.getBlueWinRounds() : room.getRedWinRounds()) == room.getKillsByMask())
//                             if ((((((room.killtime == 2) && (room.getRedWinRounds() >= 3)) || ((room.killtime == 2) && (room.getBlueWinRounds() >= 3))) || (((room.killtime == 3) && (room.getRedWinRounds() >= 5)) || ((room.killtime == 3) && (room.getBlueWinRounds() >= 5)))) || ((((room.killtime == 4) && (room.getRedWinRounds() >= 7)) || ((room.killtime == 4) && (room.getBlueWinRounds() >= 7))) || ((room.killtime == 5) && (room.getRedWinRounds() >= 9)))) || ((room.killtime == 5) && (room.getBlueWinRounds() >= 9)))
                        {
                             for (Player member : getConnection().getRoom().getPlayers().values())
                            {
                                RoomSlot slot = room.getRoomSlotByPlayer(member);
                                 member.getConnection().sendPacket(new SM_BATTLE_END(player, 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(false);
                            room.setBlueWinRounds(0);
                            room.setRedWinRounds(0);
                            room.setBombState(0);
                        }
                        else
                        {
                             for (Player member : getConnection().getRoom().getPlayers().values())
                            {
                                RoomSlot 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.getConnection().sendPacket(new SM_BATTLE_ROUND_END(TeamWin, 4, room));
                            }
                            try {
                                Thread.sleep(8000);
                            } catch (InterruptedException ex) {
                                Logger.getLogger(CM_BATTLE_FRAG_INFO.class.getName()).log(Level.SEVERE, null, ex);
                            }
                            for (Player member : getConnection().getRoom().getPlayers().values())
                            {
                                member.getConnection().sendPacket(new SM_UNK_3865());
                                member.getConnection().sendPacket(new SM_BATTLE_ROUND_START(room));
                            }
                        }
                       // TeamWin = -1;
                    }
                   // TeamWin = -1;
                            }
                        }
                        //TeamWin = -1;
                                
                    }
                    
  //            }
                    
//        }
Ответ
#2
Не знаю, что вы пытаетесь показать, когда нужно видеть SM_BATTLE_ROUND_END.
Ответ
#3
Код:
package ru.pb.game.network.client.packets.server;

import ru.pb.game.network.client.packets.ServerPacket;
import ru.pb.core.models.*;

/**
* Пакет завершения раунда
*
* @author gm_lovejava
*/
public class SM_BATTLE_ROUND_END extends ServerPacket {
    
        private int team;
        private Room room;
            private int type;
            
    public SM_BATTLE_ROUND_END(int team, int type, Room room) {
        
        super(0xD19); //F1D
            this.team = team;
            this.room = room;
            this.type = type;
    }

  /*  public SM_BATTLE_ROUND_END(Room room, Player member) {
        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
    }*/

    @Override
    public void writeImpl() {
            writeC((byte)team);
            writeC((byte)type);
            writeH((short)room.getRedWinRounds());
            writeH((short)room.getBlueWinRounds());
    }
}
Ответ
#4
И SM_BATTLE_END покажите.
Ответ
#5
Код:
/*
* Java Server Emulator Project Blackout / PointBlank
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
* Authors: DarkSkeleton, sjke, Felixx
* Copyright (C) 2013 PBDev™
*/

package ru.pb.game.network.client.packets.server;

import ru.pb.core.models.LevelUpInfo;
import ru.pb.core.models.Player;
import ru.pb.core.models.Room;
import ru.pb.core.models.RoomSlot;
import ru.pb.core.service.LevelUpDaoService;
import ru.pb.game.network.client.packets.ServerPacket;

/**
* Неизместный пакет, отправляется вместе с пекетов авторизации
*
* @author sjke
*/
public class SM_BATTLE_END extends ServerPacket {

    private final Player player;
    private final Room room;

    public SM_BATTLE_END(Player player, Room room) {
        super(0xD08);
        this.player = player;
        this.room = room;
    }

    @Override
    public void writeImpl() {

        //TODO переделать
        LevelUpInfo levelUpInfo = LevelUpDaoService.getInstance().getLevelInfoForRank((byte) (player.getRank() + 1));
        RoomSlot slotByPlayer = room.getRoomSlotByPlayer(player);
        player.setExp(player.getExp() + slotByPlayer.getAllExp());
        player.setGp(player.getGp() + slotByPlayer.getAllGp());

        if (player.getRank() <= 52) {
            if (levelUpInfo.getAllExp() < player.getExp()) {
                player.setRank((short) (player.getRank() + 1));
                player.setGp(player.getGp() + levelUpInfo.getRewardGp());
            }
        }
        //

        //writeC(room.getRedKills() > room.getBlueKills() ? 0 : 1);// походу команда которая выигрывает
                if (room.getType() == 1)
            {
                if (room.getBlueKills() > room.getRedKills()){writeC(1);}
                if (room.getRedKills() > room.getBlueKills()){writeC(0);}
                if (room.getRedKills() == room.getBlueKills()){writeC(2);}
            }
            if (room.getType() == 2)
            {
                if (room.getBlueWinRounds() > room.getRedWinRounds()){writeC(1);}
                if (room.getRedWinRounds() > room.getBlueWinRounds()){writeC(0);}
                if (room.getRedWinRounds() == room.getBlueWinRounds()){writeC(2);}
            }
            if (room.getType() == 4)
            {
                if (room.getBlueWinRounds() > room.getRedWinRounds()){writeC(1);}
                if (room.getRedWinRounds() > room.getBlueWinRounds()){writeC(0);}
                if (room.getRedWinRounds() == room.getBlueWinRounds()){writeC(2);}
            }
           /* if (room.getType() == 1)
            {
                if (this.room.getBlueKills() == this.room.getRedKills())
                {
                    
                            writeC(2);
                }
                else if (this.room.getBlueKills() > this.room.getRedKills())
                {
                    writeC(1);
                }
                else
                {
                    writeC(0);
                }
            }
            else if (this.room.getBlueWinRounds() == this.room.getRedWinRounds())
            {
                writeC(2);
            }
            else if (this.room.getBlueWinRounds() > this.room.getRedWinRounds())
            {
                writeC(1);
            }
            else
            {
                writeC(0);
            }
            if ((this.player != null) && (this.room.getLeader() != null))
            {*/
        /*writeH(383); // что это???
        writeH(266); // что это???*/
            writeH(3); // что это???
            writeH(2); // что это???

        // Опыт
        for (int i = 0; i < 16; i++) {
            RoomSlot slot = room.getRoomSlot(i);
            writeH(slot.getAllExp());
        }
        // Очки
        for (int i = 0; i < 16; i++) {
            RoomSlot slot = room.getRoomSlot(i);
            writeH(slot.getAllGp());
        }
        //Очки за ботов
        for (int i = 0; i < 16; i++) {
            if (room.getSpecial() == 6) {
                RoomSlot slot = room.getRoomSlot(i);
                int score = slot.getBotScore();
                writeH(score);
            } else writeH(0);
        }

        writeB(new byte[]{
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,//
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,//
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,//
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,//
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,//
                0x00, 0x00,//
                // и тут ХЗ
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,//
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00,//
                0x00, 0x00, 0x00, 0x00
                //
        });

        writeS(player.getName(), Player.MAX_NAME_SIZE); // Имя перса
        writeD(player.getExp()); // опыт
        writeD(player.getRank()); // ранк (0-54)
        writeD(player.getRank()); // Пока не понятно за чего отвечают пустые байты...
        writeD(player.getGp()); // ГП
        writeD(con.getAccount().getMoney()); // Рублики

        writeD(0); // ClanID
        writeD(0); // ClanNameColor
        writeD(0); // Unk
        writeD(0); // Unk
        writeH(player.getPcCafe());
        writeC(player.getColor()); // 0-9 Color name

        if (player.getClan() == null) {
            writeS("", 16);
            writeC(0);
            writeH(0);
            writeC(255);
            writeC(255);
            writeC(255);
            writeC(255);
            writeH(0);
        } else {
            writeS(player.getClan().getName(), 16);
            writeC(0); // unk - Видимо разделитель
            writeH(player.getClan().getRank());
            writeC(player.getClan().getLogo1());
            writeC(player.getClan().getLogo2());
            writeC(player.getClan().getLogo3());
            writeC(player.getClan().getLogo4());
            writeH(player.getClan().getColor());
        }

        writeD(0); // Непонятно чо

        writeB(new byte[9]);

        writeD(player.getStats().getFights());
        writeD(player.getStats().getWins());
        writeD(player.getStats().getLosts());
        writeD(0); // unk
        writeD(player.getStats().getKills());
        writeD(player.getStats().getSeriaWins());
        writeD(player.getStats().getDeaths());
        writeD(0); // unk
        writeD(player.getStats().getKpd());
        writeD(player.getStats().getEscapes());
        writeD(player.getStats().getSeasonFights());
        writeD(player.getStats().getSeasonWins());
        writeD(player.getStats().getSeasonLosts());
        writeD(0); // unk
        writeD(player.getStats().getSeasonKills());
        writeD(player.getStats().getSeasonSeriaWins());
        writeD(player.getStats().getSeasonDeaths());
        writeD(0); // unk
        writeD(player.getStats().getSeasonKpd());
        writeD(player.getStats().getSeasonEscapes());

        writeB(new byte[53]);
    }
}
Ответ
#6
slawa560, зачем столько IF, когда весь этот хлам можно убрать заменив на switch
Ответ
#7
я не делал пакет конца боя я сделал только раунды
и то взял у оз нетворк там все норм работает а на этом ядре нет
хотя там такой же руумс как и у меня не могу понять где ошибка
Ответ
#8
После:

Код:
writeD(player.getStats().getSeasonEscapes());

Разбери данные, там счет команд, а так у тебя получается, что у них счёт 0:0.

[SRC="csharp"]if (room.IsBomb || room.IsEliminate || room.IsEscape || room.IsCrossCounter)
{
Write<ushort>(room.RedTeamScore);
Write<ushort>(room.BlueTeamScore);

foreach (var slot in room.Slots)
{
Write<byte>(slot.Missions);
}
}

if (room.IsAI)
{
foreach (var slot in room.Slots)
{
Write<ushort>(slot?.Player?.BattleScore ?? 0);
}
}

// ...
[/SRC]
Ответ
#9
PROGRAMMATOR Написал:После:

Код:
writeD(player.getStats().getSeasonEscapes());

Разбери данные, там счет команд, а так у тебя получается, что у них счёт 0:0.

[SRC="csharp"]if (room.IsBomb || room.IsEliminate || room.IsEscape || room.IsCrossCounter)
{
Write<ushort>(room.RedTeamScore);
Write<ushort>(room.BlueTeamScore);

foreach (var slot in room.Slots)
{
Write<byte>(slot.Missions);
}
}

if (room.IsAI)
{
foreach (var slot in room.Slots)
{
Write<ushort>(slot?.Player?.BattleScore ?? 0);
}
}

// ...
[/SRC]
щас попробую

Добавлено через 3 минуты
а воот тут все норм ?
Код:
/*
* C# Server Emulator Project Blackout / PointBlank
* Authors: the__all
* Copyright (C) 2015 | OZ-Network
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core.Model;
using Core.Config;
using Core.Database.Tables;
using Core.Data.Parsers;

namespace Game.Network.ServerPacket
{
    class PROTOCOL_BATTLE_END_ACK : SendPacket
    {
        private Player player;
        private Room room;
        Clan clan;
        Levels level;
        private byte Ivent = 8;
        PlayerStats stats;

        public PROTOCOL_BATTLE_END_ACK(Player player, Room room)
        {
            this.player = player;
            this.room = room;
        }

        public override void WriteImpl()
        {

            SLOT slotByPlayer = room.getRoomSlotByPlayer(player);
            clan = player.Clan;

            level = LevelUpParser._levels[player.getRank()];
            stats = PlayersStatsTable.statistics[player.PlayerID];

            /* Левел ап */
            if(player.getRank() <= 52)
            {
                if(player.getExp() >= level.getOnAllExp())
                {
                    player.setRank(player.getRank() + 1);
                    PlayersTable.UpdateRank(player.PlayerID, player.getRank());
                    player.setGp(player.getGp() + LevelUpParser._levels[player.getRank()].getOnGPUp());
                    PlayersTable.UpdateGP_Exp(player.PlayerID, player.getGp() + level.getOnGPUp(), player.getExp());
                }
            }

            WriteH(0xD08);
            if (room.getType() == 1)
            {
                if (room.getBlueKills() > room.getRedKills()){WriteC(1);}
                if (room.getRedKills() > room.getBlueKills()){WriteC(0);}
                if (room.getRedKills() == room.getBlueKills()){WriteC(2);}
            }
            if (room.getType() == 2)
            {
                if (room.getBlueWinRounds() > room.getRedWinRounds()){WriteC(1);}
                if (room.getRedWinRounds() > room.getBlueWinRounds()){WriteC(0);}
                if (room.getRedWinRounds() == room.getBlueWinRounds()){WriteC(2);}
            }
            if (room.getType() == 4)
            {
                if (room.getBlueWinRounds() > room.getRedWinRounds()){WriteC(1);}
                if (room.getRedWinRounds() > room.getBlueWinRounds()){WriteC(0);}
                if (room.getRedWinRounds() == room.getBlueWinRounds()){WriteC(2);}
            }
            WriteH(3); // что это???
            WriteH(2); // что это???

            int GP, Exp;
            // Опыт
            for (int i = 0; i < 16; i++)
            {
                SLOT slot = room.getRoomSlot(i);
                if (room.getSpecial() == 6)
                {
                    WriteH((short)slot.getAllExp());
                    player.setExp(player.getExp() + slot.getAllExp());

                }
                else
                {
                    WriteH((short)slot.getAllExp());
                    player.setExp(player.getExp() + slot.getAllExp());
                }
            }

            // Очки
            for (int i = 0; i < 16; i++)
            {
                SLOT slot = room.getRoomSlot(i);
                if (room.getSpecial() == 6)
                {
                    WriteH((short)slot.getAllGp());
                    player.setExp(player.getExp() + slot.getAllExp());
                }
                else
                {
                    WriteH((short)slot.getAllGp());
                    player.setExp(player.getExp() + slot.getAllExp());
                }
            }

            /* Записываем в базу данных */
            Exp = player.getExp();
            GP = player.getGp();
            PlayersTable.UpdateGP_Exp(player.PlayerID, GP, Exp);

            //Очки за ботов
             for (int i = 0; i < 16; i++)
             {
                 WriteH(0);
             }

             WriteB(new byte[]{
                 //Рейты по 2 байта на слот
           //В скобках|Иконка
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
                 0x08, 0x00,
             });
             WriteB(new byte[]{
                 //Иконки Ivent/PC_Cafe/Item
                 0xFF, 0x00,
                 0xFF, 0x00,
                 0xFF, 0x00,
                 0xFF, 0x00,
                 0xFF, 0x00,
                 0xFF, 0x00,
                 0xFF, 0x00,
                 0xFF, 0x00,
             });

             WriteS(player.getName(), Player.MAX_NAME_SIZE); // Имя перса
             WriteD(player.getExp()); // опыт
             WriteD(player.getRank()); // ранк (0-54)
             WriteD(player.getRank()); // фейк-ранг для купона скрытия ранга
             WriteD(player.getGp()); // ГП
             WriteD(player.getMoney()); // Рублики

             WriteD(player == null ? (int)clan.Id : (int)0); // ClanID
             WriteD(player == null ? (int)clan.Color : (int)0); // ClanNameColor
            
             WriteD(0); // Unk
             WriteC(0); // Unk
             WriteD(player.getPCCafe());//pc cafe
             WriteH((short)player.getEmblem()); //Лычка поидеи

             WriteS("", 17);
             WriteC(0);//unk

             WriteH(clan != null ? (short)clan.Rank : (short)0);
             WriteC(Convert.ToByte(((this.player == null) || (clan == null)) ? 0xff : clan.getLogo1()));
             WriteC(Convert.ToByte(((this.player == null) || (clan == null)) ? 0xff : clan.getLogo2()));
             WriteC(Convert.ToByte(((this.player == null) || (clan == null)) ? 0xff : clan.getLogo3()));
             WriteC(Convert.ToByte(((this.player == null) || (clan == null)) ? 0xff : clan.getLogo4()));
             WriteH(0);

             WriteD(0); // Непонятно разделитель

             WriteB(new byte[8] { 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01});

             /* Статистика */
             WriteD(stats.getFights());//всего боев
             WriteD(stats.getWins());//всего побед
             WriteD(stats.getLosts());//всего поражений
             WriteD(0); // unk
             WriteD(stats.getKills());//кол-во убийств
             WriteD(stats.getHeadshots());//кол-во хедшотов
             WriteD(stats.getDeaths());//кол-во смертей
             WriteD(0); // unk
             WriteD(stats.getKills());//опять килы о.о
             WriteD(stats.getEscapes());//всего ливнул
             WriteD(stats.getSeasonFights());//всего боев за сезон
             WriteD(stats.getSeasonWins());//всего побед за сезон
             WriteD(stats.getSeasonLosts());//всего поражений за сезон
             WriteD(0); // unk
             WriteD(stats.getSeasonKills());//киллы сезон по идее
             WriteD(stats.getSeasonHeadshots());//хеды сезон по идее
             WriteD(stats.getSeasonDeaths());//смерти сезон по идее
             WriteD(0); // unk
             WriteD(stats.getSeasonKills());//опять килы,хз зачем
             WriteD(stats.getSeasonEscapes());//сколько ливнул за сезон

             WriteH((short)room.getRedWinRounds());
             WriteH((short)room.getBlueWinRounds());
             WriteB(new byte[49]);
        }
    }
}
Ответ
#10
Awiion, там половину проверок нужно в Room вынести. kappa
Ответ


Возможно похожие темы ...
Тема Автор Ответы Просмотры Последний пост
  Помогите с клиентом slawa560 1 1,548 06-12-2019, 01:34 PM
Последний пост: zOne62
  Помогите slawa560 3 1,393 08-01-2017, 09:24 PM
Последний пост: Alter53
  Помогите юзаю исходник PBCross но есть такая вот фигня больше 16 игроков не пустит slawa560 3 1,651 07-24-2017, 02:53 AM
Последний пост: TomCodder
  Помогите разобраться с проблемкой KoToWeD 9 2,441 08-19-2016, 03:19 PM
Последний пост: Awiion
  Помогите пожалуйста slawa560 3 1,458 08-01-2016, 07:19 AM
Последний пост: Sojang
  Помогите сделать upd 3 slawa560 12 7,359 07-13-2016, 08:02 PM
Последний пост: Awiion
  пОМОГИТЕ С УПД 3 slawa560 4 1,680 06-15-2016, 11:32 AM
Последний пост: PROGRAMMATOR
  помогите с бомбой slawa560 2 1,153 05-25-2016, 12:12 AM
Последний пост: PROGRAMMATOR
  Помогите с комнатами при входе игрока вылетает клиент slawa560 2 1,262 05-23-2016, 06:38 PM
Последний пост: slawa560

Перейти к форуму:


Пользователи, просматривающие эту тему: 2 Гость(ей)