fix: Cleanup IPoint3D calls (#704)
This commit is contained in:
parent
788b04b958
commit
3293ffcf06
33 changed files with 158 additions and 264 deletions
|
|
@ -75,7 +75,7 @@ namespace Server.Commands
|
|||
{
|
||||
var m = list[i];
|
||||
|
||||
if (!m.CanSee(pm) && Utility.InUpdateRange(m, pm))
|
||||
if (!m.CanSee(pm) && Utility.InUpdateRange(m.Location, pm.Location))
|
||||
{
|
||||
OutgoingEntityPackets.CreateRemoveEntity(removeEntity, pm.Serial);
|
||||
m.NetState?.Send(removeEntity);
|
||||
|
|
@ -110,7 +110,7 @@ namespace Server.Commands
|
|||
pm.SendMessage("{0} has been added to your visibility list.", targ.Name);
|
||||
}
|
||||
|
||||
if (Utility.InUpdateRange(targ, from))
|
||||
if (Utility.InUpdateRange(targ.Location, from.Location))
|
||||
{
|
||||
var ns = targ.NetState;
|
||||
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_From.SendLocalizedMessage(1049616); // You are too busy to do that at the moment.
|
||||
}
|
||||
else if (m_From.Map == arena.Facet && arena.Zone.Contains(m_From))
|
||||
else if (m_From.Map == arena.Facet && arena.Zone.Contains(m_From.Location))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1019003); // You are already there.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Server.Engines.PartySystem
|
|||
var c = Members[i].Mobile;
|
||||
var ns = c.NetState;
|
||||
|
||||
if (c != m && ns != null && m.Map == c.Map && Utility.InUpdateRange(c, m) && c.CanSee(m))
|
||||
if (c != m && ns != null && m.Map == c.Map && Utility.InUpdateRange(c.Location, m.Location) && c.CanSee(m))
|
||||
{
|
||||
ns.Send(p);
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ namespace Server.Engines.PartySystem
|
|||
var c = Members[i].Mobile;
|
||||
var ns = c.NetState;
|
||||
|
||||
if (c != m && ns != null && m.Map == c.Map && Utility.InUpdateRange(c, m) && c.CanSee(m))
|
||||
if (c != m && ns != null && m.Map == c.Map && Utility.InUpdateRange(c.Location, m.Location) && c.CanSee(m))
|
||||
{
|
||||
ns.Send(p);
|
||||
}
|
||||
|
|
@ -85,7 +85,7 @@ namespace Server.Engines.PartySystem
|
|||
public void OnStatsQuery(Mobile beholder, Mobile beheld)
|
||||
{
|
||||
if (beholder != beheld && Contains(beholder) && beholder.Map == beheld.Map &&
|
||||
Utility.InUpdateRange(beholder, beheld))
|
||||
Utility.InUpdateRange(beholder.Location, beheld.Location))
|
||||
{
|
||||
if (!beholder.CanSee(beheld))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Server.Engines.Quests.Necro
|
|||
}
|
||||
else if (qs.IsObjectiveInProgress(typeof(UseCallingScrollObjective)))
|
||||
{
|
||||
if (pm.Map == m_WellOfTearsMap && m_WellOfTearsArea.Contains(pm))
|
||||
if (pm.Map == m_WellOfTearsMap && m_WellOfTearsArea.Contains(pm.Location))
|
||||
{
|
||||
QuestObjective obj = qs.FindObjective<UseCallingScrollObjective>();
|
||||
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace Server.Engines.Quests.Naturalist
|
|||
}
|
||||
}
|
||||
|
||||
public static NestArea Find(IPoint2D p)
|
||||
public static NestArea Find(Point3D p)
|
||||
{
|
||||
return m_Areas.FirstOrDefault(area => area.Contains(p));
|
||||
}
|
||||
|
|
@ -73,11 +73,13 @@ namespace Server.Engines.Quests.Naturalist
|
|||
return null;
|
||||
}
|
||||
|
||||
public bool Contains(IPoint2D p)
|
||||
public bool Contains(Point3D p)
|
||||
{
|
||||
var x = p.X;
|
||||
var y = p.Y;
|
||||
foreach (var rect in m_Rects)
|
||||
{
|
||||
if (rect.Contains(p))
|
||||
if (rect.Contains(x, y))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Engines.Quests.Naturalist
|
|||
{
|
||||
var nest = m_CurrentNest;
|
||||
|
||||
if ((from.Map == Map.Trammel || from.Map == Map.Felucca) && nest.Contains(from))
|
||||
if ((from.Map == Map.Trammel || from.Map == Map.Felucca) && nest.Contains(from.Location))
|
||||
{
|
||||
if (m_StudyState != StudyState.Inactive)
|
||||
{
|
||||
|
|
@ -75,7 +75,7 @@ namespace Server.Engines.Quests.Naturalist
|
|||
}
|
||||
else if (from.Map == Map.Trammel || from.Map == Map.Felucca)
|
||||
{
|
||||
var nest = NestArea.Find(from);
|
||||
var nest = NestArea.Find(from.Location);
|
||||
|
||||
if (nest != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -119,12 +119,12 @@ namespace Server.Misc
|
|||
{
|
||||
var r = m.Region;
|
||||
|
||||
if (r.IsPartOf<HouseRegion>() || BaseBoat.FindBoatAt(m, m.Map) != null)
|
||||
if (r.IsPartOf<HouseRegion>() || BaseBoat.FindBoatAt(m.Location, m.Map) != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// TODO: a CanReach of something check as opposed to above?
|
||||
|
||||
// TODO: a CanReach of something check as opposed to above?
|
||||
if (r.IsPartOf("Yomotsu Mines") || r.IsPartOf("Fan Dancer's Dojo"))
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace Server.Items
|
|||
|
||||
if (!e.Handled && from.InRange(this, 10) && e.Speech.ToLower() == Word)
|
||||
{
|
||||
var boat = BaseBoat.FindBoatAt(from, from.Map);
|
||||
var boat = BaseBoat.FindBoatAt(from.Location, from.Map);
|
||||
|
||||
if (boat == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -88,32 +88,15 @@ namespace Server.Items
|
|||
|
||||
private static void FinishLaunch(Point3D endLoc, Map map)
|
||||
{
|
||||
var hue = Utility.Random(40);
|
||||
|
||||
if (hue < 8)
|
||||
var hue = Utility.Random(40) switch
|
||||
{
|
||||
hue = 0x66D;
|
||||
}
|
||||
else if (hue < 10)
|
||||
{
|
||||
hue = 0x482;
|
||||
}
|
||||
else if (hue < 12)
|
||||
{
|
||||
hue = 0x47E;
|
||||
}
|
||||
else if (hue < 16)
|
||||
{
|
||||
hue = 0x480;
|
||||
}
|
||||
else if (hue < 20)
|
||||
{
|
||||
hue = 0x47F;
|
||||
}
|
||||
else
|
||||
{
|
||||
hue = 0;
|
||||
}
|
||||
< 8 => 0x66D,
|
||||
< 10 => 0x482,
|
||||
< 12 => 0x47E,
|
||||
< 16 => 0x480,
|
||||
< 20 => 0x47F,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
if (Utility.RandomBool())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -203,22 +203,13 @@ namespace Server.Misc
|
|||
{
|
||||
var medPoints = (from.Int + from.Skills.Meditation.Value) * 0.5;
|
||||
|
||||
if (medPoints <= 0)
|
||||
rate = medPoints switch
|
||||
{
|
||||
rate = 7.0;
|
||||
}
|
||||
else if (medPoints <= 100)
|
||||
{
|
||||
rate = 7.0 - 239 * medPoints / 2400 + 19 * medPoints * medPoints / 48000;
|
||||
}
|
||||
else if (medPoints < 120)
|
||||
{
|
||||
rate = 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
rate = 0.75;
|
||||
}
|
||||
<= 0 => 7.0,
|
||||
<= 100 => 7.0 - 239 * medPoints / 2400 + 19 * medPoints * medPoints / 48000,
|
||||
< 120 => 1.0,
|
||||
_ => 0.75
|
||||
};
|
||||
|
||||
rate += armorPenalty;
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
activate = false;
|
||||
}
|
||||
else if (m.Map == null || m.Map == Map.Internal || !m.Map.GetSector(m).Active)
|
||||
else if (m.Map == null || m.Map == Map.Internal || !m.Map.GetSector(m.Location).Active)
|
||||
{
|
||||
activate = false;
|
||||
}
|
||||
|
|
@ -3040,7 +3040,7 @@ namespace Server.Mobiles
|
|||
|
||||
if (m_Owner.m_Mobile.PlayerRangeSensitive) // have to check this in the timer....
|
||||
{
|
||||
var sect = m_Owner.m_Mobile.Map.GetSector(m_Owner.m_Mobile);
|
||||
var sect = m_Owner.m_Mobile.Map.GetSector(m_Owner.m_Mobile.Location);
|
||||
if (!sect.Active)
|
||||
{
|
||||
m_Owner.Deactivate();
|
||||
|
|
|
|||
|
|
@ -887,15 +887,13 @@ namespace Server.Mobiles
|
|||
public virtual bool CanBreath => HasBreath && !Summoned;
|
||||
public virtual bool IsDispellable => Summoned && !IsAnimatedDead;
|
||||
|
||||
public virtual bool
|
||||
PlayerRangeSensitive // If they are following a waypoint, they'll continue to follow it even if players aren't around
|
||||
=> CurrentWayPoint == null;
|
||||
// If they are following a waypoint, they'll continue to follow it even if players aren't around
|
||||
public virtual bool PlayerRangeSensitive => CurrentWayPoint == null;
|
||||
|
||||
public virtual bool ReturnsToHome =>
|
||||
SeeksHome && Home != Point3D.Zero && !m_ReturnQueued && !Controlled && !Summoned;
|
||||
|
||||
// used for deleting untamed creatures [in houses]
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RemoveIfUntamed { get; set; }
|
||||
|
||||
|
|
@ -3895,16 +3893,13 @@ namespace Server.Mobiles
|
|||
|
||||
public void GoHome_Callback()
|
||||
{
|
||||
if (m_ReturnQueued && IsSpawnerBound())
|
||||
if (m_ReturnQueued && IsSpawnerBound() && !Map.GetSector(X, Y).Active)
|
||||
{
|
||||
SetLocation(Home, true);
|
||||
|
||||
if (!Map.GetSector(X, Y).Active)
|
||||
{
|
||||
SetLocation(Home, true);
|
||||
|
||||
if (!Map.GetSector(X, Y).Active)
|
||||
{
|
||||
AIObject?.Deactivate();
|
||||
}
|
||||
AIObject?.Deactivate();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -968,7 +968,7 @@ namespace Server.Mobiles
|
|||
|
||||
public bool CanInteractWith(Mobile from, bool ownerOnly)
|
||||
{
|
||||
if (!from.CanSee(this) || !Utility.InUpdateRange(from, this) || !from.CheckAlive())
|
||||
if (!from.CanSee(this) || !Utility.InUpdateRange(from.Location, Location) || !from.CheckAlive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -1184,7 +1184,7 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if (House.IsInside(to) || to.Map != House.Map || !House.InRange(to, 5))
|
||||
if (House.IsInside(to) || to.Map != House.Map || !House.InRange(to.Location, 5))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ namespace Server.Multis
|
|||
|
||||
public override bool AllowsRelativeDrop => true;
|
||||
|
||||
public static BaseBoat FindBoatAt(IPoint2D loc, Map map)
|
||||
public static BaseBoat FindBoatAt(Point3D loc, Map map)
|
||||
{
|
||||
var sector = map.GetSector(loc);
|
||||
|
||||
|
|
@ -1512,7 +1512,7 @@ namespace Server.Multis
|
|||
var adx = dx.Abs();
|
||||
var ady = dy.Abs();
|
||||
|
||||
var dir = Utility.GetDirection(this, new Point2D(x, y));
|
||||
var dir = Utility.GetDirection(Location.X, Location.Y, x, y);
|
||||
var iDir = (int)dir;
|
||||
|
||||
// Compute the maximum distance we can travel without going too far away
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace Server.Multis
|
|||
return;
|
||||
}
|
||||
|
||||
if (from.Region.IsPartOf<HouseRegion>() || BaseBoat.FindBoatAt(from, from.Map) != null)
|
||||
if (from.Region.IsPartOf<HouseRegion>() || BaseBoat.FindBoatAt(from.Location, from.Map) != null)
|
||||
{
|
||||
from.SendLocalizedMessage(
|
||||
1010568,
|
||||
|
|
|
|||
|
|
@ -707,16 +707,16 @@ namespace Server.Multis
|
|||
return fromSecures + fromVendors + fromLockdowns + fromMovingCrate;
|
||||
}
|
||||
|
||||
public override bool InRange(IPoint2D from, int range)
|
||||
public bool InRange(Point2D from, int range)
|
||||
{
|
||||
if (Region == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
foreach (var rect in Region.Area)
|
||||
{
|
||||
// TODO: Convert this to 3D - https://github.com/modernuo/ModernUO/issues/29
|
||||
if (from.X >= rect.Start.X - range && from.Y >= rect.Start.Y - range && from.X < rect.End.X + range && from.Y < rect.End.Y + range)
|
||||
{
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Server.Network
|
|||
continue;
|
||||
}
|
||||
|
||||
if (sendLocations && Utility.InUpdateRange(from, m) && from.CanSee(m))
|
||||
if (sendLocations && Utility.InUpdateRange(from.Location, m.Location) && from.CanSee(m))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ namespace Server.Network
|
|||
continue;
|
||||
}
|
||||
|
||||
if (Utility.InUpdateRange(from, mob) && from.CanSee(mob))
|
||||
if (Utility.InUpdateRange(from.Location, mob.Location) && from.CanSee(mob))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,30 +11,10 @@ namespace Server.SkillHandlers
|
|||
SkillInfo.Table[46].Callback = OnUse;
|
||||
}
|
||||
|
||||
public static bool CheckOkayHolding(Item item)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item is Spellbook || item is Runebook)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Core.AOS && item is BaseWeapon weapon && weapon.Attributes.SpellChanneling != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Core.AOS && item is BaseArmor armor && armor.Attributes.SpellChanneling != 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
public static bool CheckOkayHolding(Item item) =>
|
||||
item is null or Spellbook or Runebook
|
||||
|| Core.AOS && item is BaseWeapon weapon && weapon.Attributes.SpellChanneling != 0
|
||||
|| Core.AOS && item is BaseArmor armor && armor.Attributes.SpellChanneling != 0;
|
||||
|
||||
public static TimeSpan OnUse(Mobile m)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ namespace Server.Spells.Spellweaving
|
|||
{
|
||||
var master = pet.GetMaster();
|
||||
|
||||
if (master?.NetState != null && Utility.InUpdateRange(pet, master))
|
||||
if (master?.NetState != null && Utility.InUpdateRange(pet.Location, master.Location))
|
||||
{
|
||||
master.CloseGump<PetResurrectGump>();
|
||||
master.SendGump(new PetResurrectGump(master, pet, hitsScalar));
|
||||
|
|
@ -125,7 +125,7 @@ namespace Server.Spells.Spellweaving
|
|||
{
|
||||
var friend = friends[i];
|
||||
|
||||
if (friend.NetState != null && Utility.InUpdateRange(pet, friend))
|
||||
if (friend.NetState != null && Utility.InUpdateRange(pet.Location, friend.Location))
|
||||
{
|
||||
friend.CloseGump<PetResurrectGump>();
|
||||
friend.SendGump(new PetResurrectGump(friend, pet));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue