Beispiel #1
0
 public void CalculateBattleResult(Account ac)
 {
     for (int i = 0; i < 16; i++)
     {
         Account playerBySlot = this.getPlayerBySlot(i);
         bool    flag         = playerBySlot != null;
         if (flag)
         {
             bool trainigExpEnable = Config.TrainigExpEnable;
             int  num;
             int  num2;
             if (trainigExpEnable)
             {
                 num  = playerBySlot.getRoom().getSlots()[playerBySlot.getSlot()].allKills * 25;
                 num2 = playerBySlot.getRoom().getSlots()[playerBySlot.getSlot()].allKills * 50;
             }
             else
             {
                 num  = playerBySlot.getRoom().getSlots()[playerBySlot.getSlot()].allKills * 10;
                 num2 = playerBySlot.getRoom().getSlots()[playerBySlot.getSlot()].allKills * 8;
             }
             this.updateFights(i,playerBySlot);
             playerBySlot.setExp(playerBySlot.getExp() + num2 + Config.BonusXP);
             playerBySlot.setGP(playerBySlot.getGP() + num);
             playerBySlot.setMoney(playerBySlot.getMoney() + 100);
             this.getSlot(i).gp  = num;
             this.getSlot(i).exp = num2;
             playerBySlot._statistic.setHeadShotKilled(playerBySlot.getRoom().getSlot(playerBySlot.getSlot()).headshotsInPlay);
             for (int j = 0; j < playerBySlot.getRoom().getSlot(playerBySlot.getSlot()).headshotsInPlay; j++)
             {
                 SLOT slot = playerBySlot.getRoom().getSlot(playerBySlot.getSlot());
                 slot.allKills--;
             }
             playerBySlot._statistic.setKills(playerBySlot.getRoom().getSlot(playerBySlot.getSlot()).allKills);
             playerBySlot._statistic.setDeaths(playerBySlot.getRoom().getSlot(playerBySlot.getSlot()).allDeaths);
             int  onNextLevel = RankExpInfoHolder.getRankExpInfo(playerBySlot.getRank())._onNextLevel;
             int  onAllExp    = RankExpInfoHolder.getRankExpInfo(playerBySlot.getRank())._onAllExp;
             int  onGPUp      = RankExpInfoHolder.getRankExpInfo(playerBySlot.getRank())._onGPUp;
             int  itemid      = RankExpInfoHolder.getRankExpInfo(playerBySlot.getRank())._itemid;
             bool flag2       = playerBySlot.getExp() >= onNextLevel && playerBySlot.getRank() < 50;
             if (flag2)
             {
                 int exp = playerBySlot.getExp() - onNextLevel;
                 playerBySlot.setExp(exp);
                 playerBySlot.setRank(playerBySlot.getRank() + 1);
                 playerBySlot.setGP(playerBySlot.getGP() + onGPUp);
                 playerBySlot.sendPacket(new SM_PLAYER_UP_LEVEL(playerBySlot.getRank(),itemid));
                 CLogger.getInstance().extra_info("[Player] " + playerBySlot.getPlayerName() + " up level");
             }
             AccountManager.getInstance().updatePlayer(playerBySlot);
         }
     }
     this.updateInfo();
 }
Beispiel #2
0
        public int getSlotBattle()
        {
            int num = 0;

            SLOT[] slots = this._slots;
            for (int i = 0; i < slots.Length; i++)
            {
                SLOT sLOT = slots[i];
                bool flag = sLOT.getPlayer().hasSlotState(SLOT_STATE.SLOT_STATE_BATTLE_READY);
                if (flag)
                {
                    num |= 1 << sLOT.getId();
                }
            }
            return(num);
        }
Beispiel #3
0
        public SLOT getRoomSlotByPlayer(Account player)
        {
            SLOT[] slots = this._slots;
            SLOT   result;

            for (int i = 0; i < slots.Length; i++)
            {
                SLOT sLOT = slots[i];
                bool flag = player.Equals(sLOT.getPlayer());
                if (flag)
                {
                    result = sLOT;
                    return(result);
                }
            }
            result = null;
            return(result);
        }
