public static void StartMonstersBattle(WorldClient client, Engines.Map.MonsterGroup group) { try { if (client.Character.Fighter != null) { return; } client.Action.EndAutoRegen(); Game.Fights.Fight fight = new Game.Fights.Fight(new Game.Fights.Fighter(client), group, client.Character.Map.Engine, Enums.FightTypeEnum.PvM); client.Character.Map.Engine.AddFightOnMap(fight); client.Character.Map.Engine.RemovePlayer(client); fight.EnableContext(); client.Send("GA;901;" + client.Character.ID + ";" + group.ID); System.Threading.Thread.Sleep(500); } catch (Exception e) { Utilities.ConsoleStyle.Error("Cant start monster battle : " + e.ToString()); client.Character.Fighter = null; } }
public static void RequestFightsDetails(WorldClient client, string packet) { if (client.Character != null && client.Character.Map != null) { int fightID = int.Parse(packet.Substring(2)); Game.Fights.Fight fightWatched = client.Character.Map.Engine.GetFight(fightID); if (fightWatched != null) { client.Send("fD" + fightWatched.DisplayFightDetails); } else { client.Action.SystemMessage("Combat non disponible !"); } } }
public static void AcceptChallengeRequest(WorldClient client) { if (client.Action.RequestChallengerID != -1) { if (client.Character.Fighter != null) { return; } Network.WorldClient otherClient = client.Character.Map.Engine.GetClientOnMap(client.Action.RequestChallengerID); if (otherClient != null) { if (otherClient.Character.Fighter != null) { return; } client.Action.EndAutoRegen(); otherClient.Action.EndAutoRegen(); client.Send("GA;901;" + client.Character.ID + ";" + otherClient.Character.ID); otherClient.Send("GA;901;" + otherClient.Character.ID + ";" + client.Character.ID); /* Reset state */ client.Action.RequestChallengerID = -1; otherClient.Action.RequestChallengerID = -1; /* Starting battle engine */ Game.Fights.Fight fight = new Game.Fights.Fight(new Game.Fights.Fighter(client), new Game.Fights.Fighter(otherClient), client.Character.Map.Engine, Enums.FightTypeEnum.Challenge); client.Character.Map.Engine.AddFightOnMap(fight); /* Destroy on the map */ client.Character.Map.Engine.RemovePlayer(client); otherClient.Character.Map.Engine.RemovePlayer(otherClient); /* Enable fight context */ fight.EnableContext(); } else { EndChallengeRequest(client); } } }
public static void RequestAggresion(WorldClient client, string packet) { if (Game.Pvp.PvpManager.IsNoPvpMap(client.Character.MapID)) { client.Action.SystemMessage("Vous ne pouvez pas pvp sur cette carte !"); return; } if (client.Character.Fighter != null) { return; } Network.WorldClient otherClient = client.Character.Map.Engine.GetClientOnMap(int.Parse(packet)); if (otherClient != null) { if (Utilities.ConfigurationManager.GetBoolValue("EnableMultiIPSecurity")) { if (client.IP == otherClient.IP) { client.Action.SystemMessage("Impossible vous défier vous même !"); return; } } if (otherClient.Character.Fighter != null) { return; } if (!otherClient.Action.IsOccuped) { if (!ConfigurationManager.GetBoolValue("EnableNeutreAggro") && otherClient.Character.Faction.ID == Enums.FactionTypeEnum.Neutral) { client.Action.SystemMessage("Impossible d'agresser ce joueur car il est neutre et le serveur n'autorise pas ce type d'agression !"); return; } if (otherClient.Character.Faction.ID != client.Character.Faction.ID) { client.Send("GA;901;" + client.Character.ID + ";" + otherClient.Character.ID); otherClient.Send("GA;901;" + otherClient.Character.ID + ";" + client.Character.ID); /* Starting battle engine */ Game.Fights.Fight fight = new Game.Fights.Fight(new Game.Fights.Fighter(client), new Game.Fights.Fighter(otherClient), client.Character.Map.Engine, Enums.FightTypeEnum.Agression); client.Character.Map.Engine.AddFightOnMap(fight); /* Destroy on the map */ client.Character.Map.Engine.RemovePlayer(client); otherClient.Character.Map.Engine.RemovePlayer(otherClient); /* Enable fight context */ fight.EnableContext(); } else { client.Action.SystemMessage("Impossible d'agresser ce joueur car celui ci est du meme alignement que vous !"); } } } else { client.Action.SystemMessage("Impossible d'agresser ce joueur car celui ci est indisponible ou introuvable !"); } }
public static void RequestJoinChallenge(WorldClient client, string packet) { string[] data = packet.Split(';'); int fightID = int.Parse(data[0]); Game.Fights.Fight fight = client.Character.Map.Engine.GetFight(fightID); if (client.Character.Fighter != null) { return; } if (data.Length > 1) { int teamID = int.Parse(data[1]); if (fight != null) { if (!client.Action.IsOccuped) { if (fight.State == Game.Fights.Fight.FightState.PlacementsPhase) { if (fight.FightType == Enums.FightTypeEnum.Agression && client.Character.FactionID == 0) { client.Action.SystemMessage("Impossible de rejoindre le combat, car vous etes neutre !"); return; } var teamRequest = fight.GetTeam(teamID); var fighter = new Game.Fights.Fighter(client); if (teamRequest.Restrictions.CanJoin(fighter)) { client.Character.Map.Engine.RemovePlayer(client); fight.AddPlayer(fighter, teamID); } else { client.Action.SystemMessage("Impossible de rejoindre le combat, celui ci est bloquer !"); client.Character.Fighter = null; } } else { client.Action.SystemMessage("Impossible de rejoindre le combat"); } } else { client.Send("BN"); } } } else { if (fight != null) { if (fight.State == Game.Fights.Fight.FightState.Fighting) { if (!fight.BlockSpectator) { if (!client.Action.IsOccuped) { client.Character.Map.Engine.RemovePlayer(client); client.Action.Spectator = new Game.Fights.FightSpectator(client, fight); fight.AddSpectator(client.Action.Spectator); } else { client.Send("BN"); } } else { client.Send("GA;903;f"); } } else { client.Action.SystemMessage("Le combat n'as pas encore debuter, veuilliez attendre !"); } } } }