Formatting #2 (#59)

This commit is contained in:
Kamron Batman 2019-10-05 00:37:03 -07:00 committed by GitHub
parent 096d39609e
commit 8e9221bb5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
400 changed files with 3688 additions and 5969 deletions

View file

@ -117,7 +117,7 @@ namespace Server.Items
owner = box.Owner;
}
if (owner?.Account == null || !owner.Account.DepositGold(Worth)) return;
if (owner?.Account?.DepositGold(Worth) != true) return;
if (tradeInfo != null)
{
@ -151,7 +151,7 @@ namespace Server.Items
1041361,
"",
AffixType.Append,
string.Concat(" ", m_Worth.ToString()),
$" {m_Worth}",
"")); // A bank check:
}
@ -174,7 +174,7 @@ namespace Server.Items
int deposited = 0;
int toAdd = m_Worth;
if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(toAdd))
if (AccountGold.Enabled && from.Account?.DepositGold(toAdd) == true)
{
deposited = toAdd;
toAdd = 0;

View file

@ -342,9 +342,9 @@ namespace Server.Items
string text = $"{from.Name} says {message}";
if (RootParent is Mobile mobile)
mobile.SendMessage(0x2B2, "Crystal: " + text);
mobile.SendMessage(0x2B2, $"Crystal: {text}");
else if (RootParent is Item item)
item.PublicOverheadMessage(MessageType.Regular, 0x2B2, false, "Crystal: " + text);
item.PublicOverheadMessage(MessageType.Regular, 0x2B2, false, $"Crystal: {text}");
else
PublicOverheadMessage(MessageType.Regular, 0x2B2, false, text);
}

View file

@ -151,7 +151,7 @@ namespace Server.Items
if (NextSpawn < DateTime.UtcNow) // means we haven't spawned anything if the next spawn is below
if (Utility.InRange(m.Location, Location, 1) && !Utility.InRange(oldLocation, Location, 1) && m.Player &&
!(m.AccessLevel > AccessLevel.Player || m.Hidden))
if (m_Timer == null || !m_Timer.Running)
if (m_Timer?.Running != true)
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(2), HeedWarning);
base.OnMovement(m, oldLocation);

View file

@ -48,7 +48,7 @@ namespace Server.Items
return;
}
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
// to prevent exploiting for pvp
from.SendLocalizedMessage(1075857); // You cannot use that while paralyzed.

View file

@ -1,5 +1,4 @@
using System;
using Server.Commands;
using Server.Targeting;
namespace Server.Items

View file

@ -73,7 +73,7 @@ namespace Server.Items
owner = box.Owner;
}
if (owner?.Account == null || !owner.Account.DepositGold(Amount)) return;
if (owner?.Account?.DepositGold(Amount) != true) return;
if (tradeInfo != null)
{

View file

@ -117,20 +117,13 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
DecorateCommand command = DecorateCommand.None;
switch (info.ButtonID)
var command = info.ButtonID switch
{
case 1:
command = DecorateCommand.Turn;
break;
case 2:
command = DecorateCommand.Up;
break;
case 3:
command = DecorateCommand.Down;
break;
}
1 => DecorateCommand.Turn,
2 => DecorateCommand.Up,
3 => DecorateCommand.Down,
_ => DecorateCommand.None
};
if (command != DecorateCommand.None)
{
@ -203,7 +196,7 @@ namespace Server.Items
}
}
if (house == null || !house.IsCoOwner(from))
if (house?.IsCoOwner(from) != true)
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
}

View file

