Fixes implicit ternary expressions

This commit is contained in:
Kamron Batman 2018-09-14 14:56:48 -07:00
parent c85b0a740c
commit ff26dfa375
345 changed files with 1905 additions and 2336 deletions

View file

@ -24,7 +24,8 @@ namespace Server
e.AllowConnection = false;
return;
}
else if ( IPLimiter.SocketBlock && !IPLimiter.Verify( ip ) )
if ( IPLimiter.SocketBlock && !IPLimiter.Verify( ip ) )
{
Console.WriteLine( "Client: {0}: Past IP limit threshold", ip );

View file

@ -316,7 +316,7 @@ namespace Server.Misc
if ( AutoAccountCreation && un.Trim().Length > 0 ) // To prevent someone from making an account of just '' or a bunch of meaningless spaces
{
e.State.Account = acct = CreateAccount( e.State, un, pw );
e.Accepted = acct == null ? false : acct.CheckAccess( e.State );
e.Accepted = acct?.CheckAccess( e.State ) ?? false;
if ( !e.Accepted )
e.RejectReason = ALRReason.BadComm;

View file

@ -219,33 +219,30 @@ namespace Server.Commands
{
return Enum.Parse( type, value, true );
}
else if ( IsType( type ) )
if ( IsType( type ) )
{
return ScriptCompiler.FindTypeByName( value );
}
else if ( IsParsable( type ) )
if ( IsParsable( type ) )
{
return ParseParsable( type, value );
}
else
object obj = value;
if ( value != null && value.StartsWith( "0x" ) )
{
object obj = value;
if ( IsSignedNumeric( type ) )
obj = Convert.ToInt64( value.Substring( 2 ), 16 );
else if ( IsUnsignedNumeric( type ) )
obj = Convert.ToUInt64( value.Substring( 2 ), 16 );
if ( value != null && value.StartsWith( "0x" ) )
{
if ( IsSignedNumeric( type ) )
obj = Convert.ToInt64( value.Substring( 2 ), 16 );
else if ( IsUnsignedNumeric( type ) )
obj = Convert.ToUInt64( value.Substring( 2 ), 16 );
obj = Convert.ToInt32( value.Substring( 2 ), 16 );
}
if ( obj == null && !type.IsValueType )
return null;
else
return Convert.ChangeType( obj, type );
obj = Convert.ToInt32( value.Substring( 2 ), 16 );
}
if ( obj == null && !type.IsValueType )
return null;
return Convert.ChangeType( obj, type );
}
catch
{

View file

@ -68,12 +68,13 @@ namespace Server.Commands
e.Mobile.SendMessage( "That is either an invalid command name or one that does not support this modifier: {0}.", commandString );
return;
}
else if ( e.Mobile.AccessLevel < command.AccessLevel )
if ( e.Mobile.AccessLevel < command.AccessLevel )
{
e.Mobile.SendMessage( "You do not have access to that command: {0}.", commandString );
return;
}
else if ( !command.ValidateArgs( m_Scope, eventArgs[i] ) )
if ( !command.ValidateArgs( m_Scope, eventArgs[i] ) )
{
return;
}
@ -157,12 +158,13 @@ namespace Server.Commands
from.SendMessage( "You must select the batch command scope." );
return false;
}
else if ( m_Condition.Length > 0 && !m_Scope.SupportsConditionals )
if ( m_Condition.Length > 0 && !m_Scope.SupportsConditionals )
{
from.SendMessage( "This command scope does not support conditionals." );
return false;
}
else if ( m_Condition.Length > 0 && !Utility.InsensitiveStartsWith( m_Condition, "where" ) )
if ( m_Condition.Length > 0 && !Utility.InsensitiveStartsWith( m_Condition, "where" ) )
{
from.SendMessage( "The condition field must start with \"where\"." );
return false;

View file

@ -68,7 +68,7 @@ namespace Server.Commands
if ( aStatic && !bStatic )
return -1;
else if ( !aStatic && bStatic )
if ( !aStatic && bStatic )
return 1;
int v = 0;
@ -115,7 +115,7 @@ namespace Server.Commands
{
if ( ctor != null )
return ctor.IsStatic;
else if ( method != null )
if ( method != null )
return method.IsStatic;
if ( prop != null )
@ -133,12 +133,11 @@ namespace Server.Commands
{
if ( ctor != null )
return ctor.DeclaringType.Name;
else if ( prop != null )
if ( prop != null )
return prop.Name;
else if ( method != null )
if ( method != null )
return method.Name;
else
return "";
return "";
}
}
@ -148,9 +147,9 @@ namespace Server.Commands
{
if ( x == null && y == null )
return 0;
else if ( x == null )
if ( x == null )
return -1;
else if ( y == null )
if ( y == null )
return 1;
return x.TypeName.CompareTo( y.TypeName );
@ -2465,7 +2464,7 @@ namespace Server.Commands
for( int i = 0; i < ReplaceChars.Length; ++i ) { sb.Replace( ReplaceChars[i], '-' ); }
if ( anonymousType ) return "(Anonymous-Type)"+sb.ToString();
else return sb.ToString();
return sb.ToString();
}
public static string AliasForName( string name )

View file

@ -308,7 +308,8 @@ namespace Server.Commands.Generic
m_From.SendGump( new InterfaceGump( m_From, m_Columns, m_List, m_Page, m_Item ) );
return;
}
else if ( !BaseCommand.IsAccessible( m_From, m_Item ) )
if ( !BaseCommand.IsAccessible( m_From, m_Item ) )
{
m_From.SendMessage( "That is no longer accessible." );
m_From.SendGump( new InterfaceGump( m_From, m_Columns, m_List, m_Page, m_Item ) );
@ -469,7 +470,8 @@ namespace Server.Commands.Generic
m_From.SendGump( new InterfaceGump( m_From, m_Columns, m_List, m_Page, m_Mobile ) );
return;
}
else if ( !BaseCommand.IsAccessible( m_From, m_Mobile ) )
if ( !BaseCommand.IsAccessible( m_From, m_Mobile ) )
{
m_From.SendMessage( "That is no longer accessible." );
m_From.SendGump( new InterfaceGump( m_From, m_Columns, m_List, m_Page, m_Mobile ) );

View file

@ -16,7 +16,7 @@ namespace Server.Commands.Generic
{
RangeCommandImplementor impl = RangeCommandImplementor.Instance;
impl?.Process( 18, @from, command, args );
impl?.Process( 18, from, command, args );
}
}
}

View file

@ -628,7 +628,7 @@ namespace Server.Commands
Mobile owner = item.RootParent as Mobile;
if ( owner?.Map != null && owner.Map != Map.Internal && !BaseCommand.IsAccessible( @from, owner ) /* !from.CanSee( owner )*/ )
if ( owner?.Map != null && owner.Map != Map.Internal && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ )
{
from.SendMessage( "You can not go to what you can not see." );
return;

View file

@ -45,8 +45,8 @@ namespace Server.Commands
return;
}
else
e.Mobile.SendMessage($"Command '{arg}' not found!");
e.Mobile.SendMessage($"Command '{arg}' not found!");
}
e.Mobile.SendGump( new CommandListGump( 0, e.Mobile, null ) );

View file

