Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -3,50 +3,47 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class DeclareFealtyGump : GuildMobileListGump
|
||||
{
|
||||
public DeclareFealtyGump( Mobile from, Guild guild ) : base( from, guild, true, guild.Members )
|
||||
{
|
||||
}
|
||||
public class DeclareFealtyGump : GuildMobileListGump
|
||||
{
|
||||
public DeclareFealtyGump(Mobile from, Guild guild) : base(from, guild, true, guild.Members)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1011097, false, false ); // Declare your fealty
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011097, false, false); // Declare your fealty
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 250, 35, 1011098, false, false ); // I have selected my new lord.
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 250, 35, 1011098, false, false); // I have selected my new lord.
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Mobile m = (Mobile)m_List[index];
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
{
|
||||
state.Mobile.GuildFealty = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m != null && !m.Deleted) state.Mobile.GuildFealty = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,53 +3,53 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GrantGuildTitleGump : GuildMobileListGump
|
||||
{
|
||||
public GrantGuildTitleGump( Mobile from, Guild guild ) : base( from, guild, true, guild.Members )
|
||||
{
|
||||
}
|
||||
public class GrantGuildTitleGump : GuildMobileListGump
|
||||
{
|
||||
public GrantGuildTitleGump(Mobile from, Guild guild) : base(from, guild, true, guild.Members)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1011118, false, false ); // Grant a title to another member.
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011118, false, false); // Grant a title to another member.
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 245, 30, 1011127, false, false ); // I dub thee...
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011127, false, false); // I dub thee...
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Mobile m = (Mobile)m_List[index];
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage( 1013074 ); // New title (20 characters max):
|
||||
m_Mobile.Prompt = new GuildTitlePrompt( m_Mobile, m, m_Guild );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( info.ButtonID == 2 )
|
||||
{
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m != null && !m.Deleted)
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1013074); // New title (20 characters max):
|
||||
m_Mobile.Prompt = new GuildTitlePrompt(m_Mobile, m, m_Guild);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,51 +3,51 @@ using Server.Prompts;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildAbbrvPrompt : Prompt
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildAbbrvPrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildAbbrvPrompt( Mobile m, Guild g )
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
public GuildAbbrvPrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
text = text.Trim();
|
||||
|
||||
if ( text.Length > 3 )
|
||||
text = text.Substring( 0, 3 );
|
||||
if (text.Length > 3)
|
||||
text = text.Substring(0, 3);
|
||||
|
||||
if ( text.Length > 0 )
|
||||
{
|
||||
if ( BaseGuild.FindByAbbrev( text ) != null )
|
||||
{
|
||||
m_Mobile.SendMessage( "{0} conflicts with the abbreviation of an existing guild.", text );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Abbreviation = text;
|
||||
m_Guild.GuildMessage( 1018025, true, text ); // Your guild abbreviation has changed:
|
||||
}
|
||||
}
|
||||
if (text.Length > 0)
|
||||
{
|
||||
if (BaseGuild.FindByAbbrev(text) != null)
|
||||
{
|
||||
m_Mobile.SendMessage("{0} conflicts with the abbreviation of an existing guild.", text);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Abbreviation = text;
|
||||
m_Guild.GuildMessage(1018025, true, text); // Your guild abbreviation has changed:
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,63 +3,63 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildAcceptWarGump : GuildListGump
|
||||
{
|
||||
public GuildAcceptWarGump( Mobile from, Guild guild ) : base( from, guild, true, guild.WarInvitations )
|
||||
{
|
||||
}
|
||||
public class GuildAcceptWarGump : GuildListGump
|
||||
{
|
||||
public GuildAcceptWarGump(Mobile from, Guild guild) : base(from, guild, true, guild.WarInvitations)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1011147, false, false ); // Select the guild to accept the invitations:
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011147, false, false); // Select the guild to accept the invitations:
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 245, 30, 1011100, false, false ); // Accept war invitations.
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011100, false, false); // Accept war invitations.
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Guild g = (Guild)m_List[index];
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if ( g != null )
|
||||
{
|
||||
m_Guild.WarInvitations.Remove( g );
|
||||
g.WarDeclarations.Remove( m_Guild );
|
||||
if (g != null)
|
||||
{
|
||||
m_Guild.WarInvitations.Remove(g);
|
||||
g.WarDeclarations.Remove(m_Guild);
|
||||
|
||||
m_Guild.AddEnemy( g );
|
||||
m_Guild.GuildMessage( 1018020, true, "{0} ({1})", g.Name, g.Abbreviation );
|
||||
m_Guild.AddEnemy(g);
|
||||
m_Guild.GuildMessage(1018020, true, "{0} ({1})", g.Name, g.Abbreviation);
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if ( m_Guild.WarInvitations.Count > 0 )
|
||||
m_Mobile.SendGump( new GuildAcceptWarGump( 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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Guild.WarInvitations.Count > 0)
|
||||
m_Mobile.SendGump(new GuildAcceptWarGump(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,125 +1,131 @@
|
|||
using Server.Factions;
|
||||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildAdminCandidatesGump : GuildMobileListGump
|
||||
{
|
||||
public GuildAdminCandidatesGump( Mobile from, Guild guild ) : base( from, guild, true, guild.Candidates )
|
||||
{
|
||||
}
|
||||
public class GuildAdminCandidatesGump : GuildMobileListGump
|
||||
{
|
||||
public GuildAdminCandidatesGump(Mobile from, Guild guild) : base(from, guild, true, guild.Candidates)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1013075, false, false ); // Accept or Refuse candidates for membership
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1013075, false, false); // Accept or Refuse candidates for membership
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 245, 30, 1013076, false, false ); // Accept
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1013076, false, false); // Accept
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1013077, false, false ); // Refuse
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1013077, false, false); // Refuse
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 ) );
|
||||
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;
|
||||
break;
|
||||
}
|
||||
case 1: // Accept
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Mobile m = (Mobile)m_List[index];
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
{
|
||||
#region Factions
|
||||
PlayerState guildState = PlayerState.Find( m_Guild.Leader );
|
||||
PlayerState targetState = PlayerState.Find( m );
|
||||
if (m != null && !m.Deleted)
|
||||
{
|
||||
#region Factions
|
||||
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
PlayerState guildState = PlayerState.Find(m_Guild.Leader);
|
||||
PlayerState targetState = PlayerState.Find(m);
|
||||
|
||||
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.
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
|
||||
break;
|
||||
}
|
||||
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.
|
||||
|
||||
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
|
||||
break;
|
||||
}
|
||||
|
||||
m_Guild.Candidates.Remove( m );
|
||||
m_Guild.Accepted.Add( m );
|
||||
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;
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
#endregion
|
||||
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
m_Guild.Candidates.Remove(m);
|
||||
m_Guild.Accepted.Add(m);
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Refuse
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Mobile m = (Mobile)m_List[index];
|
||||
break;
|
||||
}
|
||||
case 2: // Refuse
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
{
|
||||
m_Guild.Candidates.Remove( m );
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m != null && !m.Deleted)
|
||||
{
|
||||
m_Guild.Candidates.Remove(m);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,30 +3,30 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildCandidatesGump : GuildMobileListGump
|
||||
{
|
||||
public GuildCandidatesGump( Mobile from, Guild guild ) : base( from, guild, false, guild.Candidates )
|
||||
{
|
||||
}
|
||||
public class GuildCandidatesGump : GuildMobileListGump
|
||||
{
|
||||
public GuildCandidatesGump(Mobile from, Guild guild) : base(from, guild, false, guild.Candidates)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 500, 35, 1013030, false, false ); // <center> Candidates </center>
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 500, 35, 1013030, false, false); // <center> Candidates </center>
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 300, 35, 1011120, false, false ); // Return to the main menu.
|
||||
}
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 300, 35, 1011120, false, false); // Return to the main menu.
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,91 +1,101 @@
|
|||
using System;
|
||||
using Server.Factions;
|
||||
using Server.Guilds;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildChangeTypeGump : Gump
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildChangeTypeGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildChangeTypeGump( Mobile from, Guild guild ) : base( 20, 30 )
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
public GuildChangeTypeGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Dragable = false;
|
||||
Dragable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 550, 400, 5054 );
|
||||
AddBackground( 10, 10, 530, 380, 3000 );
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 400, 5054);
|
||||
AddBackground(10, 10, 530, 380, 3000);
|
||||
|
||||
AddHtmlLocalized( 20, 15, 510, 30, 1013062, false, false ); // <center>Change Guild Type Menu</center>
|
||||
AddHtmlLocalized(20, 15, 510, 30, 1013062, false, false); // <center>Change Guild Type Menu</center>
|
||||
|
||||
AddHtmlLocalized( 50, 50, 450, 30, 1013066, false, false ); // Please select the type of guild you would like to change to
|
||||
AddHtmlLocalized(50, 50, 450, 30, 1013066, false,
|
||||
false); // Please select the type of guild you would like to change to
|
||||
|
||||
AddButton( 20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 85, 100, 300, 30, 1013063, false, false ); // Standard guild
|
||||
AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(85, 100, 300, 30, 1013063, false, false); // Standard guild
|
||||
|
||||
AddButton( 20, 150, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddItem( 50, 143, 7109 );
|
||||
AddHtmlLocalized( 85, 150, 300, 300, 1013064, false, false ); // Order guild
|
||||
AddButton(20, 150, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddItem(50, 143, 7109);
|
||||
AddHtmlLocalized(85, 150, 300, 300, 1013064, false, false); // Order guild
|
||||
|
||||
AddButton( 20, 200, 4005, 4007, 3, GumpButtonType.Reply, 0 );
|
||||
AddItem( 45, 200, 7107 );
|
||||
AddHtmlLocalized( 85, 200, 300, 300, 1013065, false, false ); // Chaos guild
|
||||
AddButton(20, 200, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddItem(45, 200, 7107);
|
||||
AddHtmlLocalized(85, 200, 300, 300, 1013065, false, false); // Chaos guild
|
||||
|
||||
AddButton( 300, 360, 4005, 4007, 4, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 360, 150, 30, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 360, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 360, 150, 30, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
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 (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 (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 mobile )
|
||||
mobile.SendGump( new GuildInfoGump( mobile, m_Guild ) );
|
||||
if (Guild.NewGuildSystem)
|
||||
{
|
||||
if (m_Mobile is PlayerMobile mobile)
|
||||
mobile.SendGump(new GuildInfoGump(mobile, m_Guild));
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,68 +3,67 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildCharterGump : Gump
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildCharterGump : Gump
|
||||
{
|
||||
private const string DefaultWebsite = "https://github.com/runuo/";
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
private const string DefaultWebsite = "https://github.com/runuo/";
|
||||
public GuildCharterGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
public GuildCharterGump( Mobile from, Guild guild ) : base( 20, 30 )
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
Dragable = false;
|
||||
|
||||
Dragable = false;
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 400, 5054);
|
||||
AddBackground(10, 10, 530, 380, 3000);
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 550, 400, 5054 );
|
||||
AddBackground( 10, 10, 530, 380, 3000 );
|
||||
AddButton(20, 360, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 360, 300, 35, 1011120, false, false); // Return to the main menu.
|
||||
|
||||
AddButton( 20, 360, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 360, 300, 35, 1011120, false, false ); // Return to the main menu.
|
||||
string charter;
|
||||
|
||||
string charter;
|
||||
if ((charter = guild.Charter) == null || (charter = charter.Trim()).Length <= 0)
|
||||
AddHtmlLocalized(20, 20, 400, 35, 1013032, false, false); // No charter has been defined.
|
||||
else
|
||||
AddHtml(20, 20, 510, 75, charter, true, true);
|
||||
|
||||
if ( (charter = guild.Charter) == null || (charter = charter.Trim()).Length <= 0 )
|
||||
AddHtmlLocalized( 20, 20, 400, 35, 1013032, false, false ); // No charter has been defined.
|
||||
else
|
||||
AddHtml( 20, 20, 510, 75, charter, true, true );
|
||||
AddButton(20, 200, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 200, 300, 20, 1011122, false, false); // Visit the guild website :
|
||||
|
||||
AddButton( 20, 200, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 200, 300, 20, 1011122, false, false ); // Visit the guild website :
|
||||
string website;
|
||||
|
||||
string website;
|
||||
if ((website = guild.Website) == null || (website = website.Trim()).Length <= 0)
|
||||
website = DefaultWebsite;
|
||||
|
||||
if ( (website = guild.Website) == null || (website = website.Trim()).Length <= 0 )
|
||||
website = DefaultWebsite;
|
||||
AddHtml(55, 220, 300, 20, website, false, false);
|
||||
}
|
||||
|
||||
AddHtml( 55, 220, 300, 20, website, false, false );
|
||||
}
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: return; // Close
|
||||
case 1: break; // Return to main menu
|
||||
case 2:
|
||||
{
|
||||
string website;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
{
|
||||
case 0: return; // Close
|
||||
case 1: break; // Return to main menu
|
||||
case 2:
|
||||
{
|
||||
string website;
|
||||
if ((website = m_Guild.Website) == null || (website = website.Trim()).Length <= 0)
|
||||
website = DefaultWebsite;
|
||||
|
||||
if ( (website = m_Guild.Website) == null || (website = website.Trim()).Length <= 0 )
|
||||
website = DefaultWebsite;
|
||||
m_Mobile.LaunchBrowser(website);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_Mobile.LaunchBrowser( website );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,44 +3,44 @@ using Server.Prompts;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildCharterPrompt : Prompt
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildCharterPrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildCharterPrompt( Mobile m, Guild g )
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
public GuildCharterPrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
text = text.Trim();
|
||||
|
||||
if ( text.Length > 50 )
|
||||
text = text.Substring( 0, 50 );
|
||||
if (text.Length > 50)
|
||||
text = text.Substring(0, 50);
|
||||
|
||||
if ( text.Length > 0 )
|
||||
m_Guild.Charter = text;
|
||||
if (text.Length > 0)
|
||||
m_Guild.Charter = text;
|
||||
|
||||
m_Mobile.SendLocalizedMessage( 1013072 ); // Enter the new website for the guild (50 characters max):
|
||||
m_Mobile.Prompt = new GuildWebsitePrompt( m_Mobile, m_Guild );
|
||||
m_Mobile.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
|
||||
m_Mobile.Prompt = new GuildWebsitePrompt(m_Mobile, m_Guild);
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,60 +3,61 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildDeclarePeaceGump : GuildListGump
|
||||
{
|
||||
public GuildDeclarePeaceGump( Mobile from, Guild guild ) : base( from, guild, true, guild.Enemies )
|
||||
{
|
||||
}
|
||||
public class GuildDeclarePeaceGump : GuildListGump
|
||||
{
|
||||
public GuildDeclarePeaceGump(Mobile from, Guild guild) : base(from, guild, true, guild.Enemies)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1011137, false, false ); // Select the guild you wish to declare peace with.
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011137, false, false); // Select the guild you wish to declare peace with.
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 245, 30, 1011138, false, false ); // Send the olive branch.
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011138, false, false); // Send the olive branch.
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Guild g = (Guild)m_List[index];
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if ( g != null )
|
||||
{
|
||||
m_Guild.RemoveEnemy( g );
|
||||
m_Guild.GuildMessage( 1018018, true, "{0} ({1})", g.Name, g.Abbreviation ); // Guild Message: You are now at peace with this guild:
|
||||
if (g != null)
|
||||
{
|
||||
m_Guild.RemoveEnemy(g);
|
||||
m_Guild.GuildMessage(1018018, true, "{0} ({1})", g.Name,
|
||||
g.Abbreviation); // Guild Message: You are now at peace with this guild:
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if ( m_Guild.Enemies.Count > 0 )
|
||||
m_Mobile.SendGump( new GuildDeclarePeaceGump( 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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Guild.Enemies.Count > 0)
|
||||
m_Mobile.SendGump(new GuildDeclarePeaceGump(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,85 +1,89 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Factions;
|
||||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
using Server.Factions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildDeclareWarGump : GuildListGump
|
||||
{
|
||||
public GuildDeclareWarGump( Mobile from, Guild guild, List<Guild> list )
|
||||
: base( from, guild, true, list )
|
||||
{
|
||||
}
|
||||
public class GuildDeclareWarGump : GuildListGump
|
||||
{
|
||||
public GuildDeclareWarGump(Mobile from, Guild guild, List<Guild> list)
|
||||
: base(from, guild, true, list)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1011065, false, false ); // Select the guild you wish to declare war on.
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011065, false, false); // Select the guild you wish to declare war on.
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 245, 30, 1011068, false, false ); // Send the challenge!
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011068, false, false); // Send the challenge!
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
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 != 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:
|
||||
}
|
||||
}
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +1,56 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
using Server.Prompts;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildDeclareWarPrompt : Prompt
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildDeclareWarPrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildDeclareWarPrompt( Mobile m, Guild g )
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
public GuildDeclareWarPrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildWarAdminGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildWarAdminGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
text = text.Trim();
|
||||
|
||||
if ( text.Length >= 3 )
|
||||
{
|
||||
List<Guild> guilds = Utility.CastConvertList<BaseGuild, Guild>( BaseGuild.Search( text ) );
|
||||
if (text.Length >= 3)
|
||||
{
|
||||
List<Guild> guilds = Utility.CastConvertList<BaseGuild, Guild>(BaseGuild.Search(text));
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
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
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.SendMessage( "Search string must be at least three letters in length." );
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.SendMessage("Search string must be at least three letters in length.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,58 +3,58 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildDismissGump : GuildMobileListGump
|
||||
{
|
||||
public GuildDismissGump ( Mobile from, Guild guild ) : base( from, guild, true, guild.Members )
|
||||
{
|
||||
}
|
||||
public class GuildDismissGump : GuildMobileListGump
|
||||
{
|
||||
public GuildDismissGump(Mobile from, Guild guild) : base(from, guild, true, guild.Members)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1011124, false, false ); // Whom do you wish to dismiss?
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011124, false, false); // Whom do you wish to dismiss?
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 245, 30, 1011125, false, false ); // Kick them out!
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011125, false, false); // Kick them out!
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Mobile m = (Mobile)m_List[index];
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Mobile m = m_List[index];
|
||||
|
||||
if ( m != null && !m.Deleted )
|
||||
{
|
||||
m_Guild.RemoveMember( m );
|
||||
if (m != null && !m.Deleted)
|
||||
{
|
||||
m_Guild.RemoveMember(m);
|
||||
|
||||
if ( m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Mobile == m_Guild.Leader )
|
||||
{
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( info.ButtonID == 2 && (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Mobile == m_Guild.Leader) )
|
||||
{
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Mobile == m_Guild.Leader)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (info.ButtonID == 2 && (m_Mobile.AccessLevel >= AccessLevel.GameMaster || m_Mobile == m_Guild.Leader))
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,218 +3,220 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildGump : Gump
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildGump( Mobile beholder, Guild guild ) : base( 20, 30 )
|
||||
{
|
||||
m_Mobile = beholder;
|
||||
m_Guild = guild;
|
||||
public GuildGump(Mobile beholder, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = beholder;
|
||||
m_Guild = guild;
|
||||
|
||||
Dragable = false;
|
||||
Dragable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 550, 400, 5054 );
|
||||
AddBackground( 10, 10, 530, 380, 3000 );
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 400, 5054);
|
||||
AddBackground(10, 10, 530, 380, 3000);
|
||||
|
||||
AddHtml( 20, 15, 200, 35, guild.Name, false, false );
|
||||
AddHtml(20, 15, 200, 35, guild.Name, false, false);
|
||||
|
||||
Mobile leader = guild.Leader;
|
||||
Mobile leader = guild.Leader;
|
||||
|
||||
if ( leader != null )
|
||||
{
|
||||
string leadTitle;
|
||||
if (leader != null)
|
||||
{
|
||||
string leadTitle;
|
||||
|
||||
if ( (leadTitle = leader.GuildTitle) != null && (leadTitle = leadTitle.Trim()).Length > 0 )
|
||||
leadTitle += ": ";
|
||||
else
|
||||
leadTitle = "";
|
||||
if ((leadTitle = leader.GuildTitle) != null && (leadTitle = leadTitle.Trim()).Length > 0)
|
||||
leadTitle += ": ";
|
||||
else
|
||||
leadTitle = "";
|
||||
|
||||
string leadName;
|
||||
string leadName;
|
||||
|
||||
if ( (leadName = leader.Name) == null || (leadName = leadName.Trim()).Length <= 0 )
|
||||
leadName = "(empty)";
|
||||
if ((leadName = leader.Name) == null || (leadName = leadName.Trim()).Length <= 0)
|
||||
leadName = "(empty)";
|
||||
|
||||
AddHtml( 220, 15, 250, 35, leadTitle + leadName, false, false );
|
||||
}
|
||||
AddHtml(220, 15, 250, 35, leadTitle + leadName, false, false);
|
||||
}
|
||||
|
||||
AddButton( 20, 50, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 50, 100, 20, 1013022, false, false ); // Loyal to
|
||||
AddButton(20, 50, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 50, 100, 20, 1013022, false, false); // Loyal to
|
||||
|
||||
Mobile fealty = beholder.GuildFealty;
|
||||
Mobile fealty = beholder.GuildFealty;
|
||||
|
||||
if ( fealty == null || !guild.IsMember( fealty ) )
|
||||
fealty = leader;
|
||||
if (fealty == null || !guild.IsMember(fealty))
|
||||
fealty = leader;
|
||||
|
||||
if ( fealty == null )
|
||||
fealty = beholder;
|
||||
if (fealty == null)
|
||||
fealty = beholder;
|
||||
|
||||
string fealtyName;
|
||||
string fealtyName;
|
||||
|
||||
if ( fealty == null || (fealtyName = fealty.Name) == null || (fealtyName = fealtyName.Trim()).Length <= 0 )
|
||||
fealtyName = "(empty)";
|
||||
if (fealty == null || (fealtyName = fealty.Name) == null || (fealtyName = fealtyName.Trim()).Length <= 0)
|
||||
fealtyName = "(empty)";
|
||||
|
||||
if ( beholder == fealty )
|
||||
AddHtmlLocalized( 55, 70, 470, 20, 1018002, false, false ); // yourself
|
||||
else
|
||||
AddHtml( 55, 70, 470, 20, fealtyName, false, false );
|
||||
if (beholder == fealty)
|
||||
AddHtmlLocalized(55, 70, 470, 20, 1018002, false, false); // yourself
|
||||
else
|
||||
AddHtml(55, 70, 470, 20, fealtyName, false, false);
|
||||
|
||||
AddButton( 215, 50, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 250, 50, 170, 20, 1013023, false, false ); // Display guild abbreviation
|
||||
AddHtmlLocalized( 250, 70, 50, 20, beholder.DisplayGuildTitle ? 1011262 : 1011263, false, false ); // on/off
|
||||
AddButton(215, 50, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(250, 50, 170, 20, 1013023, false, false); // Display guild abbreviation
|
||||
AddHtmlLocalized(250, 70, 50, 20, beholder.DisplayGuildTitle ? 1011262 : 1011263, false, false); // on/off
|
||||
|
||||
AddButton( 20, 100, 4005, 4007, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 100, 470, 30, 1011086, false, false ); // View the current roster.
|
||||
AddButton(20, 100, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 100, 470, 30, 1011086, false, false); // View the current roster.
|
||||
|
||||
AddButton( 20, 130, 4005, 4007, 4, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 130, 470, 30, 1011085, false, false ); // Recruit someone into the guild.
|
||||
AddButton(20, 130, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 130, 470, 30, 1011085, false, false); // Recruit someone into the guild.
|
||||
|
||||
if ( guild.Candidates.Count > 0 )
|
||||
{
|
||||
AddButton( 20, 160, 4005, 4007, 5, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 160, 470, 30, 1011093, false, false ); // View list of candidates who have been sponsored to the guild.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage( 20, 160, 4020 );
|
||||
AddHtmlLocalized( 55, 160, 470, 30, 1013031, false, false ); // There are currently no candidates for membership.
|
||||
}
|
||||
if (guild.Candidates.Count > 0)
|
||||
{
|
||||
AddButton(20, 160, 4005, 4007, 5, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 160, 470, 30, 1011093, false,
|
||||
false); // View list of candidates who have been sponsored to the guild.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage(20, 160, 4020);
|
||||
AddHtmlLocalized(55, 160, 470, 30, 1013031, false,
|
||||
false); // There are currently no candidates for membership.
|
||||
}
|
||||
|
||||
AddButton( 20, 220, 4005, 4007, 6, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 220, 470, 30, 1011087, false, false ); // View the guild's charter.
|
||||
AddButton(20, 220, 4005, 4007, 6, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 220, 470, 30, 1011087, false, false); // View the guild's charter.
|
||||
|
||||
AddButton( 20, 250, 4005, 4007, 7, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 250, 470, 30, 1011092, false, false ); // Resign from the guild.
|
||||
AddButton(20, 250, 4005, 4007, 7, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 250, 470, 30, 1011092, false, false); // Resign from the guild.
|
||||
|
||||
AddButton( 20, 280, 4005, 4007, 8, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 280, 470, 30, 1011095, false, false ); // View list of guilds you are at war with.
|
||||
AddButton(20, 280, 4005, 4007, 8, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 280, 470, 30, 1011095, false, false); // View list of guilds you are at war with.
|
||||
|
||||
if ( beholder.AccessLevel >= AccessLevel.GameMaster || beholder == leader )
|
||||
{
|
||||
AddButton( 20, 310, 4005, 4007, 9, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 310, 470, 30, 1011094, false, false ); // Access guildmaster functions.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage( 20, 310, 4020 );
|
||||
AddHtmlLocalized( 55, 310, 470, 30, 1018013, false, false ); // Reserved for guildmaster
|
||||
}
|
||||
if (beholder.AccessLevel >= AccessLevel.GameMaster || beholder == leader)
|
||||
{
|
||||
AddButton(20, 310, 4005, 4007, 9, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 310, 470, 30, 1011094, false, false); // Access guildmaster functions.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage(20, 310, 4020);
|
||||
AddHtmlLocalized(55, 310, 470, 30, 1018013, false, false); // Reserved for guildmaster
|
||||
}
|
||||
|
||||
AddButton( 20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 360, 470, 30, 1011441, false, false ); // EXIT
|
||||
}
|
||||
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 360, 470, 30, 1011441, false, false); // EXIT
|
||||
}
|
||||
|
||||
public static void EnsureClosed( Mobile m )
|
||||
{
|
||||
m.CloseGump( typeof( DeclareFealtyGump ) );
|
||||
m.CloseGump( typeof( GrantGuildTitleGump ) );
|
||||
m.CloseGump( typeof( GuildAdminCandidatesGump ) );
|
||||
m.CloseGump( typeof( GuildCandidatesGump ) );
|
||||
m.CloseGump( typeof( GuildChangeTypeGump ) );
|
||||
m.CloseGump( typeof( GuildCharterGump ) );
|
||||
m.CloseGump( typeof( GuildDismissGump ) );
|
||||
m.CloseGump( typeof( GuildGump ) );
|
||||
m.CloseGump( typeof( GuildmasterGump ) );
|
||||
m.CloseGump( typeof( GuildRosterGump ) );
|
||||
m.CloseGump( typeof( GuildWarGump ) );
|
||||
}
|
||||
public static void EnsureClosed(Mobile m)
|
||||
{
|
||||
m.CloseGump(typeof(DeclareFealtyGump));
|
||||
m.CloseGump(typeof(GrantGuildTitleGump));
|
||||
m.CloseGump(typeof(GuildAdminCandidatesGump));
|
||||
m.CloseGump(typeof(GuildCandidatesGump));
|
||||
m.CloseGump(typeof(GuildChangeTypeGump));
|
||||
m.CloseGump(typeof(GuildCharterGump));
|
||||
m.CloseGump(typeof(GuildDismissGump));
|
||||
m.CloseGump(typeof(GuildGump));
|
||||
m.CloseGump(typeof(GuildmasterGump));
|
||||
m.CloseGump(typeof(GuildRosterGump));
|
||||
m.CloseGump(typeof(GuildWarGump));
|
||||
}
|
||||
|
||||
public static bool BadLeader( Mobile m, Guild g )
|
||||
{
|
||||
if ( m.Deleted || g.Disbanded || (m.AccessLevel < AccessLevel.GameMaster && g.Leader != m) )
|
||||
return true;
|
||||
public static bool BadLeader(Mobile m, Guild g)
|
||||
{
|
||||
if (m.Deleted || g.Disbanded || m.AccessLevel < AccessLevel.GameMaster && g.Leader != m)
|
||||
return true;
|
||||
|
||||
Item stone = g.Guildstone;
|
||||
Item stone = g.Guildstone;
|
||||
|
||||
return ( stone == null || stone.Deleted || !m.InRange( stone.GetWorldLocation(), 2 ) );
|
||||
}
|
||||
return stone == null || stone.Deleted || !m.InRange(stone.GetWorldLocation(), 2);
|
||||
}
|
||||
|
||||
public static bool BadMember( Mobile m, Guild g )
|
||||
{
|
||||
if ( m.Deleted || g.Disbanded || (m.AccessLevel < AccessLevel.GameMaster && !g.IsMember( m )) )
|
||||
return true;
|
||||
public static bool BadMember(Mobile m, Guild g)
|
||||
{
|
||||
if (m.Deleted || g.Disbanded || m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m))
|
||||
return true;
|
||||
|
||||
Item stone = g.Guildstone;
|
||||
Item stone = g.Guildstone;
|
||||
|
||||
return ( stone == null || stone.Deleted || !m.InRange( stone.GetWorldLocation(), 2 ) );
|
||||
}
|
||||
return stone == null || stone.Deleted || !m.InRange(stone.GetWorldLocation(), 2);
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 ) );
|
||||
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;
|
||||
break;
|
||||
}
|
||||
case 2: // Toggle display abbreviation
|
||||
{
|
||||
m_Mobile.DisplayGuildTitle = !m_Mobile.DisplayGuildTitle;
|
||||
|
||||
EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
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 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 4: // Recruit
|
||||
{
|
||||
m_Mobile.Target = new GuildRecruitTarget(m_Mobile, m_Guild);
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: // Membership candidates
|
||||
{
|
||||
EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildCandidatesGump( m_Mobile, m_Guild ) );
|
||||
break;
|
||||
}
|
||||
case 5: // Membership candidates
|
||||
{
|
||||
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 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 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 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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,64 +1,64 @@
|
|||
using Server.Guilds;
|
||||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public abstract class GuildListGump : Gump
|
||||
{
|
||||
protected Mobile m_Mobile;
|
||||
protected Guild m_Guild;
|
||||
protected List<Guild> m_List;
|
||||
public abstract class GuildListGump : Gump
|
||||
{
|
||||
protected Guild m_Guild;
|
||||
protected List<Guild> m_List;
|
||||
protected Mobile m_Mobile;
|
||||
|
||||
public GuildListGump( Mobile from, Guild guild, bool radio, List<Guild> list ) : base( 20, 30 )
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
public GuildListGump(Mobile from, Guild guild, bool radio, List<Guild> list) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Dragable = false;
|
||||
Dragable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 550, 440, 5054 );
|
||||
AddBackground( 10, 10, 530, 420, 3000 );
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
Design();
|
||||
Design();
|
||||
|
||||
m_List = new List<Guild>( list );
|
||||
m_List = new List<Guild>(list);
|
||||
|
||||
for ( int i = 0; i < m_List.Count; ++i )
|
||||
{
|
||||
if ( (i % 11) == 0 )
|
||||
{
|
||||
if ( i != 0 )
|
||||
{
|
||||
AddButton( 300, 370, 4005, 4007, 0, GumpButtonType.Page, (i / 11) + 1 );
|
||||
AddHtmlLocalized( 335, 370, 300, 35, 1011066, false, false ); // Next page
|
||||
}
|
||||
for (int i = 0; i < m_List.Count; ++i)
|
||||
{
|
||||
if (i % 11 == 0)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
||||
AddHtmlLocalized(335, 370, 300, 35, 1011066, false, false); // Next page
|
||||
}
|
||||
|
||||
AddPage( (i / 11) + 1 );
|
||||
AddPage(i / 11 + 1);
|
||||
|
||||
if ( i != 0 )
|
||||
{
|
||||
AddButton( 20, 370, 4014, 4016, 0, GumpButtonType.Page, (i / 11) );
|
||||
AddHtmlLocalized( 55, 370, 300, 35, 1011067, false, false ); // Previous page
|
||||
}
|
||||
}
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
||||
AddHtmlLocalized(55, 370, 300, 35, 1011067, false, false); // Previous page
|
||||
}
|
||||
}
|
||||
|
||||
if ( radio )
|
||||
AddRadio( 20, 35 + ((i % 11) * 30), 208, 209, false, i );
|
||||
if (radio)
|
||||
AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
||||
|
||||
Guild g = m_List[i];
|
||||
Guild g = m_List[i];
|
||||
|
||||
string name;
|
||||
string name;
|
||||
|
||||
if ( (name = g.Name) != null && (name = name.Trim()).Length <= 0 )
|
||||
name = "(empty)";
|
||||
if ((name = g.Name) != null && (name = name.Trim()).Length <= 0)
|
||||
name = "(empty)";
|
||||
|
||||
AddLabel( (radio ? 55 : 20), 35 + ((i % 11) * 30), 0, name );
|
||||
}
|
||||
}
|
||||
AddLabel(radio ? 55 : 20, 35 + i % 11 * 30, 0, name);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Design()
|
||||
{
|
||||
}
|
||||
}
|
||||
protected virtual void Design()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,65 +1,65 @@
|
|||
using Server.Guilds;
|
||||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public abstract class GuildMobileListGump : Gump
|
||||
{
|
||||
protected Mobile m_Mobile;
|
||||
protected Guild m_Guild;
|
||||
protected List<Mobile> m_List;
|
||||
public abstract class GuildMobileListGump : Gump
|
||||
{
|
||||
protected Guild m_Guild;
|
||||
protected List<Mobile> m_List;
|
||||
protected Mobile m_Mobile;
|
||||
|
||||
public GuildMobileListGump( Mobile from, Guild guild, bool radio, List<Mobile> list )
|
||||
: base( 20, 30 )
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
public GuildMobileListGump(Mobile from, Guild guild, bool radio, List<Mobile> list)
|
||||
: base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Dragable = false;
|
||||
Dragable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 550, 440, 5054 );
|
||||
AddBackground( 10, 10, 530, 420, 3000 );
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
Design();
|
||||
Design();
|
||||
|
||||
m_List = new List<Mobile>( list );
|
||||
m_List = new List<Mobile>(list);
|
||||
|
||||
for ( int i = 0; i < m_List.Count; ++i )
|
||||
{
|
||||
if ( (i % 11) == 0 )
|
||||
{
|
||||
if ( i != 0 )
|
||||
{
|
||||
AddButton( 300, 370, 4005, 4007, 0, GumpButtonType.Page, (i / 11) + 1 );
|
||||
AddHtmlLocalized( 335, 370, 300, 35, 1011066, false, false ); // Next page
|
||||
}
|
||||
for (int i = 0; i < m_List.Count; ++i)
|
||||
{
|
||||
if (i % 11 == 0)
|
||||
{
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(300, 370, 4005, 4007, 0, GumpButtonType.Page, i / 11 + 1);
|
||||
AddHtmlLocalized(335, 370, 300, 35, 1011066, false, false); // Next page
|
||||
}
|
||||
|
||||
AddPage( (i / 11) + 1 );
|
||||
AddPage(i / 11 + 1);
|
||||
|
||||
if ( i != 0 )
|
||||
{
|
||||
AddButton( 20, 370, 4014, 4016, 0, GumpButtonType.Page, (i / 11) );
|
||||
AddHtmlLocalized( 55, 370, 300, 35, 1011067, false, false ); // Previous page
|
||||
}
|
||||
}
|
||||
if (i != 0)
|
||||
{
|
||||
AddButton(20, 370, 4014, 4016, 0, GumpButtonType.Page, i / 11);
|
||||
AddHtmlLocalized(55, 370, 300, 35, 1011067, false, false); // Previous page
|
||||
}
|
||||
}
|
||||
|
||||
if ( radio )
|
||||
AddRadio( 20, 35 + ((i % 11) * 30), 208, 209, false, i );
|
||||
if (radio)
|
||||
AddRadio(20, 35 + i % 11 * 30, 208, 209, false, i);
|
||||
|
||||
Mobile m = m_List[i];
|
||||
Mobile m = m_List[i];
|
||||
|
||||
string name;
|
||||
string name;
|
||||
|
||||
if ( (name = m.Name) != null && (name = name.Trim()).Length <= 0 )
|
||||
name = "(empty)";
|
||||
if ((name = m.Name) != null && (name = name.Trim()).Length <= 0)
|
||||
name = "(empty)";
|
||||
|
||||
AddLabel( (radio ? 55 : 20), 35 + ((i % 11) * 30), 0, name );
|
||||
}
|
||||
}
|
||||
AddLabel(radio ? 55 : 20, 35 + i % 11 * 30, 0, name);
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void Design()
|
||||
{
|
||||
}
|
||||
}
|
||||
protected virtual void Design()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,51 +3,51 @@ using Server.Prompts;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildNamePrompt : Prompt
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildNamePrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildNamePrompt( Mobile m, Guild g )
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
public GuildNamePrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
text = text.Trim();
|
||||
|
||||
if ( text.Length > 40 )
|
||||
text = text.Substring( 0, 40 );
|
||||
if (text.Length > 40)
|
||||
text = text.Substring(0, 40);
|
||||
|
||||
if ( text.Length > 0 )
|
||||
{
|
||||
if ( BaseGuild.FindByName( text ) != null )
|
||||
{
|
||||
m_Mobile.SendMessage( "{0} conflicts with the name of an existing guild.", text );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Name = text;
|
||||
m_Guild.GuildMessage( 1018024, true, text ); // The name of your guild has changed:
|
||||
}
|
||||
}
|
||||
if (text.Length > 0)
|
||||
{
|
||||
if (BaseGuild.FindByName(text) != null)
|
||||
{
|
||||
m_Mobile.SendMessage("{0} conflicts with the name of an existing guild.", text);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Guild.Name = text;
|
||||
m_Guild.GuildMessage(1018024, true, text); // The name of your guild has changed:
|
||||
}
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,60 +3,60 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildRejectWarGump : GuildListGump
|
||||
{
|
||||
public GuildRejectWarGump( Mobile from, Guild guild ) : base( from, guild, true, guild.WarInvitations )
|
||||
{
|
||||
}
|
||||
public class GuildRejectWarGump : GuildListGump
|
||||
{
|
||||
public GuildRejectWarGump(Mobile from, Guild guild) : base(from, guild, true, guild.WarInvitations)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1011148, false, false ); // Select the guild to reject their invitations:
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011148, false, false); // Select the guild to reject their invitations:
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 245, 30, 1011101, false, false ); // Reject war invitations.
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011101, false, false); // Reject war invitations.
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Guild g = (Guild)m_List[index];
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if ( g != null )
|
||||
{
|
||||
m_Guild.WarInvitations.Remove( g );
|
||||
g.WarDeclarations.Remove( m_Guild );
|
||||
if (g != null)
|
||||
{
|
||||
m_Guild.WarInvitations.Remove(g);
|
||||
g.WarDeclarations.Remove(m_Guild);
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if ( m_Guild.WarInvitations.Count > 0 )
|
||||
m_Mobile.SendGump( new GuildRejectWarGump( 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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Guild.WarInvitations.Count > 0)
|
||||
m_Mobile.SendGump(new GuildRejectWarGump(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,60 +3,60 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildRescindDeclarationGump : GuildListGump
|
||||
{
|
||||
public GuildRescindDeclarationGump( Mobile from, Guild guild ) : base( from, guild, true, guild.WarDeclarations )
|
||||
{
|
||||
}
|
||||
public class GuildRescindDeclarationGump : GuildListGump
|
||||
{
|
||||
public GuildRescindDeclarationGump(Mobile from, Guild guild) : base(from, guild, true, guild.WarDeclarations)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized( 20, 10, 400, 35, 1011150, false, false ); // Select the guild to rescind our invitations:
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtmlLocalized(20, 10, 400, 35, 1011150, false, false); // Select the guild to rescind our invitations:
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 245, 30, 1011102, false, false ); // Rescind your war declarations.
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 245, 30, 1011102, false, false); // Rescind your war declarations.
|
||||
|
||||
AddButton( 300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 400, 100, 35, 1011012, false, false ); // CANCEL
|
||||
}
|
||||
AddButton(300, 400, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 400, 100, 35, 1011012, false, false); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 (info.ButtonID == 1)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if ( switches.Length > 0 )
|
||||
{
|
||||
int index = switches[0];
|
||||
if (switches.Length > 0)
|
||||
{
|
||||
int index = switches[0];
|
||||
|
||||
if ( index >= 0 && index < m_List.Count )
|
||||
{
|
||||
Guild g = (Guild)m_List[index];
|
||||
if (index >= 0 && index < m_List.Count)
|
||||
{
|
||||
Guild g = m_List[index];
|
||||
|
||||
if ( g != null )
|
||||
{
|
||||
m_Guild.WarDeclarations.Remove( g );
|
||||
g.WarInvitations.Remove( m_Guild );
|
||||
if (g != null)
|
||||
{
|
||||
m_Guild.WarDeclarations.Remove(g);
|
||||
g.WarInvitations.Remove(m_Guild);
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
|
||||
if ( m_Guild.WarDeclarations.Count > 0 )
|
||||
m_Mobile.SendGump( new GuildRescindDeclarationGump( 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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (m_Guild.WarDeclarations.Count > 0)
|
||||
m_Mobile.SendGump(new GuildRescindDeclarationGump(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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +1,32 @@
|
|||
using System;
|
||||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildRosterGump : GuildMobileListGump
|
||||
{
|
||||
public GuildRosterGump( Mobile from, Guild guild ) : base( from, guild, false, guild.Members )
|
||||
{
|
||||
}
|
||||
public class GuildRosterGump : GuildMobileListGump
|
||||
{
|
||||
public GuildRosterGump(Mobile from, Guild guild) : base(from, guild, false, guild.Members)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtml( 20, 10, 500, 35, $"<center>{m_Guild.Name}</center>", false, false );
|
||||
protected override void Design()
|
||||
{
|
||||
AddHtml(20, 10, 500, 35, $"<center>{m_Guild.Name}</center>", false, false);
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 300, 35, 1011120, false, false ); // Return to the main menu.
|
||||
}
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 300, 35, 1011120, false, false); // Return to the main menu.
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,46 +3,46 @@ using Server.Prompts;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildTitlePrompt : Prompt
|
||||
{
|
||||
private Mobile m_Leader, m_Target;
|
||||
private Guild m_Guild;
|
||||
public class GuildTitlePrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Leader, m_Target;
|
||||
|
||||
public GuildTitlePrompt( Mobile leader, Mobile target, Guild g )
|
||||
{
|
||||
m_Leader = leader;
|
||||
m_Target = target;
|
||||
m_Guild = g;
|
||||
}
|
||||
public GuildTitlePrompt(Mobile leader, Mobile target, Guild g)
|
||||
{
|
||||
m_Leader = leader;
|
||||
m_Target = target;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Leader, m_Guild ) )
|
||||
return;
|
||||
if ( m_Target.Deleted || !m_Guild.IsMember( m_Target ) )
|
||||
return;
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Leader, m_Guild))
|
||||
return;
|
||||
if (m_Target.Deleted || !m_Guild.IsMember(m_Target))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed( m_Leader );
|
||||
m_Leader.SendGump( new GuildmasterGump( m_Leader, m_Guild ) );
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Leader);
|
||||
m_Leader.SendGump(new GuildmasterGump(m_Leader, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Leader, m_Guild ) )
|
||||
return;
|
||||
if ( m_Target.Deleted || !m_Guild.IsMember( m_Target ) )
|
||||
return;
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Leader, m_Guild))
|
||||
return;
|
||||
if (m_Target.Deleted || !m_Guild.IsMember(m_Target))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
text = text.Trim();
|
||||
|
||||
if ( text.Length > 20 )
|
||||
text = text.Substring( 0, 20 );
|
||||
if (text.Length > 20)
|
||||
text = text.Substring(0, 20);
|
||||
|
||||
if ( text.Length > 0 )
|
||||
m_Target.GuildTitle = text;
|
||||
if (text.Length > 0)
|
||||
m_Target.GuildTitle = text;
|
||||
|
||||
GuildGump.EnsureClosed( m_Leader );
|
||||
m_Leader.SendGump( new GuildmasterGump( m_Leader, m_Guild ) );
|
||||
}
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Leader);
|
||||
m_Leader.SendGump(new GuildmasterGump(m_Leader, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,116 +3,117 @@ using Server.Network;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildWarAdminGump : Gump
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildWarAdminGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildWarAdminGump( Mobile from, Guild guild ) : base( 20, 30 )
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
public GuildWarAdminGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Dragable = false;
|
||||
Dragable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 550, 440, 5054 );
|
||||
AddBackground( 10, 10, 530, 420, 3000 );
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
AddHtmlLocalized( 20, 10, 510, 35, 1011105, false, false ); // <center>WAR FUNCTIONS</center>
|
||||
AddHtmlLocalized(20, 10, 510, 35, 1011105, false, false); // <center>WAR FUNCTIONS</center>
|
||||
|
||||
AddButton( 20, 40, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 40, 400, 30, 1011099, false, false ); // Declare war through guild name search.
|
||||
AddButton(20, 40, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 40, 400, 30, 1011099, false, false); // Declare war through guild name search.
|
||||
|
||||
int count = 0;
|
||||
int count = 0;
|
||||
|
||||
if ( guild.Enemies.Count > 0 )
|
||||
{
|
||||
AddButton( 20, 160 + (count * 30), 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 160 + (count++ * 30), 400, 30, 1011103, false, false ); // Declare peace.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized( 20, 160 + (count++ * 30), 400, 30, 1013033, false, false ); // No current wars
|
||||
}
|
||||
if (guild.Enemies.Count > 0)
|
||||
{
|
||||
AddButton(20, 160 + count * 30, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011103, false, false); // Declare peace.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1013033, false, false); // No current wars
|
||||
}
|
||||
|
||||
if ( guild.WarInvitations.Count > 0 )
|
||||
{
|
||||
AddButton( 20, 160 + (count * 30), 4005, 4007, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 160 + (count++ * 30), 400, 30, 1011100, false, false ); // Accept war invitations.
|
||||
if (guild.WarInvitations.Count > 0)
|
||||
{
|
||||
AddButton(20, 160 + count * 30, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011100, false, false); // Accept war invitations.
|
||||
|
||||
AddButton( 20, 160 + (count * 30), 4005, 4007, 4, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 160 + (count++ * 30), 400, 30, 1011101, false, false ); // Reject war invitations.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized( 20, 160 + (count++ * 30), 400, 30, 1018012, false, false ); // No current invitations received for war.
|
||||
}
|
||||
AddButton(20, 160 + count * 30, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011101, false, false); // Reject war invitations.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1018012, false,
|
||||
false); // No current invitations received for war.
|
||||
}
|
||||
|
||||
if ( guild.WarDeclarations.Count > 0 )
|
||||
{
|
||||
AddButton( 20, 160 + (count * 30), 4005, 4007, 5, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 160 + (count++ * 30), 400, 30, 1011102, false, false ); // Rescind your war declarations.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized( 20, 160 + (count++ * 30), 400, 30, 1013055, false, false ); // No current war declarations
|
||||
}
|
||||
if (guild.WarDeclarations.Count > 0)
|
||||
{
|
||||
AddButton(20, 160 + count * 30, 4005, 4007, 5, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 160 + count++ * 30, 400, 30, 1011102, false, false); // Rescind your war declarations.
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 160 + count++ * 30, 400, 30, 1013055, false, false); // No current war declarations
|
||||
}
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 6, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 400, 35, 1011104, false, false ); // Return to the previous menu.
|
||||
}
|
||||
AddButton(20, 400, 4005, 4007, 6, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 400, 35, 1011104, false, false); // Return to the previous menu.
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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.SendLocalizedMessage( 1018001 ); // Declare war through search - Enter Guild Name:
|
||||
m_Mobile.Prompt = new GuildDeclareWarPrompt( m_Mobile, m_Guild );
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // Declare war
|
||||
{
|
||||
m_Mobile.SendLocalizedMessage(1018001); // Declare war through search - Enter Guild Name:
|
||||
m_Mobile.Prompt = new GuildDeclareWarPrompt(m_Mobile, m_Guild);
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Declare peace
|
||||
{
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildDeclarePeaceGump( m_Mobile, m_Guild ) );
|
||||
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 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 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 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;
|
||||
}
|
||||
case 6: // Return
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,113 +1,101 @@
|
|||
using System.Collections.Generic;
|
||||
using Server.Guilds;
|
||||
using Server.Network;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildWarGump : Gump
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildWarGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildWarGump( Mobile from, Guild guild ) : base( 20, 30 )
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
public GuildWarGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Dragable = false;
|
||||
Dragable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 550, 440, 5054 );
|
||||
AddBackground( 10, 10, 530, 420, 3000 );
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
AddHtmlLocalized( 20, 10, 500, 35, 1011133, false, false ); // <center>WARFARE STATUS</center>
|
||||
AddHtmlLocalized(20, 10, 500, 35, 1011133, false, false); // <center>WARFARE STATUS</center>
|
||||
|
||||
AddButton( 20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 400, 300, 35, 1011120, false, false ); // Return to the main menu.
|
||||
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 400, 300, 35, 1011120, false, false); // Return to the main menu.
|
||||
|
||||
AddPage( 1 );
|
||||
AddPage(1);
|
||||
|
||||
AddButton( 375, 375, 5224, 5224, 0, GumpButtonType.Page, 2 );
|
||||
AddHtmlLocalized( 410, 373, 100, 25, 1011066, false, false ); // Next page
|
||||
AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 2);
|
||||
AddHtmlLocalized(410, 373, 100, 25, 1011066, false, false); // Next page
|
||||
|
||||
AddHtmlLocalized( 20, 45, 400, 20, 1011134, false, false ); // We are at war with:
|
||||
AddHtmlLocalized(20, 45, 400, 20, 1011134, false, false); // We are at war with:
|
||||
|
||||
List<Guild> enemies = guild.Enemies;
|
||||
List<Guild> enemies = guild.Enemies;
|
||||
|
||||
if ( enemies.Count == 0 )
|
||||
{
|
||||
AddHtmlLocalized( 20, 65, 400, 20, 1013033, false, false ); // No current wars
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < enemies.Count; ++i )
|
||||
{
|
||||
Guild g = enemies[i];
|
||||
if (enemies.Count == 0)
|
||||
AddHtmlLocalized(20, 65, 400, 20, 1013033, false, false); // No current wars
|
||||
else
|
||||
for (int i = 0; i < enemies.Count; ++i)
|
||||
{
|
||||
Guild g = enemies[i];
|
||||
|
||||
AddHtml( 20, 65 + (i * 20), 300, 20, g.Name, false, false );
|
||||
}
|
||||
}
|
||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name, false, false);
|
||||
}
|
||||
|
||||
AddPage( 2 );
|
||||
AddPage(2);
|
||||
|
||||
AddButton( 375, 375, 5224, 5224, 0, GumpButtonType.Page, 3 );
|
||||
AddHtmlLocalized( 410, 373, 100, 25, 1011066, false, false ); // Next page
|
||||
AddButton(375, 375, 5224, 5224, 0, GumpButtonType.Page, 3);
|
||||
AddHtmlLocalized(410, 373, 100, 25, 1011066, false, false); // Next page
|
||||
|
||||
AddButton( 30, 375, 5223, 5223, 0, GumpButtonType.Page, 1 );
|
||||
AddHtmlLocalized( 65, 373, 150, 25, 1011067, false, false ); // Previous page
|
||||
AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 1);
|
||||
AddHtmlLocalized(65, 373, 150, 25, 1011067, false, false); // Previous page
|
||||
|
||||
AddHtmlLocalized( 20, 45, 400, 20, 1011136, false, false ); // Guilds that we have declared war on:
|
||||
AddHtmlLocalized(20, 45, 400, 20, 1011136, false, false); // Guilds that we have declared war on:
|
||||
|
||||
List<Guild> declared = guild.WarDeclarations;
|
||||
List<Guild> declared = guild.WarDeclarations;
|
||||
|
||||
if ( declared.Count == 0 )
|
||||
{
|
||||
AddHtmlLocalized( 20, 65, 400, 20, 1018012, false, false ); // No current invitations received for war.
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < declared.Count; ++i )
|
||||
{
|
||||
Guild g = (Guild)declared[i];
|
||||
if (declared.Count == 0)
|
||||
AddHtmlLocalized(20, 65, 400, 20, 1018012, false, false); // No current invitations received for war.
|
||||
else
|
||||
for (int i = 0; i < declared.Count; ++i)
|
||||
{
|
||||
Guild g = declared[i];
|
||||
|
||||
AddHtml( 20, 65 + (i * 20), 300, 20, g.Name, false, false );
|
||||
}
|
||||
}
|
||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name, false, false);
|
||||
}
|
||||
|
||||
AddPage( 3 );
|
||||
AddPage(3);
|
||||
|
||||
AddButton( 30, 375, 5223, 5223, 0, GumpButtonType.Page, 2 );
|
||||
AddHtmlLocalized( 65, 373, 150, 25, 1011067, false, false ); // Previous page
|
||||
AddButton(30, 375, 5223, 5223, 0, GumpButtonType.Page, 2);
|
||||
AddHtmlLocalized(65, 373, 150, 25, 1011067, false, false); // Previous page
|
||||
|
||||
AddHtmlLocalized( 20, 45, 400, 20, 1011135, false, false ); // Guilds that have declared war on us:
|
||||
AddHtmlLocalized(20, 45, 400, 20, 1011135, false, false); // Guilds that have declared war on us:
|
||||
|
||||
List<Guild> invites = guild.WarInvitations;
|
||||
List<Guild> invites = guild.WarInvitations;
|
||||
|
||||
if ( invites.Count == 0 )
|
||||
{
|
||||
AddHtmlLocalized( 20, 65, 400, 20, 1013055, false, false ); // No current war declarations
|
||||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < invites.Count; ++i )
|
||||
{
|
||||
Guild g = invites[i];
|
||||
if (invites.Count == 0)
|
||||
AddHtmlLocalized(20, 65, 400, 20, 1013055, false, false); // No current war declarations
|
||||
else
|
||||
for (int i = 0; i < invites.Count; ++i)
|
||||
{
|
||||
Guild g = invites[i];
|
||||
|
||||
AddHtml( 20, 65 + (i * 20), 300, 20, g.Name, false, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
AddHtml(20, 65 + i * 20, 300, 20, g.Name, false, false);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if ( info.ButtonID == 1 )
|
||||
{
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (info.ButtonID == 1)
|
||||
{
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,41 +3,41 @@ using Server.Prompts;
|
|||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildWebsitePrompt : Prompt
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildWebsitePrompt : Prompt
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildWebsitePrompt( Mobile m, Guild g )
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
public GuildWebsitePrompt(Mobile m, Guild g)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if (GuildGump.BadLeader(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
text = text.Trim();
|
||||
text = text.Trim();
|
||||
|
||||
if ( text.Length > 50 )
|
||||
text = text.Substring( 0, 50 );
|
||||
if (text.Length > 50)
|
||||
text = text.Substring(0, 50);
|
||||
|
||||
if ( text.Length > 0 )
|
||||
m_Guild.Website = text;
|
||||
if (text.Length > 0)
|
||||
m_Guild.Website = text;
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,187 +1,189 @@
|
|||
using Server.Items;
|
||||
using Server.Guilds;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildmasterGump : Gump
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildmasterGump : Gump
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildmasterGump( Mobile from, Guild guild ) : base( 20, 30 )
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
public GuildmasterGump(Mobile from, Guild guild) : base(20, 30)
|
||||
{
|
||||
m_Mobile = from;
|
||||
m_Guild = guild;
|
||||
|
||||
Dragable = false;
|
||||
Dragable = false;
|
||||
|
||||
AddPage( 0 );
|
||||
AddBackground( 0, 0, 550, 400, 5054 );
|
||||
AddBackground( 10, 10, 530, 380, 3000 );
|
||||
AddPage(0);
|
||||
AddBackground(0, 0, 550, 400, 5054);
|
||||
AddBackground(10, 10, 530, 380, 3000);
|
||||
|
||||
AddHtmlLocalized( 20, 15, 510, 35, 1011121, false, false ); // <center>GUILDMASTER FUNCTIONS</center>
|
||||
AddHtmlLocalized(20, 15, 510, 35, 1011121, false, false); // <center>GUILDMASTER FUNCTIONS</center>
|
||||
|
||||
AddButton( 20, 40, 4005, 4007, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 40, 470, 30, 1011107, false, false ); // Set the guild name.
|
||||
AddButton(20, 40, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 40, 470, 30, 1011107, false, false); // Set the guild name.
|
||||
|
||||
AddButton( 20, 70, 4005, 4007, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 70, 470, 30, 1011109, false, false ); // Set the guild's abbreviation.
|
||||
AddButton(20, 70, 4005, 4007, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 70, 470, 30, 1011109, false, false); // Set the guild's abbreviation.
|
||||
|
||||
if ( Guild.OrderChaos )
|
||||
{
|
||||
AddButton( 20, 100, 4005, 4007, 4, GumpButtonType.Reply, 0 );
|
||||
if (Guild.OrderChaos)
|
||||
{
|
||||
AddButton(20, 100, 4005, 4007, 4, GumpButtonType.Reply, 0);
|
||||
|
||||
switch ( m_Guild.Type )
|
||||
{
|
||||
case GuildType.Regular:
|
||||
AddHtmlLocalized( 55, 100, 470, 30, 1013059, false, false ); // Change guild type: Currently Standard
|
||||
break;
|
||||
case GuildType.Order:
|
||||
AddHtmlLocalized( 55, 100, 470, 30, 1013057, false, false ); // Change guild type: Currently Order
|
||||
break;
|
||||
case GuildType.Chaos:
|
||||
AddHtmlLocalized( 55, 100, 470, 30, 1013058, false, false ); // Change guild type: Currently Chaos
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (m_Guild.Type)
|
||||
{
|
||||
case GuildType.Regular:
|
||||
AddHtmlLocalized(55, 100, 470, 30, 1013059, false, false); // Change guild type: Currently Standard
|
||||
break;
|
||||
case GuildType.Order:
|
||||
AddHtmlLocalized(55, 100, 470, 30, 1013057, false, false); // Change guild type: Currently Order
|
||||
break;
|
||||
case GuildType.Chaos:
|
||||
AddHtmlLocalized(55, 100, 470, 30, 1013058, false, false); // Change guild type: Currently Chaos
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddButton( 20, 130, 4005, 4007, 5, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 130, 470, 30, 1011112, false, false ); // Set the guild's charter.
|
||||
AddButton(20, 130, 4005, 4007, 5, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 130, 470, 30, 1011112, false, false); // Set the guild's charter.
|
||||
|
||||
AddButton( 20, 160, 4005, 4007, 6, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 160, 470, 30, 1011113, false, false ); // Dismiss a member.
|
||||
AddButton(20, 160, 4005, 4007, 6, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 160, 470, 30, 1011113, false, false); // Dismiss a member.
|
||||
|
||||
AddButton( 20, 190, 4005, 4007, 7, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 190, 470, 30, 1011114, false, false ); // Go to the WAR menu.
|
||||
AddButton(20, 190, 4005, 4007, 7, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 190, 470, 30, 1011114, false, false); // Go to the WAR menu.
|
||||
|
||||
if ( m_Guild.Candidates.Count > 0 )
|
||||
{
|
||||
AddButton( 20, 220, 4005, 4007, 8, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 220, 470, 30, 1013056, false, false ); // Administer the list of candidates
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage( 20, 220, 4020 );
|
||||
AddHtmlLocalized( 55, 220, 470, 30, 1013031, false, false ); // There are currently no candidates for membership.
|
||||
}
|
||||
if (m_Guild.Candidates.Count > 0)
|
||||
{
|
||||
AddButton(20, 220, 4005, 4007, 8, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 220, 470, 30, 1013056, false, false); // Administer the list of candidates
|
||||
}
|
||||
else
|
||||
{
|
||||
AddImage(20, 220, 4020);
|
||||
AddHtmlLocalized(55, 220, 470, 30, 1013031, false,
|
||||
false); // There are currently no candidates for membership.
|
||||
}
|
||||
|
||||
AddButton( 20, 250, 4005, 4007, 9, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 250, 470, 30, 1011117, false, false ); // Set the guildmaster's title.
|
||||
AddButton(20, 250, 4005, 4007, 9, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 250, 470, 30, 1011117, false, false); // Set the guildmaster's title.
|
||||
|
||||
AddButton( 20, 280, 4005, 4007, 10, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 280, 470, 30, 1011118, false, false ); // Grant a title to another member.
|
||||
AddButton(20, 280, 4005, 4007, 10, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 280, 470, 30, 1011118, false, false); // Grant a title to another member.
|
||||
|
||||
AddButton( 20, 310, 4005, 4007, 11, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 310, 470, 30, 1011119, false, false ); // Move this guildstone.
|
||||
AddButton(20, 310, 4005, 4007, 11, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 310, 470, 30, 1011119, false, false); // Move this guildstone.
|
||||
|
||||
AddButton( 20, 360, 4005, 4007, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 55, 360, 245, 30, 1011120, false, false ); // Return to the main menu.
|
||||
AddButton(20, 360, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 360, 245, 30, 1011120, false, false); // Return to the main menu.
|
||||
|
||||
AddButton( 300, 360, 4005, 4007, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 335, 360, 100, 30, 1011441, false, false ); // EXIT
|
||||
}
|
||||
AddButton(300, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(335, 360, 100, 30, 1011441, false, false); // EXIT
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState state, RelayInfo info )
|
||||
{
|
||||
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
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 ) );
|
||||
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 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 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;
|
||||
break;
|
||||
}
|
||||
case 4: // Change guild type
|
||||
{
|
||||
if (!Guild.OrderChaos)
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildChangeTypeGump( m_Mobile, m_Guild ) );
|
||||
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 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 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 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 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 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 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 );
|
||||
break;
|
||||
}
|
||||
case 11: // Move guildstone
|
||||
{
|
||||
if (m_Guild.Guildstone != null)
|
||||
{
|
||||
GuildTeleporter item = new GuildTeleporter(m_Guild.Guildstone);
|
||||
|
||||
m_Guild.Teleporter?.Delete();
|
||||
m_Guild.Teleporter?.Delete();
|
||||
|
||||
m_Mobile.SendLocalizedMessage( 501133 ); // Use the teleporting object placed in your backpack to move this guildstone.
|
||||
m_Mobile.SendLocalizedMessage(
|
||||
501133); // Use the teleporting object placed in your backpack to move this guildstone.
|
||||
|
||||
m_Mobile.AddToBackpack( item );
|
||||
m_Guild.Teleporter = item;
|
||||
}
|
||||
m_Mobile.AddToBackpack(item);
|
||||
m_Guild.Teleporter = item;
|
||||
}
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildmasterGump( m_Mobile, m_Guild ) );
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildmasterGump(m_Mobile, m_Guild));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,71 +1,69 @@
|
|||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public delegate void SearchSelectionCallback( GuildDisplayType display );
|
||||
public delegate void SearchSelectionCallback(GuildDisplayType display);
|
||||
|
||||
public class GuildAdvancedSearchGump : BaseGuildGump
|
||||
{
|
||||
private GuildDisplayType m_Display;
|
||||
private SearchSelectionCallback m_Callback;
|
||||
public class GuildAdvancedSearchGump : BaseGuildGump
|
||||
{
|
||||
private SearchSelectionCallback m_Callback;
|
||||
private GuildDisplayType m_Display;
|
||||
|
||||
public GuildAdvancedSearchGump( PlayerMobile pm, Guild g, GuildDisplayType display, SearchSelectionCallback callback ) : base( pm, g )
|
||||
{
|
||||
m_Callback = callback;
|
||||
m_Display = display;
|
||||
PopulateGump();
|
||||
}
|
||||
public GuildAdvancedSearchGump(PlayerMobile pm, Guild g, GuildDisplayType display, SearchSelectionCallback callback)
|
||||
: base(pm, g)
|
||||
{
|
||||
m_Callback = callback;
|
||||
m_Display = display;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
|
||||
AddHtmlLocalized( 431, 43, 110, 26, 1062978, 0xF, false, false ); // Diplomacy
|
||||
AddHtmlLocalized(431, 43, 110, 26, 1062978, 0xF, false, false); // Diplomacy
|
||||
|
||||
AddHtmlLocalized( 65, 80, 480, 26, 1063124, 0xF, true, false ); // <i>Advanced Search Options</i>
|
||||
AddHtmlLocalized(65, 80, 480, 26, 1063124, 0xF, true, false); // <i>Advanced Search Options</i>
|
||||
|
||||
AddHtmlLocalized( 65, 110, 480, 26, 1063136 + (int)m_Display, 0xF, false, false ); // Showing All Guilds/w/Relation/Waiting Relation
|
||||
AddHtmlLocalized(65, 110, 480, 26, 1063136 + (int)m_Display, 0xF, false,
|
||||
false); // Showing All Guilds/w/Relation/Waiting Relation
|
||||
|
||||
AddGroup( 1 );
|
||||
AddRadio( 75, 140, 0xD2, 0xD3, false, 2 );
|
||||
AddHtmlLocalized( 105, 140, 200, 26, 1063006, 0x0, false, false ); // Show Guilds with Relationship
|
||||
AddRadio( 75, 170, 0xD2, 0xD3, false, 1 );
|
||||
AddHtmlLocalized( 105, 170, 200, 26, 1063005, 0x0, false, false ); // Show Guilds Awaiting Action
|
||||
AddRadio( 75, 200, 0xD2, 0xD3, false, 0 );
|
||||
AddHtmlLocalized( 105, 200, 200, 26, 1063007, 0x0, false, false ); // Show All Guilds
|
||||
AddGroup(1);
|
||||
AddRadio(75, 140, 0xD2, 0xD3, false, 2);
|
||||
AddHtmlLocalized(105, 140, 200, 26, 1063006, 0x0, false, false); // Show Guilds with Relationship
|
||||
AddRadio(75, 170, 0xD2, 0xD3, false, 1);
|
||||
AddHtmlLocalized(105, 170, 200, 26, 1063005, 0x0, false, false); // Show Guilds Awaiting Action
|
||||
AddRadio(75, 200, 0xD2, 0xD3, false, 0);
|
||||
AddHtmlLocalized(105, 200, 200, 26, 1063007, 0x0, false, false); // Show All Guilds
|
||||
|
||||
AddBackground( 450, 370, 100, 26, 0x2486 );
|
||||
AddButton( 455, 375, 0x845, 0x846, 5, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 480, 373, 60, 26, 1006044, 0x0, false, false ); // OK
|
||||
AddBackground( 340, 370, 100, 26, 0x2486 );
|
||||
AddButton( 345, 375, 0x845, 0x846, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 370, 373, 60, 26, 1006045, 0x0, false, false ); // Cancel
|
||||
}
|
||||
AddBackground(450, 370, 100, 26, 0x2486);
|
||||
AddButton(455, 375, 0x845, 0x846, 5, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(480, 373, 60, 26, 1006044, 0x0, false, false); // OK
|
||||
AddBackground(340, 370, 100, 26, 0x2486);
|
||||
AddButton(345, 375, 0x845, 0x846, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(370, 373, 60, 26, 1006045, 0x0, false, false); // Cancel
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
base.OnResponse( sender, info );
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
GuildDisplayType display = m_Display;
|
||||
GuildDisplayType display = m_Display;
|
||||
|
||||
if ( info.ButtonID == 5 )
|
||||
{
|
||||
for( int i = 0; i < 3; i++ )
|
||||
{
|
||||
if ( info.IsSwitched( i ) )
|
||||
{
|
||||
display = (GuildDisplayType)i;
|
||||
m_Callback( display );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (info.ButtonID == 5)
|
||||
for (int i = 0; i < 3; i++)
|
||||
if (info.IsSwitched(i))
|
||||
{
|
||||
display = (GuildDisplayType)i;
|
||||
m_Callback(display);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,140 +1,140 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Misc;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public abstract class BaseGuildGump : Gump
|
||||
{
|
||||
protected Guild guild { get; }
|
||||
public abstract class BaseGuildGump : Gump
|
||||
{
|
||||
public BaseGuildGump(PlayerMobile pm, Guild g) : this(pm, g, 10, 10)
|
||||
{
|
||||
}
|
||||
|
||||
protected PlayerMobile player { get; }
|
||||
public BaseGuildGump(PlayerMobile pm, Guild g, int x, int y) : base(x, y)
|
||||
{
|
||||
guild = g;
|
||||
player = pm;
|
||||
|
||||
public BaseGuildGump( PlayerMobile pm, Guild g ) : this( pm, g, 10, 10 )
|
||||
{
|
||||
}
|
||||
pm.CloseGump(typeof(BaseGuildGump));
|
||||
}
|
||||
|
||||
public BaseGuildGump( PlayerMobile pm, Guild g, int x, int y ) : base( x, y )
|
||||
{
|
||||
guild = g;
|
||||
player = pm;
|
||||
protected Guild guild{ get; }
|
||||
|
||||
pm.CloseGump( typeof( BaseGuildGump ) );
|
||||
}
|
||||
protected PlayerMobile player{ get; }
|
||||
|
||||
//There's prolly a way to have all the vars set of inherited classes before something is called in the Ctor... but... I can't think of it right now, and I can't use Timer.DelayCall here :<
|
||||
//There's prolly a way to have all the vars set of inherited classes before something is called in the Ctor... but... I can't think of it right now, and I can't use Timer.DelayCall here :<
|
||||
|
||||
public virtual void PopulateGump()
|
||||
{
|
||||
AddPage( 0 );
|
||||
public virtual void PopulateGump()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground( 0, 0, 600, 440, 0x24AE );
|
||||
AddBackground( 66, 40, 150, 26, 0x2486 );
|
||||
AddButton( 71, 45, 0x845, 0x846, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 96, 43, 110, 26, 1063014, 0x0, false, false ); // My Guild
|
||||
AddBackground( 236, 40, 150, 26, 0x2486 );
|
||||
AddButton( 241, 45, 0x845, 0x846, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 266, 43, 110, 26, 1062974, 0x0, false, false ); // Guild Roster
|
||||
AddBackground( 401, 40, 150, 26, 0x2486 );
|
||||
AddButton( 406, 45, 0x845, 0x846, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 431, 43, 110, 26, 1062978, 0x0, false, false ); // Diplomacy
|
||||
AddPage( 1 );
|
||||
}
|
||||
AddBackground(0, 0, 600, 440, 0x24AE);
|
||||
AddBackground(66, 40, 150, 26, 0x2486);
|
||||
AddButton(71, 45, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(96, 43, 110, 26, 1063014, 0x0, false, false); // My Guild
|
||||
AddBackground(236, 40, 150, 26, 0x2486);
|
||||
AddButton(241, 45, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(266, 43, 110, 26, 1062974, 0x0, false, false); // Guild Roster
|
||||
AddBackground(401, 40, 150, 26, 0x2486);
|
||||
AddButton(406, 45, 0x845, 0x846, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(431, 43, 110, 26, 1062978, 0x0, false, false); // Diplomacy
|
||||
AddPage(1);
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( !IsMember( pm, guild ) )
|
||||
return;
|
||||
if (!IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
switch( info.ButtonID )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
pm.SendGump( new GuildInfoGump( pm, guild ) );
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
pm.SendGump( new GuildRosterGump( pm, guild ) );
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
pm.SendGump( new GuildDiplomacyGump( pm, guild ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
pm.SendGump(new GuildInfoGump(pm, guild));
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
pm.SendGump(new GuildRosterGump(pm, guild));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
pm.SendGump(new GuildDiplomacyGump(pm, guild));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsLeader( Mobile m, Guild g )
|
||||
{
|
||||
return !( m.Deleted || g.Disbanded || !( m is PlayerMobile ) || (m.AccessLevel < AccessLevel.GameMaster && g.Leader != m) );
|
||||
}
|
||||
public static bool IsLeader(Mobile m, Guild g)
|
||||
{
|
||||
return !(m.Deleted || g.Disbanded || !(m is PlayerMobile) ||
|
||||
m.AccessLevel < AccessLevel.GameMaster && g.Leader != m);
|
||||
}
|
||||
|
||||
public static bool IsMember( Mobile m, Guild g )
|
||||
{
|
||||
return !( m.Deleted || g.Disbanded || !( m is PlayerMobile ) || (m.AccessLevel < AccessLevel.GameMaster && !g.IsMember( m )) );
|
||||
}
|
||||
public static bool IsMember(Mobile m, Guild g)
|
||||
{
|
||||
return !(m.Deleted || g.Disbanded || !(m is PlayerMobile) ||
|
||||
m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m));
|
||||
}
|
||||
|
||||
public static bool CheckProfanity( string s )
|
||||
{
|
||||
return CheckProfanity( s, 50 );
|
||||
}
|
||||
public static bool CheckProfanity( string s, int maxLength )
|
||||
{
|
||||
//return NameVerification.Validate( s, 1, 50, true, true, false, int.MaxValue, ProfanityProtection.Exceptions, ProfanityProtection.Disallowed, ProfanityProtection.StartDisallowed ); //What am I doing wrong, this still allows chars like the <3 symbol... 3 AM. someone change this to use this
|
||||
public static bool CheckProfanity(string s)
|
||||
{
|
||||
return CheckProfanity(s, 50);
|
||||
}
|
||||
|
||||
//With testing on OSI, Guild stuff seems to follow a 'simpler' method of profanity protection
|
||||
if ( s.Length < 1 || s.Length > maxLength )
|
||||
return false;
|
||||
public static bool CheckProfanity(string s, int maxLength)
|
||||
{
|
||||
//return NameVerification.Validate( s, 1, 50, true, true, false, int.MaxValue, ProfanityProtection.Exceptions, ProfanityProtection.Disallowed, ProfanityProtection.StartDisallowed ); //What am I doing wrong, this still allows chars like the <3 symbol... 3 AM. someone change this to use this
|
||||
|
||||
char[] exceptions = ProfanityProtection.Exceptions;
|
||||
//With testing on OSI, Guild stuff seems to follow a 'simpler' method of profanity protection
|
||||
if (s.Length < 1 || s.Length > maxLength)
|
||||
return false;
|
||||
|
||||
s = s.ToLower();
|
||||
char[] exceptions = ProfanityProtection.Exceptions;
|
||||
|
||||
for ( int i = 0; i < s.Length; ++i )
|
||||
{
|
||||
char c = s[i];
|
||||
s = s.ToLower();
|
||||
|
||||
if ( (c < 'a' || c > 'z') && (c < '0' || c > '9'))
|
||||
{
|
||||
bool except = false;
|
||||
for (int i = 0; i < s.Length; ++i)
|
||||
{
|
||||
char c = s[i];
|
||||
|
||||
for( int j = 0; !except && j < exceptions.Length; j++ )
|
||||
if ( c == exceptions[j] )
|
||||
except = true;
|
||||
if ((c < 'a' || c > 'z') && (c < '0' || c > '9'))
|
||||
{
|
||||
bool except = false;
|
||||
|
||||
if ( !except )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (int j = 0; !except && j < exceptions.Length; j++)
|
||||
if (c == exceptions[j])
|
||||
except = true;
|
||||
|
||||
string[] disallowed = ProfanityProtection.Disallowed;
|
||||
if (!except)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for( int i = 0; i < disallowed.Length; i++ )
|
||||
{
|
||||
if ( s.IndexOf( disallowed[i] ) != -1 )
|
||||
return false;
|
||||
}
|
||||
string[] disallowed = ProfanityProtection.Disallowed;
|
||||
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < disallowed.Length; i++)
|
||||
if (s.IndexOf(disallowed[i]) != -1)
|
||||
return false;
|
||||
|
||||
public void AddHtmlText( int x, int y, int width, int height, TextDefinition text, bool back, bool scroll )
|
||||
{
|
||||
if ( text != null && text.Number > 0 )
|
||||
AddHtmlLocalized( x, y, width, height, text.Number, back, scroll );
|
||||
else if ( text?.String != null )
|
||||
AddHtml( x, y, width, height, text.String, back, scroll );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static string Color( string text, int color )
|
||||
{
|
||||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
}
|
||||
}
|
||||
public void AddHtmlText(int x, int y, int width, int height, TextDefinition text, bool back, bool scroll)
|
||||
{
|
||||
if (text != null && text.Number > 0)
|
||||
AddHtmlLocalized(x, y, width, height, text.Number, back, scroll);
|
||||
else if (text?.String != null)
|
||||
AddHtml(x, y, width, height, text.String, back, scroll);
|
||||
}
|
||||
|
||||
public static string Color(string text, int color)
|
||||
{
|
||||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,204 +1,209 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public abstract class BaseGuildListGump<T> : BaseGuildGump
|
||||
{
|
||||
List<T> m_List;
|
||||
IComparer<T> m_Comparer;
|
||||
InfoField<T>[] m_Fields;
|
||||
bool m_Ascending;
|
||||
string m_Filter;
|
||||
int m_StartNumber;
|
||||
public abstract class BaseGuildListGump<T> : BaseGuildGump
|
||||
{
|
||||
private const int itemsPerPage = 8;
|
||||
private bool m_Ascending;
|
||||
private IComparer<T> m_Comparer;
|
||||
private InfoField<T>[] m_Fields;
|
||||
private string m_Filter;
|
||||
private List<T> m_List;
|
||||
private int m_StartNumber;
|
||||
|
||||
private const int itemsPerPage = 8;
|
||||
public BaseGuildListGump(PlayerMobile pm, Guild g, List<T> list, IComparer<T> currentComparer, bool ascending,
|
||||
string filter, int startNumber, InfoField<T>[] fields)
|
||||
: base(pm, g)
|
||||
{
|
||||
m_Filter = filter.Trim();
|
||||
|
||||
public BaseGuildListGump( PlayerMobile pm, Guild g, List<T> list, IComparer<T> currentComparer, bool ascending, string filter, int startNumber, InfoField<T>[] fields )
|
||||
: base( pm, g )
|
||||
{
|
||||
m_Filter = filter.Trim();
|
||||
m_Comparer = currentComparer;
|
||||
m_Fields = fields;
|
||||
m_Ascending = ascending;
|
||||
m_StartNumber = startNumber;
|
||||
m_List = list;
|
||||
}
|
||||
|
||||
m_Comparer = currentComparer;
|
||||
m_Fields = fields;
|
||||
m_Ascending = ascending;
|
||||
m_StartNumber = startNumber;
|
||||
m_List = list;
|
||||
}
|
||||
public virtual bool WillFilter => m_Filter.Length >= 0;
|
||||
|
||||
public virtual bool WillFilter => (m_Filter.Length >= 0);
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
List<T> list = m_List;
|
||||
if (WillFilter)
|
||||
{
|
||||
m_List = new List<T>();
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
if (!IsFiltered(list[i], m_Filter))
|
||||
m_List.Add(list[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_List = new List<T>(list);
|
||||
}
|
||||
|
||||
List<T> list = m_List;
|
||||
if ( WillFilter )
|
||||
{
|
||||
m_List = new List<T>();
|
||||
for( int i = 0; i < list.Count; i++ )
|
||||
{
|
||||
if ( !IsFiltered( list[i], m_Filter ) )
|
||||
m_List.Add( list[i] );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_List = new List<T>( list );
|
||||
}
|
||||
|
||||
m_List.Sort( m_Comparer );
|
||||
m_StartNumber = Math.Max( Math.Min( m_StartNumber, m_List.Count - 1 ), 0 );
|
||||
m_List.Sort(m_Comparer);
|
||||
m_StartNumber = Math.Max(Math.Min(m_StartNumber, m_List.Count - 1), 0);
|
||||
|
||||
|
||||
AddBackground(130, 75, 385, 30, 0xBB8);
|
||||
AddTextEntry(135, 80, 375, 30, 0x481, 1, m_Filter);
|
||||
AddButton(520, 75, 0x867, 0x868, 5, GumpButtonType.Reply, 0); //Filter Button
|
||||
|
||||
AddBackground( 130, 75, 385, 30, 0xBB8 );
|
||||
AddTextEntry( 135, 80, 375, 30, 0x481, 1, m_Filter );
|
||||
AddButton( 520, 75, 0x867, 0x868, 5, GumpButtonType.Reply, 0 ); //Filter Button
|
||||
int width = 0;
|
||||
for (int i = 0; i < m_Fields.Length; i++)
|
||||
{
|
||||
InfoField<T> f = m_Fields[i];
|
||||
|
||||
int width = 0;
|
||||
for( int i = 0; i < m_Fields.Length; i++ )
|
||||
{
|
||||
InfoField<T> f = m_Fields[i];
|
||||
AddImageTiled(65 + width, 110, f.Width + 10, 26, 0xA40);
|
||||
AddImageTiled(67 + width, 112, f.Width + 6, 22, 0xBBC);
|
||||
AddHtmlText(70 + width, 113, f.Width, 20, f.Name, false, false);
|
||||
|
||||
AddImageTiled( 65 + width, 110, f.Width + 10, 26, 0xA40 );
|
||||
AddImageTiled( 67 + width, 112, f.Width + 6, 22, 0xBBC );
|
||||
AddHtmlText( 70 + width, 113, f.Width, 20, f.Name, false, false );
|
||||
bool isComparer = m_Fields[i].Comparer.GetType() == m_Comparer.GetType();
|
||||
|
||||
bool isComparer = ( m_Fields[i].Comparer.GetType() == m_Comparer.GetType() );
|
||||
int ButtonID = isComparer ? m_Ascending ? 0x983 : 0x985 : 0x2716;
|
||||
|
||||
int ButtonID = ( isComparer ) ? ( m_Ascending ? 0x983 : 0x985 ) : 0x2716;
|
||||
AddButton(59 + width + f.Width, 117, ButtonID, ButtonID + (isComparer ? 1 : 0), 100 + i,
|
||||
GumpButtonType.Reply, 0);
|
||||
|
||||
AddButton( 59 + width + f.Width, 117, ButtonID, ButtonID + (isComparer ? 1 : 0) , 100 + i, GumpButtonType.Reply, 0 );
|
||||
width += f.Width + 12;
|
||||
}
|
||||
|
||||
width += (f.Width + 12);
|
||||
}
|
||||
if (m_StartNumber <= 0)
|
||||
AddButton(65, 80, 0x15E3, 0x15E7, 0, GumpButtonType.Page, 0);
|
||||
else
|
||||
AddButton(65, 80, 0x15E3, 0x15E7, 6, GumpButtonType.Reply, 0); // Back
|
||||
|
||||
if ( m_StartNumber <= 0 )
|
||||
AddButton( 65, 80, 0x15E3, 0x15E7, 0, GumpButtonType.Page, 0 );
|
||||
else
|
||||
AddButton( 65, 80, 0x15E3, 0x15E7, 6, GumpButtonType.Reply, 0 ); // Back
|
||||
|
||||
if ( m_StartNumber + itemsPerPage > m_List.Count )
|
||||
AddButton( 95, 80, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 0 );
|
||||
else
|
||||
AddButton( 95, 80, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0 ); // Forward
|
||||
if (m_StartNumber + itemsPerPage > m_List.Count)
|
||||
AddButton(95, 80, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 0);
|
||||
else
|
||||
AddButton(95, 80, 0x15E1, 0x15E5, 7, GumpButtonType.Reply, 0); // Forward
|
||||
|
||||
|
||||
int itemNumber = 0;
|
||||
|
||||
int itemNumber = 0;
|
||||
if (m_Ascending)
|
||||
for (int i = m_StartNumber; i < m_StartNumber + itemsPerPage && i < m_List.Count; i++)
|
||||
DrawEntry(m_List[i], i, itemNumber++);
|
||||
else //descending, go from bottom of list to the top
|
||||
for (int i = m_List.Count - 1 - m_StartNumber;
|
||||
i >= 0 && i >= m_List.Count - itemsPerPage - m_StartNumber;
|
||||
i--)
|
||||
DrawEntry(m_List[i], i, itemNumber++);
|
||||
|
||||
if ( m_Ascending )
|
||||
for( int i = m_StartNumber; i < m_StartNumber + itemsPerPage && i < m_List.Count; i++ )
|
||||
DrawEntry( m_List[i], i, itemNumber++ );
|
||||
else //descending, go from bottom of list to the top
|
||||
for( int i = m_List.Count - 1 - m_StartNumber; i >= 0 && i >= (m_List.Count - itemsPerPage - m_StartNumber); i-- )
|
||||
DrawEntry( m_List[i], i, itemNumber++ );
|
||||
DrawEndingEntry(itemNumber);
|
||||
}
|
||||
|
||||
DrawEndingEntry( itemNumber );
|
||||
}
|
||||
public virtual void DrawEndingEntry(int itemNumber)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void DrawEndingEntry( int itemNumber )
|
||||
{
|
||||
}
|
||||
public virtual bool HasRelationship(T o)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public virtual bool HasRelationship( T o )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public virtual void DrawEntry(T o, int index, int itemNumber)
|
||||
{
|
||||
int width = 0;
|
||||
for (int j = 0; j < m_Fields.Length; j++)
|
||||
{
|
||||
InfoField<T> f = m_Fields[j];
|
||||
|
||||
public virtual void DrawEntry( T o, int index, int itemNumber )
|
||||
{
|
||||
int width = 0;
|
||||
for( int j = 0; j < m_Fields.Length; j++ )
|
||||
{
|
||||
InfoField<T> f = m_Fields[j];
|
||||
AddImageTiled(65 + width, 138 + itemNumber * 28, f.Width + 10, 26, 0xA40);
|
||||
AddImageTiled(67 + width, 140 + itemNumber * 28, f.Width + 6, 22, 0xBBC);
|
||||
AddHtmlText(70 + width, 141 + itemNumber * 28, f.Width, 20, GetValuesFor(o, m_Fields.Length)[j], false,
|
||||
false);
|
||||
|
||||
AddImageTiled( 65 + width, 138 + itemNumber * 28, f.Width + 10, 26, 0xA40 );
|
||||
AddImageTiled( 67 + width, 140 + itemNumber * 28, f.Width + 6, 22, 0xBBC );
|
||||
AddHtmlText( 70 + width, 141 + itemNumber * 28, f.Width, 20, GetValuesFor( o, m_Fields.Length )[j], false, false );
|
||||
width += f.Width + 12;
|
||||
}
|
||||
|
||||
width += (f.Width + 12);
|
||||
}
|
||||
if (HasRelationship(o))
|
||||
AddButton(40, 143 + itemNumber * 28, 0x8AF, 0x8AF, 200 + index, GumpButtonType.Reply, 0); //Info Button
|
||||
else
|
||||
AddButton(40, 143 + itemNumber * 28, 0x4B9, 0x4BA, 200 + index, GumpButtonType.Reply, 0); //Info Button
|
||||
}
|
||||
|
||||
if ( HasRelationship( o ) )
|
||||
AddButton( 40, 143 + itemNumber * 28, 0x8AF, 0x8AF, 200 + index, GumpButtonType.Reply, 0 ); //Info Button
|
||||
else
|
||||
AddButton( 40, 143 + itemNumber * 28, 0x4B9, 0x4BA, 200 + index, GumpButtonType.Reply, 0 ); //Info Button
|
||||
}
|
||||
protected abstract TextDefinition[] GetValuesFor(T o, int aryLength);
|
||||
protected abstract bool IsFiltered(T o, string filter);
|
||||
|
||||
protected abstract TextDefinition[] GetValuesFor( T o, int aryLength );
|
||||
protected abstract bool IsFiltered( T o, string filter );
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
base.OnResponse( sender, info );
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
int id = info.ButtonID;
|
||||
|
||||
int id = info.ButtonID;
|
||||
switch (id)
|
||||
{
|
||||
case 5: //Filter
|
||||
{
|
||||
TextRelay t = info.GetTextEntry(1);
|
||||
pm.SendGump(GetResentGump(player, guild, m_Comparer, m_Ascending, t == null ? "" : t.Text, 0));
|
||||
break;
|
||||
}
|
||||
case 6: //Back
|
||||
{
|
||||
pm.SendGump(
|
||||
GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber - itemsPerPage));
|
||||
break;
|
||||
}
|
||||
case 7: //Forward
|
||||
{
|
||||
pm.SendGump(
|
||||
GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber + itemsPerPage));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch( id )
|
||||
{
|
||||
case 5: //Filter
|
||||
{
|
||||
TextRelay t = info.GetTextEntry( 1 );
|
||||
pm.SendGump( GetResentGump( player, guild, m_Comparer, m_Ascending, ( t == null ) ? "" : t.Text, 0 ) );
|
||||
break;
|
||||
}
|
||||
case 6: //Back
|
||||
{
|
||||
pm.SendGump( GetResentGump( player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber - itemsPerPage ) );
|
||||
break;
|
||||
}
|
||||
case 7: //Forward
|
||||
{
|
||||
pm.SendGump( GetResentGump( player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber + itemsPerPage ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (id >= 100 && id < 100 + m_Fields.Length)
|
||||
{
|
||||
IComparer<T> comparer = m_Fields[id - 100].Comparer;
|
||||
|
||||
if ( id >= 100 && id < (100 + m_Fields.Length) )
|
||||
{
|
||||
IComparer<T> comparer = m_Fields[id-100].Comparer;
|
||||
if (m_Comparer.GetType() == comparer.GetType())
|
||||
m_Ascending = !m_Ascending;
|
||||
|
||||
if ( m_Comparer.GetType() == comparer.GetType() )
|
||||
m_Ascending = !m_Ascending;
|
||||
|
||||
pm.SendGump( GetResentGump( player, guild, comparer, m_Ascending, m_Filter, 0 ) );
|
||||
}
|
||||
else if ( id >= 200 && id < ( 200 + m_List.Count ) )
|
||||
{
|
||||
pm.SendGump( GetObjectInfoGump( player, guild, m_List[id - 200] ) );
|
||||
}
|
||||
}
|
||||
pm.SendGump(GetResentGump(player, guild, comparer, m_Ascending, m_Filter, 0));
|
||||
}
|
||||
else if (id >= 200 && id < 200 + m_List.Count)
|
||||
{
|
||||
pm.SendGump(GetObjectInfoGump(player, guild, m_List[id - 200]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public abstract Gump GetResentGump( PlayerMobile pm, Guild g, IComparer<T> comparer, bool ascending, string filter, int startNumber );
|
||||
public abstract Gump GetObjectInfoGump( PlayerMobile pm, Guild g, T o );
|
||||
public abstract Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<T> comparer, bool ascending, string filter,
|
||||
int startNumber);
|
||||
|
||||
public void ResendGump()
|
||||
{
|
||||
player.SendGump( GetResentGump( player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber ) );
|
||||
}
|
||||
}
|
||||
public struct InfoField<T>
|
||||
{
|
||||
public TextDefinition Name { get; }
|
||||
public abstract Gump GetObjectInfoGump(PlayerMobile pm, Guild g, T o);
|
||||
|
||||
public int Width { get; }
|
||||
public void ResendGump()
|
||||
{
|
||||
player.SendGump(GetResentGump(player, guild, m_Comparer, m_Ascending, m_Filter, m_StartNumber));
|
||||
}
|
||||
}
|
||||
|
||||
public IComparer<T> Comparer { get; }
|
||||
public struct InfoField<T>
|
||||
{
|
||||
public TextDefinition Name{ get; }
|
||||
|
||||
public InfoField( TextDefinition name, int width, IComparer<T> comparer )
|
||||
{
|
||||
Name = name;
|
||||
Width = width;
|
||||
Comparer = comparer;
|
||||
}
|
||||
}
|
||||
}
|
||||
public int Width{ get; }
|
||||
|
||||
public IComparer<T> Comparer{ get; }
|
||||
|
||||
public InfoField(TextDefinition name, int width, IComparer<T> comparer)
|
||||
{
|
||||
Name = name;
|
||||
Width = width;
|
||||
Comparer = comparer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,93 +1,113 @@
|
|||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class CreateGuildGump : Gump
|
||||
{
|
||||
public CreateGuildGump( PlayerMobile pm, string guildName = "Guild Name", string guildAbbrev = "") : base ( 10, 10 )
|
||||
{
|
||||
pm.CloseGump( typeof( CreateGuildGump ) );
|
||||
pm.CloseGump( typeof( BaseGuildGump ) );
|
||||
public class CreateGuildGump : Gump
|
||||
{
|
||||
public CreateGuildGump(PlayerMobile pm, string guildName = "Guild Name", string guildAbbrev = "") : base(10, 10)
|
||||
{
|
||||
pm.CloseGump(typeof(CreateGuildGump));
|
||||
pm.CloseGump(typeof(BaseGuildGump));
|
||||
|
||||
AddPage( 0 );
|
||||
AddPage(0);
|
||||
|
||||
AddBackground( 0, 0, 500, 300, 0x2422 );
|
||||
AddHtmlLocalized( 25, 20, 450, 25, 1062939, 0x0, true, false ); // <center>GUILD MENU</center>
|
||||
AddHtmlLocalized( 25, 60, 450, 60, 1062940, 0x0, false, false ); // As you are not a member of any guild, you can create your own by providing a unique guild name and paying the standard guild registration fee.
|
||||
AddHtmlLocalized( 25, 135, 120, 25, 1062941, 0x0, false, false ); // Registration Fee:
|
||||
AddLabel( 155, 135, 0x481, Guild.RegistrationFee.ToString() );
|
||||
AddHtmlLocalized( 25, 165, 120, 25, 1011140, 0x0, false, false ); // Enter Guild Name:
|
||||
AddBackground( 155, 160, 320, 26, 0xBB8 );
|
||||
AddTextEntry( 160, 163, 315, 21, 0x481, 5, guildName );
|
||||
AddHtmlLocalized( 25, 191, 120, 26, 1063035, 0x0, false, false ); // Abbreviation:
|
||||
AddBackground( 155, 186, 320, 26, 0xBB8 );
|
||||
AddTextEntry( 160, 189, 315, 21, 0x481, 6, guildAbbrev );
|
||||
AddButton( 415, 217, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 345, 217, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 );
|
||||
AddBackground(0, 0, 500, 300, 0x2422);
|
||||
AddHtmlLocalized(25, 20, 450, 25, 1062939, 0x0, true, false); // <center>GUILD MENU</center>
|
||||
AddHtmlLocalized(25, 60, 450, 60, 1062940, 0x0, false,
|
||||
false); // As you are not a member of any guild, you can create your own by providing a unique guild name and paying the standard guild registration fee.
|
||||
AddHtmlLocalized(25, 135, 120, 25, 1062941, 0x0, false, false); // Registration Fee:
|
||||
AddLabel(155, 135, 0x481, Guild.RegistrationFee.ToString());
|
||||
AddHtmlLocalized(25, 165, 120, 25, 1011140, 0x0, false, false); // Enter Guild Name:
|
||||
AddBackground(155, 160, 320, 26, 0xBB8);
|
||||
AddTextEntry(160, 163, 315, 21, 0x481, 5, guildName);
|
||||
AddHtmlLocalized(25, 191, 120, 26, 1063035, 0x0, false, false); // Abbreviation:
|
||||
AddBackground(155, 186, 320, 26, 0xBB8);
|
||||
AddTextEntry(160, 189, 315, 21, 0x481, 6, guildAbbrev);
|
||||
AddButton(415, 217, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(345, 217, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0);
|
||||
|
||||
if ( pm.AcceptGuildInvites )
|
||||
AddButton( 20, 260, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0 );
|
||||
else
|
||||
AddButton( 20, 260, 0xD3, 0xD2, 2, GumpButtonType.Reply, 0 );
|
||||
if (pm.AcceptGuildInvites)
|
||||
AddButton(20, 260, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0);
|
||||
else
|
||||
AddButton(20, 260, 0xD3, 0xD2, 2, GumpButtonType.Reply, 0);
|
||||
|
||||
AddHtmlLocalized( 45, 260, 200, 30, 1062943, 0x0, false, false ); // <i>Ignore Guild Invites</i>
|
||||
}
|
||||
AddHtmlLocalized(45, 260, 200, 30, 1062943, 0x0, false, false); // <i>Ignore Guild Invites</i>
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || pm.Guild != null )
|
||||
return; //Sanity
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (!(sender.Mobile is PlayerMobile pm) || pm.Guild != null)
|
||||
return; //Sanity
|
||||
|
||||
switch( info.ButtonID )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
TextRelay tName = info.GetTextEntry( 5 );
|
||||
TextRelay tAbbrev = info.GetTextEntry( 6 );
|
||||
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;
|
||||
string guildName = tName == null ? "" : tName.Text;
|
||||
string guildAbbrev = tAbbrev == null ? "" : tAbbrev.Text;
|
||||
|
||||
guildName = Utility.FixHtml( guildName.Trim() );
|
||||
guildAbbrev = Utility.FixHtml( guildAbbrev.Trim() );
|
||||
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 ( BaseGuild.FindByAbbrev( guildAbbrev ) != null || !BaseGuildGump.CheckProfanity( guildAbbrev ) )
|
||||
pm.SendLocalizedMessage( 501153 ); // That abbreviation is not available.
|
||||
else if ( BaseGuild.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 );
|
||||
}
|
||||
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 (BaseGuild.FindByAbbrev(guildAbbrev) != null || !BaseGuildGump.CheckProfanity(guildAbbrev))
|
||||
{
|
||||
pm.SendLocalizedMessage(501153); // That abbreviation is not available.
|
||||
}
|
||||
else if (BaseGuild.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;
|
||||
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.
|
||||
if (pm.AcceptGuildInvites)
|
||||
pm.SendLocalizedMessage(1070699); // You are now accepting guild invitations.
|
||||
else
|
||||
pm.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,287 +1,293 @@
|
|||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public enum GuildDisplayType
|
||||
{
|
||||
All,
|
||||
AwaitingAction,
|
||||
Relations
|
||||
}
|
||||
public enum GuildDisplayType
|
||||
{
|
||||
All,
|
||||
AwaitingAction,
|
||||
Relations
|
||||
}
|
||||
|
||||
public class GuildDiplomacyGump : BaseGuildListGump<Guild>
|
||||
{
|
||||
protected virtual bool AllowAdvancedSearch => true;
|
||||
public class GuildDiplomacyGump : BaseGuildListGump<Guild>
|
||||
{
|
||||
private GuildDisplayType m_Display;
|
||||
private TextDefinition m_LowerText;
|
||||
|
||||
#region Comparers
|
||||
private class NameComparer : IComparer<Guild>
|
||||
{
|
||||
public static readonly IComparer<Guild> Instance = new NameComparer();
|
||||
public GuildDiplomacyGump(PlayerMobile pm, Guild g)
|
||||
: this(pm, g, NameComparer.Instance, true, "", 0, GuildDisplayType.All,
|
||||
Utility.CastConvertList<BaseGuild, Guild>(new List<BaseGuild>(BaseGuild.List.Values)),
|
||||
1063136 + (int)GuildDisplayType.All)
|
||||
{
|
||||
}
|
||||
|
||||
public NameComparer()
|
||||
{
|
||||
}
|
||||
public GuildDiplomacyGump(PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter,
|
||||
int startNumber, GuildDisplayType display)
|
||||
: this(pm, g, currentComparer, ascending, filter, startNumber, display,
|
||||
Utility.CastConvertList<BaseGuild, Guild>(new List<BaseGuild>(BaseGuild.List.Values)),
|
||||
1063136 + (int)display)
|
||||
{
|
||||
}
|
||||
|
||||
public int Compare( Guild x, Guild y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
if ( x == null )
|
||||
return -1;
|
||||
if ( y == null )
|
||||
return 1;
|
||||
public GuildDiplomacyGump(PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter,
|
||||
int startNumber, List<Guild> list, TextDefinition lowerText)
|
||||
: this(pm, g, currentComparer, ascending, filter, startNumber, GuildDisplayType.All, list, lowerText)
|
||||
{
|
||||
}
|
||||
|
||||
return Insensitive.Compare( x.Name, y.Name );
|
||||
}
|
||||
}
|
||||
public GuildDiplomacyGump(PlayerMobile pm, Guild g, bool ascending, string filter, int startNumber, List<Guild> list,
|
||||
TextDefinition lowerText)
|
||||
: this(pm, g, NameComparer.Instance, ascending, filter, startNumber, GuildDisplayType.All, list, lowerText)
|
||||
{
|
||||
}
|
||||
|
||||
private class StatusComparer : IComparer<Guild>
|
||||
{
|
||||
private enum GuildCompareStatus
|
||||
{
|
||||
Peace,
|
||||
Ally,
|
||||
War
|
||||
}
|
||||
private Guild m_Guild;
|
||||
public StatusComparer( Guild g )
|
||||
{
|
||||
m_Guild = g;
|
||||
}
|
||||
public GuildDiplomacyGump(PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter,
|
||||
int startNumber, GuildDisplayType display, List<Guild> list, TextDefinition lowerText)
|
||||
: base(pm, g, list, currentComparer, ascending, filter, startNumber,
|
||||
new[]
|
||||
{
|
||||
new InfoField<Guild>(1062954, 280, NameComparer.Instance), //Guild Name
|
||||
new InfoField<Guild>(1062957, 50, AbbrevComparer.Instance), //Abbrev
|
||||
new InfoField<Guild>(1062958, 120, new StatusComparer(g)) //Guild Title
|
||||
})
|
||||
{
|
||||
m_Display = display;
|
||||
m_LowerText = lowerText;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public int Compare( Guild x, Guild y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
if ( x == null )
|
||||
return -1;
|
||||
if ( y == null )
|
||||
return 1;
|
||||
protected virtual bool AllowAdvancedSearch => true;
|
||||
|
||||
GuildCompareStatus aStatus = GuildCompareStatus.Peace;
|
||||
GuildCompareStatus bStatus = GuildCompareStatus.Peace;
|
||||
public override bool WillFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_Display == GuildDisplayType.All)
|
||||
return base.WillFilter;
|
||||
|
||||
if ( m_Guild.IsAlly( x ) )
|
||||
aStatus = GuildCompareStatus.Ally;
|
||||
else if ( m_Guild.IsWar( x ) )
|
||||
aStatus = GuildCompareStatus.War;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
|
||||
AddHtmlLocalized(431, 43, 110, 26, 1062978, 0xF, false, false); // Diplomacy
|
||||
}
|
||||
|
||||
protected override TextDefinition[] GetValuesFor(Guild g, int aryLength)
|
||||
{
|
||||
TextDefinition[] defs = new TextDefinition[aryLength];
|
||||
|
||||
defs[0] = g == guild ? Color(g.Name, 0x006600) : g.Name;
|
||||
defs[1] = g.Abbreviation;
|
||||
|
||||
defs[2] = 3000085; //Peace
|
||||
|
||||
|
||||
if ( m_Guild.IsAlly( y ) )
|
||||
bStatus = GuildCompareStatus.Ally;
|
||||
else if ( m_Guild.IsWar( y ) )
|
||||
bStatus = GuildCompareStatus.War;
|
||||
if (guild.IsAlly(g))
|
||||
{
|
||||
if (guild.Alliance.Leader == g)
|
||||
defs[2] = 1063237; // Alliance Leader
|
||||
else
|
||||
defs[2] = 1062964; // Ally
|
||||
}
|
||||
else if (guild.IsWar(g))
|
||||
{
|
||||
defs[2] = 3000086; // War
|
||||
}
|
||||
|
||||
return ((int)aStatus).CompareTo( (int)bStatus );
|
||||
}
|
||||
}
|
||||
private class AbbrevComparer : IComparer<Guild>
|
||||
{
|
||||
public static readonly IComparer<Guild> Instance = new AbbrevComparer();
|
||||
return defs;
|
||||
}
|
||||
|
||||
public AbbrevComparer()
|
||||
{
|
||||
}
|
||||
public override bool HasRelationship(Guild g)
|
||||
{
|
||||
if (g == guild)
|
||||
return false;
|
||||
|
||||
public int Compare( Guild x, Guild y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
if ( x == null )
|
||||
return -1;
|
||||
if ( y == null )
|
||||
return 1;
|
||||
if (guild.FindPendingWar(g) != null)
|
||||
return true;
|
||||
|
||||
return Insensitive.Compare( x.Abbreviation, y.Abbreviation );
|
||||
}
|
||||
}
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
|
||||
#endregion
|
||||
if (alliance != null)
|
||||
{
|
||||
Guild leader = alliance.Leader;
|
||||
|
||||
GuildDisplayType m_Display;
|
||||
TextDefinition m_LowerText;
|
||||
if (leader != null)
|
||||
{
|
||||
if (guild == leader && alliance.IsPendingMember(g) || g == leader && alliance.IsPendingMember(guild))
|
||||
return true;
|
||||
}
|
||||
else if (alliance.IsPendingMember(g))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public GuildDiplomacyGump( PlayerMobile pm, Guild g )
|
||||
: this( pm, g, NameComparer.Instance, true, "", 0, GuildDisplayType.All, Utility.CastConvertList<BaseGuild, Guild>( new List<BaseGuild>( BaseGuild.List.Values ) ), (1063136 + (int)GuildDisplayType.All) )
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public GuildDiplomacyGump( PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter, int startNumber, GuildDisplayType display )
|
||||
: this( pm, g, currentComparer, ascending, filter, startNumber, display, Utility.CastConvertList<BaseGuild, Guild>( new List<BaseGuild>( BaseGuild.List.Values ) ), (1063136 + (int)display) )
|
||||
{
|
||||
}
|
||||
public override void DrawEndingEntry(int itemNumber)
|
||||
{
|
||||
//AddHtmlLocalized( 66, 153 + itemNumber * 28, 280, 26, 1063136 + (int)m_Display, 0xF, false, false ); // Showing All Guilds/Awaiting Action/ w/Relation Ship
|
||||
//AddHtmlText( 66, 153 + itemNumber * 28, 280, 26, m_LowerText, false, false );
|
||||
|
||||
public GuildDiplomacyGump( PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter, int startNumber, List<Guild> list, TextDefinition lowerText )
|
||||
: this( pm, g, currentComparer, ascending, filter, startNumber, GuildDisplayType.All, list, lowerText )
|
||||
{
|
||||
}
|
||||
if (m_LowerText != null && m_LowerText.Number > 0)
|
||||
AddHtmlLocalized(66, 153 + itemNumber * 28, 280, 26, m_LowerText.Number, 0xF, false, false);
|
||||
else if (m_LowerText?.String != null)
|
||||
AddHtml(66, 153 + itemNumber * 28, 280, 26, Color(m_LowerText.String, 0x99), false, false);
|
||||
|
||||
public GuildDiplomacyGump( PlayerMobile pm, Guild g, bool ascending, string filter, int startNumber, List<Guild> list, TextDefinition lowerText )
|
||||
: this( pm, g, NameComparer.Instance, ascending, filter, startNumber, GuildDisplayType.All, list, lowerText )
|
||||
{
|
||||
}
|
||||
|
||||
public GuildDiplomacyGump( PlayerMobile pm, Guild g, IComparer<Guild> currentComparer, bool ascending, string filter, int startNumber, GuildDisplayType display, List<Guild> list, TextDefinition lowerText )
|
||||
: base( pm, g, list, currentComparer, ascending, filter, startNumber,
|
||||
new[]
|
||||
{
|
||||
new InfoField<Guild>( 1062954, 280, NameComparer.Instance ), //Guild Name
|
||||
new InfoField<Guild>( 1062957, 50, AbbrevComparer.Instance ), //Abbrev
|
||||
new InfoField<Guild>( 1062958, 120, new StatusComparer( g ) ) //Guild Title
|
||||
})
|
||||
{
|
||||
|
||||
m_Display = display;
|
||||
m_LowerText = lowerText;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
|
||||
AddHtmlLocalized( 431, 43, 110, 26, 1062978, 0xF, false, false ); // Diplomacy
|
||||
}
|
||||
|
||||
protected override TextDefinition[] GetValuesFor( Guild g, int aryLength )
|
||||
{
|
||||
TextDefinition[] defs = new TextDefinition[aryLength];
|
||||
|
||||
defs[0] = ( g == guild ) ? Color( g.Name, 0x006600 ) : g.Name;
|
||||
defs[1] = g.Abbreviation;
|
||||
|
||||
defs[2] = 3000085; //Peace
|
||||
if (AllowAdvancedSearch)
|
||||
{
|
||||
AddBackground(350, 148 + itemNumber * 28, 200, 26, 0x2486);
|
||||
AddButton(355, 153 + itemNumber * 28, 0x845, 0x846, 8, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(380, 151 + itemNumber * 28, 160, 26, 1063083, 0x0, false, false); // Advanced Search
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( guild.IsAlly( g ) )
|
||||
{
|
||||
if ( guild.Alliance.Leader == g )
|
||||
defs[2] = 1063237; // Alliance Leader
|
||||
else
|
||||
defs[2] = 1062964; // Ally
|
||||
}
|
||||
else if ( guild.IsWar( g ) )
|
||||
{
|
||||
defs[2] = 3000086; // War
|
||||
}
|
||||
protected override bool IsFiltered(Guild g, string filter)
|
||||
{
|
||||
if (g == null)
|
||||
return true;
|
||||
|
||||
return defs;
|
||||
}
|
||||
switch (m_Display)
|
||||
{
|
||||
case GuildDisplayType.Relations:
|
||||
{
|
||||
//if ( !( guild.IsWar( g ) || guild.IsAlly( g ) ) )
|
||||
|
||||
public override bool HasRelationship( Guild g )
|
||||
{
|
||||
if ( g == guild )
|
||||
return false;
|
||||
if (!(guild.FindActiveWar(g) != null || guild.IsAlly(g))
|
||||
) //As per OSI, only the guild leader wars show up under the sorting by relation
|
||||
return true;
|
||||
|
||||
if ( guild.FindPendingWar( g ) != null )
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
case GuildDisplayType.AwaitingAction:
|
||||
{
|
||||
return !HasRelationship(g);
|
||||
}
|
||||
}
|
||||
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
|
||||
if ( alliance != null )
|
||||
{
|
||||
Guild leader = alliance.Leader;
|
||||
|
||||
if ( leader != null )
|
||||
{
|
||||
if ( guild == leader && alliance.IsPendingMember( g ) || g == leader && alliance.IsPendingMember( guild ) )
|
||||
return true;
|
||||
}
|
||||
else if ( alliance.IsPendingMember( g ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void DrawEndingEntry( int itemNumber )
|
||||
{
|
||||
//AddHtmlLocalized( 66, 153 + itemNumber * 28, 280, 26, 1063136 + (int)m_Display, 0xF, false, false ); // Showing All Guilds/Awaiting Action/ w/Relation Ship
|
||||
//AddHtmlText( 66, 153 + itemNumber * 28, 280, 26, m_LowerText, false, false );
|
||||
|
||||
if ( m_LowerText != null && m_LowerText.Number > 0 )
|
||||
AddHtmlLocalized( 66, 153 + itemNumber * 28, 280, 26, m_LowerText.Number, 0xF, false, false );
|
||||
else if ( m_LowerText?.String != null )
|
||||
AddHtml( 66, 153 + itemNumber * 28, 280, 26, Color( m_LowerText.String, 0x99 ), false, false );
|
||||
|
||||
if ( AllowAdvancedSearch )
|
||||
{
|
||||
AddBackground( 350, 148 + itemNumber * 28, 200, 26, 0x2486 );
|
||||
AddButton( 355, 153 + itemNumber * 28, 0x845, 0x846, 8, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 380, 151 + itemNumber * 28, 160, 26, 1063083, 0x0, false, false ); // Advanced Search
|
||||
}
|
||||
}
|
||||
return !(Insensitive.Contains(g.Name, filter) || Insensitive.Contains(g.Abbreviation, filter));
|
||||
}
|
||||
|
||||
|
||||
protected override bool IsFiltered( Guild g, string filter )
|
||||
{
|
||||
if ( g == null )
|
||||
return true;
|
||||
public override Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<Guild> comparer, bool ascending,
|
||||
string filter, int startNumber)
|
||||
{
|
||||
return new GuildDiplomacyGump(pm, g, comparer, ascending, filter, startNumber, m_Display);
|
||||
}
|
||||
|
||||
switch( m_Display )
|
||||
{
|
||||
case GuildDisplayType.Relations:
|
||||
{
|
||||
//if ( !( guild.IsWar( g ) || guild.IsAlly( g ) ) )
|
||||
public override Gump GetObjectInfoGump(PlayerMobile pm, Guild g, Guild o)
|
||||
{
|
||||
if (guild == o)
|
||||
return new GuildInfoGump(pm, g);
|
||||
|
||||
if ( !( guild.FindActiveWar( g ) != null || guild.IsAlly( g ) ) ) //As per OSI, only the guild leader wars show up under the sorting by relation
|
||||
return true;
|
||||
return new OtherGuildInfo(pm, g, o);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
case GuildDisplayType.AwaitingAction:
|
||||
{
|
||||
return !HasRelationship( g );
|
||||
}
|
||||
}
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
return !( Insensitive.Contains( g.Name, filter ) || Insensitive.Contains( g.Abbreviation, filter ) );
|
||||
}
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
public override bool WillFilter
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Display == GuildDisplayType.All )
|
||||
return base.WillFilter;
|
||||
if (AllowAdvancedSearch && info.ButtonID == 8)
|
||||
pm.SendGump(new GuildAdvancedSearchGump(pm, guild, m_Display, AdvancedSearch_Callback));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public void AdvancedSearch_Callback(GuildDisplayType display)
|
||||
{
|
||||
m_Display = display;
|
||||
ResendGump();
|
||||
}
|
||||
|
||||
#region Comparers
|
||||
|
||||
private class NameComparer : IComparer<Guild>
|
||||
{
|
||||
public static readonly IComparer<Guild> Instance = new NameComparer();
|
||||
|
||||
public int Compare(Guild x, Guild y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
return Insensitive.Compare(x.Name, y.Name);
|
||||
}
|
||||
}
|
||||
|
||||
private class StatusComparer : IComparer<Guild>
|
||||
{
|
||||
private Guild m_Guild;
|
||||
|
||||
public StatusComparer(Guild g)
|
||||
{
|
||||
m_Guild = g;
|
||||
}
|
||||
|
||||
public int Compare(Guild x, Guild y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
GuildCompareStatus aStatus = GuildCompareStatus.Peace;
|
||||
GuildCompareStatus bStatus = GuildCompareStatus.Peace;
|
||||
|
||||
if (m_Guild.IsAlly(x))
|
||||
aStatus = GuildCompareStatus.Ally;
|
||||
else if (m_Guild.IsWar(x))
|
||||
aStatus = GuildCompareStatus.War;
|
||||
|
||||
|
||||
public override Gump GetResentGump( PlayerMobile pm, Guild g, IComparer<Guild> comparer, bool ascending, string filter, int startNumber )
|
||||
{
|
||||
return new GuildDiplomacyGump( pm, g, comparer, ascending, filter, startNumber, m_Display );
|
||||
}
|
||||
if (m_Guild.IsAlly(y))
|
||||
bStatus = GuildCompareStatus.Ally;
|
||||
else if (m_Guild.IsWar(y))
|
||||
bStatus = GuildCompareStatus.War;
|
||||
|
||||
public override Gump GetObjectInfoGump( PlayerMobile pm, Guild g, Guild o )
|
||||
{
|
||||
if ( guild == o )
|
||||
return new GuildInfoGump( pm, g );
|
||||
return ((int)aStatus).CompareTo((int)bStatus);
|
||||
}
|
||||
|
||||
return new OtherGuildInfo( pm, g, (Guild)o ) ;
|
||||
}
|
||||
private enum GuildCompareStatus
|
||||
{
|
||||
Peace,
|
||||
Ally,
|
||||
War
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
base.OnResponse( sender, info );
|
||||
private class AbbrevComparer : IComparer<Guild>
|
||||
{
|
||||
public static readonly IComparer<Guild> Instance = new AbbrevComparer();
|
||||
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
public int Compare(Guild x, Guild y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
if ( AllowAdvancedSearch && info.ButtonID == 8 )
|
||||
pm.SendGump( new GuildAdvancedSearchGump( pm, guild, m_Display, AdvancedSearch_Callback ));
|
||||
return Insensitive.Compare(x.Abbreviation, y.Abbreviation);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AdvancedSearch_Callback( GuildDisplayType display )
|
||||
{
|
||||
m_Display = display;
|
||||
ResendGump();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
@ -1,188 +1,196 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class GuildInfoGump : BaseGuildGump
|
||||
{
|
||||
private bool m_IsResigning;
|
||||
public class GuildInfoGump : BaseGuildGump
|
||||
{
|
||||
private bool m_IsResigning;
|
||||
|
||||
public GuildInfoGump( PlayerMobile pm, Guild g ) : this( pm, g, false )
|
||||
{
|
||||
}
|
||||
public GuildInfoGump( PlayerMobile pm, Guild g, bool isResigning ) : base( pm, g )
|
||||
{
|
||||
m_IsResigning = isResigning;
|
||||
PopulateGump();
|
||||
}
|
||||
public GuildInfoGump(PlayerMobile pm, Guild g) : this(pm, g, false)
|
||||
{
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
bool isLeader = IsLeader( player, guild );
|
||||
base.PopulateGump();
|
||||
public GuildInfoGump(PlayerMobile pm, Guild g, bool isResigning) : base(pm, g)
|
||||
{
|
||||
m_IsResigning = isResigning;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
AddHtmlLocalized( 96, 43, 110, 26, 1063014, 0xF, false, false ); // My Guild
|
||||
public override void PopulateGump()
|
||||
{
|
||||
bool isLeader = IsLeader(player, guild);
|
||||
base.PopulateGump();
|
||||
|
||||
AddImageTiled( 65, 80, 160, 26, 0xA40 );
|
||||
AddImageTiled( 67, 82, 156, 22, 0xBBC );
|
||||
AddHtmlLocalized( 70, 83, 150, 20, 1062954, 0x0, false, false ); // <i>Guild Name</i>
|
||||
AddHtml( 233, 84, 320, 26, guild.Name, false, false );
|
||||
AddHtmlLocalized(96, 43, 110, 26, 1063014, 0xF, false, false); // My Guild
|
||||
|
||||
AddImageTiled( 65, 114, 160, 26, 0xA40 );
|
||||
AddImageTiled( 67, 116, 156, 22, 0xBBC );
|
||||
AddHtmlLocalized( 70, 117, 150, 20, 1063025, 0x0, false, false ); // <i>Alliance</i>
|
||||
AddImageTiled(65, 80, 160, 26, 0xA40);
|
||||
AddImageTiled(67, 82, 156, 22, 0xBBC);
|
||||
AddHtmlLocalized(70, 83, 150, 20, 1062954, 0x0, false, false); // <i>Guild Name</i>
|
||||
AddHtml(233, 84, 320, 26, guild.Name, false, false);
|
||||
|
||||
if ( guild.Alliance != null && guild.Alliance.IsMember( guild ) )
|
||||
{
|
||||
AddHtml( 233, 118, 320, 26, guild.Alliance.Name, false, false );
|
||||
AddButton( 40, 120, 0x4B9, 0x4BA, 6, GumpButtonType.Reply, 0 ); //Alliance Roster
|
||||
}
|
||||
AddImageTiled(65, 114, 160, 26, 0xA40);
|
||||
AddImageTiled(67, 116, 156, 22, 0xBBC);
|
||||
AddHtmlLocalized(70, 117, 150, 20, 1063025, 0x0, false, false); // <i>Alliance</i>
|
||||
|
||||
if ( Guild.OrderChaos && isLeader )
|
||||
AddButton( 40, 154, 0x4B9, 0x4BA, 100, GumpButtonType.Reply, 0 ); // Guild Faction
|
||||
if (guild.Alliance != null && guild.Alliance.IsMember(guild))
|
||||
{
|
||||
AddHtml(233, 118, 320, 26, guild.Alliance.Name, false, false);
|
||||
AddButton(40, 120, 0x4B9, 0x4BA, 6, GumpButtonType.Reply, 0); //Alliance Roster
|
||||
}
|
||||
|
||||
AddImageTiled( 65, 148, 160, 26, 0xA40 );
|
||||
AddImageTiled( 67, 150, 156, 22, 0xBBC );
|
||||
AddHtmlLocalized( 70, 151, 150, 20, 1063084, 0x0, false, false ); // <i>Guild Faction</i>
|
||||
if (Guild.OrderChaos && isLeader)
|
||||
AddButton(40, 154, 0x4B9, 0x4BA, 100, GumpButtonType.Reply, 0); // Guild Faction
|
||||
|
||||
GuildType gt;
|
||||
Faction f;
|
||||
AddImageTiled(65, 148, 160, 26, 0xA40);
|
||||
AddImageTiled(67, 150, 156, 22, 0xBBC);
|
||||
AddHtmlLocalized(70, 151, 150, 20, 1063084, 0x0, false, false); // <i>Guild Faction</i>
|
||||
|
||||
if ( ( gt = guild.Type ) != GuildType.Regular )
|
||||
AddHtml( 233, 152, 320, 26, gt.ToString(), false, false );
|
||||
else if ( ( f = Faction.Find( guild.Leader ) ) != null )
|
||||
AddHtml( 233, 152, 320, 26, f.ToString(), false, false );
|
||||
GuildType gt;
|
||||
Faction f;
|
||||
|
||||
AddImageTiled( 65, 196, 480, 4, 0x238D );
|
||||
if ((gt = guild.Type) != GuildType.Regular)
|
||||
AddHtml(233, 152, 320, 26, gt.ToString(), false, false);
|
||||
else if ((f = Faction.Find(guild.Leader)) != null)
|
||||
AddHtml(233, 152, 320, 26, f.ToString(), false, false);
|
||||
|
||||
AddImageTiled(65, 196, 480, 4, 0x238D);
|
||||
|
||||
|
||||
string s = guild.Charter;
|
||||
if ( string.IsNullOrEmpty( s ) )
|
||||
s = "The guild leader has not yet set the guild charter.";
|
||||
string s = guild.Charter;
|
||||
if (string.IsNullOrEmpty(s))
|
||||
s = "The guild leader has not yet set the guild charter.";
|
||||
|
||||
AddHtml( 65, 216, 480, 80, s, true, true );
|
||||
if ( isLeader )
|
||||
AddButton( 40, 251, 0x4B9, 0x4BA, 4, GumpButtonType.Reply, 0 ); //Charter Edit button
|
||||
AddHtml(65, 216, 480, 80, s, true, true);
|
||||
if (isLeader)
|
||||
AddButton(40, 251, 0x4B9, 0x4BA, 4, GumpButtonType.Reply, 0); //Charter Edit button
|
||||
|
||||
s = guild.Website;
|
||||
if ( string.IsNullOrEmpty( s ) )
|
||||
s = "Guild website not yet set.";
|
||||
AddHtml( 65, 306, 480, 30, s, true, false );
|
||||
if ( isLeader )
|
||||
AddButton( 40, 313, 0x4B9, 0x4BA, 5, GumpButtonType.Reply, 0 ); //Website Edit button
|
||||
s = guild.Website;
|
||||
if (string.IsNullOrEmpty(s))
|
||||
s = "Guild website not yet set.";
|
||||
AddHtml(65, 306, 480, 30, s, true, false);
|
||||
if (isLeader)
|
||||
AddButton(40, 313, 0x4B9, 0x4BA, 5, GumpButtonType.Reply, 0); //Website Edit button
|
||||
|
||||
AddCheck( 65, 370, 0xD2, 0xD3, player.DisplayGuildTitle, 0 );
|
||||
AddHtmlLocalized( 95, 370, 150, 26, 1063085, 0x0, false, false ); // Show Guild Title
|
||||
AddBackground( 450, 370, 100, 26, 0x2486 );
|
||||
AddCheck(65, 370, 0xD2, 0xD3, player.DisplayGuildTitle, 0);
|
||||
AddHtmlLocalized(95, 370, 150, 26, 1063085, 0x0, false, false); // Show Guild Title
|
||||
AddBackground(450, 370, 100, 26, 0x2486);
|
||||
|
||||
AddButton( 455, 375, 0x845, 0x846, 7, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 480, 373, 60, 26, 3006115, (m_IsResigning) ? 0x5000 : 0, false, false ); // Resign
|
||||
}
|
||||
AddButton(455, 375, 0x845, 0x846, 7, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(480, 373, 60, 26, 3006115, m_IsResigning ? 0x5000 : 0, false, false); // Resign
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
base.OnResponse( sender, info );
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
if ( !IsMember( pm, guild ) )
|
||||
return;
|
||||
if (!IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
|
||||
pm.DisplayGuildTitle = info.IsSwitched( 0 );
|
||||
pm.DisplayGuildTitle = info.IsSwitched(0);
|
||||
|
||||
switch( info.ButtonID )
|
||||
{
|
||||
//1-3 handled by base.OnResponse
|
||||
case 4:
|
||||
{
|
||||
if ( IsLeader( pm, guild ) )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1013071 ); // Enter the new guild charter (50 characters max):
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
//1-3 handled by base.OnResponse
|
||||
case 4:
|
||||
{
|
||||
if (IsLeader(pm, guild))
|
||||
{
|
||||
pm.SendLocalizedMessage(1013071); // Enter the new guild charter (50 characters max):
|
||||
|
||||
pm.BeginPrompt( SetCharter_Callback, true ); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
if ( IsLeader( pm, guild ) )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1013072 ); // Enter the new website for the guild (50 characters max):
|
||||
pm.BeginPrompt( SetWebsite_Callback, true ); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
//Alliance Roster
|
||||
if ( guild.Alliance != null && guild.Alliance.IsMember( guild ) )
|
||||
pm.SendGump( new AllianceInfo.AllianceRosterGump( pm, guild, guild.Alliance ) );
|
||||
pm.BeginPrompt(SetCharter_Callback,
|
||||
true); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
//Resign
|
||||
if ( !m_IsResigning )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063332 ); // Are you sure you wish to resign from your guild?
|
||||
pm.SendGump( new GuildInfoGump( pm, guild, true ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.RemoveMember( pm, 1063411 ); // You resign from your guild.
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100: // Custom code to support Order/Chaos in the new guild system
|
||||
{
|
||||
// Guild Faction
|
||||
if ( Guild.OrderChaos && IsLeader( pm, guild ) )
|
||||
{
|
||||
pm.CloseGump( typeof( GuildChangeTypeGump ) );
|
||||
pm.SendGump( new GuildChangeTypeGump( pm, guild ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
if (IsLeader(pm, guild))
|
||||
{
|
||||
pm.SendLocalizedMessage(1013072); // Enter the new website for the guild (50 characters max):
|
||||
pm.BeginPrompt(SetWebsite_Callback,
|
||||
true); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
|
||||
}
|
||||
|
||||
public void SetCharter_Callback( Mobile from, string text )
|
||||
{
|
||||
if ( !IsLeader( from, guild ) )
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case 6:
|
||||
{
|
||||
//Alliance Roster
|
||||
if (guild.Alliance != null && guild.Alliance.IsMember(guild))
|
||||
pm.SendGump(new AllianceInfo.AllianceRosterGump(pm, guild, guild.Alliance));
|
||||
|
||||
string charter = Utility.FixHtml( text.Trim() );
|
||||
break;
|
||||
}
|
||||
case 7:
|
||||
{
|
||||
//Resign
|
||||
if (!m_IsResigning)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063332); // Are you sure you wish to resign from your guild?
|
||||
pm.SendGump(new GuildInfoGump(pm, guild, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.RemoveMember(pm, 1063411); // You resign from your guild.
|
||||
}
|
||||
|
||||
if ( charter.Length > 50 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1070774, "50" ); // Your guild charter cannot exceed ~1_val~ characters.
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.Charter = charter;
|
||||
from.SendLocalizedMessage( 1070775 ); // You submit a new guild charter.
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 100: // Custom code to support Order/Chaos in the new guild system
|
||||
{
|
||||
// Guild Faction
|
||||
if (Guild.OrderChaos && IsLeader(pm, guild))
|
||||
{
|
||||
pm.CloseGump(typeof(GuildChangeTypeGump));
|
||||
pm.SendGump(new GuildChangeTypeGump(pm, guild));
|
||||
}
|
||||
|
||||
public void SetWebsite_Callback( Mobile from, string text )
|
||||
{
|
||||
if ( !IsLeader( from, guild ) )
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string site = Utility.FixHtml( text.Trim() );
|
||||
public void SetCharter_Callback(Mobile from, string text)
|
||||
{
|
||||
if (!IsLeader(from, guild))
|
||||
return;
|
||||
|
||||
if ( site.Length > 50 )
|
||||
from.SendLocalizedMessage( 1070777, "50" ); // Your guild website cannot exceed ~1_val~ characters.
|
||||
else
|
||||
{
|
||||
guild.Website = site;
|
||||
from.SendLocalizedMessage( 1070778 ); // You submit a new guild website.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
string charter = Utility.FixHtml(text.Trim());
|
||||
|
||||
if (charter.Length > 50)
|
||||
{
|
||||
from.SendLocalizedMessage(1070774, "50"); // Your guild charter cannot exceed ~1_val~ characters.
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.Charter = charter;
|
||||
from.SendLocalizedMessage(1070775); // You submit a new guild charter.
|
||||
}
|
||||
}
|
||||
|
||||
public void SetWebsite_Callback(Mobile from, string text)
|
||||
{
|
||||
if (!IsLeader(from, guild))
|
||||
return;
|
||||
|
||||
string site = Utility.FixHtml(text.Trim());
|
||||
|
||||
if (site.Length > 50)
|
||||
{
|
||||
from.SendLocalizedMessage(1070777, "50"); // Your guild website cannot exceed ~1_val~ characters.
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.Website = site;
|
||||
from.SendLocalizedMessage(1070778); // You submit a new guild website.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,62 +1,65 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class GuildInvitationRequest : BaseGuildGump
|
||||
{
|
||||
PlayerMobile m_Inviter;
|
||||
public GuildInvitationRequest( PlayerMobile pm, Guild g, PlayerMobile inviter ) : base( pm, g )
|
||||
{
|
||||
m_Inviter = inviter;
|
||||
public class GuildInvitationRequest : BaseGuildGump
|
||||
{
|
||||
private PlayerMobile m_Inviter;
|
||||
|
||||
PopulateGump();
|
||||
}
|
||||
public GuildInvitationRequest(PlayerMobile pm, Guild g, PlayerMobile inviter) : base(pm, g)
|
||||
{
|
||||
m_Inviter = inviter;
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
AddPage( 0 );
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
AddBackground( 0, 0, 350, 170, 0x2422 );
|
||||
AddHtmlLocalized( 25, 20, 300, 45, 1062946, 0x0, true, false ); // <center>You have been invited to join a guild! (Warning: Accepting will make you attackable!)</center>
|
||||
AddHtml( 25, 75, 300, 25, $"<center>{guild.Name}</center>", true, false );
|
||||
AddButton( 265, 130, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
|
||||
AddButton( 195, 130, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 );
|
||||
AddButton( 20, 130, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 45, 130, 150, 30, 1062943, 0x0, false, false ); // <i>Ignore Guild Invites</i>
|
||||
}
|
||||
public override void PopulateGump()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 350, 170, 0x2422);
|
||||
AddHtmlLocalized(25, 20, 300, 45, 1062946, 0x0, true,
|
||||
false); // <center>You have been invited to join a guild! (Warning: Accepting will make you attackable!)</center>
|
||||
AddHtml(25, 75, 300, 25, $"<center>{guild.Name}</center>", true, false);
|
||||
AddButton(265, 130, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(195, 130, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0);
|
||||
AddButton(20, 130, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(45, 130, 150, 30, 1062943, 0x0, false, false); // <i>Ignore Guild Invites</i>
|
||||
}
|
||||
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( guild.Disbanded || player.Guild != null )
|
||||
return;
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (guild.Disbanded || player.Guild != null)
|
||||
return;
|
||||
|
||||
switch( info.ButtonID )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Inviter.SendLocalizedMessage( 1063250, $"{player.Name}\t{guild.Name}"); // ~1_val~ has declined your invitation to join ~2_val~.
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
guild.AddMember( player );
|
||||
player.SendLocalizedMessage( 1063056, guild.Name ); // You have joined ~1_val~.
|
||||
m_Inviter.SendLocalizedMessage( 1063249, $"{player.Name}\t{guild.Name}"); // ~1_val~ has accepted your invitation to join ~2_val~.
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Inviter.SendLocalizedMessage(1063250,
|
||||
$"{player.Name}\t{guild.Name}"); // ~1_val~ has declined your invitation to join ~2_val~.
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
guild.AddMember(player);
|
||||
player.SendLocalizedMessage(1063056, guild.Name); // You have joined ~1_val~.
|
||||
m_Inviter.SendLocalizedMessage(1063249,
|
||||
$"{player.Name}\t{guild.Name}"); // ~1_val~ has accepted your invitation to join ~2_val~.
|
||||
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
player.AcceptGuildInvites = false;
|
||||
player.SendLocalizedMessage( 1070698 ); // You are now ignoring guild invitations.
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
player.AcceptGuildInvites = false;
|
||||
player.SendLocalizedMessage(1070698); // You are now ignoring guild invitations.
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,220 +1,255 @@
|
|||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class GuildMemberInfoGump : BaseGuildGump
|
||||
{
|
||||
PlayerMobile m_Member;
|
||||
bool m_ToLeader, m_toKick;
|
||||
public class GuildMemberInfoGump : BaseGuildGump
|
||||
{
|
||||
private PlayerMobile m_Member;
|
||||
private bool m_ToLeader, m_toKick;
|
||||
|
||||
public GuildMemberInfoGump( PlayerMobile pm, Guild g, PlayerMobile member, bool toKick, bool toPromoteToLeader ) : base( pm, g, 10, 40 )
|
||||
{
|
||||
m_ToLeader = toPromoteToLeader;
|
||||
m_toKick = toKick;
|
||||
m_Member = member;
|
||||
PopulateGump();
|
||||
}
|
||||
public GuildMemberInfoGump(PlayerMobile pm, Guild g, PlayerMobile member, bool toKick, bool toPromoteToLeader) :
|
||||
base(pm, g, 10, 40)
|
||||
{
|
||||
m_ToLeader = toPromoteToLeader;
|
||||
m_toKick = toKick;
|
||||
m_Member = member;
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
AddPage( 0 );
|
||||
public override void PopulateGump()
|
||||
{
|
||||
AddPage(0);
|
||||
|
||||
AddBackground( 0, 0, 350, 255, 0x242C );
|
||||
AddHtmlLocalized( 20, 15, 310, 26, 1063018, 0x0, false, false ); // <div align=center><i>Guild Member Information</i></div>
|
||||
AddImageTiled( 20, 40, 310, 2, 0x2711 );
|
||||
AddBackground(0, 0, 350, 255, 0x242C);
|
||||
AddHtmlLocalized(20, 15, 310, 26, 1063018, 0x0, false,
|
||||
false); // <div align=center><i>Guild Member Information</i></div>
|
||||
AddImageTiled(20, 40, 310, 2, 0x2711);
|
||||
|
||||
AddHtmlLocalized( 20, 50, 150, 26, 1062955, 0x0, true, false ); // <i>Name</i>
|
||||
AddHtml( 180, 53, 150, 26, m_Member.Name, false, false );
|
||||
AddHtmlLocalized(20, 50, 150, 26, 1062955, 0x0, true, false); // <i>Name</i>
|
||||
AddHtml(180, 53, 150, 26, m_Member.Name, false, false);
|
||||
|
||||
AddHtmlLocalized( 20, 80, 150, 26, 1062956, 0x0, true, false ); // <i>Rank</i>
|
||||
AddHtmlLocalized( 180, 83, 150, 26, m_Member.GuildRank.Name, 0x0, false, false );
|
||||
AddHtmlLocalized(20, 80, 150, 26, 1062956, 0x0, true, false); // <i>Rank</i>
|
||||
AddHtmlLocalized(180, 83, 150, 26, m_Member.GuildRank.Name, 0x0, false, false);
|
||||
|
||||
AddHtmlLocalized( 20, 110, 150, 26, 1062953, 0x0, true, false ); // <i>Guild Title</i>
|
||||
AddHtml( 180, 113, 150, 26, m_Member.GuildTitle, false, false );
|
||||
AddImageTiled( 20, 142, 310, 2, 0x2711 );
|
||||
AddHtmlLocalized(20, 110, 150, 26, 1062953, 0x0, true, false); // <i>Guild Title</i>
|
||||
AddHtml(180, 113, 150, 26, m_Member.GuildTitle, false, false);
|
||||
AddImageTiled(20, 142, 310, 2, 0x2711);
|
||||
|
||||
AddBackground( 20, 150, 310, 26, 0x2486 );
|
||||
AddButton( 25, 155, 0x845, 0x846, 4, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, 153, 270, 26, (m_Member == player.GuildFealty && guild.Leader != m_Member) ? 1063082 : 1062996, 0x0, false, false ); // Clear/Cast Vote For This Member
|
||||
AddBackground(20, 150, 310, 26, 0x2486);
|
||||
AddButton(25, 155, 0x845, 0x846, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 153, 270, 26,
|
||||
m_Member == player.GuildFealty && guild.Leader != m_Member ? 1063082 : 1062996, 0x0, false,
|
||||
false); // Clear/Cast Vote For This Member
|
||||
|
||||
AddBackground( 20, 180, 150, 26, 0x2486 );
|
||||
AddButton( 25, 185, 0x845, 0x846, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, 183, 110, 26, 1062993, (m_ToLeader)? 0x990000 : 0, false, false ); // Promote
|
||||
AddBackground(20, 180, 150, 26, 0x2486);
|
||||
AddButton(25, 185, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 183, 110, 26, 1062993, m_ToLeader ? 0x990000 : 0, false, false); // Promote
|
||||
|
||||
AddBackground( 180, 180, 150, 26, 0x2486 );
|
||||
AddButton( 185, 185, 0x845, 0x846, 3, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 210, 183, 110, 26, 1062995, 0x0, false, false ); // Set Guild Title
|
||||
AddBackground(180, 180, 150, 26, 0x2486);
|
||||
AddButton(185, 185, 0x845, 0x846, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(210, 183, 110, 26, 1062995, 0x0, false, false); // Set Guild Title
|
||||
|
||||
AddBackground( 20, 210, 150, 26, 0x2486 );
|
||||
AddButton( 25, 215, 0x845, 0x846, 2, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 50, 213, 110, 26, 1062994, 0x0, false, false ); // Demote
|
||||
AddBackground(20, 210, 150, 26, 0x2486);
|
||||
AddButton(25, 215, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 213, 110, 26, 1062994, 0x0, false, false); // Demote
|
||||
|
||||
AddBackground( 180, 210, 150, 26, 0x2486 );
|
||||
AddButton( 185, 215, 0x845, 0x846, 5, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 210, 213, 110, 26, 1062997, (m_toKick)? 0x5000 : 0, false, false ); // Kick
|
||||
}
|
||||
AddBackground(180, 210, 150, 26, 0x2486);
|
||||
AddButton(185, 215, 0x845, 0x846, 5, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(210, 213, 110, 26, 1062997, m_toKick ? 0x5000 : 0, false, false); // Kick
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) )
|
||||
return;
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild) || !IsMember(m_Member, guild))
|
||||
return;
|
||||
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
RankDefinition targetRank = m_Member.GuildRank;
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
RankDefinition targetRank = m_Member.GuildRank;
|
||||
|
||||
switch( info.ButtonID )
|
||||
{
|
||||
case 1: //Promote
|
||||
{
|
||||
if ( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && ((playerRank.Rank -1 ) > targetRank.Rank || ( playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank )) )
|
||||
{
|
||||
targetRank = RankDefinition.Ranks[targetRank.Rank + 1];
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: //Promote
|
||||
{
|
||||
if (playerRank.GetFlag(RankFlags.CanPromoteDemote) &&
|
||||
(playerRank.Rank - 1 > targetRank.Rank ||
|
||||
playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank))
|
||||
{
|
||||
targetRank = RankDefinition.Ranks[targetRank.Rank + 1];
|
||||
|
||||
if ( targetRank == RankDefinition.Leader )
|
||||
{
|
||||
if ( m_ToLeader )
|
||||
{
|
||||
m_Member.GuildRank = targetRank;
|
||||
pm.SendLocalizedMessage( 1063156, m_Member.Name ); // The guild information for ~1_val~ has been updated.
|
||||
pm.SendLocalizedMessage( 1063156, pm.Name ); // The guild information for ~1_val~ has been updated.
|
||||
guild.Leader = m_Member;
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063144 ); // Are you sure you wish to make this member the new guild leader?
|
||||
pm.SendGump( new GuildMemberInfoGump( player, guild, m_Member, false, true ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Member.GuildRank = targetRank;
|
||||
pm.SendLocalizedMessage( 1063156, m_Member.Name ); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
else
|
||||
pm.SendLocalizedMessage( 1063143 ); // You don't have permission to promote this member.
|
||||
if (targetRank == RankDefinition.Leader)
|
||||
{
|
||||
if (m_ToLeader)
|
||||
{
|
||||
m_Member.GuildRank = targetRank;
|
||||
pm.SendLocalizedMessage(1063156,
|
||||
m_Member.Name); // The guild information for ~1_val~ has been updated.
|
||||
pm.SendLocalizedMessage(1063156,
|
||||
pm.Name); // The guild information for ~1_val~ has been updated.
|
||||
guild.Leader = m_Member;
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(
|
||||
1063144); // Are you sure you wish to make this member the new guild leader?
|
||||
pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, false, true));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Member.GuildRank = targetRank;
|
||||
pm.SendLocalizedMessage(1063156,
|
||||
m_Member.Name); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1063143); // You don't have permission to promote this member.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: //Demote
|
||||
{
|
||||
if ( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && playerRank.Rank > targetRank.Rank )
|
||||
{
|
||||
if ( targetRank == RankDefinition.Lowest )
|
||||
{
|
||||
if ( RankDefinition.Lowest.Name.Number == 1062963 )
|
||||
pm.SendLocalizedMessage( 1063333 ); // You can't demote a ronin.
|
||||
else
|
||||
pm.SendMessage( "You can't demote a {0}.", RankDefinition.Lowest.Name );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Member.GuildRank = RankDefinition.Ranks[targetRank.Rank - 1];
|
||||
pm.SendLocalizedMessage( 1063156, m_Member.Name ); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
else
|
||||
pm.SendLocalizedMessage( 1063146 ); // You don't have permission to demote this member.
|
||||
break;
|
||||
}
|
||||
case 2: //Demote
|
||||
{
|
||||
if (playerRank.GetFlag(RankFlags.CanPromoteDemote) && playerRank.Rank > targetRank.Rank)
|
||||
{
|
||||
if (targetRank == RankDefinition.Lowest)
|
||||
{
|
||||
if (RankDefinition.Lowest.Name.Number == 1062963)
|
||||
pm.SendLocalizedMessage(1063333); // You can't demote a ronin.
|
||||
else
|
||||
pm.SendMessage("You can't demote a {0}.", RankDefinition.Lowest.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Member.GuildRank = RankDefinition.Ranks[targetRank.Rank - 1];
|
||||
pm.SendLocalizedMessage(1063156,
|
||||
m_Member.Name); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1063146); // You don't have permission to demote this member.
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: //Set Guild title
|
||||
{
|
||||
if ( playerRank.GetFlag( RankFlags.CanSetGuildTitle ) && ( playerRank.Rank > targetRank.Rank || m_Member == player))
|
||||
{
|
||||
pm.SendLocalizedMessage( 1011128 ); // Enter the new title for this guild member or 'none' to remove a title:
|
||||
break;
|
||||
}
|
||||
case 3: //Set Guild title
|
||||
{
|
||||
if (playerRank.GetFlag(RankFlags.CanSetGuildTitle) &&
|
||||
(playerRank.Rank > targetRank.Rank || m_Member == player))
|
||||
{
|
||||
pm.SendLocalizedMessage(
|
||||
1011128); // Enter the new title for this guild member or 'none' to remove a title:
|
||||
|
||||
pm.BeginPrompt( SetTitle_Callback );
|
||||
}
|
||||
else 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.
|
||||
}
|
||||
pm.BeginPrompt(SetTitle_Callback);
|
||||
}
|
||||
else 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.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 4: //Vote
|
||||
{
|
||||
if ( m_Member == pm.GuildFealty && guild.Leader != m_Member )
|
||||
pm.SendLocalizedMessage( 1063158 ); // You have cleared your vote for guild leader.
|
||||
else if ( guild.CanVote( m_Member ) )//( playerRank.GetFlag( RankFlags.CanVote ) )
|
||||
{
|
||||
if ( m_Member == guild.Leader )
|
||||
pm.SendLocalizedMessage( 1063424 ); // You can't vote for the current guild leader.
|
||||
else if ( !guild.CanBeVotedFor( m_Member ) )
|
||||
pm.SendLocalizedMessage( 1063425 ); // You can't vote for an inactive guild member.
|
||||
else
|
||||
{
|
||||
pm.GuildFealty = m_Member;
|
||||
pm.SendLocalizedMessage( 1063159, m_Member.Name ); // You cast your vote for ~1_val~ for guild leader.
|
||||
}
|
||||
}
|
||||
else
|
||||
pm.SendLocalizedMessage( 1063149 ); // You don't have permission to vote.
|
||||
break;
|
||||
}
|
||||
case 4: //Vote
|
||||
{
|
||||
if (m_Member == pm.GuildFealty && guild.Leader != m_Member)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063158); // You have cleared your vote for guild leader.
|
||||
}
|
||||
else if (guild.CanVote(m_Member)) //( playerRank.GetFlag( RankFlags.CanVote ) )
|
||||
{
|
||||
if (m_Member == guild.Leader)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063424); // You can't vote for the current guild leader.
|
||||
}
|
||||
else if (!guild.CanBeVotedFor(m_Member))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063425); // You can't vote for an inactive guild member.
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.GuildFealty = m_Member;
|
||||
pm.SendLocalizedMessage(1063159,
|
||||
m_Member.Name); // You cast your vote for ~1_val~ for guild leader.
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1063149); // You don't have permission to vote.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 5: //Kick
|
||||
{
|
||||
if ( ( playerRank.GetFlag( RankFlags.RemovePlayers ) && playerRank.Rank > targetRank.Rank ) || ( playerRank.GetFlag( RankFlags.RemoveLowestRank ) && targetRank == RankDefinition.Lowest ) )
|
||||
{
|
||||
if ( m_toKick )
|
||||
{
|
||||
guild.RemoveMember( m_Member );
|
||||
pm.SendLocalizedMessage( 1063157 ); // The member has been removed from your guild.
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063152 ); // Are you sure you wish to kick this member from the guild?
|
||||
pm.SendGump( new GuildMemberInfoGump( player, guild, m_Member, true, false ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
pm.SendLocalizedMessage( 1063151 ); // You don't have permission to remove this member.
|
||||
break;
|
||||
}
|
||||
case 5: //Kick
|
||||
{
|
||||
if (playerRank.GetFlag(RankFlags.RemovePlayers) && playerRank.Rank > targetRank.Rank ||
|
||||
playerRank.GetFlag(RankFlags.RemoveLowestRank) && targetRank == RankDefinition.Lowest)
|
||||
{
|
||||
if (m_toKick)
|
||||
{
|
||||
guild.RemoveMember(m_Member);
|
||||
pm.SendLocalizedMessage(1063157); // The member has been removed from your guild.
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1063152); // Are you sure you wish to kick this member from the guild?
|
||||
pm.SendGump(new GuildMemberInfoGump(player, guild, m_Member, true, false));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1063151); // You don't have permission to remove this member.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetTitle_Callback( Mobile from, string text )
|
||||
{
|
||||
if (!(from is PlayerMobile pm) || m_Member == null )
|
||||
return;
|
||||
public void SetTitle_Callback(Mobile from, string text)
|
||||
{
|
||||
if (!(from is PlayerMobile pm) || m_Member == null)
|
||||
return;
|
||||
|
||||
if ( !(m_Member.Guild is Guild g) || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > m_Member.GuildRank.Rank || pm == m_Member)) )
|
||||
{
|
||||
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.
|
||||
if (!(m_Member.Guild is Guild g) || !IsMember(pm, g) ||
|
||||
!(pm.GuildRank.GetFlag(RankFlags.CanSetGuildTitle) &&
|
||||
(pm.GuildRank.Rank > m_Member.GuildRank.Rank || pm == m_Member)))
|
||||
{
|
||||
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;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
string title = Utility.FixHtml( text.Trim() );
|
||||
string title = Utility.FixHtml(text.Trim());
|
||||
|
||||
if ( title.Length > 20 )
|
||||
from.SendLocalizedMessage( 501178 ); // That title is too long.
|
||||
else if ( !CheckProfanity( title ) )
|
||||
from.SendLocalizedMessage( 501179 ); // That title is disallowed.
|
||||
else
|
||||
{
|
||||
if ( Insensitive.Equals( title, "none" ) )
|
||||
m_Member.GuildTitle = null;
|
||||
else
|
||||
m_Member.GuildTitle = title;
|
||||
if (title.Length > 20)
|
||||
{
|
||||
from.SendLocalizedMessage(501178); // That title is too long.
|
||||
}
|
||||
else if (!CheckProfanity(title))
|
||||
{
|
||||
from.SendLocalizedMessage(501179); // That title is disallowed.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Insensitive.Equals(title, "none"))
|
||||
m_Member.GuildTitle = null;
|
||||
else
|
||||
m_Member.GuildTitle = title;
|
||||
|
||||
pm.SendLocalizedMessage( 1063156, m_Member.Name ); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pm.SendLocalizedMessage(1063156, m_Member.Name); // The guild information for ~1_val~ has been updated.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,259 +1,257 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Factions;
|
||||
using System.Collections.Generic;
|
||||
using Server.Factions;
|
||||
using Server.Gumps;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class GuildRosterGump : BaseGuildListGump<PlayerMobile>
|
||||
{
|
||||
#region Comparers
|
||||
private class NameComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new NameComparer();
|
||||
public class GuildRosterGump : BaseGuildListGump<PlayerMobile>
|
||||
{
|
||||
private static InfoField<PlayerMobile>[] m_Fields =
|
||||
{
|
||||
new InfoField<PlayerMobile>(1062955, 130, NameComparer.Instance), //Name
|
||||
new InfoField<PlayerMobile>(1062956, 80, RankComparer.Instance), //Rank
|
||||
new InfoField<PlayerMobile>(1062952, 80, LastOnComparer.Instance), //Last On
|
||||
new InfoField<PlayerMobile>(1062953, 150, TitleComparer.Instance) //Guild Title
|
||||
};
|
||||
|
||||
public NameComparer()
|
||||
{
|
||||
}
|
||||
public GuildRosterGump(PlayerMobile pm, Guild g) : this(pm, g, LastOnComparer.Instance, false, "", 0)
|
||||
{
|
||||
}
|
||||
|
||||
public int Compare( PlayerMobile x, PlayerMobile y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
if ( x == null )
|
||||
return -1;
|
||||
if ( y == null )
|
||||
return 1;
|
||||
public GuildRosterGump(PlayerMobile pm, Guild g, IComparer<PlayerMobile> currentComparer, bool ascending,
|
||||
string filter, int startNumber)
|
||||
: base(pm, g, Utility.SafeConvertList<Mobile, PlayerMobile>(g.Members), currentComparer, ascending, filter,
|
||||
startNumber, m_Fields)
|
||||
{
|
||||
PopulateGump();
|
||||
}
|
||||
|
||||
return Insensitive.Compare( x.Name, y.Name );
|
||||
}
|
||||
}
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
|
||||
private class LastOnComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new LastOnComparer();
|
||||
AddHtmlLocalized(266, 43, 110, 26, 1062974, 0xF, false, false); // Guild Roster
|
||||
}
|
||||
|
||||
public LastOnComparer()
|
||||
{
|
||||
}
|
||||
public override void DrawEndingEntry(int itemNumber)
|
||||
{
|
||||
AddBackground(225, 148 + itemNumber * 28, 150, 26, 0x2486);
|
||||
AddButton(230, 153 + itemNumber * 28, 0x845, 0x846, 8, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(255, 151 + itemNumber * 28, 110, 26, 1062992, 0x0, false, false); // Invite Player
|
||||
}
|
||||
|
||||
public int Compare( PlayerMobile x, PlayerMobile y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
if ( x == null )
|
||||
return -1;
|
||||
if ( y == null )
|
||||
return 1;
|
||||
protected override TextDefinition[] GetValuesFor(PlayerMobile pm, int aryLength)
|
||||
{
|
||||
TextDefinition[] defs = new TextDefinition[aryLength];
|
||||
|
||||
NetState aState = x.NetState;
|
||||
NetState bState = y.NetState;
|
||||
string name = $"{pm.Name}{(player.GuildFealty == pm && player.GuildFealty != guild.Leader ? " *" : "")}";
|
||||
|
||||
if ( aState == null && bState == null )
|
||||
return x.LastOnline.CompareTo( y.LastOnline );
|
||||
if ( aState == null )
|
||||
return -1;
|
||||
if ( bState == null )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
private class TitleComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new TitleComparer();
|
||||
if (pm == player)
|
||||
name = Color(name, 0x006600);
|
||||
else if (pm.NetState != null)
|
||||
name = Color(name, 0x000066);
|
||||
|
||||
public TitleComparer()
|
||||
{
|
||||
}
|
||||
defs[0] = name;
|
||||
defs[1] = pm.GuildRank.Name;
|
||||
defs[2] = pm.NetState != null
|
||||
? new TextDefinition(1063015)
|
||||
: new TextDefinition(pm.LastOnline.ToString("yyyy-MM-dd"));
|
||||
defs[3] = pm.GuildTitle ?? "";
|
||||
|
||||
public int Compare( PlayerMobile x, PlayerMobile y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
if ( x == null )
|
||||
return -1;
|
||||
if ( y == null )
|
||||
return 1;
|
||||
return defs;
|
||||
}
|
||||
|
||||
return Insensitive.Compare( x.GuildTitle, y.GuildTitle );
|
||||
}
|
||||
}
|
||||
protected override bool IsFiltered(PlayerMobile pm, string filter)
|
||||
{
|
||||
if (pm == null)
|
||||
return true;
|
||||
|
||||
private class RankComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new RankComparer();
|
||||
return !Insensitive.Contains(pm.Name, filter);
|
||||
}
|
||||
|
||||
public RankComparer()
|
||||
{
|
||||
}
|
||||
public override Gump GetResentGump(PlayerMobile pm, Guild g, IComparer<PlayerMobile> comparer, bool ascending,
|
||||
string filter, int startNumber)
|
||||
{
|
||||
return new GuildRosterGump(pm, g, comparer, ascending, filter, startNumber);
|
||||
}
|
||||
|
||||
public int Compare( PlayerMobile x, PlayerMobile y )
|
||||
{
|
||||
if ( x == null && y == null )
|
||||
return 0;
|
||||
if ( x == null )
|
||||
return -1;
|
||||
if ( y == null )
|
||||
return 1;
|
||||
public override Gump GetObjectInfoGump(PlayerMobile pm, Guild g, PlayerMobile o)
|
||||
{
|
||||
return new GuildMemberInfoGump(pm, g, o, false, false);
|
||||
}
|
||||
|
||||
return x.GuildRank.Rank.CompareTo( y.GuildRank.Rank );
|
||||
}
|
||||
}
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
base.OnResponse(sender, info);
|
||||
|
||||
#endregion
|
||||
if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
private static InfoField<PlayerMobile>[] m_Fields =
|
||||
{
|
||||
new InfoField<PlayerMobile>( 1062955, 130, NameComparer.Instance ), //Name
|
||||
new InfoField<PlayerMobile>( 1062956, 80, RankComparer.Instance ), //Rank
|
||||
new InfoField<PlayerMobile>( 1062952, 80, LastOnComparer.Instance), //Last On
|
||||
new InfoField<PlayerMobile>( 1062953, 150, TitleComparer.Instance ) //Guild Title
|
||||
};
|
||||
if (info.ButtonID == 8)
|
||||
{
|
||||
if (pm.GuildRank.GetFlag(RankFlags.CanInvitePlayer))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063048); // Whom do you wish to invite into your guild?
|
||||
pm.BeginTarget(-1, false, TargetFlags.None, new TargetStateCallback(InvitePlayer_Callback), guild);
|
||||
}
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(503301); // You don't have permission to do that.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public GuildRosterGump( PlayerMobile pm, Guild g ) : this( pm, g, LastOnComparer.Instance, false, "", 0 )
|
||||
{
|
||||
}
|
||||
public void InvitePlayer_Callback(Mobile from, object targeted, object state)
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
PlayerMobile targ = targeted as PlayerMobile;
|
||||
|
||||
public GuildRosterGump( PlayerMobile pm, Guild g, IComparer<PlayerMobile> currentComparer, bool ascending, string filter, int startNumber )
|
||||
: base( pm, g, Utility.SafeConvertList<Mobile, PlayerMobile>( g.Members ), currentComparer, ascending, filter, startNumber, m_Fields )
|
||||
{
|
||||
PopulateGump();
|
||||
}
|
||||
Guild g = state as Guild;
|
||||
|
||||
public override void PopulateGump()
|
||||
{
|
||||
base.PopulateGump();
|
||||
PlayerState guildState = PlayerState.Find(g.Leader);
|
||||
PlayerState targetState = PlayerState.Find(targ);
|
||||
|
||||
AddHtmlLocalized( 266, 43, 110, 26, 1062974, 0xF, false, false ); // Guild Roster
|
||||
}
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
|
||||
public override void DrawEndingEntry( int itemNumber )
|
||||
{
|
||||
AddBackground( 225, 148 + itemNumber * 28, 150, 26, 0x2486 );
|
||||
AddButton( 230, 153 + itemNumber * 28, 0x845, 0x846, 8, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 255, 151 + itemNumber * 28, 110, 26, 1062992, 0x0, false, false ); // Invite Player
|
||||
}
|
||||
if (pm == null || !IsMember(pm, guild) || !pm.GuildRank.GetFlag(RankFlags.CanInvitePlayer))
|
||||
{
|
||||
pm.SendLocalizedMessage(503301); // You don't have permission to do that.
|
||||
}
|
||||
else if (targ == null)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063334); // That isn't a valid player.
|
||||
}
|
||||
else if (!targ.AcceptGuildInvites)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063049, targ.Name); // ~1_val~ is not accepting guild invitations.
|
||||
}
|
||||
else if (g.IsMember(targ))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063050, targ.Name); // ~1_val~ is already a member of your guild!
|
||||
}
|
||||
else if (targ.Guild != null)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063051, targ.Name); // ~1_val~ is already a member of a guild.
|
||||
}
|
||||
else if (targ.HasGump(typeof(BaseGuildGump)) || targ.HasGump(typeof(CreateGuildGump))
|
||||
) //TODO: Check message if CreateGuildGump Open
|
||||
{
|
||||
pm.SendLocalizedMessage(1063052, targ.Name); // ~1_val~ is currently considering another guild invitation.
|
||||
}
|
||||
|
||||
protected override TextDefinition[] GetValuesFor( PlayerMobile pm, int aryLength )
|
||||
{
|
||||
TextDefinition[] defs = new TextDefinition[aryLength];
|
||||
#region Factions
|
||||
|
||||
string name = $"{pm.Name}{((player.GuildFealty == pm && player.GuildFealty != guild.Leader) ? " *" : "")}";
|
||||
else if (targ.Young && guildFaction != null)
|
||||
{
|
||||
pm.SendLocalizedMessage(1070766); // You cannot invite a young player to your faction-aligned guild.
|
||||
}
|
||||
else if (guildFaction != targetFaction)
|
||||
{
|
||||
if (guildFaction == null)
|
||||
pm.SendLocalizedMessage(1013027); // That player cannot join a non-faction guild.
|
||||
else if (targetFaction == null)
|
||||
pm.SendLocalizedMessage(1013026); // That player must be in a faction before joining this guild.
|
||||
else
|
||||
pm.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
|
||||
pm.SendMessage("That person is quitting their faction and so you may not recruit them.");
|
||||
}
|
||||
|
||||
if ( pm == player )
|
||||
name = Color( name, 0x006600 );
|
||||
else if ( pm.NetState != null )
|
||||
name = Color( name, 0x000066 );
|
||||
#endregion
|
||||
|
||||
defs[0] = name;
|
||||
defs[1] = pm.GuildRank.Name;
|
||||
defs[2] = (pm.NetState != null) ? new TextDefinition( 1063015 ): new TextDefinition( pm.LastOnline.ToString( "yyyy-MM-dd" ) );
|
||||
defs[3] = pm.GuildTitle ?? "";
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage(1063053, targ.Name); // You invite ~1_val~ to join your guild.
|
||||
targ.SendGump(new GuildInvitationRequest(targ, guild, pm));
|
||||
}
|
||||
}
|
||||
|
||||
return defs;
|
||||
}
|
||||
#region Comparers
|
||||
|
||||
protected override bool IsFiltered( PlayerMobile pm, string filter )
|
||||
{
|
||||
if ( pm == null )
|
||||
return true;
|
||||
private class NameComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new NameComparer();
|
||||
|
||||
return !Insensitive.Contains( pm.Name, filter );
|
||||
}
|
||||
public int Compare(PlayerMobile x, PlayerMobile y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
public override Gump GetResentGump( PlayerMobile pm, Guild g, IComparer<PlayerMobile> comparer, bool ascending, string filter, int startNumber )
|
||||
{
|
||||
return new GuildRosterGump( pm, g, comparer, ascending, filter, startNumber );
|
||||
}
|
||||
return Insensitive.Compare(x.Name, y.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public override Gump GetObjectInfoGump( PlayerMobile pm, Guild g, PlayerMobile o )
|
||||
{
|
||||
return new GuildMemberInfoGump( pm, g, o, false, false ) ;
|
||||
}
|
||||
private class LastOnComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new LastOnComparer();
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
base.OnResponse( sender, info );
|
||||
public int Compare(PlayerMobile x, PlayerMobile y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
if ( !(sender.Mobile is PlayerMobile pm) || !IsMember( pm, guild ) )
|
||||
return;
|
||||
NetState aState = x.NetState;
|
||||
NetState bState = y.NetState;
|
||||
|
||||
if ( info.ButtonID == 8 )
|
||||
{
|
||||
if ( pm.GuildRank.GetFlag( RankFlags.CanInvitePlayer ) )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063048 ); // Whom do you wish to invite into your guild?
|
||||
pm.BeginTarget( -1, false, Targeting.TargetFlags.None, new TargetStateCallback( InvitePlayer_Callback ), guild );
|
||||
}
|
||||
else
|
||||
pm.SendLocalizedMessage( 503301 ); // You don't have permission to do that.
|
||||
}
|
||||
}
|
||||
if (aState == null && bState == null)
|
||||
return x.LastOnline.CompareTo(y.LastOnline);
|
||||
if (aState == null)
|
||||
return -1;
|
||||
if (bState == null)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public void InvitePlayer_Callback( Mobile from, object targeted, object state )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
PlayerMobile targ = targeted as PlayerMobile;
|
||||
private class TitleComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new TitleComparer();
|
||||
|
||||
Guild g = state as Guild;
|
||||
public int Compare(PlayerMobile x, PlayerMobile y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
PlayerState guildState = PlayerState.Find( g.Leader );
|
||||
PlayerState targetState = PlayerState.Find( targ );
|
||||
return Insensitive.Compare(x.GuildTitle, y.GuildTitle);
|
||||
}
|
||||
}
|
||||
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
private class RankComparer : IComparer<PlayerMobile>
|
||||
{
|
||||
public static readonly IComparer<PlayerMobile> Instance = new RankComparer();
|
||||
|
||||
if ( pm == null || !IsMember( pm, guild ) || !pm.GuildRank.GetFlag( RankFlags.CanInvitePlayer ) )
|
||||
{
|
||||
pm.SendLocalizedMessage( 503301 ); // You don't have permission to do that.
|
||||
}
|
||||
else if ( targ == null )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063334 ); // That isn't a valid player.
|
||||
}
|
||||
else if ( !targ.AcceptGuildInvites )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063049, targ.Name ); // ~1_val~ is not accepting guild invitations.
|
||||
}
|
||||
else if ( g.IsMember( targ ) )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063050, targ.Name ); // ~1_val~ is already a member of your guild!
|
||||
}
|
||||
else if ( targ.Guild != null )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063051, targ.Name ); // ~1_val~ is already a member of a guild.
|
||||
}
|
||||
else if ( targ.HasGump( typeof( BaseGuildGump ) ) || targ.HasGump( typeof( CreateGuildGump ) )) //TODO: Check message if CreateGuildGump Open
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063052, targ.Name ); // ~1_val~ is currently considering another guild invitation.
|
||||
}
|
||||
#region Factions
|
||||
else if ( targ.Young && guildFaction != null )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1070766 ); // You cannot invite a young player to your faction-aligned guild.
|
||||
}
|
||||
else if ( guildFaction != targetFaction )
|
||||
{
|
||||
if ( guildFaction == null )
|
||||
pm.SendLocalizedMessage( 1013027 ); // That player cannot join a non-faction guild.
|
||||
else if ( targetFaction == null )
|
||||
pm.SendLocalizedMessage( 1013026 ); // That player must be in a faction before joining this guild.
|
||||
else
|
||||
pm.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
|
||||
pm.SendMessage( "That person is quitting their faction and so you may not recruit them." );
|
||||
}
|
||||
#endregion
|
||||
else
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063053, targ.Name ); // You invite ~1_val~ to join your guild.
|
||||
targ.SendGump( new GuildInvitationRequest( targ, guild, pm ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
public int Compare(PlayerMobile x, PlayerMobile y)
|
||||
{
|
||||
if (x == null && y == null)
|
||||
return 0;
|
||||
if (x == null)
|
||||
return -1;
|
||||
if (y == null)
|
||||
return 1;
|
||||
|
||||
return x.GuildRank.Rank.CompareTo(y.GuildRank.Rank);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,129 +1,140 @@
|
|||
using System;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Guilds
|
||||
{
|
||||
public class WarDeclarationGump : BaseGuildGump
|
||||
{
|
||||
private Guild m_Other;
|
||||
public class WarDeclarationGump : BaseGuildGump
|
||||
{
|
||||
private Guild m_Other;
|
||||
|
||||
public WarDeclarationGump( PlayerMobile pm, Guild g, Guild otherGuild ) : base( pm, g )
|
||||
{
|
||||
m_Other = otherGuild;
|
||||
WarDeclaration war = g.FindPendingWar( otherGuild );
|
||||
public WarDeclarationGump(PlayerMobile pm, Guild g, Guild otherGuild) : base(pm, g)
|
||||
{
|
||||
m_Other = otherGuild;
|
||||
WarDeclaration war = g.FindPendingWar(otherGuild);
|
||||
|
||||
AddPage( 0 );
|
||||
AddPage(0);
|
||||
|
||||
AddBackground( 0, 0, 500, 340, 0x24AE );
|
||||
AddBackground( 65, 50, 370, 30, 0x2486 );
|
||||
AddHtmlLocalized( 75, 55, 370, 26, 1062979, 0x3C00, false, false ); // <div align=center><i>Declaration of War</i></div>
|
||||
AddImage( 410, 45, 0x232C );
|
||||
AddHtmlLocalized( 65, 95, 200, 20, 1063009, 0x14AF, false, false ); // <i>Duration of War</i>
|
||||
AddHtmlLocalized( 65, 120, 400, 20, 1063010, 0x0, false, false ); // Enter the number of hours the war will last.
|
||||
AddBackground( 65, 150, 40, 30, 0x2486 );
|
||||
AddTextEntry( 70, 154, 50, 30, 0x481, 10, (war != null) ? war.WarLength.Hours.ToString() : "0" );
|
||||
AddHtmlLocalized( 65, 195, 200, 20, 1063011, 0x14AF, false, false ); // <i>Victory Condition</i>
|
||||
AddHtmlLocalized( 65, 220, 400, 20, 1063012, 0x0, false, false ); // Enter the winning number of kills.
|
||||
AddBackground( 65, 250, 40, 30, 0x2486 );
|
||||
AddTextEntry( 70, 254, 50, 30, 0x481, 11, (war != null) ? war.MaxKills.ToString() : "0" );
|
||||
AddBackground( 190, 270, 130, 26, 0x2486 );
|
||||
AddButton( 195, 275, 0x845, 0x846, 0, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 220, 273, 90, 26, 1006045, 0x0, false, false ); // Cancel
|
||||
AddBackground( 330, 270, 130, 26, 0x2486 );
|
||||
AddButton( 335, 275, 0x845, 0x846, 1, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 360, 273, 90, 26, 1062989, 0x5000, false, false ); // Declare War!
|
||||
}
|
||||
AddBackground(0, 0, 500, 340, 0x24AE);
|
||||
AddBackground(65, 50, 370, 30, 0x2486);
|
||||
AddHtmlLocalized(75, 55, 370, 26, 1062979, 0x3C00, false,
|
||||
false); // <div align=center><i>Declaration of War</i></div>
|
||||
AddImage(410, 45, 0x232C);
|
||||
AddHtmlLocalized(65, 95, 200, 20, 1063009, 0x14AF, false, false); // <i>Duration of War</i>
|
||||
AddHtmlLocalized(65, 120, 400, 20, 1063010, 0x0, false, false); // Enter the number of hours the war will last.
|
||||
AddBackground(65, 150, 40, 30, 0x2486);
|
||||
AddTextEntry(70, 154, 50, 30, 0x481, 10, war != null ? war.WarLength.Hours.ToString() : "0");
|
||||
AddHtmlLocalized(65, 195, 200, 20, 1063011, 0x14AF, false, false); // <i>Victory Condition</i>
|
||||
AddHtmlLocalized(65, 220, 400, 20, 1063012, 0x0, false, false); // Enter the winning number of kills.
|
||||
AddBackground(65, 250, 40, 30, 0x2486);
|
||||
AddTextEntry(70, 254, 50, 30, 0x481, 11, war != null ? war.MaxKills.ToString() : "0");
|
||||
AddBackground(190, 270, 130, 26, 0x2486);
|
||||
AddButton(195, 275, 0x845, 0x846, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(220, 273, 90, 26, 1006045, 0x0, false, false); // Cancel
|
||||
AddBackground(330, 270, 130, 26, 0x2486);
|
||||
AddButton(335, 275, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(360, 273, 90, 26, 1062989, 0x5000, false, false); // Declare War!
|
||||
}
|
||||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
|
||||
PlayerMobile pm = sender.Mobile as PlayerMobile;
|
||||
if (!IsMember(pm, guild))
|
||||
return;
|
||||
|
||||
if ( !IsMember( pm, guild ) )
|
||||
return;
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
|
||||
RankDefinition playerRank = pm.GuildRank;
|
||||
switch (info.ButtonID)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
AllianceInfo otherAlliance = m_Other.Alliance;
|
||||
|
||||
switch( info.ButtonID )
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
AllianceInfo alliance = guild.Alliance;
|
||||
AllianceInfo otherAlliance = m_Other.Alliance;
|
||||
if (!playerRank.GetFlag(RankFlags.ControlWarStatus))
|
||||
{
|
||||
pm.SendLocalizedMessage(1063440); // You don't have permission to negotiate wars.
|
||||
}
|
||||
else if (alliance != null && alliance.Leader != guild)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
|
||||
pm.SendLocalizedMessage(1070707, alliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
|
||||
}
|
||||
else if (otherAlliance != null && otherAlliance.Leader != m_Other)
|
||||
{
|
||||
pm.SendLocalizedMessage(1063239,
|
||||
$"{m_Other.Name}\t{otherAlliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
|
||||
pm.SendLocalizedMessage(1070707,
|
||||
otherAlliance.Leader.Name); // You need to negotiate via ~1_val~ instead.
|
||||
}
|
||||
else
|
||||
{
|
||||
WarDeclaration activeWar = guild.FindActiveWar(m_Other);
|
||||
|
||||
if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars.
|
||||
}
|
||||
else if ( alliance != null && alliance.Leader != guild )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063239, $"{guild.Name}\t{alliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
|
||||
pm.SendLocalizedMessage( 1070707, alliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
|
||||
}
|
||||
else if ( otherAlliance != null && otherAlliance.Leader != m_Other )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1063239, $"{m_Other.Name}\t{otherAlliance.Name}"); // ~1_val~ is not the leader of the ~2_val~ alliance.
|
||||
pm.SendLocalizedMessage( 1070707, otherAlliance.Leader.Name ); // You need to negotiate via ~1_val~ instead.
|
||||
}
|
||||
else
|
||||
{
|
||||
WarDeclaration activeWar = guild.FindActiveWar( m_Other );
|
||||
if (activeWar == null)
|
||||
{
|
||||
WarDeclaration war = guild.FindPendingWar(m_Other);
|
||||
WarDeclaration otherWar = m_Other.FindPendingWar(guild);
|
||||
|
||||
if ( activeWar == null )
|
||||
{
|
||||
WarDeclaration war = guild.FindPendingWar( m_Other );
|
||||
WarDeclaration otherWar = m_Other.FindPendingWar( guild );
|
||||
//Note: OSI differs from what it says on website. unlimited war = 0 kills/ 0 hrs. Not > 999. (sidenote: they both cap at 65535, 7.5 years, but, still.)
|
||||
TextRelay tKills = info.GetTextEntry(11);
|
||||
TextRelay tWarLength = info.GetTextEntry(10);
|
||||
|
||||
//Note: OSI differs from what it says on website. unlimited war = 0 kills/ 0 hrs. Not > 999. (sidenote: they both cap at 65535, 7.5 years, but, still.)
|
||||
TextRelay tKills = info.GetTextEntry( 11 );
|
||||
TextRelay tWarLength = info.GetTextEntry( 10 );
|
||||
int maxKills = tKills == null
|
||||
? 0
|
||||
: Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(11).Text), 0xFFFF), 0);
|
||||
TimeSpan warLength = TimeSpan.FromHours(tWarLength == null
|
||||
? 0
|
||||
: Math.Max(Math.Min(Utility.ToInt32(info.GetTextEntry(10).Text), 0xFFFF), 0));
|
||||
|
||||
int maxKills = (tKills == null)? 0 : Math.Max( Math.Min( Utility.ToInt32( info.GetTextEntry( 11 ).Text ), 0xFFFF ), 0 );
|
||||
TimeSpan warLength = TimeSpan.FromHours( (tWarLength == null) ? 0 : Math.Max( Math.Min( Utility.ToInt32( info.GetTextEntry( 10 ).Text ), 0xFFFF ), 0 ) );
|
||||
if (war != null)
|
||||
{
|
||||
war.MaxKills = maxKills;
|
||||
war.WarLength = warLength;
|
||||
war.WarRequester = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.PendingWars.Add(new WarDeclaration(guild, m_Other, maxKills, warLength, true));
|
||||
}
|
||||
|
||||
if ( war != null )
|
||||
{
|
||||
war.MaxKills = maxKills;
|
||||
war.WarLength = warLength;
|
||||
war.WarRequester = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
guild.PendingWars.Add( new WarDeclaration( guild, m_Other, maxKills, warLength, true ) );
|
||||
}
|
||||
if (otherWar != null)
|
||||
{
|
||||
otherWar.MaxKills = maxKills;
|
||||
otherWar.WarLength = warLength;
|
||||
otherWar.WarRequester = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Other.PendingWars.Add(new WarDeclaration(m_Other, guild, maxKills, warLength, false));
|
||||
}
|
||||
|
||||
if ( otherWar != null )
|
||||
{
|
||||
otherWar.MaxKills = maxKills;
|
||||
otherWar.WarLength = warLength;
|
||||
otherWar.WarRequester = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Other.PendingWars.Add( new WarDeclaration( m_Other, guild, maxKills, warLength, false ) );
|
||||
}
|
||||
if (war != null)
|
||||
pm.SendLocalizedMessage(1070752); // The proposal has been updated.
|
||||
else
|
||||
m_Other.GuildMessage(1070781,
|
||||
guild.Alliance != null
|
||||
? guild.Alliance.Name
|
||||
: guild.Name); // ~1_val~ has proposed a war.
|
||||
|
||||
if ( war != null )
|
||||
{
|
||||
pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated.
|
||||
//m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal.
|
||||
}
|
||||
else
|
||||
m_Other.GuildMessage( 1070781, ((guild.Alliance != null ) ? guild.Alliance.Name : guild.Name ) ); // ~1_val~ has proposed a war.
|
||||
pm.SendLocalizedMessage(1070751,
|
||||
m_Other.Alliance != null
|
||||
? m_Other.Alliance.Name
|
||||
: m_Other.Name); // War proposal has been sent to ~1_val~.
|
||||
}
|
||||
}
|
||||
|
||||
pm.SendLocalizedMessage( 1070751, ((m_Other.Alliance != null ) ? m_Other.Alliance.Name : m_Other.Name ) ); // War proposal has been sent to ~1_val~.
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pm.SendGump( new OtherGuildInfo( pm, guild, m_Other ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pm.SendGump(new OtherGuildInfo(pm, guild, m_Other));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,91 +1,97 @@
|
|||
using Server.Factions;
|
||||
using Server.Guilds;
|
||||
using Server.Targeting;
|
||||
using Server.Factions;
|
||||
|
||||
namespace Server.Gumps
|
||||
{
|
||||
public class GuildRecruitTarget : Target
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Guild m_Guild;
|
||||
public class GuildRecruitTarget : Target
|
||||
{
|
||||
private Guild m_Guild;
|
||||
private Mobile m_Mobile;
|
||||
|
||||
public GuildRecruitTarget( Mobile m, Guild guild ) : base( 10, false, TargetFlags.None )
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = guild;
|
||||
}
|
||||
public GuildRecruitTarget(Mobile m, Guild guild) : base(10, false, TargetFlags.None)
|
||||
{
|
||||
m_Mobile = m;
|
||||
m_Guild = guild;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
if ( targeted is Mobile m )
|
||||
{
|
||||
PlayerState guildState = PlayerState.Find( m_Guild.Leader );
|
||||
PlayerState targetState = PlayerState.Find( m );
|
||||
if (targeted is Mobile m)
|
||||
{
|
||||
PlayerState guildState = PlayerState.Find(m_Guild.Leader);
|
||||
PlayerState targetState = PlayerState.Find(m);
|
||||
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = targetState?.Faction;
|
||||
Faction guildFaction = guildState?.Faction;
|
||||
Faction targetFaction = 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
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.
|
||||
}
|
||||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
if ( GuildGump.BadMember( m_Mobile, m_Guild ) )
|
||||
return;
|
||||
#region Factions
|
||||
|
||||
GuildGump.EnsureClosed( m_Mobile );
|
||||
m_Mobile.SendGump( new GuildGump( m_Mobile, m_Guild ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
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 OnTargetFinish(Mobile from)
|
||||
{
|
||||
if (GuildGump.BadMember(m_Mobile, m_Guild))
|
||||
return;
|
||||
|
||||
GuildGump.EnsureClosed(m_Mobile);
|
||||
m_Mobile.SendGump(new GuildGump(m_Mobile, m_Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue