cleanup: Fixes bugs and cleans up code (#660)

This commit is contained in:
Kamron Batman 2021-07-19 20:49:59 -07:00 • committed by GitHub
parent 1de0b656a9
commit 679e8100f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
99 changed files with 160 additions and 346 deletions

View file

@ -161,7 +161,7 @@ namespace Server.Items
return AddonFitResult.Blocked;
}
if (!CheckHouse(from, p3D, map, c.ItemData.Height, ref house))
if (!CheckHouse(from, p3D, map, c.ItemData.Height, out house))
{
return AddonFitResult.NotInHouse;
}
@ -203,7 +203,7 @@ namespace Server.Items
return AddonFitResult.Valid;
}
public static bool CheckHouse(Mobile from, Point3D p, Map map, int height, ref BaseHouse house)
public static bool CheckHouse(Mobile from, Point3D p, Map map, int height, out BaseHouse house)
{
house = BaseHouse.FindHouseAt(p, map, height);

View file

@ -246,7 +246,7 @@ namespace Server.Items
return AddonFitResult.Blocked;
}
if (!BaseAddon.CheckHouse(from, p3D, map, c.ItemData.Height, ref house))
if (!BaseAddon.CheckHouse(from, p3D, map, c.ItemData.Height, out house))
{
return AddonFitResult.NotInHouse;
}
@ -269,7 +269,7 @@ namespace Server.Items
return AddonFitResult.Blocked;
}
if (!BaseAddon.CheckHouse(from, p3, map, ItemData.Height, ref house))
if (!BaseAddon.CheckHouse(from, p3, map, ItemData.Height, out house))
{
return AddonFitResult.NotInHouse;
}

View file

@ -1,4 +1,3 @@
using System;
using System.Linq;
using Server.Mobiles;

View file

@ -769,7 +769,7 @@ namespace Server.Items
list.Add(1060436, prop.ToString()); // luck ~1_val~
}
if ((prop = ClothingAttributes.MageArmor) != 0)
if (ClothingAttributes.MageArmor != 0)
{
list.Add(1060437); // mage armor
}
@ -784,7 +784,7 @@ namespace Server.Items
list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~
}
if ((prop = Attributes.NightSight) != 0)
if (Attributes.NightSight != 0)
{
list.Add(1060441); // night sight
}
@ -809,7 +809,7 @@ namespace Server.Items
list.Add(1060450, prop.ToString()); // self repair ~1_val~
}
if ((prop = Attributes.SpellChanneling) != 0)
if (Attributes.SpellChanneling != 0)
{
list.Add(1060482); // spell channeling
}

View file

@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;
using Server.ContextMenus;
using Server.Gumps;

View file

@ -1,4 +1,3 @@
using System;
using Server.Gumps;
using Server.Multis;
using Server.Network;

View file

@ -16,8 +16,8 @@ namespace Server.Items
public override int LabelNumber => 1075040; // Quiver of the Elements
public override void AlterBowDamage(
ref int phys, ref int fire, ref int cold, ref int pois, ref int nrgy,
ref int chaos, ref int direct
out int phys, out int fire, out int cold, out int pois, out int nrgy,
out int chaos, out int direct
)
{
phys = fire = cold = pois = nrgy = direct = 0;

View file

@ -18,8 +18,8 @@ namespace Server.Items
public override int LabelNumber => 1075038; // Quiver of Rage
public override void AlterBowDamage(
ref int phys, ref int fire, ref int cold, ref int pois, ref int nrgy,
ref int chaos, ref int direct
out int phys, out int fire, out int cold, out int pois, out int nrgy,
out int chaos, out int direct
)
{
chaos = direct = 0;

View file

@ -50,7 +50,7 @@ namespace Server.Items
else
{
length = OutgoingItemPackets.CreateWorldItem(buffer, this);
BinaryPrimitives.WriteUInt16BigEndian(buffer[7..2], GMItemId);
BinaryPrimitives.WriteUInt16BigEndian(buffer[7..9], GMItemId);
}
ns.Send(buffer[..length]);

View file

@ -265,10 +265,15 @@ namespace Server.Items
list.Add(1074762, prop.ToString()); // Damage modifier: ~1_PERCENT~%
}
int phys, fire, cold, pois, nrgy, chaos, direct;
phys = fire = cold = pois = nrgy = chaos = direct = 0;
AlterBowDamage(ref phys, ref fire, ref cold, ref pois, ref nrgy, ref chaos, ref direct);
AlterBowDamage(
out var phys,
out var fire,
out var cold,
out var pois,
out var nrgy,
out var chaos,
out var direct
);
if (phys != 0)
{
@ -372,7 +377,7 @@ namespace Server.Items
list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~
}
if ((prop = Attributes.NightSight) != 0)
if (Attributes.NightSight != 0)
{
list.Add(1060441); // night sight
}
@ -547,10 +552,11 @@ namespace Server.Items
}
public virtual void AlterBowDamage(
ref int phys, ref int fire, ref int cold, ref int pois, ref int nrgy,
ref int chaos, ref int direct
out int phys, out int fire, out int cold, out int pois, out int nrgy,
out int chaos, out int direct
)
{
phys = fire = cold = pois = nrgy = chaos = direct = 0;
}
public void InvalidateWeight()

View file

@ -12,8 +12,8 @@ namespace Server.Items
public override int LabelNumber => 1073111; // Quiver of Blight
public override void AlterBowDamage(
ref int phys, ref int fire, ref int cold, ref int pois, ref int nrgy,
ref int chaos, ref int direct
out int phys, out int fire, out int cold, out int pois, out int nrgy,
out int chaos, out int direct
)
{
phys = fire = nrgy = chaos = direct = 0;

View file

@ -12,8 +12,8 @@ namespace Server.Items
public override int LabelNumber => 1073109; // quiver of fire
public override void AlterBowDamage(
ref int phys, ref int fire, ref int cold, ref int pois, ref int nrgy,
ref int chaos, ref int direct
out int phys, out int fire, out int cold, out int pois, out int nrgy,
out int chaos, out int direct
)
{
cold = pois = nrgy = chaos = direct = 0;

View file

@ -12,8 +12,8 @@ namespace Server.Items
public override int LabelNumber => 1073110; // quiver of ice
public override void AlterBowDamage(
ref int phys, ref int fire, ref int cold, ref int pois, ref int nrgy,
ref int chaos, ref int direct
out int phys, out int fire, out int cold, out int pois, out int nrgy,
out int chaos, out int direct
)
{
fire = pois = nrgy = chaos = direct = 0;

View file

@ -12,8 +12,8 @@ namespace Server.Items
public override int LabelNumber => 1073112; // Quiver of Lightning
public override void AlterBowDamage(
ref int phys, ref int fire, ref int cold, ref int pois, ref int nrgy,
ref int chaos, ref int direct
out int phys, out int fire, out int cold, out int pois, out int nrgy,
out int chaos, out int direct
)
{
fire = cold = pois = chaos = direct = 0;

View file

@ -1,5 +1,3 @@
using System;
namespace Server.Items
{
public class DisguisePersistance : Item

View file

@ -160,7 +160,6 @@ namespace Server.Gumps
x += 150;
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center("1"), color));
x += 60;
}
}

View file

@ -350,8 +350,6 @@ namespace Server.Items
{
private Item m_Gland;
private Timer m_Timer;
public PlagueBeastBackupOrgan() : base(0x1362, 0x6)
{
}
@ -407,7 +405,7 @@ namespace Server.Items
if (to.Hue == 0x1 && m_Gland == null && item is PlagueBeastGland)
{
m_Gland = item;
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(3), FinishHealing);
Timer.DelayCall(TimeSpan.FromSeconds(3), FinishHealing);
from.SendAsciiMessage(0x3B2, "* You place the healthy gland inside the organ sac *");
item.Movable = false;
@ -437,7 +435,7 @@ namespace Server.Items
Components[i].Hue = 0x6;
}
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(2), OpenOrgan);
Timer.DelayCall(TimeSpan.FromSeconds(2), OpenOrgan);
}
public void OpenOrgan()

View file

@ -550,7 +550,7 @@ namespace Server.Items
Effects.PlaySound(from.Location, from.Map, 0x243);
Effects.SendMovingParticles(
new Entity(Server.Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map),
new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map),
from,
0x36D4,
7,
@ -797,7 +797,7 @@ namespace Server.Items
Effects.PlaySound(from.Location, from.Map, 0x243);
Effects.SendMovingParticles(
new Entity(Server.Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map),
new Entity(Serial.Zero, new Point3D(from.X - 6, from.Y - 6, from.Z + 15), from.Map),
from,
0x36D4,
7,

View file

@ -1,4 +1,3 @@
using System;
using Server.Engines.MLQuests;
using Server.Engines.MLQuests.Objectives;
using Server.Mobiles;

View file

@ -1,4 +1,3 @@
using System;
using Server.Engines.Quests.Haven;
using Server.Engines.VeteranRewards;
using Server.Gumps;

View file

@ -8,8 +8,6 @@ namespace Server.Targeting
public WandTarget(BaseWand item) : base(6, false, TargetFlags.None) => m_Item = item;
private static int GetOffset(Mobile caster) => 5 + (int)(caster.Skills.Magery.Value * 0.02);
protected override void OnTarget(Mobile from, object targeted)
{
m_Item.DoWandTarget(from, targeted);

View file

@ -1847,24 +1847,24 @@ namespace Server.Items
}
AddBlood(attacker, defender, damage);
int phys, fire, cold, pois, nrgy, chaos, direct;
GetDamageTypes(
attacker,
out var phys,
out var fire,
out var cold,
out var pois,
out var nrgy,
out var chaos,
out var direct
);
if (Core.ML && this is BaseRanged)
if (Core.ML && this is BaseRanged && attacker.FindItemOnLayer(Layer.Cloak) is BaseQuiver quiver)
{
if (attacker.FindItemOnLayer(Layer.Cloak) is BaseQuiver quiver)
{
quiver.AlterBowDamage(ref phys, ref fire, ref cold, ref pois, ref nrgy, ref chaos, ref direct);
}
quiver.AlterBowDamage(out phys, out fire, out cold, out pois, out nrgy, out chaos, out direct);
}
else
{
GetDamageTypes(
attacker,
out phys,
out fire,
out cold,
out pois,
out nrgy,
out chaos,
out direct
);
}
if (Consecrated)
@ -1930,8 +1930,6 @@ namespace Server.Items
ImmolatingWeaponSpell.DoEffect(this, defender);
}
var damageGiven = damage;
if (a?.OnBeforeDamage(attacker, defender) == false)
{
WeaponAbility.ClearCurrentAbility(attacker);
@ -1946,7 +1944,7 @@ namespace Server.Items
var ignoreArmor = a is ArmorIgnore || move?.IgnoreArmor(attacker) == true;
damageGiven = AOS.Damage(
var damageGiven = AOS.Damage(
defender,
attacker,
damage,