Fixes for Last Moved (#194)

This commit is contained in:
Kamron Batman 2020-08-16 06:58:16 -07:00 • committed by GitHub
parent 3a081d5322
commit b476bcfd24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 155 additions and 398 deletions

View file

@ -1553,7 +1553,7 @@ namespace Server.Mobiles
else if (TransferItem.IsInCombat(m_Mobile))
{
from.SendMessage("You may not transfer a pet that has recently been in combat.");
to.SendMessage("The pet may not be transfered to you because it has recently been in combat.");
to.SendMessage("The pet may not be transferred to you because it has recently been in combat.");
}
else
{
@ -2596,7 +2596,7 @@ namespace Server.Mobiles
else if (accepted && IsInCombat(m_Creature))
{
from.SendMessage("You may not transfer a pet that has recently been in combat.");
to.SendMessage("The pet may not be transfered to you because it has recently been in combat.");
to.SendMessage("The pet may not be transferred to you because it has recently been in combat.");
return false;
}

View file

@ -695,22 +695,16 @@ namespace Server.Mobiles
public override int GetMinResistance(ResistanceType type)
{
int magicResist = (int)(Skills.MagicResist.Value * 10);
int min = int.MinValue;
int min;
if (magicResist >= 1000)
min = 40 + (magicResist - 1000) / 50;
else if (magicResist >= 400)
min = (magicResist - 400) / 15;
else
min = int.MinValue;
if (min > MaxPlayerResistance)
min = MaxPlayerResistance;
int baseMin = base.GetMinResistance(type);
if (min < baseMin)
min = baseMin;
return min;
return Math.Clamp(min, base.GetMinResistance(type), MaxPlayerResistance);
}
public override void OnManaChange(int oldValue)
@ -1612,27 +1606,17 @@ namespace Server.Mobiles
m_NoRecursion = false;
}
public override bool OnMoveOver(Mobile m)
{
if (m is BaseCreature creature && !creature.Controlled)
return !Alive || !creature.Alive || IsDeadBondedPet || creature.IsDeadBondedPet ||
Hidden && AccessLevel > AccessLevel.Player;
public override bool OnMoveOver(Mobile m) =>
m is BaseCreature creature && !creature.Controlled
? !Alive || !creature.Alive || IsDeadBondedPet || creature.IsDeadBondedPet ||
Hidden && AccessLevel > AccessLevel.Player
: Region.IsPartOf<SafeZone>() && m is PlayerMobile pm &&
(pm.DuelContext == null || pm.DuelPlayer == null || !pm.DuelContext.Started || pm.DuelContext.Finished ||
pm.DuelPlayer.Eliminated) || base.OnMoveOver(m);
if (Region.IsPartOf<SafeZone>() && m is PlayerMobile pm)
if (pm.DuelContext == null || pm.DuelPlayer == null || !pm.DuelContext.Started || pm.DuelContext.Finished ||
pm.DuelPlayer.Eliminated)
return true;
return base.OnMoveOver(m);
}
public override bool CheckShove(Mobile shoved)
{
if (m_IgnoreMobiles || TransformationSpellHelper.UnderTransformation(shoved, typeof(WraithFormSpell)))
return true;
return base.CheckShove(shoved);
}
public override bool CheckShove(Mobile shoved) =>
m_IgnoreMobiles || TransformationSpellHelper.UnderTransformation(shoved, typeof(WraithFormSpell)) ||
base.CheckShove(shoved);
protected override void OnMapChange(Map oldMap)
{
@ -3210,10 +3194,7 @@ namespace Server.Mobiles
if (item.Layer == Layer.Mount)
return false;
if (item.LootType == LootType.Blessed || item.LootType == LootType.Newbied || item.BlessedFor == this)
return false;
return true;
return item.LootType != LootType.Blessed && item.LootType != LootType.Newbied && item.BlessedFor != this;
}
private void ToggleItemInsurance_Callback(Mobile from, object obj)
@ -3694,13 +3675,8 @@ namespace Server.Mobiles
return result;
}
public override bool CheckPoisonImmunity(Mobile from, Poison poison)
{
if (Young && (DuelContext?.Started != true || DuelContext.Finished))
return true;
return base.CheckPoisonImmunity(from, poison);
}
public override bool CheckPoisonImmunity(Mobile from, Poison poison) =>
Young && (DuelContext?.Started != true || DuelContext.Finished) || base.CheckPoisonImmunity(from, poison);
public override void OnPoisonImmunity(Mobile from, Poison poison)
{
@ -3997,13 +3973,7 @@ namespace Server.Mobiles
public override string ApplyNameSuffix(string suffix)
{
if (Young)
{
if (suffix.Length == 0)
suffix = "(Young)";
else
suffix = $"{suffix} (Young)";
}
if (Young) suffix = suffix.Length == 0 ? "(Young)" : $"{suffix} (Young)";
if (EthicPlayer != null)
{
@ -4020,10 +3990,7 @@ namespace Server.Mobiles
if (faction != null)
{
string adjunct = $"[{faction.Definition.Abbreviation}]";
if (suffix.Length == 0)
suffix = adjunct;
else
suffix = $"{suffix} {adjunct}";
suffix = suffix.Length == 0 ? adjunct : $"{suffix} {adjunct}";
}
}

View file

@ -838,23 +838,14 @@ namespace Server.Mobiles
if (vi == null)
return;
string name;
if (!string.IsNullOrEmpty(item.Name))
name = item.Name;
else
name = $"#{item.LabelNumber}";
string name = item.Name.IsNullOrDefault($"#{item.LabelNumber}");
from.SendLocalizedMessage(1043303, name); // Type in a price and description for ~1_ITEM~ (ESC=not for sale)
from.Prompt = new VendorPricePrompt(this, vi);
}
public override bool AllowEquipFrom(Mobile from)
{
if (BaseHouse.NewVendorSystem && IsOwner(from))
return true;
return base.AllowEquipFrom(from);
}
public override bool AllowEquipFrom(Mobile from) =>
BaseHouse.NewVendorSystem && IsOwner(from) || base.AllowEquipFrom(from);
public override bool CheckNonlocalLift(Mobile from, Item item)
{