Decoupled the Order/Chaos system from the NewGuildSystem setting.

This commit is contained in:
eos@runuo.com 2013-06-07 01:07:07 +00:00
parent 2067f181e1
commit cab25a9b8f
5 changed files with 74 additions and 43 deletions

View file

@ -489,7 +489,7 @@ namespace Server.Factions
if ( guild.Leader != pm )
pm.SendLocalizedMessage( 1005057 ); // You cannot join a faction because you are in a guild and not the guildmaster
else if ( !Guild.NewGuildSystem && guild.Type != GuildType.Regular )
else if ( guild.Type != GuildType.Regular )
pm.SendLocalizedMessage( 1042161 ); // You cannot join a faction because your guild is an Order or Chaos type.
else if ( !Guild.NewGuildSystem && guild.Enemies != null && guild.Enemies.Count > 0 ) //CAN join w/wars in new system
pm.SendLocalizedMessage( 1005056 ); // You cannot join a faction with active Wars

View file

@ -2,6 +2,7 @@ using System;
using System.Collections;
using Server;
using Server.Guilds;
using Server.Mobiles;
using Server.Network;
using Server.Factions;
@ -44,36 +45,45 @@ namespace Server.Gumps
public override void OnResponse( NetState state, RelayInfo info )
{
if ( GuildGump.BadLeader( m_Mobile, m_Guild ) )
if ( ( Guild.NewGuildSystem && !BaseGuildGump.IsLeader( m_Mobile, m_Guild ) ) || ( !Guild.NewGuildSystem && GuildGump.BadLeader( m_Mobile, m_Guild ) ) )
return;
PlayerState pl = PlayerState.Find( m_Mobile );
GuildType newType;
if ( pl != null )
switch ( info.ButtonID )
{
m_Mobile.SendLocalizedMessage( 1010405 ); // You cannot change guild types while in a Faction!
default: newType = m_Guild.Type; break;
case 1: newType = GuildType.Regular; break;
case 2: newType = GuildType.Order; break;
case 3: newType = GuildType.Chaos; break;
}
else if ( m_Guild.TypeLastChange.AddDays( 7 ) > DateTime.Now )
{
m_Mobile.SendLocalizedMessage( 1005292 ); // Your guild type will be changed in one week.
}
else
{
GuildType newType;
switch ( info.ButtonID )
if ( m_Guild.Type != newType )
{
PlayerState pl = PlayerState.Find( m_Mobile );
if ( pl != null )
{
default: return; // Close
case 1: newType = GuildType.Regular; break;
case 2: newType = GuildType.Order; break;
case 3: newType = GuildType.Chaos; break;
m_Mobile.SendLocalizedMessage( 1010405 ); // You cannot change guild types while in a Faction!
}
else if ( m_Guild.TypeLastChange.AddDays( 7 ) > DateTime.Now )
{
m_Mobile.SendLocalizedMessage( 1011142 ); // You have already changed your guild type recently.
// TODO: Clilocs 1011142-1011145 suggest a timer for pending changes
}
else
{
m_Guild.Type = newType;
m_Guild.GuildMessage( 1018022, true, newType.ToString() ); // Guild Message: Your guild type has changed:
}
}
if ( m_Guild.Type == newType )
return;
if ( Guild.NewGuildSystem )
{
if ( m_Mobile is PlayerMobile )
m_Mobile.SendGump( new GuildInfoGump( (PlayerMobile)m_Mobile, m_Guild ) );
m_Guild.Type = newType;
m_Guild.GuildMessage( 1018022, true, newType.ToString() ); // Guild Message: Your guild type has changed:
return;
}
GuildGump.EnsureClosed( m_Mobile );

View file

@ -31,18 +31,22 @@ namespace Server.Gumps
AddButton( 20, 70, 4005, 4007, 3, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 55, 70, 470, 30, 1011109, false, false ); // Set the guild's abbreviation.
AddButton( 20, 100, 4005, 4007, 4, GumpButtonType.Reply, 0 );
switch ( m_Guild.Type )
if ( Guild.OrderChaos )
{
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, 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;
}
}
AddButton( 20, 130, 4005, 4007, 5, GumpButtonType.Reply, 0 );
@ -111,6 +115,9 @@ namespace Server.Gumps
}
case 4: // Change guild type
{
if ( !Guild.OrderChaos )
return;
GuildGump.EnsureClosed( m_Mobile );
m_Mobile.SendGump( new GuildChangeTypeGump( m_Mobile, m_Guild ) );

View file

@ -43,12 +43,19 @@ namespace Server.Guilds
AddButton( 40, 120, 0x4B9, 0x4BA, 6, GumpButtonType.Reply, 0 ); //Alliance Roster
}
if( Guild.OrderChaos && isLeader )
AddButton( 40, 154, 0x4B9, 0x4BA, 100, GumpButtonType.Reply, 0 ); // Guild Faction
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>
Faction f = Faction.Find( guild.Leader );
if( f != null )
GuildType gt;
Faction f;
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 );
@ -133,6 +140,16 @@ namespace Server.Guilds
}
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;
}
}
}

View file

@ -694,6 +694,7 @@ namespace Server.Guilds
#endregion
public static bool NewGuildSystem{ get{ return Core.SE; } }
public static bool OrderChaos{ get{ return !Core.SE; } }
public static readonly int RegistrationFee = 25000;
public static readonly int AbbrevLimit = 4;
@ -1166,13 +1167,10 @@ namespace Server.Guilds
public bool IsEnemy( Guild g )
{
if( NewGuildSystem )
return IsWar( g );
if( m_Type != GuildType.Regular && g.m_Type != GuildType.Regular && m_Type != g.m_Type )
if( Type != GuildType.Regular && g.Type != GuildType.Regular && Type != g.Type )
return true;
return m_Enemies.Contains( g );
return IsWar( g );
}
public bool IsWar( Guild g )
@ -1184,14 +1182,13 @@ namespace Server.Guilds
{
Guild guild = GetAllianceLeader( this );
Guild otherGuild = GetAllianceLeader( g );
if ( guild.FindActiveWar( otherGuild ) != null )
return true;
return false;
}
return m_Enemies.Contains( g );
}
#endregion
@ -1765,7 +1762,7 @@ namespace Server.Guilds
{
get
{
return m_Type;
return OrderChaos ? m_Type : GuildType.Regular;
}
set
{