Fixes casting checks

This commit is contained in:
Kamron Batman 2018-08-19 01:38:55 +08:00
parent 7ea00fbf4f
commit 03dd5f1926
431 changed files with 5616 additions and 6250 deletions

View file

@ -53,7 +53,7 @@ namespace Server.Gumps
{
m_Mobile.SendLocalizedMessage( 501183 ); // You are already at war with that guild.
}
else if( Faction.Find( m_Guild.Leader ) != null )
else if ( Faction.Find( m_Guild.Leader ) != null )
{
m_Mobile.SendLocalizedMessage( 1005288 ); // You cannot declare war while you are in a faction
}
@ -85,4 +85,4 @@ namespace Server.Gumps
}
}
}
}
}

View file

@ -53,16 +53,16 @@ namespace Server.Guilds
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || !IsMember( pm, guild ) )
if ( pm == null || !IsMember( pm, guild ) )
return;
GuildDisplayType display = m_Display;
if( info.ButtonID == 5 )
if ( info.ButtonID == 5 )
{
for( int i = 0; i < 3; i++ )
{
if( info.IsSwitched( i ) )
if ( info.IsSwitched( i ) )
{
display = (GuildDisplayType)i;
m_Callback( display );
@ -72,4 +72,4 @@ namespace Server.Guilds
}
}
}
}
}

View file

@ -24,7 +24,7 @@ namespace Server.Guilds
{
m_Guild = g;
m_Player = pm;
pm.CloseGump( typeof( BaseGuildGump ) );
}
@ -51,7 +51,7 @@ namespace Server.Guilds
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( !IsMember( pm, guild ) )
if ( !IsMember( pm, guild ) )
return;
switch( info.ButtonID )
@ -93,7 +93,7 @@ namespace Server.Guilds
//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
//With testing on OSI, Guild stuff seems to follow a 'simpler' method of profanity protection
if( s.Length < 1 || s.Length > maxLength )
if ( s.Length < 1 || s.Length > maxLength )
return false;
char[] exceptions = ProfanityProtection.Exceptions;
@ -109,10 +109,10 @@ namespace Server.Guilds
bool except = false;
for( int j = 0; !except && j < exceptions.Length; j++ )
if( c == exceptions[j] )
if ( c == exceptions[j] )
except = true;
if( !except )
if ( !except )
return false;
}
}
@ -125,7 +125,7 @@ namespace Server.Guilds
return false;
}
return true;
return true;
}
public void AddHtmlText( int x, int y, int width, int height, TextDefinition text, bool back, bool scroll )
@ -141,4 +141,4 @@ namespace Server.Guilds
return String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", color, text );
}
}
}
}

View file

@ -38,12 +38,12 @@ namespace Server.Guilds
base.PopulateGump();
List<T> list = m_List;
if( WillFilter )
if ( WillFilter )
{
m_List = new List<T>();
for( int i = 0; i < list.Count; i++ )
{
if( !IsFiltered( list[i], m_Filter ) )
if ( !IsFiltered( list[i], m_Filter ) )
m_List.Add( list[i] );
}
}
@ -79,12 +79,12 @@ namespace Server.Guilds
width += (f.Width + 12);
}
if( m_StartNumber <= 0 )
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 )
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
@ -93,7 +93,7 @@ namespace Server.Guilds
int itemNumber = 0;
if( m_Ascending )
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
@ -126,7 +126,7 @@ namespace Server.Guilds
width += (f.Width + 12);
}
if( HasRelationship( o ) )
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
@ -141,7 +141,7 @@ namespace Server.Guilds
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || !IsMember( pm, guild ) )
if ( pm == null || !IsMember( pm, guild ) )
return;
int id = info.ButtonID;
@ -166,16 +166,16 @@ namespace Server.Guilds
}
}
if( id >= 100 && id < (100 + m_Fields.Length) )
if ( id >= 100 && id < (100 + m_Fields.Length) )
{
IComparer<T> comparer = m_Fields[id-100].Comparer;
if( m_Comparer.GetType() == comparer.GetType() )
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 ) )
else if ( id >= 200 && id < ( 200 + m_List.Count ) )
{
pm.SendGump( GetObjectInfoGump( player, guild, m_List[id - 200] ) );
}

View file

@ -24,7 +24,7 @@ namespace Server.Guilds
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:
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:
@ -33,7 +33,7 @@ namespace Server.Guilds
AddButton( 415, 217, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0 );
AddButton( 345, 217, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0 );
if( pm.AcceptGuildInvites )
if ( pm.AcceptGuildInvites )
AddButton( 20, 260, 0xD2, 0xD3, 2, GumpButtonType.Reply, 0 );
else
AddButton( 20, 260, 0xD3, 0xD2, 2, GumpButtonType.Reply, 0 );
@ -45,7 +45,7 @@ namespace Server.Guilds
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || pm.Guild != null )
if ( pm == null || pm.Guild != null )
return; //Sanity
switch( info.ButtonID )
@ -61,19 +61,19 @@ namespace Server.Guilds
guildName = Utility.FixHtml( guildName.Trim() );
guildAbbrev = Utility.FixHtml( guildAbbrev.Trim() );
if( guildName.Length <= 0 )
if ( guildName.Length <= 0 )
pm.SendLocalizedMessage( 1070884 ); // Guild name cannot be blank.
else if( guildAbbrev.Length <= 0 )
else if ( guildAbbrev.Length <= 0 )
pm.SendLocalizedMessage( 1070885 ); // You must provide a guild abbreviation.
else if( guildName.Length > Guild.NameLimit )
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 )
else if ( guildAbbrev.Length > Guild.AbbrevLimit )
pm.SendLocalizedMessage( 1063037, Guild.AbbrevLimit.ToString() ); // An abbreviation cannot exceed ~1_val~ characters in length.
else if( Guild.FindByAbbrev( guildAbbrev ) != null || !BaseGuildGump.CheckProfanity( guildAbbrev ) )
else if ( Guild.FindByAbbrev( guildAbbrev ) != null || !BaseGuildGump.CheckProfanity( guildAbbrev ) )
pm.SendLocalizedMessage( 501153 ); // That abbreviation is not available.
else if( Guild.FindByName( guildName ) != null || !BaseGuildGump.CheckProfanity( guildName ) )
else if ( Guild.FindByName( guildName ) != null || !BaseGuildGump.CheckProfanity( guildName ) )
pm.SendLocalizedMessage( 1063000 ); // That guild name is not available.
else if( !Banker.Withdraw( pm, Guild.RegistrationFee ) )
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
{
@ -88,7 +88,7 @@ namespace Server.Guilds
{
pm.AcceptGuildInvites = !pm.AcceptGuildInvites;
if( pm.AcceptGuildInvites )
if ( pm.AcceptGuildInvites )
pm.SendLocalizedMessage( 1070699 ); // You are now accepting guild invitations.
else
pm.SendLocalizedMessage( 1070698 ); // You are now ignoring guild invitations.
@ -98,4 +98,4 @@ namespace Server.Guilds
}
}
}
}
}

View file

@ -62,19 +62,19 @@ namespace Server.Guilds
return -1;
else if ( y == null )
return 1;
GuildCompareStatus aStatus = GuildCompareStatus.Peace;
GuildCompareStatus bStatus = GuildCompareStatus.Peace;
if( m_Guild.IsAlly( x ) )
if ( m_Guild.IsAlly( x ) )
aStatus = GuildCompareStatus.Ally;
else if( m_Guild.IsWar( x ) )
else if ( m_Guild.IsWar( x ) )
aStatus = GuildCompareStatus.War;
if( m_Guild.IsAlly( y ) )
if ( m_Guild.IsAlly( y ) )
bStatus = GuildCompareStatus.Ally;
else if( m_Guild.IsWar( y ) )
else if ( m_Guild.IsWar( y ) )
bStatus = GuildCompareStatus.War;
return ((int)aStatus).CompareTo( (int)bStatus );
@ -106,7 +106,7 @@ namespace Server.Guilds
GuildDisplayType m_Display;
TextDefinition m_LowerText;
public GuildDiplomacyGump( PlayerMobile pm, Guild g )
public GuildDiplomacyGump( PlayerMobile pm, Guild g )
: this( pm, g, GuildDiplomacyGump.NameComparer.Instance, true, "", 0, GuildDisplayType.All, Utility.CastConvertList<BaseGuild, Guild>( new List<BaseGuild>( Guild.List.Values ) ), (1063136 + (int)GuildDisplayType.All) )
{
}
@ -121,7 +121,7 @@ namespace Server.Guilds
{
}
public GuildDiplomacyGump( PlayerMobile pm, Guild g, bool ascending, string filter, int startNumber, List<Guild> list, TextDefinition lowerText )
public GuildDiplomacyGump( PlayerMobile pm, Guild g, bool ascending, string filter, int startNumber, List<Guild> list, TextDefinition lowerText )
: this( pm, g, GuildDiplomacyGump.NameComparer.Instance, ascending, filter, startNumber, GuildDisplayType.All, list, lowerText )
{
}
@ -145,7 +145,7 @@ namespace Server.Guilds
{
base.PopulateGump();
AddHtmlLocalized( 431, 43, 110, 26, 1062978, 0xF, false, false ); // Diplomacy
AddHtmlLocalized( 431, 43, 110, 26, 1062978, 0xF, false, false ); // Diplomacy
}
protected override TextDefinition[] GetValuesFor( Guild g, int aryLength )
@ -158,14 +158,14 @@ namespace Server.Guilds
defs[2] = 3000085; //Peace
if( guild.IsAlly( g ) )
if ( guild.IsAlly( g ) )
{
if( guild.Alliance.Leader == g )
if ( guild.Alliance.Leader == g )
defs[2] = 1063237; // Alliance Leader
else
defs[2] = 1062964; // Ally
}
else if( guild.IsWar( g ) )
else if ( guild.IsWar( g ) )
{
defs[2] = 3000086; // War
}
@ -175,18 +175,18 @@ namespace Server.Guilds
public override bool HasRelationship( Guild g )
{
if( g == guild )
if ( g == guild )
return false;
if( guild.FindPendingWar( g ) != null )
if ( guild.FindPendingWar( g ) != null )
return true;
AllianceInfo alliance = guild.Alliance;
if( alliance != null )
if ( alliance != null )
{
Guild leader = alliance.Leader;
if ( leader != null )
{
if ( guild == leader && alliance.IsPendingMember( g ) || g == leader && alliance.IsPendingMember( guild ) )
@ -209,7 +209,7 @@ namespace Server.Guilds
else if ( m_LowerText != null && m_LowerText.String != null )
AddHtml( 66, 153 + itemNumber * 28, 280, 26, Color( m_LowerText.String, 0x99 ), false, false );
if( AllowAdvancedSearch )
if ( AllowAdvancedSearch )
{
AddBackground( 350, 148 + itemNumber * 28, 200, 26, 0x2486 );
AddButton( 355, 153 + itemNumber * 28, 0x845, 0x846, 8, GumpButtonType.Reply, 0 );
@ -220,18 +220,18 @@ namespace Server.Guilds
protected override bool IsFiltered( Guild g, string filter )
{
if( g == null )
if ( g == null )
return true;
switch( m_Display )
{
case GuildDisplayType.Relations:
{
//if( !( guild.IsWar( g ) || guild.IsAlly( g ) ) )
//if ( !( guild.IsWar( g ) || guild.IsAlly( g ) ) )
if( !( guild.FindActiveWar( g ) != null || guild.IsAlly( g ) ) ) //As per OSI, only the guild leader wars show up under the sorting by relation
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 false;
}
case GuildDisplayType.AwaitingAction:
@ -247,7 +247,7 @@ namespace Server.Guilds
{
get
{
if( m_Display == GuildDisplayType.All )
if ( m_Display == GuildDisplayType.All )
return base.WillFilter;
return true;
@ -262,7 +262,7 @@ namespace Server.Guilds
public override Gump GetObjectInfoGump( PlayerMobile pm, Guild g, Guild o )
{
if( guild == o )
if ( guild == o )
return new GuildInfoGump( pm, g );
return new OtherGuildInfo( pm, g, (Guild)o ) ;
@ -274,10 +274,10 @@ namespace Server.Guilds
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || !IsMember( pm, guild ) )
if ( pm == null || !IsMember( pm, guild ) )
return;
if( AllowAdvancedSearch && info.ButtonID == 8 )
if ( AllowAdvancedSearch && info.ButtonID == 8 )
pm.SendGump( new GuildAdvancedSearchGump( pm, guild, m_Display, new SearchSelectionCallback( AdvancedSearch_Callback ) ));
}
@ -288,4 +288,4 @@ namespace Server.Guilds
ResendGump();
}
}
}
}

View file

@ -37,13 +37,13 @@ namespace Server.Guilds
AddImageTiled( 67, 116, 156, 22, 0xBBC );
AddHtmlLocalized( 70, 117, 150, 20, 1063025, 0x0, false, false ); // <i>Alliance</i>
if( guild.Alliance != null && guild.Alliance.IsMember( guild ) )
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
}
if( Guild.OrderChaos && isLeader )
if ( Guild.OrderChaos && isLeader )
AddButton( 40, 154, 0x4B9, 0x4BA, 100, GumpButtonType.Reply, 0 ); // Guild Faction
AddImageTiled( 65, 148, 160, 26, 0xA40 );
@ -53,27 +53,27 @@ namespace Server.Guilds
GuildType gt;
Faction f;
if( ( gt = guild.Type ) != GuildType.Regular )
if ( ( gt = guild.Type ) != GuildType.Regular )
AddHtml( 233, 152, 320, 26, gt.ToString(), false, false );
else if( ( f = Faction.Find( guild.Leader ) ) != null )
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 ) )
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 )
if ( isLeader )
AddButton( 40, 251, 0x4B9, 0x4BA, 4, GumpButtonType.Reply, 0 ); //Charter Edit button
s = guild.Website;
if( string.IsNullOrEmpty( s ) )
if ( string.IsNullOrEmpty( s ) )
s = "Guild website not yet set.";
AddHtml( 65, 306, 480, 30, s, true, false );
if( isLeader )
if ( isLeader )
AddButton( 40, 313, 0x4B9, 0x4BA, 5, GumpButtonType.Reply, 0 ); //Website Edit button
AddCheck( 65, 370, 0xD2, 0xD3, player.DisplayGuildTitle, 0 );
@ -90,18 +90,18 @@ namespace Server.Guilds
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( !IsMember( pm, guild ) )
if ( !IsMember( pm, guild ) )
return;
pm.DisplayGuildTitle = info.IsSwitched( 0 );
switch( info.ButtonID )
{
//1-3 handled by base.OnResponse
case 4:
{
if( IsLeader( pm, guild ) )
if ( IsLeader( pm, guild ) )
{
pm.SendLocalizedMessage( 1013071 ); // Enter the new guild charter (50 characters max):
@ -111,7 +111,7 @@ namespace Server.Guilds
}
case 5:
{
if( IsLeader( pm, guild ) )
if ( IsLeader( pm, guild ) )
{
pm.SendLocalizedMessage( 1013072 ); // Enter the new website for the guild (50 characters max):
pm.BeginPrompt( new PromptCallback( SetWebsite_Callback ), true ); //Have the same callback handle both canceling and deletion cause the 2nd callback would just get a text of ""
@ -121,7 +121,7 @@ namespace Server.Guilds
case 6:
{
//Alliance Roster
if( guild.Alliance != null && guild.Alliance.IsMember( guild ) )
if ( guild.Alliance != null && guild.Alliance.IsMember( guild ) )
pm.SendGump( new AllianceInfo.AllianceRosterGump( pm, guild, guild.Alliance ) );
break;
@ -129,7 +129,7 @@ namespace Server.Guilds
case 7:
{
//Resign
if( !m_IsResigning )
if ( !m_IsResigning )
{
pm.SendLocalizedMessage( 1063332 ); // Are you sure you wish to resign from your guild?
pm.SendGump( new GuildInfoGump( pm, guild, true ) );
@ -143,7 +143,7 @@ namespace Server.Guilds
case 100: // Custom code to support Order/Chaos in the new guild system
{
// Guild Faction
if( Guild.OrderChaos && IsLeader( pm, guild ) )
if ( Guild.OrderChaos && IsLeader( pm, guild ) )
{
pm.CloseGump( typeof( GuildChangeTypeGump ) );
pm.SendGump( new GuildChangeTypeGump( pm, guild ) );
@ -155,12 +155,12 @@ namespace Server.Guilds
public void SetCharter_Callback( Mobile from, string text )
{
if( !IsLeader( from, guild ) )
if ( !IsLeader( from, guild ) )
return;
string charter = Utility.FixHtml( text.Trim() );
if( charter.Length > 50 )
if ( charter.Length > 50 )
{
from.SendLocalizedMessage( 1070774, "50" ); // Your guild charter cannot exceed ~1_val~ characters.
}
@ -174,12 +174,12 @@ namespace Server.Guilds
public void SetWebsite_Callback( Mobile from, string text )
{
if( !IsLeader( from, guild ) )
if ( !IsLeader( from, guild ) )
return;
string site = Utility.FixHtml( text.Trim() );
if( site.Length > 50 )
if ( site.Length > 50 )
from.SendLocalizedMessage( 1070777, "50" ); // Your guild website cannot exceed ~1_val~ characters.
else
{

View file

@ -32,7 +32,7 @@ namespace Server.Guilds
public override void OnResponse( NetState sender, RelayInfo info )
{
if( guild.Disbanded || player.Guild != null )
if ( guild.Disbanded || player.Guild != null )
return;
switch( info.ButtonID )
@ -50,7 +50,7 @@ namespace Server.Guilds
break;
}
case 2:
case 2:
{
player.AcceptGuildInvites = false;
player.SendLocalizedMessage( 1070698 ); // You are now ignoring guild invitations.
@ -60,4 +60,4 @@ namespace Server.Guilds
}
}
}
}
}

View file

@ -28,13 +28,13 @@ namespace Server.Guilds
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, 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 );
@ -42,19 +42,19 @@ namespace Server.Guilds
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( 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( 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
@ -64,7 +64,7 @@ namespace Server.Guilds
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) )
if ( pm == null || !IsMember( pm, guild ) || !IsMember( m_Member, guild ) )
return;
RankDefinition playerRank = pm.GuildRank;
@ -74,13 +74,13 @@ namespace Server.Guilds
{
case 1: //Promote
{
if( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && ((playerRank.Rank -1 ) > targetRank.Rank || ( playerRank == RankDefinition.Leader && playerRank.Rank > targetRank.Rank )) )
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 ( targetRank == RankDefinition.Leader )
{
if( m_ToLeader )
if ( m_ToLeader )
{
m_Member.GuildRank = targetRank;
pm.SendLocalizedMessage( 1063156, m_Member.Name ); // The guild information for ~1_val~ has been updated.
@ -106,11 +106,11 @@ namespace Server.Guilds
}
case 2: //Demote
{
if( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && playerRank.Rank > targetRank.Rank )
if ( playerRank.GetFlag( RankFlags.CanPromoteDemote ) && playerRank.Rank > targetRank.Rank )
{
if( targetRank == RankDefinition.Lowest )
if ( targetRank == RankDefinition.Lowest )
{
if( RankDefinition.Lowest.Name.Number == 1062963 )
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 );
@ -123,19 +123,19 @@ namespace Server.Guilds
}
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))
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( new PromptCallback( SetTitle_Callback ) );
}
else if( m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0 )
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.
}
@ -148,13 +148,13 @@ namespace Server.Guilds
}
case 4: //Vote
{
if( m_Member == pm.GuildFealty && guild.Leader != m_Member )
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 ) )
else if ( guild.CanVote( m_Member ) )//( playerRank.GetFlag( RankFlags.CanVote ) )
{
if( m_Member == guild.Leader )
if ( m_Member == guild.Leader )
pm.SendLocalizedMessage( 1063424 ); // You can't vote for the current guild leader.
else if( !guild.CanBeVotedFor( m_Member ) )
else if ( !guild.CanBeVotedFor( m_Member ) )
pm.SendLocalizedMessage( 1063425 ); // You can't vote for an inactive guild member.
else
{
@ -169,9 +169,9 @@ namespace Server.Guilds
}
case 5: //Kick
{
if( ( playerRank.GetFlag( RankFlags.RemovePlayers ) && playerRank.Rank > targetRank.Rank ) || ( playerRank.GetFlag( RankFlags.RemoveLowestRank ) && targetRank == RankDefinition.Lowest ) )
if ( ( playerRank.GetFlag( RankFlags.RemovePlayers ) && playerRank.Rank > targetRank.Rank ) || ( playerRank.GetFlag( RankFlags.RemoveLowestRank ) && targetRank == RankDefinition.Lowest ) )
{
if( m_toKick )
if ( m_toKick )
{
guild.RemoveMember( m_Member );
pm.SendLocalizedMessage( 1063157 ); // The member has been removed from your guild.
@ -195,14 +195,14 @@ namespace Server.Guilds
PlayerMobile pm = from as PlayerMobile;
PlayerMobile targ = m_Member;
if( pm == null || targ == null )
if ( pm == null || targ == null )
return;
Guild g = targ.Guild as Guild;
if( g == null || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > targ.GuildRank.Rank || pm == targ)) )
if ( g == null || !IsMember( pm, g ) || !(pm.GuildRank.GetFlag( RankFlags.CanSetGuildTitle ) && (pm.GuildRank.Rank > targ.GuildRank.Rank || pm == targ)) )
{
if( m_Member.GuildTitle == null || m_Member.GuildTitle.Length <= 0 )
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.
@ -213,13 +213,13 @@ namespace Server.Guilds
string title = Utility.FixHtml( text.Trim() );
if( title.Length > 20 )
if ( title.Length > 20 )
from.SendLocalizedMessage( 501178 ); // That title is too long.
else if( !BaseGuildGump.CheckProfanity( title ) )
else if ( !BaseGuildGump.CheckProfanity( title ) )
from.SendLocalizedMessage( 501179 ); // That title is disallowed.
else
{
if( Insensitive.Equals( title, "none" ) )
if ( Insensitive.Equals( title, "none" ) )
targ.GuildTitle = null;
else
targ.GuildTitle = title;
@ -228,4 +228,4 @@ namespace Server.Guilds
}
}
}
}
}

View file

@ -108,7 +108,7 @@ namespace Server.Guilds
#endregion
private static InfoField<PlayerMobile>[] m_Fields =
private static InfoField<PlayerMobile>[] m_Fields =
new InfoField<PlayerMobile>[]
{
new InfoField<PlayerMobile>( 1062955, 130, GuildRosterGump.NameComparer.Instance ), //Name
@ -147,14 +147,14 @@ namespace Server.Guilds
string name = String.Format( "{0}{1}", pm.Name, ( player.GuildFealty == pm && player.GuildFealty != guild.Leader ) ? " *" : "" );
if( pm == player )
if ( pm == player )
name = Color( name, 0x006600 );
else if( pm.NetState != null )
else if ( pm.NetState != null )
name = Color( name, 0x000066 );
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[2] = (pm.NetState != null) ? new TextDefinition( 1063015 ): new TextDefinition( pm.LastOnline.ToString( "yyyy-MM-dd" ) );
defs[3] = (pm.GuildTitle == null) ? "" : pm.GuildTitle;
return defs;
@ -162,7 +162,7 @@ namespace Server.Guilds
protected override bool IsFiltered( PlayerMobile pm, string filter )
{
if( pm == null )
if ( pm == null )
return true;
return !Insensitive.Contains( pm.Name, filter );
@ -184,12 +184,12 @@ namespace Server.Guilds
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( pm == null || !IsMember( pm, guild ) )
if ( pm == null || !IsMember( pm, guild ) )
return;
if( info.ButtonID == 8 )
if ( info.ButtonID == 8 )
{
if( pm.GuildRank.GetFlag( RankFlags.CanInvitePlayer ) )
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 );
@ -212,32 +212,32 @@ namespace Server.Guilds
Faction guildFaction = ( guildState == null ? null : guildState.Faction );
Faction targetFaction = ( targetState == null ? null : targetState.Faction );
if( pm == null || !IsMember( pm, guild ) || !pm.GuildRank.GetFlag( RankFlags.CanInvitePlayer ) )
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 )
else if ( targ == null )
{
pm.SendLocalizedMessage( 1063334 ); // That isn't a valid player.
}
else if( !targ.AcceptGuildInvites )
else if ( !targ.AcceptGuildInvites )
{
pm.SendLocalizedMessage( 1063049, targ.Name ); // ~1_val~ is not accepting guild invitations.
}
else if( g.IsMember( targ ) )
else if ( g.IsMember( targ ) )
{
pm.SendLocalizedMessage( 1063050, targ.Name ); // ~1_val~ is already a member of your guild!
}
else if( targ.Guild != null )
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
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 )
else if ( targ.Young && guildFaction != null )
{
pm.SendLocalizedMessage( 1070766 ); // You cannot invite a young player to your faction-aligned guild.
}
@ -263,4 +263,4 @@ namespace Server.Guilds
}
}
}
}
}