@ -23,29 +23,16 @@ namespace Server.Items
{
Delete();
Item i = null;
switch (Utility.Random(from.BAC >= 5 ? 6 : 5))
var i = Utility.Random(from.BAC >= 5 ? 6 : 5) switch
{
case 0:
i = new OrigamiButterfly();
break;
case 1:
i = new OrigamiSwan();
break;
case 2:
i = new OrigamiFrog();
break;
case 3:
i = new OrigamiShape();
break;
case 4:
i = new OrigamiSongbird();
break;
case 5:
i = new OrigamiFish();
break;
}
0 => (Item)new OrigamiButterfly(),
1 => new OrigamiSwan(),
2 => new OrigamiFrog(),
3 => new OrigamiShape(),
4 => new OrigamiSongbird(),
5 => new OrigamiFish(),
_ => null
};
if (i != null)
from.AddToBackpack(i);
@ -224,4 +211,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -162,7 +162,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house == null || !house.HasLockedDownItem( this ) )
if ( house?.HasLockedDownItem( this ) != true )
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
else if ( !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) )
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
@ -196,7 +196,7 @@ namespace Server.Items
BaseHouse house = m_House;
BasePlayerBB board = m_Board;
if ( house == null || !house.HasLockedDownItem( board ) )
if ( house?.HasLockedDownItem( board ) != true )
{
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;
@ -212,10 +212,7 @@ namespace Server.Items
from.SendLocalizedMessage( 1062398 ); // You are not allowed to post to this bulletin board.
return;
}
if ( m_Greeting && !house.IsOwner( from ) )
{
return;
}
if ( m_Greeting && !house.IsOwner( from ) ) return;
text = text.Trim();
@ -272,7 +269,7 @@ namespace Server.Items
BaseHouse house = m_House;
BasePlayerBB board = m_Board;
if ( house == null || !house.HasLockedDownItem( board ) )
if ( house?.HasLockedDownItem( board ) != true )
{
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;
@ -363,7 +360,7 @@ namespace Server.Items
BaseHouse house = m_House;
BasePlayerBB board = m_Board;
if ( house == null || !house.HasLockedDownItem( board ) )
if ( house?.HasLockedDownItem( board ) != true )
{
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;

View file

@ -48,7 +48,7 @@ namespace Server.Items
if ( age > m_Duration ) {
Delete();
} else {
if ( !m_Drying && age > (m_Duration - age) )
if ( !m_Drying && age > m_Duration - age )
{
m_Drying = true;
ItemID = 0x122B;
@ -57,12 +57,8 @@ namespace Server.Items
List<Mobile> toDamage = new List<Mobile>();
foreach( Mobile m in GetMobilesInRange( 0 ) )
{
if ( m.Alive && !m.IsDeadBondedPet && (!(m is BaseCreature bc) || bc.Controlled || bc.Summoned) )
{
toDamage.Add( m );
}
}
for ( int i = 0; i < toDamage.Count; i++ )
Damage( toDamage[i] );

View file

@ -132,21 +132,13 @@ namespace Server.Items
{
PathDirection dir = choices[Utility.Random(count)];
switch (dir)
current = dir switch
{
case PathDirection.Left:
current = new Node(current.X - 1, current.Y);
break;
case PathDirection.Up:
current = new Node(current.X, current.Y - 1);
break;
case PathDirection.Right:
current = new Node(current.X + 1, current.Y);
break;
default:
current = new Node(current.X, current.Y + 1);
break;
}
PathDirection.Left => new Node(current.X - 1, current.Y),
PathDirection.Up => new Node(current.X, current.Y - 1),
PathDirection.Right => new Node(current.X + 1, current.Y),
_ => new Node(current.X, current.Y + 1)
};
stack[stackSize++] = current;
@ -391,19 +383,12 @@ namespace Server.Items
private void AddNode(int x, int y, NodeHue hue)
{
int id;
switch (hue)
var id = hue switch
{
case NodeHue.Gray:
id = 0x25F8;
break;
case NodeHue.Blue:
id = 0x868;
break;
default:
id = 0x9A8;
break;
}
NodeHue.Gray => 0x25F8,
NodeHue.Blue => 0x868,
_ => 0x9A8
};
AddImage(x, y, id);
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Server.Commands;
using Server.Factions;
using Server.Gumps;
using Server.Mobiles;

View file

@ -85,48 +85,22 @@ namespace Server.Items
if (m_Item.Deleted)
return;
Mobile spawn;
switch (Utility.Random(12))
var spawn = Utility.Random(12) switch
{
default:
case 0:
spawn = new Skeleton();
break;
case 1:
spawn = new Zombie();
break;
case 2:
spawn = new Wraith();
break;
case 3:
spawn = new Spectre();
break;
case 4:
spawn = new Ghoul();
break;
case 5:
spawn = new Mummy();
break;
case 6:
spawn = new Bogle();
break;
case 7:
spawn = new RottingCorpse();
break;
case 8:
spawn = new BoneKnight();
break;
case 9:
spawn = new SkeletalKnight();
break;
case 10:
spawn = new Lich();
break;
case 11:
spawn = new LichLord();
break;
}
0 => (Mobile)new Skeleton(),
1 => new Zombie(),
2 => new Wraith(),
3 => new Spectre(),
4 => new Ghoul(),
5 => new Mummy(),
6 => new Bogle(),
7 => new RottingCorpse(),
8 => new BoneKnight(),
9 => new SkeletalKnight(),
10 => new Lich(),
11 => new LichLord(),
_ => new Skeleton()
};
spawn.MoveToWorld(m_Item.Location, m_Item.Map);

View file

@ -1,4 +1,3 @@
using Server.Commands;
using Server.Targeting;
namespace Server.Items

View file

@ -55,13 +55,9 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (IsOwner(from))
{
from.SendGump(new OnOffGump(this));
}
else
{
from.SendLocalizedMessage(502691); // You must be the owner to use this.
}
}
public override void Serialize(GenericWriter writer)