@ -113,26 +113,27 @@ namespace Server.Commands
failReason = $"Property '{propertyName}' not found.";
return null;
}
else if ( (access & PropertyAccess.Read) != 0 && from.AccessLevel < attr.ReadLevel )
if ( (access & PropertyAccess.Read) != 0 && from.AccessLevel < attr.ReadLevel )
{
failReason =
$"You must be at least {Mobile.GetAccessLevelName(attr.ReadLevel)} to get the property '{propertyName}'.";
return null;
}
else if ( (access & PropertyAccess.Write) != 0 && from.AccessLevel < attr.WriteLevel )
if ( (access & PropertyAccess.Write) != 0 && from.AccessLevel < attr.WriteLevel )
{
failReason =
$"You must be at least {Mobile.GetAccessLevelName(attr.WriteLevel)} to set the property '{propertyName}'.";
return null;
}
else if ( (access & PropertyAccess.Read) != 0 && !p.CanRead )
if ( (access & PropertyAccess.Read) != 0 && !p.CanRead )
{
failReason = $"Property '{propertyName}' is write only.";
return null;
}
else if ( (access & PropertyAccess.Write) != 0 && (!p.CanWrite || attr.ReadOnly) && isFinal )
if ( (access & PropertyAccess.Write) != 0 && (!p.CanWrite || attr.ReadOnly) && isFinal )
{
failReason = $"Property '{propertyName}' is read only.";
return null;

View file

@ -95,7 +95,7 @@ namespace Server.Engines.BulkOrders
{
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
return 1049348 + (int)(material - BulkMaterialType.Spined);
return 0;

View file

@ -89,7 +89,7 @@ namespace Server.Engines.BulkOrders
{
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
return 1049348 + (int)(material - BulkMaterialType.Spined);
return 0;

View file

@ -77,7 +77,7 @@ namespace Server.Engines.BulkOrders
{
if ( m_Items.Length == 0 )
return null;
else if ( m_Items.Length == 1 )
if ( m_Items.Length == 1 )
return m_Items[0];
int totalWeight = 0;
@ -203,9 +203,9 @@ namespace Server.Engines.BulkOrders
{
if ( type == 1 )
return new LeatherGlovesOfMining( 1 );
else if ( type == 3 )
if ( type == 3 )
return new StuddedGlovesOfMining( 3 );
else if ( type == 5 )
if ( type == 5 )
return new RingmailGlovesOfMining( 5 );
throw new InvalidOperationException();

View file

@ -82,7 +82,7 @@ namespace Server.Engines.BulkOrders
{
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
return 1049348 + (int)(material - BulkMaterialType.Spined);
return 0;

View file

@ -72,7 +72,7 @@ namespace Server.Engines.BulkOrders
{
if ( material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite )
return 1045142 + (int)(material - BulkMaterialType.DullCopper);
else if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
if ( material >= BulkMaterialType.Spined && material <= BulkMaterialType.Barbed )
return 1049348 + (int)(material - BulkMaterialType.Spined);
return 0;

View file

@ -666,7 +666,7 @@ namespace Server.Engines.CannedEvil
return new Point3D( x, y, z );
/* try @ platform Z if map z fails */
else if ( Map.CanSpawnMobile( new Point2D( x, y ), m_Platform.Location.Z ) )
if ( Map.CanSpawnMobile( new Point2D( x, y ), m_Platform.Location.Z ) )
return new Point3D( x, y, m_Platform.Location.Z );
}
@ -683,9 +683,9 @@ namespace Server.Engines.CannedEvil
if ( level <= Level1 )
return 0;
else if ( level <= Level2 )
if ( level <= Level2 )
return 1;
else if ( level <= Level3 )
if ( level <= Level3 )
return 2;
return 3;

View file

@ -121,34 +121,32 @@ namespace Server.Engines.Chat
user.SendMessage( 46, m_Name ); // You are already in the conference '%1'.
return true;
}
else if ( IsBanned( user ) )
if ( IsBanned( user ) )
{
user.SendMessage( 64 ); // You have been banned from this conference.
return false;
}
else if ( !ValidatePassword( password ) )
if ( !ValidatePassword( password ) )
{
user.SendMessage( 34 ); // That is not the correct password.
return false;
}
else
{
user.CurrentChannel?.RemoveUser( user ); // Remove them from their current channel first
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.JoinedChannel, m_Name );
SendCommand( ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
m_Users.Add( user );
user.CurrentChannel = this;
if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!m_AlwaysAvailable && m_Users.Count == 1) )
AddModerator( user );
SendUsersTo( user );
return true;
}
user.CurrentChannel?.RemoveUser( user ); // Remove them from their current channel first
ChatSystem.SendCommandTo( user.Mobile, ChatCommand.JoinedChannel, m_Name );
SendCommand( ChatCommand.AddUserToChannel, user.GetColorCharacter() + user.Username );
m_Users.Add( user );
user.CurrentChannel = this;
if ( user.Mobile.AccessLevel >= AccessLevel.GameMaster || (!m_AlwaysAvailable && m_Users.Count == 1) )
AddModerator( user );
SendUsersTo( user );
return true;
}
public void RemoveUser( ChatUser user )

View file

@ -153,7 +153,8 @@ namespace Server.Engines.ConPVP
ie.Refresh();
return;
}
else if ( ie.Expired )
if ( ie.Expired )
{
list.RemoveAt( i-- );
}

View file

@ -821,9 +821,9 @@ namespace Server.Engines.ConPVP
if ( a == null && b == null )
return 0;
else if ( a == null )
if ( a == null )
return -1;
else if ( b == null )
if ( b == null )
return +1;
return a.CompareTo( b );

View file

@ -44,21 +44,19 @@ namespace Server.Engines.ConPVP
from.SendMessage( 0x22, "You have recently been in combat with another player and cannot use this moongate." );
return false;
}
else if ( from.Spell != null )
if ( from.Spell != null )
{
from.SendLocalizedMessage( 1049616 ); // You are too busy to do that at the moment.
return false;
}
else
{
from.CloseGump( typeof( ArenaGump ) );
from.SendGump( new ArenaGump( from, this ) );
from.CloseGump( typeof( ArenaGump ) );
from.SendGump( new ArenaGump( from, this ) );
if ( !from.Hidden || from.AccessLevel == AccessLevel.Player )
Effects.PlaySound( from.Location, from.Map, 0x20E );
if ( !from.Hidden || from.AccessLevel == AccessLevel.Player )
Effects.PlaySound( from.Location, from.Map, 0x20E );
return true;
}
return true;
}
public override void OnDoubleClick( Mobile from )
@ -288,4 +286,4 @@ namespace Server.Engines.ConPVP
m_ColumnX += width;
}
}
}
}

View file

@ -851,7 +851,7 @@ namespace Server.Engines.ConPVP
}
if ( hasWinner )
return winner == null ? (Participant) m_Participants[0] : winner;
return winner ?? (Participant) m_Participants[0];
return null;
}
@ -1851,11 +1851,11 @@ namespace Server.Engines.ConPVP
pack.DropItem( item );
if ( item is BaseWeapon )
mob.SendLocalizedMessage( 1062001, item.Name == null ? "#" + item.LabelNumber.ToString() : item.Name ); // You can no longer wield your ~1_WEAPON~
mob.SendLocalizedMessage( 1062001, item.Name ?? "#" + item.LabelNumber.ToString() ); // You can no longer wield your ~1_WEAPON~
else if ( item is BaseArmor && !(item is BaseShield) )
mob.SendLocalizedMessage( 1062002, item.Name == null ? "#" + item.LabelNumber.ToString() : item.Name ); // You can no longer wear your ~1_ARMOR~
mob.SendLocalizedMessage( 1062002, item.Name ?? "#" + item.LabelNumber.ToString() ); // You can no longer wear your ~1_ARMOR~
else
mob.SendLocalizedMessage( 1062003, item.Name == null ? "#" + item.LabelNumber.ToString() : item.Name ); // You can no longer equip your ~1_SHIELD~
mob.SendLocalizedMessage( 1062003, item.Name ?? "#" + item.LabelNumber.ToString() ); // You can no longer equip your ~1_SHIELD~
}
}
@ -2080,7 +2080,7 @@ namespace Server.Engines.ConPVP
if ( entry.Mobile == mob )
return entry;
else if ( entry.Expired )
if ( entry.Expired )
m_Entries.RemoveAt( i-- );
}
@ -2105,11 +2105,9 @@ namespace Server.Engines.ConPVP
return false;
}
else
{
m.SendLocalizedMessage( 1049383 ); // The teleporter doesn't seem to work for you.
return true;
}
m.SendLocalizedMessage( 1049383 ); // The teleporter doesn't seem to work for you.
return true;
}
public ExitTeleporter( Serial serial ) : base( serial )
@ -2319,8 +2317,7 @@ namespace Server.Engines.ConPVP
{
if ( m_Tournament == null )
return $"{dp.Mobile.Name} is dead";
else
dp.Mobile.Resurrect();
dp.Mobile.Resurrect();
}
if ( m_Tournament == null && CheckCombat( dp.Mobile ) )

View file

@ -778,10 +778,8 @@ namespace Server.Engines.ConPVP
return true;
}
else
{
return false;
}
return false;
}
}
@ -1158,9 +1156,6 @@ namespace Server.Engines.ConPVP
AddBorderedText( 235 + 15, 105 + ( i * 75 ), 250, 20, pl.Player.Name, 0xFFC000, BlackColor32 );
}
}
else
{
}
AddButton( 314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0 );
}
@ -1402,8 +1397,7 @@ namespace Server.Engines.ConPVP
{
if ( m_Name != null )
return $"({Name}) ...";
else
return "...";
return "...";
}
}

View file

@ -218,9 +218,6 @@ namespace Server.Engines.ConPVP
AddBorderedText( 235 + 15, 105 + ( i * 75 ), 250, 20, pl.Player.Name, 0xFFC000, BlackColor32 );
}
}
else
{
}
AddButton( 314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0 );
}
@ -449,7 +446,7 @@ namespace Server.Engines.ConPVP
else if ( passTeam == useTeam && passTo.PlaceInBackpack( this ) )
{
passTo.LocalOverheadMessage( MessageType.Regular, 0x59, false,
$"{@from.Name} has passed you the cookies!");
$"{from.Name} has passed you the cookies!");
}
else
{
@ -496,7 +493,7 @@ namespace Server.Engines.ConPVP
Mobile mob = FindOwner( parent );
if ( mob != null )
mob.SolidHueOverride = ( m_TeamInfo == null ? -1 : m_TeamInfo.Game.GetColor( mob ) );
mob.SolidHueOverride = m_TeamInfo?.Game.GetColor( mob ) ?? -1;
}
public CTFFlag( Serial serial )

View file

@ -214,9 +214,6 @@ namespace Server.Engines.ConPVP
AddBorderedText( 235 + 15, 105 + ( i * 75 ), 250, 20, pl.Player.Name, 0xFFC000, BlackColor32 );
}
}
else
{
}
AddButton( 314, height - 42, 247, 248, 1, GumpButtonType.Reply, 0 );
}

View file

@ -83,10 +83,9 @@ namespace Server.Engines.ConPVP
{
get
{
if (m_KingTimer != null)
if (m_KingTimer != null)
return m_KingTimer.Captures;
else
return 0;
return 0;
}
}
@ -136,17 +135,15 @@ namespace Server.Engines.ConPVP
public override bool OnMoveOff(Mobile m)
{
if (base.OnMoveOff(m))
if (base.OnMoveOff(m))
{
if (m_King == m)
DeKingify();
return true;
}
else
{
return false;
}
return false;
}
public virtual void OnKingDied(Mobile king, KHTeamInfo kingTeam, Mobile killer, KHTeamInfo killerTeam)
@ -725,10 +722,9 @@ namespace Server.Engines.ConPVP
public override string ToString()
{
if (m_Name != null)
if (m_Name != null)
return $"({Name}) ...";
else
return "...";
return "...";
}
}

View file

@ -88,9 +88,9 @@ namespace Server.Engines.ConPVP
{
if ( xp >= 22500 )
return 50;
else if ( xp >= 2500 )
if ( xp >= 2500 )
return (10 + ((xp - 2500) / 500));
else if ( xp < 0 )
if ( xp < 0 )
xp = 0;
return m_ShortLevels[xp / 100];

View file

@ -601,7 +601,7 @@ namespace Server.Engines.ConPVP
case TournamentStage.Inactive:
{
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
0x35, false, "The tournament is closed.", @from.NetState );
0x35, false, "The tournament is closed.", from.NetState );
break;
}
@ -610,7 +610,7 @@ namespace Server.Engines.ConPVP
if ( m_Players.Count != tourny.PlayersPerParticipant )
{
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
0x35, false, "You have not yet chosen your team.", @from.NetState );
0x35, false, "You have not yet chosen your team.", from.NetState );
m_From.SendGump( new ConfirmSignupGump( m_From, m_Registrar, m_Tournament, m_Players ) );
break;
@ -818,7 +818,7 @@ namespace Server.Engines.ConPVP
m_Registrar?.PrivateOverheadMessage( MessageType.Regular,
0x59, false,
$"As you command m'{(@from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.", from.NetState );
$"As you command m'{(from.Female ? "Lady" : "Lord")}. I've given your offer to {mob.Name}.", from.NetState );
}
}
}
@ -961,7 +961,7 @@ namespace Server.Engines.ConPVP
AddBorderedText( 22, 22, 294, 20, Center( sb.ToString() ), LabelColor32, BlackColor32 );
AddBorderedText( 22, 50, 294, 40,
$"You have been asked to partner with {@from.Name} in a tournament. Do you accept?",
$"You have been asked to partner with {from.Name} in a tournament. Do you accept?",
0xB0C868, BlackColor32 );
AddImageTiled( 32, 88, 264, 1, 9107 );
@ -1157,7 +1157,7 @@ namespace Server.Engines.ConPVP
0x59, false, $"{mob.Name} has accepted your offer of partnership.", from.NetState );
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x59, false, $"You have accepted the partnership with {@from.Name}.", mob.NetState );
0x59, false, $"You have accepted the partnership with {from.Name}.", mob.NetState );
}
}
}
@ -1174,7 +1174,7 @@ namespace Server.Engines.ConPVP
0x22, false, $"{mob.Name} has declined your offer of partnership.", from.NetState );
m_Registrar.PrivateOverheadMessage( MessageType.Regular,
0x22, false, $"You have declined the partnership with {@from.Name}.", mob.NetState );
0x22, false, $"You have declined the partnership with {from.Name}.", mob.NetState );
}
}
}
@ -3133,8 +3133,8 @@ namespace Server.Engines.ConPVP
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}", false, false );
AddHtml( 25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}", false, false );
AddHtml( 25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}", false, false );
AddHtml( 25, 133, 250, 20, $"Wins: {(entry == null ? 0 : entry.Wins):N0}", false, false );
AddHtml( 25, 153, 250, 20, $"Losses: {(entry == null ? 0 : entry.Losses):N0}", false, false );
AddHtml( 25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}", false, false );
AddHtml( 25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}", false, false );
break;
}

View file

@ -152,7 +152,7 @@ namespace Server.Engines.Craft
string nameString = craftSystem.CraftSubRes2.NameString;
int nameNumber = craftSystem.CraftSubRes2.NameNumber;
int resIndex = ( context == null ? -1 : context.LastResourceIndex2 );
int resIndex = context?.LastResourceIndex2 ?? -1;
Type resourceType = craftSystem.CraftSubRes2.ResType;
@ -481,7 +481,7 @@ namespace Server.Engines.Craft
{
if ( m_Page == CraftPage.PickResource && index >= 0 && index < system.CraftSubRes.Count )
{
int groupIndex = ( context == null ? -1 : context.LastGroupIndex );
int groupIndex = context?.LastGroupIndex ?? -1;
CraftSubRes res = system.CraftSubRes.GetAt( index );
@ -499,7 +499,7 @@ namespace Server.Engines.Craft
}
else if ( m_Page == CraftPage.PickResource2 && index >= 0 && index < system.CraftSubRes2.Count )
{
int groupIndex = ( context == null ? -1 : context.LastGroupIndex );
int groupIndex = context?.LastGroupIndex ?? -1;
CraftSubRes res = system.CraftSubRes2.GetAt( index );

View file

@ -246,30 +246,24 @@ namespace Server.Engines.Craft
message = "You lack the required hit points to make that.";
return false;
}
else
{
consumHits = consume;
}
consumHits = consume;
if ( Mana > 0 && from.Mana < Mana )
{
message = "You lack the required mana to make that.";
return false;
}
else
{
consumMana = consume;
}
consumMana = consume;
if ( Stam > 0 && from.Stam < Stam )
{
message = "You lack the required stamina to make that.";
return false;
}
else
{
consumStam = consume;
}
consumStam = consume;
if ( consumMana )
from.Mana -= Mana;
@ -786,7 +780,7 @@ namespace Server.Engines.Craft
return true;
}
else
{
CraftRes res = m_arCraftRes.GetAt( index );

View file

@ -49,7 +49,7 @@ namespace Server.Engines.Craft
private int GetWeakenChance( Mobile mob, SkillName skill, int curHits, int maxHits )
{
// 40% - (1% per hp lost) - (1% per 10 craft skill)
return (40 + (maxHits - curHits)) - (int)(((m_Deed != null)? m_Deed.SkillLevel : mob.Skills[skill].Value) / 10);
return (40 + (maxHits - curHits)) - (int)((m_Deed?.SkillLevel ?? mob.Skills[skill].Value) / 10);
}
private bool CheckWeaken( Mobile mob, SkillName skill, int curHits, int maxHits )
@ -75,17 +75,15 @@ namespace Server.Engines.Craft
if ( value < minSkill )
return false; // Too difficult
else if ( value >= maxSkill )
if ( value >= maxSkill )
return true; // No challenge
double chance = (value - minSkill) / (maxSkill - minSkill);
return (chance >= Utility.RandomDouble());
}
else
{
return mob.CheckSkill( skill, difficulty - 25.0, difficulty + 25.0 );
}
return mob.CheckSkill( skill, difficulty - 25.0, difficulty + 25.0 );
}
private bool CheckDeed( Mobile from )
@ -126,39 +124,41 @@ namespace Server.Engines.Craft
|| ( weapon is ButcherKnife )
|| ( weapon is SkinningKnife );
}
else if ( m_CraftSystem is DefCarpentry )
if ( m_CraftSystem is DefCarpentry )
{
return ( weapon is Club )
|| ( weapon is BlackStaff )
|| ( weapon is MagicWand )
#region Temporary
// TODO: Make these items craftable
|| ( weapon is WildStaff );
|| ( weapon is BlackStaff )
|| ( weapon is MagicWand )
#region Temporary
// TODO: Make these items craftable
|| ( weapon is WildStaff );
#endregion
}
else if ( m_CraftSystem is DefBlacksmithy )
if ( m_CraftSystem is DefBlacksmithy )
{
return ( weapon is Pitchfork )
#region Temporary
// TODO: Make these items craftable
|| ( weapon is RadiantScimitar )
|| ( weapon is WarCleaver )
|| ( weapon is ElvenSpellblade )
|| ( weapon is AssassinSpike )
|| ( weapon is Leafblade )
|| ( weapon is RuneBlade )
|| ( weapon is ElvenMachete )
|| ( weapon is OrnateAxe )
|| ( weapon is DiamondMace );
#region Temporary
// TODO: Make these items craftable
|| ( weapon is RadiantScimitar )
|| ( weapon is WarCleaver )
|| ( weapon is ElvenSpellblade )
|| ( weapon is AssassinSpike )
|| ( weapon is Leafblade )
|| ( weapon is RuneBlade )
|| ( weapon is ElvenMachete )
|| ( weapon is OrnateAxe )
|| ( weapon is DiamondMace );
#endregion
}
#region Temporary
// TODO: Make these items craftable
else if ( m_CraftSystem is DefBowFletching )
if ( m_CraftSystem is DefBowFletching )
{
return ( weapon is ElvenCompositeLongbow )
|| ( weapon is MagicalShortbow );
|| ( weapon is MagicalShortbow );
}
#endregion
return false;
@ -184,23 +184,25 @@ namespace Server.Engines.Craft
|| ( armor is HidePants )
|| ( armor is HidePauldrons );
}
else if ( m_CraftSystem is DefCarpentry )
if ( m_CraftSystem is DefCarpentry )
{
return ( armor is WingedHelm )
|| ( armor is RavenHelm )
|| ( armor is VultureHelm )
|| ( armor is WoodlandArms )
|| ( armor is WoodlandChest )
|| ( armor is WoodlandGloves )
|| ( armor is WoodlandGorget )
|| ( armor is WoodlandLegs );
|| ( armor is RavenHelm )
|| ( armor is VultureHelm )
|| ( armor is WoodlandArms )
|| ( armor is WoodlandChest )
|| ( armor is WoodlandGloves )
|| ( armor is WoodlandGorget )
|| ( armor is WoodlandLegs );
}
else if ( m_CraftSystem is DefBlacksmithy )
if ( m_CraftSystem is DefBlacksmithy )
{
return ( armor is Circlet )
|| ( armor is RoyalCirclet )
|| ( armor is GemmedCirclet );
|| ( armor is RoyalCirclet )
|| ( armor is GemmedCirclet );
}
#endregion
return false;

View file

@ -35,7 +35,7 @@ namespace Server.Engines.Craft
{
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckAccessible( tool, from ) )
if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
return 0;
@ -65,27 +65,20 @@ namespace Server.Engines.Craft
from.AddToBackpack( new Bottle() );
return 500287; // You fail to create a useful potion.
}
else
{
return 1044043; // You failed to create the item, and some of your materials are lost.
}
}
else
{
from.PlaySound( 0x240 ); // Sound of a filling bottle
if ( IsPotion( item.ItemType ) )
{
if ( quality == -1 )
return 1048136; // You create the potion and pour it into a keg.
else
return 500279; // You pour the potion into a bottle...
}
else
{
return 1044154; // You create the item.
}
return 1044043; // You failed to create the item, and some of your materials are lost.
}
from.PlaySound( 0x240 ); // Sound of a filling bottle
if ( IsPotion( item.ItemType ) )
{
if ( quality == -1 )
return 1048136; // You create the potion and pour it into a keg.
return 500279; // You pour the potion into a bottle...
}
return 1044154; // You create the item.
}
public override void InitCraftList()

View file

@ -112,9 +112,9 @@ namespace Server.Engines.Craft
{
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckTool( tool, from ) )
if ( !BaseTool.CheckTool( tool, from ) )
return 1048146; // If you have a tool equipped, you must use that tool.
else if ( !BaseTool.CheckAccessible( tool, from ) )
if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
bool anvil, forge;
@ -161,20 +161,16 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override void InitCraftList()

View file

@ -35,7 +35,7 @@ namespace Server.Engines.Craft
{
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckAccessible( tool, from ) )
if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
return 0;
@ -59,20 +59,16 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override CraftECA ECA => CraftECA.FiftyPercentChanceMinusTenPercent;

View file

@ -35,7 +35,7 @@ namespace Server.Engines.Craft
{
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckAccessible( tool, from ) )
if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
return 0;
@ -59,20 +59,16 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override void InitCraftList()

View file

@ -35,7 +35,7 @@ namespace Server.Engines.Craft
{
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckAccessible( tool, from ) )
if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
return 0;
@ -55,20 +55,16 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override void InitCraftList()

View file

@ -37,7 +37,7 @@ namespace Server.Engines.Craft
{
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckAccessible( tool, from ) )
if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
return 0;
@ -56,20 +56,16 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override void InitCraftList()

View file

@ -91,22 +91,18 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
from.PlaySound( 0x41 ); // glass breaking
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
}
from.PlaySound( 0x41 ); // glass breaking
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override void InitCraftList()

View file

@ -82,28 +82,21 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
else
{
if ( failed )
return 501630; // You fail to inscribe the scroll, and the scroll is ruined.
else
return 501629; // You inscribe the spell and put the scroll in your backpack.
}
if ( failed )
return 501630; // You fail to inscribe the scroll, and the scroll is ruined.
return 501629; // You inscribe the spell and put the scroll in your backpack.
}
private int m_Circle, m_Mana;

View file

@ -84,20 +84,16 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override void InitCraftList()

View file

@ -37,7 +37,7 @@ namespace Server.Engines.Craft
{
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckAccessible( tool, from ) )
if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
return 0;
@ -79,20 +79,16 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override void InitCraftList()

View file

@ -40,9 +40,9 @@ namespace Server.Engines.Craft
{
if ( tool == null || tool.Deleted || tool.UsesRemaining < 0 )
return 1044038; // You have worn out your tool!
else if ( !BaseTool.CheckAccessible( tool, from ) )
if ( !BaseTool.CheckAccessible( tool, from ) )
return 1044263; // The tool must be on your person to use.
else if ( itemType != null && ( itemType.IsSubclassOf( typeof( BaseFactionTrapDeed ) ) || itemType == typeof( FactionTrapRemovalKit ) ) && Faction.Find( from ) == null )
if ( itemType != null && ( itemType.IsSubclassOf( typeof( BaseFactionTrapDeed ) ) || itemType == typeof( FactionTrapRemovalKit ) ) && Faction.Find( from ) == null )
return 1044573; // You have to be in a faction to do that.
return 0;
@ -91,20 +91,16 @@ namespace Server.Engines.Craft
{
if ( lostMaterial )
return 1044043; // You failed to create the item, and some of your materials are lost.
else
return 1044157; // You failed to create the item, but no materials were lost.
}
else
{
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
else if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
else if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
else
return 1044154; // You create the item.
return 1044157; // You failed to create the item, but no materials were lost.
}
if ( quality == 0 )
return 502785; // You were barely able to make this item. It's quality is below average.
if ( makersMark && quality == 2 )
return 1044156; // You create an exceptional quality item and affix your maker's mark.
if ( quality == 2 )
return 1044155; // You create an exceptional quality item.
return 1044154; // You create the item.
}
public override bool ConsumeOnFailure( Mobile from, Type resourceType, CraftItem craftItem )
@ -417,11 +413,9 @@ namespace Server.Engines.Craft
{
return false;
}
else
{
m_Container = container;
return true;
}
m_Container = container;
return true;
}
public override void EndCraftAction()

View file

@ -1014,7 +1014,7 @@ namespace Server.Factions
if ( pack != null )
{
Container killerPack = ( killer == null ? null : killer.Backpack );
Container killerPack = killer?.Backpack;
Item[] sigils = pack.FindItemsByType( typeof( Sigil ) );
for ( int i = 0; i < sigils.Length; ++i )

View file

@ -59,7 +59,8 @@ namespace Server.Factions
ps.IsActive = false;
continue;
}
else if ( ps.KillPoints > 0 )
if ( ps.KillPoints > 0 )
{
int atrophy = ( ps.KillPoints + 9 ) / 10;
ps.KillPoints -= atrophy;

View file

@ -143,7 +143,7 @@ namespace Server.Factions
{
Faction faction = Faction.Find( from );
faction?.BeginHonorLeadership( @from );
faction?.BeginHonorLeadership( from );
break;
}

View file

@ -21,11 +21,9 @@ namespace Server.Factions
index = offset / ButtonTypes;
return true;
}
else
{
type = index = 0;
return false;
}
type = index = 0;
return false;
}
public static bool Exists( Mobile mob )

View file

@ -128,10 +128,10 @@ namespace Server.Factions
AddHtml( 120, 100, 150, 20, from.Name, false, false );
AddHtmlLocalized( 20, 130, 100, 20, 1018064, false, false ); // score :
AddHtml( 120, 130, 100, 20, (pl != null ? pl.KillPoints : 0).ToString(), false, false );
AddHtml( 120, 130, 100, 20, (pl?.KillPoints ?? 0).ToString(), false, false );
AddHtmlLocalized( 20, 160, 100, 20, 1011446, false, false ); // Rank :
AddHtml( 120, 160, 100, 20, (pl != null ? pl.Rank.Rank : 0).ToString(), false, false );
AddHtml( 120, 160, 100, 20, (pl?.Rank.Rank ?? 0).ToString(), false, false );
AddHtmlLocalized( 55, 250, 100, 20, 1011447, false, false ); // BACK
AddButton( 20, 250, 4005, 4007, 0, GumpButtonType.Page, 1 );

View file

@ -118,7 +118,8 @@ namespace Server.Factions
from.SendLocalizedMessage( 1010339 ); // You no longer control this city
return;
}
else if ( m_Town.Sheriff != null )
if ( m_Town.Sheriff != null )
{
from.SendLocalizedMessage( 1010342 ); // You must fire your Sheriff before you can elect a new one
}

View file

@ -47,7 +47,7 @@ namespace Server.Factions
set
{
m_Faction = value;
Hue = ( m_Faction == null ? 0 : m_Faction.Definition.HuePrimary );
Hue = m_Faction?.Definition.HuePrimary ?? 0;
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Factions
{
m_Faction = value;
AssignName( m_Faction == null ? null : m_Faction.Definition.FactionStoneName );
AssignName( m_Faction?.Definition.FactionStoneName );
}
}

View file

@ -15,8 +15,8 @@ namespace Server.Factions
{
m_Faction = value;
Hue = ( m_Faction == null ? 0 : m_Faction.Definition.HueJoin );
AssignName( m_Faction == null ? null : m_Faction.Definition.SignupName );
Hue = m_Faction?.Definition.HueJoin ?? 0;
AssignName( m_Faction?.Definition.SignupName );
}
}

View file

@ -30,11 +30,11 @@ namespace Server {
from.AddStatMod( new StatMod( StatType.All, "blood-rose", amount, TimeSpan.FromMinutes( time ) ) );
return true;
} else {
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
return false;
}
from.SendLocalizedMessage( 1062927 ); // You have eaten one of these recently and eating another would provide no benefit.
return false;
}
public override void Serialize( GenericWriter writer ) {
@ -49,4 +49,4 @@ namespace Server {
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -73,7 +73,8 @@ namespace Server {
weight = Utility.Random( weight );
foreach ( WeightedItem item in _items ) {
foreach ( WeightedItem item in _items )
{
if ( weight < item.Weight ) {
Item obj = item.Construct();
@ -95,9 +96,9 @@ namespace Server {
}
break;
} else {
weight -= item.Weight;
}
weight -= item.Weight;
}
}
}

View file

@ -103,7 +103,7 @@ namespace Server.Factions
public void Update()
{
ItemID = ( m_Town == null ? 0x1869 : m_Town.Definition.SigilID );
ItemID = m_Town?.Definition.SigilID ?? 0x1869;
if ( m_Town == null )
AssignName( null );

View file

@ -29,10 +29,9 @@ namespace Server.Factions
{
if ( Amount <= 1 )
return 0x2E4;
else if ( Amount <= 5 )
if ( Amount <= 5 )
return 0x2E5;
else
return 0x2E6;
return 0x2E6;
}
public override void Serialize( GenericWriter writer )

View file

@ -6,7 +6,7 @@ namespace Server.Factions
public override void OnTownChanged()
{
AssignName( Town == null ? null : Town.Definition.StrongholdMonolithName );
AssignName( Town?.Definition.StrongholdMonolithName );
}
public StrongholdMonolith() : this( null, null )

View file

@ -6,7 +6,7 @@ namespace Server.Factions
public override void OnTownChanged()
{
AssignName( Town == null ? null : Town.Definition.TownMonolithName );
AssignName( Town?.Definition.TownMonolithName );
}
public TownMonolith() : this( null )

View file

@ -14,7 +14,7 @@ namespace Server.Factions
{
m_Town = value;
AssignName( m_Town == null ? null : m_Town.Definition.TownStoneName );
AssignName( m_Town?.Definition.TownStoneName );
}
}

View file

@ -93,7 +93,7 @@ namespace Server.Factions
if ( from.Alive )
m_Placer.SendMessage( "You have earned {0} silver pieces because {1} fell for your trap.", silverGiven, from.Name );
else
m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{@from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
m_Placer.SendLocalizedMessage( 1042736, $"{silverGiven} silver\t{from.Name}"); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~!
}
victimState.OnGivenSilverTo( m_Placer );

View file

@ -15,8 +15,8 @@ namespace Server.Factions
{
m_Faction = value;
Body = ( m_Faction == null ? 0xE2 : m_Faction.Definition.WarHorseBody );
ItemID = ( m_Faction == null ? 0x3EA0 : m_Faction.Definition.WarHorseItem );
Body = m_Faction?.Definition.WarHorseBody ?? 0xE2;
ItemID = m_Faction?.Definition.WarHorseItem ?? 0x3EA0;
}
}

View file

@ -310,45 +310,43 @@ namespace Server.Factions
return active;
}
else
Map map = m_Mobile.Map;
if ( map != null )
{
Map map = m_Mobile.Map;
Mobile active = null, inactive = null;
double actPrio = 0.0, inactPrio = 0.0;
if ( map != null )
Mobile comb = m_Mobile.Combatant;
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
{
Mobile active = null, inactive = null;
double actPrio = 0.0, inactPrio = 0.0;
active = inactive = comb;
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
}
Mobile comb = m_Mobile.Combatant;
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
foreach ( Mobile m in m_Mobile.GetMobilesInRange( 12 ) )
{
if ( m != m_Mobile && CanDispel( m ) )
{
active = inactive = comb;
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
}
double prio = m_Mobile.GetDistanceToSqrt( m );
foreach ( Mobile m in m_Mobile.GetMobilesInRange( 12 ) )
{
if ( m != m_Mobile && CanDispel( m ) )
if ( !activeOnly && (inactive == null || prio < inactPrio) )
{
double prio = m_Mobile.GetDistanceToSqrt( m );
inactive = m;
inactPrio = prio;
}
if ( !activeOnly && (inactive == null || prio < inactPrio) )
{
inactive = m;
inactPrio = prio;
}
if ( (m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio) )
{
active = m;
actPrio = prio;
}
if ( (m_Mobile.Combatant == m || m.Combatant == m_Mobile) && (active == null || prio < actPrio) )
{
active = m;
actPrio = prio;
}
}
return active != null ? active : inactive;
}
return active ?? inactive;
}
return null;
@ -473,7 +471,7 @@ namespace Server.Factions
{
Target targ = m_Guard.Target;
Mobile toHarm = ( dispelTarget == null ? combatant : dispelTarget );
Mobile toHarm = dispelTarget ?? combatant;
if ( (targ.Flags & TargetFlags.Harmful) != 0 && toHarm != null )
{

View file

@ -225,15 +225,13 @@ namespace Server.Engines.Harvest
return contains;
}
else
{
int dist = -1;
for ( int i = 0; dist < 0 && i < m_Tiles.Length; ++i )
dist = ( m_Tiles[i] - tileID );
int dist = -1;
return ( dist == 0 );
}
for ( int i = 0; dist < 0 && i < m_Tiles.Length; ++i )
dist = ( m_Tiles[i] - tileID );
return ( dist == 0 );
}
}
}

View file

@ -107,7 +107,8 @@ namespace Server.Engines.Harvest
OnBadHarvestTarget( from, tool, toHarvest );
return;
}
else if ( !def.Validate( tileID ) )
if ( !def.Validate( tileID ) )
{
OnBadHarvestTarget( from, tool, toHarvest );
return;
@ -115,9 +116,9 @@ namespace Server.Engines.Harvest
if ( !CheckRange( from, tool, def, map, loc, true ) )
return;
else if ( !CheckResources( from, tool, def, map, loc, true ) )
if ( !CheckResources( from, tool, def, map, loc, true ) )
return;
else if ( !CheckHarvest( from, tool, def, toHarvest ) )
if ( !CheckHarvest( from, tool, def, toHarvest ) )
return;
if ( SpecialHarvest( from, tool, def, map, loc ) )
@ -341,23 +342,24 @@ namespace Server.Engines.Harvest
OnBadHarvestTarget( from, tool, toHarvest );
return false;
}
else if ( !def.Validate( tileID ) )
if ( !def.Validate( tileID ) )
{
from.EndAction( locked );
OnBadHarvestTarget( from, tool, toHarvest );
return false;
}
else if ( !CheckRange( from, tool, def, map, loc, true ) )
if ( !CheckRange( from, tool, def, map, loc, true ) )
{
from.EndAction( locked );
return false;
}
else if ( !CheckResources( from, tool, def, map, loc, true ) )
if ( !CheckResources( from, tool, def, map, loc, true ) )
{
from.EndAction( locked );
return false;
}
else if ( !CheckHarvest( from, tool, def, toHarvest ) )
if ( !CheckHarvest( from, tool, def, toHarvest ) )
{
from.EndAction( locked );
return false;
@ -424,9 +426,9 @@ namespace Server.Engines.Harvest
if ( !CheckRange( from, tool, def, map, loc, false ) )
return;
else if ( !CheckResources( from, tool, def, map, loc, false ) )
if ( !CheckResources( from, tool, def, map, loc, false ) )
return;
else if ( !CheckHarvest( from, tool, def, toHarvest ) )
if ( !CheckHarvest( from, tool, def, toHarvest ) )
return;
object toLock = GetLock( from, tool, def, toHarvest );

View file

@ -206,7 +206,8 @@ namespace Server.Engines.Harvest
from.SendLocalizedMessage( 501864 ); // You can't mine while riding.
return false;
}
else if ( from.IsBodyMod && !from.Body.IsHuman )
if ( from.IsBodyMod && !from.Body.IsHuman )
{
from.SendLocalizedMessage( 501865 ); // You can't mine while polymorphed.
return false;

View file

@ -183,10 +183,9 @@ namespace Server.Engines.Help
{
if ( type == PageType.VerbalHarassment )
return "Verbal Harassment";
else if ( type == PageType.PhysicalHarassment )
if ( type == PageType.PhysicalHarassment )
return "Physical Harassment";
else
return type.ToString();
return type.ToString();
}
public static void OnHandlerChanged( Mobile old, Mobile value, PageEntry entry )

View file

@ -21,7 +21,7 @@ namespace Server.Engines.Help
AddHtmlLocalized( 150, 40, 360, 40, 1062610, false, false ); // <CENTER><U>Ultima Online Help Response</U></CENTER>
AddHtml( 80, 90, 480, 290, $"{name} tells {@from.Name}: {text}", true, true );
AddHtml( 80, 90, 480, 290, $"{name} tells {from.Name}: {text}", true, true );
AddHtmlLocalized( 80, 390, 480, 40, 1062611, false, false ); // Clicking the OKAY button will remove the reponse you have received.
AddButton( 400, 417, 2074, 2075, 1, GumpButtonType.Reply, 0 ); // OKAY

View file

@ -256,10 +256,8 @@ namespace Server.Items
return true;
}
else
{
return false;
}
return false;
}
public PuzzleChestSolutionAndTime GetLastGuess( Mobile m )

View file

@ -236,7 +236,8 @@ namespace Server.Engines.MLQuests
return false;
}
else if ( nextAvailable > DateTime.UtcNow )
if ( nextAvailable > DateTime.UtcNow )
{
if ( message )
MLQuestSystem.Tell( quester, pm, 1075575 ); // I'm sorry, but I don't have anything else for you right now. Could you check back with me in a few minutes?

View file

@ -36,7 +36,7 @@ namespace Server.Engines.MLQuests
m_Quest = quest;
m_Quester = quester;
m_QuesterType = ( quester == null ) ? null : quester.GetType();
m_QuesterType = quester?.GetType();
m_Player = player;
m_Accepted = DateTime.UtcNow;
@ -91,7 +91,7 @@ namespace Server.Engines.MLQuests
set
{
m_Quester = value;
m_QuesterType = ( value == null ) ? null : value.GetType();
m_QuesterType = value?.GetType();
}
}
@ -156,7 +156,7 @@ namespace Server.Engines.MLQuests
if ( complete && !requiresAll )
return true;
else if ( !complete && requiresAll )
if ( !complete && requiresAll )
return false;
}
@ -369,7 +369,7 @@ namespace Server.Engines.MLQuests
foreach ( Item rewardItem in rewards )
{
string rewardName = ( rewardItem.Name != null ) ? rewardItem.Name : string.Concat( "#", rewardItem.LabelNumber );
string rewardName = rewardItem.Name ?? string.Concat( "#", rewardItem.LabelNumber );
if ( rewardItem.Stackable )
m_Player.SendLocalizedMessage( 1115917, string.Concat( rewardItem.Amount, "\t", rewardName ) ); // You receive a reward: ~1_QUANTITY~ ~2_ITEM~

View file

@ -376,7 +376,7 @@ namespace Server.Engines.MLQuests
if ( entry.Failed )
return; // Note: OSI sends no gump at all for failed quests, they have to be cancelled in the quest overview
else if ( entry.ClaimReward )
if ( entry.ClaimReward )
entry.SendRewardOffer();
else if ( entry.IsCompleted() )
entry.SendReportBackGump();

View file

@ -65,8 +65,7 @@ namespace Server.Engines.MLQuests.Objectives
{
if ( label < 1078872 )
return ( label - 1020000 );
else
return ( label - 1078872 );
return ( label - 1078872 );
}
public override void WriteToGump( Gump g, ref int y )

View file

@ -119,55 +119,53 @@ namespace Server.Engines.MyRunUO
return;
}
else
try
{
connected = true;
connection = new OdbcConnection( m_ConnectionString );
connection.Open();
command = connection.CreateCommand();
if ( Config.UseTransactions )
{
transact = connection.BeginTransaction();
command.Transaction = transact;
}
}
catch ( Exception e )
{
try
{
connected = true;
connection = new OdbcConnection( m_ConnectionString );
connection.Open();
command = connection.CreateCommand();
if ( Config.UseTransactions )
{
transact = connection.BeginTransaction();
command.Transaction = transact;
}
transact?.Rollback();
}
catch ( Exception e )
catch{}
try
{
try
{
transact?.Rollback();
}
catch{}
try
{
connection?.Close();
}
catch{}
try
{
connection?.Dispose();
}
catch{}
try
{
command?.Dispose();
}
catch{}
try{ m_Sync.Close(); }
catch{}
Console.WriteLine( "MyRunUO: Unable to connect to the database" );
Console.WriteLine( e );
m_HasCompleted = true;
return;
connection?.Close();
}
catch{}
try
{
connection?.Dispose();
}
catch{}
try
{
command?.Dispose();
}
catch{}
try{ m_Sync.Close(); }
catch{}
Console.WriteLine( "MyRunUO: Unable to connect to the database" );
Console.WriteLine( e );
m_HasCompleted = true;
return;
}
}
else if ( obj is string s )

View file

@ -129,7 +129,7 @@ namespace Server.Engines.PartySystem
Mobile from = e.Mobile;
Party p = Get( from );
p?.Remove( @from );
p?.Remove( from );
from.Party = null;
}

View file

@ -381,10 +381,8 @@ namespace Server.Engines.Plants
return;
}
else
{
m_Plant.LabelTo( from, message );
}
m_Plant.LabelTo( from, message );
}
from.SendGump( new MainPlantGump( m_Plant ) );

View file

@ -331,7 +331,8 @@ namespace Server.Items
item.MoveToWorld( new Point3D( x, y, Location.Z ), Map );
return true;
}
else if ( Map.CanFit( x, y, z, 1 ) )
if ( Map.CanFit( x, y, z, 1 ) )
{
item.MoveToWorld( new Point3D( x, y, z ), Map );
return true;
@ -355,7 +356,8 @@ namespace Server.Items
creature.Combatant = From;
return true;
}
else if ( Map.CanSpawnMobile( x, y, z ) )
if ( Map.CanSpawnMobile( x, y, z ) )
{
creature.MoveToWorld( new Point3D( x, y, z ), Map );
creature.Combatant = From;

View file

@ -70,8 +70,7 @@ namespace Server.Engines.Plants
{
if (m_Table.TryGetValue( plantHue, out PlantHueInfo info ))
return info;
else
return m_Table[PlantHue.Plain];
return m_Table[PlantHue.Plain];
}
public static PlantHue RandomFirstGeneration()

View file

@ -208,12 +208,11 @@ namespace Server.Engines.Plants
{
if ( m_PlantStatus >= PlantStatus.Plant )
return 1060812; // plant
else if ( m_PlantStatus >= PlantStatus.Sapling )
if ( m_PlantStatus >= PlantStatus.Sapling )
return 1023305; // sapling
else if ( m_PlantStatus >= PlantStatus.Seed )
if ( m_PlantStatus >= PlantStatus.Seed )
return 1060810; // seed
else
return 1026951; // dirt
return 1026951; // dirt
}
public int GetLocalizedContainerType()
@ -508,11 +507,9 @@ namespace Server.Engines.Plants
message = 1053065; // The plant is already soaked with this type of potion!
return false;
}
else
{
message = 1053067; // You pour the potion over the plant.
return true;
}
message = 1053067; // You pour the potion over the plant.
return true;
}
public override void Serialize( GenericWriter writer )

View file

@ -116,12 +116,11 @@ namespace Server.Engines.Plants
if ( perc < 33 )
return PlantHealth.Dying;
else if ( perc < 66 )
if ( perc < 66 )
return PlantHealth.Wilted;
else if ( perc < 100 )
if ( perc < 100 )
return PlantHealth.Healthy;
else
return PlantHealth.Vibrant;
return PlantHealth.Vibrant;
}
}
@ -261,8 +260,7 @@ namespace Server.Engines.Plants
{
if ( m_Pollinated )
return m_SeedType;
else
return m_Plant.PlantType;
return m_Plant.PlantType;
}
set => m_SeedType = value;
}
@ -273,8 +271,7 @@ namespace Server.Engines.Plants
{
if ( m_Pollinated )
return m_SeedHue;
else
return m_Plant.PlantHue;
return m_Plant.PlantHue;
}
set => m_SeedHue = value;
}
@ -346,12 +343,11 @@ namespace Server.Engines.Plants
{
if ( Water <= 1 )
return 1060826; // hard
else if ( Water <= 2 )
if ( Water <= 2 )
return 1060827; // soft
else if ( Water <= 3 )
if ( Water <= 3 )
return 1060828; // squishy
else
return 1060829; // sopping wet
return 1060829; // sopping wet
}
public int GetLocalizedHealth()

View file

@ -113,8 +113,7 @@ namespace Server.Engines.Plants
if ( index >= 0 && index < m_Table.Length )
return m_Table[index];
else
return m_Table[0];
return m_Table[0];
}
public static PlantType RandomFirstGeneration()
@ -206,20 +205,19 @@ namespace Server.Engines.Plants
if ( rand < 0.5 / exp4 )
return PlantType.CommonGreenBonsai;
else if ( rand < 1.0 / exp4 )
if ( rand < 1.0 / exp4 )
return PlantType.CommonPinkBonsai;
else if ( rand < (k1 * 0.5 + 1.0) / exp4 )
if ( rand < (k1 * 0.5 + 1.0) / exp4 )
return PlantType.UncommonGreenBonsai;
else if ( rand < exp1 / exp4 )
if ( rand < exp1 / exp4 )
return PlantType.UncommonPinkBonsai;
else if ( rand < (k2 * 0.5 + exp1) / exp4 )
if ( rand < (k2 * 0.5 + exp1) / exp4 )
return PlantType.RareGreenBonsai;
else if ( rand < exp2 / exp4 )
if ( rand < exp2 / exp4 )
return PlantType.RarePinkBonsai;
else if ( rand < exp3 / exp4 )
if ( rand < exp3 / exp4 )
return PlantType.ExceptionalBonsai;
else
return PlantType.ExoticBonsai;
return PlantType.ExoticBonsai;
}
public static bool IsCrossable( PlantType plantType )
@ -237,8 +235,7 @@ namespace Server.Engines.Plants
if ( firstIndex + 1 == secondIndex || firstIndex == secondIndex + 1 )
return Utility.RandomBool() ? first : second;
else
return (PlantType)( (firstIndex + secondIndex) / 2 );
return (PlantType)( (firstIndex + secondIndex) / 2 );
}
public static bool CanReproduce( PlantType plantType )
@ -261,8 +258,7 @@ namespace Server.Engines.Plants
if ( m_ContainsPlant )
return hueInfo.IsBright() ? 1060832 : 1060831; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~
else
return hueInfo.IsBright() ? 1061887 : 1061888; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
return hueInfo.IsBright() ? 1061887 : 1061888; // a ~1_val~ of ~2_val~ dirt with a ~3_val~ [bright] ~4_val~ ~5_val~ ~6_val~
}
public int GetPlantLabelFullGrown( PlantHueInfo hueInfo )
@ -272,8 +268,7 @@ namespace Server.Engines.Plants
if ( m_ContainsPlant )
return hueInfo.IsBright() ? 1061891 : 1061889; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~
else
return hueInfo.IsBright() ? 1061892 : 1061890; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant
return hueInfo.IsBright() ? 1061892 : 1061890; // a ~1_HEALTH~ [bright] ~2_COLOR~ ~3_NAME~ plant
}
public int GetPlantLabelDecorative( PlantHueInfo hueInfo )

View file

@ -109,25 +109,19 @@ namespace Server.Engines.Plants
args = $"#{title}\t#{typeInfo.Name}";
return typeInfo.GetSeedLabel( hueInfo );
}
else
{
args = $"#{title}";
return hueInfo.IsBright() ? 1060839 : 1060838; // [bright] ~1_val~ seed
}
args = $"#{title}";
return hueInfo.IsBright() ? 1060839 : 1060838; // [bright] ~1_val~ seed
}
else
if ( m_ShowType )
{
if ( m_ShowType )
{
args = $"{Amount}\t#{title}\t#{typeInfo.Name}";
return typeInfo.GetSeedLabelPlural( hueInfo );
}
else
{
args = $"{Amount}\t#{title}";
return hueInfo.IsBright() ? 1113491 : 1113490; // ~1_amount~ [bright] ~2_val~ seeds
}
args = $"{Amount}\t#{title}\t#{typeInfo.Name}";
return typeInfo.GetSeedLabelPlural( hueInfo );
}
args = $"{Amount}\t#{title}";
return hueInfo.IsBright() ? 1113491 : 1113490; // ~1_amount~ [bright] ~2_val~ seeds
}
public override void AddNameProperty( ObjectPropertyList list )

View file

@ -38,8 +38,7 @@ namespace Server.Engines.Quests.Ambitious
if ( redSolen )
return from is RedSolenQueen;
else
return from is BlackSolenQueen;
return from is BlackSolenQueen;
}
public override void OnKill( BaseCreature creature, Container corpse )

View file

@ -60,8 +60,7 @@ namespace Server.Engines.Quests.Collector
int index = (int)image;
if ( index >= 0 && index < m_Table.Length )
return m_Table[index];
else
return m_Table[0];
return m_Table[0];
}
public static ImageType[] RandomList( int count )

View file

@ -75,8 +75,7 @@ namespace Server.Engines.Quests.Collector
int index = Utility.Random( m_Names.Length );
if ( m_Names[index] == null )
return from.Name;
else
return m_Names[index];
return m_Names[index];
}
private const int m_Partial = 2;

View file

@ -217,11 +217,9 @@ namespace Server.Engines.Quests.Collector
{
return true;
}
else
{
bag.Delete();
return false;
}
bag.Delete();
return false;
}
public override void Serialize( GenericWriter writer )

View file

@ -321,14 +321,12 @@ namespace Server.Engines.Quests.Collector
{
return CaptureResponse.AlreadyDone;
}
else
{
m_Done[i] = true;
CheckCompletionStatus();
m_Done[i] = true;
return CaptureResponse.Valid;
}
CheckCompletionStatus();
return CaptureResponse.Valid;
}
}

View file

@ -26,20 +26,16 @@ namespace Server.Engines.Quests
{
return true;
}
else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
{
return true;
}
else
{
from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
return false;
}
}
else
{
return ret;
from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
return false;
}
return ret;
}
public override bool DropToMobile( Mobile from, Mobile target, Point3D p )
@ -52,20 +48,16 @@ namespace Server.Engines.Quests
{
return true;
}
else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
{
return true;
}
else
{
from.SendLocalizedMessage( 1049344 ); // You decide against trading the item. You still need it for your quest.
return false;
}
}
else
{
return ret;
from.SendLocalizedMessage( 1049344 ); // You decide against trading the item. You still need it for your quest.
return false;
}
return ret;
}
public override bool DropToItem( Mobile from, Item target, Point3D p )
@ -78,15 +70,13 @@ namespace Server.Engines.Quests
{
return true;
}
else if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
if ( !(from is PlayerMobile) || CanDrop( (PlayerMobile)from ) )
{
return true;
}
else
{
from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
return false;
}
from.SendLocalizedMessage( 1049343 ); // You can only drop quest items into the top-most level of your backpack while you still need them for your quest.
return false;
}
return ret;
}

View file

@ -178,14 +178,12 @@ namespace Server.Engines.Quests.Necro
*/
return 1062058;
}
else // from well of tears
{
/* You have arrived at the well, but no longer have the scroll
/* You have arrived at the well, but no longer have the scroll
* of calling. Use Mardoth's teleporter to return to the
* Crystal Cave and fetch another scroll from the box.
*/
return 1060129;
}
return 1060129;
}
}

View file

@ -22,25 +22,26 @@ namespace Server.Engines.Quests.Necro
qs.AddConversation( new RadarConversation() );
return true;
}
else if ( qs.IsObjectiveInProgress( typeof( FindCrystalCaveObjective ) ) )
if ( qs.IsObjectiveInProgress( typeof( FindCrystalCaveObjective ) ) )
{
loc = new Point3D( 1194, 521, -90 );
map = Map.Malas;
return true;
}
else if ( qs.IsObjectiveInProgress( typeof( FindCityOfLightObjective ) ) )
if ( qs.IsObjectiveInProgress( typeof( FindCityOfLightObjective ) ) )
{
loc = new Point3D( 1091, 519, -90 );
map = Map.Malas;
return true;
}
else if ( qs.IsObjectiveInProgress( typeof( ReturnToCrystalCaveObjective ) ) )
if ( qs.IsObjectiveInProgress( typeof( ReturnToCrystalCaveObjective ) ) )
{
loc = new Point3D( 1194, 521, -90 );
map = Map.Malas;
return true;
}
else if ( DarkTidesQuest.HasLostCallingScroll( player ) )
if ( DarkTidesQuest.HasLostCallingScroll( player ) )
{
loc = new Point3D( 1194, 521, -90 );
map = Map.Malas;

View file

@ -382,14 +382,12 @@ namespace Server.Engines.Quests.Necro
*/
return 1060131;
}
else
{
/* Although you were slain by the cowardly paladin,
/* Although you were slain by the cowardly paladin,
* you managed to complete the rite of calling as
* instructed. Return to Mardoth.
*/
return 1060132;
}
return 1060132;
}
}

View file

@ -64,11 +64,9 @@ namespace Server.Engines.Quests.Samurai
// You have just gained some <a href="?ForceTopic45">Karma</a> for killing a Cursed Soul.
return 1063040;
}
else
{
// You have just gained some <a href="?ForceTopic45">Karma</a> for killing a Young Ronin.
return 1063041;
}
// You have just gained some <a href="?ForceTopic45">Karma</a> for killing a Young Ronin.
return 1063041;
}
}
@ -119,9 +117,8 @@ namespace Server.Engines.Quests.Samurai
*/
return 1063045;
}
else
{
/* It is good that you rid the land of those dishonorable Samurai.
/* It is good that you rid the land of those dishonorable Samurai.
* Perhaps they will learn a greater lesson in death.<BR><BR>
*
* I have placed a reward in your pack.<BR><BR>
@ -129,8 +126,7 @@ namespace Server.Engines.Quests.Samurai
* The second trial will test your courage. You only have to follow
* the yellow path to see what awaits you.
*/
return 1063046;
}
return 1063046;
}
}
@ -201,9 +197,8 @@ namespace Server.Engines.Quests.Samurai
*/
return 1063060;
}
else
{
/* Fear remains in your eyes but you have learned that not all is
/* Fear remains in your eyes but you have learned that not all is
* what it appears to be. <BR><BR>
*
* You must have known the dragon would slay you instantly.
@ -217,8 +212,7 @@ namespace Server.Engines.Quests.Samurai
*
* The next trial will test your benevolence. You only have to walk the blue path.
*/
return 1063059;
}
return 1063059;
}
}
@ -313,9 +307,8 @@ namespace Server.Engines.Quests.Samurai
*/
return 1063071;
}
else
{
/* You showed respect by helping another out while allowing the gypsy
/* You showed respect by helping another out while allowing the gypsy
* what little dignity she has left. <BR><BR>
*
* Now she will be able to feed herself and gain enough energy to walk
@ -330,8 +323,7 @@ namespace Server.Engines.Quests.Samurai
* prove yourself again. <BR><BR>Please retrieve my katana from the
* treasure room and return it to me.
*/
return 1063070;
}
return 1063070;
}
}
@ -412,9 +404,8 @@ namespace Server.Engines.Quests.Samurai
*/
return 1063077;
}
else
{
/* Thank you for returning this sword to me and leaving the remaining
/* Thank you for returning this sword to me and leaving the remaining
* treasure alone. <BR><BR>
*
* Your training is nearly complete. Before you have your final trial,
@ -422,8 +413,7 @@ namespace Server.Engines.Quests.Samurai
*
* Go into the Altar Room and light a candle for them. Afterwards, return to me.
*/
return 1063076;
}
return 1063076;
}
}

View file

@ -19,9 +19,8 @@ namespace Server.Engines.Quests.Matriarch
*/
return 1054081;
}
else
{
/* <I>The Solen Matriarch smiles as she eats the seed you offered.</I><BR><BR>
/* <I>The Solen Matriarch smiles as she eats the seed you offered.</I><BR><BR>
*
* Thank you for that seed. It was quite delicious. <BR><BR>
*
@ -29,8 +28,7 @@ namespace Server.Engines.Quests.Matriarch
* another task at the moment. Perhaps you should finish whatever is occupying
* your attention at the moment and return to me once you're done.
*/
return 1054079;
}
return 1054079;
}
}
@ -133,9 +131,8 @@ namespace Server.Engines.Quests.Matriarch
*/
return 1054097;
}
else
{
/* <I>The Solen Matriarch listens as you report the completion of your
/* <I>The Solen Matriarch listens as you report the completion of your
* tasks to her.</I><BR><BR>
*
* I give you my thanks for your help, and I will gladly make you a friend of my
@ -149,8 +146,7 @@ namespace Server.Engines.Quests.Matriarch
* I will also give you some gold for assisting me and my colony, but first let's
* take care of your zoogi fungus.
*/
return 1054096;
}
return 1054096;
}
}

View file

@ -38,8 +38,7 @@ namespace Server.Engines.Quests.Matriarch
if ( redSolen )
return from is BlackSolenInfiltratorWarrior || from is BlackSolenInfiltratorQueen;
else
return from is RedSolenInfiltratorWarrior || from is RedSolenInfiltratorQueen;
return from is RedSolenInfiltratorWarrior || from is RedSolenInfiltratorQueen;
}
public override void OnKill( BaseCreature creature, Container corpse )

View file

@ -54,9 +54,8 @@ namespace Server.Engines.Quests.Matriarch
*/
return 1054083;
}
else
{
/* <I>The Solen Matriarch smiles happily as she eats the seed you offered.</I><BR><BR>
/* <I>The Solen Matriarch smiles happily as she eats the seed you offered.</I><BR><BR>
*
* I think you for that seed. I was quite delicious. So full of flavor.<BR><BR>
*
@ -79,8 +78,7 @@ namespace Server.Engines.Quests.Matriarch
*
* Will you accept my offer?
*/
return 1054082;
}
return 1054082;
}
}
@ -128,8 +126,7 @@ namespace Server.Engines.Quests.Matriarch
{
if ( redSolen )
return player.SolenFriendship == SolenFriendship.Red;
else
return player.SolenFriendship == SolenFriendship.Black;
return player.SolenFriendship == SolenFriendship.Black;
}
public static bool GiveRewardTo( PlayerMobile player )
@ -141,11 +138,9 @@ namespace Server.Engines.Quests.Matriarch
player.SendLocalizedMessage( 1054076 ); // You have been given some gold.
return true;
}
else
{
gold.Delete();
return false;
}
gold.Delete();
return false;
}
}
}

View file

@ -46,8 +46,7 @@ namespace Server.Engines.Quests.Naturalist
{
if ( id >= 0 && id < m_Areas.Length )
return m_Areas[id];
else
return null;
return null;
}
private bool m_Special;

View file

@ -38,8 +38,7 @@ namespace Server.Engines.Quests.Zento
{
if ( m.Quest == null )
return 3;
else
return -1;
return -1;
}
public override void OnTalk( PlayerMobile player, bool contextMenu )

View file

@ -139,16 +139,14 @@ namespace Server.Engines.Quests.Doom
foundLoc = true;
break;
}
else
{
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
dragon.MoveToWorld( new Point3D( x, y, z ), map );
foundLoc = true;
break;
}
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
dragon.MoveToWorld( new Point3D( x, y, z ), map );
foundLoc = true;
break;
}
}

View file

@ -65,10 +65,9 @@ namespace Server.Engines.Quests.Doom
if ( fame < 1500 )
return Utility.Dice( 2, 5, -1 );
else if ( fame < 20000 )
if ( fame < 20000 )
return Utility.Dice( 2, 4, 8 );
else
return 50;
return 50;
}
public TheSummoningQuest( Victoria victoria, PlayerMobile from ) : base( from )

View file

@ -64,7 +64,8 @@ namespace Server.Engines.Quests.Haven
*/
return 1049088;
}
else if ( System.From.Profession == 2 ) // magician
if ( System.From.Profession == 2 ) // magician
{
/* <I>Uzeraan greets you as you approach...</I><BR><BR>
*
@ -95,9 +96,7 @@ namespace Server.Engines.Quests.Haven
*/
return 1049386;
}
else
{
/* <I>Uzeraan nods at you with approval and begins to speak...</I><BR><BR>
/* <I>Uzeraan nods at you with approval and begins to speak...</I><BR><BR>
*
* Now that you are ready, let me give you your first task.<BR><BR>
*
@ -120,8 +119,7 @@ namespace Server.Engines.Quests.Haven
*
* Good luck young Paladin!
*/
return 1060388;
}
return 1060388;
}
}
@ -180,9 +178,8 @@ namespace Server.Engines.Quests.Haven
*/
return 1049387;
}
else
{
/* <I>You give your report to Uzeraan and after a while,
/* <I>You give your report to Uzeraan and after a while,
* he begins to speak...</I><BR><BR>
*
* Your report is grim, but all hope is not lost! It has become apparent
@ -208,8 +205,7 @@ namespace Server.Engines.Quests.Haven
* and <a href="?ForceTopic76">Healing</a> <a href="?ForceTopic74">potions</a>
* to help you out along the way. Good luck.
*/
return 1049119;
}
return 1049119;
}
}
@ -265,9 +261,8 @@ namespace Server.Engines.Quests.Haven
*/
return 1060749;
}
else
{
/* <I>Schmendrick barely pays you any attention as you approach him. His
/* <I>Schmendrick barely pays you any attention as you approach him. His
* mind seems to be occupied with something else. You explain to him that
* you came for the scroll of power and after a long while he begins to speak,
* but apparently still not giving you his full attention...</I><BR><BR>
@ -284,8 +279,7 @@ namespace Server.Engines.Quests.Haven
* <I>Schmendrick goes back to his work and you seem to completely fade from his
* awareness...
*/
return 1049322;
}
return 1049322;
}
}
@ -370,9 +364,8 @@ namespace Server.Engines.Quests.Haven
*/
return 1049388;
}
else
{
/* <I>Uzeraan takes the dirt from you and smiles...<BR><BR></I>
/* <I>Uzeraan takes the dirt from you and smiles...<BR><BR></I>
*
* Wonderful! I knew I could count on you. As a token of my appreciation
* I've given you a bag with some bandages as well as some healing potions.
@ -392,8 +385,7 @@ namespace Server.Engines.Quests.Haven
*
* Good luck!
*/
return 1049329;
}
return 1049329;
}
}
@ -440,9 +432,8 @@ namespace Server.Engines.Quests.Haven
+ "<BR>"
+ "Return here when you have found a <I>Daemon Bone</I>.";
}
else
{
/* <I>You hand Uzeraan the Vial of Blood, which he hastily accepts...</I><BR><BR>
/* <I>You hand Uzeraan the Vial of Blood, which he hastily accepts...</I><BR><BR>
*
* Excellent work! Only one reagent remains and the spell is complete!
* The final requirement is a <I>Daemon Bone</I>, which will not be as easily
@ -459,8 +450,7 @@ namespace Server.Engines.Quests.Haven
*
* Return here when you have found a <I>Daemon Bone</I>.
*/
return 1049333;
}
return 1049333;
}
}
@ -479,8 +469,7 @@ namespace Server.Engines.Quests.Haven
{
if ( System.From.Profession == 5 ) // paladin
return m_InfoPaladin;
else
return m_Info;
return m_Info;
}
}
@ -550,9 +539,8 @@ namespace Server.Engines.Quests.Haven
*/
return 1049377;
}
else
{
/* You've lost the scroll? Argh! I will have to try and re-construct
/* You've lost the scroll? Argh! I will have to try and re-construct
* the scroll from memory. Bring me a blank scroll, which you can
* <a href = "?ForceTopic33">purchase from the mage shop</a> just
* <a href = "?ForceTopic13">East</a> of Uzeraan's mansion in Haven.<BR><BR>
@ -561,8 +549,7 @@ namespace Server.Engines.Quests.Haven
*
* When you return, be sure to hand me the scroll (drag and drop).
*/
return 1049345;
}
return 1049345;
}
}
@ -609,9 +596,8 @@ namespace Server.Engines.Quests.Haven
*/
return 1049374;
}
else
{
/* You've lost the dirt I gave you?<BR><BR>
/* You've lost the dirt I gave you?<BR><BR>
*
* My, my, my... What ever shall we do now?<BR><BR>
*
@ -628,8 +614,7 @@ namespace Server.Engines.Quests.Haven
*
* Good luck.<BR><BR>
*/
return 1049359;
}
return 1049359;
}
}

View file

@ -23,22 +23,23 @@ namespace Server.Engines.Quests.Haven
map = Map.Trammel;
return true;
}
else if ( qs.IsObjectiveInProgress( typeof( FindDryadObjective ) )
|| UzeraanTurmoilQuest.HasLostFertileDirt( player ) )
if ( qs.IsObjectiveInProgress( typeof( FindDryadObjective ) )
|| UzeraanTurmoilQuest.HasLostFertileDirt( player ) )
{
loc = new Point3D( 3557, 2690, 2 );
map = Map.Trammel;
return true;
}
else if ( player.Profession != 5 // paladin
&& ( qs.IsObjectiveInProgress( typeof( GetDaemonBoneObjective ) )
|| UzeraanTurmoilQuest.HasLostDaemonBone( player ) ) )
if ( player.Profession != 5 // paladin
&& ( qs.IsObjectiveInProgress( typeof( GetDaemonBoneObjective ) )
|| UzeraanTurmoilQuest.HasLostDaemonBone( player ) ) )
{
loc = new Point3D( 3422, 2653, 48 );
map = Map.Trammel;
return true;
}
else if ( qs.IsObjectiveInProgress( typeof( CashBankCheckObjective ) ) )
if ( qs.IsObjectiveInProgress( typeof( CashBankCheckObjective ) ) )
{
loc = new Point3D( 3624, 2610, 0 );
map = Map.Trammel;

View file

@ -97,12 +97,10 @@ namespace Server.Engines.Quests.Haven
from.SendLocalizedMessage( 1046260 ); // You need to clear some space in your inventory to continue with the quest. Come back here when you have more space in your inventory.
return false;
}
else
{
dropped.Consume();
from.SendLocalizedMessage( 1049346 ); // Schmendrick scribbles on the scroll for a few moments and hands you the finished product.
return dropped.Deleted;
}
dropped.Consume();
from.SendLocalizedMessage( 1049346 ); // Schmendrick scribbles on the scroll for a few moments and hands you the finished product.
return dropped.Deleted;
}
return base.OnDragDrop( from, dropped );

View file

@ -119,10 +119,8 @@ namespace Server.Engines.Quests.Haven
default: return 5;
}
}
else
{
return 5;
}
return 5;
}
}
@ -132,8 +130,7 @@ namespace Server.Engines.Quests.Haven
{
if ( m_Step == KillHordeMinionsStep.LearnKarma && HasBeenRead )
return true;
else
return base.Completed;
return base.Completed;
}
}
@ -414,14 +411,12 @@ namespace Server.Engines.Quests.Haven
*/
return 1060755;
}
else
{
/* Use Uzeraan's teleporter to get to the Haunted graveyard.<BR><BR>
/* Use Uzeraan's teleporter to get to the Haunted graveyard.<BR><BR>
*
* Slay the undead until you find a <I>Daemon Bone</I>.
*/
return 1049362;
}
return 1049362;
}
}

Some files were not shown because too many files have changed in this diff Show more