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 { var switches = info.Switches; if (switches.Length > 0) { var index = switches[0]; if (index >= 0 && index < m_List.Count) { var m = m_List[index]; if (m?.Deleted == false) { var guildState = PlayerState.Find(m_Guild.Leader); var targetState = PlayerState.Find(m); var guildFaction = guildState?.Faction; var targetFaction = 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; } if (targetState?.IsLeaving == true) { // 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; } 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 { var switches = info.Switches; if (switches.Length > 0) { var index = switches[0]; if (index >= 0 && index < m_List.Count) { var m = m_List[index]; if (m?.Deleted == false) { 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 state, RelayInfo info) { if (GuildGump.BadLeader(m_Mobile, m_Guild)) { return; } if (info.ButtonID == 1) { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < m_List.Count) { Guild g = (Guild)m_List[index]; if (g != null) { if (g.IOBAlignment != IOBAlignment.None && m_Guild.IOBAlignment != IOBAlignment.None && g.IOBAlignment != m_Guild.IOBAlignment) { //If we're both not aligned, and aligned to different kin, then we can't ally. m_Mobile.SendMessage("You cannot ally with different kin."); m_Guild.AllyInvitations.Remove(g); g.AllyDeclarations.Remove(m_Guild); } else if (m_Guild.Peaceful == true) { m_Mobile.SendMessage("You belong to a peaceful guild and may not do that."); m_Guild.AllyInvitations.Remove(g); g.AllyDeclarations.Remove(m_Guild); } else { m_Guild.AllyInvitations.Remove(g); g.AllyDeclarations.Remove(m_Guild); m_Guild.AddAlly(g); string s = string.Format("Your guild is now allied, {0} {1}", g.Name, g.Abbreviation); m_Guild.GuildMessage(s); GuildGump.EnsureClosed(m_Mobile); } if (m_Guild.AllyInvitations.Count > 0) { m_Mobile.SendGump(new GuildAcceptAllianceGump(m_Mobile, m_Guild)); } else { m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); } } } } } else if (info.ButtonID == 2) { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); } }
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 { BaseHouse house = BaseHouse.FindHouseAt(m_Mobile); if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Guild.Leader == m_Mobile) { EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); } else if (house != null && m_Mobile == house.Owner) { ((Items.Guildstone)m_Guild.Guildstone).OnPrepareMove(m_Mobile); } break; } case 10: // View Allies { EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildAllianceGump(m_Mobile, m_Guild)); break; } case 11: //Force new guildmaster recalculation (available only to staff) { if (m_Mobile.AccessLevel >= AccessLevel.Counselor) { m_Guild.CalculateGuildmaster(); } else { m_Mobile.SendMessage("You can't cheat like that."); } m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild)); break; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (GuildGump.BadLeader(m_Mobile, m_Guild)) { return; } GuildType newType; switch (info.ButtonID) { default: return; // Close case 1: newType = GuildType.Regular; break; case 2: newType = GuildType.Order; break; case 3: newType = GuildType.Chaos; break; } PlayerState pl = PlayerState.Find(m_Mobile); bool okToChange = false; if (pl != null && m_Guild.TypeLastChange.AddDays(7) <= DateTime.Now) { Faction faction = pl.Faction; Faction com = CouncilOfMages.Instance; Faction tb = TrueBritannians.Instance; Faction sl = Shadowlords.Instance; Faction minax = Minax.Instance; if (((faction == com || faction == tb) && newType == GuildType.Order) || ((faction == sl || faction == minax) && newType == GuildType.Chaos)) { okToChange = true; } else { m_Mobile.SendLocalizedMessage(1010405); // You cannot change guild types while in a Faction! } } else if (m_Guild.TypeLastChange.AddDays(7) > DateTime.Now) { m_Mobile.SendLocalizedMessage(1005292); // Your guild type will be changed in one week. } else { okToChange = true; } if (okToChange) { if (m_Guild.Type == newType) { return; } m_Guild.Type = newType; m_Guild.GuildMessage(1018022, true, newType.ToString()); // Guild Message: Your guild type has changed: } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); }
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.Now) { 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(this.m_Mobile, this.m_Guild)) { return; } switch (info.ButtonID) { case 0: { GuildGump.EnsureClosed(this.m_Mobile); this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild)); break; } case 1: // Accept { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < this.m_List.Count) { Mobile m = (Mobile)this.m_List[index]; if (m != null && !m.Deleted) { #region Factions PlayerState guildState = PlayerState.Find(this.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) { this.m_Mobile.SendLocalizedMessage(1013027); // That player cannot join a non-faction guild. } else if (targetFaction == null) { this.m_Mobile.SendLocalizedMessage(1013026); // That player must be in a faction before joining this guild. } else { this.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 this.m_Mobile.SendMessage("That person is quitting their faction and so you may not recruit them."); break; } #endregion this.m_Guild.Candidates.Remove(m); this.m_Guild.Accepted.Add(m); GuildGump.EnsureClosed(this.m_Mobile); if (this.m_Guild.Candidates.Count > 0) { this.m_Mobile.SendGump(new GuildAdminCandidatesGump(this.m_Mobile, this.m_Guild)); } else { this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild)); } } } } break; } case 2: // Refuse { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < this.m_List.Count) { Mobile m = (Mobile)this.m_List[index]; if (m != null && !m.Deleted) { this.m_Guild.Candidates.Remove(m); GuildGump.EnsureClosed(this.m_Mobile); if (this.m_Guild.Candidates.Count > 0) { this.m_Mobile.SendGump(new GuildAdminCandidatesGump(this.m_Mobile, this.m_Guild)); } else { this.m_Mobile.SendGump(new GuildmasterGump(this.m_Mobile, this.m_Guild)); } } } } break; } } }
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; } if (m_Guild.TypeLastChange.AddDays(7) > DateTime.Now) { m_Mobile.SendLocalizedMessage(1005292); // Your guild type will be changed in one week. } else { GuildType newType; switch (info.ButtonID) { default: return; // Close case 1: newType = GuildType.Regular; break; case 2: newType = GuildType.Order; break; case 3: newType = GuildType.Chaos; break; } if (m_Guild.Type == newType) { return; } 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 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) { 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 state, RelayInfo info) { if (GuildGump.BadLeader(m_Mobile, m_Guild)) { return; } if (info.ButtonID == 1) { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < m_List.Count) { Guild g = (Guild)m_List[index]; if (g != null) { if (g == m_Guild) { m_Mobile.SendLocalizedMessage(501184); // You cannot declare war against yourself! } else if (m_Guild.Peaceful == true) { m_Mobile.SendMessage("You belong to a peaceful guild and may not do this."); } else if ((g.WarInvitations.Contains(m_Guild) && m_Guild.WarDeclarations.Contains(g)) || m_Guild.IsWar(g)) { m_Mobile.SendLocalizedMessage(501183); // You are already at war with that guild. } else if ((g.AllyInvitations.Contains(m_Guild) && m_Guild.AllyDeclarations.Contains(g)) || m_Guild.IsAlly(g)) { m_Mobile.SendMessage("You cannot war with a guild you are allied with!."); // cant allie with a guild we are at war with } else { if (!m_Guild.WarDeclarations.Contains(g)) { m_Guild.WarDeclarations.Add(g); m_Guild.GuildMessage(1018019, "{0} ({1})", g.Name, g.Abbreviation); // Guild Message: Your guild has sent an invitation for war: } if (!g.WarInvitations.Contains(m_Guild)) { g.WarInvitations.Add(m_Guild); g.GuildMessage(1018021, "{0} ({1})", m_Guild.Name, m_Guild.Abbreviation); // Guild Message: Your guild has received an invitation to war: } } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild)); } } } } else if (info.ButtonID == 2) { 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; } 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.Now) { //m_Mobile.SendLocalizedMessage( 1005292 ); // Your guild type will be changed in one week. m_Mobile.SendMessage("You can only change your guild type once every seven days. Try again later."); } else { GuildType newType; switch (info.ButtonID) { default: return; // Close case 1: newType = GuildType.Regular; break; case 2: newType = GuildType.Order; break; case 3: newType = GuildType.Chaos; break; } if (m_Guild.Type == newType) { return; } if (newType != GuildType.Regular && !Guild.JoinVirtue(m_Mobile, newType)) { m_Mobile.SendAsciiMessage(0x25, "You cannot change this guild to be a that virtue right now. Change to regular and then wait up to seven days. Murderers cannot join virtue guilds, ever."); return; } m_Guild.Type = newType; m_Guild.GuildMessage(1018022, true, newType.ToString()); // Guild Message: Your guild type has changed: if (newType != GuildType.Regular) { List <Mobile> toRemove = new List <Mobile>(); foreach (Mobile m in m_Guild.Members) { if (!Guild.JoinVirtue(m, newType)) { toRemove.Add(m); } } foreach (Mobile m in toRemove) { m_Guild.RemoveMember(m); m.SendAsciiMessage(0x25, "You are a your guild has become a virtue guild, you cannot be in that virtue so you have been removed from the guild. You must wait up to 7 days before you can join a guild of an opposing virtue. Murderers may not join virtue guilds."); } m_Mobile.SendAsciiMessage(0x25, "{0} murderers have been purged from the member list.", toRemove.Count); } } 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 { 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) { if (m_Guild.Guildstone is Items.Guildstone) { ((Items.Guildstone)m_Guild.Guildstone).OnPrepareMove(m_Mobile); } } // GuildGump.EnsureClosed( m_Mobile ); // m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) ); break; } case 12: // Ally Menu { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildAllianceAdminGump(m_Mobile, m_Guild)); break; } case 13: //Guild War Ring toggle { if (DateTime.Now >= m_Guild.GuildWarRingChangeTime.AddMinutes(CoreAI.GWRChangeDelayMinutes)) { m_Guild.GuildWarRing = !m_Guild.GuildWarRing; m_Guild.GuildWarRingChangeTime = DateTime.Now; if (m_Guild.GuildWarRing) { m_Guild.GuildMessage("Your guild has joined the Guild War Ring. All the guilds in the ring are now your enemies."); } else { m_Guild.GuildMessage("Your guild has left the Guild War Ring."); } } else { m_Mobile.SendMessage("You cannot change the Guild War Ring feature yet."); } m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); break; } case 14: //Murder Reporting { m_Guild.IsNoCountingGuild = !m_Guild.IsNoCountingGuild; if (m_Guild.IsNoCountingGuild) { m_Guild.GuildMessage("Your guild now restricts murder reporting."); } else { m_Guild.GuildMessage("Your guild now allows murder reporting."); } 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; } if (info.ButtonID == 1) { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < m_List.Count) { Guild g = (Guild)m_List[index]; if (g != null) { if (g == m_Guild) { m_Mobile.SendMessage("You cannot declare an alliance with yourself"); // You cannot declare war against yourself! } else if (m_Guild.Peaceful == true) { m_Mobile.SendMessage("You belong to a peaceful guild and may not do this."); } else if ((g.AllyInvitations.Contains(m_Guild) && m_Guild.AllyDeclarations.Contains(g)) || m_Guild.IsAlly(g)) { m_Mobile.SendMessage("You are already allied with that guild."); // You are already allyed with that guild. } else if (g.IOBAlignment != IOBAlignment.None && m_Guild.IOBAlignment != IOBAlignment.None && g.IOBAlignment != m_Guild.IOBAlignment) { m_Mobile.SendMessage("You cannot ally with different kin."); } else if ((g.WarInvitations.Contains(m_Guild) && m_Guild.WarDeclarations.Contains(g)) || m_Guild.IsEnemy(g)) { m_Mobile.SendMessage("You cannot ally with a guild you are at war with!."); // cant allie with a guild we are at war with } else { if (!m_Guild.AllyDeclarations.Contains(g)) { m_Guild.AllyDeclarations.Add(g); string s = string.Format("Your guild has sent an alliance invitation, {0} {1}", g.Name, g.Abbreviation); m_Guild.GuildMessage(s); } if (!g.AllyInvitations.Contains(m_Guild)) { g.AllyInvitations.Add(m_Guild); string s = string.Format("Your guild has recieved an invitation to ally, {0} {1}", m_Guild.Name, m_Guild.Abbreviation); g.GuildMessage(s); } } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildAllianceAdminGump(m_Mobile, m_Guild)); } } } } else if (info.ButtonID == 2) { 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; } if (info.ButtonID == 1) { int[] switches = info.Switches; if (switches.Length > 0) { int index = switches[0]; if (index >= 0 && index < m_List.Count) { Guild g = m_List[index]; if (g != null) { if (g == m_Guild) { m_Mobile.SendLocalizedMessage(501184); // You cannot declare war against yourself! } else if ((g.WarInvitations.Contains(m_Guild) && m_Guild.WarDeclarations.Contains(g)) || m_Guild.IsWar(g)) { m_Mobile.SendLocalizedMessage(501183); // You are already at war with that guild. } else if (Faction.Find(m_Guild.Leader) != null) { m_Mobile.SendLocalizedMessage(1005288); // You cannot declare war while you are in a faction } else { if (!m_Guild.WarDeclarations.Contains(g)) { m_Guild.WarDeclarations.Add(g); m_Guild.GuildMessage(1018019, true, "{0} ({1})", g.Name, g.Abbreviation); // Guild Message: Your guild has sent an invitation for war: } if (!g.WarInvitations.Contains(m_Guild)) { g.WarInvitations.Add(m_Guild); g.GuildMessage(1018021, true, "{0} ({1})", m_Guild.Name, m_Guild .Abbreviation); // Guild Message: Your guild has received an invitation to war: } } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild)); } } } } else if (info.ButtonID == 2) { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); } }
protected override void OnTarget(Mobile from, object targeted) { if (GuildGump.BadMember(m_Mobile, m_Guild)) { return; } if (targeted is Mobile || targeted is Items.CertificateOfIdentity) { Mobile m = targeted as Mobile; 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); PlayerMobile pm = targeted as PlayerMobile; Items.CertificateOfIdentity coi = null; if (targeted is Items.CertificateOfIdentity) { coi = targeted as Items.CertificateOfIdentity; if (coi.Mobile != null && coi.Mobile.Deleted == false) { // reassign m = coi.Mobile as Mobile; pm = coi.Mobile as PlayerMobile; } } if (coi != null && (coi.Mobile == null || coi.Mobile.Deleted)) { from.SendMessage("That identity certificate does not represent a player."); } else 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! } #region Kin else if (pm != null && !(pm.IOBAlignment == IOBAlignment.None || pm.IOBAlignment == m_Guild.IOBAlignment)) { m_Mobile.SendMessage("Only non-aligned or same-aligned can be recruited."); } #endregion 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); } } }
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 (GuildGump.BadLeader(m_Mobile, m_Guild)) { return; } if (m_Guild.TypeLastChange.AddDays(7) > DateTime.Now) { m_Mobile.SendLocalizedMessage(1005292); // Your guild type will be changed in one week. } else { GuildType newType; switch (info.ButtonID) { default: return; // Close case 1: newType = GuildType.Regular; break; case 2: newType = GuildType.Order; break; case 3: newType = GuildType.Chaos; break; } if (m_Guild.Type == newType) { return; } if (newType != GuildType.Regular) { ArrayList remove = new ArrayList(); for (int i = 0; i < m_Guild.Members.Count; i++) { if (((Mobile)m_Guild.Members[i]).Karma < (int)Noto.LordLady) { remove.Add(m_Guild.Members[i]); } } if (remove.Count >= m_Guild.Members.Count || remove.Contains(m_Guild.Leader)) { m_Mobile.SendAsciiMessage("The effects on your guild's membership would be far too great."); return; } else { for (int i = 0; i < remove.Count; i++) { Mobile m = (Mobile)remove[i]; m_Guild.RemoveMember(m); m.SendAsciiMessage("You are not famous enough to stay in your guild."); } } } m_Guild.Type = newType; m_Guild.GuildMessage(1018022, newType.ToString()); // Guild Message: Your guild type has changed: } 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; } GuildType newType = m_Guild.Type; //GuildType.Regular; IOBAlignment newIOBType = m_Guild.IOBAlignment; //IOBAlignment.None; switch (info.ButtonID) { default: break; //return; // Close case 1: newType = GuildType.Regular; break; case 2: newType = GuildType.Order; break; case 3: newType = GuildType.Chaos; break; case 5: newIOBType = IOBAlignment.Brigand; break; case 6: newIOBType = IOBAlignment.Council; break; case 7: newIOBType = IOBAlignment.Good; break; case 8: newIOBType = IOBAlignment.Orcish; break; case 9: newIOBType = IOBAlignment.Pirate; break; case 10: newIOBType = IOBAlignment.Savage; break; case 11: newIOBType = IOBAlignment.Undead; break; case 12: newIOBType = IOBAlignment.None; break; } if (m_Guild.IOBAlignment != newIOBType && CanChangeKin() == false) { m_Mobile.SendMessage("Guild Kin Alignment change is currently disabled."); return; } if ((m_Guild.Type != newType || m_Guild.IOBAlignment != newIOBType) && m_Guild.TypeLastChange.AddDays(7) > DateTime.Now) { m_Mobile.SendMessage("You can only change your alignment once every 7 days."); } else { if (m_Guild.Type != newType) { //Changing Order/Chaos //Check that Order/Chaos guilds aren't allied if (newType != GuildType.Regular) //we only care if there changeing to a differnt special type { ArrayList Allies = m_Guild.Allies; for (int i = 0; i < Allies.Count; ++i) { Guild g = (Guild)Allies[i]; if (g.Type != GuildType.Regular && g.Type != newType) { m_Mobile.SendMessage("Break any alliances with opposing guild types first"); return; } } } //Change the Guild! m_Guild.Type = newType; m_Guild.GuildMessage(1018022, newType.ToString()); // Guild Message: Your guild type has changed: } else if (m_Guild.IOBAlignment != newIOBType) { //Changing KIN //Check that different IOB types aren't allied if (newIOBType != IOBAlignment.None) { ArrayList Allies = m_Guild.Allies; for (int i = 0; i < Allies.Count; ++i) { Guild g = (Guild)Allies[i]; if (g.IOBAlignment != IOBAlignment.None && g.IOBAlignment != newIOBType) { m_Mobile.SendMessage("Break any alliances with opposing guild types first"); return; } } } //Change the Guild! m_Guild.IOBAlignment = newIOBType; if (m_Guild.IOBAlignment != IOBAlignment.None) { m_Guild.GuildMessage("Your guild is now allied with the " + this.TranslateIOBName(newIOBType)); } else { m_Guild.GuildMessage("Your guild has broken its kin alignment, it is now unaligned."); } } else { m_Mobile.SendMessage("You have not changed your alignment."); } } GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); }
protected override void OnTarget(Mobile from, object targeted) { if (GuildGump.BadMember(m_Mobile, m_Guild)) { return; } if (targeted is Mobile || targeted is Items.CertificateOfIdentity) { Mobile m = targeted as Mobile; PlayerMobile pm = targeted as PlayerMobile; Items.CertificateOfIdentity coi = null; if (targeted is Items.CertificateOfIdentity) { coi = targeted as Items.CertificateOfIdentity; if (coi.Mobile != null && coi.Mobile.Deleted == false) { // reassign m = coi.Mobile as Mobile; pm = coi.Mobile as PlayerMobile; } } if (coi != null && (coi.Mobile == null || coi.Mobile.Deleted)) { from.SendMessage("That identity certificate does not represent a player."); } else 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! } //Pix: IOBAlignment check else if (pm != null && !(pm.IOBAlignment == IOBAlignment.None || pm.IOBAlignment == m_Guild.IOBAlignment)) { m_Mobile.SendMessage("Only non-aligned or same-aligned can be recruited."); } 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. } 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 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; } } }
public override void OnResponse(NetState state, RelayInfo info) { if (GuildGump.BadLeader(m_Mobile, m_Guild)) { return; } switch (info.ButtonID) { case 1: // Declare war { //m_Mobile.SendMessage("Pesquisar Nome da Guilda para Declarar Guerra"); // Declare war through search - Enter Guild Name: //m_Mobile.Prompt = new GuildDeclareWarPrompt( m_Mobile, m_Guild ); List <Guild> guilds = Utility.CastConvertList <BaseGuild, Guild>(Guild.Search("")); GuildGump.EnsureClosed(m_Mobile); if (guilds.Count > 0) { m_Mobile.SendGump(new GuildDeclareWarGump(m_Mobile, m_Guild, guilds)); } else { m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild)); m_Mobile.SendLocalizedMessage(1018003); // No guilds found matching - try another name in the search } break; } case 2: // Declare peace { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildDeclarePeaceGump(m_Mobile, m_Guild)); break; } case 3: // Accept war { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildAcceptWarGump(m_Mobile, m_Guild)); break; } case 4: // Reject war { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildRejectWarGump(m_Mobile, m_Guild)); break; } case 5: // Rescind declarations { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildRescindDeclarationGump(m_Mobile, m_Guild)); break; } case 6: // Return { GuildGump.EnsureClosed(m_Mobile); m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild)); break; } } }