示例#1
0
 private bool CheckTournamentRules(Account player, string roomName)
 {
     if (TournamentRulesManager.CheckRoomRule(roomName))
     {
         PlayerEquipedItems equip  = player.equipments;
         List <string>      blocks = new List <string>();
         if (TournamentRulesManager.IsBlocked(roomName, equip.primary))
         {
             blocks.Add("Primária");
         }
         if (TournamentRulesManager.IsBlocked(roomName, equip.secondary))
         {
             blocks.Add("Secundária");
         }
         if (TournamentRulesManager.IsBlocked(roomName, equip.melee))
         {
             blocks.Add("Arma branca");
         }
         if (TournamentRulesManager.IsBlocked(roomName, equip.grenade))
         {
             blocks.Add("Granada");
         }
         if (TournamentRulesManager.IsBlocked(roomName, equip.special))
         {
             blocks.Add("Especial");
         }
         if (TournamentRulesManager.IsBlocked(roomName, equip.red))
         {
             blocks.Add("Pers. Vermelho");
         }
         if (TournamentRulesManager.IsBlocked(roomName, equip.blue))
         {
             blocks.Add("Pers. Azul");
         }
         int ItemClassType = Utilities.GetItemIdClass(equip.helmet);
         if (TournamentRulesManager.IsBlocked(roomName, equip.helmet) || ItemClassType == 110400 || ItemClassType == 110500)
         {
             blocks.Add("Capacete");
         }
         if (TournamentRulesManager.IsBlocked(roomName, equip.beret))
         {
             blocks.Add("Boina");
         }
         if (blocks.Count > 0)
         {
             string message = string.Format("Não é possível jogar devido a regra @CAMP.\nItens não aceitos:  {0}", string.Join(", ", blocks.ToArray()));
             player.SendPacket(new SERVER_MESSAGE_ANNOUNCE_PAK(message));
             return(true);
         }
     }
     return(false);
 }
