public void SetTitle_Callback(Mobile from, string text) { PlayerMobile pm = from as PlayerMobile; PlayerMobile targ = m_Member; if (pm == null || targ == null) { return; } Guild g = targ.Guild as Guild; if (g == null || !IsMember(pm, g) || !(pm.GuildRank.GetFlag(RankFlags.CanSetGuildTitle) && (pm.GuildRank.Rank > targ.GuildRank.Rank || pm == targ))) { if (m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0) { pm.SendLocalizedMessage(1070746); // You don't have the permission to set that member's guild title. } else { pm.SendLocalizedMessage(1063148); // You don't have permission to change this member's guild title. } return; } string title = Utility.FixHtml(text.Trim()); if (title.Length > 20) { from.SendLocalizedMessage(501178); // That title is too long. } else if (!BaseGuildGump.CheckProfanity(title)) { from.SendLocalizedMessage(501179); // That title is disallowed. } else { if (Insensitive.Equals(title, "none")) { targ.GuildTitle = null; } else { targ.GuildTitle = title; } pm.SendLocalizedMessage(1063156, targ.Name); // The guild information for ~1_val~ has been updated. } }
public void CreateAlliance_Callback(Mobile from, string text) { PlayerMobile pm = from as PlayerMobile; AllianceInfo alliance = guild.Alliance; AllianceInfo otherAlliance = m_Other.Alliance; if (!IsMember(from, guild) || alliance != null) { return; } RankDefinition playerRank = pm.GuildRank; if (!playerRank.GetFlag(RankFlags.AllianceControl)) { pm.SendLocalizedMessage(1070747); // You don't have permission to create an alliance. } else if (Faction.Find(guild.Leader) != Faction.Find(m_Other.Leader)) { //Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later. pm.SendLocalizedMessage(1070758); // You cannot propose an alliance to a guild with a different faction allegiance. } else if (otherAlliance != null) { if (otherAlliance.IsPendingMember(m_Other)) { pm.SendLocalizedMessage(1063416, m_Other.Name); // ~1_val~ is currently considering another alliance proposal. } else { pm.SendLocalizedMessage(1063426, m_Other.Name); // ~1_val~ already belongs to an alliance. } } else if (m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0) { pm.SendLocalizedMessage(1063427, m_Other.Name); // ~1_val~ is currently involved in a guild war. } else if (guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0) { pm.SendLocalizedMessage(1063427, guild.Name); // ~1_val~ is currently involved in a guild war. } else { string name = Utility.FixHtml(text.Trim()); if (!BaseGuildGump.CheckProfanity(name)) { pm.SendLocalizedMessage(1070886); // That alliance name is not allowed. } else if (name.Length > Guild.NameLimit) { pm.SendLocalizedMessage(1070887, Guild.NameLimit.ToString()); // An alliance name cannot exceed ~1_val~ characters in length. } else if (AllianceInfo.Alliances.ContainsKey(name.ToLower())) { pm.SendLocalizedMessage(1063428); // That alliance name is not available. } else { pm.SendLocalizedMessage(1070750, m_Other.Name); // An invitation to join your alliance has been sent to ~1_val~. m_Other.GuildMessage(1070780, guild.Name); // ~1_val~ has proposed an alliance. new AllianceInfo(guild, name, m_Other); } } }
public override void OnResponse(NetState sender, RelayInfo info) { PlayerMobile pm = sender.Mobile as PlayerMobile; if (pm == null || pm.Guild != null) { return; //Sanity } switch (info.ButtonID) { case 1: { TextRelay tName = info.GetTextEntry(5); TextRelay tAbbrev = info.GetTextEntry(6); string guildName = (tName == null) ? "" : tName.Text; string guildAbbrev = (tAbbrev == null) ? "" : tAbbrev.Text; guildName = Utility.FixHtml(guildName.Trim()); guildAbbrev = Utility.FixHtml(guildAbbrev.Trim()); if (guildName.Length <= 0) { pm.SendLocalizedMessage(1070884); // Guild name cannot be blank. } else if (guildAbbrev.Length <= 0) { pm.SendLocalizedMessage(1070885); // You must provide a guild abbreviation. } else if (guildName.Length > Guild.NameLimit) { pm.SendLocalizedMessage(1063036, Guild.NameLimit.ToString()); // A guild name cannot be more than ~1_val~ characters in length. } else if (guildAbbrev.Length > Guild.AbbrevLimit) { pm.SendLocalizedMessage(1063037, Guild.AbbrevLimit.ToString()); // An abbreviation cannot exceed ~1_val~ characters in length. } else if (Guild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev)) { pm.SendLocalizedMessage(501153); // That abbreviation is not available. } else if (Guild.FindByName(guildName) != null || !BaseGuildGump.CheckProfanity(guildName)) { pm.SendLocalizedMessage(1063000); // That guild name is not available. } else if (!Banker.Withdraw(pm, Guild.RegistrationFee)) { pm.SendLocalizedMessage(1063001, Guild.RegistrationFee.ToString()); // You do not possess the ~1_val~ gold piece fee required to create a guild. } else { pm.SendLocalizedMessage(1060398, Guild.RegistrationFee.ToString()); // ~1_AMOUNT~ gold has been withdrawn from your bank box. pm.SendLocalizedMessage(1063238); // Your new guild has been founded. pm.Guild = new Guild(pm, guildName, guildAbbrev); } break; } case 2: { pm.AcceptGuildInvites = !pm.AcceptGuildInvites; if (pm.AcceptGuildInvites) { pm.SendLocalizedMessage(1070699); // You are now accepting guild invitations. } else { pm.SendLocalizedMessage(1070698); // You are now ignoring guild invitations. } break; } } }