protected override void OnTarget(Mobile from, object targeted) { if (GuildGump.BadMember(m_Mobile, m_Guild)) { return; } if (targeted is Mobile) { Mobile m = (Mobile)targeted; PlayerState guildState = PlayerState.Find(m_Guild.Leader); PlayerState targetState = PlayerState.Find(m); Faction guildFaction = (guildState == null ? null : guildState.Faction); Faction targetFaction = (targetState == null ? null : targetState.Faction); if (!m.Player) { m_Mobile.SendLocalizedMessage(501161); // You may only recruit players into the guild. } else if (!m.Alive) { m_Mobile.SendLocalizedMessage(501162); // Only the living may be recruited. } else if (m_Guild.IsMember(m)) { m_Mobile.SendLocalizedMessage(501163); // They are already a guildmember! } else if (m_Guild.Candidates.Contains(m)) { m_Mobile.SendLocalizedMessage(501164); // They are already a candidate. } else if (m_Guild.Accepted.Contains(m)) { m_Mobile.SendLocalizedMessage(501165); // They have already been accepted for membership, and merely need to use the Guildstone to gain full membership. } else if (m.Guild != null) { m_Mobile.SendLocalizedMessage(501166); // You can only recruit candidates who are not already in a guild. } #region Factions else if (guildFaction != targetFaction) { if (guildFaction == null) { m_Mobile.SendLocalizedMessage(1013027); // That player cannot join a non-faction guild. } else if (targetFaction == null) { m_Mobile.SendLocalizedMessage(1013026); // That player must be in a faction before joining this guild. } else { m_Mobile.SendLocalizedMessage(1013028); // That person has a different faction affiliation. } } else if (targetState != null && targetState.IsLeaving) { // OSI does this quite strangely, so we'll just do it this way m_Mobile.SendMessage("That person is quitting their faction and so you may not recruit them."); } #endregion else if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Guild.Leader == m_Mobile) { m_Guild.Accepted.Add(m); } else { m_Guild.Candidates.Add(m); } } }
public override void OnResponse(NetState state, RelayInfo info) { if ((Guild.NewGuildSystem && !BaseGuildGump.IsLeader(m_Mobile, m_Guild)) || (!Guild.NewGuildSystem && GuildGump.BadLeader(m_Mobile, m_Guild))) { return; } GuildType newType; switch (info.ButtonID) { default: newType = m_Guild.Type; break; case 1: newType = GuildType.Regular; break; case 2: newType = GuildType.Order; break; case 3: newType = GuildType.Chaos; break; } if (m_Guild.Type != newType) { PlayerState pl = PlayerState.Find(m_Mobile); if (pl != null) { m_Mobile.SendLocalizedMessage(1010405); // You cannot change guild types while in a Faction! } else if (m_Guild.TypeLastChange.AddDays(7) > DateTime.UtcNow) { m_Mobile.SendLocalizedMessage(1011142); // You have already changed your guild type recently. // TODO: Clilocs 1011142-1011145 suggest a timer for pending changes } else { m_Guild.Type = newType; m_Guild.GuildMessage(1018022, true, newType.ToString()); // Guild Message: Your guild type has changed: } } if (Guild.NewGuildSystem) { if (m_Mobile is PlayerMobile) { m_Mobile.SendGump(new GuildInfoGump((PlayerMobile)m_Mobile, m_Guild)); } return; } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); }
public override void OnResponse(NetState state, RelayInfo info) { if (GuildGump.BadLeader(m_Mobile, m_Guild)) { return; } switch (info.ButtonID) { case 1: // Main menu { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild)); break; } case 2: // Set guild name { m_Mobile.SendLocalizedMessage(1013060); // Enter new guild name (40 characters max): m_Mobile.Prompt = new GuildNamePrompt(m_Mobile, m_Guild); break; } case 3: // Set guild abbreviation { m_Mobile.SendLocalizedMessage(1013061); // Enter new guild abbreviation (3 characters max): m_Mobile.Prompt = new GuildAbbrvPrompt(m_Mobile, m_Guild); break; } case 4: // Change guild type { if (!Guild.OrderChaos) { return; } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildChangeTypeGump(m_Mobile, m_Guild)); break; } case 5: // Set charter { m_Mobile.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max): m_Mobile.Prompt = new GuildCharterPrompt(m_Mobile, m_Guild); break; } case 6: // Dismiss member { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildDismissGump(m_Mobile, m_Guild)); break; } case 7: // War menu { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild)); break; } case 8: // Administer candidates { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild)); break; } case 9: // Set guildmaster's title { m_Mobile.SendLocalizedMessage(1013073); // Enter new guildmaster title (20 characters max): m_Mobile.Prompt = new GuildTitlePrompt(m_Mobile, m_Mobile, m_Guild); break; } case 10: // Grant title { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GrantGuildTitleGump(m_Mobile, m_Guild)); break; } case 11: // Move guildstone { if (m_Guild.Guildstone != null) { GuildTeleporter item = new GuildTeleporter(m_Guild.Guildstone); if (m_Guild.Teleporter != null) { m_Guild.Teleporter.Delete(); } m_Mobile.SendLocalizedMessage(501133); // Use the teleporting object placed in your backpack to move this guildstone. m_Mobile.AddToBackpack(item); m_Guild.Teleporter = item; } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); break; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (GuildGump.BadLeader(m_Mobile, m_Guild)) { return; } switch (info.ButtonID) { case 0: { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); break; } case 1: // Accept { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < m_List.Count) { Mobile m = (Mobile)m_List[index]; if (m != null && !m.Deleted) { #region Factions PlayerState guildState = PlayerState.Find(m_Guild.Leader); PlayerState targetState = PlayerState.Find(m); Faction guildFaction = (guildState == null ? null : guildState.Faction); Faction targetFaction = (targetState == null ? null : targetState.Faction); if (guildFaction != targetFaction) { if (guildFaction == null) { m_Mobile.SendLocalizedMessage(1013027); // That player cannot join a non-faction guild. } else if (targetFaction == null) { m_Mobile.SendLocalizedMessage(1013026); // That player must be in a faction before joining this guild. } else { m_Mobile.SendLocalizedMessage(1013028); // That person has a different faction affiliation. } break; } else if (targetState != null && targetState.IsLeaving) { // OSI does this quite strangely, so we'll just do it this way m_Mobile.SendMessage("That person is quitting their faction and so you may not recruit them."); break; } #endregion m_Guild.Candidates.Remove(m); m_Guild.Accepted.Add(m); GuildGump.EnsureClosed(m_Mobile); if (m_Guild.Candidates.Count > 0) { m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild)); } else { m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); } } } } break; } case 2: // Refuse { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < m_List.Count) { Mobile m = (Mobile)m_List[index]; if (m != null && !m.Deleted) { m_Guild.Candidates.Remove(m); GuildGump.EnsureClosed(m_Mobile); if (m_Guild.Candidates.Count > 0) { m_Mobile.SendGump(new GuildAdminCandidatesGump(m_Mobile, m_Guild)); } else { m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); } } } } break; } } }
public override void OnResponse(NetState sender, RelayInfo info) { if (BadMember(m_Mobile, m_Guild)) { return; } switch (info.ButtonID) { case 1: // Loyalty { EnsureClosed(m_Mobile); m_Mobile.SendGump(new DeclareFealtyGump(m_Mobile, m_Guild)); break; } case 2: // Toggle display abbreviation { m_Mobile.DisplayGuildTitle = !m_Mobile.DisplayGuildTitle; EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild)); break; } case 3: // View the current roster { EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildRosterGump(m_Mobile, m_Guild)); break; } case 4: // Recruit { m_Mobile.Target = new GuildRecruitTarget(m_Mobile, m_Guild); break; } case 5: // Membership candidates { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildCandidatesGump(m_Mobile, m_Guild)); break; } case 6: // View charter { EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildCharterGump(m_Mobile, m_Guild)); break; } case 7: // Resign { m_Guild.RemoveMember(m_Mobile); break; } case 8: // View wars { EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildWarGump(m_Mobile, m_Guild)); break; } case 9: // Guildmaster functions { if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Guild.Leader == m_Mobile) { EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); } break; } } }