Beispiel #4
0
        public SLOT changeTeam(Account player,int team)
        {
            SLOT slot = this.getSlot(player.getSlot());

            foreach (int teamSlot in team == 0 ? RED_TEAM : BLUE_TEAM)
            {
                foreach (SLOT rslot in new SLOT[teamSlot])
                {
                    //RoomSlot rslot = ROOM_SLOT[teamSlot];
                    // if (player.equals(rslot.getPlayer()) || rslot.state == SLOT_STATE.SLOT_STATE_EMPTY)
                    //  {
                    //      slot.setPlayer(null);
                    //      slot.state = SLOT_STATE.SLOT_STATE_EMPTY;
                    //      rslot.setPlayer(player);
                    //      rslot.state = SLOT_STATE.SLOT_STATE_NORMAL;
                    //      return rslot;
                    //  }
                }
            }
            return(null);
        }
Beispiel #5
0
        public void RoomTask(Room room)
        {
            int num = 0;

            foreach (Account current in room.getReadyPlayerList())
            {
                SLOT roomSlotByPlayer = room.getRoomSlotByPlayer(current);
                bool flag             = roomSlotByPlayer.state > SLOT_STATE.SLOT_STATE_READY && roomSlotByPlayer.state < SLOT_STATE.SLOT_STATE_BATTLE_READY;
                if (flag)
                {
                    num++;
                }
            }
            SLOT roomSlotByPlayer2 = room.getRoomSlotByPlayer(room.getLeader());
            bool flag2             = roomSlotByPlayer2.state < SLOT_STATE.SLOT_STATE_BATTLE;

            if (flag2)
            {
                bool flag3 = num == 0;
                if (flag3)
                {
                    bool flag4 = roomSlotByPlayer2.state < SLOT_STATE.SLOT_STATE_BATTLE;
                    if (flag4)
                    {
                        foreach (Account current2 in room.getReadyPlayerList())
                        {
                            SLOT roomSlotByPlayer3 = room.getRoomSlotByPlayer(current2);
                            bool flag5             = roomSlotByPlayer3.state == SLOT_STATE.SLOT_STATE_BATTLE_READY;
                            if (flag5)
                            {
                                roomSlotByPlayer3.setState(SLOT_STATE.SLOT_STATE_BATTLE);
                                current2.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current2));
                                foreach (Account current3 in room.getReadyPlayerList())
                                {
                                    bool flag6 = !current3.Equals(current2);
                                    if (flag6)
                                    {
                                        SLOT roomSlotByPlayer4 = room.getRoomSlotByPlayer(current3);
                                        bool flag7             = roomSlotByPlayer4.state > SLOT_STATE.SLOT_STATE_PRESTART;
                                        if (flag7)
                                        {
                                            current2.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current3));
                                        }
                                    }
                                }
                                current2.getClient().sendPacket(new PROTOCOL_BATTLE_MISSION_ROUND_START_ACK(room));
                            }
                        }
                    }
                }
            }
            else
            {
                foreach (Account current4 in room.getReadyPlayerList())
                {
                    SLOT roomSlotByPlayer5 = room.getRoomSlotByPlayer(current4);
                    bool flag8             = roomSlotByPlayer5.state == SLOT_STATE.SLOT_STATE_BATTLE_READY;
                    if (flag8)
                    {
                        current4.getClient().sendPacket(new PROTOCOL_BATTLE_AI_COLLISION_ACK(room));
                        roomSlotByPlayer5.setState(SLOT_STATE.SLOT_STATE_BATTLE);
                        current4.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current4));
                        foreach (Account current5 in room.getReadyPlayerList())
                        {
                            SLOT sLOT  = room._slots[current5.getSlot()];
                            bool flag9 = sLOT.state == SLOT_STATE.SLOT_STATE_BATTLE && !current4.Equals(current5);
                            if (flag9)
                            {
                                current5.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current4));
                                current4.getClient().sendPacket(new PROTOCOL_BATTLE_STARTBATTLE_ACK(current5));
                            }
                        }
                        current4.getClient().sendPacket(new PROTOCOL_BATTLE_MISSION_ROUND_START_ACK(room));
                    }
                }
            }
            foreach (Account current6 in room.getReadyPlayerList())
            {
                current6.getClient().sendPacket(new PROTOCOL_ROOM_GET_SLOTINFO_ACK(room));
            }
            CLogger.getInstance().info("State= " + roomSlotByPlayer2.state);
        }