View file

@ -16,7 +16,7 @@ namespace Server.Guilds
m_Other = otherGuild;
g.CheckExpiredWars();
PopulateGump();
}
@ -31,7 +31,7 @@ namespace Server.Guilds
{
Guild g = Guild.GetAllianceLeader( guild );
Guild other = Guild.GetAllianceLeader( m_Other );
WarDeclaration war = g.FindPendingWar( other );
WarDeclaration activeWar = g.FindActiveWar( other );
@ -51,14 +51,14 @@ namespace Server.Guilds
AddHtmlLocalized( 20, 80, 120, 26, 1063025, 0x0, true, false ); // <i>Alliance</i>
if( otherAlliance != null )
if ( otherAlliance != null )
{
if( otherAlliance.IsMember( m_Other ))
if ( otherAlliance.IsMember( m_Other ))
{
AddHtml( 150, 83, 360, 26, otherAlliance.Name, false, false );
}
//else if( otherAlliance.Leader == guild && ( otherAlliance.IsPendingMember( m_Other ) || otherAlliance.IsPendingMember( guild ) ) )
/* else if( (otherAlliance.Leader == guild && otherAlliance.IsPendingMember( m_Other ) ) || ( otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) )
//else if ( otherAlliance.Leader == guild && ( otherAlliance.IsPendingMember( m_Other ) || otherAlliance.IsPendingMember( guild ) ) )
/* else if ( (otherAlliance.Leader == guild && otherAlliance.IsPendingMember( m_Other ) ) || ( otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) ) )
{
AddHtml( 150, 83, 360, 26, Color( alliance.Name, 0xF), false, false );
}
@ -74,33 +74,33 @@ namespace Server.Guilds
string kills = "0/0";
string time = "00:00";
string otherKills = "0/0";
WarDeclaration otherWar;
if( ActiveWar )
if ( ActiveWar )
{
kills = String.Format( "{0}/{1}", activeWar.Kills, activeWar.MaxKills );
TimeSpan timeRemaining = TimeSpan.Zero;
if( activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.UtcNow )
if ( activeWar.WarLength != TimeSpan.Zero && (activeWar.WarBeginning + activeWar.WarLength) > DateTime.UtcNow )
timeRemaining = (activeWar.WarBeginning + activeWar.WarLength) - DateTime.UtcNow;
//time = String.Format( "{0:D2}:{1:D2}", timeRemaining.Hours.ToString(), timeRemaining.Subtract( TimeSpan.FromHours( timeRemaining.Hours ) ).Minutes ); //Is there a formatter for htis? it's 2AM and I'm tired and can't find it
time = String.Format( "{0:D2}:{1:mm}", timeRemaining.Hours, DateTime.MinValue + timeRemaining );
otherWar = m_Other.FindActiveWar( guild );
if( otherWar != null )
if ( otherWar != null )
otherKills = String.Format( "{0}/{1}", otherWar.Kills, otherWar.MaxKills );
}
else if( PendingWar )
else if ( PendingWar )
{
kills = Color( String.Format( "{0}/{1}", war.Kills, war.MaxKills ), 0x990000 );
//time = Color( String.Format( "{0}:{1}", war.WarLength.Hours, ((TimeSpan)(war.WarLength - TimeSpan.FromHours( war.WarLength.Hours ))).Minutes ), 0xFF0000 );
time = Color( String.Format( "{0:D2}:{1:mm}", war.WarLength.Hours, DateTime.MinValue + war.WarLength ), 0x990000 );
otherWar = m_Other.FindPendingWar( guild );
if( otherWar != null )
if ( otherWar != null )
otherKills = Color( String.Format( "{0}/{1}", otherWar.Kills, otherWar.MaxKills ), 0x990000 );
}
@ -116,11 +116,11 @@ namespace Server.Guilds
AddImageTiled( 20, 172, 480, 2, 0x2711 );
int number = 1062973;// <div align=center>You are at peace with this guild.</div>
if( PendingWar )
if ( PendingWar )
{
if( war.WarRequester )
if ( war.WarRequester )
{
number = 1063027; // <div align=center>You have challenged this guild to war!</div>
}
@ -134,18 +134,18 @@ namespace Server.Guilds
AddButtonAndBackground( 20, 290, 7, 1062982 ); // Dismiss Challenge
}
else if( ActiveWar )
else if ( ActiveWar )
{
number = 1062965; // <div align=center>You are at war with this guild!</div>
AddButtonAndBackground( 20, 290, 8, 1062980 ); // Surrender
}
else if ( alliance != null && alliance == otherAlliance ) //alliance, Same Alliance
{
if( alliance.IsMember( guild ) && alliance.IsMember( m_Other ) ) //Both in Same alliance, full members
if ( alliance.IsMember( guild ) && alliance.IsMember( m_Other ) ) //Both in Same alliance, full members
{
number = 1062970; // <div align=center>You are allied with this guild.</div>
if( alliance.Leader == guild )
if ( alliance.Leader == guild )
{
AddButtonAndBackground( 20, 260, 12, 1062984 ); // Remove Guild from Alliance
AddButtonAndBackground( 275, 260, 13, 1063433 ); // Promote to Alliance Leader //Note: No 'confirmation' like the other leader guild promotion things
@ -157,7 +157,7 @@ namespace Server.Guilds
//Leave Alliance
AddButtonAndBackground( 20, 290, 11, 1062985 ); // Leave Alliance
}
else if( alliance.Leader == guild && alliance.IsPendingMember( m_Other ) )
else if ( alliance.Leader == guild && alliance.IsPendingMember( m_Other ) )
{
number = 1062971; // <div align=center>You have requested an alliance with this guild.</div>
@ -168,7 +168,7 @@ namespace Server.Guilds
AddHtml( 150, 83, 360, 26, Color( alliance.Name, 0x99 ), false, false );
}
else if( alliance.Leader == m_Other && alliance.IsPendingMember( guild ) )
else if ( alliance.Leader == m_Other && alliance.IsPendingMember( guild ) )
{
number = 1062972; // <div align=center>This guild has requested an alliance.</div>
@ -184,7 +184,7 @@ namespace Server.Guilds
}
else
{
AddButtonAndBackground( 20, 260, 2, 1062990 ); // Request Alliance
AddButtonAndBackground( 20, 260, 2, 1062990 ); // Request Alliance
AddButtonAndBackground( 20, 290, 1, 1062989 ); // Declare War!
}
@ -199,11 +199,11 @@ namespace Server.Guilds
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( !IsMember( pm, guild ) )
if ( !IsMember( pm, guild ) )
return;
RankDefinition playerRank = pm.GuildRank;
Guild guildLeader = Guild.GetAllianceLeader( guild );
Guild otherGuild = Guild.GetAllianceLeader( m_Other );
@ -219,13 +219,13 @@ namespace Server.Guilds
#region War
case 5: //Accept the war
{
if( war != null && !war.WarRequester && activeWar == null )
if ( war != null && !war.WarRequester && activeWar == null )
{
if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
{
pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars.
}
else if( alliance != null && alliance.Leader != guild )
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, 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.
@ -237,7 +237,7 @@ namespace Server.Guilds
war.WarBeginning = DateTime.UtcNow;
guild.AcceptedWars.Add( war );
if( alliance != null && alliance.IsMember( guild ) )
if ( alliance != null && alliance.IsMember( guild ) )
{
alliance.AllianceMessage( 1070769, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name) ); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
alliance.InvalidateMemberProperties();
@ -253,7 +253,7 @@ namespace Server.Guilds
otherWar.WarBeginning = DateTime.UtcNow;
otherGuild.AcceptedWars.Add( otherWar );
if( otherAlliance != null && m_Other.Alliance.IsMember( m_Other ) )
if ( otherAlliance != null && m_Other.Alliance.IsMember( m_Other ) )
{
otherAlliance.AllianceMessage( 1070769, ((alliance != null) ? alliance.Name : guild.Name) ); // Guild Message: Your guild is now at war with ~1_GUILDNAME~
otherAlliance.InvalidateMemberProperties();
@ -270,13 +270,13 @@ namespace Server.Guilds
}
case 6: //Modify war terms
{
if( war != null && !war.WarRequester && activeWar == null )
if ( war != null && !war.WarRequester && activeWar == null )
{
if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
{
pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars.
}
else if( alliance != null && alliance.Leader != guild )
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, 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.
@ -290,19 +290,19 @@ namespace Server.Guilds
}
case 7: //Dismiss war
{
if( war != null )
if ( war != null )
{
if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
{
pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars.
}
else if( alliance != null && alliance.Leader != guild )
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, 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
{
{
//Dismiss the war
guild.PendingWars.Remove( war );
otherGuild.PendingWars.Remove( otherWar );
@ -314,20 +314,20 @@ namespace Server.Guilds
}
case 8: //Surrender
{
if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
{
pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars.
}
else if( alliance != null && alliance.Leader != guild )
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, 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( activeWar != null )
if ( activeWar != null )
{
if( alliance != null && alliance.IsMember( guild ) )
if ( alliance != null && alliance.IsMember( guild ) )
{
alliance.AllianceMessage( 1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name) );// You have lost the war with ~1_val~.
alliance.InvalidateMemberProperties();
@ -337,10 +337,10 @@ namespace Server.Guilds
guild.GuildMessage( 1070740, ((otherAlliance != null) ? otherAlliance.Name : otherGuild.Name) );// You have lost the war with ~1_val~.
guild.InvalidateMemberProperties();
}
guild.AcceptedWars.Remove( activeWar );
if( otherAlliance != null && otherAlliance.IsMember( otherGuild ) )
if ( otherAlliance != null && otherAlliance.IsMember( otherGuild ) )
{
otherAlliance.AllianceMessage( 1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name) );// You have won the war against ~1_val~!
otherAlliance.InvalidateMemberProperties();
@ -350,7 +350,7 @@ namespace Server.Guilds
otherGuild.GuildMessage( 1070739, ((guild.Alliance != null) ? guild.Alliance.Name : guild.Name) );// You have won the war against ~1_val~!
otherGuild.InvalidateMemberProperties();
}
otherGuild.AcceptedWars.Remove( otherGuild.FindActiveWar( guild ) );
}
}
@ -358,18 +358,18 @@ namespace Server.Guilds
}
case 1: //Declare War
{
if( war == null && activeWar == null )
if ( war == null && activeWar == null )
{
if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
{
pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars.
}
else if( alliance != null && alliance.Leader != guild )
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, 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 )
else if ( otherAlliance != null && otherAlliance.Leader != m_Other )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", m_Other.Name, 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.
@ -385,28 +385,28 @@ namespace Server.Guilds
case 2: //Request Alliance
{
#region New alliance
if( alliance == null )
if ( alliance == null )
{
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1070747 ); // You don't have permission to create an alliance.
}
else if( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) )
else if ( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) )
{
pm.SendLocalizedMessage( 1070758 ); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else if( otherAlliance != null )
else if ( otherAlliance != null )
{
if( otherAlliance.IsPendingMember( m_Other ) )
if ( otherAlliance.IsPendingMember( m_Other ) )
pm.SendLocalizedMessage( 1063416, m_Other.Name ); // ~1_val~ is currently considering another alliance proposal.
else
pm.SendLocalizedMessage( 1063426, m_Other.Name ); // ~1_val~ already belongs to an alliance.
}
else if( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 )
else if ( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 )
{
pm.SendLocalizedMessage( 1063427, m_Other.Name ); // ~1_val~ is currently involved in a guild war.
}
else if( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 )
else if ( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 )
{
pm.SendLocalizedMessage( 1063427, guild.Name ); // ~1_val~ is currently involved in a guild war.
}
@ -420,34 +420,34 @@ namespace Server.Guilds
#region Existing Alliance
else
{
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance.
}
else if( alliance.Leader != guild )
else if ( alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if( otherAlliance != null )
else if ( otherAlliance != null )
{
if( otherAlliance.IsPendingMember( m_Other ) )
if ( otherAlliance.IsPendingMember( m_Other ) )
pm.SendLocalizedMessage( 1063416, m_Other.Name ); // ~1_val~ is currently considering another alliance proposal.
else
pm.SendLocalizedMessage( 1063426, m_Other.Name ); // ~1_val~ already belongs to an alliance.
}
else if( alliance.IsPendingMember( guild ) )
else if ( alliance.IsPendingMember( guild ) )
{
pm.SendLocalizedMessage( 1063416, guild.Name ); // ~1_val~ is currently considering another alliance proposal.
}
else if( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 )
else if ( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 )
{
pm.SendLocalizedMessage( 1063427, m_Other.Name ); // ~1_val~ is currently involved in a guild war.
}
else if( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 )
else if ( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 )
{
pm.SendLocalizedMessage( 1063427, guild.Name ); // ~1_val~ is currently involved in a guild war.
}
else if( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) )
else if ( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) )
{
pm.SendLocalizedMessage( 1070758 ); // You cannot propose an alliance to a guild with a different faction allegiance.
}
@ -466,60 +466,60 @@ namespace Server.Guilds
}
case 10: //Show Alliance Roster
{
if( alliance != null && alliance == otherAlliance )
if ( alliance != null && alliance == otherAlliance )
pm.SendGump( new AllianceInfo.AllianceRosterGump( pm, guild, alliance ) );
break;
}
case 11: //Leave Alliance
{
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance.
}
else if( alliance != null && alliance.IsMember( guild ) )
else if ( alliance != null && alliance.IsMember( guild ) )
{
guild.Alliance = null; //Calls alliance.Removeguild
// alliance.RemoveGuild( guild );
m_Other.InvalidateWarNotoriety();
guild.InvalidateMemberNotoriety();
}
break;
}
case 12: //Remove Guild from alliance
{
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance.
}
else if( alliance != null && alliance.Leader != guild )
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) )
else if ( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) )
{
m_Other.Alliance = null;
m_Other.InvalidateMemberNotoriety();
guild.InvalidateWarNotoriety();
}
break;
}
case 13: //Promote to Alliance leader
{
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance.
}
else if( alliance != null && alliance.Leader != guild )
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, alliance.Name ) ); // ~1_val~ is not the leader of the ~2_val~ alliance.
}
else if( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) )
{
else if ( alliance != null && alliance.IsMember( guild ) && alliance.IsMember( m_Other ) )
{
pm.SendLocalizedMessage( 1063434, String.Format( "{0}\t{1}", m_Other.Name, alliance.Name ) ); // ~1_val~ is now the leader of ~2_val~.
alliance.Leader = m_Other;
@ -528,11 +528,11 @@ namespace Server.Guilds
}
case 14: //Withdraw Request
{
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance.
}
else if( alliance != null && alliance.Leader == guild && alliance.IsPendingMember( m_Other ) )
else if ( alliance != null && alliance.Leader == guild && alliance.IsPendingMember( m_Other ) )
{
m_Other.Alliance = null;
pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated.
@ -541,11 +541,11 @@ namespace Server.Guilds
}
case 15: //Deny Alliance Request
{
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance.
}
else if( alliance != null && otherAlliance != null && alliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) )
else if ( alliance != null && otherAlliance != null && alliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) )
{
pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated.
//m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal. //Per OSI commented out.
@ -556,11 +556,11 @@ namespace Server.Guilds
}
case 16: //Accept Alliance Request
{
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1063436 ); // You don't have permission to negotiate an alliance.
}
else if( otherAlliance != null && otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) )
else if ( otherAlliance != null && otherAlliance.Leader == m_Other && otherAlliance.IsPendingMember( guild ) )
{
pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated.
@ -574,41 +574,41 @@ namespace Server.Guilds
}
public void CreateAlliance_Callback( Mobile from, string text )
{
{
PlayerMobile pm = from as PlayerMobile;
AllianceInfo alliance = guild.Alliance;
AllianceInfo otherAlliance = m_Other.Alliance;
if( !IsMember( from, guild ) || alliance != null )
if ( !IsMember( from, guild ) || alliance != null )
return;
RankDefinition playerRank = pm.GuildRank;
if( !playerRank.GetFlag( RankFlags.AllianceControl ) )
if ( !playerRank.GetFlag( RankFlags.AllianceControl ) )
{
pm.SendLocalizedMessage( 1070747 ); // You don't have permission to create an alliance.
}
else if( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) )
else if ( Faction.Find( guild.Leader ) != Faction.Find( m_Other.Leader ) )
{
//Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later.
//Notes about this: OSI only cares/checks when proposing, you can change your faction all you want later.
pm.SendLocalizedMessage( 1070758 ); // You cannot propose an alliance to a guild with a different faction allegiance.
}
else if( otherAlliance != null )
else if ( otherAlliance != null )
{
if( otherAlliance.IsPendingMember( m_Other ) )
if ( otherAlliance.IsPendingMember( m_Other ) )
pm.SendLocalizedMessage( 1063416, m_Other.Name ); // ~1_val~ is currently considering another alliance proposal.
else
pm.SendLocalizedMessage( 1063426, m_Other.Name ); // ~1_val~ already belongs to an alliance.
}
else if( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 )
else if ( m_Other.AcceptedWars.Count > 0 || m_Other.PendingWars.Count > 0 )
{
pm.SendLocalizedMessage( 1063427, m_Other.Name ); // ~1_val~ is currently involved in a guild war.
}
else if( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 )
else if ( guild.AcceptedWars.Count > 0 || guild.PendingWars.Count > 0 )
{
pm.SendLocalizedMessage( 1063427, guild.Name ); // ~1_val~ is currently involved in a guild war.
}
@ -616,21 +616,21 @@ namespace Server.Guilds
{
string name = Utility.FixHtml( text.Trim() );
if( !BaseGuildGump.CheckProfanity( name ) )
if ( !BaseGuildGump.CheckProfanity( name ) )
pm.SendLocalizedMessage( 1070886 ); // That alliance name is not allowed.
else if( name.Length > Guild.NameLimit )
else if ( name.Length > Guild.NameLimit )
pm.SendLocalizedMessage( 1070887, Guild.NameLimit.ToString() ); // An alliance name cannot exceed ~1_val~ characters in length.
else if( AllianceInfo.Alliances.ContainsKey( name.ToLower() ) )
else if ( AllianceInfo.Alliances.ContainsKey( name.ToLower() ) )
pm.SendLocalizedMessage( 1063428 ); // That alliance name is not available.
else
{
pm.SendLocalizedMessage( 1070750, m_Other.Name ); // An invitation to join your alliance has been sent to ~1_val~.
m_Other.GuildMessage( 1070780, guild.Name ); // ~1_val~ has proposed an alliance.
new AllianceInfo( guild, name, m_Other );
}
}
}
}
}
}

View file

@ -39,10 +39,10 @@ namespace Server.Guilds
public override void OnResponse( NetState sender, RelayInfo info )
{
PlayerMobile pm = sender.Mobile as PlayerMobile;
if( !IsMember( pm, guild ) )
if ( !IsMember( pm, guild ) )
return;
RankDefinition playerRank = pm.GuildRank;
@ -52,18 +52,18 @@ namespace Server.Guilds
case 1:
{
AllianceInfo alliance = guild.Alliance;
AllianceInfo otherAlliance = m_Other.Alliance;
AllianceInfo otherAlliance = m_Other.Alliance;
if( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
if ( !playerRank.GetFlag( RankFlags.ControlWarStatus ) )
{
pm.SendLocalizedMessage( 1063440 ); // You don't have permission to negotiate wars.
}
else if( alliance != null && alliance.Leader != guild )
else if ( alliance != null && alliance.Leader != guild )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", guild.Name, 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 )
else if ( otherAlliance != null && otherAlliance.Leader != m_Other )
{
pm.SendLocalizedMessage( 1063239, String.Format( "{0}\t{1}", m_Other.Name, 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.
@ -72,7 +72,7 @@ namespace Server.Guilds
{
WarDeclaration activeWar = guild.FindActiveWar( m_Other );
if( activeWar == null )
if ( activeWar == null )
{
WarDeclaration war = guild.FindPendingWar( m_Other );
WarDeclaration otherWar = m_Other.FindPendingWar( guild );
@ -84,7 +84,7 @@ namespace Server.Guilds
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 )
if ( war != null )
{
war.MaxKills = maxKills;
war.WarLength = warLength;
@ -95,7 +95,7 @@ namespace Server.Guilds
guild.PendingWars.Add( new WarDeclaration( guild, m_Other, maxKills, warLength, true ) );
}
if( otherWar != null )
if ( otherWar != null )
{
otherWar.MaxKills = maxKills;
otherWar.WarLength = warLength;
@ -106,7 +106,7 @@ namespace Server.Guilds
m_Other.PendingWars.Add( new WarDeclaration( m_Other, guild, maxKills, warLength, false ) );
}
if( war != null )
if ( war != null )
{
pm.SendLocalizedMessage( 1070752 ); // The proposal has been updated.
//m_Other.GuildMessage( 1070782 ); // ~1_val~ has responded to your proposal.
@ -127,4 +127,4 @@ namespace Server.Guilds
}
}
}
}
}