// Méthode pour vérifier qu'un joueur soit bien citoyen d'une ville donnée public static bool IsPlayerCitizenOf(Mobile from, string town) { if (from == null) { return(false); } POMI thePomi = POMI.FindPomi(); if (thePomi == null) { return(false); } foreach (object v in thePomi.Villes) { if (v == null || !(v is TownStone)) { continue; } TownStone ville = (TownStone)v; if (ville.Nom.ToLower() == town.ToLower()) { return(ville.Citoyens.Contains(from)); } } return(false); }
// Scriptiz : méthode pour vérifier si un point se trouve à l'intérieur de la ville d'un PJ public static bool IsPointInPlayerTown(PlayerMobile from, Point2D location) { if (from == null) { return(false); } ArrayList villesPomi = POMI.FindPomi().Villes; TownStone ts = null; foreach (object o in villesPomi) { if (o is TownStone) { ts = (TownStone)o; } if (ts != null) { if (ts.Citoyens.Contains(from) && ts.Map == from.Map) { double distance = Math.Sqrt(Math.Pow(ts.Location.X - location.X, 2) + Math.Pow(ts.Location.Y - location.Y, 2)); if (distance > ts.MaxDistance) { from.SendMessage("Vous ne pouvez pas bâtir en dehors de votre ville."); return(false); } } } } return(true); }