public void Delete() { if (Owner != null) { Owner.SendMessage("Votre faction {0} viens d'être effacée"); } CommandHandlers.BroadcastMessage(AccessLevel.GameMaster, 1333, String.Format("(GM)La faction de '{0}' nommée '{1}' à été effacée", (Owner == null ? "Personne" : Owner.Name), Name)); XMLFactions.Remove(m_Name); }
public XMLFaction(string _Name, Mobile _owner) { m_Name = _Name; m_Owner = _owner; if (m_Owner != null) { m_Access = m_Owner.AccessLevel; m_PlayerFaction = (m_Owner.AccessLevel <= AccessLevel.Player); } bool CanCreate = true; foreach (XMLFaction f in XMLFactions.GetFactions()) { if (CompareTo(f) == 0) { CanCreate = false; } } if (!CanCreate) { if (m_Owner != null) { m_Owner.SendMessage(133, "Impossible de créer votre faction: Le nom est déjà pris"); } return; //N'étant pas ajouté a XMLFactions.m_Factions, l'objet ne sera pas save et sera Delete comme un Grand. // Ne surtout pas utiliser Delete ici, on effacerai la faction existante du même nom ^^ } CommandHandlers.BroadcastMessage(AccessLevel.Player, 133, String.Format("La faction {0} viens de voir le jour", Name)); CommandHandlers.BroadcastMessage(AccessLevel.GameMaster, 0, String.Format("(GM)Faction crée par: {0}", (Owner == null ? "Personne" : Owner.Name))); XMLFactions.Add(this); }
public GumpAdminXMLFaction(NubiaPlayer _owner, int page) : base(50, 50) { m_owner = _owner; int largeur = 500; int hauteur = 400; int _x = 50; int _y = 50; int colG = _x + 40; int colG2 = colG + 70; int colorG = 2168; int colorG2 = 2120; int HColor = 2161; m_page = page; int colCompetence = 375 + _x; AddBackground(_x, _y, _x + largeur, _y + hauteur, 0x2422); AddImageTiled(_x, _y, _x + largeur, 18, 0x280A); //AddAlphaRegion( _x+25, _y+25, _x+largeur-35,_y+hauteur-30 ); //AddImage( 0,40, 0x28C8 ); //AddImage( largeur+70,40, 0x28C9 ); AddImage((largeur / 2) - 10, _y - 3, 0x988); AddLabel((largeur / 2) + 18, _y - 2, 2123, "-= Admin XML Factions =-"); int y = _y + 40; int x = _x + 35; int line = 0; int scale = 35; int decal = 5; /*AddHtml( _x+35, _y+35, largeur-35 , hauteur-50, "<center>Bienvenue sur Terra Nubia</center>"+ * "<p>Votre account doit être validé pour que vous puissiez jouer.<br>"+ * "Pour ce faire, vous devrez répondre à quelques petites questions. Vos réponses seront ensuite examiné par les Administrateurs qui validerons ou non votre Account.</p>", true, true ); */ //AddBackground( _x, _y, _x+largeur,_y+hauteur, 0x2454 ); m_List = new ArrayList((ICollection)XMLFactions.GetFactions()); //m_List.Sort( AccountComparer.Instance ); int LabelHue = 0; int GreenHue = 75; int RedHue = 133; int BlueHue = 5; if (m_List == null) { AddLabelCropped(x, 90, 120, 20, RedHue, "Les factions n'existe pas ?!? Putain, appellez l'Nexam !"); return; } if (m_List.Count == 0) { AddLabelCropped(x, 90, 120, 20, GreenHue, "Aucune faction n'est encore crée"); return; } else { AddLabelCropped(x, 90, 120, 20, LabelHue, "Name"); AddLabelCropped(x + 75, 90, 120, 20, LabelHue, "Owner"); AddLabelCropped(x + 150, 90, 120, 20, LabelHue, "Players?"); AddLabelCropped(x + 225, 90, 120, 20, LabelHue, "Nbr"); AddLabelCropped(x + 300, 90, 120, 20, LabelHue, "AccessLevel"); } //AddAccountHeader(); int width = largeur - 70; int height = 40; //TODO: Tourner les pages :) int index = 0; for (int i = m_page * 10; i < m_List.Count; ++i) { XMLFaction faction = m_List[i] as XMLFaction; if (faction == null) { continue; } int offset = y + ((index + 1) * scale); AddAlphaRegion(x - 2, offset - 2, width, 25); AddLabelCropped(x, offset, 120, 20, LabelHue, faction.Name); if (faction.Owner != null) { AddLabelCropped(x + 75, offset, 120, 20, GreenHue, faction.Owner.Name); } else { AddLabelCropped(x + 75, offset, 120, 20, RedHue, "Inexistant"); } if (faction.PlayerFaction) { AddLabelCropped(x + 150, offset, 120, 20, GreenHue, "Oui"); } else { AddLabelCropped(x + 150, offset, 120, 20, RedHue, "Non"); } AddLabelCropped(x + 225, offset, 120, 20, BlueHue, faction.Count.ToString()); if (faction.Access > m_owner.AccessLevel) { AddLabelCropped(x + 300, offset, 120, 20, RedHue, faction.Access.ToString()); } else { AddLabelCropped(x + 300, offset, 120, 20, GreenHue, faction.Access.ToString()); } //AddButton( x+380 , offset, 0xFA5, 0xFA7, 100+i, GumpButtonType.Reply, 0 ); if (m_owner.AccessLevel >= faction.Access || m_owner == faction.Owner) { AddButton(x + 420, offset, 0xFAB, 0xFAD, 500 + i, GumpButtonType.Reply, 0); } index++; if (index > 10) { return; } } //if( m_owner.AccessLevel >= AccessLevel.Administrator ) // AddButtonLabeled( x, 350, 1, "Créer une faction"); }