示例#2
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         Room    room   = player != null ? player.room : null;
         if (room == null || room.state != RoomStateEnum.Battle)
         {
             return;
         }
         Slot slot = room.GetSlot(player.slotId);
         if (slot == null || slot.state != SlotStateEnum.BATTLE)
         {
             return;
         }
         bool NoChangeEquipment = false;
         if (slot.deathState.HasFlag(DeadEnum.isDead) || slot.deathState.HasFlag(DeadEnum.useChat))
         {
             slot.deathState = DeadEnum.isAlive;
         }
         player.CheckEquipedItems(equipment, true); //Verifica se os equipamentos enviados pelo pacote existem no inventario.
         string roomName = room.roomName.ToUpper();
         if (TournamentRulesManager.CheckRoomRule(roomName))
         {
             if ((WeaponsFlag & 8) > 0)
             {
                 if (!TournamentRulesManager.IsBlocked(roomName, equipment.primary))
                 {
                     slot.equipment.primary = equipment.primary;
                     InsertItem(equipment.primary, slot);
                 }
                 else if (slot.equipment.primary != equipment.primary)
                 {
                     NoChangeEquipment = true;
                 }
             }
             if ((WeaponsFlag & 4) > 0)
             {
                 if (!TournamentRulesManager.IsBlocked(roomName, equipment.secondary))
                 {
                     slot.equipment.secondary = equipment.secondary;
                     InsertItem(equipment.secondary, slot);
                 }
                 else if (slot.equipment.secondary != equipment.secondary)
                 {
                     NoChangeEquipment = true;
                 }
             }
             if ((WeaponsFlag & 2) > 0)
             {
                 if (!TournamentRulesManager.IsBlocked(roomName, equipment.melee))
                 {
                     slot.equipment.melee = equipment.melee;
                     InsertItem(equipment.melee, slot);
                 }
                 else if (slot.equipment.melee != equipment.melee)
                 {
                     NoChangeEquipment = true;
                 }
             }
             if ((WeaponsFlag & 1) > 0)
             {
                 if (!TournamentRulesManager.IsBlocked(roomName, equipment.grenade))
                 {
                     slot.equipment.grenade = equipment.grenade;
                     InsertItem(equipment.grenade, slot);
                 }
                 else if (slot.equipment.grenade != equipment.grenade)
                 {
                     NoChangeEquipment = true;
                 }
             }
             if (!TournamentRulesManager.IsBlocked(roomName, equipment.special))
             {
                 slot.equipment.special = equipment.special;
                 InsertItem(equipment.special, slot);
             }
             else if (slot.equipment.special != equipment.special)
             {
                 NoChangeEquipment = true;
             }
         }
         else
         {
             slot.equipment = equipment;
             if ((WeaponsFlag & 8) > 0)
             {
                 InsertItem(equipment.primary, slot);
             }
             if ((WeaponsFlag & 4) > 0)
             {
                 InsertItem(equipment.secondary, slot);
             }
             if ((WeaponsFlag & 2) > 0)
             {
                 InsertItem(equipment.melee, slot);
             }
             if ((WeaponsFlag & 1) > 0)
             {
                 InsertItem(equipment.grenade, slot);
             }
             InsertItem(equipment.special, slot);
         }
         if (slot.firstRespawn)
         {
             if (slot.teamId == 0)
             {
                 InsertItem(equipment.red, slot);
             }
             else
             {
                 InsertItem(equipment.blue, slot);
             }
             InsertItem(equipment.helmet, slot);
             InsertItem(equipment.beret, slot);
         }
         InsertItem(equipment.dino, slot);
         using (BATTLE_RESPAWN_PAK packet = new BATTLE_RESPAWN_PAK(room, slot))
         {
             room.SendPacketToPlayers(packet, SlotStateEnum.BATTLE, 0);
         }
         if (NoChangeEquipment)
         {
             client.SendCompletePacket(PackageDataManager.SERVER_MESSAGE_ANNOUNCE_BLOCK_RULE_PAK);
         }
         room.UpdatePlayerInfoInBattle(slot, player.effects, slot.firstRespawn ? 0 : 2);
         slot.firstRespawn = false;
         if (room.weaponsFlag != WeaponsFlag)
         {
             Logger.Warning($" [BATTLE_RESPAWN_REQ] [WeaponsFlag] Room: " + room.weaponsFlag + " Player: " + WeaponsFlag);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
示例#3
0
 public override void RunImplement()
 {
     try
     {
         string log = $"roomId: {roomId} " +
                      $"roomName: {roomName} " +
                      $"mapId: {mapId} " +
                      $"stage4vs4: {stage4vs4} " +
                      $"stageType: {stageType} " +
                      $"state: {state} " +
                      $"players: {players} " +
                      $"slots: {slots} " +
                      $"ping: {ping} " +
                      $"weaponsFlag: {weaponsFlag} " +
                      $"randomMap: {randomMap} " +
                      $"modeSpecial: {modeSpecial} " +
                      $"leaderName: {leaderName} " +
                      $"killTime: {killTime} " +
                      $"limit: {limit} " +
                      $"seeConf: {seeConf} " +
                      $"balancing: {balancing} " +
                      $"aiCount: {aiCount} " +
                      $"aiLevel: {aiLevel}";
         Logger.DebugPacket(GetType().Name, log);
         //if (roomId >= 0 && roomId <= Settings.MaxRoomsPerChannel && roomName.Length > 0 && stage4vs4 >= 0 && stage4vs4 <= 1 && stageType >= RoomTypeEnum.Tutorial && stageType <= RoomTypeEnum.Escort && leaderName.Length > Settings.NickMinLength && limit >= 0 && limit <= 1 && balancing >= 0 && balancing <= 2)
         //{
         //}
         Logger.DebugPacket(GetType().Name, $"RoomId: {roomId} RoomName: {roomName} MapId: {mapId} Stage4vs4: {stage4vs4} StageType: {stageType} State: {state} Players: {players} Slots: {slots} Ping: {ping} WeaponsFlag: {weaponsFlag} RandomMap: {randomMap} ModeSpecial: {modeSpecial} LeaderName: {leaderName} KillTime: {killTime} Limit: {limit} SeeConf: {seeConf} Balancing: {balancing} AiCount: {aiCount} AiLevel: {aiLevel}");
         Account player = client.SessionPlayer;
         Room    room   = player != null ? player.room : null;
         if (leaderName != player.nickname)
         {
             Logger.Warning($" [PROTOCOL_ROOM_CHANGE_INFO_REQ] Nome do lider incorreto! Leader: {leaderName} Player: {player.nickname}");
         }
         if (room.roomId != roomId)
         {
             Logger.Warning($" [PROTOCOL_ROOM_CHANGE_INFO_REQ] Id da sala incorreto! RoomId: {roomId} SalaId: {room.roomId}");
         }
         if (room != null && room.roomId == roomId && leaderName == player.nickname && room.leaderSlot == player.slotId && room.state == state && room.state == RoomStateEnum.Ready && MapsXML.CheckId(mapId))
         {
             string oldName = room.roomName;
             room.roomName    = roomName;
             room.mapId       = mapId;
             room.stage4vs4   = stage4vs4;
             room.ping        = ping;
             room.randomMap   = randomMap;
             room.modeSpecial = modeSpecial;
             room.leaderName  = leaderName;
             room.killtime    = killTime;
             room.limit       = limit;
             room.seeConf     = seeConf;
             room.balancing   = (BalancingTeamEnum)balancing;
             room.aiCount     = aiCount;
             room.aiLevel     = aiLevel;
             if (stageType != room.mode || weaponsFlag != room.weaponsFlag || oldName != roomName && TournamentRulesManager.CheckRoomRule(oldName.ToUpper()) || TournamentRulesManager.CheckRoomRule(roomName.ToUpper()))
             {
                 room.mode = stageType;
                 if (!room.isModePorrada)
                 {
                     room.weaponsFlag = weaponsFlag;
                 }
                 int count = 0;
                 for (int i = 0; i < 16; i++)
                 {
                     Slot slot = room.slots[i];
                     if (slot.state == SlotStateEnum.READY)
                     {
                         slot.state = SlotStateEnum.NORMAL;
                         count++;
                     }
                 }
                 if (count > 0)
                 {
                     room.UpdateSlotsInfo();
                 }
             }
             room.UpdateRoomInfo();
         }
         else
         {
             Logger.Warning($"[{GetType().Name}] NÃO FOI POSSIVEL ALTERAR AS INFORMAÇÕES DA SALA [!] RoomId ({room.roomId}/{roomId}) LeaderName ({leaderName}/{player.nickname}) LeaderSlot ({room.leaderSlot}/{player.slotId}) RoomState ({room.state}/{state})");
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
示例#4
0
 public override void RunImplement()
 {
     try
     {
         Logger.DebugPacket(GetType().Name, $"RoomName: {roomName} MapId: {mapId} Stage4vs4: {stage4vs4} StageType: {stageType} Ping: {ping} WeaponsFlag: {weaponsFlag} RandomMap: {randomMap} ModeSpecial: {modeSpecial} AiCount: {aiCount} AiLevel: {aiLevel} roomId: {roomId} state: {state} players: {players} slots: {slots}");
         Account player = client.SessionPlayer;
         Room    room   = player != null ? player.room : null;
         if (room == null || room.state != state || room.state != RoomStateEnum.Ready || room.leaderSlot != player.slotId || !MapsXML.CheckId(mapId))
         {
             return;
         }
         string oldName = room.roomName;
         room.roomName    = roomName;
         room.mapId       = mapId;
         room.stage4vs4   = stage4vs4;
         room.ping        = ping;
         room.randomMap   = randomMap;
         room.modeSpecial = modeSpecial;
         room.aiCount     = aiCount;
         room.aiLevel     = aiLevel;
         if (stageType != room.mode || weaponsFlag != room.weaponsFlag || oldName != roomName && TournamentRulesManager.CheckRoomRule(oldName.ToUpper()) || TournamentRulesManager.CheckRoomRule(roomName.ToUpper()))
         {
             room.mode = stageType;
             if (!room.isModePorrada)
             {
                 room.weaponsFlag = weaponsFlag;
             }
             int count = 0;
             for (int i = 0; i < 16; i++)
             {
                 Slot slot = room.slots[i];
                 if (slot.state == SlotStateEnum.READY)
                 {
                     slot.state = SlotStateEnum.NORMAL;
                     count++;
                 }
             }
             if (count > 0)
             {
                 room.UpdateSlotsInfo();
             }
         }
         room.UpdateRoomInfo();
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }