Formatting FIxes (#58)

This commit is contained in:
Kamron Batman 2019-10-04 23:08:13 -07:00 • committed by GitHub
parent 57fb9fb525
commit 096d39609e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1318 changed files with 11633 additions and 22129 deletions

View file

@ -440,10 +440,7 @@ namespace Server.Items
flags |= toSet;
}
private static bool GetSaveFlag(SaveFlag flags, SaveFlag toGet)
{
return (flags & toGet) != 0;
}
private static bool GetSaveFlag(SaveFlag flags, SaveFlag toGet) => (flags & toGet) != 0;
public override void Serialize(GenericWriter writer)
{
@ -598,10 +595,7 @@ namespace Server.Items
InvalidateProperties();
}
public virtual Type GetSummoner()
{
return null;
}
public virtual Type GetSummoner() => null;
public virtual void SetSummoner(Type type, TextDefinition name)
{
@ -646,10 +640,8 @@ namespace Server.Items
private BaseTalisman m_Talisman;
public TalismanTarget(BaseTalisman talisman)
: base(12, false, TargetFlags.Beneficial)
{
: base(12, false, TargetFlags.Beneficial) =>
m_Talisman = talisman;
}
protected override void OnTarget(Mobile from, object o)
{
@ -937,10 +929,7 @@ namespace Server.Items
0x2F58, 0x2F59, 0x2F5A, 0x2F5B
};
public static int GetRandomItemID()
{
return Utility.RandomList(m_ItemIDs);
}
public static int GetRandomItemID() => Utility.RandomList(m_ItemIDs);
private static Type[] m_Summons =
{
@ -992,10 +981,7 @@ namespace Server.Items
1023817 // clean bandage
};
public static Type GetRandomSummonType()
{
return m_Summons[Utility.Random(m_Summons.Length)];
}
public static Type GetRandomSummonType() => m_Summons[Utility.Random(m_Summons.Length)];
public static TalismanAttribute GetRandomSummoner()
{
@ -1052,10 +1038,7 @@ namespace Server.Items
1072493, 1072494, 1072495, 1072498
};
public static TalismanAttribute GetRandomKiller()
{
return GetRandomKiller(true);
}
public static TalismanAttribute GetRandomKiller() => GetRandomKiller(true);
public static TalismanAttribute GetRandomKiller(bool includingNone)
{
@ -1067,10 +1050,7 @@ namespace Server.Items
return new TalismanAttribute(m_Killers[num], m_KillerLabels[num], Utility.RandomMinMax(10, 100));
}
public static TalismanAttribute GetRandomProtection()
{
return GetRandomProtection(true);
}
public static TalismanAttribute GetRandomProtection() => GetRandomProtection(true);
public static TalismanAttribute GetRandomProtection(bool includingNone)
{
@ -1095,10 +1075,7 @@ namespace Server.Items
SkillName.Tinkering
};
public static SkillName GetRandomSkill()
{
return m_Skills[Utility.Random(m_Skills.Length)];
}
public static SkillName GetRandomSkill() => m_Skills[Utility.Random(m_Skills.Length)];
public static int GetRandomExceptional()
{
@ -1124,20 +1101,11 @@ namespace Server.Items
return 0;
}
public static bool GetRandomBlessed()
{
return 0.02 > Utility.RandomDouble();
}
public static bool GetRandomBlessed() => 0.02 > Utility.RandomDouble();
public static TalismanSlayerName GetRandomSlayer()
{
return 0.01 > Utility.RandomDouble() ? (TalismanSlayerName)Utility.RandomMinMax(1, 9) : TalismanSlayerName.None;
}
public static TalismanSlayerName GetRandomSlayer() => 0.01 > Utility.RandomDouble() ? (TalismanSlayerName)Utility.RandomMinMax(1, 9) : TalismanSlayerName.None;
public static int GetRandomCharges()
{
return 0.5 > Utility.RandomDouble() ? Utility.RandomMinMax(10, 50) : 0;
}
public static int GetRandomCharges() => 0.5 > Utility.RandomDouble() ? Utility.RandomMinMax(10, 50) : 0;
#endregion
}

View file

@ -3,10 +3,7 @@ namespace Server.Items
public class EnchantedSwitch : Item
{
[Constructible]
public EnchantedSwitch() : base(0x2F5C)
{
Weight = 1.0;
}
public EnchantedSwitch() : base(0x2F5C) => Weight = 1.0;
public EnchantedSwitch(Serial serial) : base(serial)
{

View file

@ -3,10 +3,7 @@ namespace Server.Items
public class HollowPrism : Item
{
[Constructible]
public HollowPrism() : base(0x2F5D)
{
Weight = 1.0;
}
public HollowPrism() : base(0x2F5D) => Weight = 1.0;
public HollowPrism(Serial serial) : base(serial)
{

View file

@ -3,10 +3,7 @@ namespace Server.Items
public class JeweledFiligree : Item
{
[Constructible]
public JeweledFiligree() : base(0x2F5E)
{
Weight = 1.0;
}
public JeweledFiligree() : base(0x2F5E) => Weight = 1.0;
public JeweledFiligree(Serial serial) : base(serial)
{

View file

@ -3,10 +3,7 @@ namespace Server.Items
public class RunedPrism : Item
{
[Constructible]
public RunedPrism() : base(0x2F57)
{
Weight = 1.0;
}
public RunedPrism() : base(0x2F57) => Weight = 1.0;
public RunedPrism(Serial serial) : base(serial)
{

View file

@ -1,81 +1,75 @@
using Server.Targeting;
namespace Server.Items
{
public class RunedSwitch : Item
{
[Constructible]
public RunedSwitch() : base(0x2F61)
{
Weight = 1.0;
}
public RunedSwitch(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1072896; // runed switch
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1075101); // Please select an item to recharge.
from.Target = new InternalTarget(this);
}
else
{
from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
private class InternalTarget : Target
{
private RunedSwitch m_Item;
public InternalTarget(RunedSwitch item) : base(0, false, TargetFlags.None)
{
m_Item = item;
}
protected override void OnTarget(Mobile from, object o)
{
if (m_Item?.Deleted != false)
return;
if (o is BaseTalisman talisman)
{
if (talisman.Charges == 0)
{
talisman.Charges = talisman.MaxCharges;
m_Item.Delete();
from.SendLocalizedMessage(1075100); // The item has been recharged.
}
else
{
from.SendLocalizedMessage(
1075099); // You cannot recharge that item until all of its current charges have been used.
}
}
else
{
from.SendLocalizedMessage(1046439); // That is not a valid target.
}
}
}
}
}
using Server.Targeting;
namespace Server.Items
{
public class RunedSwitch : Item
{
[Constructible]
public RunedSwitch() : base(0x2F61) => Weight = 1.0;
public RunedSwitch(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1072896; // runed switch
public override void OnDoubleClick(Mobile from)
{
if (IsChildOf(from.Backpack))
{
from.SendLocalizedMessage(1075101); // Please select an item to recharge.
from.Target = new InternalTarget(this);
}
else
{
from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it.
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0); // version
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
}
private class InternalTarget : Target
{
private RunedSwitch m_Item;
public InternalTarget(RunedSwitch item) : base(0, false, TargetFlags.None) => m_Item = item;
protected override void OnTarget(Mobile from, object o)
{
if (m_Item?.Deleted != false)
return;
if (o is BaseTalisman talisman)
{
if (talisman.Charges == 0)
{
talisman.Charges = talisman.MaxCharges;
m_Item.Delete();
from.SendLocalizedMessage(1075100); // The item has been recharged.
}
else
{
from.SendLocalizedMessage(
1075099); // You cannot recharge that item until all of its current charges have been used.
}
}
else
{
from.SendLocalizedMessage(1046439); // That is not a valid target.
}
}
}
}
}

View file

@ -57,10 +57,7 @@ namespace Server.Items
[CommandProperty(AccessLevel.GameMaster)]
public bool IsItem => Type?.Namespace.Equals("Server.Items") == true;
public override string ToString()
{
return Type?.Name ?? "None";
}
public override string ToString() => Type?.Name ?? "None";
private static void SetSaveFlag(ref SaveFlag flags, SaveFlag toSet, bool setIf)
{
@ -68,10 +65,7 @@ namespace Server.Items
flags |= toSet;
}
private static bool GetSaveFlag(SaveFlag flags, SaveFlag toGet)
{
return (flags & toGet) != 0;
}
private static bool GetSaveFlag(SaveFlag flags, SaveFlag toGet) => (flags & toGet) != 0;
public virtual void Serialize(GenericWriter writer)
{
@ -95,10 +89,7 @@ namespace Server.Items
writer.WriteEncodedInt(Amount);
}
public int DamageBonus(Mobile to)
{
return to?.GetType() == Type ? Amount : 0;
}
public int DamageBonus(Mobile to) => to?.GetType() == Type ? Amount : 0;
[Flags]
private enum SaveFlag

View file

@ -45,10 +45,7 @@ namespace Server.Mobiles
{
private Mobile m_Mobile;
public TalismanReleaseEntry(Mobile m) : base(6118, 3)
{
m_Mobile = m;
}
public TalismanReleaseEntry(Mobile m) : base(6118, 3) => m_Mobile = m;
public override void OnClick()
{