#W# Confict: Fixed BaseCreature git merge conflict.
This commit is contained in:
commit
ad38314ca7
112 changed files with 5397 additions and 616 deletions
|
|
@ -484,8 +484,9 @@ public abstract partial class BaseDoor : Item, ILockable, ITelekinesisable
|
|||
}
|
||||
else
|
||||
{
|
||||
_current = _current.Link;
|
||||
valid = _current?.Deleted == false && _current != _door;
|
||||
var next = _current.Link;
|
||||
valid = next?.Deleted == false && !IsVisited(next);
|
||||
_current = next;
|
||||
}
|
||||
|
||||
if (!valid)
|
||||
|
|
@ -497,6 +498,27 @@ public abstract partial class BaseDoor : Item, ILockable, ITelekinesisable
|
|||
return valid;
|
||||
}
|
||||
|
||||
// Links are set pairwise by GMs, so a chain can loop back to a door other than the start
|
||||
private readonly bool IsVisited(BaseDoor door)
|
||||
{
|
||||
var visited = _door;
|
||||
|
||||
while (true)
|
||||
{
|
||||
if (visited == door)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (visited == _current || visited == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
visited = visited.Link;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseDoor Current
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ public partial class StrongBackpack : Backpack // Used on Pack animals
|
|||
base.CheckHold(m, item, false, checkItems, plusItems, plusWeight);
|
||||
|
||||
public override bool CheckContentDisplay(Mobile from) =>
|
||||
RootParent is BaseCreature creature && creature.Controlled && creature.ControlMaster == from ||
|
||||
RootParent is BaseCreature creature && creature.ControlMaster == from ||
|
||||
base.CheckContentDisplay(from);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -806,7 +806,7 @@ public partial class TreasureMap : MapItem
|
|||
|
||||
if (bc != null)
|
||||
{
|
||||
m_Chest.Guardians.Add(bc);
|
||||
m_Chest.AddToGuardians(bc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,6 +100,10 @@ public partial class Corpse : Container, ICarvable
|
|||
|
||||
private Dictionary<Item, InstancedItemInfo> _instancedItems;
|
||||
|
||||
// Worn gear being lifted is off _equipItems before its remove goes out; until then it stays public so
|
||||
// the remove reaches everyone who was shown it worn.
|
||||
private Item _liftingWornItem;
|
||||
|
||||
[SerializableField(0)]
|
||||
private List<Item> _restoreEquip;
|
||||
|
||||
|
|
@ -197,6 +201,12 @@ public partial class Corpse : Container, ICarvable
|
|||
// Why was this public?
|
||||
// public override bool IsPublicContainer => true;
|
||||
|
||||
// Human corpses show their worn gear to everyone who sees them (SendInfoTo), not only to openers.
|
||||
private bool ShowsWornGear => ((Body)Amount).IsHuman && ItemID == 0x2006;
|
||||
|
||||
public override bool IsChildPublic(Item child) =>
|
||||
ShowsWornGear && (child == _liftingWornItem || _equipItems?.Contains(child) == true);
|
||||
|
||||
public Corpse(Mobile owner, List<Item> equipItems) : this(owner, 0, 0, 0, 0, equipItems)
|
||||
{
|
||||
}
|
||||
|
|
@ -416,7 +426,7 @@ public partial class Corpse : Container, ICarvable
|
|||
{
|
||||
from.SendLocalizedMessage(500485); // You see nothing useful to carve from the corpse.
|
||||
}
|
||||
else if (((Body)Amount).IsHuman && ItemID == 0x2006)
|
||||
else if (ShowsWornGear)
|
||||
{
|
||||
new Blood(0x122D).MoveToWorld(Location, Map);
|
||||
|
||||
|
|
@ -587,6 +597,7 @@ public partial class Corpse : Container, ICarvable
|
|||
{
|
||||
_decayTimer?.Stop();
|
||||
_decayTimer = null;
|
||||
_liftingWornItem = null;
|
||||
}
|
||||
|
||||
public static string GetCorpseName(Mobile m) => m is BaseCreature bc ? bc.CorpseNameOverride ?? bc.CorpseName : null;
|
||||
|
|
@ -740,7 +751,7 @@ public partial class Corpse : Container, ICarvable
|
|||
{
|
||||
base.SendInfoTo(ns, world);
|
||||
|
||||
if (((Body)Amount).IsHuman && ItemID == 0x2006)
|
||||
if (ShowsWornGear)
|
||||
{
|
||||
ns.SendCorpseContent(ns.Mobile, this);
|
||||
ns.SendCorpseEquip(ns.Mobile, this);
|
||||
|
|
@ -812,6 +823,23 @@ public partial class Corpse : Container, ICarvable
|
|||
AddToLooters(from);
|
||||
|
||||
_instancedItems?.Remove(item);
|
||||
|
||||
// Lifted gear is loot from then on. Clients only learn worn gear from 0x89 on first sight, so a
|
||||
// piece put back would show worn after a relog but loose to everyone already watching.
|
||||
if (_equipItems != null && this.Remove(_equipItems, item))
|
||||
{
|
||||
_liftingWornItem = item;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnItemRemoved(Item item)
|
||||
{
|
||||
base.OnItemRemoved(item);
|
||||
|
||||
if (item == _liftingWornItem)
|
||||
{
|
||||
_liftingWornItem = null;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list)
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ public partial class BigFish : Item, ICarvable
|
|||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (Weight >= 20)
|
||||
if (Core.SE && Weight >= 20)
|
||||
{
|
||||
if (_fisher != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ public partial class TrophyAddon : Item, IAddon
|
|||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_animalWeight >= 20)
|
||||
if (Core.SE && _animalWeight >= 20)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_hunter))
|
||||
{
|
||||
|
|
@ -346,7 +346,7 @@ public partial class TrophyDeed : Item
|
|||
{
|
||||
base.GetProperties(list);
|
||||
|
||||
if (_animalWeight >= 20)
|
||||
if (Core.SE && _animalWeight >= 20)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_hunter))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public partial class MessageInABottle : Item
|
|||
|
||||
public static int GetRandomLevel()
|
||||
{
|
||||
if (Core.AOS && Utility.Random(25) < 1)
|
||||
if (Core.AOS && Utility.Random(Core.SE ? 25 : 40) < 1)
|
||||
{
|
||||
return 4; // ancient
|
||||
}
|
||||
|
|
|
|||
|
|
@ -228,11 +228,6 @@ public partial class BallOfSummoning : Item, TranslocationItem
|
|||
{
|
||||
pet.SetControlMaster(from);
|
||||
|
||||
if (pet.SummonMaster != null)
|
||||
{
|
||||
pet.SummonMaster = from;
|
||||
}
|
||||
|
||||
pet.ControlTarget = from;
|
||||
pet.ControlOrder = OrderType.Follow;
|
||||
|
||||
|
|
|
|||
|
|
@ -1698,12 +1698,12 @@ public abstract partial class BaseWeapon
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (attacker is not BaseCreature bc || bc.PackInstinct == PackInstinct.None || !bc.Controlled && !bc.Summoned)
|
||||
if (attacker is not BaseCreature bc || bc.PackInstinct == PackInstinct.None)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
var master = bc.ControlMaster ?? bc.SummonMaster;
|
||||
var master = bc.GetMaster();
|
||||
|
||||
if (master == null)
|
||||
{
|
||||
|
|
@ -1713,8 +1713,7 @@ public abstract partial class BaseWeapon
|
|||
var inPack = 1;
|
||||
foreach (var m in defender.GetMobilesInRange<BaseCreature>(1))
|
||||
{
|
||||
if (m != attacker && (m.PackInstinct & bc.PackInstinct) != 0 && (m.Controlled || m.Summoned) &&
|
||||
master == (m.ControlMaster ?? m.SummonMaster) && m.Combatant == defender)
|
||||
if (m != attacker && (m.PackInstinct & bc.PackInstinct) != 0 && master == m.GetMaster() && m.Combatant == defender)
|
||||
{
|
||||
inPack++;
|
||||
}
|
||||
|
|
@ -1736,7 +1735,7 @@ public abstract partial class BaseWeapon
|
|||
{
|
||||
foreach (var m in defender.GetMobilesInRange<Clone>(4))
|
||||
{
|
||||
if (m?.Summoned == true && m.SummonMaster == defender)
|
||||
if (m?.SummonMaster == defender)
|
||||
{
|
||||
// Your attack has been diverted to a nearby mirror image of your target!
|
||||
attacker.SendLocalizedMessage(1063141);
|
||||
|
|
@ -2100,7 +2099,7 @@ public abstract partial class BaseWeapon
|
|||
|
||||
if (attacker is VampireBatFamiliar bc)
|
||||
{
|
||||
var caster = bc.ControlMaster ?? bc.SummonMaster;
|
||||
var caster = bc.GetMaster();
|
||||
|
||||
if (caster != null && caster.Map == bc.Map && caster.InRange(bc, 2))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue