Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 • committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -64,7 +64,7 @@ namespace Server.Factions
}
}
public static List<BaseMonolith> Monoliths{ get; set; } = new List<BaseMonolith>();
public static List<BaseMonolith> Monoliths { get; set; } = new List<BaseMonolith>();
public override void OnLocationChange(Point3D oldLocation)
{
@ -117,12 +117,12 @@ namespace Server.Factions
switch (version)
{
case 0:
{
Town = Town.ReadReference(reader);
Faction = Faction.ReadReference(reader);
m_Sigil = reader.ReadItem() as Sigil;
break;
}
{
Town = Town.ReadReference(reader);
Faction = Faction.ReadReference(reader);
m_Sigil = reader.ReadItem() as Sigil;
break;
}
}
}
}

View file

@ -89,10 +89,10 @@ namespace Server.Factions
switch (version)
{
case 0:
{
Faction = Faction.ReadReference(reader);
break;
}
{
Faction = Faction.ReadReference(reader);
break;
}
}
}
}

View file

@ -64,10 +64,10 @@ namespace Server.Factions
switch (version)
{
case 0:
{
Faction = Faction.ReadReference(reader);
break;
}
{
Faction = Faction.ReadReference(reader);
break;
}
}
}
}

View file

@ -40,7 +40,7 @@ namespace Server
from.PlaySound(0x1EE);
from.AddStatMod(new StatMod(StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes(time)));
Timer.DelayCall(TimeSpan.FromMinutes(time), delegate { from.EndAction<ClarityPotion>(); });
Timer.DelayCall(TimeSpan.FromMinutes(time), from.EndAction<ClarityPotion>);
return true;
}
@ -62,4 +62,4 @@ namespace Server
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -9,7 +9,7 @@ namespace Server
{
public abstract class PowerFactionItem : Item
{
private static WeightedItem[] _items =
private static readonly WeightedItem[] _items =
{
new WeightedItem(30, typeof(GemOfEmpowerment)),
new WeightedItem(25, typeof(BloodRose)),
@ -61,8 +61,7 @@ namespace Server
killer.SendSound(1470);
killer.LocalOverheadMessage(
MessageType.Regular, 2119, false,
"You notice a strange item on the corpse, and decide to pick it up."
);
"You notice a strange item on the corpse, and decide to pick it up.");
try
{
@ -101,19 +100,16 @@ namespace Server
"The object vanishes from your hands as you touch it.");
Timer.DelayCall(TimeSpan.FromSeconds(1.0),
delegate
{
from.LocalOverheadMessage(MessageType.Regular, 2118, false,
"You feel a strange tingling sensation throughout your body.");
});
() => from.LocalOverheadMessage(MessageType.Regular, 2118, false,
"You feel a strange tingling sensation throughout your body."));
Timer.DelayCall(TimeSpan.FromSeconds(4.0),
delegate { from.LocalOverheadMessage(MessageType.Regular, 2118, false, "Your skin begins to burn."); });
() => { from.LocalOverheadMessage(MessageType.Regular, 2118, false, "Your skin begins to burn."); });
new DestructionTimer(from).Start();
Delete();
//from.SendMessage( "You must be in a faction to use this item." );
// from.SendMessage( "You must be in a faction to use this item." );
}
else if (Use(from))
{
@ -138,7 +134,7 @@ namespace Server
private sealed class DestructionTimer : Timer
{
private Mobile _mobile;
private readonly Mobile _mobile;
private bool _screamed;
@ -171,9 +167,9 @@ namespace Server
Type = type;
}
public int Weight{ get; }
public int Weight { get; }
public Type Type{ get; }
public Type Type { get; }
public Item Construct() => ActivatorUtil.CreateInstance(Type) as Item;
}

View file

@ -23,7 +23,7 @@ namespace Server
public override bool Use(Mobile user)
{
if (Movable)
user.BeginTarget(12, true, TargetFlags.None, delegate(Mobile from, object obj)
user.BeginTarget(12, true, TargetFlags.None, (from, obj) =>
{
if (Movable && !Deleted)
if (obj is IPoint3D pt)
@ -40,10 +40,9 @@ namespace Server
Effects.SendMovingEffect(
from, new Entity(Serial.Zero, origin, facet),
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1
);
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1);
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
Timer.DelayCall(TimeSpan.FromSeconds(0.5), () =>
{
Delete();
@ -52,10 +51,9 @@ namespace Server
Effects.SendLocationEffect(
origin, facet,
14284, 96, 1, 0, 2
);
14284, 96, 1, 0, 2);
Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () =>
{
List<Mobile> targets = facet.GetMobilesInRange(origin, 12).Where(mob =>
from.CanBeHarmful(mob, false) && mob.InLOS(new Point3D(origin, origin.Z + 1)) &&
@ -72,8 +70,7 @@ namespace Server
Effects.SendMovingEffect(
new Entity(Serial.Zero, new Point3D(origin, origin.Z + 4), facet), mob,
14068, 1, 32, false, false, 1111, 2
);
14068, 1, 32, false, false, 1111, 2);
from.DoHarmful(mob);
@ -84,7 +81,7 @@ namespace Server
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
Timer.DelayCall(TimeSpan.FromSeconds(0.50), delegate { mob.PlaySound(0x1FB); });
Timer.DelayCall(TimeSpan.FromSeconds(0.50), mob.PlaySound, 0x1FB);
}
});
});

View file

@ -41,16 +41,16 @@ namespace Server.Factions
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public DateTime LastStolen{ get; set; }
public DateTime LastStolen { get; set; }
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public DateTime GraceStart{ get; set; }
public DateTime GraceStart { get; set; }
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public DateTime CorruptionStart{ get; set; }
public DateTime CorruptionStart { get; set; }
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public DateTime PurificationStart{ get; set; }
public DateTime PurificationStart { get; set; }
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public Town Town
@ -86,7 +86,7 @@ namespace Server.Factions
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.Administrator)]
public BaseMonolith LastMonolith{ get; set; }
public BaseMonolith LastMonolith { get; set; }
[CommandProperty(AccessLevel.Counselor)]
public bool IsBeingCorrupted => LastMonolith is StrongholdMonolith && LastMonolith.Faction == m_Corrupting &&
@ -118,7 +118,7 @@ namespace Server.Factions
}
}
public static List<Sigil> Sigils{ get; } = new List<Sigil>();
public static List<Sigil> Sigils { get; } = new List<Sigil>();
public void Update()
{
@ -240,8 +240,6 @@ namespace Server.Factions
if (Deleted || !IsChildOf(from.Backpack))
return;
#region Give To Mobile
if (obj is Mobile)
{
if (obj is PlayerMobile targ)
@ -274,16 +272,11 @@ namespace Server.Factions
}
else
{
from.SendLocalizedMessage(1005221); //You cannot give the sigil to them
from.SendLocalizedMessage(1005221); // You cannot give the sigil to them
}
}
#endregion
else if (obj is BaseMonolith)
{
#region Put in Stronghold
if (obj is StrongholdMonolith sm)
{
if (sm.Faction == null || sm.Faction != Faction.Find(from))
@ -327,11 +320,6 @@ namespace Server.Factions
PurificationStart = DateTime.MinValue;
}
}
#endregion
#region Put in Town
else if (obj is TownMonolith tm)
{
if (tm.Town == null || tm.Town != m_Town)
@ -355,12 +343,10 @@ namespace Server.Factions
m_Corrupted = null;
}
}
#endregion
}
else
{
from.SendLocalizedMessage(1005224); // You can't use the sigil on that
from.SendLocalizedMessage(1005224); // You can't use the sigil on that
}
Update();
@ -393,25 +379,25 @@ namespace Server.Factions
switch (version)
{
case 0:
{
m_Town = Town.ReadReference(reader);
m_Corrupted = Faction.ReadReference(reader);
m_Corrupting = Faction.ReadReference(reader);
{
m_Town = Town.ReadReference(reader);
m_Corrupted = Faction.ReadReference(reader);
m_Corrupting = Faction.ReadReference(reader);
LastMonolith = reader.ReadItem() as BaseMonolith;
LastMonolith = reader.ReadItem() as BaseMonolith;
LastStolen = reader.ReadDateTime();
GraceStart = reader.ReadDateTime();
CorruptionStart = reader.ReadDateTime();
PurificationStart = reader.ReadDateTime();
LastStolen = reader.ReadDateTime();
GraceStart = reader.ReadDateTime();
CorruptionStart = reader.ReadDateTime();
PurificationStart = reader.ReadDateTime();
Update();
Update();
if (RootParent is Mobile mob)
mob.SolidHueOverride = OwnershipHue;
if (RootParent is Mobile mob)
mob.SolidHueOverride = OwnershipHue;
break;
}
break;
}
}
}

View file

@ -4,7 +4,6 @@ namespace Server.Factions
{
public StrongholdMonolith(Town town = null, Faction faction = null) : base(town, faction)
{
}
public StrongholdMonolith(Serial serial) : base(serial)

View file

@ -41,7 +41,7 @@ namespace Server.Factions
if (faction == null && from.AccessLevel < AccessLevel.GameMaster)
return; // TODO: Message?
if (m_Town.Owner == null || from.AccessLevel < AccessLevel.GameMaster && faction != m_Town.Owner)
if (m_Town.Owner == null || (from.AccessLevel < AccessLevel.GameMaster && faction != m_Town.Owner))
from.SendLocalizedMessage(1010332); // Your faction does not control this town
else if (!m_Town.Owner.IsCommander(from))
from.SendLocalizedMessage(1005242); // Only faction Leaders can use townstones
@ -69,10 +69,10 @@ namespace Server.Factions
switch (version)
{
case 0:
{
Town = Town.ReadReference(reader);
break;
}
{
Town = Town.ReadReference(reader);
break;
}
}
}
}

View file

@ -31,13 +31,13 @@ namespace Server.Factions
}
[CommandProperty(AccessLevel.GameMaster)]
public Faction Faction{ get; set; }
public Faction Faction { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Placer{ get; set; }
public Mobile Placer { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime TimeOfPlacement{ get; set; }
public DateTime TimeOfPlacement { get; set; }
public virtual int EffectSound => 0;
@ -120,32 +120,32 @@ namespace Server.Factions
switch (AllowedPlacing)
{
case AllowedPlacing.FactionStronghold:
{
StrongholdRegion region = Region.Find(p, m).GetRegion<StrongholdRegion>();
{
StrongholdRegion region = Region.Find(p, m).GetRegion<StrongholdRegion>();
if (region != null && region.Faction == Faction)
return 0;
if (region != null && region.Faction == Faction)
return 0;
return 1010355; // This trap can only be placed in your stronghold
}
return 1010355; // This trap can only be placed in your stronghold
}
case AllowedPlacing.AnyFactionTown:
{
Town town = Town.FromRegion(Region.Find(p, m));
{
Town town = Town.FromRegion(Region.Find(p, m));
if (town != null)
return 0;
if (town != null)
return 0;
return 1010356; // This trap can only be placed in a faction town
}
return 1010356; // This trap can only be placed in a faction town
}
case AllowedPlacing.ControlledFactionTown:
{
Town town = Town.FromRegion(Region.Find(p, m));
{
Town town = Town.FromRegion(Region.Find(p, m));
if (town != null && town.Owner == Faction)
return 0;
if (town != null && town.Owner == Faction)
return 0;
return 1010357; // This trap can only be placed in a town your faction controls
}
return 1010357; // This trap can only be placed in a town your faction controls
}
}
return 0;

View file

@ -9,7 +9,7 @@ namespace Server.Factions
{
private Faction m_Faction;
public BaseFactionTrapDeed(int itemID= 0x14F0) : base(itemID)
public BaseFactionTrapDeed(int itemID = 0x14F0) : base(itemID)
{
Weight = 1.0;
LootType = LootType.Blessed;
@ -19,7 +19,7 @@ namespace Server.Factions
{
}
public abstract Type TrapType{ get; }
public abstract Type TrapType { get; }
[CommandProperty(AccessLevel.GameMaster)]
public Faction Faction
@ -34,8 +34,6 @@ namespace Server.Factions
}
}
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -45,8 +43,6 @@ namespace Server.Factions
return 1;
}
#endregion
public virtual BaseFactionTrap Construct(Mobile from)
{
try

View file

@ -14,7 +14,7 @@ namespace Server.Factions
}
[CommandProperty(AccessLevel.GameMaster)]
public int Charges{ get; set; }
public int Charges { get; set; }
public override int LabelNumber => 1041508; // a faction trap removal kit
@ -56,15 +56,15 @@ namespace Server.Factions
switch (version)
{
case 1:
{
Charges = reader.ReadEncodedInt();
break;
}
{
Charges = reader.ReadEncodedInt();
break;
}
case 0:
{
Charges = 25;
break;
}
{
Charges = 25;
break;
}
}
}
}